Skip to content

Commit 3d27f4e

Browse files
committed
outputing the bits
1 parent b571a11 commit 3d27f4e

1 file changed

Lines changed: 72 additions & 16 deletions

File tree

PWGUD/Tasks/upcTauRl.cxx

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

121121
// Global varialbes
122-
bool isMC = false;
123122
Service<o2::framework::O2DatabasePDG> pdg;
124123
SGSelector sgSelector;
125124

@@ -263,7 +262,7 @@ struct UpcTauRl {
263262
ConfigurableAxis zzAxisFITamplitude{"zzAxisFITamplitude", {1000, 0., 1000.}, "FIT amplitude"};
264263

265264
AxisSpec zzAxisChannels{CH_ENUM_COUNTER, -0.5, +CH_ENUM_COUNTER - 0.5, "Channels (-)"};
266-
AxisSpec zzAxisSelections{10, -0.5, 9.5, "Selections (-)"};
265+
AxisSpec zzAxisSelections{40, -0.5, 39.5, "Selections (-)"};
267266

268267
} confAxis;
269268

@@ -645,12 +644,12 @@ struct UpcTauRl {
645644
histos.add("Tracks/Truth/hPionEta", ";Pion #eta (-);Number of events (-)", HistType::kTH1D, {confAxis.zzAxisEta});
646645
}
647646

648-
histos.add("ProcessDataDG/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
649-
histos.add("ProcessDataSG/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
650-
histos.add("ProcessMCrecDG/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
651-
histos.add("ProcessMCrecSG/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
652-
histos.add("ProcessMCgen/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
653-
histos.add("OutputTable/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
647+
// histos.add("ProcessDataDG/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
648+
// histos.add("ProcessDataSG/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
649+
// histos.add("ProcessMCrecDG/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
650+
// histos.add("ProcessMCrecSG/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
651+
// histos.add("ProcessMCgen/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
652+
// histos.add("OutputTable/hSelections", ";Selection (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
654653
histos.add("OutputTable/hRejections", ";Rejections (-);Number of passed collision (-)", HistType::kTH1D, {confAxis.zzAxisSelections});
655654

656655
} // end init
@@ -873,6 +872,33 @@ struct UpcTauRl {
873872
unsigned int bitsRejection = 0;
874873
unsigned int bitsRejectElCan = 0;
875874
unsigned int bitsRejectMuPiCan = 0;
875+
unsigned int bitsRejectTauEvent = 0;
876+
877+
void outputGlobalRejectionHistogram(){
878+
879+
for (int i{0}; i < 10; i++) {
880+
if (bitsRejection & (1 << i))
881+
histos.get<TH1>(HIST("OutputTable/hRejections"))->Fill(i);
882+
}
883+
}
884+
885+
void outputDetailedRejectionHistogram(){
886+
887+
for (int i{0}; i < 10; i++) {
888+
if (bitsRejectTauEvent & (1 << i))
889+
histos.get<TH1>(HIST("OutputTable/hRejections"))->Fill(i+10);
890+
}
891+
892+
for (int i{0}; i < 10; i++) {
893+
if (bitsRejectElCan & (1 << i))
894+
histos.get<TH1>(HIST("OutputTable/hRejections"))->Fill(i+20);
895+
}
896+
897+
for (int i{0}; i < 10; i++) {
898+
if (bitsRejectMuPiCan & (1 << i))
899+
histos.get<TH1>(HIST("OutputTable/hRejections"))->Fill(i+30);
900+
}
901+
}
876902

877903
template <typename T>
878904
void fillRejectElectronCandidate(T const& electronCandidate)
@@ -1682,7 +1708,7 @@ struct UpcTauRl {
16821708
}
16831709
}
16841710
if (trkDaug1.hasTPC() && trkDaug2.hasTPC()) {
1685-
if (!isMC && isElEl) {
1711+
if ((doprocessDataDG || doprocessDataSG) && isElEl) {
16861712
if (daug[0].P() > daug[1].P()) {
16871713
histos.get<TH2>(HIST("EventTwoTracks/TwoElectrons/PID/hTPCsignalVsLP"))->Fill(daug[0].P(), trkDaug1.tpcSignal());
16881714
histos.get<TH2>(HIST("EventTwoTracks/TwoElectrons/PID/hTPCsignalVsOP"))->Fill(daug[1].P(), trkDaug2.tpcSignal());
@@ -1711,7 +1737,7 @@ struct UpcTauRl {
17111737
}
17121738
}
17131739
}
1714-
if (!isMC && isElMuPion) {
1740+
if ((doprocessDataSG || doprocessDataDG) && isElMuPion) {
17151741
double electronPt = (cutTauEvent.useThresholdsPID ? isElectronCandidate(trkDaug1) : enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? daug[0].Pt() : daug[1].Pt();
17161742
double electronPID = (cutTauEvent.useThresholdsPID ? isElectronCandidate(trkDaug1) : enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcSignal() : trkDaug2.tpcSignal();
17171743
double electronNsigmaEl = (cutTauEvent.useThresholdsPID ? isElectronCandidate(trkDaug1) : enumMyParticle(trackPDG(trkDaug1, cutPID.cutSiTPC, cutPID.cutSiTOF, cutPID.usePIDwTOF, cutPID.useScutTOFinTPC)) == P_ELECTRON) ? trkDaug1.tpcNSigmaEl() : trkDaug2.tpcNSigmaEl();
@@ -1823,7 +1849,7 @@ struct UpcTauRl {
18231849
daug[1].SetPxPyPzE(trkDaug2.px(), trkDaug2.py(), trkDaug2.pz(), energy(MassPionCharged, trkDaug2.px(), trkDaug2.py(), trkDaug2.pz()));
18241850
}
18251851
if (trkDaug1.hasTPC() && trkDaug2.hasTPC()) {
1826-
if (isMC && isElEl) {
1852+
if ((doprocessMCgen || doprocessMCrecSG || doprocessMCrecDG) && isElEl) {
18271853
if (daug[0].P() > daug[1].P()) {
18281854
histos.get<TH2>(HIST("EventTwoTracks/TwoElectrons/PID/hTPCsignalVsLP"))->Fill(daug[0].P(), trkDaug1.tpcSignal());
18291855
histos.get<TH2>(HIST("EventTwoTracks/TwoElectrons/PID/hTPCsignalVsOP"))->Fill(daug[1].P(), trkDaug2.tpcSignal());
@@ -1852,7 +1878,7 @@ struct UpcTauRl {
18521878
}
18531879
}
18541880
}
1855-
if (isMC && isElMuPion) {
1881+
if ((doprocessMCgen || doprocessMCrecSG || doprocessMCrecDG) && isElMuPion) {
18561882
int pid = 0;
18571883
if (trkDaug1.has_udMcParticle()) {
18581884
const auto& part = trkDaug1.udMcParticle();
@@ -2051,6 +2077,7 @@ struct UpcTauRl {
20512077

20522078
int countTracksPerCollision = 0;
20532079
int countGoodNonPVtracks = 0;
2080+
int countBadTracks = 0;
20542081
int countPVGTel = 0;
20552082
int countPVGTmupi = 0;
20562083
std::vector<int> vecTrkIdx;
@@ -2106,6 +2133,27 @@ struct UpcTauRl {
21062133
px, py, pz, sign, dcaxy, dcaz,
21072134
tpcSignal, tpcEl, tpcMu, tpcPi, tpcKa, tpcPr,
21082135
tofSignal, tofEl, tofMu, tofPi, tofKa, tofPr);
2136+
} else {
2137+
// Store info on what would rejected events
2138+
bitsRejectTauEvent |= (1 << 0);
2139+
2140+
int countTrksPerCol = 0;
2141+
int countNonPVtracks = 0;
2142+
int countBadTracks = 0;
2143+
// Loop over tracks with selections
2144+
for (const auto& track : tracks) {
2145+
countTrksPerCol++;
2146+
if (!isGlobalTrackReinstatement(track)){
2147+
countBadTracks++;
2148+
}
2149+
if (!track.isPVContributor()) {
2150+
countNonPVtracks++;
2151+
}
2152+
} // Loop over tracks with selections
2153+
if (countTrksPerCol - countBadTracks != 2)
2154+
bitsRejectTauEvent |= (1 << 1);
2155+
if (countTrksPerCol - countNonPVtracks != 2)
2156+
bitsRejectTauEvent |= (1 << 2);
21092157
}
21102158
}
21112159

@@ -2168,11 +2216,11 @@ struct UpcTauRl {
21682216
bitsRejection |= (1 << 4);
21692217
}
21702218

2171-
21722219
void processDataDG(FullUDCollision const& reconstructedCollision,
21732220
FullUDTracks const& reconstructedBarrelTracks)
21742221
{
21752222
fillRejectionReasonDG(reconstructedCollision);
2223+
outputGlobalRejectionHistogram();
21762224

21772225
if (!isGoodROFtime(reconstructedCollision))
21782226
return;
@@ -2197,12 +2245,15 @@ struct UpcTauRl {
21972245
if (doOutputTauEvents)
21982246
outputTauEventCandidates(reconstructedCollision, reconstructedBarrelTracks);
21992247

2248+
outputDetailedRejectionHistogram();
2249+
22002250
} // end processDataDG
22012251

22022252
void processDataSG(FullSGUDCollision const& reconstructedCollision,
22032253
FullUDTracks const& reconstructedBarrelTracks)
22042254
{
22052255
fillRejectionReasonSG(reconstructedCollision);
2256+
outputGlobalRejectionHistogram();
22062257

22072258
int gapSide = reconstructedCollision.gapSide();
22082259
int trueGapSide = sgSelector.trueGap(reconstructedCollision, cutSample.cutTrueGapSideFV0, cutSample.cutTrueGapSideFT0A, cutSample.cutTrueGapSideFT0C, cutSample.cutTrueGapSideZDC);
@@ -2238,14 +2289,16 @@ struct UpcTauRl {
22382289
if (doOutputTauEvents)
22392290
outputTauEventCandidates(reconstructedCollision, reconstructedBarrelTracks);
22402291

2292+
outputDetailedRejectionHistogram();
2293+
22412294
} // end processDataSG
22422295

22432296
void processMCrecDG(FullMCUDCollision const& reconstructedCollision,
22442297
FullMCUDTracks const& reconstructedBarrelTracks,
22452298
aod::UDMcParticles const&)
22462299
{
2247-
isMC = true;
22482300
fillRejectionReasonDG(reconstructedCollision);
2301+
outputGlobalRejectionHistogram();
22492302

22502303
if (!isGoodROFtime(reconstructedCollision))
22512304
return;
@@ -2281,14 +2334,16 @@ struct UpcTauRl {
22812334
if (doOutputTauEvents)
22822335
outputTauEventCandidates(reconstructedCollision, reconstructedBarrelTracks);
22832336

2337+
outputDetailedRejectionHistogram();
2338+
22842339
} // end processMCrecDG
22852340

22862341
void processMCrecSG(FullMCSGUDCollision const& reconstructedCollision,
22872342
FullMCUDTracks const& reconstructedBarrelTracks,
22882343
aod::UDMcParticles const&)
22892344
{
2290-
isMC = true;
22912345
fillRejectionReasonMCSG(reconstructedCollision);
2346+
outputGlobalRejectionHistogram();
22922347

22932348
int gapSide = reconstructedCollision.gapSide();
22942349

@@ -2330,12 +2385,13 @@ struct UpcTauRl {
23302385
if (doOutputTauEvents)
23312386
outputTauEventCandidates(reconstructedCollision, reconstructedBarrelTracks);
23322387

2388+
outputDetailedRejectionHistogram();
2389+
23332390
} // end processMCrecDG
23342391

23352392
void processMCgen(aod::UDMcCollision const& /*generatedCollision*/,
23362393
aod::UDMcParticles const& particles)
23372394
{
2338-
isMC = true;
23392395

23402396
if (cutSample.applyAcceptanceSelection) {
23412397
for (const auto& particle : particles) {

0 commit comments

Comments
 (0)