Skip to content

Commit

Permalink
ITS digi: Ability to process events before the first RO
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sawenzel committed Oct 1, 2024
1 parent 993746f commit d9e8f04
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class Digitizer : public TObject
uint32_t mROFrameMin = 0; ///< lowest RO frame of current digits
uint32_t mROFrameMax = 0; ///< highest RO frame of current digits
uint32_t mNewROFrame = 0; ///< ROFrame corresponding to provided time
bool mIsBeforeFirstRO = false;

uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)
Expand Down
25 changes: 23 additions & 2 deletions Detectors/ITSMFT/common/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ void Digitizer::init()
}
mParams.print();
mIRFirstSampledTF = o2::raw::HBFUtils::Instance().getFirstSampledTFIR();

//
LOG(info) << "First IR sampled in digitization is: " << mIRFirstSampledTF;
LOG(info) << "First IR ns " << mIRFirstSampledTF.bc2ns();
}

auto Digitizer::getChipResponse(int chipID)
Expand Down Expand Up @@ -167,7 +171,19 @@ void Digitizer::setEventTime(const o2::InteractionTimeRecord& irt)
if (mCollisionTimeWrtROF < 0 && nbc > 0) {
nbc--;
}
mNewROFrame = nbc / mParams.getROFrameLengthInBC();

// we might get interactions to digitize from before
// the first sampled IR
if (nbc < 0) {
mNewROFrame = 0;
// this event is before the first RO
mIsBeforeFirstRO = true;
} else {
mNewROFrame = nbc / mParams.getROFrameLengthInBC();
mIsBeforeFirstRO = false;
}
LOG(info) << " NewROFrame " << mNewROFrame << " nbc " << nbc;

// in continuous mode depends on starts of periodic readout frame
mCollisionTimeWrtROF += (nbc % mParams.getROFrameLengthInBC()) * o2::constants::lhc::LHCBunchSpacingNS;
} else {
Expand Down Expand Up @@ -275,6 +291,11 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
if (isContinuous()) {
timeInROF += mCollisionTimeWrtROF;
}
if (mIsBeforeFirstRO && timeInROF < 0) {
// disregard this hit because it comes from an event before readout starts and it does not effect this RO
return;
}

// calculate RO Frame for this hit
if (timeInROF < 0) {
timeInROF = 0.;
Expand All @@ -290,7 +311,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
maxFr = roFrameMax; // if signal extends beyond current maxFrame, increase the latter
}

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

0 comments on commit d9e8f04

Please sign in to comment.