From adbb6739cbfd5375142813247ccb70f828c1569e Mon Sep 17 00:00:00 2001 From: altsybee Date: Mon, 22 Sep 2025 17:22:11 +0200 Subject: [PATCH 1/2] flag for filling ITS dead zone histograms --- DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 169 ++++++++++++------------ 1 file changed, 87 insertions(+), 82 deletions(-) diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index e890b9fbab9..c1044f3e68c 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -14,31 +14,33 @@ /// /// \author Evgeny Kryshen and Igor Altsybeev -#include -#include -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/EventSelection.h" #include "Common/CCDB/EventSelectionParams.h" +#include "Common/DataModel/EventSelection.h" + #include "CCDB/BasicCCDBManager.h" -#include "Framework/HistogramRegistry.h" #include "CommonDataFormat/BunchFilling.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "DataFormatsParameters/GRPECSObject.h" -#include "DataFormatsParameters/AggregatedRunInfo.h" #include "DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h -#include "DataFormatsITSMFT/TimeDeadMap.h" #include "DataFormatsITSMFT/ROFRecord.h" -#include "ReconstructionDataFormats/Vertex.h" +#include "DataFormatsITSMFT/TimeDeadMap.h" +#include "DataFormatsParameters/AggregatedRunInfo.h" +#include "DataFormatsParameters/GRPECSObject.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" #include "ITSMFTBase/DPLAlpideParam.h" #include "ITSMFTReconstruction/ChipMappingITS.h" +#include "ReconstructionDataFormats/Vertex.h" + #include "TH1F.h" #include "TH2F.h" +#include +#include +#include +#include + using namespace o2::framework; using namespace o2; using namespace o2::aod::evsel; @@ -53,6 +55,7 @@ struct EventSelectionQaTask { Configurable isMC{"isMC", 0, "0 - data, 1 - MC"}; Configurable nGlobalBCs{"nGlobalBCs", 100000, "number of global bcs for detailed monitoring"}; Configurable isLowFlux{"isLowFlux", 1, "1 - low flux (pp, pPb), 0 - high flux (PbPb)"}; + Configurable fillITSdeadStaveHists{"fillITSdeadStaveHists", 0, "0 - no, 1 - yes"}; Service ccdb; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -639,78 +642,80 @@ struct EventSelectionQaTask { } // fill ITS dead maps - o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getForTimeStamp("ITS/Calib/TimeDeadMap", (tsSOR + tsEOR) / 2); - auto itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys(); // roughly every second, ~350 TFs = 350x32 orbits - 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}); - } + if (fillITSdeadStaveHists) { + o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getForTimeStamp("ITS/Calib/TimeDeadMap", (tsSOR + tsEOR) / 2); + auto itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys(); // roughly every second, ~350 TFs = 350x32 orbits + 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]); } - } + } // end of fill ITS dead maps } // run >= 500000 // create orbit-axis histograms on the fly with binning based on info from GRP if GRP is available @@ -736,7 +741,7 @@ struct EventSelectionQaTask { double minSec = floor(tsSOR / 1000.); double maxSec = ceil(tsEOR / 1000.); - const AxisSpec axisSeconds{maxSec - minSec < 5000 ? static_cast(maxSec - minSec) : 5000, minSec, maxSec, "seconds"}; + const AxisSpec axisSeconds{maxSec - minSec < 1000 ? static_cast(maxSec - minSec) : 1000, minSec, maxSec, "seconds"}; const AxisSpec axisBcDif{600, -300., 300., "bc difference"}; histos.add("hSecondsTVXvsBcDif", "", kTH2F, {axisSeconds, axisBcDif}); histos.add("hSecondsTVXvsBcDifAll", "", kTH2F, {axisSeconds, axisBcDif}); From ef3eb990c310cb35163cb1a5def19866a292ba33 Mon Sep 17 00:00:00 2001 From: altsybee Date: Mon, 22 Sep 2025 17:27:04 +0200 Subject: [PATCH 2/2] flag for filling ITS dead zone histograms, cosmetics --- DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 32 ++++++++++++------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index c1044f3e68c..b4f2c47d834 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -14,33 +14,31 @@ /// /// \author Evgeny Kryshen and Igor Altsybeev -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/DataModel/EventSelection.h" +#include +#include +#include +#include +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/CCDB/EventSelectionParams.h" #include "CCDB/BasicCCDBManager.h" +#include "Framework/HistogramRegistry.h" #include "CommonDataFormat/BunchFilling.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "DataFormatsParameters/GRPECSObject.h" +#include "DataFormatsParameters/AggregatedRunInfo.h" #include "DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h -#include "DataFormatsITSMFT/ROFRecord.h" #include "DataFormatsITSMFT/TimeDeadMap.h" -#include "DataFormatsParameters/AggregatedRunInfo.h" -#include "DataFormatsParameters/GRPECSObject.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" +#include "DataFormatsITSMFT/ROFRecord.h" +#include "ReconstructionDataFormats/Vertex.h" #include "ITSMFTBase/DPLAlpideParam.h" #include "ITSMFTReconstruction/ChipMappingITS.h" -#include "ReconstructionDataFormats/Vertex.h" - #include "TH1F.h" #include "TH2F.h" -#include -#include -#include -#include - using namespace o2::framework; using namespace o2; using namespace o2::aod::evsel;