diff --git a/Detectors/TPC/simulation/include/TPCSimulation/DigitContainer.h b/Detectors/TPC/simulation/include/TPCSimulation/DigitContainer.h index 6e9b669caa9c4..36b3f69478e04 100644 --- a/Detectors/TPC/simulation/include/TPCSimulation/DigitContainer.h +++ b/Detectors/TPC/simulation/include/TPCSimulation/DigitContainer.h @@ -19,6 +19,9 @@ #include "TPCBase/CRU.h" #include "DataFormatsTPC/Defs.h" #include "TPCSimulation/DigitTime.h" +#include "TPCBase/ParameterDetector.h" +#include "TPCBase/ParameterElectronics.h" +#include "TPCBase/ParameterGas.h" namespace o2 { @@ -76,10 +79,17 @@ class DigitContainer Sector mSector; ///< ID of the currently processed sector TimeBin mFirstTimeBin; ///< First time bin to consider TimeBin mEffectiveTimeBin; ///< Effective time bin of that digit + TimeBin mTmaxTriggered; ///< Maximum time bin in case of triggered mode (TPClength / width of time bin) std::deque mTimeBins; ///< Time bin Container for the ADC value }; -inline DigitContainer::DigitContainer() : mSector(-1), mFirstTimeBin(0), mEffectiveTimeBin(0), mTimeBins(500) {} +inline DigitContainer::DigitContainer() : mSector(-1), mFirstTimeBin(0), mEffectiveTimeBin(0), mTmaxTriggered(0), mTimeBins(500) +{ + const static ParameterDetector& detParam = ParameterDetector::defaultInstance(); + const static ParameterElectronics& eleParam = ParameterElectronics::defaultInstance(); + const static ParameterGas& gasParam = ParameterGas::defaultInstance(); + mTmaxTriggered = detParam.getTPClength() / (eleParam.getZBinWidth() * gasParam.getVdrift()); +} inline void DigitContainer::setup(const Sector& sector) { diff --git a/Detectors/TPC/simulation/src/DigitContainer.cxx b/Detectors/TPC/simulation/src/DigitContainer.cxx index 90459711d700a..892b07a873692 100644 --- a/Detectors/TPC/simulation/src/DigitContainer.cxx +++ b/Detectors/TPC/simulation/src/DigitContainer.cxx @@ -46,8 +46,10 @@ void DigitContainer::fillOutputContainer(std::vector* output, TimeBin timeBin = mFirstTimeBin; for (auto& time : mTimeBins) { /// the time bins between the last event and the timing of this event are uncorrelated and can be written out - /// OR the readout is triggered (i.e. not continuous) and we can dump everything in any case + /// OR the readout is triggered (i.e. not continuous) and we can dump everything in any case, as long it is within one drift time interval if ((nProcessedTimeBins + mFirstTimeBin < eventTime) || !isContinuous) { + if (!isContinuous && timeBin > mTmaxTriggered) + continue; ++nProcessedTimeBins; time.fillOutputContainer(output, mcTruth, debug, mSector, timeBin); } else {