Skip to content

Commit 5ded443

Browse files
committed
Adding counters
1 parent 10cef7b commit 5ded443

1 file changed

Lines changed: 100 additions & 11 deletions

File tree

PWGUD/Tasks/upcTauRl.cxx

Lines changed: 100 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ struct UpcTauRl {
119119
Produces<o2::aod::TauTwoTracks> tauTwoTracks;
120120

121121
// Global varialbes
122-
bool isMC = false;
122+
bool isMC{false};
123123
Service<o2::framework::O2DatabasePDG> pdg;
124124
SGSelector sgSelector;
125125

@@ -252,6 +252,7 @@ struct UpcTauRl {
252252
ConfigurableAxis zzAxisFITamplitude{"zzAxisFITamplitude", {1000, 0., 1000.}, "FIT amplitude"};
253253

254254
AxisSpec zzAxisChannels{CH_ENUM_COUNTER, -0.5, +CH_ENUM_COUNTER - 0.5, "Channels (-)"};
255+
AxisSpec zzAxisSelections{10, -0.5, 9.5, "Selections (-)"};
255256
} confAxis;
256257

257258
using FullUDTracks = soa::Join<aod::UDTracks, aod::UDTracksExtra, aod::UDTracksDCA, aod::UDTracksPID, aod::UDTracksFlags>;
@@ -632,6 +633,14 @@ struct UpcTauRl {
632633
histos.add("Tracks/Truth/hPionEta", ";Pion #eta (-);Number of events (-)", HistType::kTH1D, {confAxis.zzAxisEta});
633634
}
634635

636+
histos.add("ProcessDataDG/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
637+
histos.add("ProcessDataSG/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
638+
histos.add("ProcessMCrecDG/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
639+
histos.add("ProcessMCrecSG/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
640+
histos.add("ProcessMCgen/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
641+
histos.add("OutputTable/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
642+
histos.add("OutputTable/hRejections", ";Rejections (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
643+
635644
} // end init
636645

637646
// run (always called before process :( )
@@ -849,32 +858,57 @@ struct UpcTauRl {
849858
return true;
850859
}
851860

861+
bool isElectronOutElectron{false};
862+
bool isElectronNotTOF{false};
863+
852864
template <typename T>
853865
bool isElectronCandidate(T const& electronCandidate)
854866
// Loose criterium to find electron-like particle
855867
// Requiring TOF to avoid double-counting pions/electrons and for better timing
856868
{
857-
if (electronCandidate.tpcNSigmaEl() < -2.0 || electronCandidate.tpcNSigmaEl() > 4.0)
869+
if (electronCandidate.tpcNSigmaEl() < -2.0 || electronCandidate.tpcNSigmaEl() > 4.0) {
870+
isElectronOutElectron = true;
858871
return false;
859-
if (!electronCandidate.hasTOF())
872+
}
873+
if (!electronCandidate.hasTOF()) {
874+
isElectronNotTOF = true;
860875
return false;
876+
}
861877
return true;
862878
}
863879

880+
bool isMupionOutMuon{false};
881+
bool isMupionOutPion{false};
882+
bool isMupionNotTOF{false};
883+
864884
template <typename T>
865885
bool isMuPionCandidate(T const& muPionCandidate)
866886
// Loose criterium to find muon/pion-like particle
867887
// Requiring TOF for better timing
868888
{
869-
if (muPionCandidate.tpcNSigmaMu() < -5.0 || muPionCandidate.tpcNSigmaMu() > 5.0)
889+
if (muPionCandidate.tpcNSigmaMu() < -5.0 || muPionCandidate.tpcNSigmaMu() > 5.0) {
890+
isMupionOutMuon = true;
870891
return false;
871-
if (muPionCandidate.tpcNSigmaPi() < -5.0 || muPionCandidate.tpcNSigmaPi() > 5.0)
892+
}
893+
if (muPionCandidate.tpcNSigmaPi() < -5.0 || muPionCandidate.tpcNSigmaPi() > 5.0) {
894+
isMupionOutPion = true;
872895
return false;
873-
if (!muPionCandidate.hasTOF())
896+
}
897+
if (!muPionCandidate.hasTOF()) {
898+
isMupionNotTOF = true;
874899
return false;
900+
}
875901
return true;
876902
}
877903

904+
void resetLooseCounters(){
905+
isElectronOutElectron = false;
906+
isElectronNotTOF = false;
907+
isMupionOutPion = false;
908+
isMupionOutMuon = false;
909+
isMupionNotTOF = false;
910+
}
911+
878912
template <typename T>
879913
bool selectedGoodElectron(T const& electronCandidate)
880914
{
@@ -2000,20 +2034,28 @@ struct UpcTauRl {
20002034
void outputTauEventCandidates(C const& collision, Ts const& tracks)
20012035
{
20022036

2003-
int countTracksPerCollision = 0;
2004-
int countGoodNonPVtracks = 0;
2005-
int countPVGTel = 0;
2006-
int countPVGTmupi = 0;
2037+
histos.get<TH1>(HIST("OutputTable/hSelections"))->Fill(0);
2038+
2039+
int countTracksPerCollision{0};
2040+
int countBadPVtracks{0};
2041+
int countGoodNonPVtracks{0};
2042+
int countPVGT{0};
2043+
int countPVGTel{0};
2044+
int countPVGTmupi{0};
2045+
resetLooseCounters();
20072046
std::vector<int> vecTrkIdx;
20082047
// Loop over tracks with selections
20092048
for (const auto& track : tracks) {
20102049
countTracksPerCollision++;
2011-
if (!isGlobalTrackReinstatement(track))
2050+
if (!isGlobalTrackReinstatement(track)) {
2051+
countBadPVtracks++;
20122052
continue;
2053+
}
20132054
if (!track.isPVContributor()) {
20142055
countGoodNonPVtracks++;
20152056
continue;
20162057
}
2058+
countPVGT++;
20172059
// alternative selection
20182060
if (isElectronCandidate(track)) {
20192061
countPVGTel++;
@@ -2027,6 +2069,9 @@ struct UpcTauRl {
20272069
} // Loop over tracks with selections
20282070

20292071
if ((countPVGTel == 2 && countPVGTmupi == 0) || (countPVGTel == 1 && countPVGTmupi == 1)) {
2072+
2073+
histos.get<TH1>(HIST("OutputTable/hSelections"))->Fill(1);
2074+
20302075
const auto& trk1 = tracks.iteratorAt(vecTrkIdx[0]);
20312076
const auto& trk2 = tracks.iteratorAt(vecTrkIdx[1]);
20322077

@@ -2057,24 +2102,47 @@ struct UpcTauRl {
20572102
px, py, pz, sign, dcaxy, dcaz,
20582103
tpcSignal, tpcEl, tpcMu, tpcPi, tpcKa, tpcPr,
20592104
tofSignal, tofEl, tofMu, tofPi, tofKa, tofPr);
2105+
} else {
2106+
if (countPVGT != 2)
2107+
histos.get<TH1>(HIST("OutputTable/hRejections"))->Fill(0);
2108+
if (countPVGTel != 1 && countPVGTel != 2)
2109+
histos.get<TH1>(HIST("OutputTable/hRejections"))->Fill(1);
2110+
if (countPVGTmupi != 0 && countPVGTmupi != 1)
2111+
histos.get<TH1>(HIST("OutputTable/hRejections"))->Fill(2);
2112+
if (isElectronOutElectron)
2113+
histos.get<TH1>(HIST("OutputTable/hRejections"))->Fill(3);
2114+
if (isElectronNotTOF)
2115+
histos.get<TH1>(HIST("OutputTable/hRejections"))->Fill(4);
2116+
if (isMupionOutPion)
2117+
histos.get<TH1>(HIST("OutputTable/hRejections"))->Fill(5);
2118+
if (isMupionOutMuon)
2119+
histos.get<TH1>(HIST("OutputTable/hRejections"))->Fill(6);
2120+
if (isMupionNotTOF)
2121+
histos.get<TH1>(HIST("OutputTable/hRejections"))->Fill(7);
2122+
20602123
}
20612124
}
20622125

20632126
void processDataDG(FullUDCollision const& reconstructedCollision,
20642127
FullUDTracks const& reconstructedBarrelTracks)
20652128
{
2129+
histos.get<TH1>(HIST("ProcessDataDG/hSelections"))->Fill(0);
20662130

20672131
if (!isGoodROFtime(reconstructedCollision))
20682132
return;
2133+
histos.get<TH1>(HIST("ProcessDataDG/hSelections"))->Fill(1);
20692134

20702135
if (!isGoodFITtime(reconstructedCollision, cutSample.cutFITtime))
20712136
return;
2137+
histos.get<TH1>(HIST("ProcessDataDG/hSelections"))->Fill(2);
20722138

20732139
if (cutSample.useNumContribs && (reconstructedCollision.numContrib() != cutSample.cutNumContribs))
20742140
return;
2141+
histos.get<TH1>(HIST("ProcessDataDG/hSelections"))->Fill(3);
20752142

20762143
if (cutSample.useRecoFlag && (reconstructedCollision.flags() != cutSample.cutRecoFlag))
20772144
return;
2145+
histos.get<TH1>(HIST("ProcessDataDG/hSelections"))->Fill(4);
20782146

20792147
if (doMainHistos) {
20802148
fillHistograms(reconstructedBarrelTracks);
@@ -2092,6 +2160,7 @@ struct UpcTauRl {
20922160
void processDataSG(FullSGUDCollision const& reconstructedCollision,
20932161
FullUDTracks const& reconstructedBarrelTracks)
20942162
{
2163+
histos.get<TH1>(HIST("ProcessDataSG/hSelections"))->Fill(0);
20952164

20962165
int gapSide = reconstructedCollision.gapSide();
20972166
int trueGapSide = sgSelector.trueGap(reconstructedCollision, cutSample.cutTrueGapSideFV0, cutSample.cutTrueGapSideFT0A, cutSample.cutTrueGapSideFT0C, cutSample.cutTrueGapSideZDC);
@@ -2101,18 +2170,23 @@ struct UpcTauRl {
21012170

21022171
if (!isGoodROFtime(reconstructedCollision))
21032172
return;
2173+
histos.get<TH1>(HIST("ProcessDataSG/hSelections"))->Fill(1);
21042174

21052175
if (gapSide != cutSample.whichGapSide)
21062176
return;
2177+
histos.get<TH1>(HIST("ProcessDataSG/hSelections"))->Fill(2);
21072178

21082179
if (!isGoodFITtime(reconstructedCollision, cutSample.cutFITtime))
21092180
return;
2181+
histos.get<TH1>(HIST("ProcessDataSG/hSelections"))->Fill(3);
21102182

21112183
if (cutSample.useNumContribs && (reconstructedCollision.numContrib() != cutSample.cutNumContribs))
21122184
return;
2185+
histos.get<TH1>(HIST("ProcessDataSG/hSelections"))->Fill(4);
21132186

21142187
if (cutSample.useRecoFlag && (reconstructedCollision.flags() != cutSample.cutRecoFlag))
21152188
return;
2189+
histos.get<TH1>(HIST("ProcessDataSG/hSelections"))->Fill(5);
21162190

21172191
if (doMainHistos) {
21182192
histos.fill(HIST("Events/UDtableGapSide"), gapSide);
@@ -2133,19 +2207,24 @@ struct UpcTauRl {
21332207
FullMCUDTracks const& reconstructedBarrelTracks,
21342208
aod::UDMcParticles const&)
21352209
{
2210+
histos.get<TH1>(HIST("ProcessMCrecDG/hSelections"))->Fill(0);
21362211
isMC = true;
21372212

21382213
if (!isGoodROFtime(reconstructedCollision))
21392214
return;
2215+
histos.get<TH1>(HIST("ProcessMCrecDG/hSelections"))->Fill(1);
21402216

21412217
if (!isGoodFITtime(reconstructedCollision, cutSample.cutFITtime))
21422218
return;
2219+
histos.get<TH1>(HIST("ProcessMCrecDG/hSelections"))->Fill(2);
21432220

21442221
if (cutSample.useNumContribs && (reconstructedCollision.numContrib() != cutSample.cutNumContribs))
21452222
return;
2223+
histos.get<TH1>(HIST("ProcessMCrecDG/hSelections"))->Fill(3);
21462224

21472225
if (cutSample.useRecoFlag && (reconstructedCollision.flags() != cutSample.cutRecoFlag))
21482226
return;
2227+
histos.get<TH1>(HIST("ProcessMCrecDG/hSelections"))->Fill(4);
21492228

21502229
if (cutSample.applyAcceptanceSelection) {
21512230
for (const auto& track : reconstructedBarrelTracks) {
@@ -2155,6 +2234,7 @@ struct UpcTauRl {
21552234
return;
21562235
}
21572236
}
2237+
histos.get<TH1>(HIST("ProcessMCrecDG/hSelections"))->Fill(5);
21582238

21592239
if (doMainHistos) {
21602240
fillHistograms(reconstructedBarrelTracks);
@@ -2175,24 +2255,30 @@ struct UpcTauRl {
21752255
FullMCUDTracks const& reconstructedBarrelTracks,
21762256
aod::UDMcParticles const&)
21772257
{
2258+
histos.get<TH1>(HIST("ProcessMCrecSG/hSelections"))->Fill(0);
21782259
isMC = true;
21792260

21802261
int gapSide = reconstructedCollision.gapSide();
21812262

21822263
if (gapSide != cutSample.whichGapSide)
21832264
return;
2265+
histos.get<TH1>(HIST("ProcessMCrecSG/hSelections"))->Fill(1);
21842266

21852267
if (!isGoodROFtime(reconstructedCollision))
21862268
return;
2269+
histos.get<TH1>(HIST("ProcessMCrecSG/hSelections"))->Fill(2);
21872270

21882271
if (!isGoodFITtime(reconstructedCollision, cutSample.cutFITtime))
21892272
return;
2273+
histos.get<TH1>(HIST("ProcessMCrecSG/hSelections"))->Fill(3);
21902274

21912275
if (cutSample.useNumContribs && (reconstructedCollision.numContrib() != cutSample.cutNumContribs))
21922276
return;
2277+
histos.get<TH1>(HIST("ProcessMCrecSG/hSelections"))->Fill(4);
21932278

21942279
if (cutSample.useRecoFlag && (reconstructedCollision.flags() != cutSample.cutRecoFlag))
21952280
return;
2281+
histos.get<TH1>(HIST("ProcessMCrecSG/hSelections"))->Fill(5);
21962282

21972283
if (cutSample.applyAcceptanceSelection) {
21982284
for (const auto& track : reconstructedBarrelTracks) {
@@ -2202,6 +2288,7 @@ struct UpcTauRl {
22022288
return;
22032289
}
22042290
}
2291+
histos.get<TH1>(HIST("ProcessMCrecSG/hSelections"))->Fill(6);
22052292

22062293
if (doMainHistos) {
22072294
histos.fill(HIST("Events/UDtableGapSide"), gapSide);
@@ -2222,6 +2309,7 @@ struct UpcTauRl {
22222309
void processMCgen(aod::UDMcCollision const& /*generatedCollision*/,
22232310
aod::UDMcParticles const& particles)
22242311
{
2312+
histos.get<TH1>(HIST("ProcessMCgen/hSelections"))->Fill(0);
22252313
isMC = true;
22262314

22272315
if (cutSample.applyAcceptanceSelection) {
@@ -2233,6 +2321,7 @@ struct UpcTauRl {
22332321
return;
22342322
}
22352323
}
2324+
histos.get<TH1>(HIST("ProcessMCgen/hSelections"))->Fill(1);
22362325

22372326
if (doTruthHistos) {
22382327
fillTruthHistograms(particles);

0 commit comments

Comments
 (0)