1414// /
1515// / \author Evgeny Kryshen <evgeny.kryshen@cern.ch> and Igor Altsybeev <Igor.Altsybeev@cern.ch>
1616
17- #include < map>
18- #include < vector>
19- #include < string>
20- #include < unordered_map>
21-
22- #include " Framework/runDataProcessing.h"
23- #include " Framework/AnalysisTask.h"
24- #include " Framework/AnalysisDataModel.h"
25- #include " Common/DataModel/EventSelection.h"
2617#include " Common/CCDB/EventSelectionParams.h"
18+ #include " Common/DataModel/EventSelection.h"
19+
2720#include " CCDB/BasicCCDBManager.h"
28- #include " Framework/HistogramRegistry.h"
2921#include " CommonDataFormat/BunchFilling.h"
30- #include " DataFormatsParameters/GRPLHCIFData.h"
31- #include " DataFormatsParameters/GRPECSObject.h"
32- #include " DataFormatsParameters/AggregatedRunInfo.h"
3322#include " DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h
34- #include " DataFormatsITSMFT/TimeDeadMap.h"
3523#include " DataFormatsITSMFT/ROFRecord.h"
36- #include " ReconstructionDataFormats/Vertex.h"
24+ #include " DataFormatsITSMFT/TimeDeadMap.h"
25+ #include " DataFormatsParameters/AggregatedRunInfo.h"
26+ #include " DataFormatsParameters/GRPECSObject.h"
27+ #include " DataFormatsParameters/GRPLHCIFData.h"
28+ #include " Framework/AnalysisDataModel.h"
29+ #include " Framework/AnalysisTask.h"
30+ #include " Framework/HistogramRegistry.h"
31+ #include " Framework/runDataProcessing.h"
3732#include " ITSMFTBase/DPLAlpideParam.h"
3833#include " ITSMFTReconstruction/ChipMappingITS.h"
34+ #include " ReconstructionDataFormats/Vertex.h"
35+
3936#include " TH1F.h"
4037#include " TH2F.h"
4138
39+ #include < map>
40+ #include < string>
41+ #include < unordered_map>
42+ #include < vector>
43+
4244using namespace o2 ::framework;
4345using namespace o2 ;
4446using namespace o2 ::aod::evsel;
@@ -53,6 +55,7 @@ struct EventSelectionQaTask {
5355 Configurable<bool > isMC{" isMC" , 0 , " 0 - data, 1 - MC" };
5456 Configurable<int32_t > nGlobalBCs{" nGlobalBCs" , 100000 , " number of global bcs for detailed monitoring" };
5557 Configurable<bool > isLowFlux{" isLowFlux" , 1 , " 1 - low flux (pp, pPb), 0 - high flux (PbPb)" };
58+ Configurable<bool > fillITSdeadStaveHists{" fillITSdeadStaveHists" , 0 , " 0 - no, 1 - yes" };
5659
5760 Service<o2::ccdb::BasicCCDBManager> ccdb;
5861 HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
@@ -639,78 +642,80 @@ struct EventSelectionQaTask {
639642 }
640643
641644 // 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- }
645+ if (fillITSdeadStaveHists) {
646+ o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getForTimeStamp <o2::itsmft::TimeDeadMap>(" ITS/Calib/TimeDeadMap" , (tsSOR + tsEOR) / 2 );
647+ auto itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys (); // roughly every second, ~350 TFs = 350x32 orbits
648+ if (itsDeadMapOrbits.size () > 0 ) {
649+ std::vector<double > itsDeadMapOrbitsDouble (itsDeadMapOrbits.begin (), itsDeadMapOrbits.end ());
650+ const AxisSpec axisItsDeadMapOrbits{itsDeadMapOrbitsDouble};
651+
652+ for (int l = 0 ; l < o2::itsmft::ChipMappingITS::NLayers; l++) {
653+ int nChips = o2::itsmft::ChipMappingITS::getNChipsOnLayer (l);
654+ double idFirstChip = o2::itsmft::ChipMappingITS::getFirstChipsOnLayer (l);
655+ // int nStaves = o2::itsmft::ChipMappingITS::getNStavesOnLr(l);
656+ // double idFirstStave = o2::itsmft::ChipMappingITS::getFirstStavesOnLr(l);
657+ histos.add (Form (" hDeadChipsVsOrbitL%d" , l), Form (" ;orbit; chip; Layer %d" , l), kTH2C , {axisItsDeadMapOrbits, {nChips, idFirstChip, idFirstChip + nChips}});
658+ histos.add (Form (" hNumberOfInactiveChipsVsOrbitL%d" , l), Form (" ;orbit; Layer %d" , l), kTH1I , {axisItsDeadMapOrbits});
659+ }
656660
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);
661+ std::vector<uint16_t > vClosest;
662+ std::bitset<o2::itsmft::ChipMappingITS::getNChips ()> alwaysDeadChips;
663+ std::bitset<o2::itsmft::ChipMappingITS::getNChips ()> deadChips;
664+ alwaysDeadChips.set ();
665+ for (const auto & orbit : itsDeadMapOrbits) {
666+ itsDeadMap->getMapAtOrbit (orbit, vClosest);
667+ deadChips.reset ();
668+ for (size_t iel = 0 ; iel < vClosest.size (); iel++) {
669+ uint16_t w1 = vClosest[iel];
670+ bool isLastInSequence = (w1 & 0x8000 ) == 0 ;
671+ uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1 ];
672+ uint16_t chipId1 = w1 & 0x7FFF ;
673+ uint16_t chipId2 = w2 & 0x7FFF ;
674+ // dead chips are stored as ranges
675+ // vClosest contains first and last chip ids in the range
676+ // last chip id in the range is marked with 0x8000 bit set to 1
677+ for (int chipId = chipId1; chipId < chipId2; chipId++) {
678+ histos.fill (HIST (" hDeadChipsVsOrbitL0" ), orbit, chipId, 1 );
679+ histos.fill (HIST (" hDeadChipsVsOrbitL1" ), orbit, chipId, 1 );
680+ histos.fill (HIST (" hDeadChipsVsOrbitL2" ), orbit, chipId, 1 );
681+ histos.fill (HIST (" hDeadChipsVsOrbitL3" ), orbit, chipId, 1 );
682+ histos.fill (HIST (" hDeadChipsVsOrbitL4" ), orbit, chipId, 1 );
683+ histos.fill (HIST (" hDeadChipsVsOrbitL5" ), orbit, chipId, 1 );
684+ histos.fill (HIST (" hDeadChipsVsOrbitL6" ), orbit, chipId, 1 );
685+ deadChips.set (chipId);
686+ }
682687 }
688+ alwaysDeadChips &= deadChips; // chips active in the current orbit are set to 0
683689 }
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]++;
690+ // std::cout << alwaysDeadChips << std::endl;
691+
692+ // filling histograms with number of inactive chips per layer vs orbit (ignoring always inactive)
693+ for (const auto & orbit : itsDeadMapOrbits) {
694+ itsDeadMap->getMapAtOrbit (orbit, vClosest);
695+ std::vector<int16_t > nInactiveChips (o2::itsmft::ChipMappingITS::NLayers, 0 );
696+ for (size_t iel = 0 ; iel < vClosest.size (); iel++) {
697+ uint16_t w1 = vClosest[iel];
698+ bool isLastInSequence = (w1 & 0x8000 ) == 0 ;
699+ uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1 ];
700+ uint16_t chipId1 = w1 & 0x7FFF ;
701+ uint16_t chipId2 = w2 & 0x7FFF ;
702+ for (int chipId = chipId1; chipId < chipId2; chipId++) {
703+ if (alwaysDeadChips[chipId]) // skip always inactive chips
704+ continue ;
705+ int32_t layer = o2::itsmft::ChipMappingITS::getLayer (chipId);
706+ nInactiveChips[layer]++;
707+ }
703708 }
709+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL0" ), orbit, nInactiveChips[0 ]);
710+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL1" ), orbit, nInactiveChips[1 ]);
711+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL2" ), orbit, nInactiveChips[2 ]);
712+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL3" ), orbit, nInactiveChips[3 ]);
713+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL4" ), orbit, nInactiveChips[4 ]);
714+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL5" ), orbit, nInactiveChips[5 ]);
715+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL6" ), orbit, nInactiveChips[6 ]);
704716 }
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 ]);
712717 }
713- }
718+ } // end of fill ITS dead maps
714719 } // run >= 500000
715720
716721 // create orbit-axis histograms on the fly with binning based on info from GRP if GRP is available
@@ -736,7 +741,7 @@ struct EventSelectionQaTask {
736741
737742 double minSec = floor (tsSOR / 1000 .);
738743 double maxSec = ceil (tsEOR / 1000 .);
739- const AxisSpec axisSeconds{maxSec - minSec < 5000 ? static_cast <int >(maxSec - minSec) : 5000 , minSec, maxSec, " seconds" };
744+ const AxisSpec axisSeconds{maxSec - minSec < 1000 ? static_cast <int >(maxSec - minSec) : 1000 , minSec, maxSec, " seconds" };
740745 const AxisSpec axisBcDif{600 , -300 ., 300 ., " bc difference" };
741746 histos.add (" hSecondsTVXvsBcDif" , " " , kTH2F , {axisSeconds, axisBcDif});
742747 histos.add (" hSecondsTVXvsBcDifAll" , " " , kTH2F , {axisSeconds, axisBcDif});
0 commit comments