diff --git a/Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TPCResidualAggregatorSpec.h b/Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TPCResidualAggregatorSpec.h index 4f1705533c965..b9c99f9e65676 100644 --- a/Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TPCResidualAggregatorSpec.h +++ b/Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TPCResidualAggregatorSpec.h @@ -145,7 +145,6 @@ class ResidualAggregatorDevice : public o2::framework::Task using lumiDataType = std::decay_t(""))>; std::optional lumiInput; if (mCTPInput) { - recoCont.getCTPLumi(); lumiInput = recoCont.getCTPLumi(); lumi = &lumiInput.value(); } diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx index 17a4fab61fd2e..3902692abd7f0 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx @@ -17,12 +17,14 @@ #include "Framework//Task.h" #include "DetectorsBase/BaseDPLDigitizer.h" #include "DataFormatsCTP/Digits.h" +#include "DataFormatsCTP/LumiInfo.h" #include "Steer/HitProcessingManager.h" // for DigitizationContext #include "DetectorsCommonDataFormats/DetID.h" #include "CTPSimulation/Digitizer.h" #include "DataFormatsCTP/Configuration.h" #include "DataFormatsFT0/Digit.h" #include "DataFormatsFV0/Digit.h" +#include "CommonConstants/LHCConstants.h" #include #include @@ -37,7 +39,7 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer using GRP = o2::parameters::GRPObject; public: - CTPDPLDigitizerTask(const std::vector& detList) : o2::base::BaseDPLDigitizer(), mDigitizer(), mDetList(detList) {} + CTPDPLDigitizerTask(const std::vector& detList, float ctpLumiScaler) : o2::base::BaseDPLDigitizer(), mDigitizer(), mDetList(detList), mLumiScaler(ctpLumiScaler) {} ~CTPDPLDigitizerTask() override = default; void initDigitizerTask(framework::InitContext& ic) override { @@ -85,6 +87,12 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer pc.outputs().snapshot(Output{"CTP", "DIGITS", 0}, digits); LOG(info) << "CTP PRESENT being sent."; pc.outputs().snapshot(Output{"CTP", "ROMode", 0}, mROMode); + if (mLumiScaler >= 0.) { + uint32_t nhbf = mLumiScaler > 0.f ? uint32_t(int(mLumiScaler) / mLumiScaler * o2::constants::lhc::LHCRevFreq) : 0; + o2::ctp::LumiInfo lminfo{pc.services().get().firstTForbit, nhbf, 0, uint64_t(mLumiScaler), 0}; + LOG(info) << "CTP Lumi scaler " << lminfo.counts << " for integration time of " << lminfo.nHBFCounted << " being sent"; + pc.outputs().snapshot(Output{"CTP", "LUMI", 0}, lminfo); + } timer.Stop(); LOG(info) << "CTP Digitization took " << timer.CpuTime() << "s"; } @@ -102,8 +110,10 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer o2::parameters::GRPObject::ROMode mROMode = o2::parameters::GRPObject::PRESENT; o2::ctp::Digitizer mDigitizer; ///< Digitizer std::vector mDetList; + float mLumiScaler = -1.; }; -o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector& detList, bool mctruth) + +o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector& detList, float ctpLumiScaler, bool mctruth) { std::vector inputs; std::vector output; @@ -119,12 +129,15 @@ o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector= 0.f) { + output.emplace_back("CTP", "LUMI", 0, Lifetime::Timeframe); + } output.emplace_back("CTP", "ROMode", 0, Lifetime::Timeframe); return DataProcessorSpec{ "CTPDigitizer", inputs, output, - AlgorithmSpec{adaptFromTask(detList)}, + AlgorithmSpec{adaptFromTask(detList, ctpLumiScaler)}, Options{{"pileup", VariantType::Int, 1, {"whether to run in continuous time mode"}}, {"disable-qed", o2::framework::VariantType::Bool, false, {"disable QED handling"}}}}; } diff --git a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h index b5cd46f27ad64..64a058fe539b0 100644 --- a/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h +++ b/Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h @@ -20,7 +20,7 @@ namespace o2 namespace ctp { -o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector& detList, bool mctruth = true); +o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector& detList, float ctpLumiScaler = -1.f, bool mctruth = true); } // namespace ctp } // end namespace o2 diff --git a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx index b111d8f372967..e86ee47550f13 100644 --- a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx +++ b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx @@ -220,6 +220,9 @@ void customize(std::vector& workflowOptions) // to enable distribution of triggers workflowOptions.push_back(ConfigParamSpec{"with-trigger", VariantType::Bool, false, {"enable distribution of CTP trigger digits"}}); + + // option to propagate CTP Lumi scaler counts (if >=0) into the CTP digits + workflowOptions.push_back(ConfigParamSpec{"store-ctp-lumi", VariantType::Float, -1.f, {"store CTP lumi scaler in CTP digits (if >= 0)"}}); } void customize(std::vector& policies) @@ -798,10 +801,11 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) // the CTP part if (isEnabled(o2::detectors::DetID::CTP)) { detList.emplace_back(o2::detectors::DetID::CTP); + float lumiScaler = configcontext.options().get("store-ctp-lumi"); // connect the CTP digitization - specs.emplace_back(o2::ctp::getCTPDigitizerSpec(fanoutsize++, detList)); + specs.emplace_back(o2::ctp::getCTPDigitizerSpec(fanoutsize++, detList, lumiScaler)); // connect the CTP digit writer - specs.emplace_back(o2::ctp::getDigitWriterSpec(false)); + specs.emplace_back(o2::ctp::getDigitWriterSpec(lumiScaler >= 0)); } // GRP updater: must come after all detectors since requires their list if (!configcontext.options().get("only-context")) {