Skip to content

Commit fb34e69

Browse files
sawenzelalcaliva
authored andcommitted
ITS digi: Ability to process events before the first RO
This commit makes it possible to inject events/hits into the ITS digitizer which happen in time before the "first interaction sampled" (start of the first readout-frame given by HBFUtils). The commit avoids/fixes a segmenation fault which, so far, occurs in these situations (because of overflow of unsigned int32 newROFrame) The commit allows to reduce "startup" effects in a timeframe by capturing hits that come from events before data taking starts. This makes MC more realistic. With these "startup effects" removed, one could now play with short timeframe lengths for skimming studies. (cherry picked from commit d9e8f04)
1 parent a7088e6 commit fb34e69

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/Digitizer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class Digitizer : public TObject
118118
uint32_t mROFrameMin = 0; ///< lowest RO frame of current digits
119119
uint32_t mROFrameMax = 0; ///< highest RO frame of current digits
120120
uint32_t mNewROFrame = 0; ///< ROFrame corresponding to provided time
121+
bool mIsBeforeFirstRO = false;
121122

122123
uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
123124
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)

Detectors/ITSMFT/common/simulation/src/Digitizer.cxx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ void Digitizer::init()
102102
}
103103
mParams.print();
104104
mIRFirstSampledTF = o2::raw::HBFUtils::Instance().getFirstSampledTFIR();
105+
106+
//
107+
LOG(info) << "First IR sampled in digitization is: " << mIRFirstSampledTF;
108+
LOG(info) << "First IR ns " << mIRFirstSampledTF.bc2ns();
105109
}
106110

107111
auto Digitizer::getChipResponse(int chipID)
@@ -167,7 +171,19 @@ void Digitizer::setEventTime(const o2::InteractionTimeRecord& irt)
167171
if (mCollisionTimeWrtROF < 0 && nbc > 0) {
168172
nbc--;
169173
}
170-
mNewROFrame = nbc / mParams.getROFrameLengthInBC();
174+
175+
// we might get interactions to digitize from before
176+
// the first sampled IR
177+
if (nbc < 0) {
178+
mNewROFrame = 0;
179+
// this event is before the first RO
180+
mIsBeforeFirstRO = true;
181+
} else {
182+
mNewROFrame = nbc / mParams.getROFrameLengthInBC();
183+
mIsBeforeFirstRO = false;
184+
}
185+
LOG(info) << " NewROFrame " << mNewROFrame << " nbc " << nbc;
186+
171187
// in continuous mode depends on starts of periodic readout frame
172188
mCollisionTimeWrtROF += (nbc % mParams.getROFrameLengthInBC()) * o2::constants::lhc::LHCBunchSpacingNS;
173189
} else {
@@ -275,6 +291,11 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
275291
if (isContinuous()) {
276292
timeInROF += mCollisionTimeWrtROF;
277293
}
294+
if (mIsBeforeFirstRO && timeInROF < 0) {
295+
// disregard this hit because it comes from an event before readout starts and it does not effect this RO
296+
return;
297+
}
298+
278299
// calculate RO Frame for this hit
279300
if (timeInROF < 0) {
280301
timeInROF = 0.;
@@ -290,7 +311,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
290311
maxFr = roFrameMax; // if signal extends beyond current maxFrame, increase the latter
291312
}
292313

293-
// here we start stepping in the depth of the sensor to generate charge diffision
314+
// here we start stepping in the depth of the sensor to generate charge diffusion
294315
float nStepsInv = mParams.getNSimStepsInv();
295316
int nSteps = mParams.getNSimSteps();
296317
const auto& matrix = mGeometry->getMatrixL2G(hit.GetDetectorID());

0 commit comments

Comments
 (0)