1212// / \file identifiedBfFilter.cxx
1313// / \brief Filters collisions and tracks according to selection criteria
1414// / \author bghanley1995@gmail.com
15+
1516#include " PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h"
1617
1718#include < cmath>
@@ -156,8 +157,8 @@ TH2F* fhCompatibleCollisionsZVtxRms = nullptr;
156157TH2S* fhTruePIDMismatch = nullptr ;
157158TH1S* fhTruePIDCorrect = nullptr ;
158159
159- TH2F* fhTrueNSigmaTPC[ kIdBfNoOfSpecies ] = {nullptr };
160- TH2F* fhTrueNSigmaTOF[ kIdBfNoOfSpecies ] = {nullptr };
160+ std::vector<std::vector< TH2F*>> fhTrueNSigmaTPC = {o2::analysis::identifiedbffilter:: kIdBfNoOfSpecies ,{o2::analysis::identifiedbffilter:: kIdBfNoOfSpecies , nullptr } };
161+ std::vector<std::vector< TH2F*>> fhTrueNSigmaTOF = {o2::analysis::identifiedbffilter:: kIdBfNoOfSpecies ,{o2::analysis::identifiedbffilter:: kIdBfNoOfSpecies , nullptr } };
161162
162163TH1F* fhTrueCentMultB = nullptr ;
163164TH1F* fhTrueCentMultA = nullptr ;
@@ -1025,16 +1026,18 @@ struct IdentifiedBfFilterTracks {
10251026 79 , -39.5 , 39.5 );
10261027 }
10271028
1028- for (int sp = 0 ; sp < kIdBfNoOfSpecies ; ++sp) {
1029- fhTrueNSigmaTPC[sp] = new TH2F (TString::Format (" fhTrueNSigmaTPC_%s" , speciesName[sp]).Data (),
1030- TString::Format (" N #sigma from TPC vs P for generated %s;N #sigma;p (GeV/c)" , speciesTitle[sp]).Data (),
1031- 48 , -6 , 6 ,
1032- ptbins, ptlow, ptup);
1033-
1034- fhTrueNSigmaTOF[sp] = new TH2F (TString::Format (" fhTrueNSigmaTOF_%s" , speciesName[sp]).Data (),
1035- TString::Format (" N #sigma from TOF vs P for generated %s;N #sigma;p (GeV/c)" , speciesTitle[sp]).Data (),
1036- 48 , -6 , 6 ,
1037- ptbins, ptlow, ptup);
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);
1040+ }
10381041 }
10391042
10401043 /* add the hstograms to the output list */
@@ -1073,9 +1076,11 @@ struct IdentifiedBfFilterTracks {
10731076 fOutputList ->Add (fhTrueNPosNegA[sp]);
10741077 fOutputList ->Add (fhTrueDeltaNA[sp]);
10751078 }
1076- for (int sp = 0 ; sp < kIdBfNoOfSpecies ; ++sp) {
1077- fOutputList ->Add (fhTrueNSigmaTPC[sp]);
1078- fOutputList ->Add (fhTrueNSigmaTOF[sp]);
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]);
1083+ }
10791084 }
10801085 }
10811086 /* initialize access to the CCDB */
@@ -1380,7 +1385,6 @@ inline void IdentifiedBfFilterTracks::identifyRealNSigma(ParticleObject const& p
13801385
13811386 MatchRecoGenSpecies realPID = kWrongSpecies ;
13821387 int pdgcode = std::fabs (particle.pdgCode ());
1383-
13841388 switch (pdgcode) {
13851389 case pdgcodeEl:
13861390 realPID = kIdBfElectron ;
@@ -1402,8 +1406,14 @@ inline void IdentifiedBfFilterTracks::identifyRealNSigma(ParticleObject const& p
14021406 break ;
14031407 }
14041408 if (!(realPID < 0 )) {
1405- fhTrueNSigmaTPC[realPID]->Fill (tpcNSigma[realPID], tpcInnerParam);
1406- fhTrueNSigmaTOF[realPID]->Fill (tofNSigma[realPID], tpcInnerParam);
1409+ fhTrueNSigmaTPC[kIdBfElectron ][realPID]->Fill (tpcNSigma[kIdBfElectron ], tpcInnerParam);
1410+ fhTrueNSigmaTOF[kIdBfElectron ][realPID]->Fill (tofNSigma[kIdBfElectron ], tpcInnerParam);
1411+ fhTrueNSigmaTPC[kIdBfPion ][realPID]->Fill (tpcNSigma[kIdBfPion ], tpcInnerParam);
1412+ fhTrueNSigmaTOF[kIdBfPion ][realPID]->Fill (tofNSigma[kIdBfPion ], tpcInnerParam);
1413+ fhTrueNSigmaTPC[kIdBfKaon ][realPID]->Fill (tpcNSigma[kIdBfKaon ], tpcInnerParam);
1414+ fhTrueNSigmaTOF[kIdBfKaon ][realPID]->Fill (tofNSigma[kIdBfKaon ], tpcInnerParam);
1415+ fhTrueNSigmaTPC[kIdBfProton ][realPID]->Fill (tpcNSigma[kIdBfProton ], tpcInnerParam);
1416+ fhTrueNSigmaTOF[kIdBfProton ][realPID]->Fill (tofNSigma[kIdBfProton ], tpcInnerParam);
14071417 }
14081418}
14091419
@@ -1439,8 +1449,8 @@ void fillNSigmaHistos(TrackObject const& track)
14391449
14401450 fhNSigmaTOF[kIdBfElectron ]->Fill (actualTOFNSigma[kIdBfElectron ], track.tpcInnerParam ());
14411451 fhNSigmaTOF[kIdBfPion ]->Fill (actualTOFNSigma[kIdBfPion ], track.tpcInnerParam ());
1442- fhNSigmaTOF[kIdBfKaon ]->Fill (track. tofNSigmaKa () , track.tpcInnerParam ());
1443- fhNSigmaTOF[kIdBfProton ]->Fill (track. tofNSigmaPr () , track.tpcInnerParam ());
1452+ fhNSigmaTOF[kIdBfKaon ]->Fill (actualTOFNSigma[ kIdBfKaon ] , track.tpcInnerParam ());
1453+ fhNSigmaTOF[kIdBfProton ]->Fill (actualTOFNSigma[ kIdBfProton ] , track.tpcInnerParam ());
14441454
14451455 fhNSigmaCombo[kIdBfElectron ]->Fill (sqrtf (actualTOFNSigma[kIdBfElectron ] * actualTOFNSigma[kIdBfElectron ] + actualTPCNSigma[kIdBfElectron ] * actualTPCNSigma[kIdBfElectron ]), track.tpcInnerParam ());
14461456 fhNSigmaCombo[kIdBfPion ]->Fill (sqrtf (actualTOFNSigma[kIdBfPion ] * actualTOFNSigma[kIdBfPion ] + actualTPCNSigma[kIdBfPion ] * actualTPCNSigma[kIdBfPion ]), track.tpcInnerParam ());
@@ -1459,14 +1469,14 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyTrack(TrackObject c
14591469
14601470 fillNSigmaHistos (track);
14611471
1462- std::vector<float > actualTPCNSigma;
1472+ std::vector<float > actualTPCNSigma ( kIdBfNoOfSpecies , 0 .) ;
14631473
14641474 actualTPCNSigma[kIdBfElectron ] = track.tpcNSigmaEl ();
14651475 actualTPCNSigma[kIdBfPion ] = track.tpcNSigmaPi ();
14661476 actualTPCNSigma[kIdBfKaon ] = track.tpcNSigmaKa ();
14671477 actualTPCNSigma[kIdBfProton ] = track.tpcNSigmaPr ();
14681478
1469- std::vector<float > actualTOFNSigma;
1479+ std::vector<float > actualTOFNSigma ( kIdBfNoOfSpecies , 0 .) ;
14701480
14711481 actualTOFNSigma[kIdBfElectron ] = track.tofNSigmaEl ();
14721482 actualTOFNSigma[kIdBfPion ] = track.tofNSigmaPi ();
0 commit comments