@@ -48,26 +48,23 @@ using FullTracksIUwithLabels = soa::Join<aod::TracksIU, aod::TracksExtra, aod::M
4848
4949struct EventSelectionQaTask {
5050 Configurable<bool > isMC{" isMC" , 0 , " 0 - data, 1 - MC" };
51- Configurable<int32_t > nGlobalBCs{" nGlobalBCs" , 100000 , " number of global bcs" };
52- Configurable<int64_t > minOrbitConf{" minOrbit" , 0 , " minimum orbit" };
53- Configurable<int32_t > nOrbitsConf{" nOrbits" , 10000 , " number of orbits" };
51+ Configurable<int32_t > nGlobalBCs{" nGlobalBCs" , 100000 , " number of global bcs for detailed monitoring" };
5452 Configurable<bool > isLowFlux{" isLowFlux" , 1 , " 1 - low flux (pp, pPb), 0 - high flux (PbPb)" };
5553
5654 Service<o2::ccdb::BasicCCDBManager> ccdb;
5755 HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
5856 bool * applySelection = NULL ;
59- int nBCsPerOrbit = 3564 ;
60- int lastRun = -1 ;
61- int nOrbits = nOrbitsConf;
62- int64_t minOrbit = minOrbitConf;
63- int64_t minGlobalBC = minOrbit * nBCsPerOrbit;
57+ static const int32_t nBCsPerOrbit = o2::constants::lhc::LHCMaxBunches;
58+ int32_t lastRun = -1 ;
59+ int64_t nOrbits = 1 ; // number of orbits, setting 1 for unanchored MC
60+ int64_t orbitSOR = 0 ; // first orbit, setting 0 for unanchored MC
6461 int64_t bcSOR = 0 ; // global bc of the start of the first orbit, setting 0 for unanchored MC
6562 int32_t nOrbitsPerTF = 128 ; // 128 in 2022, 32 in 2023, setting 128 for unanchored MC
6663 int64_t nBCsPerTF = nOrbitsPerTF * nBCsPerOrbit; // duration of TF in bcs
6764
68- std::bitset<o2::constants::lhc::LHCMaxBunches > bcPatternA;
69- std::bitset<o2::constants::lhc::LHCMaxBunches > bcPatternC;
70- std::bitset<o2::constants::lhc::LHCMaxBunches > bcPatternB;
65+ std::bitset<nBCsPerOrbit > bcPatternA;
66+ std::bitset<nBCsPerOrbit > bcPatternC;
67+ std::bitset<nBCsPerOrbit > bcPatternB;
7168 SliceCache cache;
7269 Partition<aod::Tracks> tracklets = (aod::track::trackType == static_cast <uint8_t >(o2::aod::track::TrackTypeEnum::Run2Tracklet));
7370
@@ -87,9 +84,6 @@ struct EventSelectionQaTask {
8784
8885 void init (InitContext&)
8986 {
90- minGlobalBC = minOrbit * nBCsPerOrbit;
91-
92- // ccdb->setURL("http://ccdb-test.cern.ch:8080");
9387 ccdb->setURL (" http://alice-ccdb.cern.ch" );
9488 ccdb->setCaching (true );
9589 ccdb->setLocalObjectValidityChecking ();
@@ -388,22 +382,22 @@ struct EventSelectionQaTask {
388382 uint64_t globalBC = bc.globalBC ();
389383 // uint64_t orbit = globalBC / nBCsPerOrbit;
390384 int localBC = globalBC % nBCsPerOrbit;
391- histos.fill (HIST (" hGlobalBcAll" ), globalBC - minGlobalBC );
392- // histos.fill(HIST("hOrbitAll"), orbit - minOrbit );
385+ histos.fill (HIST (" hGlobalBcAll" ), globalBC - bcSOR );
386+ // histos.fill(HIST("hOrbitAll"), orbit - orbitSOR );
393387 histos.fill (HIST (" hBcAll" ), localBC);
394388 if (col.selection_bit (kIsBBV0A ) || col.selection_bit (kIsBBV0C )) {
395- histos.fill (HIST (" hGlobalBcFV0" ), globalBC - minGlobalBC );
396- // histos.fill(HIST("hOrbitFV0"), orbit - minOrbit );
389+ histos.fill (HIST (" hGlobalBcFV0" ), globalBC - bcSOR );
390+ // histos.fill(HIST("hOrbitFV0"), orbit - orbitSOR );
397391 histos.fill (HIST (" hBcFV0" ), localBC);
398392 }
399393 if (col.selection_bit (kIsBBT0A ) || col.selection_bit (kIsBBT0C )) {
400- histos.fill (HIST (" hGlobalBcFT0" ), globalBC - minGlobalBC );
401- // histos.fill(HIST("hOrbitFT0"), orbit - minOrbit );
394+ histos.fill (HIST (" hGlobalBcFT0" ), globalBC - bcSOR );
395+ // histos.fill(HIST("hOrbitFT0"), orbit - orbitSOR );
402396 histos.fill (HIST (" hBcFT0" ), localBC);
403397 }
404398 if (col.selection_bit (kIsBBFDA ) || col.selection_bit (kIsBBFDC )) {
405- histos.fill (HIST (" hGlobalBcFDD" ), globalBC - minGlobalBC );
406- // histos.fill(HIST("hOrbitFDD"), orbit - minOrbit );
399+ histos.fill (HIST (" hGlobalBcFDD" ), globalBC - bcSOR );
400+ // histos.fill(HIST("hOrbitFDD"), orbit - orbitSOR );
407401 histos.fill (HIST (" hBcFDD" ), localBC);
408402 }
409403
@@ -550,13 +544,13 @@ struct EventSelectionQaTask {
550544 if (run >= 500000 ) {
551545 auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo (o2::ccdb::BasicCCDBManager::instance (), run);
552546 // first bc of the first orbit
553- bcSOR = runInfo.orbitSOR * o2::constants::lhc::LHCMaxBunches ;
547+ bcSOR = runInfo.orbitSOR * nBCsPerOrbit ;
554548 // duration of TF in bcs
555- nBCsPerTF = runInfo.orbitsPerTF * o2::constants::lhc::LHCMaxBunches ;
549+ nBCsPerTF = runInfo.orbitsPerTF * nBCsPerOrbit ;
556550 // number of orbits per TF
557551 nOrbitsPerTF = runInfo.orbitsPerTF ;
558552 // first orbit
559- minOrbit = runInfo.orbitSOR ;
553+ orbitSOR = runInfo.orbitSOR ;
560554 // total number of orbits
561555 nOrbits = runInfo.orbitEOR - runInfo.orbitSOR ;
562556 // start-of-run timestamp
@@ -594,17 +588,25 @@ struct EventSelectionQaTask {
594588 // int nStaves = o2::itsmft::ChipMappingITS::getNStavesOnLr(l);
595589 // double idFirstStave = o2::itsmft::ChipMappingITS::getFirstStavesOnLr(l);
596590 histos.add (Form (" hDeadChipsVsOrbitL%d" , l), Form (" ;orbit; chip; Layer %d" , l), kTH2C , {axisItsDeadMapOrbits, {nChips, idFirstChip, idFirstChip + nChips}});
591+ histos.add (Form (" hNumberOfInactiveChipsVsOrbitL%d" , l), Form (" ;orbit; Layer %d" , l), kTH1I , {axisItsDeadMapOrbits});
597592 }
598593
599- std::vector<uint16_t > closestVec;
594+ std::vector<uint16_t > vClosest;
595+ std::bitset<o2::itsmft::ChipMappingITS::getNChips ()> alwaysDeadChips;
596+ std::bitset<o2::itsmft::ChipMappingITS::getNChips ()> deadChips;
597+ alwaysDeadChips.set ();
600598 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);
599+ itsDeadMap->getMapAtOrbit (orbit, vClosest);
600+ deadChips.reset ();
601+ for (size_t iel = 0 ; iel < vClosest.size (); iel++) {
602+ uint16_t w1 = vClosest[iel];
604603 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 ;
604+ uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1 ];
605+ uint16_t chipId1 = w1 & 0x7FFF ;
606+ uint16_t chipId2 = w2 & 0x7FFF ;
607+ // dead chips are stored as ranges
608+ // vClosest contains first and last chip ids in the range
609+ // last chip id in the range is marked with 0x8000 bit set to 1
608610 for (int chipId = chipId1; chipId < chipId2; chipId++) {
609611 histos.fill (HIST (" hDeadChipsVsOrbitL0" ), orbit, chipId, 1 );
610612 histos.fill (HIST (" hDeadChipsVsOrbitL1" ), orbit, chipId, 1 );
@@ -613,13 +615,43 @@ struct EventSelectionQaTask {
613615 histos.fill (HIST (" hDeadChipsVsOrbitL4" ), orbit, chipId, 1 );
614616 histos.fill (HIST (" hDeadChipsVsOrbitL5" ), orbit, chipId, 1 );
615617 histos.fill (HIST (" hDeadChipsVsOrbitL6" ), orbit, chipId, 1 );
618+ deadChips.set (chipId);
616619 }
617620 }
621+ alwaysDeadChips &= deadChips; // chips active in the current orbit are set to 0
618622 }
619- }
623+ // std::cout << alwaysDeadChips << std::endl;
624+
625+ // filling histograms with number of inactive chips per layer vs orbit (ignoring always inactive)
626+ for (const auto & orbit : itsDeadMapOrbits) {
627+ itsDeadMap->getMapAtOrbit (orbit, vClosest);
628+ std::vector<int16_t > nInactiveChips (o2::itsmft::ChipMappingITS::NLayers, 0 );
629+ for (size_t iel = 0 ; iel < vClosest.size (); iel++) {
630+ uint16_t w1 = vClosest[iel];
631+ bool isLastInSequence = (w1 & 0x8000 ) == 0 ;
632+ uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1 ];
633+ uint16_t chipId1 = w1 & 0x7FFF ;
634+ uint16_t chipId2 = w2 & 0x7FFF ;
635+ for (int chipId = chipId1; chipId < chipId2; chipId++) {
636+ if (alwaysDeadChips[chipId]) // skip always inactive chips
637+ continue ;
638+ int32_t layer = o2::itsmft::ChipMappingITS::getLayer (chipId);
639+ nInactiveChips[layer]++;
640+ }
641+ }
642+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL0" ), orbit, nInactiveChips[0 ]);
643+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL1" ), orbit, nInactiveChips[1 ]);
644+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL2" ), orbit, nInactiveChips[2 ]);
645+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL3" ), orbit, nInactiveChips[3 ]);
646+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL4" ), orbit, nInactiveChips[4 ]);
647+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL5" ), orbit, nInactiveChips[5 ]);
648+ histos.fill (HIST (" hNumberOfInactiveChipsVsOrbitL6" ), orbit, nInactiveChips[6 ]);
649+ }
650+
651+ } // run >= 500000
620652
621653 // create orbit-axis histograms on the fly with binning based on info from GRP if GRP is available
622- // otherwise default minOrbit and nOrbits will be used
654+ // otherwise default orbitSOR and nOrbits will be used
623655 const AxisSpec axisOrbits{static_cast <int >(nOrbits / nOrbitsPerTF), 0 ., static_cast <double >(nOrbits), " " };
624656 histos.add (" hOrbitAll" , " " , kTH1F , {axisOrbits});
625657 histos.add (" hOrbitCol" , " " , kTH1F , {axisOrbits});
@@ -753,19 +785,19 @@ struct EventSelectionQaTask {
753785 histos.fill (HIST (" hTimeFDCref" ), timeFDC);
754786 }
755787
756- histos.fill (HIST (" hGlobalBcAll" ), globalBC - minGlobalBC );
757- histos.fill (HIST (" hOrbitAll" ), orbit - minOrbit );
788+ histos.fill (HIST (" hGlobalBcAll" ), globalBC - bcSOR );
789+ histos.fill (HIST (" hOrbitAll" ), orbit - orbitSOR );
758790 histos.fill (HIST (" hBcAll" ), localBC);
759791
760792 if (bc.selection_bit (kIsTriggerTVX )) {
761- histos.fill (HIST (" hOrbitTVX" ), orbit - minOrbit );
793+ histos.fill (HIST (" hOrbitTVX" ), orbit - orbitSOR );
762794 histos.fill (HIST (" hBcTVX" ), localBC);
763795 }
764796
765797 // FV0
766798 if (bc.has_fv0a ()) {
767- histos.fill (HIST (" hGlobalBcFV0" ), globalBC - minGlobalBC );
768- histos.fill (HIST (" hOrbitFV0" ), orbit - minOrbit );
799+ histos.fill (HIST (" hGlobalBcFV0" ), globalBC - bcSOR );
800+ histos.fill (HIST (" hOrbitFV0" ), orbit - orbitSOR );
769801 histos.fill (HIST (" hBcFV0" ), localBC);
770802 float multV0A = 0 ;
771803 for (const auto & amplitude : bc.fv0a ().amplitude ()) {
@@ -779,8 +811,8 @@ struct EventSelectionQaTask {
779811
780812 // FT0
781813 if (bc.has_ft0 ()) {
782- histos.fill (HIST (" hGlobalBcFT0" ), globalBC - minGlobalBC );
783- histos.fill (HIST (" hOrbitFT0" ), orbit - minOrbit );
814+ histos.fill (HIST (" hGlobalBcFT0" ), globalBC - bcSOR );
815+ histos.fill (HIST (" hOrbitFT0" ), orbit - orbitSOR );
784816 histos.fill (HIST (" hBcFT0" ), localBC);
785817 float multT0A = bc.ft0 ().sumAmpA ();
786818 float multT0C = bc.ft0 ().sumAmpC ();
@@ -806,8 +838,8 @@ struct EventSelectionQaTask {
806838
807839 // FDD
808840 if (bc.has_fdd ()) {
809- histos.fill (HIST (" hGlobalBcFDD" ), globalBC - minGlobalBC );
810- histos.fill (HIST (" hOrbitFDD" ), orbit - minOrbit );
841+ histos.fill (HIST (" hGlobalBcFDD" ), globalBC - bcSOR );
842+ histos.fill (HIST (" hOrbitFDD" ), orbit - orbitSOR );
811843 histos.fill (HIST (" hBcFDD" ), localBC);
812844
813845 auto fdd = bc.fdd ();
@@ -829,8 +861,8 @@ struct EventSelectionQaTask {
829861
830862 // ZDC
831863 if (bc.has_zdc ()) {
832- histos.fill (HIST (" hGlobalBcZDC" ), globalBC - minGlobalBC );
833- histos.fill (HIST (" hOrbitZDC" ), orbit - minOrbit );
864+ histos.fill (HIST (" hGlobalBcZDC" ), globalBC - bcSOR );
865+ histos.fill (HIST (" hOrbitZDC" ), orbit - orbitSOR );
834866 histos.fill (HIST (" hBcZDC" ), localBC);
835867 float multZNA = bc.zdc ().energyCommonZNA ();
836868 float multZNC = bc.zdc ().energyCommonZNC ();
@@ -869,7 +901,7 @@ struct EventSelectionQaTask {
869901 for (const auto & bc : bcs) {
870902 int64_t globalBC = bc.globalBC ();
871903 // skip non-colliding bcs for data and anchored runs
872- if (run >= 500000 && bcPatternB[globalBC % o2::constants::lhc::LHCMaxBunches ] == 0 ) {
904+ if (run >= 500000 && bcPatternB[globalBC % nBCsPerOrbit ] == 0 ) {
873905 continue ;
874906 }
875907 if (bc.selection_bit (kIsBBT0A ) || bc.selection_bit (kIsBBT0C )) {
@@ -919,11 +951,11 @@ struct EventSelectionQaTask {
919951 uint64_t globalBC = bc.globalBC ();
920952 uint64_t orbit = globalBC / nBCsPerOrbit;
921953 int localBC = globalBC % nBCsPerOrbit;
922- histos.fill (HIST (" hGlobalBcCol" ), globalBC - minGlobalBC );
923- histos.fill (HIST (" hOrbitCol" ), orbit - minOrbit );
954+ histos.fill (HIST (" hGlobalBcCol" ), globalBC - bcSOR );
955+ histos.fill (HIST (" hOrbitCol" ), orbit - orbitSOR );
924956 histos.fill (HIST (" hBcCol" ), localBC);
925957 if (col.sel8 ()) {
926- histos.fill (HIST (" hOrbitAcc" ), orbit - minOrbit );
958+ histos.fill (HIST (" hOrbitAcc" ), orbit - orbitSOR );
927959 }
928960
929961 // search for nearest ft0a&ft0c entry
@@ -1139,8 +1171,8 @@ struct EventSelectionQaTask {
11391171 uint64_t orbit = globalBC / nBCsPerOrbit;
11401172 int localBC = globalBC % nBCsPerOrbit;
11411173 int64_t bcInTF = (globalBC - bcSOR) % nBCsPerTF;
1142- histos.fill (HIST (" hGlobalBcColMC" ), globalBC - minGlobalBC );
1143- histos.fill (HIST (" hOrbitColMC" ), orbit - minOrbit );
1174+ histos.fill (HIST (" hGlobalBcColMC" ), globalBC - bcSOR );
1175+ histos.fill (HIST (" hOrbitColMC" ), orbit - orbitSOR );
11441176 histos.fill (HIST (" hBcColMC" ), localBC);
11451177 histos.fill (HIST (" hVertexXMC" ), mcCol.posX ());
11461178 histos.fill (HIST (" hVertexYMC" ), mcCol.posY ());
0 commit comments