@@ -107,6 +107,12 @@ std::array<std::shared_ptr<TH1>, nParticles> hPtTrkItsTpcMat;
107107std::array<std::shared_ptr<TH1>, nParticles> hPtItsTpcTofMat;
108108std::array<std::shared_ptr<TH1>, nParticles> hPtGeneratedMat;
109109
110+ // Pt for tertiaries from secondary weak decay
111+ std::array<std::shared_ptr<TH1>, nParticles> hPtItsTpcTer;
112+ std::array<std::shared_ptr<TH1>, nParticles> hPtTrkItsTpcTer;
113+ std::array<std::shared_ptr<TH1>, nParticles> hPtItsTpcTofTer;
114+ std::array<std::shared_ptr<TH1>, nParticles> hPtGeneratedTer;
115+
110116// P
111117std::array<std::shared_ptr<TH1>, nParticles> hPItsTpc;
112118std::array<std::shared_ptr<TH1>, nParticles> hPTrkItsTpc;
@@ -325,6 +331,12 @@ struct QaEfficiency {
325331 hPtItsTpcTofStr[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/str/its_tpc_tof" , PDGs[histogramIndex]), " ITS-TPC-TOF tracks (from weak decays) " + tagPt, kTH1D , {axisPt});
326332 hPtGeneratedStr[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/str/generated" , PDGs[histogramIndex]), " Generated (from weak decays) " + tagPt, kTH1D , {axisPt});
327333
334+ // Ter
335+ hPtItsTpcTer[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/ter/its_tpc" , PDGs[histogramIndex]), " ITS-TPC tracks (from secondary weak decays) " + tagPt, kTH1D , {axisPt});
336+ hPtTrkItsTpcTer[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/ter/trk/its_tpc" , PDGs[histogramIndex]), " ITS-TPC tracks (reco from secondary weak decays) " + tagPt, kTH1D , {axisPt});
337+ hPtItsTpcTofTer[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/ter/its_tpc_tof" , PDGs[histogramIndex]), " ITS-TPC-TOF tracks (from secondary weak decays) " + tagPt, kTH1D , {axisPt});
338+ hPtGeneratedTer[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/ter/generated" , PDGs[histogramIndex]), " Generated (from secondary weak decays) " + tagPt, kTH1D , {axisPt});
339+
328340 // Mat
329341 hPtItsTpcMat[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/mat/its_tpc" , PDGs[histogramIndex]), " ITS-TPC tracks (from material)" + tagPt, kTH1D , {axisPt});
330342 hPtTrkItsTpcMat[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/mat/trk/its_tpc" , PDGs[histogramIndex]), " ITS-TPC tracks (reco from material) " + tagPt, kTH1D , {axisPt});
@@ -437,17 +449,19 @@ struct QaEfficiency {
437449 makeEfficiency (" ITS-TPC_vsPt_Prm_Trk" , hPtTrkItsTpcPrm[histogramIndex]);
438450 makeEfficiency (" ITS-TPC-TOF_vsPt_Prm" , hPtItsTpcTofPrm[histogramIndex]);
439451 makeEfficiency (" ITS-TPC-TOF_vsPt_Prm_Trk" , hPtTrkItsTpcTofPrm[histogramIndex]);
440-
441452 makeEfficiency (" ITS-TPC_vsPt_Prm_RecoEv" , hPtItsTpcPrm[histogramIndex]);
442453
443454 makeEfficiency (" ITS-TPC_vsPt_Str" , hPtItsTpcStr[histogramIndex]);
444455 makeEfficiency (" ITS-TPC_vsPt_Str_Trk" , hPtTrkItsTpcStr[histogramIndex]);
445456 makeEfficiency (" ITS-TPC-TOF_vsPt_Str" , hPtItsTpcTofStr[histogramIndex]);
446-
447457 makeEfficiency (" ITS-TPC_vsPt_Mat" , hPtItsTpcMat[histogramIndex]);
448458 makeEfficiency (" ITS-TPC_vsPt_Mat_Trk" , hPtTrkItsTpcMat[histogramIndex]);
449459 makeEfficiency (" ITS-TPC-TOF_vsPt_Mat" , hPtItsTpcTofMat[histogramIndex]);
450460
461+ makeEfficiency (" ITS-TPC_vsPt_Ter" , hPtItsTpcTer[histogramIndex]);
462+ makeEfficiency (" ITS-TPC_vsPt_Ter_Trk" , hPtTrkItsTpcTer[histogramIndex]);
463+ makeEfficiency (" ITS-TPC-TOF_vsPt_Ter" , hPtItsTpcTofTer[histogramIndex]);
464+
451465 makeEfficiency (" ITS-TPC_vsP" , hPItsTpc[histogramIndex]);
452466 makeEfficiency (" ITS-TPC_vsP_Trk" , hPTrkItsTpc[histogramIndex]);
453467 makeEfficiency (" ITS-TPC-TOF_vsP" , hPItsTpcTof[histogramIndex]);
@@ -909,7 +923,24 @@ struct QaEfficiency {
909923 }
910924 return mcParticle.isPhysicalPrimary ();
911925 }
912-
926+ bool isFinal (const o2::aod::McParticles::iterator& mcParticle)
927+ {
928+ // Example conditions to determine if a particle is final (tertiary)
929+ // Here, we assume that final state particles are those not originating from primary vertex
930+ // and not further decaying into other particles
931+ // Check if the particle has no daughters
932+ if (!mcParticle.has_daughters ()) {
933+
934+ // Check if the particle is not a primary particle
935+ if (!mcParticle.isPhysicalPrimary ()) {
936+ // Check if the particle is produced in a secondary decay
937+ if (mcParticle.getProcess () == 4 ) {
938+ return true ; // Consider it as a tertiary particle
939+ }
940+ }
941+ }
942+ return false ; // Otherwise, not considered a tertiary particle
943+ }
913944 template <int pdgSign, o2::track::PID::ID id>
914945 void fillMCTrackHistograms (const TrackCandidatesMC::iterator& track, const bool doMakeHistograms)
915946 {
@@ -927,7 +958,6 @@ struct QaEfficiency {
927958 return ;
928959 }
929960 }
930-
931961 constexpr int histogramIndex = id + pdgSign * nSpecies;
932962 LOG (debug) << " fillMCTrackHistograms for pdgSign '" << pdgSign << " ' and id '" << static_cast <int >(id) << " ' " << particleName (pdgSign, id) << " with index " << histogramIndex;
933963 const o2::aod::McParticles::iterator& mcParticle = track.mcParticle ();
@@ -1036,6 +1066,15 @@ struct QaEfficiency {
10361066 hPtItsTpcTofStr[histogramIndex]->Fill (mcParticle.pt ());
10371067 }
10381068 }
1069+ if (isFinal (mcParticle)) {
1070+ if (passedITS && passedTPC && motherIsAccepted) {
1071+ hPtItsTpcTer[histogramIndex]->Fill (mcParticle.pt ());
1072+ hPtTrkItsTpcTer[histogramIndex]->Fill (track.pt ());
1073+ if (passedTOF) {
1074+ hPtItsTpcTofTer[histogramIndex]->Fill (mcParticle.pt ());
1075+ }
1076+ }
1077+ }
10391078 } else { // Material
10401079 if (passedITS && passedTPC) {
10411080 hPtItsTpcMat[histogramIndex]->Fill (mcParticle.pt ());
@@ -1107,12 +1146,14 @@ struct QaEfficiency {
11071146 }
11081147 if (motherIsAccepted) {
11091148 hPtGeneratedStr[histogramIndex]->Fill (mcParticle.pt ());
1149+ if (isFinal (mcParticle)) {
1150+ hPtGeneratedTer[histogramIndex]->Fill (mcParticle.pt ());
1151+ }
11101152 }
11111153 } else { // Material
11121154 hPtGeneratedMat[histogramIndex]->Fill (mcParticle.pt ());
11131155 }
11141156 }
1115-
11161157 hEtaGenerated[histogramIndex]->Fill (mcParticle.eta ());
11171158 hYGenerated[histogramIndex]->Fill (mcParticle.y ());
11181159 hPhiGenerated[histogramIndex]->Fill (mcParticle.phi ());
@@ -1191,6 +1232,10 @@ struct QaEfficiency {
11911232 doFillEfficiency (" ITS-TPC_vsPt_Mat_Trk" , hPtTrkItsTpcMat[histogramIndex], hPtGeneratedMat[histogramIndex]);
11921233 doFillEfficiency (" ITS-TPC-TOF_vsPt_Mat" , hPtItsTpcTofMat[histogramIndex], hPtGeneratedMat[histogramIndex]);
11931234
1235+ doFillEfficiency (" ITS-TPC_vsPt_Ter" , hPtItsTpcTer[histogramIndex], hPtGeneratedTer[histogramIndex]);
1236+ doFillEfficiency (" ITS-TPC_vsPt_Ter_Trk" , hPtTrkItsTpcTer[histogramIndex], hPtGeneratedTer[histogramIndex]);
1237+ doFillEfficiency (" ITS-TPC-TOF_vsPt_Ter" , hPtItsTpcTofTer[histogramIndex], hPtGeneratedTer[histogramIndex]);
1238+
11941239 doFillEfficiency (" ITS-TPC_vsP" , hPItsTpc[histogramIndex], hPGenerated[histogramIndex]);
11951240 doFillEfficiency (" ITS-TPC_vsP_Trk" , hPTrkItsTpc[histogramIndex], hPGenerated[histogramIndex]);
11961241 doFillEfficiency (" ITS-TPC-TOF_vsP" , hPItsTpcTof[histogramIndex], hPGenerated[histogramIndex]);
0 commit comments