@@ -360,6 +360,7 @@ struct PidFlowPtCorr {
360360 ConfigurableAxis cfgaxisAbundancePr{" cfgaxisAbundancePr" , {100 , 0 , 50 }, " axis for Abundance Pr" };
361361
362362 Configurable<bool > cfgOutPutAbundanceDis{" cfgOutPutAbundanceDis" , false , " out put hists for pid particle Abundance QA" };
363+ Configurable<bool > cfgOutputAbundanceYields{" cfgOutputAbundanceYields" , false , " Output detector-PID abundance yields for pion, kaon, proton, and unidentified" };
363364 } particleAbundanceOpts;
364365
365366 ConfigurableAxis cfgaxisVertex{" cfgaxisVertex" , {20 , -10 , 10 }, " vertex axis for histograms" };
@@ -511,8 +512,10 @@ struct PidFlowPtCorr {
511512 kPidRespPion = 0 ,
512513 kPidRespKaon ,
513514 kPidRespProton ,
514- kPidRespUnidentified ,
515- kPidRespNRecoBins
515+ kPidRespOther ,
516+ kPidRespNTrueBins ,
517+ kPidRespUnidentified = kPidRespOther ,
518+ kPidRespNRecoBins = kPidRespNTrueBins
516519 };
517520
518521 // graphs for NUE / NUA
@@ -659,6 +662,16 @@ struct PidFlowPtCorr {
659662 // hist for Pr eff
660663 registry.add (" correction/hPtCentMcRecPr" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
661664 registry.add (" correction/hPtCentMcGenPr" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
665+ // Charged-track reconstruction efficiency split by MC true species.
666+ // Detector PID is deliberately not used for these numerators.
667+ registry.add (" correction/hPtCentMcRecTruePi" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
668+ registry.add (" correction/hPtCentMcRecTrueKa" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
669+ registry.add (" correction/hPtCentMcRecTruePr" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
670+ registry.add (" correction/hPtCentMcRecTrueOther" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
671+ registry.add (" correction/hPtCentMcGenTruePi" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
672+ registry.add (" correction/hPtCentMcGenTrueKa" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
673+ registry.add (" correction/hPtCentMcGenTruePr" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
674+ registry.add (" correction/hPtCentMcGenTrueOther" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
662675 } // cfgoutputMC
663676
664677 if (switchsOpts.cfgOutPutMC1D .value ) {
@@ -706,6 +719,12 @@ struct PidFlowPtCorr {
706719 registry.add (" abundance/hNumOfKaEventCount" , " " , {HistType::kTH1D , {particleAbundanceOpts.cfgaxisAbundanceKa }});
707720 registry.add (" abundance/hNumOfPrEventCount" , " " , {HistType::kTH1D , {particleAbundanceOpts.cfgaxisAbundancePr }});
708721 }
722+ if (particleAbundanceOpts.cfgOutputAbundanceYields .value ) {
723+ registry.add (" abundance/hPtCentDataPi" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
724+ registry.add (" abundance/hPtCentDataKa" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
725+ registry.add (" abundance/hPtCentDataPr" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
726+ registry.add (" abundance/hPtCentDataUnidentified" , " " , {HistType::kTH2D , {cfgaxisPt, axisMultiplicity}});
727+ }
709728
710729 // set bin label for hEventCount
711730 // processdata
@@ -802,15 +821,17 @@ struct PidFlowPtCorr {
802821 // end set bin label for eventcount
803822
804823 if (switchsOpts.cfgAddPidResponseMatrixHistograms .value ) {
805- registry.add (" pidResponseMatrix/hPidResponseMatrix" , " PID response matrix;true PID;reconstructed PID" , {HistType::kTH2D , {{3 , -0.5 , 2 .5 }, {4 , -0.5 , 3.5 }}});
806- registry.add (" pidResponseMatrix/hPidResponseMatrixRecPtCent" , " PID response matrix vs reconstructed pT and centrality;true PID;reconstructed PID;p_{T}^{rec} (GeV/#it{c});Centrality (%)" , {HistType::kTHnSparseF , {{3 , -0.5 , 2 .5 }, {4 , -0.5 , 3.5 }, cfgaxisPt, axisMultiplicity}});
824+ registry.add (" pidResponseMatrix/hPidResponseMatrix" , " PID response matrix;true PID;reconstructed PID" , {HistType::kTH2D , {{4 , -0.5 , 3 .5 }, {4 , -0.5 , 3.5 }}});
825+ registry.add (" pidResponseMatrix/hPidResponseMatrixRecPtCent" , " PID response matrix vs reconstructed pT and centrality;true PID;reconstructed PID;p_{T}^{rec} (GeV/#it{c});Centrality (%)" , {HistType::kTHnSparseF , {{4 , -0.5 , 3 .5 }, {4 , -0.5 , 3.5 }, cfgaxisPt, axisMultiplicity}});
807826
808827 auto setPidResponseLabels = [](TAxis* axis, bool includeUnidentified) {
809828 axis->SetBinLabel (kPidRespPion + 1 , " Pion" );
810829 axis->SetBinLabel (kPidRespKaon + 1 , " Kaon" );
811830 axis->SetBinLabel (kPidRespProton + 1 , " Proton" );
812831 if (includeUnidentified) {
813832 axis->SetBinLabel (kPidRespUnidentified + 1 , " Unidentified" );
833+ } else {
834+ axis->SetBinLabel (kPidRespOther + 1 , " Other" );
814835 }
815836 };
816837 setPidResponseLabels (registry.get <TH2 >(HIST (" pidResponseMatrix/hPidResponseMatrix" ))->GetXaxis (), false );
@@ -1401,7 +1422,7 @@ struct PidFlowPtCorr {
14011422 case PDG_t::kProton :
14021423 return kPidRespProton ;
14031424 default :
1404- return - 1 ;
1425+ return kPidRespOther ;
14051426 }
14061427 }
14071428
@@ -1419,6 +1440,12 @@ struct PidFlowPtCorr {
14191440 }
14201441 }
14211442
1443+ template <typename McParticle>
1444+ int getTrueSpeciesBin (McParticle const & particle)
1445+ {
1446+ return getPidResponseTrueBin (particle.pdgCode ());
1447+ }
1448+
14221449 // pid util function
14231450
14241451 // other utils
@@ -2716,6 +2743,17 @@ struct PidFlowPtCorr {
27162743 // Unified PID logic (configurable)
27172744 // ------------------------------
27182745 int pid = getPidConfigurable (track);
2746+ if (particleAbundanceOpts.cfgOutputAbundanceYields .value && withinPtRefGlobal) {
2747+ if (pid == MyParticleType::kPion ) {
2748+ registry.fill (HIST (" abundance/hPtCentDataPi" ), track.pt (), cent);
2749+ } else if (pid == MyParticleType::kKaon ) {
2750+ registry.fill (HIST (" abundance/hPtCentDataKa" ), track.pt (), cent);
2751+ } else if (pid == MyParticleType::kProton ) {
2752+ registry.fill (HIST (" abundance/hPtCentDataPr" ), track.pt (), cent);
2753+ } else {
2754+ registry.fill (HIST (" abundance/hPtCentDataUnidentified" ), track.pt (), cent);
2755+ }
2756+ }
27192757 if (pid == -1 && withinPtRefGlobal) {
27202758 // Unidentified tracks have no PID-specific correction. Reuse exactly
27212759 // the charged NUA/NUE (including the optional local-density factor).
@@ -4031,9 +4069,6 @@ struct PidFlowPtCorr {
40314069 }
40324070
40334071 const int truePidBin = getPidResponseTrueBin (mcParticle.pdgCode ());
4034- if (truePidBin < 0 ) {
4035- continue ;
4036- }
40374072 const int recoPidBin = getPidResponseRecoBin (getPidConfigurable (track));
40384073
40394074 registry.fill (HIST (" pidResponseMatrix/hPidResponseMatrix" ), truePidBin, recoPidBin);
@@ -4097,6 +4132,21 @@ struct PidFlowPtCorr {
40974132 // graph for all particles
40984133 registry.fill (HIST (" correction/hPtCentMcRec" ), track.pt (), cent);
40994134
4135+ switch (getTrueSpeciesBin (mcParticle)) {
4136+ case kPidRespPion :
4137+ registry.fill (HIST (" correction/hPtCentMcRecTruePi" ), track.pt (), cent);
4138+ break ;
4139+ case kPidRespKaon :
4140+ registry.fill (HIST (" correction/hPtCentMcRecTrueKa" ), track.pt (), cent);
4141+ break ;
4142+ case kPidRespProton :
4143+ registry.fill (HIST (" correction/hPtCentMcRecTruePr" ), track.pt (), cent);
4144+ break ;
4145+ default :
4146+ registry.fill (HIST (" correction/hPtCentMcRecTrueOther" ), track.pt (), cent);
4147+ break ;
4148+ }
4149+
41004150 // ------------------------------
41014151 // Unified PID logic (configurable)
41024152 // ------------------------------
@@ -4179,6 +4229,21 @@ struct PidFlowPtCorr {
41794229 // graph for all particles
41804230 registry.fill (HIST (" correction/hPtCentMcGen" ), mcParticle.pt (), cent);
41814231
4232+ switch (getTrueSpeciesBin (mcParticle)) {
4233+ case kPidRespPion :
4234+ registry.fill (HIST (" correction/hPtCentMcGenTruePi" ), mcParticle.pt (), cent);
4235+ break ;
4236+ case kPidRespKaon :
4237+ registry.fill (HIST (" correction/hPtCentMcGenTrueKa" ), mcParticle.pt (), cent);
4238+ break ;
4239+ case kPidRespProton :
4240+ registry.fill (HIST (" correction/hPtCentMcGenTruePr" ), mcParticle.pt (), cent);
4241+ break ;
4242+ default :
4243+ registry.fill (HIST (" correction/hPtCentMcGenTrueOther" ), mcParticle.pt (), cent);
4244+ break ;
4245+ }
4246+
41824247 // identify particle and fill graph
41834248 if (std::abs (mcParticle.pdgCode ()) == PDG_t::kPiPlus ) {
41844249 registry.fill (HIST (" correction/hPtCentMcGenPi" ), mcParticle.pt (), cent);
0 commit comments