1313// / \brief Tasks that reads the track tables and creates track triplets; only three identical particles can be used
1414// / \author Laura Serksnyte, TU München, laura.serksnyte@tum.de
1515
16- #include < vector>
17- #include < string>
16+ #include " PWGCF/DataModel/FemtoDerived.h"
17+ #include " PWGCF/FemtoDream/Core/femtoDreamContainerThreeBody.h"
18+ #include " PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h"
19+ #include " PWGCF/FemtoDream/Core/femtoDreamEventHisto.h"
20+ #include " PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h"
21+ #include " PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h"
22+ #include " PWGCF/FemtoDream/Core/femtoDreamUtils.h"
23+
24+ #include " Framework/ASoAHelpers.h"
1825#include " Framework/AnalysisTask.h"
19- #include " Framework/runDataProcessing.h"
2026#include " Framework/HistogramRegistry.h"
21- #include " Framework/ASoAHelpers .h"
27+ #include " Framework/O2DatabasePDGPlugin .h"
2228#include " Framework/RunningWorkflowInfo.h"
2329#include " Framework/StepTHn.h"
24- #include " Framework/O2DatabasePDGPlugin.h"
25- #include " TDatabasePDG.h"
30+ #include " Framework/runDataProcessing.h"
2631
27- #include " PWGCF/DataModel/FemtoDerived.h"
28- #include " PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h"
29- #include " PWGCF/FemtoDream/Core/femtoDreamEventHisto.h"
30- #include " PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h"
31- #include " PWGCF/FemtoDream/Core/femtoDreamContainerThreeBody.h"
32- #include " PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h"
33- #include " PWGCF/FemtoDream/Core/femtoDreamUtils.h"
32+ #include < string>
33+ #include < vector>
3434
3535using namespace o2 ;
3636using namespace o2 ::analysis::femtoDream;
@@ -49,6 +49,10 @@ struct femtoDreamProducerTaskForSpecificAnalysis {
4949 float mMassOne = -999 , mMassTwo = -999 , mMassThree = -999 ;
5050 int collisions = 0 ;
5151
52+ // Require bitmask selection for candidates
53+ Configurable<bool > ConfRequireBitmask{" ConfRequireBitmask" , false , " Require bitmask selection for candidates" };
54+
55+ // Number of candidates required
5256 Configurable<int > ConfNumberOfTracks{" ConfNumberOfTracks" , 3 , " Number of tracks" };
5357 Configurable<int > ConfNumberOfV0{" ConfNumberOfV0" , 0 , " Number of V0" };
5458 Configurable<int > ConfNumberOfCascades{" ConfNumberOfCascades" , 0 , " Number of Cascades" };
@@ -57,6 +61,8 @@ struct femtoDreamProducerTaskForSpecificAnalysis {
5761 Configurable<float > ConfPIDthrMom{" ConfPIDthrMom" , 1 .f , " Momentum threshold from which TPC and TOF are required for PID" };
5862 Configurable<o2::aod::femtodreamparticle::cutContainerType> ConfTPCPIDBit{" ConfTPCPIDBit" , 16 , " PID TPC bit from cutCulator " };
5963 Configurable<o2::aod::femtodreamparticle::cutContainerType> ConfTPCTOFPIDBit{" ConfTPCTOFPIDBit" , 8 , " PID TPCTOF bit from cutCulator" };
64+ Configurable<o2::aod::femtodreamparticle::cutContainerType> ConfCutPart{" ConfCutPart" , 0 , " Track - Selection bit from cutCulator for part" };
65+ Configurable<o2::aod::femtodreamparticle::cutContainerType> ConfCutPartAntiPart{" ConfCutPartAntiPart" , 0 , " Track - Selection bit from cutCulator for antipart" };
6066
6167 // / Partition for selected particles
6268 Partition<aod::FDParticles> SelectedParts = (aod::femtodreamparticle::partType == uint8_t (aod::femtodreamparticle::ParticleType::kTrack )) &&
@@ -67,6 +73,12 @@ struct femtoDreamProducerTaskForSpecificAnalysis {
6773 Configurable<float > Conf_maxInvMass_V0{" Conf_maxInvMass_V0" , 1.15 , " Maximum invariant mass of V0 (particle)" };
6874 Configurable<float > Conf_minInvMassAnti_V0{" Conf_minInvMassAnti_V0" , 1.08 , " Minimum invariant mass of V0 (antiparticle)" };
6975 Configurable<float > Conf_maxInvMassAnti_V0{" Conf_maxInvMassAnti_V0" , 1.15 , " Maximum invariant mass of V0 (antiparticle)" };
76+ Configurable<o2::aod::femtodreamparticle::cutContainerType> ConfCutV0_SameForAntipart{" ConfCutV0_SameForAntipart" , 0 , " V0 - Selection bit from cutCulator for part/antipart" };
77+ Configurable<o2::aod::femtodreamparticle::cutContainerType> Conf_ChildPos_CutV0{" Conf_ChildPos_CutV0" , 149 , " Selection bit for positive child of V0" };
78+ Configurable<o2::aod::femtodreamparticle::cutContainerType> Conf_ChildPos_TPCBitV0{" Conf_ChildPos_TPCBitV0" , 2 , " PID TPC bit for positive child of V0" };
79+ Configurable<o2::aod::femtodreamparticle::cutContainerType> Conf_ChildNeg_CutV0{" Conf_ChildNeg_CutV0" , 149 , " Selection bit for negative child of V0" };
80+ Configurable<o2::aod::femtodreamparticle::cutContainerType> Conf_ChildNeg_TPCBitV0{" Conf_ChildNeg_TPCBitV0" , 2 , " PID TPC bit for negative child of V0" };
81+
7082 // / Cascade selection
7183 Configurable<float > Conf_minInvMass_Cascade{" Conf_minInvMass_Cascade" , 1.2 , " Minimum invariant mass of Cascade (particle)" };
7284 Configurable<float > Conf_maxInvMass_Cascade{" Conf_maxInvMass_Cascade" , 1.5 , " Maximum invariant mass of Cascade (particle)" };
@@ -95,8 +107,12 @@ struct femtoDreamProducerTaskForSpecificAnalysis {
95107 void init (InitContext&)
96108 {
97109 EventRegistry.add (" hStatistiscs" , " ;bin;Entries" , kTH1F , {{3 , 0 , 3 }});
98- // get bit for the collision mask
110+ // Never run V0s and Cascades together as this will DOUBLE the track number and induce self correlations
111+ if ((doprocessCollisionsWithNTracksAndNCascades && doprocessCollisionsWithNTracksAndNV0)) {
112+ LOG (fatal) << " Never run V0s and Cascades together as this will DOUBLE the track number and induce self correlations!" ;
113+ }
99114 }
115+
100116 // / This function stores accepted collisions in derived data
101117 // / @tparam PartitionType
102118 // / @tparam PartType
@@ -105,27 +121,57 @@ struct femtoDreamProducerTaskForSpecificAnalysis {
105121 // / @param groupSelectedV0s partition for the second particle passed by the process function
106122 // / @param parts femtoDreamParticles table
107123 template <bool isMC, typename PartitionType, typename PartType>
108- void createSpecifiedDerivedData (o2::aod::FDCollision& col, PartitionType groupSelectedTracks, PartitionType groupSelectedV0s, PartType parts)
124+ void createSpecifiedDerivedData (const o2::aod::FDCollision& col, PartitionType groupSelectedTracks, PartitionType groupSelectedV0s, PartType parts)
109125 {
110126 // / check tracks
111127 int tracksCount = 0 ;
112128 int antitracksCount = 0 ;
113- for (auto & part : groupSelectedTracks) {
129+ for (const auto & part : groupSelectedTracks) {
114130 if (part.cut () & 1 ) {
115- antitracksCount++;
131+ if (!ConfRequireBitmask || ncheckbit (part.cut (), ConfCutPartAntiPart)) {
132+ antitracksCount++;
133+ }
116134 } else {
117- tracksCount++;
135+ if (!ConfRequireBitmask || ncheckbit (part.cut (), ConfCutPart)) {
136+ tracksCount++;
137+ }
118138 }
119139 }
120140
121141 // / check V0s
122142 int V0Count = 0 ;
123143 int antiV0Count = 0 ;
124- for (auto & V0 : groupSelectedV0s) {
144+ for (const auto & V0 : groupSelectedV0s) {
125145 if ((V0.mLambda () > Conf_minInvMass_V0) && (V0.mLambda () < Conf_maxInvMass_V0)) {
126- V0Count++;
146+ if (ConfRequireBitmask) {
147+ if (ncheckbit (V0.cut (), ConfCutV0_SameForAntipart)) {
148+ const auto & posChild = parts.iteratorAt (V0.index () - 2 );
149+ const auto & negChild = parts.iteratorAt (V0.index () - 1 );
150+ if (((posChild.cut () & Conf_ChildPos_CutV0) == Conf_ChildPos_CutV0 &&
151+ (posChild.pidcut () & Conf_ChildPos_TPCBitV0) == Conf_ChildPos_TPCBitV0 &&
152+ (negChild.cut () & Conf_ChildNeg_CutV0) == Conf_ChildNeg_CutV0 &&
153+ (negChild.pidcut () & Conf_ChildNeg_TPCBitV0) == Conf_ChildNeg_TPCBitV0)) {
154+ V0Count++;
155+ }
156+ }
157+ } else {
158+ V0Count++;
159+ }
127160 } else if ((V0.mAntiLambda () > Conf_minInvMassAnti_V0) && (V0.mAntiLambda () < Conf_maxInvMassAnti_V0)) {
128- antiV0Count++;
161+ if (ConfRequireBitmask) {
162+ if (ncheckbit (V0.cut (), ConfCutV0_SameForAntipart)) {
163+ const auto & posChild = parts.iteratorAt (V0.index () - 2 );
164+ const auto & negChild = parts.iteratorAt (V0.index () - 1 );
165+ if (((posChild.cut () & Conf_ChildPos_CutV0) == Conf_ChildPos_CutV0 &&
166+ (posChild.pidcut () & Conf_ChildNeg_TPCBitV0) == Conf_ChildNeg_TPCBitV0 && // exchanged values because checking antiparticle daughters and pid of particles exchange
167+ (negChild.cut () & Conf_ChildNeg_CutV0) == Conf_ChildNeg_CutV0 &&
168+ (negChild.pidcut () & Conf_ChildPos_TPCBitV0) == Conf_ChildPos_TPCBitV0)) { // exchanged values because checking antiparticle daughters and pid of particles exchange
169+ antiV0Count++;
170+ }
171+ }
172+ } else {
173+ antiV0Count++;
174+ }
129175 }
130176 }
131177
@@ -134,7 +180,7 @@ struct femtoDreamProducerTaskForSpecificAnalysis {
134180 if ((V0Count >= ConfNumberOfV0 && tracksCount >= ConfNumberOfTracks) || (antiV0Count >= ConfNumberOfV0 && antitracksCount >= ConfNumberOfTracks)) {
135181 EventRegistry.fill (HIST (" hStatistiscs" ), 1 );
136182 outputCollision (col.posZ (), col.multV0M (), col.multNtr (), col.sphericity (), col.magField ());
137- for (auto & femtoParticle : parts) {
183+ for (const auto & femtoParticle : parts) {
138184 if (aod::femtodreamparticle::ParticleType::kTrack == femtoParticle.partType ()) {
139185 std::vector<int > childIDs = {0 , 0 };
140186 outputParts (outputCollision.lastIndex (),
@@ -197,8 +243,8 @@ struct femtoDreamProducerTaskForSpecificAnalysis {
197243 // / process function to create derived data with only collisions containing n tracks
198244 // / \param col subscribe to the collision table (Data)
199245 // / \param parts subscribe to the femtoDreamParticleTable
200- void processCollisionsWithNTracksAndNV0 (o2::aod::FDCollision& col,
201- o2::aod::FDParticles& parts)
246+ void processCollisionsWithNTracksAndNV0 (const o2::aod::FDCollision& col,
247+ const o2::aod::FDParticles& parts)
202248 {
203249 EventRegistry.fill (HIST (" hStatistiscs" ), 0 );
204250 auto thegroupSelectedParts = SelectedParts->sliceByCached (aod::femtodreamparticle::fdCollisionId, col.globalIndex (), cache);
@@ -216,13 +262,13 @@ struct femtoDreamProducerTaskForSpecificAnalysis {
216262 // / @param groupSelectedV0s partition for the second particle passed by the process function
217263 // / @param parts femtoDreamParticles table
218264 template <bool isMC, typename PartitionType, typename PartType>
219- void createSpecifiedDerivedData_TrkCascade (o2::aod::FDCollision& col, PartitionType groupSelectedTracks, PartitionType groupSelectedCascades, PartType parts)
265+ void createSpecifiedDerivedData_TrkCascade (const o2::aod::FDCollision& col, PartitionType groupSelectedTracks, PartitionType groupSelectedCascades, PartType parts)
220266 {
221267
222268 // / check tracks
223269 int tracksCount = 0 ;
224270 int antitracksCount = 0 ;
225- for (auto & part : groupSelectedTracks) {
271+ for (const auto & part : groupSelectedTracks) {
226272 if (part.cut () & 1 ) {
227273 antitracksCount++;
228274 } else {
@@ -233,7 +279,7 @@ struct femtoDreamProducerTaskForSpecificAnalysis {
233279 // / check Cascades
234280 int CascadeCount = 0 ;
235281 int antiCascadeCount = 0 ;
236- for (auto & casc : groupSelectedCascades) {
282+ for (const auto & casc : groupSelectedCascades) {
237283 if ((casc.cut () & kSignPlusMask ) == kSignPlusMask ) {
238284 CascadeCount++;
239285 } else {
@@ -247,7 +293,7 @@ struct femtoDreamProducerTaskForSpecificAnalysis {
247293 EventRegistry.fill (HIST (" hStatistiscs" ), 1 );
248294 outputCollision (col.posZ (), col.multV0M (), col.multNtr (), col.sphericity (), col.magField ());
249295
250- for (auto & femtoParticle : parts) {
296+ for (const auto & femtoParticle : parts) {
251297 if (aod::femtodreamparticle::ParticleType::kTrack == femtoParticle.partType ()) {
252298 std::vector<int > childIDs = {0 , 0 };
253299 outputParts (outputCollision.lastIndex (),
@@ -330,8 +376,8 @@ struct femtoDreamProducerTaskForSpecificAnalysis {
330376 // / process function to create derived data with only collisions containing n tracks
331377 // / \param col subscribe to the collision table (Data)
332378 // / \param parts subscribe to the femtoDreamParticleTable
333- void processCollisionsWithNTracksAndNCascades (o2::aod::FDCollision& col,
334- o2::aod::FDParticles& parts)
379+ void processCollisionsWithNTracksAndNCascades (const o2::aod::FDCollision& col,
380+ const o2::aod::FDParticles& parts)
335381 {
336382 EventRegistry.fill (HIST (" hStatistiscs" ), 0 );
337383 auto thegroupSelectedParts = SelectedParts->sliceByCached (aod::femtodreamparticle::fdCollisionId, col.globalIndex (), cache);
0 commit comments