Skip to content

Commit feb4a7d

Browse files
authored
[DPG] Added monitoring of ITS dead map vs time (AliceO2Group#8749)
1 parent 6357914 commit feb4a7d

File tree

1 file changed

+68
-22
lines changed

1 file changed

+68
-22
lines changed

DPG/Tasks/AOTEvent/eventSelectionQa.cxx

Lines changed: 68 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12+
/// \file eventSelectionQa.cxx
13+
/// \brief Event selection QA task
14+
///
15+
/// \author Evgeny Kryshen <[email protected]>
16+
1217
#include <map>
1318
#include <vector>
19+
#include <string>
1420
#include <unordered_map>
1521

1622
#include "Framework/runDataProcessing.h"
@@ -24,6 +30,9 @@
2430
#include "DataFormatsParameters/GRPLHCIFData.h"
2531
#include "DataFormatsParameters/GRPECSObject.h"
2632
#include "DataFormatsParameters/AggregatedRunInfo.h"
33+
#include "DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h
34+
#include "DataFormatsITSMFT/TimeDeadMap.h"
35+
#include "ITSMFTReconstruction/ChipMappingITS.h"
2736
#include "TH1F.h"
2837
#include "TH2F.h"
2938

@@ -59,7 +68,6 @@ struct EventSelectionQaTask {
5968
std::bitset<o2::constants::lhc::LHCMaxBunches> bcPatternA;
6069
std::bitset<o2::constants::lhc::LHCMaxBunches> bcPatternC;
6170
std::bitset<o2::constants::lhc::LHCMaxBunches> bcPatternB;
62-
6371
SliceCache cache;
6472
Partition<aod::Tracks> tracklets = (aod::track::trackType == static_cast<uint8_t>(o2::aod::track::TrackTypeEnum::Run2Tracklet));
6573

@@ -335,13 +343,13 @@ struct EventSelectionQaTask {
335343
{
336344
bool isINT1period = 0;
337345
if (!applySelection) {
338-
auto first_bc = bcs.iteratorAt(0);
339-
EventSelectionParams* par = ccdb->getForTimeStamp<EventSelectionParams>("EventSelection/EventSelectionParams", first_bc.timestamp());
346+
auto firstBC = bcs.iteratorAt(0);
347+
EventSelectionParams* par = ccdb->getForTimeStamp<EventSelectionParams>("EventSelection/EventSelectionParams", firstBC.timestamp());
340348
applySelection = par->GetSelection(0);
341349
for (int i = 0; i < kNsel; i++) {
342350
histos.get<TH1>(HIST("hSelMask"))->SetBinContent(i + 1, applySelection[i]);
343351
}
344-
isINT1period = first_bc.runNumber() <= 136377 || (first_bc.runNumber() >= 144871 && first_bc.runNumber() <= 159582);
352+
isINT1period = firstBC.runNumber() <= 136377 || (firstBC.runNumber() >= 144871 && firstBC.runNumber() <= 159582);
345353
}
346354

347355
// bc-based event selection qa
@@ -449,10 +457,10 @@ struct EventSelectionQaTask {
449457

450458
if (bc.has_fdd()) {
451459
auto fdd = bc.fdd();
452-
for (auto amplitude : fdd.chargeA()) {
460+
for (const auto& amplitude : fdd.chargeA()) {
453461
multFDA += amplitude;
454462
}
455-
for (auto amplitude : fdd.chargeC()) {
463+
for (const auto& amplitude : fdd.chargeC()) {
456464
multFDC += amplitude;
457465
}
458466
}
@@ -564,12 +572,50 @@ struct EventSelectionQaTask {
564572
bcPatternC = ~beamPatternA & beamPatternC;
565573
bcPatternB = beamPatternA & beamPatternC;
566574

567-
// fill once per DF
575+
// fill once
568576
for (int i = 0; i < nBCsPerOrbit; i++) {
569577
histos.fill(HIST("hBcA"), i, bcPatternA[i] ? 1. : 0.);
570578
histos.fill(HIST("hBcB"), i, bcPatternB[i] ? 1. : 0.);
571579
histos.fill(HIST("hBcC"), i, bcPatternC[i] ? 1. : 0.);
572580
}
581+
582+
// fill ITS dead maps
583+
std::map<std::string, std::string> metadata;
584+
metadata["runNumber"] = Form("%d", run);
585+
o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getSpecific<o2::itsmft::TimeDeadMap>("ITS/Calib/TimeDeadMap", (tsSOR + tsEOR) / 2, metadata);
586+
587+
std::vector<uint64_t> itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys(); // roughly every second, ~350 TFs = 350x32 orbits
588+
std::vector<double> itsDeadMapOrbitsDouble(itsDeadMapOrbits.begin(), itsDeadMapOrbits.end());
589+
const AxisSpec axisItsDeadMapOrbits{itsDeadMapOrbitsDouble};
590+
591+
for (int l = 0; l < o2::itsmft::ChipMappingITS::NLayers; l++) {
592+
int nChips = o2::itsmft::ChipMappingITS::getNChipsOnLayer(l);
593+
double idFirstChip = o2::itsmft::ChipMappingITS::getFirstChipsOnLayer(l);
594+
// int nStaves = o2::itsmft::ChipMappingITS::getNStavesOnLr(l);
595+
// double idFirstStave = o2::itsmft::ChipMappingITS::getFirstStavesOnLr(l);
596+
histos.add(Form("hDeadChipsVsOrbitL%d", l), Form(";orbit; chip; Layer %d", l), kTH2C, {axisItsDeadMapOrbits, {nChips, idFirstChip, idFirstChip + nChips}});
597+
}
598+
599+
std::vector<uint16_t> closestVec;
600+
for (const auto& orbit : itsDeadMapOrbits) {
601+
itsDeadMap->getMapAtOrbit(orbit, closestVec);
602+
for (size_t iel = 0; iel < closestVec.size(); iel++) {
603+
uint16_t w1 = closestVec.at(iel);
604+
bool isLastInSequence = (w1 & 0x8000) == 0;
605+
uint16_t w2 = isLastInSequence ? w1 + 1 : closestVec.at(iel + 1);
606+
int chipId1 = w1 & 0x7FFF;
607+
int chipId2 = w2 & 0x7FFF;
608+
for (int chipId = chipId1; chipId < chipId2; chipId++) {
609+
histos.fill(HIST("hDeadChipsVsOrbitL0"), orbit, chipId, 1);
610+
histos.fill(HIST("hDeadChipsVsOrbitL1"), orbit, chipId, 1);
611+
histos.fill(HIST("hDeadChipsVsOrbitL2"), orbit, chipId, 1);
612+
histos.fill(HIST("hDeadChipsVsOrbitL3"), orbit, chipId, 1);
613+
histos.fill(HIST("hDeadChipsVsOrbitL4"), orbit, chipId, 1);
614+
histos.fill(HIST("hDeadChipsVsOrbitL5"), orbit, chipId, 1);
615+
histos.fill(HIST("hDeadChipsVsOrbitL6"), orbit, chipId, 1);
616+
}
617+
}
618+
}
573619
}
574620

575621
// create orbit-axis histograms on the fly with binning based on info from GRP if GRP is available
@@ -615,12 +661,12 @@ struct EventSelectionQaTask {
615661
break;
616662
}
617663
deltaIndex++;
618-
const auto& bc_past = bcs.iteratorAt(bc.globalIndex() - deltaIndex);
619-
deltaBC = globalBC - bc_past.globalBC();
664+
const auto& bcPast = bcs.iteratorAt(bc.globalIndex() - deltaIndex);
665+
deltaBC = globalBC - bcPast.globalBC();
620666
if (deltaBC < maxDeltaBC) {
621-
pastActivityFT0 |= bc_past.has_ft0();
622-
pastActivityFV0 |= bc_past.has_fv0a();
623-
pastActivityFDD |= bc_past.has_fdd();
667+
pastActivityFT0 |= bcPast.has_ft0();
668+
pastActivityFV0 |= bcPast.has_fv0a();
669+
pastActivityFDD |= bcPast.has_fdd();
624670
}
625671
}
626672

@@ -722,7 +768,7 @@ struct EventSelectionQaTask {
722768
histos.fill(HIST("hOrbitFV0"), orbit - minOrbit);
723769
histos.fill(HIST("hBcFV0"), localBC);
724770
float multV0A = 0;
725-
for (auto amplitude : bc.fv0a().amplitude()) {
771+
for (const auto& amplitude : bc.fv0a().amplitude()) {
726772
multV0A += amplitude;
727773
}
728774
histos.fill(HIST("hMultV0Aall"), multV0A);
@@ -766,11 +812,11 @@ struct EventSelectionQaTask {
766812

767813
auto fdd = bc.fdd();
768814
float multFDA = 0;
769-
for (auto amplitude : fdd.chargeA()) {
815+
for (const auto& amplitude : fdd.chargeA()) {
770816
multFDA += amplitude;
771817
}
772818
float multFDC = 0;
773-
for (auto amplitude : fdd.chargeC()) {
819+
for (const auto& amplitude : fdd.chargeC()) {
774820
multFDC += amplitude;
775821
}
776822
histos.fill(HIST("hMultFDAall"), multFDA);
@@ -891,7 +937,7 @@ struct EventSelectionQaTask {
891937
int trackBcDiff = bcDiff + track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS;
892938
if (!track.isPVContributor())
893939
continue;
894-
if (fabs(track.eta()) < 0.8 && track.tpcNClsFound() > 80 && track.tpcNClsCrossedRows() > 100)
940+
if (std::fabs(track.eta()) < 0.8 && track.tpcNClsFound() > 80 && track.tpcNClsCrossedRows() > 100)
895941
nContributorsAfterEtaTPCCuts++;
896942
if (!track.hasTPC())
897943
histos.fill(HIST("hITStrackBcDiff"), trackBcDiff);
@@ -968,7 +1014,7 @@ struct EventSelectionQaTask {
9681014
// FV0
9691015
float multV0A = 0;
9701016
if (foundBC.has_fv0a()) {
971-
for (auto amplitude : foundBC.fv0a().amplitude()) {
1017+
for (const auto& amplitude : foundBC.fv0a().amplitude()) {
9721018
multV0A += amplitude;
9731019
}
9741020
}
@@ -977,10 +1023,10 @@ struct EventSelectionQaTask {
9771023
float multFDC = 0;
9781024
if (foundBC.has_fdd()) {
9791025
auto fdd = foundBC.fdd();
980-
for (auto amplitude : fdd.chargeA()) {
1026+
for (const auto& amplitude : fdd.chargeA()) {
9811027
multFDA += amplitude;
9821028
}
983-
for (auto amplitude : fdd.chargeC()) {
1029+
for (const auto& amplitude : fdd.chargeC()) {
9841030
multFDC += amplitude;
9851031
}
9861032
}
@@ -1070,7 +1116,7 @@ struct EventSelectionQaTask {
10701116
} // collisions
10711117

10721118
// TVX efficiency after TF and ITS ROF border cuts
1073-
for (auto& col : cols) {
1119+
for (const auto& col : cols) {
10741120
if (!col.selection_bit(kNoTimeFrameBorder) || !col.selection_bit(kNoITSROFrameBorder))
10751121
continue;
10761122

@@ -1102,12 +1148,12 @@ struct EventSelectionQaTask {
11021148
histos.fill(HIST("hNcolMCVsBcInTF"), bcInTF);
11031149
}
11041150

1105-
for (auto& col : cols) {
1151+
for (const auto& col : cols) {
11061152
int32_t mcColIdFromCollision = col.mcCollisionId();
11071153
// check if collision is built from tracks originating from different MC collisions
11081154
bool isCollisionAmbiguous = 0;
11091155
const auto& colPvTracks = pvTracks.sliceByCached(aod::track::collisionId, col.globalIndex(), cache);
1110-
for (auto& track : colPvTracks) {
1156+
for (const auto& track : colPvTracks) {
11111157
int32_t mcPartId = track.mcParticleId();
11121158
int32_t mcColId = mcPartId >= 0 ? mcParts.iteratorAt(mcPartId).mcCollisionId() : -1;
11131159
if (mcColId < 0 || mcColIdFromCollision != mcColId) {

0 commit comments

Comments
 (0)