@@ -216,6 +216,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
216216 ctpRateFetcher irFetcher;
217217 std::string irSourceForCptFetcher;
218218
219+ // guard variable to guarantee full configuration
220+ // important for RCT, Zorro
221+ bool isInitCalled{false };
222+
219223 // / Set standard preselection gap trigger (values taken from UD group)
220224 SGCutParHolder setSgPreselection ()
221225 {
@@ -277,6 +281,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
277281 if (!irSource.value .empty ()) {
278282 irSourceForCptFetcher = irSource.value ;
279283 }
284+
285+ // full configuration complete: update the guard variable
286+ isInitCalled = true ;
280287 }
281288
282289 // / \brief Applies event selection.
@@ -304,8 +311,14 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
304311
305312 if constexpr (UseEvSel) {
306313 // / RCT condition
307- if (requireGoodRct && !rctChecker.checkTable (collision)) {
308- SETBIT (rejectionMask, EventRejection::Rct);
314+ if (requireGoodRct) {
315+ if (!isInitCalled) {
316+ // protect against incomplete configuration
317+ LOG (fatal) << " Checking RCT flags w/o full HF event-selection configuration. Call the function HfEventSelection::init() to fix." ;
318+ }
319+ if (!rctChecker.checkTable (collision)) {
320+ SETBIT (rejectionMask, EventRejection::Rct);
321+ }
309322 }
310323 // / trigger condition
311324 if ((useSel8Trigger && !collision.sel8 ()) || (!useSel8Trigger && triggerClass > -1 && !collision.alias_bit (triggerClass))) {
@@ -368,6 +381,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
368381 }
369382
370383 if (!softwareTrigger.value .empty ()) {
384+ if (!isInitCalled) {
385+ // protect against incomplete configuration
386+ LOG (fatal) << " Using Zorro utility w/o full HF event-selection configuration. Call the function HfEventSelection::init() to fix." ;
387+ }
371388 // we might have to update it from CCDB
372389 const auto bc = collision.template bc_as <TBcs>();
373390 const auto runNumber = bc.runNumber ();
@@ -480,6 +497,7 @@ struct HfEventSelectionMc {
480497 std::string rctLabel; // RCT selection flag
481498 bool rctCheckZDC{false }; // require ZDC from RCT
482499 bool rctTreatLimitedAcceptanceAsBad{false }; // RCT flag to reject events with limited acceptance for selected detectors
500+ bool isInitCalled{false }; // guard variable to guarantee full configuration, important for RCT
483501
484502 // util to retrieve the RCT info from CCDB
485503 o2::aod::rctsel::RCTFlagsChecker rctChecker;
@@ -557,6 +575,9 @@ struct HfEventSelectionMc {
557575
558576 // we initialise histograms
559577 addHistograms (registry);
578+
579+ // full configuration complete: update the guard variable
580+ isInitCalled = true ;
560581 }
561582
562583 // / \brief Function to apply event selections to generated MC collisions
@@ -583,6 +604,10 @@ struct HfEventSelectionMc {
583604
584605 // / RCT condition
585606 if (requireGoodRct) {
607+ if (!isInitCalled) {
608+ // protect against incomplete configuration
609+ LOG (fatal) << " Checking RCT flags w/o full HF event-selection configuration (MC). Call the function HfEventSelectionMc::init() to fix." ;
610+ }
586611 if (!rctChecker.checkTable (bc)) {
587612 SETBIT (rejectionMask, EventRejection::Rct);
588613 }
0 commit comments