Skip to content

Commit ca7c139

Browse files
ekryshenalibuild
andauthored
Adjust QA to recent changes in evsel (#5569)
* Adjust QA to recent changes in evsel * Fix redefinition of tsSOR and tsEOR * Fix redefinition of nOrbitsPerTF * Please consider the following formatting changes --------- Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 58fe2e5 commit ca7c139

File tree

1 file changed

+33
-127
lines changed

1 file changed

+33
-127
lines changed

DPG/Tasks/AOTEvent/eventSelectionQa.cxx

Lines changed: 33 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ struct EventSelectionQaTask {
3838
Configurable<int> nGlobalBCs{"nGlobalBCs", 100000, "number of global bcs"};
3939
Configurable<double> minOrbitConf{"minOrbit", 0, "minimum orbit"};
4040
Configurable<int> nOrbitsConf{"nOrbits", 10000, "number of orbits"};
41-
Configurable<int> refBC{"refBC", 1238, "reference bc"};
4241
Configurable<bool> isLowFlux{"isLowFlux", 1, "1 - low flux (pp, pPb), 0 - high flux (PbPb)"};
4342

4443
uint64_t minGlobalBC = 0;
@@ -554,113 +553,31 @@ struct EventSelectionQaTask {
554553
}
555554
}
556555

556+
EventSelectionParams* par = ccdb->getForTimeStamp<EventSelectionParams>("EventSelection/EventSelectionParams", ts);
557557
// access orbit-reset timestamp
558558
auto ctpx = ccdb->getForTimeStamp<std::vector<Long64_t>>("CTP/Calib/OrbitReset", ts);
559559
int64_t tsOrbitReset = (*ctpx)[0]; // us
560-
LOGP(info, "tsOrbitReset={} us", tsOrbitReset);
561-
562560
// access TF duration, start-of-run and end-of-run timestamps from ECS GRP
563561
std::map<std::string, std::string> metadata;
564562
metadata["runNumber"] = Form("%d", runNumber);
565563
auto grpecs = ccdb->getSpecific<o2::parameters::GRPECSObject>("GLO/Config/GRPECS", ts, metadata);
566-
nOrbitsPerTF = grpecs->getNHBFPerTF(); // assuming 1 orbit = 1 HBF
564+
nOrbitsPerTF = grpecs->getNHBFPerTF(); // assuming 1 orbit = 1 HBF; nOrbitsPerTF=128 in 2022, 32 in 2023
567565
tsSOR = grpecs->getTimeStart(); // ms
568566
tsEOR = grpecs->getTimeEnd(); // ms
569-
570-
LOGP(info, "nOrbitsPerTF={} tsSOR={} ms tsEOR={} ms", nOrbitsPerTF, tsSOR, tsEOR);
571-
572567
// calculate SOR and EOR orbits
573568
int64_t orbitSOR = (tsSOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS;
574569
int64_t orbitEOR = (tsEOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS;
575-
576-
// temporary map of TF start orbit shifts (affected all runs < LHC22o)
577-
std::map<int, int> mapOrbitShift;
578-
mapOrbitShift[517619] = 109;
579-
mapOrbitShift[517620] = 109;
580-
mapOrbitShift[517623] = 109;
581-
mapOrbitShift[517677] = 127;
582-
mapOrbitShift[517678] = 127;
583-
mapOrbitShift[517679] = 127;
584-
mapOrbitShift[517685] = 127;
585-
mapOrbitShift[517690] = 127;
586-
mapOrbitShift[517693] = 127;
587-
mapOrbitShift[517737] = 127;
588-
mapOrbitShift[517748] = 127;
589-
mapOrbitShift[517751] = 127;
590-
mapOrbitShift[517753] = 127;
591-
mapOrbitShift[517758] = 127;
592-
mapOrbitShift[517767] = 127;
593-
mapOrbitShift[518541] = 40;
594-
mapOrbitShift[518543] = 92;
595-
mapOrbitShift[518546] = 124;
596-
mapOrbitShift[518547] = 47;
597-
mapOrbitShift[519041] = 59;
598-
mapOrbitShift[519043] = 59;
599-
mapOrbitShift[519045] = 59;
600-
mapOrbitShift[519497] = 86;
601-
mapOrbitShift[519498] = 86;
602-
mapOrbitShift[519499] = 86;
603-
mapOrbitShift[519502] = 86;
604-
mapOrbitShift[519503] = 86;
605-
mapOrbitShift[519504] = 86;
606-
mapOrbitShift[519506] = 86;
607-
mapOrbitShift[519507] = 86;
608-
mapOrbitShift[519903] = 62;
609-
mapOrbitShift[519904] = 62;
610-
mapOrbitShift[519905] = 62;
611-
mapOrbitShift[519906] = 62;
612-
mapOrbitShift[520259] = 76;
613-
mapOrbitShift[520294] = 76;
614-
mapOrbitShift[520471] = 46;
615-
mapOrbitShift[520472] = 46;
616-
mapOrbitShift[520473] = 46;
617-
mapOrbitShift[523142] = 127;
618-
mapOrbitShift[523148] = 127;
619-
mapOrbitShift[523182] = 127;
620-
mapOrbitShift[523186] = 127;
621-
mapOrbitShift[523298] = 28;
622-
mapOrbitShift[523306] = 28;
623-
mapOrbitShift[523308] = 28;
624-
mapOrbitShift[523309] = 28;
625-
mapOrbitShift[523397] = 110;
626-
mapOrbitShift[523399] = 110;
627-
mapOrbitShift[523401] = 110;
628-
mapOrbitShift[523441] = 117;
629-
mapOrbitShift[523541] = 103;
630-
mapOrbitShift[523559] = 103;
631-
mapOrbitShift[523669] = 39;
632-
mapOrbitShift[523671] = 39;
633-
mapOrbitShift[523677] = 39;
634-
mapOrbitShift[523728] = 113;
635-
mapOrbitShift[523731] = 113;
636-
mapOrbitShift[523779] = 41;
637-
mapOrbitShift[523783] = 41;
638-
mapOrbitShift[523786] = 41;
639-
mapOrbitShift[523788] = 41;
640-
mapOrbitShift[523789] = 41;
641-
mapOrbitShift[523792] = 41;
642-
mapOrbitShift[523797] = 41;
643-
mapOrbitShift[523821] = 36;
644-
mapOrbitShift[523897] = 38;
645-
646-
int orbitShift = 0;
647-
if (auto search = mapOrbitShift.find(runNumber); search != mapOrbitShift.end()) {
648-
orbitShift = search->second;
649-
}
650-
651570
// adjust to the nearest TF edge
652-
orbitSOR = orbitSOR / nOrbitsPerTF * nOrbitsPerTF + orbitShift;
653-
orbitEOR = orbitEOR / nOrbitsPerTF * nOrbitsPerTF + orbitShift;
654-
571+
orbitSOR = orbitSOR / nOrbitsPerTF * nOrbitsPerTF + par->fTimeFrameOrbitShift;
572+
orbitEOR = orbitEOR / nOrbitsPerTF * nOrbitsPerTF + par->fTimeFrameOrbitShift;
655573
// set nOrbits and minOrbit used for orbit-axis binning
656574
nOrbits = orbitEOR - orbitSOR;
657575
minOrbit = orbitSOR;
658-
659576
// first bc of the first orbit (should coincide with TF start)
660-
bcSOR = orbitSOR * nBCsPerOrbit;
661-
577+
bcSOR = orbitSOR * o2::constants::lhc::LHCMaxBunches;
662578
// duration of TF in bcs
663-
nBCsPerTF = nOrbitsPerTF * nBCsPerOrbit;
579+
nBCsPerTF = nOrbitsPerTF * o2::constants::lhc::LHCMaxBunches;
580+
LOGP(info, "tsOrbitReset={} us, SOR = {} ms, EOR = {} ms, orbitSOR = {}, nBCsPerTF = {}", tsOrbitReset, tsSOR, tsEOR, orbitSOR, nBCsPerTF);
664581
}
665582

666583
// create orbit-axis histograms on the fly with binning based on info from GRP if GRP is available
@@ -814,7 +731,7 @@ struct EventSelectionQaTask {
814731
multV0A += amplitude;
815732
}
816733
histos.fill(HIST("hMultV0Aall"), multV0A);
817-
if (localBC == refBC) {
734+
if (bcPatternB[localBC]) {
818735
histos.fill(HIST("hMultV0Aref"), multV0A);
819736
}
820737
}
@@ -828,7 +745,7 @@ struct EventSelectionQaTask {
828745
float multT0C = bc.ft0().sumAmpC();
829746
histos.fill(HIST("hMultT0Aall"), multT0A);
830747
histos.fill(HIST("hMultT0Call"), multT0C);
831-
if (localBC == refBC) {
748+
if (bcPatternB[localBC]) {
832749
histos.fill(HIST("hMultT0Aref"), multT0A);
833750
histos.fill(HIST("hMultT0Cref"), multT0C);
834751
}
@@ -858,7 +775,7 @@ struct EventSelectionQaTask {
858775
}
859776
histos.fill(HIST("hMultFDAall"), multFDA);
860777
histos.fill(HIST("hMultFDCall"), multFDC);
861-
if (localBC == refBC) {
778+
if (bcPatternB[localBC]) {
862779
histos.fill(HIST("hMultFDAref"), multFDA);
863780
histos.fill(HIST("hMultFDCref"), multFDC);
864781
}
@@ -873,7 +790,7 @@ struct EventSelectionQaTask {
873790
float multZNC = bc.zdc().energyCommonZNC();
874791
histos.fill(HIST("hMultZNAall"), multZNA);
875792
histos.fill(HIST("hMultZNCall"), multZNC);
876-
if (localBC == refBC) {
793+
if (bcPatternB[localBC]) {
877794
histos.fill(HIST("hMultZNAref"), multZNA);
878795
histos.fill(HIST("hMultZNCref"), multZNC);
879796
}
@@ -893,11 +810,6 @@ struct EventSelectionQaTask {
893810
vCollisionsPerBc[col.foundBCId()]++;
894811
}
895812

896-
// consider sliceBy to collect pileup vertices?
897-
// for (auto const& bc : bcs) {
898-
// auto collisionsGrouped = cols.sliceBy(perFoundBC, bc.globalIndex());
899-
// }
900-
901813
// build map from track index to ambiguous track index
902814
std::unordered_map<int32_t, int32_t> mapAmbTrIds;
903815
for (const auto& ambTrack : ambTracks) {
@@ -974,17 +886,11 @@ struct EventSelectionQaTask {
974886

975887
// count tracks of different types
976888
auto tracksGrouped = tracks.sliceBy(perCollision, col.globalIndex());
977-
int nTPCtracks = 0;
978-
int nTOFtracks = 0;
979-
int nTRDtracks = 0;
980889
int nContributorsAfterEtaTPCCuts = 0;
981890
for (auto& track : tracksGrouped) {
982891
int trackBcDiff = bcDiff + track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS;
983892
if (!track.isPVContributor())
984893
continue;
985-
nTPCtracks += track.hasTPC();
986-
nTOFtracks += track.hasTOF();
987-
nTRDtracks += track.hasTRD() && !track.hasTOF();
988894
if (fabs(track.eta()) < 0.8 && track.tpcNClsFound() > 80 && track.tpcNClsCrossedRows() > 100)
989895
nContributorsAfterEtaTPCCuts++;
990896
if (!track.hasTPC())
@@ -1010,11 +916,11 @@ struct EventSelectionQaTask {
1010916
histos.fill(HIST("hNcontribAfterCutsVsBcInTF"), bcInTF, nContributorsAfterEtaTPCCuts);
1011917
histos.fill(HIST("hColBcDiffVsNcontrib"), nContributors, bcDiff);
1012918
histos.fill(HIST("hColTimeResVsNcontrib"), nContributors, timeRes);
1013-
if (nTPCtracks == 0) {
919+
if (!col.selection_bit(kIsVertexITSTPC)) {
1014920
histos.fill(HIST("hColBcDiffVsNcontribITSonly"), nContributors, bcDiff);
1015921
histos.fill(HIST("hColTimeResVsNcontribITSonly"), nContributors, timeRes);
1016922
}
1017-
if (nTOFtracks > 0) {
923+
if (col.selection_bit(kIsVertexTOFmatched)) {
1018924
histos.fill(HIST("hColBcDiffVsNcontribWithTOF"), nContributors, bcDiff);
1019925
histos.fill(HIST("hColTimeResVsNcontribWithTOF"), nContributors, timeRes);
1020926
histos.fill(HIST("hNcontribColTOF"), nContributors);
@@ -1023,7 +929,7 @@ struct EventSelectionQaTask {
1023929
histos.fill(HIST("hNcontribAccTOF"), nContributors);
1024930
}
1025931
}
1026-
if (nTRDtracks > 0) {
932+
if (col.selection_bit(kIsVertexTRDmatched)) {
1027933
histos.fill(HIST("hColBcDiffVsNcontribWithTRD"), nContributors, bcDiff);
1028934
histos.fill(HIST("hColTimeResVsNcontribWithTRD"), nContributors, timeRes);
1029935
histos.fill(HIST("hNcontribColTRD"), nContributors);
@@ -1089,38 +995,29 @@ struct EventSelectionQaTask {
1089995
histos.fill(HIST("hMultZNAcol"), multZNA);
1090996
histos.fill(HIST("hMultZNCcol"), multZNC);
1091997

1092-
// filling plots for accepted events
1093-
if (!col.sel8()) {
998+
// filling plots for events passing basic TVX selection
999+
if (!col.selection_bit(kIsTriggerTVX)) {
10941000
continue;
10951001
}
10961002

1097-
bool noPileup = vCollisionsPerBc[foundBC.globalIndex()] <= 1;
1098-
if (!noPileup) {
1099-
histos.fill(HIST("hMultT0Mpup"), multT0A + multT0C);
1100-
}
1101-
1102-
bool isGoodVertex = 0;
1003+
// z-vertex from FT0 vs PV
11031004
if (foundBC.has_ft0()) {
11041005
histos.fill(HIST("hVtxFT0VsVtxCol"), foundBC.ft0().posZ(), col.posZ());
11051006
histos.fill(HIST("hVtxFT0MinusVtxCol"), foundBC.ft0().posZ() - col.posZ());
11061007
histos.fill(HIST("hVtxFT0MinusVtxColVsMultT0M"), foundBC.ft0().posZ() - col.posZ(), multT0A + multT0C);
1107-
isGoodVertex = fabs(foundBC.ft0().posZ() - col.posZ()) < 1;
11081008
}
11091009

11101010
int foundLocalBC = foundBC.globalBC() % nBCsPerOrbit;
1111-
int bcInITSROF = (foundLocalBC + 594 - 71) % 594;
1112-
bool noITSROFBorder = bcInITSROF < 594 - 15;
11131011

11141012
if (col.selection_bit(kNoTimeFrameBorder)) {
11151013
histos.fill(HIST("hMultV0AVsNcontribAcc"), multV0A, nContributors);
11161014
histos.fill(HIST("hBcForMultV0AVsNcontribAcc"), foundLocalBC);
11171015
histos.fill(HIST("hFoundBc"), foundLocalBC);
11181016
histos.fill(HIST("hFoundBcNcontrib"), foundLocalBC, nContributors);
1119-
if (nTOFtracks > 0) {
1017+
if (col.selection_bit(kIsVertexTOFmatched)) {
11201018
histos.fill(HIST("hFoundBcTOF"), foundLocalBC);
11211019
histos.fill(HIST("hFoundBcNcontribTOF"), foundLocalBC, nContributors);
11221020
}
1123-
11241021
if (nContributors < 0.043 * multV0A - 860) {
11251022
histos.fill(HIST("hBcForMultV0AVsNcontribOutliers"), foundLocalBC);
11261023
}
@@ -1130,18 +1027,27 @@ struct EventSelectionQaTask {
11301027
}
11311028
}
11321029

1133-
if (col.selection_bit(kNoTimeFrameBorder) && noITSROFBorder && isGoodVertex) {
1030+
if (col.selection_bit(kNoITSROFrameBorder)) {
1031+
histos.fill(HIST("hMultT0MVsNcontribCut"), multT0A + multT0C, nContributors);
1032+
}
1033+
1034+
// filling plots for accepted events
1035+
if (!col.sel8()) {
1036+
continue;
1037+
}
1038+
1039+
if (col.selection_bit(kIsVertexITSTPC)) {
11341040
histos.fill(HIST("hMultV0AVsNcontribAfterVertex"), multV0A, nContributors);
1041+
if (col.selection_bit(kNoSameBunchPileup)) {
1042+
histos.fill(HIST("hMultV0AVsNcontribGood"), multV0A, nContributors);
1043+
}
11351044
}
11361045

1137-
if (col.selection_bit(kNoTimeFrameBorder) && noITSROFBorder && isGoodVertex && noPileup) {
1138-
histos.fill(HIST("hMultV0AVsNcontribGood"), multV0A, nContributors);
1046+
if (!col.selection_bit(kNoSameBunchPileup)) {
1047+
histos.fill(HIST("hMultT0Mpup"), multT0A + multT0C);
11391048
}
11401049

11411050
histos.fill(HIST("hMultT0MVsNcontribAcc"), multT0A + multT0C, nContributors);
1142-
if (col.selection_bit(kNoITSROFrameBorder)) {
1143-
histos.fill(HIST("hMultT0MVsNcontribCut"), multT0A + multT0C, nContributors);
1144-
}
11451051
histos.fill(HIST("hTimeV0Aacc"), timeV0A);
11461052
histos.fill(HIST("hTimeZNAacc"), timeZNA);
11471053
histos.fill(HIST("hTimeZNCacc"), timeZNC);

0 commit comments

Comments
 (0)