5353#include < cmath>
5454#include < cstddef>
5555#include < cstdint>
56+ #include < cstdio>
5657#include < cstdlib>
5758#include < numeric>
5859#include < string>
@@ -189,20 +190,23 @@ struct PiKpRAA {
189190
190191 // Configurables Event Selection
191192 Configurable<bool > isNoCollInTimeRangeStrict{" isNoCollInTimeRangeStrict" , true , " use isNoCollInTimeRangeStrict?" };
193+ Configurable<bool > selNoSameBunchPileup{" selNoSameBunchPileup" , true , " selNoSameBunchPileup?" };
194+ Configurable<bool > selIsGoodZvtxFT0vsPV{" selIsGoodZvtxFT0vsPV" , true , " selIsGoodZvtxFT0vsPV?" };
192195 Configurable<bool > isNoCollInTimeRangeStandard{" isNoCollInTimeRangeStandard" , false , " use isNoCollInTimeRangeStandard?" };
193196 Configurable<bool > isNoCollInRofStrict{" isNoCollInRofStrict" , true , " use isNoCollInRofStrict?" };
194197 Configurable<bool > isNoCollInRofStandard{" isNoCollInRofStandard" , false , " use isNoCollInRofStandard?" };
195198 Configurable<bool > isNoHighMultCollInPrevRof{" isNoHighMultCollInPrevRof" , true , " use isNoHighMultCollInPrevRof?" };
196199 Configurable<bool > isNoCollInTimeRangeNarrow{" isNoCollInTimeRangeNarrow" , false , " use isNoCollInTimeRangeNarrow?" };
197200 Configurable<bool > isOccupancyCut{" isOccupancyCut" , true , " Occupancy cut?" };
198201 Configurable<bool > isCentSel{" isCentSel" , true , " Centrality selection?" };
202+ Configurable<bool > selHasFT0{" selHasFT0" , true , " Has FT0?" };
199203 Configurable<bool > isT0Ccent{" isT0Ccent" , true , " Use T0C-based centrality?" };
200204 Configurable<bool > isZvtxPosSel{" isZvtxPosSel" , true , " Zvtx position selection?" };
205+ Configurable<bool > isZvtxPosSelMC{" isZvtxPosSelMC" , true , " Zvtx position selection for MC events?" };
201206 Configurable<bool > selINELgt0{" selINELgt0" , true , " Select INEL > 0?" };
202207 Configurable<bool > isApplyFT0CbasedOccupancy{" isApplyFT0CbasedOccupancy" , false , " T0C Occu cut" };
203208 Configurable<bool > applyNchSel{" applyNchSel" , false , " Use mid-rapidity-based Nch selection" };
204209 Configurable<bool > skipRecoColGTOne{" skipRecoColGTOne" , true , " Remove collisions if reconstructed more than once" };
205- Configurable<std::string> detector4Calibration{" detector4Calibration" , " T0M" , " Detector for nSigma-Nch rejection" };
206210
207211 // Event selection
208212 Configurable<float > posZcut{" posZcut" , +10.0 , " z-vertex position cut" };
@@ -256,6 +260,7 @@ struct PiKpRAA {
256260 NoHighMultCollInPrevRof,
257261 NoCollInTimeRangeNarrow,
258262 OccuCut,
263+ HasFT0,
259264 Centrality,
260265 VtxZ,
261266 NchSel,
@@ -361,6 +366,8 @@ struct PiKpRAA {
361366 registry.add (" EventCounter" , " ;;Events" , kTH1F , {axisEvent});
362367 registry.add (" zPos" , " With Event Selection;;Entries;" , kTH1F , {axisZpos});
363368 registry.add (" T0Ccent" , " ;;Entries" , kTH1F , {axisCent});
369+ registry.add (" T0CcentVsFoundFT0" , " ;Found(=1.5) NOT Found(=0.5);" , kTH2F , {{{axisCent}, {2 , 0 , 2 }}});
370+ registry.add (" NchVsCent" , " Measured Nch v.s. Centrality (At least Once Rec. Coll. + Sel. criteria);;Nch" , kTH2F , {{axisCent, {nBinsNch, minNch, maxNch}}});
364371 registry.add (" NclVsEtaPID" , " ;#eta;Ncl used for PID" , kTH2F , {{{axisEta}, {161 , -0.5 , 160.5 }}});
365372 registry.add (" NclVsEtaPIDp" , " ;#eta;#LTNcl#GT used for PID" , kTProfile , {axisEta});
366373 registry.add (" dcaVsPtPi" , " Primary pions;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm);Centrality Perc.;" , kTH3F , {axisPt, axisDCAxy, axisCent});
@@ -379,10 +386,11 @@ struct PiKpRAA {
379386 x->SetBinLabel (9 , " NoHighMultCollInPrevRof" );
380387 x->SetBinLabel (10 , " NoCollInTimeRangeNarrow" );
381388 x->SetBinLabel (11 , " Occupancy Cut" );
382- x->SetBinLabel (12 , " Cent. Sel." );
383- x->SetBinLabel (13 , " VtxZ Sel." );
384- x->SetBinLabel (14 , " Nch Sel." );
385- x->SetBinLabel (15 , " INEL > 0" );
389+ x->SetBinLabel (12 , " Has FT0?" );
390+ x->SetBinLabel (13 , " Cent. Sel." );
391+ x->SetBinLabel (14 , " VtxZ Sel." );
392+ x->SetBinLabel (15 , " Nch Sel." );
393+ x->SetBinLabel (16 , " INEL > 0" );
386394
387395 if (doprocessCalibrationAndV0s) {
388396 registry.add (" NchVsNPV" , " ;Nch; NPV;" , kTH2F , {{{nBinsNPV, minNpv, maxNpv}, {nBinsNch, minNch, maxNch}}});
@@ -564,7 +572,6 @@ struct PiKpRAA {
564572 LOG (info) << " \t ccdbNoLaterThan=" << ccdbNoLaterThan.value ;
565573 LOG (info) << " \t applyNchSel=" << applyNchSel.value ;
566574 LOG (info) << " \t selINELgt0=" << selINELgt0.value ;
567- LOG (info) << " \t detector4Calibration=" << detector4Calibration.value ;
568575 LOG (info) << " \t v0TypeSelection=" << static_cast <int >(v0Selections.v0TypeSelection );
569576 LOG (info) << " \t selElecFromGammas=" << v0Selections.selElecFromGammas ;
570577 LOG (info) << " \t requireITShit=" << v0Selections.requireITShit ;
@@ -633,6 +640,7 @@ struct PiKpRAA {
633640 const uint64_t timeStamp{foundBC.timestamp ()};
634641 const int magField{getMagneticField (timeStamp)};
635642 const double nPV{collision.multNTracksPVeta1 () / 1 .};
643+ const float centrality{isT0Ccent ? collision.centFT0C () : collision.centFT0M ()};
636644
637645 if (applyNchSel) {
638646 const int nextRunNumber{foundBC.runNumber ()};
@@ -687,7 +695,7 @@ struct PiKpRAA {
687695
688696 registry.fill (HIST (" NchVsNPV" ), nPV, nch);
689697 registry.fill (HIST (" zPos" ), collision.posZ ());
690- const float centrality{isT0Ccent ? collision. centFT0C () : collision. centFT0M ()} ;
698+ registry. fill ( HIST ( " NchVsCent " ), centrality, nch) ;
691699
692700 if (v0Selections.applyPhiCut ) {
693701 const int nextRunNumber{foundBC.runNumber ()};
@@ -1407,34 +1415,48 @@ struct PiKpRAA {
14071415 nChMC++;
14081416 }
14091417
1418+ // ---------------------------
1419+ // Only MC events with |Vtx Z| < 10 cm
1420+ // ---------------------------
1421+ if (isZvtxPosSelMC && (std::fabs (mccollision.posZ ()) > posZcut)) {
1422+ return ;
1423+ }
1424+
14101425 // ---------------------------
14111426 // Only INEL > 0 generated events
14121427 // ---------------------------
14131428 if (selINELgt0) {
14141429 if (!(nChMC > kZeroInt )) {
14151430 return ;
14161431 }
1417- } // selINELgt0 condition: Rejects all NON-INEL > 0
1432+ }
14181433
14191434 const auto & nRecColls{collisions.size ()};
14201435 registry.fill (HIST (" NumberOfRecoCollisions" ), nRecColls);
14211436
1437+ // ---------------------------
14221438 // Only Generated evets with at least one reconstrued collision
1439+ // ---------------------------
14231440 if (nRecColls > kZeroInt ) {
14241441
14251442 // Finds the collisions with the largest number of contributors
14261443 // in case nRecColls is larger than One
14271444 int biggestNContribs{-1 };
14281445 int bestCollisionIndex{-1 };
14291446 for (const auto & collision : collisions) {
1447+
1448+ const float centrality{isT0Ccent ? collision.centFT0C () : collision.centFT0M ()};
1449+ if (selHasFT0 && !collision.has_foundFT0 ()) {
1450+ continue ;
1451+ }
1452+
14301453 if (biggestNContribs < collision.numContrib ()) {
14311454 biggestNContribs = collision.numContrib ();
14321455 bestCollisionIndex = collision.globalIndex ();
14331456 }
14341457
14351458 // Needed to calculate denominator of the Event Splitting correction
14361459 if (isEventSelected (collision)) {
1437- const float centrality{isT0Ccent ? collision.centFT0C () : collision.centFT0M ()};
14381460 registry.fill (HIST (" Centrality_AllRecoEvt" ), centrality);
14391461 }
14401462 }
@@ -1445,7 +1467,20 @@ struct PiKpRAA {
14451467 // ---------------------------
14461468 for (const auto & collision : collisions) {
14471469
1448- // Choose the collisions with the largest number of contributors
1470+ const float centrality{isT0Ccent ? collision.centFT0C () : collision.centFT0M ()};
1471+
1472+ // ---------------------------
1473+ // Reject collisions if has_foundFT0() returns false
1474+ // ---------------------------
1475+ if (selHasFT0 && !collision.has_foundFT0 ()) {
1476+ registry.fill (HIST (" T0CcentVsFoundFT0" ), centrality, 0.5 );
1477+ continue ;
1478+ }
1479+ registry.fill (HIST (" T0CcentVsFoundFT0" ), centrality, 1.5 );
1480+
1481+ // ---------------------------
1482+ // Pick the collisions with the largest number of contributors
1483+ // ---------------------------
14491484 if (bestCollisionIndex != collision.globalIndex ()) {
14501485 continue ;
14511486 }
@@ -1472,7 +1507,6 @@ struct PiKpRAA {
14721507 // Needed to construct the correlation between MC Nch v.s. centrality
14731508 // ---------------------------
14741509
1475- const float centrality{isT0Ccent ? collision.centFT0C () : collision.centFT0M ()};
14761510 registry.fill (HIST (" Centrality_WRecoEvt" ), centrality);
14771511 registry.fill (HIST (" zPosMC" ), mccollision.posZ ());
14781512
@@ -1634,6 +1668,7 @@ struct PiKpRAA {
16341668 // This is needed for the number of the Tracking Efficiency
16351669 // and the spectra to be corrected
16361670 // ---------------------------
1671+ int nCh{0 };
16371672 for (const auto & track : groupedTracks) {
16381673 // Track Selection
16391674 if (track.eta () < v0Selections.minEtaDaughter || track.eta () > v0Selections.maxEtaDaughter )
@@ -1693,6 +1728,7 @@ struct PiKpRAA {
16931728 registry.fill (HIST (" NclVsPhip" ), pOrPt, phiPrime, ncl);
16941729 registry.fill (HIST (" NclVsEtaPID" ), eta, ncl);
16951730 registry.fill (HIST (" NclVsEtaPIDp" ), eta, ncl);
1731+ nCh++;
16961732
16971733 bool isPrimary{false };
16981734 if (particle.isPhysicalPrimary ())
@@ -1729,6 +1765,7 @@ struct PiKpRAA {
17291765 }
17301766 registry.fill (HIST (" PtResolution" ), particle.pt (), (track.pt () - particle.pt ()) / particle.pt ());
17311767 } // Loop over reconstructed tracks
1768+ registry.fill (HIST (" NchVsCent" ), centrality, nCh);
17321769 } // Loop over Reco. Collisions: Only the collisions with the largest number of contributors
17331770 } // If condition: Only simulated evets with at least one reconstrued collision
17341771
@@ -2093,15 +2130,19 @@ struct PiKpRAA {
20932130 }
20942131 registry.fill (HIST (" EventCounter" ), EvCutLabel::SelEigth);
20952132
2096- if (!col.selection_bit (o2::aod::evsel::kNoSameBunchPileup )) {
2097- return false ;
2133+ if (selNoSameBunchPileup) {
2134+ if (!col.selection_bit (o2::aod::evsel::kNoSameBunchPileup )) {
2135+ return false ;
2136+ }
2137+ registry.fill (HIST (" EventCounter" ), EvCutLabel::NoSameBunchPileup);
20982138 }
2099- registry.fill (HIST (" EventCounter" ), EvCutLabel::NoSameBunchPileup);
21002139
2101- if (!col.selection_bit (o2::aod::evsel::kIsGoodZvtxFT0vsPV )) {
2102- return false ;
2140+ if (selIsGoodZvtxFT0vsPV) {
2141+ if (!col.selection_bit (o2::aod::evsel::kIsGoodZvtxFT0vsPV )) {
2142+ return false ;
2143+ }
2144+ registry.fill (HIST (" EventCounter" ), EvCutLabel::IsGoodZvtxFT0vsPV);
21032145 }
2104- registry.fill (HIST (" EventCounter" ), EvCutLabel::IsGoodZvtxFT0vsPV);
21052146
21062147 if (isNoCollInTimeRangeStrict) {
21072148 if (!col.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStrict )) {
@@ -2155,6 +2196,13 @@ struct PiKpRAA {
21552196 registry.fill (HIST (" EventCounter" ), EvCutLabel::OccuCut);
21562197 }
21572198
2199+ if (selHasFT0) {
2200+ if (!col.has_foundFT0 ()) {
2201+ return false ;
2202+ }
2203+ registry.fill (HIST (" EventCounter" ), EvCutLabel::HasFT0);
2204+ }
2205+
21582206 if (isCentSel) {
21592207 if (col.centFT0C () < minT0CcentCut || col.centFT0C () > maxT0CcentCut) {
21602208 return false ;
0 commit comments