3636#include " Framework/O2DatabasePDGPlugin.h"
3737#include < TROOT.h>
3838#include < TParameter.h>
39+ #include < TPDGCode.h>
3940#include < TList.h>
4041#include < TDirectory.h>
4142#include < TFolder.h>
@@ -132,6 +133,7 @@ TH2F* fhdEdxB = nullptr;
132133TH2F* fhdEdxIPTPCB = nullptr ;
133134TH2F* fhdEdxA[kIdBfNoOfSpecies + 2 ] = {nullptr };
134135TH2F* fhdEdxIPTPCA[kIdBfNoOfSpecies + 2 ] = {nullptr };
136+ TH2F* fhTrackTime[kIdBfNoOfSpecies + 2 ] = {nullptr };
135137
136138TH1F* fhMassB = nullptr ;
137139TH1F* fhMassA[kIdBfNoOfSpecies + 1 ] = {nullptr };
@@ -177,6 +179,9 @@ TH1F* fhTruePtNegA[kIdBfNoOfSpecies + 1] = {nullptr};
177179TH2F* fhTrueNPosNegA[kIdBfNoOfSpecies + 1 ] = {nullptr };
178180TH1F* fhTrueDeltaNA[kIdBfNoOfSpecies + 1 ] = {nullptr };
179181
182+ TH2F* fhTruedEdx[kIdBfNoOfSpecies + 1 ] = {nullptr };
183+ TH2F* fhTrueTrackTime[kIdBfNoOfSpecies + 1 ] = {nullptr };
184+
180185TH2F* fhTruePtEtaPosA[kIdBfNoOfSpecies + 1 ] = {nullptr };
181186TH2F* fhTruePtEtaNegA[kIdBfNoOfSpecies + 1 ] = {nullptr };
182187
@@ -421,7 +426,7 @@ void IdentifiedBfFilter::processReconstructed(CollisionObject const& collision,
421426 fhVertexZB->Fill (collision.posZ ());
422427 uint8_t acceptedevent = uint8_t (false );
423428 float centormult = tentativecentmult;
424- if (IsEvtSelected (collision, centormult)) {
429+ if (isEvtSelected (collision, centormult)) {
425430 acceptedevent = true ;
426431 fhCentMultA->Fill (centormult);
427432 fhMultA->Fill (mult);
@@ -535,7 +540,7 @@ void IdentifiedBfFilter::processGenerated(CollisionObject const& mccollision, Pa
535540 using namespace identifiedbffilter ;
536541
537542 uint8_t acceptedevent = uint8_t (false );
538- if (IsEvtSelected (mccollision, centormult)) {
543+ if (isEvtSelected (mccollision, centormult)) {
539544 acceptedevent = uint8_t (true );
540545 }
541546 if (fullDerivedData) {
@@ -565,7 +570,7 @@ void IdentifiedBfFilter::processGeneratorLevel(aod::McCollision const& mccollisi
565570 if (tmpcollision.has_mcCollision ()) {
566571 if (tmpcollision.mcCollisionId () == mccollision.globalIndex ()) {
567572 typename AllCollisions::iterator const & collision = allcollisions.iteratorAt (tmpcollision.globalIndex ());
568- if (IsEvtSelected (collision, defaultcent)) {
573+ if (isEvtSelected (collision, defaultcent)) {
569574 fhTrueVertexZAA->Fill (mccollision.posZ ());
570575 processGenerated (mccollision, mcparticles, defaultcent);
571576 processed = true ;
@@ -609,7 +614,7 @@ void IdentifiedBfFilter::processVertexGenerated(aod::McCollisions const& mccolli
609614 fhTrueVertexZB->Fill (mccollision.posZ ());
610615 /* we assign a default value */
611616 float centmult = 50 .0f ;
612- if (IsEvtSelected (mccollision, centmult)) {
617+ if (isEvtSelected (mccollision, centmult)) {
613618 fhTrueVertexZA->Fill ((mccollision.posZ ()));
614619 }
615620 }
@@ -658,6 +663,7 @@ struct IdentifiedBfFilterTracks {
658663 return lst;
659664 }
660665
666+ Service<o2::framework::O2DatabasePDG> fPDG ;
661667 Produces<aod::ScannedTracks> scannedtracks;
662668 Produces<aod::IdentifiedBfCFTracksInfo> tracksinfo;
663669 Produces<aod::ScannedTrueTracks> scannedgentracks;
@@ -689,6 +695,7 @@ struct IdentifiedBfFilterTracks {
689695 Configurable<float > maxRejectSigma{" maxRejectSigma" , 1.0 , " Maximum required sigma for PID double match rejection" };
690696
691697 Configurable<float > tofCut{" tofCut" , 0.8 , " Momentum under which we don't use TOF PID data" };
698+ Configurable<bool > makeNSigmaPlots{" makeNSigmaPlots" , false , " Produce the N Sigma Plots for external storage. Default false" };
692699
693700 OutputObj<TList> fOutput {" IdentifiedBfFilterTracksInfo" , OutputObjHandlingPolicy::AnalysisObject};
694701 bool checkAmbiguousTracks = false ;
@@ -769,7 +776,6 @@ struct IdentifiedBfFilterTracks {
769776 /* if the system type is not known at this time, we have to put the initialization somewhere else */
770777 fSystem = getSystemType (cfgSystem);
771778 fDataType = getDataType (cfgDataType);
772- fPDG = o2::O2DatabasePDG::Instance ();
773779
774780 /* required ambiguous tracks checks? */
775781 if (dofilterDetectorLevelWithoutPIDAmbiguous || dofilterDetectorLevelWithPIDAmbiguous || dofilterRecoWithoutPIDAmbiguous || dofilterRecoWithPIDAmbiguous) {
@@ -1025,18 +1031,19 @@ struct IdentifiedBfFilterTracks {
10251031 TString::Format (" N(%s^{#plus}) #minus N(%s^{#minus}) distribution (truth);N(%s^{#plus}) #minus N(%s^{#minus})" , speciesTitle[sp], speciesTitle[sp], speciesTitle[sp], speciesTitle[sp]).Data (),
10261032 79 , -39.5 , 39.5 );
10271033 }
1028-
1029- for (int sp1 = 0 ; sp1 < kIdBfNoOfSpecies ; ++sp1) {
1030- for (int sp2 = 0 ; sp2 < kIdBfNoOfSpecies ; ++sp2) {
1031- fhTrueNSigmaTPC[sp1][sp2] = new TH2F (TString::Format (" fhTrueNSigmaTPC%s_%s" , speciesName[sp1], speciesName[sp2]).Data (),
1032- TString::Format (" N #sigma %s from TPC vs P for generated %s;N #sigma;p (GeV/c)" , speciesTitle[sp1], speciesTitle[sp2]).Data (),
1033- 48 , -6 , 6 ,
1034- ptbins, ptlow, ptup);
1035-
1036- fhTrueNSigmaTOF[sp1][sp2] = new TH2F (TString::Format (" fhTrueNSigmaTOF%s_%s" , speciesName[sp1], speciesName[sp2]).Data (),
1037- TString::Format (" N #sigma %s from TOF vs P for generated %s;N #sigma;p (GeV/c)" , speciesTitle[sp1], speciesTitle[sp2]).Data (),
1038- 48 , -6 , 6 ,
1039- ptbins, ptlow, ptup);
1034+ if (makeNSigmaPlots) {
1035+ for (int sp1 = 0 ; sp1 < kIdBfNoOfSpecies ; ++sp1) {
1036+ for (int sp2 = 0 ; sp2 < kIdBfNoOfSpecies ; ++sp2) {
1037+ fhTrueNSigmaTPC[sp1][sp2] = new TH2F (TString::Format (" fhTrueNSigmaTPC%s_%s" , speciesName[sp1], speciesName[sp2]).Data (),
1038+ TString::Format (" N #sigma %s from TPC vs P for generated %s;N #sigma;p (GeV/c)" , speciesTitle[sp1], speciesTitle[sp2]).Data (),
1039+ 48 , -6 , 6 ,
1040+ ptbins, ptlow, ptup);
1041+
1042+ fhTrueNSigmaTOF[sp1][sp2] = new TH2F (TString::Format (" fhTrueNSigmaTOF%s_%s" , speciesName[sp1], speciesName[sp2]).Data (),
1043+ TString::Format (" N #sigma %s from TOF vs P for generated %s;N #sigma;p (GeV/c)" , speciesTitle[sp1], speciesTitle[sp2]).Data (),
1044+ 48 , -6 , 6 ,
1045+ ptbins, ptlow, ptup);
1046+ }
10401047 }
10411048 }
10421049
@@ -1076,10 +1083,12 @@ struct IdentifiedBfFilterTracks {
10761083 fOutputList ->Add (fhTrueNPosNegA[sp]);
10771084 fOutputList ->Add (fhTrueDeltaNA[sp]);
10781085 }
1079- for (int sp1 = 0 ; sp1 < kIdBfNoOfSpecies ; ++sp1) {
1080- for (int sp2 = 0 ; sp2 < kIdBfNoOfSpecies ; ++sp2) {
1081- fOutputList ->Add (fhTrueNSigmaTPC[sp1][sp2]);
1082- fOutputList ->Add (fhTrueNSigmaTOF[sp1][sp2]);
1086+ if (makeNSigmaPlots) {
1087+ for (int sp1 = 0 ; sp1 < kIdBfNoOfSpecies ; ++sp1) {
1088+ for (int sp2 = 0 ; sp2 < kIdBfNoOfSpecies ; ++sp2) {
1089+ fOutputList ->Add (fhTrueNSigmaTPC[sp1][sp2]);
1090+ fOutputList ->Add (fhTrueNSigmaTOF[sp1][sp2]);
1091+ }
10831092 }
10841093 }
10851094 }
@@ -1321,17 +1330,17 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyParticle(ParticleOb
13211330 int pdgcode = std::fabs (particle.pdgCode ());
13221331
13231332 switch (pdgcode) {
1324- case pdgcodeEl :
1333+ case kPositron :
13251334 return kIdBfElectron ;
13261335 break ;
13271336
1328- case pdgcodePi :
1337+ case kPiPlus :
13291338 return kIdBfPion ;
13301339 break ;
1331- case pdgcodeKa :
1340+ case kKPlus :
13321341 return kIdBfKaon ;
13331342 break ;
1334- case pdgcodePr :
1343+ case kProton :
13351344 return kIdBfProton ;
13361345 break ;
13371346
@@ -1351,16 +1360,16 @@ inline void IdentifiedBfFilterTracks::identifyPIDMismatch(ParticleObject const&
13511360 int pdgcode = std::fabs (particle.pdgCode ());
13521361
13531362 switch (pdgcode) {
1354- case pdgcodeEl :
1363+ case kPositron :
13551364 realPID = kIdBfElectron ;
13561365 break ;
1357- case pdgcodePi :
1366+ case kPiPlus :
13581367 realPID = kIdBfPion ;
13591368 break ;
1360- case pdgcodeKa :
1369+ case kKPlus :
13611370 realPID = kIdBfKaon ;
13621371 break ;
1363- case pdgcodePr :
1372+ case kProton :
13641373 realPID = kIdBfProton ;
13651374 break ;
13661375 default :
@@ -1386,16 +1395,16 @@ inline void IdentifiedBfFilterTracks::identifyRealNSigma(ParticleObject const& p
13861395 MatchRecoGenSpecies realPID = kWrongSpecies ;
13871396 int pdgcode = std::fabs (particle.pdgCode ());
13881397 switch (pdgcode) {
1389- case pdgcodeEl :
1398+ case kPositron :
13901399 realPID = kIdBfElectron ;
13911400 break ;
1392- case pdgcodePi :
1401+ case kPiPlus :
13931402 realPID = kIdBfPion ;
13941403 break ;
1395- case pdgcodeKa :
1404+ case kKPlus :
13961405 realPID = kIdBfKaon ;
13971406 break ;
1398- case pdgcodePr :
1407+ case kProton :
13991408 realPID = kIdBfProton ;
14001409 break ;
14011410 default :
@@ -1486,7 +1495,9 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyTrack(TrackObject c
14861495 float nsigmas[kIdBfNoOfSpecies ];
14871496
14881497 if constexpr (framework::has_type_v<aod::mctracklabel::McParticleId, typename TrackObject::all_columns>) {
1489- identifyRealNSigma (track.template mcParticle_as <aod::McParticles>(), actualTPCNSigma, actualTOFNSigma, track.tpcInnerParam ());
1498+ if (makeNSigmaPlots) {
1499+ identifyRealNSigma (track.template mcParticle_as <aod::McParticles>(), actualTPCNSigma, actualTOFNSigma, track.tpcInnerParam ());
1500+ }
14901501 }
14911502
14921503 if (loadfromccdb) {
@@ -1495,7 +1506,7 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyTrack(TrackObject c
14951506 }
14961507 }
14971508
1498- if (track.tpcInnerParam () < tofCut && !reqTOF && ! onlyTOF) {
1509+ if (track.tpcInnerParam () < tofCut && !onlyTOF) {
14991510
15001511 for (int iSp = 0 ; iSp < kIdBfNoOfSpecies ; iSp++) {
15011512 nsigmas[iSp] = actualTPCNSigma[iSp];
@@ -1507,7 +1518,7 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyTrack(TrackObject c
15071518 for (int iSp = 0 ; iSp < kIdBfNoOfSpecies ; iSp++) {
15081519 nsigmas[iSp] = sqrtf (actualTPCNSigma[iSp] * actualTPCNSigma[iSp] + actualTOFNSigma[iSp] * actualTOFNSigma[iSp]);
15091520 }
1510- } else if (!reqTOF || !onlyTOF) {
1521+ } else if (!track. hasTOF () && ! reqTOF && !onlyTOF) {
15111522 for (int iSp = 0 ; iSp < kIdBfNoOfSpecies ; iSp++) {
15121523 nsigmas[iSp] = actualTPCNSigma[iSp];
15131524 }
0 commit comments