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

[EMCAL-614] Fixing the pileup simulation #5426

Merged
merged 1 commit into from
Feb 9, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 6 additions & 10 deletions Detectors/EMCAL/simulation/include/EMCALSimulation/Digitizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,9 @@ class Digitizer : public TObject
void setEventTime(double t);
double getTriggerTime() const { return mTriggerTime; }
double getEventTime() const { return mEventTime; }
bool isLive(double t) const { return (t < mLiveTime); }
bool isLive(double t) const { return (t - mTriggerTime < mLiveTime); }
bool isLive() const { return (mEventTime < mLiveTime); }

void setContinuous(bool v) { mContinuous = v; }
bool isContinuous() const { return mContinuous; }

bool isEmpty() const { return mEmpty; }

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

std::vector<Digit> mTempDigitVector; ///< temporary digit storage
std::unordered_map<Int_t, std::list<LabeledDigit>> mDigits; ///< used to sort digits and labels by tower
std::vector<Digit> mTempDigitVector; ///< temporary digit storage
std::unordered_map<Int_t, std::list<LabeledDigit>> mDigits; ///< used to sort digits and labels by tower

TRandom3* mRandomGenerator = nullptr; // random number generator
std::vector<int> mTimeBinOffset; // offset of first time bin
std::vector<std::vector<double>> mAmplitudeInTimeBins; // amplitude of signal for each time bin
TRandom3* mRandomGenerator = nullptr; // random number generator
std::vector<int> mTimeBinOffset; // offset of first time bin
std::vector<std::vector<double>> mAmplitudeInTimeBins; // amplitude of signal for each time bin

float mLiveTime = 1500; // EMCal live time (ns)
float mBusyTime = 35000; // EMCal busy time (ns)
Expand Down
2 changes: 1 addition & 1 deletion Detectors/EMCAL/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void Digitizer::setEventTime(double t)
// convert to ns
t *= mCoeffToNanoSecond;

if (t < mEventTime && mContinuous) {
if (t < mEventTime) {
LOG(FATAL) << "New event time (" << t << ") is < previous event time (" << mEventTime << ")";
}

Expand Down
7 changes: 4 additions & 3 deletions Steer/DigitizerWorkflow/src/EMCALDigitizerSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ void DigitizerSpec::run(framework::ProcessingContext& ctx)
// loop over all composite collisions given from context
// (aka loop over all the interaction records)
for (int collID = 0; collID < timesview.size(); ++collID) {
if (!mDigitizer.isEmpty() && (o2::emcal::SimParam::Instance().isDisablePileup() || !mDigitizer.isLive(timesview[collID].getTimeNS()))) {

mDigitizer.setEventTime(timesview[collID].getTimeNS());

if (!mDigitizer.isEmpty() && (o2::emcal::SimParam::Instance().isDisablePileup() || !mDigitizer.isLive())) {
// copy digits into accumulator
mDigits.clear();
mLabels.clear();
Expand All @@ -93,8 +96,6 @@ void DigitizerSpec::run(framework::ProcessingContext& ctx)
mLabels.clear();
}

mDigitizer.setEventTime(timesview[collID].getTimeNS());

if (!mDigitizer.isLive()) {
continue;
}
Expand Down