Skip to content

Commit 2ba8cfc

Browse files
authored
Propagate digitizer interaction rate via DigitizationContext (#13296)
Some digitizer (EMCAL) aim to use the interaction rate for flow-control in digitization. This is now possible from a new member in DigitizationContext which will be filled in digitizer workflows.
1 parent c191058 commit 2ba8cfc

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

DataFormats/simulation/include/SimulationDataFormat/DigitizationContext.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ class DigitizationContext
8282
void setMuPerBC(float m) { mMuBC = m; }
8383
float getMuPerBC() const { return mMuBC; }
8484

85+
/// returns the main (hadronic interaction rate) associated to this digitization context
86+
float getCalculatedInteractionRate() const { return getMuPerBC() * getBunchFilling().getNBunches() * o2::constants::lhc::LHCRevFreq; }
87+
8588
void printCollisionSummary(bool withQED = false, int truncateOutputTo = -1) const;
8689

8790
// we need a method to fill the file names
@@ -150,6 +153,9 @@ class DigitizationContext
150153
}
151154
}
152155

156+
void setDigitizerInteractionRate(float intRate) { mDigitizerInteractionRate = intRate; }
157+
float getDigitizerInteractionRate() const { return mDigitizerInteractionRate; }
158+
153159
std::vector<o2::ctp::CTPDigit> const* getCTPDigits() const { return mCTPTrigger; }
154160
bool hasTriggerInput() const { return mHasTrigger; }
155161

@@ -184,7 +190,13 @@ class DigitizationContext
184190
mutable std::vector<o2::ctp::CTPDigit> const* mCTPTrigger = nullptr; // CTP trigger info associated to this digitization context
185191
mutable bool mHasTrigger = false; //
186192

187-
ClassDefNV(DigitizationContext, 5);
193+
// The global ALICE interaction hadronic interaction rate as applied in digitization.
194+
// It should be consistent with mMuPerBC but it might be easier to handle.
195+
// The value will be filled/inserted by the digitization workflow so that digiters can access it.
196+
// There is no guarantee that the value is available elsewhere.
197+
float mDigitizerInteractionRate{-1};
198+
199+
ClassDefNV(DigitizationContext, 6);
188200
};
189201

190202
/// function reading the hits from a chain (previously initialized with initSimChains

Detectors/EMCAL/workflow/src/EMCALDigitizerSpec.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ void DigitizerSpec::run(framework::ProcessingContext& ctx)
8282

8383
// read collision context from input
8484
auto context = ctx.inputs().get<o2::steer::DigitizationContext*>("collisioncontext");
85+
86+
// get interaction rate ... so that it can be used in digitization
87+
auto intRate = context->getDigitizerInteractionRate();
8588
context->initSimChains(o2::detectors::DetID::EMC, mSimChains);
8689
auto& timesview = context->getEventRecords();
8790
LOG(debug) << "GOT " << timesview.size() << " COLLISSION TIMES";

Steer/DigitizerWorkflow/src/SimReaderSpec.cxx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ namespace steer
4545
{
4646

4747
std::vector<o2::ctp::CTPDigit>* ctptrigger = nullptr;
48+
float gIntRate = -1.;
4849

4950
DataProcessorSpec getSimReaderSpec(SubspecRange range, const std::vector<std::string>& simprefixes, const std::vector<int>& tpcsectors, bool withTrigger)
5051
{
@@ -55,7 +56,7 @@ DataProcessorSpec getSimReaderSpec(SubspecRange range, const std::vector<std::st
5556

5657
auto doit = [range, tpcsectors, activeSectors, withTrigger](ProcessingContext& pc) {
5758
auto& mgr = steer::HitProcessingManager::instance();
58-
const auto& context = mgr.getDigitizationContext();
59+
auto& context = mgr.getDigitizationContext();
5960
auto eventrecords = context.getEventRecords();
6061

6162
if (withTrigger) {
@@ -64,6 +65,9 @@ DataProcessorSpec getSimReaderSpec(SubspecRange range, const std::vector<std::st
6465
context.setCTPDigits(ctptrigger);
6566
}
6667

68+
// inject the global interaction rate information
69+
context.setDigitizerInteractionRate(gIntRate);
70+
6771
for (auto const& sector : tpcsectors) {
6872
// Note: the TPC sector header was serving the sector to lane mapping before
6973
// now the only remaining purpose is to propagate the mask of valid sectors
@@ -128,6 +132,10 @@ DataProcessorSpec getSimReaderSpec(SubspecRange range, const std::vector<std::st
128132
}
129133
}
130134

135+
gIntRate = ctx.options().get<float>("interactionRate"); // is interaction rate requested?
136+
if (gIntRate < 1.f) {
137+
gIntRate = 1.f;
138+
}
131139
// do we start from an existing context
132140
auto incontextstring = ctx.options().get<std::string>("incontext");
133141
LOG(info) << "INCONTEXTSTRING " << incontextstring;
@@ -137,13 +145,8 @@ DataProcessorSpec getSimReaderSpec(SubspecRange range, const std::vector<std::st
137145
LOG(fatal) << "Could not read collision context from " << incontextstring;
138146
}
139147
} else {
140-
141-
auto intRate = ctx.options().get<float>("interactionRate"); // is interaction rate requested?
142-
if (intRate < 1.f) {
143-
intRate = 1.f;
144-
}
145-
LOG(info) << "Imposing hadronic interaction rate " << intRate << "Hz";
146-
mgr.getInteractionSampler().setInteractionRate(intRate);
148+
LOG(info) << "Imposing hadronic interaction rate " << gIntRate << "Hz";
149+
mgr.getInteractionSampler().setInteractionRate(gIntRate);
147150
o2::raw::HBFUtils::Instance().print();
148151
o2::raw::HBFUtils::Instance().checkConsistency();
149152
mgr.getInteractionSampler().setFirstIR({0, o2::raw::HBFUtils::Instance().orbitFirstSampled});

0 commit comments

Comments
 (0)