Skip to content

Commit 59dc15a

Browse files
committed
Replaced first time interval with job average
1 parent 8a9d681 commit 59dc15a

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

MC/config/common/external/generator/TPCLoopers.C

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ class GenTPCLoopers : public Generator
218218
LOG(info) << "Interaction Time records has " << mInteractionTimeRecords.size() << " entries.";
219219
mCollisionContext->printCollisionSummary();
220220
}
221+
for (int c = 0; c < mInteractionTimeRecords.size() - 1; c++)
222+
{
223+
mIntTimeRecMean += mInteractionTimeRecords[c + 1].bc2ns() - mInteractionTimeRecords[c].bc2ns();
224+
}
225+
mIntTimeRecMean /= (mInteractionTimeRecords.size() - 1); // Average interaction time record used for the reference
221226
}
222227

223228
Bool_t generateEvent() override
@@ -230,11 +235,11 @@ class GenTPCLoopers : public Generator
230235
{
231236
unsigned int nLoopers, nLoopersPairs, nLoopersCompton;
232237
LOG(info) << "mCurrentEvent is " << mCurrentEvent;
233-
LOG(info) << "Current event time: " << ((mCurrentEvent < mInteractionTimeRecords.size() - 1) ? std::to_string(mInteractionTimeRecords[mCurrentEvent + 1].bc2ns() - mInteractionTimeRecords[mCurrentEvent].bc2ns()) : "Final Event till the end") << " ns";
238+
LOG(info) << "Current event time: " << ((mCurrentEvent < mInteractionTimeRecords.size() - 1) ? std::to_string(mInteractionTimeRecords[mCurrentEvent + 1].bc2ns() - mInteractionTimeRecords[mCurrentEvent].bc2ns()) : std::to_string(mIntTimeRecMean)) << " ns";
234239
LOG(info) << "Current time offset wrt BC: " << mInteractionTimeRecords[mCurrentEvent].getTimeOffsetWrtBC() << " ns";
235-
mTimeLimit = (mCurrentEvent < mInteractionTimeRecords.size() - 1) ? mInteractionTimeRecords[mCurrentEvent + 1].bc2ns() - mInteractionTimeRecords[mCurrentEvent].bc2ns() : mInteractionTimeRecords[1].bc2ns() - mInteractionTimeRecords[0].bc2ns();
240+
mTimeLimit = (mCurrentEvent < mInteractionTimeRecords.size() - 1) ? mInteractionTimeRecords[mCurrentEvent + 1].bc2ns() - mInteractionTimeRecords[mCurrentEvent].bc2ns() : mIntTimeRecMean;
236241
// With Flat Gas number of loopers are adapted based on time interval widths
237-
nLoopers = mFlatGasNumber * (mTimeLimit / mStartingTime);
242+
nLoopers = mFlatGasNumber * (mTimeLimit / mIntTimeRecMean);
238243
nLoopersPairs = static_cast<unsigned int>(std::round(nLoopers * mLoopsFractionPairs));
239244
nLoopersCompton = nLoopers - nLoopersPairs;
240245
SetNLoopers(nLoopersPairs, nLoopersCompton);
@@ -421,14 +426,13 @@ class GenTPCLoopers : public Generator
421426
else
422427
{
423428
mFlatGasNumber = number;
424-
mStartingTime = mInteractionTimeRecords[1].bc2ns() - mInteractionTimeRecords[0].bc2ns(); // Time width of first event
425429
}
426430
}
427431
else
428432
{
429433
mFlatGasNumber = -1;
430434
}
431-
LOG(info) << "Flat gas loopers: " << (mFlatGas ? "ON" : "OFF") << ", Number of loopers per event: " << mFlatGasNumber;
435+
LOG(info) << "Flat gas loopers: " << (mFlatGas ? "ON" : "OFF") << ", Reference loopers number per event: " << mFlatGasNumber;
432436
}
433437

434438
void setFractionPairs(float &fractionPairs)
@@ -468,7 +472,7 @@ class GenTPCLoopers : public Generator
468472
std::vector<o2::InteractionTimeRecord> mInteractionTimeRecords; // Interaction time records from collision context
469473
Bool_t mFlatGas = false; // Flag to indicate if flat gas loopers are used
470474
Int_t mFlatGasNumber = -1; // Number of flat gas loopers per event
471-
double mStartingTime = 1.0; // First BC time interval in ns used for reference in adaptive loopers
475+
double mIntTimeRecMean = 1.0; // Average interaction time record used for the reference
472476
double mTimeLimit = 0.0; // Time limit for the current event
473477
float mLoopsFractionPairs = 0.08; // Fraction of loopers from Pairs
474478
};

0 commit comments

Comments
 (0)