|
15 | 15 | #include "DataFormatsMCH/ROFRecord.h" |
16 | 16 | #include "DataFormatsParameters/GRPObject.h" |
17 | 17 | #include "DetectorsBase/BaseDPLDigitizer.h" |
18 | | -#include "DetectorsRaw/HBFUtils.h" |
19 | 18 | #include "Framework/ConfigParamRegistry.h" |
20 | 19 | #include "Framework/ControlService.h" |
21 | 20 | #include "Framework/DataProcessorSpec.h" |
@@ -63,7 +62,7 @@ class MCHDPLDigitizerTask : public o2::base::BaseDPLDigitizer |
63 | 62 | if (labels.getIndexedSize() != digits.size()) { |
64 | 63 | LOGP(error, "Number of labels != number of digits"); |
65 | 64 | } |
66 | | - LOGP(info, "Number of signal pileup : {} ({} %)", nPileup, 100. * nPileup / digits.size()); |
| 65 | + LOGP(info, "Number of signal pileup : {} ({} %)", nPileup, digits.empty() ? 0. : 100.* nPileup / digits.size()); |
67 | 66 | auto tEnd = std::chrono::high_resolution_clock::now(); |
68 | 67 | auto duration = tEnd - start; |
69 | 68 | auto d = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count(); |
@@ -104,20 +103,12 @@ class MCHDPLDigitizerTask : public o2::base::BaseDPLDigitizer |
104 | 103 | } |
105 | 104 |
|
106 | 105 | // generate noise-only signals between first and last collisions ± 100 BC (= 25 ADC samples). |
107 | | - // A timeframe can hold no collision at all when the interaction rate is low; take the range |
108 | | - // from the timeframe itself in that case, since there are no collisions to take it from. |
109 | | - int64_t firstLong, lastLong; |
110 | | - if (eventRecords.empty()) { |
111 | | - const auto& hbf = o2::raw::HBFUtils::Instance(); |
112 | | - firstLong = InteractionRecord(0, hbf.orbitFirstSampled).toLong(); |
113 | | - lastLong = InteractionRecord(0, hbf.orbitFirstSampled + hbf.nHBFPerTF).toLong(); |
114 | | - } else { |
115 | | - firstLong = eventRecords.front().toLong(); |
116 | | - lastLong = eventRecords.back().toLong(); |
| 106 | + // A timeframe can hold no collision at all when the interaction rate is low; skip it in that case. |
| 107 | + if (!eventRecords.empty()) { |
| 108 | + auto firstIR = InteractionRecord::long2IR(std::max(int64_t(0), eventRecords.front().toLong() - timeOffset - 100)); |
| 109 | + auto lastIR = InteractionRecord::long2IR(std::max(int64_t(0), eventRecords.back().toLong() - timeOffset + 100)); |
| 110 | + mDigitizer->addNoise(firstIR, lastIR); |
117 | 111 | } |
118 | | - auto firstIR = InteractionRecord::long2IR(std::max(int64_t(0), firstLong - timeOffset - 100)); |
119 | | - auto lastIR = InteractionRecord::long2IR(std::max(int64_t(0), lastLong - timeOffset + 100)); |
120 | | - mDigitizer->addNoise(firstIR, lastIR); |
121 | 112 |
|
122 | 113 | // digitize |
123 | 114 | std::vector<Digit> digits{}; |
|
0 commit comments