From c4effc36ecb41fa074dcf6325666d0316ca9713d Mon Sep 17 00:00:00 2001 From: Evgeny Kryshen Date: Fri, 20 Dec 2024 11:42:30 +0300 Subject: [PATCH] getForTimeStamp instead of getSpecific --- Common/TableProducer/eventSelection.cxx | 5 +- DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 132 ++++++++++++------------ 2 files changed, 66 insertions(+), 71 deletions(-) diff --git a/Common/TableProducer/eventSelection.cxx b/Common/TableProducer/eventSelection.cxx index e5ccc3523ae..6c323c86952 100644 --- a/Common/TableProducer/eventSelection.cxx +++ b/Common/TableProducer/eventSelection.cxx @@ -14,7 +14,6 @@ /// /// \author Evgeny Kryshen and Igor Altsybeev -#include #include #include @@ -291,9 +290,7 @@ struct BcSelectionTask { int beamZ2 = grplhcif->getBeamZ(o2::constants::lhc::BeamC); isPP = beamZ1 == 1 && beamZ2 == 1; // prepare map of inactive chips - std::map metadata; - metadata["runNumber"] = Form("%d", run); - auto itsDeadMap = ccdb->getSpecific("ITS/Calib/TimeDeadMap", ts, metadata); + auto itsDeadMap = ccdb->getForTimeStamp("ITS/Calib/TimeDeadMap", ts); auto itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys(); // roughly every second, ~350 TFs = 350x32 orbits std::vector vClosest; // temporary vector of inactive chip ids for the current orbit range for (const auto& orbit : itsDeadMapOrbits) { diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index 27eadf4288b..de37d37c00b 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -577,80 +577,78 @@ struct EventSelectionQaTask { } // fill ITS dead maps - std::map metadata; - metadata["runNumber"] = Form("%d", run); - o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getSpecific("ITS/Calib/TimeDeadMap", (tsSOR + tsEOR) / 2, metadata); - + o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getForTimeStamp("ITS/Calib/TimeDeadMap", (tsSOR + tsEOR) / 2); auto itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys(); // roughly every second, ~350 TFs = 350x32 orbits - std::vector itsDeadMapOrbitsDouble(itsDeadMapOrbits.begin(), itsDeadMapOrbits.end()); - const AxisSpec axisItsDeadMapOrbits{itsDeadMapOrbitsDouble}; - - for (int l = 0; l < o2::itsmft::ChipMappingITS::NLayers; l++) { - int nChips = o2::itsmft::ChipMappingITS::getNChipsOnLayer(l); - double idFirstChip = o2::itsmft::ChipMappingITS::getFirstChipsOnLayer(l); - // int nStaves = o2::itsmft::ChipMappingITS::getNStavesOnLr(l); - // double idFirstStave = o2::itsmft::ChipMappingITS::getFirstStavesOnLr(l); - histos.add(Form("hDeadChipsVsOrbitL%d", l), Form(";orbit; chip; Layer %d", l), kTH2C, {axisItsDeadMapOrbits, {nChips, idFirstChip, idFirstChip + nChips}}); - histos.add(Form("hNumberOfInactiveChipsVsOrbitL%d", l), Form(";orbit; Layer %d", l), kTH1I, {axisItsDeadMapOrbits}); - } + if (itsDeadMapOrbits.size() > 0) { + std::vector itsDeadMapOrbitsDouble(itsDeadMapOrbits.begin(), itsDeadMapOrbits.end()); + const AxisSpec axisItsDeadMapOrbits{itsDeadMapOrbitsDouble}; + + for (int l = 0; l < o2::itsmft::ChipMappingITS::NLayers; l++) { + int nChips = o2::itsmft::ChipMappingITS::getNChipsOnLayer(l); + double idFirstChip = o2::itsmft::ChipMappingITS::getFirstChipsOnLayer(l); + // int nStaves = o2::itsmft::ChipMappingITS::getNStavesOnLr(l); + // double idFirstStave = o2::itsmft::ChipMappingITS::getFirstStavesOnLr(l); + histos.add(Form("hDeadChipsVsOrbitL%d", l), Form(";orbit; chip; Layer %d", l), kTH2C, {axisItsDeadMapOrbits, {nChips, idFirstChip, idFirstChip + nChips}}); + histos.add(Form("hNumberOfInactiveChipsVsOrbitL%d", l), Form(";orbit; Layer %d", l), kTH1I, {axisItsDeadMapOrbits}); + } - std::vector vClosest; - std::bitset alwaysDeadChips; - std::bitset deadChips; - alwaysDeadChips.set(); - for (const auto& orbit : itsDeadMapOrbits) { - itsDeadMap->getMapAtOrbit(orbit, vClosest); - deadChips.reset(); - for (size_t iel = 0; iel < vClosest.size(); iel++) { - uint16_t w1 = vClosest[iel]; - bool isLastInSequence = (w1 & 0x8000) == 0; - uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1]; - uint16_t chipId1 = w1 & 0x7FFF; - uint16_t chipId2 = w2 & 0x7FFF; - // dead chips are stored as ranges - // vClosest contains first and last chip ids in the range - // last chip id in the range is marked with 0x8000 bit set to 1 - for (int chipId = chipId1; chipId < chipId2; chipId++) { - histos.fill(HIST("hDeadChipsVsOrbitL0"), orbit, chipId, 1); - histos.fill(HIST("hDeadChipsVsOrbitL1"), orbit, chipId, 1); - histos.fill(HIST("hDeadChipsVsOrbitL2"), orbit, chipId, 1); - histos.fill(HIST("hDeadChipsVsOrbitL3"), orbit, chipId, 1); - histos.fill(HIST("hDeadChipsVsOrbitL4"), orbit, chipId, 1); - histos.fill(HIST("hDeadChipsVsOrbitL5"), orbit, chipId, 1); - histos.fill(HIST("hDeadChipsVsOrbitL6"), orbit, chipId, 1); - deadChips.set(chipId); + std::vector vClosest; + std::bitset alwaysDeadChips; + std::bitset deadChips; + alwaysDeadChips.set(); + for (const auto& orbit : itsDeadMapOrbits) { + itsDeadMap->getMapAtOrbit(orbit, vClosest); + deadChips.reset(); + for (size_t iel = 0; iel < vClosest.size(); iel++) { + uint16_t w1 = vClosest[iel]; + bool isLastInSequence = (w1 & 0x8000) == 0; + uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1]; + uint16_t chipId1 = w1 & 0x7FFF; + uint16_t chipId2 = w2 & 0x7FFF; + // dead chips are stored as ranges + // vClosest contains first and last chip ids in the range + // last chip id in the range is marked with 0x8000 bit set to 1 + for (int chipId = chipId1; chipId < chipId2; chipId++) { + histos.fill(HIST("hDeadChipsVsOrbitL0"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL1"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL2"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL3"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL4"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL5"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL6"), orbit, chipId, 1); + deadChips.set(chipId); + } } + alwaysDeadChips &= deadChips; // chips active in the current orbit are set to 0 } - alwaysDeadChips &= deadChips; // chips active in the current orbit are set to 0 - } - // std::cout << alwaysDeadChips << std::endl; - - // filling histograms with number of inactive chips per layer vs orbit (ignoring always inactive) - for (const auto& orbit : itsDeadMapOrbits) { - itsDeadMap->getMapAtOrbit(orbit, vClosest); - std::vector nInactiveChips(o2::itsmft::ChipMappingITS::NLayers, 0); - for (size_t iel = 0; iel < vClosest.size(); iel++) { - uint16_t w1 = vClosest[iel]; - bool isLastInSequence = (w1 & 0x8000) == 0; - uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1]; - uint16_t chipId1 = w1 & 0x7FFF; - uint16_t chipId2 = w2 & 0x7FFF; - for (int chipId = chipId1; chipId < chipId2; chipId++) { - if (alwaysDeadChips[chipId]) // skip always inactive chips - continue; - int32_t layer = o2::itsmft::ChipMappingITS::getLayer(chipId); - nInactiveChips[layer]++; + // std::cout << alwaysDeadChips << std::endl; + + // filling histograms with number of inactive chips per layer vs orbit (ignoring always inactive) + for (const auto& orbit : itsDeadMapOrbits) { + itsDeadMap->getMapAtOrbit(orbit, vClosest); + std::vector nInactiveChips(o2::itsmft::ChipMappingITS::NLayers, 0); + for (size_t iel = 0; iel < vClosest.size(); iel++) { + uint16_t w1 = vClosest[iel]; + bool isLastInSequence = (w1 & 0x8000) == 0; + uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1]; + uint16_t chipId1 = w1 & 0x7FFF; + uint16_t chipId2 = w2 & 0x7FFF; + for (int chipId = chipId1; chipId < chipId2; chipId++) { + if (alwaysDeadChips[chipId]) // skip always inactive chips + continue; + int32_t layer = o2::itsmft::ChipMappingITS::getLayer(chipId); + nInactiveChips[layer]++; + } } + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL0"), orbit, nInactiveChips[0]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL1"), orbit, nInactiveChips[1]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL2"), orbit, nInactiveChips[2]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL3"), orbit, nInactiveChips[3]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL4"), orbit, nInactiveChips[4]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL5"), orbit, nInactiveChips[5]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL6"), orbit, nInactiveChips[6]); } - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL0"), orbit, nInactiveChips[0]); - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL1"), orbit, nInactiveChips[1]); - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL2"), orbit, nInactiveChips[2]); - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL3"), orbit, nInactiveChips[3]); - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL4"), orbit, nInactiveChips[4]); - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL5"), orbit, nInactiveChips[5]); - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL6"), orbit, nInactiveChips[6]); } - } // run >= 500000 // create orbit-axis histograms on the fly with binning based on info from GRP if GRP is available