1717#include " Framework//Task.h"
1818#include " DetectorsBase/BaseDPLDigitizer.h"
1919#include " DataFormatsCTP/Digits.h"
20+ #include " DataFormatsCTP/LumiInfo.h"
2021#include " Steer/HitProcessingManager.h" // for DigitizationContext
2122#include " DetectorsCommonDataFormats/DetID.h"
2223#include " CTPSimulation/Digitizer.h"
2324#include " DataFormatsCTP/Configuration.h"
2425#include " DataFormatsFT0/Digit.h"
2526#include " DataFormatsFV0/Digit.h"
27+ #include " CommonConstants/LHCConstants.h"
2628
2729#include < TStopwatch.h>
2830#include < gsl/span>
@@ -37,7 +39,7 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer
3739 using GRP = o2::parameters::GRPObject;
3840
3941 public:
40- CTPDPLDigitizerTask (const std::vector<o2::detectors::DetID>& detList) : o2::base::BaseDPLDigitizer(), mDigitizer (), mDetList (detList) {}
42+ CTPDPLDigitizerTask (const std::vector<o2::detectors::DetID>& detList, float ctpLumiScaler ) : o2::base::BaseDPLDigitizer(), mDigitizer (), mDetList (detList), mLumiScaler (ctpLumiScaler ) {}
4143 ~CTPDPLDigitizerTask () override = default ;
4244 void initDigitizerTask (framework::InitContext& ic) override
4345 {
@@ -85,6 +87,12 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer
8587 pc.outputs ().snapshot (Output{" CTP" , " DIGITS" , 0 }, digits);
8688 LOG (info) << " CTP PRESENT being sent." ;
8789 pc.outputs ().snapshot (Output{" CTP" , " ROMode" , 0 }, mROMode );
90+ if (mLumiScaler >= 0 .) {
91+ uint32_t nhbf = mLumiScaler > 0 .f ? uint32_t (int (mLumiScaler ) / mLumiScaler * o2::constants::lhc::LHCRevFreq) : 0 ;
92+ o2::ctp::LumiInfo lminfo{pc.services ().get <o2::framework::TimingInfo>().firstTForbit , nhbf, 0 , uint64_t (mLumiScaler ), 0 };
93+ LOG (info) << " CTP Lumi scaler " << lminfo.counts << " for integration time of " << lminfo.nHBFCounted << " being sent" ;
94+ pc.outputs ().snapshot (Output{" CTP" , " LUMI" , 0 }, lminfo);
95+ }
8896 timer.Stop ();
8997 LOG (info) << " CTP Digitization took " << timer.CpuTime () << " s" ;
9098 }
@@ -102,8 +110,10 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer
102110 o2::parameters::GRPObject::ROMode mROMode = o2::parameters::GRPObject::PRESENT;
103111 o2::ctp::Digitizer mDigitizer ; // /< Digitizer
104112 std::vector<o2::detectors::DetID> mDetList ;
113+ float mLumiScaler = -1 .;
105114};
106- o2::framework::DataProcessorSpec getCTPDigitizerSpec (int channel, std::vector<o2::detectors::DetID>& detList, bool mctruth)
115+
116+ o2::framework::DataProcessorSpec getCTPDigitizerSpec (int channel, std::vector<o2::detectors::DetID>& detList, float ctpLumiScaler, bool mctruth)
107117{
108118 std::vector<InputSpec> inputs;
109119 std::vector<OutputSpec> output;
@@ -119,12 +129,15 @@ o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector<o2
119129 }
120130 inputs.emplace_back (" ctpconfig" , " CTP" , " CTPCONFIG" , 0 , Lifetime::Condition, ccdbParamSpec (" CTP/Config/Config" , true ));
121131 output.emplace_back (" CTP" , " DIGITS" , 0 , Lifetime::Timeframe);
132+ if (ctpLumiScaler >= 0 .f ) {
133+ output.emplace_back (" CTP" , " LUMI" , 0 , Lifetime::Timeframe);
134+ }
122135 output.emplace_back (" CTP" , " ROMode" , 0 , Lifetime::Timeframe);
123136 return DataProcessorSpec{
124137 " CTPDigitizer" ,
125138 inputs,
126139 output,
127- AlgorithmSpec{adaptFromTask<CTPDPLDigitizerTask>(detList)},
140+ AlgorithmSpec{adaptFromTask<CTPDPLDigitizerTask>(detList, ctpLumiScaler )},
128141 Options{{" pileup" , VariantType::Int, 1 , {" whether to run in continuous time mode" }},
129142 {" disable-qed" , o2::framework::VariantType::Bool, false , {" disable QED handling" }}}};
130143}
0 commit comments