Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TPC digi: Cut digits arriving before timeframe/readout start #13562

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading