3838
3939// for time measurements
4040#include < chrono>
41+ #include < optional>
4142
4243using namespace o2 ::framework;
4344
@@ -97,7 +98,7 @@ class EMCALChannelCalibDevice : public o2::framework::Task
9798 mScaleFactorsInitialized = true ;
9899 }
99100 }
100- if (matcher == ConcreteDataMatcher (" CTP" , " CTPCONFIG" , 0 )) {
101+ if (mRejectL0Triggers && matcher == ConcreteDataMatcher (" CTP" , " CTPCONFIG" , 0 )) {
101102 // clear current class mask and prepare to fill in the updated values
102103 // The trigger names are seperated by a ":" in one string in the calib params
103104 mSelectedClassMasks .clear ();
@@ -149,15 +150,21 @@ class EMCALChannelCalibDevice : public o2::framework::Task
149150 }
150151
151152 // prepare CTPConfiguration such that it can be loaded in finalise ccdb
152- pc.inputs ().get <o2::ctp::CTPConfiguration*>(getCTPConfigBinding ());
153+ if (mRejectL0Triggers ) {
154+ pc.inputs ().get <o2::ctp::CTPConfiguration*>(getCTPConfigBinding ());
155+ }
153156
154157 if (!mIsConfigured ) {
155158 // configure calibrators (after calib params are loaded from the CCDB)
156159 configureCalibrators ();
157160 mIsConfigured = true ;
158161 }
159162
160- auto ctpDigits = pc.inputs ().get <gsl::span<o2::ctp::CTPDigit>>(getCTPDigitsBinding ());
163+ using ctpDigitsType = std::decay_t <decltype (pc.inputs ().get <gsl::span<o2::ctp::CTPDigit>>(getCTPDigitsBinding ()))>;
164+ std::optional<ctpDigitsType> ctpDigits;
165+ if (mRejectL0Triggers ) {
166+ ctpDigits = pc.inputs ().get <gsl::span<o2::ctp::CTPDigit>>(getCTPDigitsBinding ());
167+ }
161168
162169 // reset EOR behaviour
163170 if (mTimeCalibrator ) {
@@ -197,7 +204,7 @@ class EMCALChannelCalibDevice : public o2::framework::Task
197204 bool acceptEvent = false ;
198205 // Match the EMCal bc to the CTP bc
199206 int64_t bcEMC = trg.getBCData ().toLong ();
200- for (auto & ctpDigit : ctpDigits) {
207+ for (auto & ctpDigit : * ctpDigits) {
201208 int64_t bcCTP = ctpDigit.intRecord .toLong ();
202209 LOG (debug) << " bcEMC " << bcEMC << " bcCTP " << bcCTP;
203210 if (bcCTP == bcEMC) {
@@ -403,8 +410,10 @@ DataProcessorSpec getEMCALChannelCalibDeviceSpec(const std::string calibType, co
403410 // inputs.emplace_back("EMC_BadChannelMap", o2::header::gDataOriginEMC, "BADCHANNELMAP", 0, Lifetime::Condition, ccdbParamSpec("EMC/Calib/BadChannelMap"));
404411
405412 // data request needed for rejection of EMCal trigger
406- inputs.emplace_back (device::getCTPConfigBinding (), " CTP" , " CTPCONFIG" , 0 , Lifetime::Condition, ccdbParamSpec (" CTP/Config/Config" , ctpcfgperrun));
407- inputs.emplace_back (device::getCTPDigitsBinding (), " CTP" , " DIGITS" , 0 , Lifetime::Timeframe);
413+ if (rejectL0Trigger) {
414+ inputs.emplace_back (device::getCTPConfigBinding (), " CTP" , " CTPCONFIG" , 0 , Lifetime::Condition, ccdbParamSpec (" CTP/Config/Config" , ctpcfgperrun));
415+ inputs.emplace_back (device::getCTPDigitsBinding (), " CTP" , " DIGITS" , 0 , Lifetime::Timeframe);
416+ }
408417
409418 auto ccdbRequest = std::make_shared<o2::base::GRPGeomRequest>(true , // orbitResetTime
410419 true , // GRPECS=true
@@ -425,4 +434,4 @@ DataProcessorSpec getEMCALChannelCalibDeviceSpec(const std::string calibType, co
425434} // namespace framework
426435} // namespace o2
427436
428- #endif
437+ #endif
0 commit comments