@@ -124,7 +124,7 @@ struct NucleitpcPbPb {
124124 Configurable<float > cfgCutEta{" cfgCutEta" , 0 .9f , " Eta range for tracks" };
125125 Configurable<bool > cfgetaRequire{" cfgetaRequire" , true , " eta cut require" };
126126 Configurable<bool > cfgetaRequireMC{" cfgetaRequireMC" , true , " eta cut require for generated particles" };
127- Configurable<bool > cfgrapidityRequireMC{ " cfgrapidityRequireMC " , true , " rapidity cut require for generated particles" };
127+ Configurable<bool > cfgRapidityRequireMC{ " cfgRapidityRequireMC " , true , " rapidity cut require for generated particles" };
128128 Configurable<bool > cfgUsePVcontributors{" cfgUsePVcontributors" , true , " use tracks that are PV contibutors" };
129129 Configurable<bool > cfgITSrequire{" cfgITSrequire" , true , " Additional cut on ITS require" };
130130 Configurable<bool > cfgTPCrequire{" cfgTPCrequire" , true , " Additional cut on TPC require" };
@@ -146,6 +146,7 @@ struct NucleitpcPbPb {
146146 Configurable<bool > cfgDCAwithptRequire{" cfgDCAwithptRequire" , true , " Require DCA cuts with pt dependance" };
147147 Configurable<bool > cfgRequirebetaplot{" cfgRequirebetaplot" , true , " Require beta plot" };
148148 Configurable<bool > cfgIncludeMaterialInEfficiency{" cfgIncludeMaterialInEfficiency" , true , " Require from material in efficiency" };
149+ Configurable<bool > cfgMasscut{" cfgMasscut" , true , " Require mass cut on He4 particles" };
149150
150151 Configurable<LabeledArray<double >> cfgBetheBlochParams{" cfgBetheBlochParams" , {kBetheBlochDefault [0 ], nParticles, nBetheParams, particleNames, betheBlochParNames}, " TPC Bethe-Bloch parameterisation for light nuclei" };
151152 Configurable<LabeledArray<double >> cfgTrackPIDsettings{" cfgTrackPIDsettings" , {kTrackPIDSettings [0 ], nParticles, nTrkSettings, particleNames, trackPIDsettingsNames}, " track selection and PID criteria" };
@@ -155,7 +156,7 @@ struct NucleitpcPbPb {
155156 Configurable<bool > cfgFillmassnsigma{" cfgFillmassnsigma" , true , " Fill mass vs nsigma histograms" };
156157 Configurable<float > centcut{" centcut" , 80 .0f , " centrality cut" };
157158 Configurable<float > cfgCutRapidity{" cfgCutRapidity" , 0 .5f , " Rapidity range" };
158- Configurable<float > cfgtpcNClsFindable{" cfgtpcNClsFindable" , 0 .8f , " tpcNClsFindable over crossedRows" }; // ///////////
159+ Configurable<float > cfgtpcNClsFindable{" cfgtpcNClsFindable" , 0 .8f , " tpcNClsFindable over crossedRows" };
159160 Configurable<float > cfgZvertex{" cfgZvertex" , 10 , " Min Z Vertex" };
160161 Configurable<bool > cfgZvertexRequire{" cfgZvertexRequire" , true , " Pos Z cut require" };
161162 Configurable<bool > cfgZvertexRequireMC{" cfgZvertexRequireMC" , true , " Pos Z cut require for generated particles" };
@@ -179,7 +180,7 @@ struct NucleitpcPbPb {
179180 ConfigurableAxis speciesTrackingAxis{" speciesTrackingAxis" , {11 , -0.5 , 10.5 }, " particle type 0: pion, 1: proton, 2: deuteron, 3: triton, 4:He3, 5:He4" };
180181 ConfigurableAxis axisDCA{" axisDCA" , {400 , -10 ., 10 .}, " DCA axis" };
181182 ConfigurableAxis particleAntiAxis{" particleAntiAxis" , {2 , 0 , 2 }, " Particle/Anti-particle" }; // 0 = particle, 1 = anti-particle
182- ConfigurableAxis decayTypeAxis{" decayTypeAxis" , {3 , 0 , 3 }, " Decay type" }; // 0 = primary, 1 = from decay
183+ ConfigurableAxis decayTypeAxis{" decayTypeAxis" , {3 , - 0.5 , 2.5 }, " Decay type" }; // 0 = primary, 1 = from decay, 2 = material
183184
184185 // CCDB
185186 Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -281,6 +282,8 @@ struct NucleitpcPbPb {
281282 histomc.add (" histPIDtrackanti" , " delta pt vs pt rec" , HistType::kTH2F , {{1000 , 0 , 10 , " p_{T}(reco)" }, {9 , -0.5 , 8.5 , " p_{T}(reco) - p_{T}(gen)" }});
282283 histomc.add (" histPIDtrackhe4" , " delta pt vs pt rec" , HistType::kTH2F , {{1000 , 0 , 10 , " p_{T}(reco)" }, {9 , -0.5 , 8.5 , " p_{T}(reco) - p_{T}(gen)" }});
283284 histomc.add (" histPIDtrackantihe4" , " delta pt vs pt rec" , HistType::kTH2F , {{1000 , 0 , 10 , " p_{T}(reco)" }, {9 , -0.5 , 8.5 , " p_{T}(reco) - p_{T}(gen)" }});
285+ histomc.add (" hEventLossDenom" , " Event loss denominator" , kTH1F , {axisCent});
286+ histomc.add (" hEventLossNumer" , " Event loss numerator" , kTH1F , {axisCent});
284287
285288 histomc.add (" histWeakDecayPtHe3" , " Pt distribution of He3 from weak decays" , kTH2F , {ptAxis, axisCent});
286289 histomc.add (" histWeakDecayPtAntiHe3" , " Pt distribution of Anti-He3 from weak decays" , kTH2F , {ptAxis, axisCent});
@@ -296,8 +299,6 @@ struct NucleitpcPbPb {
296299 histomc.add (" histProcess23Details" , " Process 23 details" , kTH2F , {{4 , 0.5 , 4.5 , " particle type" }, {100 , 0 , 10 , " p_{T}" }});
297300 histomc.add (" histAllMaterialSecondariesGen" , " All material secondaries (gen)" , kTH3F , {{100 , 0 , 10 , " p_{T}" }, {20 , -1 , 1 , " y" }, {5 , -0.5 , 4.5 , " type" }});
298301 histomc.add (" histAllMaterialSecondariesReco" , " All material secondaries (reco)" , kTH3F , {{100 , 0 , 10 , " p_{T}" }, {20 , -1 , 1 , " y" }, {5 , -0.5 , 4.5 , " type" }});
299-
300- // Add axis labels for type: 0=unknown, 1=He3, 2=anti-He3, 3=He4, 4=anti-He4
301302 }
302303 }
303304 // ----------------------------------------------------------------------------------------------------------------
@@ -435,20 +436,50 @@ struct NucleitpcPbPb {
435436
436437 mcCollInfos.clear ();
437438 mcCollInfos.resize (mcCollisions.size ());
439+
440+ // Store centrality regardless of cuts FIRST
438441 for (auto const & collision : collisions) {
439442 int mcCollIdx = collision.mcCollisionId ();
440443 if (mcCollIdx < 0 || mcCollIdx >= static_cast <int >(mcCollisions.size ())) {
441444 continue ;
442445 }
443- if (std::abs (collision.posZ ()) > cfgZvertex)
446+ // STORE CENTRALITY WITHOUT ANY CUTS
447+ mcCollInfos[mcCollIdx].centrality = collision.centFT0C ();
448+ }
449+
450+ // FILL DENOMINATOR: ONCE per MC collision
451+ for (size_t i = 0 ; i < mcCollInfos.size (); i++) {
452+ if (mcCollInfos[i].centrality >= 0 ) { // Only if we found a matching collision
453+ histomc.fill (HIST (" hEventLossDenom" ), mcCollInfos[i].centrality );
454+ }
455+ }
456+
457+ for (auto const & collision : collisions) {
458+ int mcCollIdx = collision.mcCollisionId ();
459+ if (mcCollIdx < 0 || mcCollIdx >= static_cast <int >(mcCollisions.size ())) {
444460 continue ;
445- if (!collision.sel8 ())
461+ }
462+ if (std::abs (collision.posZ ()) > cfgZvertex && cfgZvertexRequireMC)
463+ continue ;
464+ if (!collision.sel8 () && cfgsel8Require)
446465 continue ;
447466 if (collision.centFT0C () > centcut)
448467 continue ;
449468
469+ // Additional cuts
470+ if (removeITSROFrameBorder && !collision.selection_bit (aod::evsel::kNoITSROFrameBorder ))
471+ continue ;
472+ if (removeNoSameBunchPileup && !collision.selection_bit (aod::evsel::kNoSameBunchPileup ))
473+ continue ;
474+ if (requireIsGoodZvtxFT0vsPV && !collision.selection_bit (aod::evsel::kIsGoodZvtxFT0vsPV ))
475+ continue ;
476+ if (requireIsVertexITSTPC && !collision.selection_bit (aod::evsel::kIsVertexITSTPC ))
477+ continue ;
478+ if (removeNoTimeFrameBorder && !collision.selection_bit (aod::evsel::kNoTimeFrameBorder ))
479+ continue ;
480+
450481 mcCollInfos[mcCollIdx].passedEvSel = true ;
451- mcCollInfos[mcCollIdx].centrality = collision. centFT0C ( );
482+ histomc. fill ( HIST ( " hEventLossNumer " ), mcCollInfos[mcCollIdx].centrality );
452483 }
453484 for (auto const & mcCollision : mcCollisions) {
454485 size_t idx = mcCollision.globalIndex ();
@@ -464,10 +495,20 @@ struct NucleitpcPbPb {
464495 int pdgCode = mcParticle.pdgCode ();
465496 bool isHe3 = (std::abs (pdgCode) == particlePdgCodes.at (4 ));
466497 bool isHe4 = (std::abs (pdgCode) == particlePdgCodes.at (5 ));
467-
468- if (std::abs (mcParticle.eta ()) > cfgCutEta)
498+ if (mcParticle.isPhysicalPrimary ()) {
499+ if (pdgCode == particlePdgCodes.at (4 )) {
500+ histomc.fill (HIST (" histPtgenHe3" ), mcParticle.pt ());
501+ } else if (pdgCode == -particlePdgCodes.at (4 )) {
502+ histomc.fill (HIST (" histPtgenAntiHe3" ), mcParticle.pt ());
503+ } else if (pdgCode == particlePdgCodes.at (5 )) {
504+ histomc.fill (HIST (" histPtgenHe4" ), mcParticle.pt ());
505+ } else if (pdgCode == -particlePdgCodes.at (5 )) {
506+ histomc.fill (HIST (" histPtgenAntiHe4" ), mcParticle.pt ());
507+ }
508+ }
509+ if (std::abs (mcParticle.eta ()) > cfgCutEta && cfgetaRequireMC)
469510 continue ;
470- if (std::abs (mcParticle.y ()) > cfgCutRapidity)
511+ if (std::abs (mcParticle.y ()) > cfgCutRapidity && cfgRapidityRequireMC )
471512 continue ;
472513 bool isMaterialSecondary = false ;
473514 if (!mcParticle.isPhysicalPrimary () && (isHe3 || isHe4)) {
@@ -543,7 +584,7 @@ struct NucleitpcPbPb {
543584 particleType = he4;
544585
545586 if (particleType >= 0 ) {
546- float centrality = mcCollInfos[idx].passedEvSel ? mcCollInfos[idx]. centrality : - 1 . 0f ;
587+ float centrality = mcCollInfos[idx].centrality ; // Always use actual centrality
547588 histomc.fill (HIST (" hDenomSignalLoss" ), particleType, mcParticle.pt (), mcParticle.y (), centrality, particleAnti, decayType);
548589
549590 if (mcCollInfos[idx].passedEvSel ) {
@@ -563,15 +604,6 @@ struct NucleitpcPbPb {
563604 histomc.fill (HIST (" histWeakDecayPtAntiHe4" ), mcParticle.pt (), centrality);
564605 }
565606 }
566- if (pdgCode == particlePdgCodes.at (4 )) {
567- histomc.fill (HIST (" histPtgenHe3" ), mcParticle.pt ());
568- } else if (pdgCode == -particlePdgCodes.at (4 )) {
569- histomc.fill (HIST (" histPtgenAntiHe3" ), mcParticle.pt ());
570- } else if (pdgCode == particlePdgCodes.at (5 )) {
571- histomc.fill (HIST (" histPtgenHe4" ), mcParticle.pt ());
572- } else if (pdgCode == -particlePdgCodes.at (5 )) {
573- histomc.fill (HIST (" histPtgenAntiHe4" ), mcParticle.pt ());
574- }
575607 }
576608 }
577609 for (auto const & mcCollision : mcCollisions) {
@@ -933,6 +965,7 @@ struct NucleitpcPbPb {
933965 {
934966 if (!track.hasTOF () || !cfgFillmass)
935967 return ;
968+
936969 float beta{o2::pid::tof::Beta::GetBeta (track)};
937970 const float eps = 1e-6f ;
938971 if (beta < eps || beta > 1 .0f - eps)
@@ -942,7 +975,16 @@ struct NucleitpcPbPb {
942975 float massTOF = p * charge * std::sqrt (1 .f / (beta * beta) - 1 .f );
943976 // get PDG mass
944977 float pdgMass = particleMasses[species];
945- float massDiff = massTOF - pdgMass;
978+ float massDiff = 0.0 ;
979+ if (species != he4) {
980+ massDiff = massTOF - pdgMass;
981+ }
982+ if (species == he4) {
983+ if ((massTOF * massTOF < 6.5 && massTOF * massTOF < 9.138 ) && cfgMasscut)
984+ return ;
985+ massDiff = massTOF - pdgMass;
986+ }
987+
946988 float ptMomn;
947989 setTrackParCov (track, mTrackParCov );
948990 mTrackParCov .setPID (track.pidForTracking ());
0 commit comments