Skip to content

Commit 6c96974

Browse files
authored
[DPG] flag for filling ITS dead zone histograms (#13084)
1 parent ccfd43e commit 6c96974

File tree

1 file changed

+70
-67
lines changed

1 file changed

+70
-67
lines changed

DPG/Tasks/AOTEvent/eventSelectionQa.cxx

Lines changed: 70 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct EventSelectionQaTask {
5353
Configurable<bool> isMC{"isMC", 0, "0 - data, 1 - MC"};
5454
Configurable<int32_t> nGlobalBCs{"nGlobalBCs", 100000, "number of global bcs for detailed monitoring"};
5555
Configurable<bool> isLowFlux{"isLowFlux", 1, "1 - low flux (pp, pPb), 0 - high flux (PbPb)"};
56+
Configurable<bool> fillITSdeadStaveHists{"fillITSdeadStaveHists", 0, "0 - no, 1 - yes"};
5657

5758
Service<o2::ccdb::BasicCCDBManager> ccdb;
5859
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
@@ -639,78 +640,80 @@ struct EventSelectionQaTask {
639640
}
640641

641642
// fill ITS dead maps
642-
o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getForTimeStamp<o2::itsmft::TimeDeadMap>("ITS/Calib/TimeDeadMap", (tsSOR + tsEOR) / 2);
643-
auto itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys(); // roughly every second, ~350 TFs = 350x32 orbits
644-
if (itsDeadMapOrbits.size() > 0) {
645-
std::vector<double> itsDeadMapOrbitsDouble(itsDeadMapOrbits.begin(), itsDeadMapOrbits.end());
646-
const AxisSpec axisItsDeadMapOrbits{itsDeadMapOrbitsDouble};
647-
648-
for (int l = 0; l < o2::itsmft::ChipMappingITS::NLayers; l++) {
649-
int nChips = o2::itsmft::ChipMappingITS::getNChipsOnLayer(l);
650-
double idFirstChip = o2::itsmft::ChipMappingITS::getFirstChipsOnLayer(l);
651-
// int nStaves = o2::itsmft::ChipMappingITS::getNStavesOnLr(l);
652-
// double idFirstStave = o2::itsmft::ChipMappingITS::getFirstStavesOnLr(l);
653-
histos.add(Form("hDeadChipsVsOrbitL%d", l), Form(";orbit; chip; Layer %d", l), kTH2C, {axisItsDeadMapOrbits, {nChips, idFirstChip, idFirstChip + nChips}});
654-
histos.add(Form("hNumberOfInactiveChipsVsOrbitL%d", l), Form(";orbit; Layer %d", l), kTH1I, {axisItsDeadMapOrbits});
655-
}
643+
if (fillITSdeadStaveHists) {
644+
o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getForTimeStamp<o2::itsmft::TimeDeadMap>("ITS/Calib/TimeDeadMap", (tsSOR + tsEOR) / 2);
645+
auto itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys(); // roughly every second, ~350 TFs = 350x32 orbits
646+
if (itsDeadMapOrbits.size() > 0) {
647+
std::vector<double> itsDeadMapOrbitsDouble(itsDeadMapOrbits.begin(), itsDeadMapOrbits.end());
648+
const AxisSpec axisItsDeadMapOrbits{itsDeadMapOrbitsDouble};
649+
650+
for (int l = 0; l < o2::itsmft::ChipMappingITS::NLayers; l++) {
651+
int nChips = o2::itsmft::ChipMappingITS::getNChipsOnLayer(l);
652+
double idFirstChip = o2::itsmft::ChipMappingITS::getFirstChipsOnLayer(l);
653+
// int nStaves = o2::itsmft::ChipMappingITS::getNStavesOnLr(l);
654+
// double idFirstStave = o2::itsmft::ChipMappingITS::getFirstStavesOnLr(l);
655+
histos.add(Form("hDeadChipsVsOrbitL%d", l), Form(";orbit; chip; Layer %d", l), kTH2C, {axisItsDeadMapOrbits, {nChips, idFirstChip, idFirstChip + nChips}});
656+
histos.add(Form("hNumberOfInactiveChipsVsOrbitL%d", l), Form(";orbit; Layer %d", l), kTH1I, {axisItsDeadMapOrbits});
657+
}
656658

657-
std::vector<uint16_t> vClosest;
658-
std::bitset<o2::itsmft::ChipMappingITS::getNChips()> alwaysDeadChips;
659-
std::bitset<o2::itsmft::ChipMappingITS::getNChips()> deadChips;
660-
alwaysDeadChips.set();
661-
for (const auto& orbit : itsDeadMapOrbits) {
662-
itsDeadMap->getMapAtOrbit(orbit, vClosest);
663-
deadChips.reset();
664-
for (size_t iel = 0; iel < vClosest.size(); iel++) {
665-
uint16_t w1 = vClosest[iel];
666-
bool isLastInSequence = (w1 & 0x8000) == 0;
667-
uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1];
668-
uint16_t chipId1 = w1 & 0x7FFF;
669-
uint16_t chipId2 = w2 & 0x7FFF;
670-
// dead chips are stored as ranges
671-
// vClosest contains first and last chip ids in the range
672-
// last chip id in the range is marked with 0x8000 bit set to 1
673-
for (int chipId = chipId1; chipId < chipId2; chipId++) {
674-
histos.fill(HIST("hDeadChipsVsOrbitL0"), orbit, chipId, 1);
675-
histos.fill(HIST("hDeadChipsVsOrbitL1"), orbit, chipId, 1);
676-
histos.fill(HIST("hDeadChipsVsOrbitL2"), orbit, chipId, 1);
677-
histos.fill(HIST("hDeadChipsVsOrbitL3"), orbit, chipId, 1);
678-
histos.fill(HIST("hDeadChipsVsOrbitL4"), orbit, chipId, 1);
679-
histos.fill(HIST("hDeadChipsVsOrbitL5"), orbit, chipId, 1);
680-
histos.fill(HIST("hDeadChipsVsOrbitL6"), orbit, chipId, 1);
681-
deadChips.set(chipId);
659+
std::vector<uint16_t> vClosest;
660+
std::bitset<o2::itsmft::ChipMappingITS::getNChips()> alwaysDeadChips;
661+
std::bitset<o2::itsmft::ChipMappingITS::getNChips()> deadChips;
662+
alwaysDeadChips.set();
663+
for (const auto& orbit : itsDeadMapOrbits) {
664+
itsDeadMap->getMapAtOrbit(orbit, vClosest);
665+
deadChips.reset();
666+
for (size_t iel = 0; iel < vClosest.size(); iel++) {
667+
uint16_t w1 = vClosest[iel];
668+
bool isLastInSequence = (w1 & 0x8000) == 0;
669+
uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1];
670+
uint16_t chipId1 = w1 & 0x7FFF;
671+
uint16_t chipId2 = w2 & 0x7FFF;
672+
// dead chips are stored as ranges
673+
// vClosest contains first and last chip ids in the range
674+
// last chip id in the range is marked with 0x8000 bit set to 1
675+
for (int chipId = chipId1; chipId < chipId2; chipId++) {
676+
histos.fill(HIST("hDeadChipsVsOrbitL0"), orbit, chipId, 1);
677+
histos.fill(HIST("hDeadChipsVsOrbitL1"), orbit, chipId, 1);
678+
histos.fill(HIST("hDeadChipsVsOrbitL2"), orbit, chipId, 1);
679+
histos.fill(HIST("hDeadChipsVsOrbitL3"), orbit, chipId, 1);
680+
histos.fill(HIST("hDeadChipsVsOrbitL4"), orbit, chipId, 1);
681+
histos.fill(HIST("hDeadChipsVsOrbitL5"), orbit, chipId, 1);
682+
histos.fill(HIST("hDeadChipsVsOrbitL6"), orbit, chipId, 1);
683+
deadChips.set(chipId);
684+
}
682685
}
686+
alwaysDeadChips &= deadChips; // chips active in the current orbit are set to 0
683687
}
684-
alwaysDeadChips &= deadChips; // chips active in the current orbit are set to 0
685-
}
686-
// std::cout << alwaysDeadChips << std::endl;
687-
688-
// filling histograms with number of inactive chips per layer vs orbit (ignoring always inactive)
689-
for (const auto& orbit : itsDeadMapOrbits) {
690-
itsDeadMap->getMapAtOrbit(orbit, vClosest);
691-
std::vector<int16_t> nInactiveChips(o2::itsmft::ChipMappingITS::NLayers, 0);
692-
for (size_t iel = 0; iel < vClosest.size(); iel++) {
693-
uint16_t w1 = vClosest[iel];
694-
bool isLastInSequence = (w1 & 0x8000) == 0;
695-
uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1];
696-
uint16_t chipId1 = w1 & 0x7FFF;
697-
uint16_t chipId2 = w2 & 0x7FFF;
698-
for (int chipId = chipId1; chipId < chipId2; chipId++) {
699-
if (alwaysDeadChips[chipId]) // skip always inactive chips
700-
continue;
701-
int32_t layer = o2::itsmft::ChipMappingITS::getLayer(chipId);
702-
nInactiveChips[layer]++;
688+
// std::cout << alwaysDeadChips << std::endl;
689+
690+
// filling histograms with number of inactive chips per layer vs orbit (ignoring always inactive)
691+
for (const auto& orbit : itsDeadMapOrbits) {
692+
itsDeadMap->getMapAtOrbit(orbit, vClosest);
693+
std::vector<int16_t> nInactiveChips(o2::itsmft::ChipMappingITS::NLayers, 0);
694+
for (size_t iel = 0; iel < vClosest.size(); iel++) {
695+
uint16_t w1 = vClosest[iel];
696+
bool isLastInSequence = (w1 & 0x8000) == 0;
697+
uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1];
698+
uint16_t chipId1 = w1 & 0x7FFF;
699+
uint16_t chipId2 = w2 & 0x7FFF;
700+
for (int chipId = chipId1; chipId < chipId2; chipId++) {
701+
if (alwaysDeadChips[chipId]) // skip always inactive chips
702+
continue;
703+
int32_t layer = o2::itsmft::ChipMappingITS::getLayer(chipId);
704+
nInactiveChips[layer]++;
705+
}
703706
}
707+
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL0"), orbit, nInactiveChips[0]);
708+
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL1"), orbit, nInactiveChips[1]);
709+
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL2"), orbit, nInactiveChips[2]);
710+
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL3"), orbit, nInactiveChips[3]);
711+
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL4"), orbit, nInactiveChips[4]);
712+
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL5"), orbit, nInactiveChips[5]);
713+
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL6"), orbit, nInactiveChips[6]);
704714
}
705-
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL0"), orbit, nInactiveChips[0]);
706-
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL1"), orbit, nInactiveChips[1]);
707-
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL2"), orbit, nInactiveChips[2]);
708-
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL3"), orbit, nInactiveChips[3]);
709-
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL4"), orbit, nInactiveChips[4]);
710-
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL5"), orbit, nInactiveChips[5]);
711-
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL6"), orbit, nInactiveChips[6]);
712715
}
713-
}
716+
} // end of fill ITS dead maps
714717
} // run >= 500000
715718

716719
// create orbit-axis histograms on the fly with binning based on info from GRP if GRP is available
@@ -736,7 +739,7 @@ struct EventSelectionQaTask {
736739

737740
double minSec = floor(tsSOR / 1000.);
738741
double maxSec = ceil(tsEOR / 1000.);
739-
const AxisSpec axisSeconds{maxSec - minSec < 5000 ? static_cast<int>(maxSec - minSec) : 5000, minSec, maxSec, "seconds"};
742+
const AxisSpec axisSeconds{maxSec - minSec < 1000 ? static_cast<int>(maxSec - minSec) : 1000, minSec, maxSec, "seconds"};
740743
const AxisSpec axisBcDif{600, -300., 300., "bc difference"};
741744
histos.add("hSecondsTVXvsBcDif", "", kTH2F, {axisSeconds, axisBcDif});
742745
histos.add("hSecondsTVXvsBcDifAll", "", kTH2F, {axisSeconds, axisBcDif});

0 commit comments

Comments
 (0)