Skip to content

Commit

Permalink
TPC digi: Cut digits arriving before timeframe/readout start
Browse files Browse the repository at this point in the history
Relates to
https://its.cern.ch/jira/browse/O2-5395

and should allow to treat correctly events coming before the timeframe
start to reduce the startup effect in MC.
  • Loading branch information
sawenzel committed Oct 9, 2024
1 parent ff3f5b3 commit 81baf91
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ inline float SAMPAProcessing::getZfromTimeBin(float timeBin, Side s) const

inline TimeBin SAMPAProcessing::getTimeBinFromTime(float time) const
{
if (time < 0.f) {
// protection and convention for negative times (otherwise overflow)
return 0;
}
return static_cast<TimeBin>(time / mEleParam->ZbinWidth);
}

Expand Down
13 changes: 12 additions & 1 deletion Detectors/TPC/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ void Digitizer::process(const std::vector<o2::tpc::HitGroup>& hits,
}
const float absoluteTime = eleTime + mTDriftOffset + (mEventTime - mOutputDigitTimeOffset); /// in us

/// the absolute time needs to be within the readout limits
/// (otherwise negative times would all be accumulated in the 0-th timebin further below)
if (!(absoluteTime >= 0 /* && absoluteTime <= timeframelength */)) {
continue;
}

/// Attachment
if (electronTransport.isElectronAttachment(driftTime)) {
continue;
Expand Down Expand Up @@ -217,9 +223,14 @@ void Digitizer::setUseSCDistortions(std::string_view finp)

void Digitizer::setStartTime(double time)
{
// this is setting the first timebin index for the digit container
// note that negative times w.r.t start of timeframe/data-taking == mOutputDigitTimeOffset
// will yield the 0-th bin (due to casting logic in sampaProcessing)
SAMPAProcessing& sampaProcessing = SAMPAProcessing::instance();
sampaProcessing.updateParameters(mVDrift);
mDigitContainer.setStartTime(sampaProcessing.getTimeBinFromTime(time - mOutputDigitTimeOffset));
const auto timediff = time - mOutputDigitTimeOffset;
const auto starttimebin = sampaProcessing.getTimeBinFromTime(timediff);
mDigitContainer.setStartTime(starttimebin);
}

void Digitizer::setLumiScaleFactor()
Expand Down

0 comments on commit 81baf91

Please sign in to comment.