2525#include " Common/DataModel/EventSelection.h"
2626#include " Common/CCDB/EventSelectionParams.h"
2727#include " Common/CCDB/TriggerAliases.h"
28+ #include " Common/CCDB/RCTSelectionFlags.h"
2829#include " CCDB/BasicCCDBManager.h"
2930#include " CommonConstants/LHCConstants.h"
3031#include " Framework/HistogramRegistry.h"
@@ -66,6 +67,8 @@ struct BcSelectionTask {
6667 Configurable<int > confTimeFrameEndBorderMargin{" TimeFrameEndBorderMargin" , -1 , " Number of bcs to cut at the end of the Time Frame. Take from CCDB if -1" }; // o2-linter: disable=name/configurable (temporary fix)
6768 Configurable<bool > confCheckRunDurationLimits{" checkRunDurationLimits" , false , " Check if the BCs are within the run duration limits" }; // o2-linter: disable=name/configurable (temporary fix)
6869 Configurable<std::vector<int >> maxInactiveChipsPerLayer{" maxInactiveChipsPerLayer" , {8 , 8 , 8 , 111 , 111 , 195 , 195 }, " Maximum allowed number of inactive ITS chips per layer" };
70+ Configurable<bool > rctCheckZDC{" rctCheckZDC" , false , " Check ZDC flag for Pb-Pb from RCT for lumi histograms" };
71+ Configurable<bool > rctTreatLimitedAcceptanceAsBad{" rctTreatLimitedAcceptanceAsBad" , false , " Reject limited acceptance from RCT for lumi histograms" };
6972
7073 int lastRun = -1 ;
7174 int64_t lastTF = -1 ;
@@ -90,6 +93,13 @@ struct BcSelectionTask {
9093 bool isGoodITSLayer3 = true ; // default value
9194 bool isGoodITSLayer0123 = true ; // default value
9295 bool isGoodITSLayersAll = true ; // default value
96+ // RCT checkers for lumi histograms
97+ o2::aod::rctsel::RCTFlagsChecker rctCheckerCBT;
98+ o2::aod::rctsel::RCTFlagsChecker rctCheckerCBThadronPID;
99+ o2::aod::rctsel::RCTFlagsChecker rctCheckerCBTelectronPID;
100+ o2::aod::rctsel::RCTFlagsChecker rctCheckerCBTcalo;
101+ o2::aod::rctsel::RCTFlagsChecker rctCheckerCBTmuon;
102+ o2::aod::rctsel::RCTFlagsChecker rctCheckerCBTmuonGlo;
93103 void init (InitContext&)
94104 {
95105 if (metadataInfo.isFullyDefined () && !doprocessRun2 && !doprocessRun3) { // Check if the metadata is initialized (only if not forced from the workflow configuration)
@@ -107,22 +117,53 @@ struct BcSelectionTask {
107117 ccdb->setLocalObjectValidityChecking ();
108118
109119 histos.add (" hCounterTVX" , " " , kTH1D , {{1 , 0 ., 1 .}});
120+ histos.add (" hCounterTVX_CBT" , " " , kTH1D , {{1 , 0 ., 1 .}});
121+ histos.add (" hCounterTVX_CBT_hadronPID" , " " , kTH1D , {{1 , 0 ., 1 .}});
122+ histos.add (" hCounterTVX_CBT_electronPID" , " " , kTH1D , {{1 , 0 ., 1 .}});
123+ histos.add (" hCounterTVX_CBT_calo" , " " , kTH1D , {{1 , 0 ., 1 .}});
124+ histos.add (" hCounterTVX_CBT_muon" , " " , kTH1D , {{1 , 0 ., 1 .}});
125+ histos.add (" hCounterTVX_CBT_muon_glo" , " " , kTH1D , {{1 , 0 ., 1 .}});
110126 histos.add (" hCounterTCE" , " " , kTH1D , {{1 , 0 ., 1 .}});
111127 histos.add (" hCounterZEM" , " " , kTH1D , {{1 , 0 ., 1 .}});
112128 histos.add (" hCounterZNC" , " " , kTH1D , {{1 , 0 ., 1 .}});
113129 histos.add (" hCounterTVXafterBCcuts" , " " , kTH1D , {{1 , 0 ., 1 .}});
130+ histos.add (" hCounterTVXafterBCcuts_CBT" , " " , kTH1D , {{1 , 0 ., 1 .}});
131+ histos.add (" hCounterTVXafterBCcuts_CBT_hadronPID" , " " , kTH1D , {{1 , 0 ., 1 .}});
132+ histos.add (" hCounterTVXafterBCcuts_CBT_electronPID" , " " , kTH1D , {{1 , 0 ., 1 .}});
133+ histos.add (" hCounterTVXafterBCcuts_CBT_calo" , " " , kTH1D , {{1 , 0 ., 1 .}});
134+ histos.add (" hCounterTVXafterBCcuts_CBT_muon" , " " , kTH1D , {{1 , 0 ., 1 .}});
135+ histos.add (" hCounterTVXafterBCcuts_CBT_muon_glo" , " " , kTH1D , {{1 , 0 ., 1 .}});
114136 histos.add (" hCounterTCEafterBCcuts" , " " , kTH1D , {{1 , 0 ., 1 .}});
115137 histos.add (" hCounterZEMafterBCcuts" , " " , kTH1D , {{1 , 0 ., 1 .}});
116138 histos.add (" hCounterZNCafterBCcuts" , " " , kTH1D , {{1 , 0 ., 1 .}});
117139 histos.add (" hCounterInvalidBCTimestamp" , " " , kTH1D , {{1 , 0 ., 1 .}});
118140 histos.add (" hLumiTVX" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
141+ histos.add (" hLumiTVX_CBT" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
142+ histos.add (" hLumiTVX_CBT_hadronPID" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
143+ histos.add (" hLumiTVX_CBT_electronPID" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
144+ histos.add (" hLumiTVX_CBT_calo" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
145+ histos.add (" hLumiTVX_CBT_muon" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
146+ histos.add (" hLumiTVX_CBT_muon_glo" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
119147 histos.add (" hLumiTCE" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
120148 histos.add (" hLumiZEM" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
121149 histos.add (" hLumiZNC" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
122150 histos.add (" hLumiTVXafterBCcuts" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
151+ histos.add (" hLumiTVXafterBCcuts_CBT" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
152+ histos.add (" hLumiTVXafterBCcuts_CBT_hadronPID" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
153+ histos.add (" hLumiTVXafterBCcuts_CBT_electronPID" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
154+ histos.add (" hLumiTVXafterBCcuts_CBT_calo" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
155+ histos.add (" hLumiTVXafterBCcuts_CBT_muon" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
156+ histos.add (" hLumiTVXafterBCcuts_CBT_muon_glo" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
123157 histos.add (" hLumiTCEafterBCcuts" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
124158 histos.add (" hLumiZEMafterBCcuts" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
125159 histos.add (" hLumiZNCafterBCcuts" , " ;;Luminosity, 1/#mub" , kTH1D , {{1 , 0 ., 1 .}});
160+
161+ rctCheckerCBT.init (" CBT" , rctCheckZDC.value , rctTreatLimitedAcceptanceAsBad.value );
162+ rctCheckerCBThadronPID.init (" CBT_hadronPID" , rctCheckZDC.value , rctTreatLimitedAcceptanceAsBad.value );
163+ rctCheckerCBTelectronPID.init (" CBT_electronPID" , rctCheckZDC.value , rctTreatLimitedAcceptanceAsBad.value );
164+ rctCheckerCBTcalo.init (" CBT_calo" , rctCheckZDC.value , rctTreatLimitedAcceptanceAsBad.value );
165+ rctCheckerCBTmuon.init (" CBT_muon" , rctCheckZDC.value , rctTreatLimitedAcceptanceAsBad.value );
166+ rctCheckerCBTmuonGlo.init (" CBT_muon_glo" , rctCheckZDC.value , rctTreatLimitedAcceptanceAsBad.value );
126167 }
127168
128169 void processRun2 (
@@ -360,6 +401,7 @@ struct BcSelectionTask {
360401 // store rct flags
361402 uint32_t rct = lastRCT;
362403 int64_t thisTF = (bc.globalBC () - bcSOR) / nBCsPerTF;
404+ bool goodCBT{false }, goodCBThadronPID{false }, goodCBTelectronPID{false }, goodCBTcalo{false }, goodCBTmuon{false }, goodCBTmuonGlo{false };
363405 if (mapRCT != nullptr && thisTF != lastTF) { // skip for unanchored runs; do it once per TF
364406 auto itrct = mapRCT->upper_bound (bc.timestamp ());
365407 if (itrct != mapRCT->begin ())
@@ -368,6 +410,13 @@ struct BcSelectionTask {
368410 LOGP (debug, " sor={} eor={} ts={} rct={}" , sorTimestamp, eorTimestamp, bc.timestamp (), rct);
369411 lastRCT = rct;
370412 lastTF = thisTF;
413+ // check flags for lumi histograms
414+ goodCBT = rctCheckerCBT.checkFlags (rct);
415+ goodCBThadronPID = rctCheckerCBThadronPID.checkFlags (rct);
416+ goodCBTelectronPID = rctCheckerCBTelectronPID.checkFlags (rct);
417+ goodCBTcalo = rctCheckerCBTcalo.checkFlags (rct);
418+ goodCBTmuon = rctCheckerCBTmuon.checkFlags (rct);
419+ goodCBTmuonGlo = rctCheckerCBTmuonGlo.checkFlags (rct);
371420 }
372421
373422 uint32_t alias{0 };
@@ -510,9 +559,57 @@ struct BcSelectionTask {
510559 if (TESTBIT (selection, kIsTriggerTVX )) {
511560 histos.get <TH1>(HIST (" hCounterTVX" ))->Fill (srun, 1 );
512561 histos.get <TH1>(HIST (" hLumiTVX" ))->Fill (srun, 1 . / csTVX);
562+ if (goodCBT) {
563+ histos.get <TH1>(HIST (" hCounterTVX_CBT" ))->Fill (srun, 1 );
564+ histos.get <TH1>(HIST (" hLumiTVX_CBT" ))->Fill (srun, 1 . / csTVX);
565+ }
566+ if (goodCBThadronPID) {
567+ histos.get <TH1>(HIST (" hCounterTVX_CBT_hadronPID" ))->Fill (srun, 1 );
568+ histos.get <TH1>(HIST (" hLumiTVX_CBT_hadronPID" ))->Fill (srun, 1 . / csTVX);
569+ }
570+ if (goodCBTelectronPID) {
571+ histos.get <TH1>(HIST (" hCounterTVX_CBT_electronPID" ))->Fill (srun, 1 );
572+ histos.get <TH1>(HIST (" hLumiTVX_CBT_electronPID" ))->Fill (srun, 1 . / csTVX);
573+ }
574+ if (goodCBTcalo) {
575+ histos.get <TH1>(HIST (" hCounterTVX_CBT_calo" ))->Fill (srun, 1 );
576+ histos.get <TH1>(HIST (" hLumiTVX_CBT_calo" ))->Fill (srun, 1 . / csTVX);
577+ }
578+ if (goodCBTmuon) {
579+ histos.get <TH1>(HIST (" hCounterTVX_CBT_muon" ))->Fill (srun, 1 );
580+ histos.get <TH1>(HIST (" hLumiTVX_CBT_muon" ))->Fill (srun, 1 . / csTVX);
581+ }
582+ if (goodCBTmuonGlo) {
583+ histos.get <TH1>(HIST (" hCounterTVX_CBT_muon_glo" ))->Fill (srun, 1 );
584+ histos.get <TH1>(HIST (" hLumiTVX_CBT_muon_glo" ))->Fill (srun, 1 . / csTVX);
585+ }
513586 if (TESTBIT (selection, kNoITSROFrameBorder ) && TESTBIT (selection, kNoTimeFrameBorder )) {
514587 histos.get <TH1>(HIST (" hCounterTVXafterBCcuts" ))->Fill (srun, 1 );
515588 histos.get <TH1>(HIST (" hLumiTVXafterBCcuts" ))->Fill (srun, 1 . / csTVX);
589+ if (goodCBT) {
590+ histos.get <TH1>(HIST (" hCounterTVXafterBCcuts_CBT" ))->Fill (srun, 1 );
591+ histos.get <TH1>(HIST (" hLumiTVXafterBCcuts_CBT" ))->Fill (srun, 1 . / csTVX);
592+ }
593+ if (goodCBThadronPID) {
594+ histos.get <TH1>(HIST (" hCounterTVXafterBCcuts_CBT_hadronPID" ))->Fill (srun, 1 );
595+ histos.get <TH1>(HIST (" hLumiTVXafterBCcuts_CBT_hadronPID" ))->Fill (srun, 1 . / csTVX);
596+ }
597+ if (goodCBTelectronPID) {
598+ histos.get <TH1>(HIST (" hCounterTVXafterBCcuts_CBT_electronPID" ))->Fill (srun, 1 );
599+ histos.get <TH1>(HIST (" hLumiTVXafterBCcuts_CBT_electronPID" ))->Fill (srun, 1 . / csTVX);
600+ }
601+ if (goodCBTcalo) {
602+ histos.get <TH1>(HIST (" hCounterTVXafterBCcuts_CBT_calo" ))->Fill (srun, 1 );
603+ histos.get <TH1>(HIST (" hLumiTVX_afterBCcutsCBT_calo" ))->Fill (srun, 1 . / csTVX);
604+ }
605+ if (goodCBTmuon) {
606+ histos.get <TH1>(HIST (" hCounterTVXafterBCcuts_CBT_muon" ))->Fill (srun, 1 );
607+ histos.get <TH1>(HIST (" hLumiTVXafterBCcuts_CBT_muon" ))->Fill (srun, 1 . / csTVX);
608+ }
609+ if (goodCBTmuonGlo) {
610+ histos.get <TH1>(HIST (" hCounterTVXafterBCcuts_CBT_muon_glo" ))->Fill (srun, 1 );
611+ histos.get <TH1>(HIST (" hLumiTVXafterBCcuts_CBT_muon_glo" ))->Fill (srun, 1 . / csTVX);
612+ }
516613 }
517614 }
518615 // Fill counters and lumi histograms for Pb-Pb lumi monitoring
0 commit comments