Skip to content

Commit bad8177

Browse files
committed
Optionally store CTP lumi scaler (norm to 1s) in CTP digitizer output
1 parent 24f1796 commit bad8177

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TPCResidualAggregatorSpec.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ class ResidualAggregatorDevice : public o2::framework::Task
145145
using lumiDataType = std::decay_t<decltype(pc.inputs().get<o2::ctp::LumiInfo>(""))>;
146146
std::optional<lumiDataType> lumiInput;
147147
if (mCTPInput) {
148-
recoCont.getCTPLumi();
149148
lumiInput = recoCont.getCTPLumi();
150149
lumi = &lumiInput.value();
151150
}

Steer/DigitizerWorkflow/src/CTPDigitizerSpec.cxx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "DataFormatsCTP/Configuration.h"
2424
#include "DataFormatsFT0/Digit.h"
2525
#include "DataFormatsFV0/Digit.h"
26+
#include "CommonConstants/LHCConstants.h"
2627

2728
#include <TStopwatch.h>
2829
#include <gsl/span>
@@ -37,7 +38,7 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer
3738
using GRP = o2::parameters::GRPObject;
3839

3940
public:
40-
CTPDPLDigitizerTask(const std::vector<o2::detectors::DetID>& detList) : o2::base::BaseDPLDigitizer(), mDigitizer(), mDetList(detList) {}
41+
CTPDPLDigitizerTask(const std::vector<o2::detectors::DetID>& detList, float ctpLumiScaler) : o2::base::BaseDPLDigitizer(), mDigitizer(), mDetList(detList), mLumiScaler(ctpLumiScaler) {}
4142
~CTPDPLDigitizerTask() override = default;
4243
void initDigitizerTask(framework::InitContext& ic) override
4344
{
@@ -85,6 +86,12 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer
8586
pc.outputs().snapshot(Output{"CTP", "DIGITS", 0}, digits);
8687
LOG(info) << "CTP PRESENT being sent.";
8788
pc.outputs().snapshot(Output{"CTP", "ROMode", 0}, mROMode);
89+
if (mLumiScaler >= 0.) {
90+
int nhbf = mLumiScaler > 0.f ? int(int(mLumiScaler) / mLumiScaler * o2::constants::lhc::LHCRevFreq) : 0;
91+
o2::ctp::LumiInfo lminfo{pc.services().get<o2::framework::TimingInfo>().firstTForbit, nhbf, 0, int(mLumiScaler), 0};
92+
LOG(info) << "CTP Lumi scaler " << lminfo.counts << " for integration time of " << lminfo.nHBFCounted << " being sent";
93+
pc.outputs().snapshot(Output{"CTP", "LUMI", 0}, lminfo);
94+
}
8895
timer.Stop();
8996
LOG(info) << "CTP Digitization took " << timer.CpuTime() << "s";
9097
}
@@ -102,8 +109,10 @@ class CTPDPLDigitizerTask : public o2::base::BaseDPLDigitizer
102109
o2::parameters::GRPObject::ROMode mROMode = o2::parameters::GRPObject::PRESENT;
103110
o2::ctp::Digitizer mDigitizer; ///< Digitizer
104111
std::vector<o2::detectors::DetID> mDetList;
112+
float mLumiScaler = -1.;
105113
};
106-
o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector<o2::detectors::DetID>& detList, bool mctruth)
114+
115+
o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector<o2::detectors::DetID>& detList, int ctpLumiScaler, bool mctruth)
107116
{
108117
std::vector<InputSpec> inputs;
109118
std::vector<OutputSpec> output;
@@ -119,12 +128,15 @@ o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector<o2
119128
}
120129
inputs.emplace_back("ctpconfig", "CTP", "CTPCONFIG", 0, Lifetime::Condition, ccdbParamSpec("CTP/Config/Config", true));
121130
output.emplace_back("CTP", "DIGITS", 0, Lifetime::Timeframe);
131+
if (ctpLumiScaler >= 0) {
132+
output.emplace_back("CTP", "LUMI", 0, Lifetime::Timeframe);
133+
}
122134
output.emplace_back("CTP", "ROMode", 0, Lifetime::Timeframe);
123135
return DataProcessorSpec{
124136
"CTPDigitizer",
125137
inputs,
126138
output,
127-
AlgorithmSpec{adaptFromTask<CTPDPLDigitizerTask>(detList)},
139+
AlgorithmSpec{adaptFromTask<CTPDPLDigitizerTask>(detList, ctpLumiScaler)},
128140
Options{{"pileup", VariantType::Int, 1, {"whether to run in continuous time mode"}},
129141
{"disable-qed", o2::framework::VariantType::Bool, false, {"disable QED handling"}}}};
130142
}

Steer/DigitizerWorkflow/src/CTPDigitizerSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace o2
2020
namespace ctp
2121
{
2222

23-
o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector<o2::detectors::DetID>& detList, bool mctruth = true);
23+
o2::framework::DataProcessorSpec getCTPDigitizerSpec(int channel, std::vector<o2::detectors::DetID>& detList, float ctpLumiScaler = -1.f, bool mctruth = true);
2424

2525
} // namespace ctp
2626
} // end namespace o2

Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
220220

221221
// to enable distribution of triggers
222222
workflowOptions.push_back(ConfigParamSpec{"with-trigger", VariantType::Bool, false, {"enable distribution of CTP trigger digits"}});
223+
224+
// option to propagate CTP Lumi scaler counts (if >=0) into the CTP digits
225+
workflowOptions.push_back(ConfigParamSpec{"store-ctp-lumi", VariantType::Float, -1.f, {"store CTP lumi scaler in CTP digits (if >= 0)"}});
223226
}
224227

225228
void customize(std::vector<o2::framework::DispatchPolicy>& policies)
@@ -798,10 +801,11 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
798801
// the CTP part
799802
if (isEnabled(o2::detectors::DetID::CTP)) {
800803
detList.emplace_back(o2::detectors::DetID::CTP);
804+
float lumiScaler = configcontext.options().get<float>("store-ctp-lumi");
801805
// connect the CTP digitization
802-
specs.emplace_back(o2::ctp::getCTPDigitizerSpec(fanoutsize++, detList));
806+
specs.emplace_back(o2::ctp::getCTPDigitizerSpec(fanoutsize++, detList, lumiScaler));
803807
// connect the CTP digit writer
804-
specs.emplace_back(o2::ctp::getDigitWriterSpec(false));
808+
specs.emplace_back(o2::ctp::getDigitWriterSpec(lumiScaler >= 0));
805809
}
806810
// GRP updater: must come after all detectors since requires their list
807811
if (!configcontext.options().get<bool>("only-context")) {

0 commit comments

Comments
 (0)