Skip to content

Commit f485cc0

Browse files
jokonigsawenzel
authored andcommitted
[O2-5395, EMCAL-501] Implement correct handling of events preceding timeframe
- Reject digits if it comes from a collision happening at a bc before the RO starts and the time of the digit also comes before the RO - Time of current collision calculated w.r.t start of RO
1 parent 52a1d75 commit f485cc0

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Detectors/EMCAL/simulation/include/EMCALSimulation/Digitizer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class Digitizer : public TObject
110110
bool mSmearEnergy = true; ///< do time and energy smearing
111111
bool mSimulateTimeResponse = true; ///< simulate time response
112112
const SimParam* mSimParam = nullptr; ///< SimParam object
113+
bool mIsBeforeFirstRO = false; ///< check if the signal comes before the ROF
114+
o2::InteractionRecord mIRFirstSampledTF; ///< IR of the 1st sampled IR, noise-only ROFs will be inserted till this IR only
115+
double mTimeBCns; ///< time difference between bc and start of ROF in ns
113116

114117
std::vector<Digit> mTempDigitVector; ///< temporary digit storage
115118
o2::emcal::DigitsWriteoutBuffer mDigits; ///< used to sort digits and labels by tower

Detectors/EMCAL/simulation/src/Digitizer.cxx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include "CommonDataFormat/InteractionRecord.h"
2727
#include "CommonUtils/TreeStreamRedirector.h"
2828
#include "SimConfig/DigiParams.h"
29+
#include "DetectorsRaw/HBFUtilsInitializer.h"
30+
#include "DetectorsRaw/HBFUtils.h"
2931

3032
ClassImp(o2::emcal::Digitizer);
3133

@@ -80,6 +82,8 @@ void Digitizer::init()
8082
} else {
8183
}
8284

85+
mIRFirstSampledTF = o2::raw::HBFUtils::Instance().getFirstSampledTFIR();
86+
8387
if (mEnableDebugStreaming) {
8488
mDebugStream = std::make_unique<o2::utils::TreeStreamRedirector>("emcaldigitsDebug.root", "RECREATE");
8589
}
@@ -164,6 +168,13 @@ void Digitizer::sampleSDigit(const Digit& sDigit)
164168
return;
165169
}
166170

171+
// check if this hit because it comes from an event before readout starts and it does not effect this RO
172+
LOG(debug) << "mIsBeforeFirstRO " << mIsBeforeFirstRO << " sDigit.getTimeStamp() " << sDigit.getTimeStamp() << " mSimParam->getSignalDelay() " << mSimParam->getSignalDelay() << " mPhase " << mPhase << " total: " << sDigit.getTimeStamp() + mSimParam->getSignalDelay() + mPhase * 25 << " EMC_TOF_MAX " << EMC_TOF_MAX << " mTimeBCns " << mTimeBCns;
173+
if (mIsBeforeFirstRO && sDigit.getTimeStamp() + mTimeBCns < 0) {
174+
LOG(debug) << "disregard this hit because it comes from an event before readout starts and it does not effect this RO";
175+
return;
176+
}
177+
167178
Double_t energies[15];
168179
if (mSimulateTimeResponse) {
169180
if (sDigit.getTimeStamp() + mSimParam->getSignalDelay() + mPhase * 25 > EMC_TOF_MAX) {
@@ -246,4 +257,16 @@ void Digitizer::setEventTime(o2::InteractionTimeRecord record, bool trigger)
246257
mPhase = 0;
247258
mEventTimeOffset++;
248259
}
260+
261+
// get time difference between current bc and start of RO in ns
262+
auto nbc = record.differenceInBC(mIRFirstSampledTF);
263+
mTimeBCns = record.getTimeOffsetWrtBC();
264+
mTimeBCns += nbc * o2::constants::lhc::LHCBunchSpacingNS;
265+
266+
if (nbc < 0) {
267+
// this event is before the first RO
268+
mIsBeforeFirstRO = true;
269+
} else {
270+
mIsBeforeFirstRO = false;
271+
}
249272
}

0 commit comments

Comments
 (0)