1616// / \since 2025-09-06
1717//
1818// to run it execute:
19- // copts="--configuration json://tautauConfig.json -b"
20- // o2-analysis-ud-tauthreeprongeventtableproducer $copts > output.log
19+ // copts="--configuration json://tautauMC_modified_new.json -b"
20+ // for MC
21+ // oopts="--aod-writer-json saveDerivedConfig.json"
22+ // for data
23+ // oopts="--aod-writer-json saveDerivedConfigData.json"
24+ // o2-analysis-ud-tau-three-prong-event-table-producer $copts $oopts > output.log
2125
2226// // C++ headers
2327#include " Math/Vector4D.h"
@@ -66,6 +70,14 @@ enum MyRecoProblem {
6670 TWO_TRACKS = 3 // more than 1 associated track to MC particle (tau daughter)
6771};
6872
73+ enum MyParticle {
74+ MyOtherParticle = -1 ,
75+ MyElectron = 1 ,
76+ MyMuon = 2 ,
77+ MyPion = 3 ,
78+ MyKaon = 4
79+ };
80+
6981struct TauThreeProngEventTableProducer {
7082 Produces<o2::aod::TrueTauFourTracks> trueTauFourTracks;
7183 Produces<o2::aod::DataTauFourTracks> dataTauFourTracks;
@@ -387,26 +399,27 @@ struct TauThreeProngEventTableProducer {
387399 return -1 ;
388400 }
389401
390- // analysis track quality check
391- template <typename T>
392- bool isGoodTrackCheck (T track)
393- {
394- if (!track.hasTPC ())
395- return false ;
396- if (track.tpcChi2NCl () >= 4 .)
397- return false ;
398- if (track.itsChi2NCl () >= 36 .)
399- return false ;
400- // if (track.dcaZ() >= 2.) return false;
401- // if (track.dcaXY() >= 0.0105 * 0.035 / std::pow(track.pt(), 1.1)) return false;
402- if (track.tpcNClsCrossedRows () <= 50 )
403- return false ;
404- if (track.tpcNClsFindable () == 0 )
405- return false ;
406- if (track.tpcNClsCrossedRows () / track.tpcNClsFindable () <= 0.8 )
407- return false ;
408- return true ;
409- }
402+ // to be appied later
403+ // // analysis track quality check
404+ // template <typename T>
405+ // bool isGoodTrackCheck(T track)
406+ // {
407+ // if (!track.hasTPC())
408+ // return false;
409+ // if (track.tpcChi2NCl() >= 4.)
410+ // return false;
411+ // if (track.itsChi2NCl() >= 36.)
412+ // return false;
413+ // // if (track.dcaZ() >= 2.) return false;
414+ // // if (track.dcaXY() >= 0.0105 * 0.035 / std::pow(track.pt(), 1.1)) return false;
415+ // if (track.tpcNClsCrossedRows() <= 50)
416+ // return false;
417+ // if (track.tpcNClsFindable() == 0)
418+ // return false;
419+ // if (track.tpcNClsCrossedRows() / track.tpcNClsFindable() <= 0.8)
420+ // return false;
421+ // return true;
422+ // }
410423
411424 // // analysis track quality check
412425 // template <typename T>
@@ -426,16 +439,16 @@ struct TauThreeProngEventTableProducer {
426439 // return isGoodTrack;
427440 // }
428441
429- // analysis track quality check
430- template <typename T>
431- bool isGoodTOFTrackCheck (T track)
432- {
433- if (!track.hasTOF ())
434- return false ;
435- if (track.tofChi2 () >= 3 )
436- return false ;
437- return true ;
438- }
442+ // // analysis track quality check
443+ // template <typename T>
444+ // bool isGoodTOFTrackCheck(T track)
445+ // {
446+ // if (!track.hasTOF())
447+ // return false;
448+ // if (track.tofChi2() >= 3)
449+ // return false;
450+ // return true;
451+ // }
439452
440453 // check ITS clusters, how many -1,0,1,7 + 10 if 0,1,2 layers were fired
441454 // analysis track quality check
@@ -478,20 +491,20 @@ struct TauThreeProngEventTableProducer {
478491
479492 // ////////////////////////////////////////
480493
481- template <typename C>
482- bool isGoodFITtime (C const & coll, float maxFITtime)
483- {
484-
485- // FTOA
486- if ((std::abs (coll.timeFT0A ()) > maxFITtime) && coll.timeFT0A () > -998 .)
487- return false ;
488-
489- // FTOC
490- if ((std::abs (coll.timeFT0C ()) > maxFITtime) && coll.timeFT0C () > -998 .)
491- return false ;
492-
493- return true ;
494- }
494+ // template <typename C>
495+ // bool isGoodFITtime(C const& coll, float maxFITtime)
496+ // {
497+ //
498+ // // FTOA
499+ // if ((std::abs(coll.timeFT0A()) > maxFITtime) && coll.timeFT0A() > -998.)
500+ // return false;
501+ //
502+ // // FTOC
503+ // if ((std::abs(coll.timeFT0C()) > maxFITtime) && coll.timeFT0C() > -998.)
504+ // return false;
505+ //
506+ // return true;
507+ // }
495508
496509 // template <typename C>
497510 // bool isGoodROFtime(C const& coll)
@@ -663,18 +676,18 @@ struct TauThreeProngEventTableProducer {
663676 int enumMyParticle (int valuePDG)
664677 // reads pdg value and returns particle number as in enumMyParticle
665678 {
666- if (std::abs (valuePDG) == kElectron ) { // 11 e+ or e-
667- return 1 ;
679+ if (std::abs (valuePDG) == kElectron ) { // 11 e+ or e-
680+ return MyElectron; // 1
668681 } else if (std::abs (valuePDG) == kMuonMinus ) { // 13 mu+ or mu -
669- return 2 ;
670- } else if (std::abs (valuePDG) == kPiPlus ) { // 211 pi+ (or pi-)
671- return 3 ;
672- } else if (std::abs (valuePDG) == 321 ) { // 321 K+ or K-
673- return 4 ;
682+ return MyMuon; // 2
683+ } else if (std::abs (valuePDG) == kPiPlus ) { // 211 pi+ (or pi-)
684+ return MyPion; // 3
685+ } else if (std::abs (valuePDG) == kKPlus ) { // 321 K+ ( or K-)
686+ return MyKaon; // 4
674687 } else {
675688 if (verbose)
676689 LOGF (info, " PDG value not found in enumMyParticle. Returning -1." );
677- return - 1 .;
690+ return MyOtherParticle; // -1
678691 }
679692 }
680693
@@ -1035,13 +1048,14 @@ struct TauThreeProngEventTableProducer {
10351048 if (verbose)
10361049 LOGF (info, " 1. part from MC coll %d" , tmpPartsFromMcColl.size ());
10371050 int countMothers = 0 ;
1051+ const int desiredNMothers = 2 ;
10381052 for (const auto & particle : tmpPartsFromMcColl) {
10391053 if (verbose)
10401054 LOGF (info, " 2. MC part pdg %d" , particle.pdgCode ());
10411055 if (std::abs (particle.pdgCode ()) != kTauMinus )
10421056 continue ; // 15 = tau_minus
10431057 // if (std::abs(particle.pdgCode()) != 15) continue; // 15 = tau_minus
1044- if (countMothers < 2 ) {
1058+ if (countMothers < desiredNMothers ) { // < 2
10451059 // fill info for each tau
10461060 trueTauX[countMothers] = particle.px ();
10471061 trueTauY[countMothers] = particle.py ();
@@ -1056,7 +1070,7 @@ struct TauThreeProngEventTableProducer {
10561070 registrySkim.get <TH1>(HIST (" skim/tauPhiMC" ))->Fill (trueTauPhi[countMothers]);
10571071 registrySkim.get <TH1>(HIST (" skim/tauEtaMC" ))->Fill (trueTauEta[countMothers]);
10581072 registrySkim.get <TH1>(HIST (" skim/tauPtMC" ))->Fill (RecoDecay::pt (particle.px (), particle.py ()));
1059- if (std::abs (tmpRapidity) > 0.9 ) {
1073+ if (std::abs (tmpRapidity) > trkEtacut ) { // 0.9
10601074 tauInRapidity = false ;
10611075 if (verbose)
10621076 LOGF (info, " tau y %f" , tmpRapidity);
@@ -1065,7 +1079,7 @@ struct TauThreeProngEventTableProducer {
10651079 countMothers++;
10661080 } // end of loop over MC paricles
10671081 registrySkim.get <TH1>(HIST (" skim/nTauMC" ))->Fill (countMothers);
1068- if (countMothers != 2 ) {
1082+ if (countMothers != desiredNMothers ) { // 2
10691083 if (verbose)
10701084 LOGF (info, " Truth collision has number of mother particles (taus) %d different than 2. Jump to the next MC event." , countMothers);
10711085 continue ;
@@ -1100,26 +1114,26 @@ struct TauThreeProngEventTableProducer {
11001114 const auto & daughters = particle.daughters_as <aod::UDMcParticles>();
11011115 for (const auto & daughter : daughters) {
11021116 particleType = enumMyParticle (daughter.pdgCode ());
1103- if (particleType == - 1 ) {
1117+ if (particleType == MyOtherParticle ) { // -1
11041118 continue ;
11051119 } else {
11061120 nChargedDaughtersTau[countMothers]++;
1107- if (particleType == 1 )
1121+ if (particleType == MyElectron) // 1
11081122 nElec++;
1109- else if (particleType == 2 )
1123+ else if (particleType == MyMuon) // 2
11101124 nMuon++;
1111- else if (particleType == 3 )
1125+ else if (particleType == MyPion) // 3
11121126 nPi++;
11131127 }
11141128
1115- if (std::abs (RecoDecay::eta (std::array<double , 3 >{daughter.px (), daughter.py (), daughter.pz ()})) > 0.9 )
1129+ if (std::abs (RecoDecay::eta (std::array<double , 3 >{daughter.px (), daughter.py (), daughter.pz ()})) > trkEtacut) // 0.9
11161130 partFromTauInEta = false ;
11171131 registrySkim.get <TH1>(HIST (" skim/daughterPhiMC" ))->Fill (RecoDecay::phi (daughter.px (), daughter.py ()));
11181132 registrySkim.get <TH1>(HIST (" skim/daughterEtaMC" ))->Fill (RecoDecay::eta (std::array<double , 3 >{daughter.px (), daughter.py (), daughter.pz ()}));
11191133 registrySkim.get <TH1>(HIST (" skim/daughterPtMC" ))->Fill (RecoDecay::pt (daughter.px (), daughter.py ()));
11201134 }
11211135 countMothers++;
1122- if (countMothers >= 2 )
1136+ if (countMothers >= desiredNMothers) // 2
11231137 break ;
11241138 } // end of loop over MC particles
11251139
@@ -1329,7 +1343,7 @@ struct TauThreeProngEventTableProducer {
13291343 if (verbose)
13301344 LOGF (info, " With Coll; daug pdg %d" , daughter.pdgCode ());
13311345 // check if it is the charged particle (= no pi0 or neutrino)
1332- if (enumMyParticle (daughter.pdgCode ()) == - 1 )
1346+ if (enumMyParticle (daughter.pdgCode ()) == MyOtherParticle) // -1
13331347 continue ;
13341348 countDaughters++;
13351349 if (daughter.pdgCode () == kPi0 )
@@ -1424,7 +1438,7 @@ struct TauThreeProngEventTableProducer {
14241438 // select only tauons with checking if particle has no mother
14251439 // in UPC MC taus have mothers
14261440 // if (particle.has_mothers())
1427- if (std::abs (particle.pdgCode ()) != 15 )
1441+ if (std::abs (particle.pdgCode ()) != kTauMinus ) // 15
14281442 continue ;
14291443 // countMothers++;
14301444 // check the generated collision does not have more than 2 tauons
0 commit comments