Skip to content

Commit 9f72140

Browse files
hahassan7shahor02
authored andcommitted
[EMCAL-614] Fixing the pileup simulation
1 parent c093a2f commit 9f72140

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

Detectors/EMCAL/simulation/include/EMCALSimulation/Digitizer.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,9 @@ class Digitizer : public TObject
5757
void setEventTime(double t);
5858
double getTriggerTime() const { return mTriggerTime; }
5959
double getEventTime() const { return mEventTime; }
60-
bool isLive(double t) const { return (t < mLiveTime); }
60+
bool isLive(double t) const { return (t - mTriggerTime < mLiveTime); }
6161
bool isLive() const { return (mEventTime < mLiveTime); }
6262

63-
void setContinuous(bool v) { mContinuous = v; }
64-
bool isContinuous() const { return mContinuous; }
65-
6663
bool isEmpty() const { return mEmpty; }
6764

6865
void fillOutputContainer(std::vector<Digit>& digits, o2::dataformats::MCTruthContainer<o2::emcal::MCLabel>& labels);
@@ -97,7 +94,6 @@ class Digitizer : public TObject
9794
short mEventTimeOffset = 0; ///< event time difference from trigger time (in number of bins)
9895
short mPhase = 0; ///< event phase
9996
double mCoeffToNanoSecond = 1.0; ///< coefficient to convert event time (Fair) to ns
100-
bool mContinuous = false; ///< flag for continuous simulation
10197
UInt_t mROFrameMin = 0; ///< lowest RO frame of current digits
10298
UInt_t mROFrameMax = 0; ///< highest RO frame of current digits
10399
int mCurrSrcID = 0; ///< current MC source from the manager
@@ -109,12 +105,12 @@ class Digitizer : public TObject
109105
const SimParam* mSimParam = nullptr; ///< SimParam object
110106
bool mEmpty = true; ///< Digitizer contains no digits/labels
111107

112-
std::vector<Digit> mTempDigitVector; ///< temporary digit storage
113-
std::unordered_map<Int_t, std::list<LabeledDigit>> mDigits; ///< used to sort digits and labels by tower
108+
std::vector<Digit> mTempDigitVector; ///< temporary digit storage
109+
std::unordered_map<Int_t, std::list<LabeledDigit>> mDigits; ///< used to sort digits and labels by tower
114110

115-
TRandom3* mRandomGenerator = nullptr; // random number generator
116-
std::vector<int> mTimeBinOffset; // offset of first time bin
117-
std::vector<std::vector<double>> mAmplitudeInTimeBins; // amplitude of signal for each time bin
111+
TRandom3* mRandomGenerator = nullptr; // random number generator
112+
std::vector<int> mTimeBinOffset; // offset of first time bin
113+
std::vector<std::vector<double>> mAmplitudeInTimeBins; // amplitude of signal for each time bin
118114

119115
float mLiveTime = 1500; // EMCal live time (ns)
120116
float mBusyTime = 35000; // EMCal busy time (ns)

Detectors/EMCAL/simulation/src/Digitizer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ void Digitizer::setEventTime(double t)
174174
// convert to ns
175175
t *= mCoeffToNanoSecond;
176176

177-
if (t < mEventTime && mContinuous) {
177+
if (t < mEventTime) {
178178
LOG(FATAL) << "New event time (" << t << ") is < previous event time (" << mEventTime << ")";
179179
}
180180

Steer/DigitizerWorkflow/src/EMCALDigitizerSpec.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ void DigitizerSpec::run(framework::ProcessingContext& ctx)
7979
// loop over all composite collisions given from context
8080
// (aka loop over all the interaction records)
8181
for (int collID = 0; collID < timesview.size(); ++collID) {
82-
if (!mDigitizer.isEmpty() && (o2::emcal::SimParam::Instance().isDisablePileup() || !mDigitizer.isLive(timesview[collID].getTimeNS()))) {
82+
83+
mDigitizer.setEventTime(timesview[collID].getTimeNS());
84+
85+
if (!mDigitizer.isEmpty() && (o2::emcal::SimParam::Instance().isDisablePileup() || !mDigitizer.isLive())) {
8386
// copy digits into accumulator
8487
mDigits.clear();
8588
mLabels.clear();
@@ -93,8 +96,6 @@ void DigitizerSpec::run(framework::ProcessingContext& ctx)
9396
mLabels.clear();
9497
}
9598

96-
mDigitizer.setEventTime(timesview[collID].getTimeNS());
97-
9899
if (!mDigitizer.isLive()) {
99100
continue;
100101
}

0 commit comments

Comments
 (0)