Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 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 @@ -48,7 +48,7 @@

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

Check failure on line 51 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 +64,8 @@

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

Check failure on line 67 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 68 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 +130,8 @@

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

Check failure on line 133 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 134 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 +157,8 @@
LambdaToPPiTight,
AntiLambdaToPiPLoose,
AntiLambdaToPiPTight,
D0barToKPiExclusive
D0barToKPiExclusive,
PhiToKKPID3Mixed
};
} // namespace cf2prongtrack
DECLARE_SOA_TABLE(CF2ProngTracks, "AOD", "CF2PRONGTRACK", //! Reduced track table
Expand All @@ -183,8 +184,8 @@

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

Check failure on line 187 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 188 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
117 changes: 117 additions & 0 deletions PWGCF/TableProducer/filter2Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,20 @@
// #define FLOAT_PRECISION 0xFFFFFFF0
#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};

namespace o2::aod
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.

Move this to the data model, then we do not need to have it twice

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.

Ok

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

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

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 +159,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 +242,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 245 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 248 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 +789,106 @@
}
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;
// float multiplicity = getMultiplicity(collision1);
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.

Remove the commented lines

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.

Ok

// int bin = configurableBinningDerived.getBin(std::tuple(collision1.posZ(), multiplicity));
// float eventWeight = 1.0f / it.currentWindowNeighbours();
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

Copy link
Copy Markdown
Contributor

@jgrosseo jgrosseo Apr 13, 2026

Choose a reason for hiding this comment

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

const auto& p1 = cftrack1.track()

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.

Done

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;
}

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);

if (selectionPID3(p1) && selectionPID3(p2)) {
if (selectionSys(p1, false, false) && selectionSys(p2, false, false)) {
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.

Move the selections before the computations (line 867)

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.

Ok

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
Loading