Skip to content

Commit f28b1db

Browse files
committed
call digitizer param instance each time it is needed (possibly to be cleaned up in future)
1 parent 5d4a873 commit f28b1db

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ void Digitizer::init()
5050
/// }
5151
}
5252

53+
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
54+
5355
LOG(info) << "Initializing IOTOF digitizer";
54-
LOG(info) << " Time resolution: " << timeResolution * 1e3 << " ps";
55-
LOG(info) << " Charge threshold: " << chargeThreshold << " electrons";
56-
LOG(info) << " Detection efficiency: " << efficiency * 100 << " %";
56+
LOG(info) << " Time resolution: " << digitizerParams.timeResolution * 1e3 << " ps";
57+
LOG(info) << " Charge threshold: " << digitizerParams.chargeThreshold << " electrons";
58+
LOG(info) << " Detection efficiency: " << digitizerParams.efficiency * 100 << " %";
5759
LOG(info) << " Continuous mode: " << (mContinuous ? "ON" : "OFF");
5860
sSegmentation = o2::iotof::Segmentation::Instance();
5961
}
@@ -114,8 +116,8 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID)
114116
int electronsPerStep = static_cast<int>(charge / digitizerParams.nSimSteps);
115117

116118
// Apply charge threshold
117-
if (charge < chargeThreshold) {
118-
LOG(debug) << "Hit rejected by charge threshold: " << charge << " < " << chargeThreshold;
119+
if (charge < digitizerParams.chargeThreshold) {
120+
LOG(debug) << "Hit rejected by charge threshold: " << charge << " < " << digitizerParams.chargeThreshold;
119121
return;
120122
}
121123

@@ -256,8 +258,9 @@ void Digitizer::stepping(const o2::itsmft::Hit& hit, float**& respMatrix, int& r
256258
double Digitizer::smearTime(double time) const
257259
{
258260
// Apply Gaussian smearing to simulate detector time resolution
259-
if (timeResolution > 0) {
260-
return time + gRandom->Gaus(0, timeResolution);
261+
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
262+
if (digitizerParams.timeResolution > 0) {
263+
return time + gRandom->Gaus(0, digitizerParams.timeResolution);
261264
}
262265
return time;
263266
}
@@ -268,14 +271,16 @@ int Digitizer::energyToCharge(float energyLoss) const
268271
// Convert energy loss (GeV) to number of electrons
269272
// Typical value: 3.6 eV per electron-hole pair in silicon
270273
// energyLoss is in GeV, energyToNElectrons is electrons per GeV
271-
return static_cast<int>(energyLoss * energyToNElectrons);
274+
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
275+
return static_cast<int>(energyLoss * digitizerParams.energyToNElectrons);
272276
}
273277

274278
//_______________________________________________________________________
275279
bool Digitizer::isEfficient() const
276280
{
277281
// Apply efficiency cut using random number
278-
return gRandom->Uniform() < efficiency;
282+
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
283+
return gRandom->Uniform() < digitizerParams.efficiency;
279284
}
280285

281286
//_______________________________________________________________________
@@ -284,6 +289,8 @@ void Digitizer::fillOutputContainer()
284289
LOG(info) << "Filling output container with digits from chips";
285290
LOG(debug) << "Number of chips: " << mChips.size();
286291

292+
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
293+
287294
o2::itsmft::ROFRecord rof;
288295
rof.setFirstEntry(mDigits->size()); // index of the first digit
289296

@@ -303,7 +310,7 @@ void Digitizer::fillOutputContainer()
303310
auto& chipDigits = chip.getDigits();
304311
for (const auto& [key, digit] : chipDigits) {
305312

306-
if (digit.getCharge() < chargeThreshold) {
313+
if (digit.getCharge() < digitizerParams.chargeThreshold) {
307314
continue; // skip digits below threshold
308315
}
309316

0 commit comments

Comments
 (0)