Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion PWGCF/DataModel/CorrelationsDerived.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

namespace cfmcparticle
{
DECLARE_SOA_INDEX_COLUMN(CFMcCollision, cfMcCollision); //! Index to reduced MC collision

Check failure on line 34 in PWGCF/DataModel/CorrelationsDerived.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(Pt, pt, float); //! pT (GeV/c)
DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity
DECLARE_SOA_COLUMN(Phi, phi, float); //! Phi angle
Expand All @@ -46,9 +46,17 @@
mcparticle::IsPhysicalPrimary<mcparticle::Flags>);
using CFMcParticle = CFMcParticles::iterator;

namespace cfmultiplicity
{
DECLARE_SOA_COLUMN(Multiplicity, multiplicity, float);
}
DECLARE_SOA_TABLE(CFMultiplicities, "AOD", "CFMULTIPLICITY", cfmultiplicity::Multiplicity);

using CFMultiplicity = CFMultiplicities::iterator;

namespace cfcollision
{
DECLARE_SOA_INDEX_COLUMN(CFMcCollision, cfMcCollision); //! Index to reduced MC collision

Check failure on line 59 in PWGCF/DataModel/CorrelationsDerived.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(Multiplicity, multiplicity, float); //! Centrality/multiplicity value
} // namespace cfcollision
DECLARE_SOA_TABLE(CFCollisions, "AOD", "CFCOLLISION", //! Reduced collision table
Expand All @@ -64,8 +72,8 @@

namespace cftrack
{
DECLARE_SOA_INDEX_COLUMN(CFCollision, cfCollision); //! Index to collision

Check failure on line 75 in PWGCF/DataModel/CorrelationsDerived.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_INDEX_COLUMN(CFMcParticle, cfMCParticle); //! Index to MC particle

Check failure on line 76 in PWGCF/DataModel/CorrelationsDerived.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(Pt, pt, float); //! pT (GeV/c)
DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity
DECLARE_SOA_COLUMN(Phi, phi, float); //! Phi angle
Expand Down Expand Up @@ -130,8 +138,8 @@

namespace cf2prongtrack
{
DECLARE_SOA_INDEX_COLUMN_FULL(CFTrackProng0, cfTrackProng0, int, CFTracks, "_0"); //! Index to prong 1 CFTrack

Check failure on line 141 in PWGCF/DataModel/CorrelationsDerived.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_INDEX_COLUMN_FULL(CFTrackProng1, cfTrackProng1, int, CFTracks, "_1"); //! Index to prong 2 CFTrack

Check failure on line 142 in PWGCF/DataModel/CorrelationsDerived.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(Pt, pt, float); //! pT (GeV/c)
DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity
DECLARE_SOA_COLUMN(Phi, phi, float); //! Phi angle
Expand All @@ -157,7 +165,8 @@
LambdaToPPiTight,
AntiLambdaToPiPLoose,
AntiLambdaToPiPTight,
D0barToKPiExclusive
D0barToKPiExclusive,
PhiToKKPID3Mixed
};
} // namespace cf2prongtrack
DECLARE_SOA_TABLE(CF2ProngTracks, "AOD", "CF2PRONGTRACK", //! Reduced track table
Expand All @@ -183,8 +192,8 @@

namespace cf2prongmcpart
{
DECLARE_SOA_INDEX_COLUMN_FULL(CFParticleDaugh0, cfParticleDaugh0, int, CFMcParticles, "_0"); //! Index to prong 1 CFMcParticle

Check failure on line 195 in PWGCF/DataModel/CorrelationsDerived.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_INDEX_COLUMN_FULL(CFParticleDaugh1, cfParticleDaugh1, int, CFMcParticles, "_1"); //! Index to prong 2 CFMcParticle

Check failure on line 196 in PWGCF/DataModel/CorrelationsDerived.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(Decay, decay, uint8_t); //! Particle decay and flags
DECLARE_SOA_DYNAMIC_COLUMN(McDecay, mcDecay, [](uint8_t decay) -> uint8_t { return decay & 0x7f; }); //! MC particle decay
enum ParticleDecayFlags {
Expand Down
104 changes: 104 additions & 0 deletions PWGCF/TableProducer/filter2Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};

struct Filter2Prong {
SliceCache cache;

O2_DEFINE_CONFIGURABLE(cfgVerbosity, int, 0, "Verbosity level (0 = major, 1 = per collision)")
O2_DEFINE_CONFIGURABLE(cfgYMax, float, -1.0f, "Maximum candidate rapidity")
O2_DEFINE_CONFIGURABLE(cfgImPart1Mass, float, o2::constants::physics::MassKPlus, "Daughter particle 1 mass in GeV")
Expand Down Expand Up @@ -146,6 +148,10 @@
O2_DEFINE_CONFIGURABLE(applyTOF, bool, false, "Flag for applying TOF");
} grpPhi;

O2_DEFINE_CONFIGURABLE(cfgNoMixedEvents, int, 5, "Number of mixed events per event for mixed phi building")
ConfigurableAxis axisVertexMix{"axisVertexMix", {7, -7, 7}, "vertex axis for phi event mixing"};
ConfigurableAxis axisMultiplicityMix{"axisMultiplicityMix", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1}, "multiplicity axis for phi event mixing"};

HfHelper hfHelper;
Produces<aod::CF2ProngTracks> output2ProngTracks;
Produces<aod::CF2ProngTrackmls> output2ProngTrackmls;
Expand Down Expand Up @@ -225,10 +231,10 @@
prongCFId[0], prongCFId[1], c.pt(), c.eta(), c.phi(), hfHelper.invMassD0ToPiK(c), aod::cf2prongtrack::D0ToPiK);
if constexpr (std::experimental::is_detected<HasMLProb, typename HFCandidatesType::iterator>::value) {
mlvecd.clear();
for (const float val : c.mlProbD0())

Check failure on line 234 in PWGCF/TableProducer/filter2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
mlvecd.push_back(val);
mlvecdbar.clear();
for (const float val : c.mlProbD0bar())

Check failure on line 237 in PWGCF/TableProducer/filter2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
mlvecdbar.push_back(val);
output2ProngTrackmls(cfcollisions.begin().globalIndex(), mlvecd, mlvecdbar);
}
Expand Down Expand Up @@ -772,6 +778,104 @@
}
PROCESS_SWITCH(Filter2Prong, processDataPhiV0, "Process data Phi and V0 candidates with invariant mass method", false);

using DerivedCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::CFMultiplicities>;
void processDataPhiMixed(DerivedCollisions const& collisions, Filter2Prong::PIDTrack const& tracksP, aod::CFTrackRefs const& cftracks)
{
auto getMultiplicity = [](auto const& col) {
return col.multiplicity();
};
using BinningTypeDerived = FlexibleBinningPolicy<std::tuple<decltype(getMultiplicity)>, aod::collision::PosZ, decltype(getMultiplicity)>;
BinningTypeDerived configurableBinningDerived{{getMultiplicity}, {axisVertexMix, axisMultiplicityMix}, true};
auto tracksTuple = std::make_tuple(cftracks, cftracks);
using TA = std::tuple_element<0, decltype(tracksTuple)>::type;
using TB = std::tuple_element<std::tuple_size_v<decltype(tracksTuple)> - 1, decltype(tracksTuple)>::type;
Pair<DerivedCollisions, TA, TB, BinningTypeDerived> pairs{configurableBinningDerived, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip

o2::aod::ITSResponse itsResponse;

for (auto it = pairs.begin(); it != pairs.end(); it++) {
auto& [collision1, tracks1, collision2, tracks2] = *it;

if (!(collision1.sel8() &&
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may later need to run it with a larger cfgNoMixedEvents because we skip events here

Copy link
Copy Markdown
Collaborator Author

@prottayCMT prottayCMT Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes currently I am using the same set of event cuts as we applied for the same events....do you want to remove these?

collision1.selection_bit(aod::evsel::kNoSameBunchPileup) &&
collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) &&
collision1.selection_bit(aod::evsel::kIsGoodITSLayersAll))) {
continue;
}

if (!(collision2.sel8() &&
collision2.selection_bit(aod::evsel::kNoSameBunchPileup) &&
collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) &&
collision2.selection_bit(aod::evsel::kIsGoodITSLayersAll))) {
continue;
}

for (const auto& cftrack1 : tracks1) {
const auto& p1 = tracksP.iteratorAt(cftrack1.trackId() - tracksP.begin().globalIndex());

if (p1.sign() != 1) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cftrack2.track().sign() does not work?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it works but as I am using the p1 for the rest of the logic (tracks cuts, pid...) i am using this object consistently

continue;
}
if (!selectionTrack(p1)) {
continue;
}
if (grpPhi.ITSPIDSelection &&
p1.p() < grpPhi.ITSPIDPthreshold.value &&
!(itsResponse.nSigmaITS<o2::track::PID::Kaon>(p1) > grpPhi.lowITSPIDNsigma.value &&
itsResponse.nSigmaITS<o2::track::PID::Kaon>(p1) < grpPhi.highITSPIDNsigma.value)) {
continue;
}
if (grpPhi.removefaketrack && isFakeTrack(p1)) {
continue;
}

for (const auto& cftrack2 : tracks2) {
const auto& p2 = tracksP.iteratorAt(cftrack2.trackId() - tracksP.begin().globalIndex());

if (p2.sign() != -1) {
continue;
}
if (!selectionTrack(p2)) {
continue;
}
if (grpPhi.ITSPIDSelection &&
p2.p() < grpPhi.ITSPIDPthreshold.value &&
!(itsResponse.nSigmaITS<o2::track::PID::Kaon>(p2) > grpPhi.lowITSPIDNsigma.value &&
itsResponse.nSigmaITS<o2::track::PID::Kaon>(p2) < grpPhi.highITSPIDNsigma.value)) {
continue;
}
if (grpPhi.removefaketrack && isFakeTrack(p2)) {
continue;
}
if (!selectionPair(p1, p2)) {
continue;
}

if (selectionPID3(p1) && selectionPID3(p2)) {
if (selectionSys(p1, false, false) && selectionSys(p2, false, false)) {
ROOT::Math::PtEtaPhiMVector vec1(p1.pt(), p1.eta(), p1.phi(), cfgImPart1Mass);
ROOT::Math::PtEtaPhiMVector vec2(p2.pt(), p2.eta(), p2.phi(), cfgImPart2Mass);
ROOT::Math::PtEtaPhiMVector s = vec1 + vec2;

if (s.M() < grpPhi.ImMinInvMassPhiMeson || s.M() > grpPhi.ImMaxInvMassPhiMeson) {
continue;
}

float phi = RecoDecay::constrainAngle(s.Phi(), 0.0f);

output2ProngTracks(collision1.globalIndex(),
cftrack1.globalIndex(), cftrack2.globalIndex(),
s.pt(), s.eta(), phi, s.M(),
aod::cf2prongtrack::PhiToKKPID3Mixed);
}
}
}
}
}
}

PROCESS_SWITCH(Filter2Prong, processDataPhiMixed, "Process mixed-event phi candidates using O2 framework", false);

// Phi and V0s invariant mass method candidate finder. Only works for non-identical daughters of opposite charge for now.
void processDataV0(aod::Collisions::iterator const& collision, aod::BCsWithTimestamps const&, aod::CFCollRefs const& cfcollisions, aod::CFTrackRefs const& cftracks, Filter2Prong::PIDTrack const&, aod::V0Datas const& V0s)
{
Expand Down
15 changes: 2 additions & 13 deletions PWGCF/TableProducer/filterCorrelations.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,6 @@ using namespace o2::math_utils::detail;
#define FLOAT_PRECISION 0xFFFFFFF0
#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};

namespace o2::aod
{
namespace cfmultiplicity
{
DECLARE_SOA_COLUMN(Multiplicity, multiplicity, float); //! Centrality/multiplicity value
} // namespace cfmultiplicity
DECLARE_SOA_TABLE(CFMultiplicities, "AOD", "CFMULTIPLICITY", cfmultiplicity::Multiplicity); //! Transient multiplicity table

using CFMultiplicity = CFMultiplicities::iterator;
} // namespace o2::aod

struct FilterCF {
Service<o2::framework::O2DatabasePDG> pdg;

Expand Down Expand Up @@ -106,7 +95,7 @@ struct FilterCF {

// TODO how to have this in the second task? For now they are copied
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPt);
Filter trackSelection = (requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true);
Filter trackSelection = (requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t)true);

Filter mcCollisionFilter = nabs(aod::mccollision::posZ) < cfgCutVertex;

Expand Down Expand Up @@ -570,7 +559,7 @@ struct MultiplicitySelector {
O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks")

Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPt);
Filter trackSelection = (requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true);
Filter trackSelection = (requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t)true);

void init(InitContext&)
{
Expand Down
Loading