Skip to content

Commit 4a10163

Browse files
committed
Feat: add mc processing to track-v0 task
1 parent d8e267d commit 4a10163

File tree

5 files changed

+164
-56
lines changed

5 files changed

+164
-56
lines changed

PWGCF/Femto/Core/pairBuilder.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ class PairTrackV0Builder
497497
mPairHistManagerMe.setMass(confTrackSelection.pdgCodeAbs.value, confV0Selection.pdgCodeAbs.value);
498498
mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1);
499499
mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value);
500+
mPc.template init<mode>(confPairCuts);
500501

501502
// setup mixing
502503
mMixingPolicy = static_cast<pairhistmanager::MixingPolicy>(confMixing.policy.value);
@@ -516,6 +517,19 @@ class PairTrackV0Builder
516517
pairprocesshelpers::processSameEvent<mode>(trackSlice, v0Slice, trackTable, col, mTrackHistManager, mV0HistManager, mPairHistManagerSe, mCprSe, mPc);
517518
}
518519

520+
template <modes::Mode mode, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
521+
void processSameEvent(T1 const& col, T2 const& mcCols, T3 const& trackTable, T4& trackPartition, T5 const& /*v0table*/, T6& v0Partition, T7 const& mcParticles, T8 const& mcMothers, T9 const& mcPartonicMothers, T10& cache)
522+
{
523+
auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache);
524+
auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache);
525+
if (trackSlice.size() == 0 || v0Slice.size() == 0) {
526+
return;
527+
}
528+
mColHistManager.template fill<mode>(col, mcCols);
529+
mCprSe.setMagField(col.magField());
530+
pairprocesshelpers::processSameEvent<mode>(trackSlice, v0Slice, trackTable, mcParticles, mcMothers, mcPartonicMothers, col, mcCols, mTrackHistManager, mV0HistManager, mPairHistManagerSe, mCprSe, mPc);
531+
}
532+
519533
template <modes::Mode mode, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
520534
void processMixedEvent(T1 const& cols, T2& trackTable, T3& trackPartition, T4& v0Partition, T5& cache, T6& binsVtxMult, T7& binsVtxCent, T8& binsVtxMultCent)
521535
{
@@ -534,6 +548,24 @@ class PairTrackV0Builder
534548
}
535549
}
536550

551+
template <modes::Mode mode, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
552+
void processMixedEvent(T1 const& cols, T2 const& mcCols, T3& trackTable, T4& trackPartition, T5& v0Partition, T6 const& mcParticles, T7& cache, T8& binsVtxMult, T9& binsVtxCent, T10& binsVtxMultCent)
553+
{
554+
switch (mMixingPolicy) {
555+
case static_cast<int>(pairhistmanager::kVtxMult):
556+
pairprocesshelpers::processMixedEvent<mode>(cols, mcCols, trackPartition, v0Partition, trackTable, mcParticles, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc);
557+
break;
558+
case static_cast<int>(pairhistmanager::kVtxCent):
559+
pairprocesshelpers::processMixedEvent<mode>(cols, mcCols, trackPartition, v0Partition, trackTable, mcParticles, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc);
560+
break;
561+
case static_cast<int>(pairhistmanager::kVtxMultCent):
562+
pairprocesshelpers::processMixedEvent<mode>(cols, mcCols, trackPartition, v0Partition, trackTable, mcParticles, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc);
563+
break;
564+
default:
565+
LOG(fatal) << "Invalid binning policiy specifed. Breaking...";
566+
}
567+
}
568+
537569
private:
538570
colhistmanager::CollisionHistManager mColHistManager;
539571
trackhistmanager::TrackHistManager<prefixTrack> mTrackHistManager;

PWGCF/Femto/Core/pairCleaner.h

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class BasePairCleaner
5353
template <typename T1, typename T2, typename T3>
5454
bool pairHasCommonAncestor(T1 const& particle1, T2 const& particle2, T3 const& /*partonicMothers*/) const
5555
{
56-
// if one of the two particles has no associated partonic mother, we cannot now if they have a common anchestor, so we break out with false
56+
// if one of the two particles has no associated partonic mother, we cannot now if they have a common anchestor, so we break out with false
5757
if (!particle1.has_fMcPartMoth() || !particle2.has_fMcPartMoth()) {
5858
return false;
5959
}
@@ -67,7 +67,7 @@ class BasePairCleaner
6767
template <typename T1, typename T2, typename T3>
6868
bool pairHasNonCommonAncestor(T1 const& particle1, T2 const& particle2, T3 const& /*partonicMothers*/) const
6969
{
70-
// if one of the two particles has no associated partonic mother, we cannot now if they have a common anchestor, so we break out with false
70+
// if one of the two particles has no associated partonic mother, we cannot now if they have a non-common anchestor, so we break out with false
7171
if (!particle1.has_fMcPartMoth() || !particle2.has_fMcPartMoth()) {
7272
return false;
7373
}
@@ -96,8 +96,7 @@ class TrackTrackPairCleaner : public BasePairCleaner
9696
template <typename T1, typename T2, typename T3, typename T4>
9797
bool isCleanPair(T1 const& track1, T2 const& track2, T3 const& /*trackTable*/, T4 const& partonicMothers) const
9898
{
99-
bool isCleanPair = this->isCleanTrackPair(track1, track2);
100-
if (!isCleanPair) {
99+
if (!this->isCleanTrackPair(track1, track2)) {
101100
return false;
102101
}
103102
// pair is clean
@@ -138,6 +137,23 @@ class TrackV0PairCleaner : public BasePairCleaner // also works for particles de
138137
auto negDaughter = trackTable.rawIteratorAt(v0.negDauId() - trackTable.offset());
139138
return (this->isCleanTrackPair(posDaughter, track) && this->isCleanTrackPair(negDaughter, track));
140139
}
140+
141+
template <typename T1, typename T2, typename T3, typename T4>
142+
bool isCleanPair(T1 const& track1, T2 const& v0, T3 const& trackTable, T4 const& partonicMothers) const
143+
{
144+
if (!this->isCleanPair(track1, v0, trackTable)) {
145+
return false;
146+
}
147+
// pair is clean
148+
// no check if we require common or non-common ancestry
149+
if (mMixPairsWithCommonAncestor) {
150+
return this->pairHasCommonAncestor(track1, v0, partonicMothers);
151+
}
152+
if (mMixPairsWithNonCommonAncestor) {
153+
return this->pairHasNonCommonAncestor(track1, v0, partonicMothers);
154+
}
155+
return true;
156+
}
141157
};
142158

143159
class TrackKinkPairCleaner : public BasePairCleaner

PWGCF/Femto/Tasks/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ o2physics_add_dpl_workflow(femto-pair-track-track
3939
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
4040
COMPONENT_NAME Analysis)
4141

42-
# o2physics_add_dpl_workflow(femto-pair-track-v0
43-
# SOURCES femtoPairTrackV0.cxx
44-
# PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
45-
# COMPONENT_NAME Analysis)
46-
#
42+
o2physics_add_dpl_workflow(femto-pair-track-v0
43+
SOURCES femtoPairTrackV0.cxx
44+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
45+
COMPONENT_NAME Analysis)
46+
4747
# o2physics_add_dpl_workflow(femto-pair-track-two-track-resonance
4848
# SOURCES femtoPairTrackTwoTrackResonance.cxx
4949
# PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore

PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ struct FemtoPairTrackTrack {
6868
colhistmanager::ConfCollisionBinning confCollisionBinning;
6969

7070
// setup tracks
71-
trackbuilder::ConfTrackSelection1 trackSelections1;
71+
trackbuilder::ConfTrackSelection1 confTrackSelections1;
7272
trackhistmanager::ConfTrackBinning1 confTrackBinning1;
73-
trackbuilder::ConfTrackSelection2 trackSelections2;
73+
trackbuilder::ConfTrackSelection2 confTrackSelections2;
7474
trackhistmanager::ConfTrackBinning2 confTrackBinning2;
7575

76-
Partition<FemtoTracks> trackPartition1 = MAKE_TRACK_PARTITION(trackSelections1);
77-
Partition<FemtoTracks> trackPartition2 = MAKE_TRACK_PARTITION(trackSelections2);
76+
Partition<FemtoTracks> trackPartition1 = MAKE_TRACK_PARTITION(confTrackSelections1);
77+
Partition<FemtoTracks> trackPartition2 = MAKE_TRACK_PARTITION(confTrackSelections2);
7878
Preslice<FemtoTracks> perColtracks = aod::femtobase::stored::fColId;
7979

80-
Partition<FemtoTracksWithLabel> trackWithLabelPartition1 = MAKE_TRACK_PARTITION(trackSelections1);
81-
Partition<FemtoTracksWithLabel> trackWithLabelPartition2 = MAKE_TRACK_PARTITION(trackSelections2);
80+
Partition<FemtoTracksWithLabel> trackWithLabelPartition1 = MAKE_TRACK_PARTITION(confTrackSelections1);
81+
Partition<FemtoTracksWithLabel> trackWithLabelPartition2 = MAKE_TRACK_PARTITION(confTrackSelections2);
8282
Preslice<FemtoTracksWithLabel> perColtracksWithLabel = aod::femtobase::stored::fColId;
8383

8484
// setup pairs
@@ -109,14 +109,11 @@ struct FemtoPairTrackTrack {
109109

110110
void init(InitContext&)
111111
{
112-
113112
if ((doprocessSameEvent + doprocessSameEventMc) > 1 || (doprocessMixedEvent + doprocessMixedEventMc) > 1) {
114113
LOG(fatal) << "More than 1 same or mixed event process function is activated. Breaking...";
115114
}
116-
117115
bool processData = doprocessSameEvent || doprocessMixedEvent;
118116
bool processMc = doprocessSameEventMc || doprocessMixedEventMc;
119-
120117
if (processData && processMc) {
121118
LOG(fatal) << "Both data and mc processing is activated. Breaking...";
122119
}
@@ -135,13 +132,13 @@ struct FemtoPairTrackTrack {
135132
auto trackHistSpec1 = trackhistmanager::makeTrackHistSpecMap(confTrackBinning1);
136133
auto trackHistSpec2 = trackhistmanager::makeTrackHistSpecMap(confTrackBinning2);
137134
auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning);
138-
pairTrackTrackBuilder.init<modes::Mode::kAnalysis>(&hRegistry, trackSelections1, trackSelections2, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec);
135+
pairTrackTrackBuilder.init<modes::Mode::kAnalysis>(&hRegistry, confTrackSelections1, confTrackSelections2, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec);
139136
} else {
140137
auto colHistSpec = colhistmanager::makeColMcHistSpecMap(confCollisionBinning);
141138
auto trackHistSpec1 = trackhistmanager::makeTrackMcHistSpecMap(confTrackBinning1);
142139
auto trackHistSpec2 = trackhistmanager::makeTrackMcHistSpecMap(confTrackBinning2);
143140
auto pairHistSpec = pairhistmanager::makePairMcHistSpecMap(confPairBinning);
144-
pairTrackTrackBuilder.init<modes::Mode::kAnalysis_Mc>(&hRegistry, trackSelections1, trackSelections2, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec);
141+
pairTrackTrackBuilder.init<modes::Mode::kAnalysis_Mc>(&hRegistry, confTrackSelections1, confTrackSelections2, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec);
145142
}
146143
hRegistry.print();
147144
};

0 commit comments

Comments
 (0)