|
5 | 5 | #include <rapidjson/document.h> |
6 | 6 | #include "CCDB/CCDBTimeStampUtils.h" |
7 | 7 | #include "CCDB/CcdbApi.h" |
| 8 | +#include "DetectorsRaw/HBFUtils.h" |
8 | 9 |
|
9 | 10 | // Static Ort::Env instance for multiple onnx model loading |
10 | 11 | static Ort::Env global_env(ORT_LOGGING_LEVEL_WARNING, "GlobalEnv"); |
@@ -219,9 +220,9 @@ class GenTPCLoopers : public Generator |
219 | 220 | { |
220 | 221 | unsigned int nLoopers, nLoopersPairs, nLoopersCompton; |
221 | 222 | LOG(debug) << "mCurrentEvent is " << mCurrentEvent; |
222 | | - LOG(debug) << "Current event time: " << ((mCurrentEvent < mInteractionTimeRecords.size() - 1) ? std::to_string(mInteractionTimeRecords[mCurrentEvent + 1].bc2ns() - mInteractionTimeRecords[mCurrentEvent].bc2ns()) : std::to_string(mIntTimeRecMean)) << " ns"; |
| 223 | + LOG(debug) << "Current event time: " << ((mCurrentEvent < mInteractionTimeRecords.size() - 1) ? std::to_string(mInteractionTimeRecords[mCurrentEvent + 1].bc2ns() - mInteractionTimeRecords[mCurrentEvent].bc2ns()) : std::to_string(mTimeEnd - mInteractionTimeRecords[mCurrentEvent].bc2ns())) << " ns"; |
223 | 224 | LOG(debug) << "Current time offset wrt BC: " << mInteractionTimeRecords[mCurrentEvent].getTimeOffsetWrtBC() << " ns"; |
224 | | - mTimeLimit = (mCurrentEvent < mInteractionTimeRecords.size() - 1) ? mInteractionTimeRecords[mCurrentEvent + 1].bc2ns() - mInteractionTimeRecords[mCurrentEvent].bc2ns() : mIntTimeRecMean; |
| 225 | + mTimeLimit = (mCurrentEvent < mInteractionTimeRecords.size() - 1) ? mInteractionTimeRecords[mCurrentEvent + 1].bc2ns() - mInteractionTimeRecords[mCurrentEvent].bc2ns() : mTimeEnd - mInteractionTimeRecords[mCurrentEvent].bc2ns(); |
225 | 226 | // With flat gas the number of loopers are adapted based on time interval widths |
226 | 227 | nLoopers = mFlatGasNumber * (mTimeLimit / mIntTimeRecMean); |
227 | 228 | nLoopersPairs = static_cast<unsigned int>(std::round(nLoopers * mLoopsFractionPairs)); |
@@ -424,6 +425,12 @@ class GenTPCLoopers : public Generator |
424 | 425 | mIntTimeRecMean += mInteractionTimeRecords[c + 1].bc2ns() - mInteractionTimeRecords[c].bc2ns(); |
425 | 426 | } |
426 | 427 | mIntTimeRecMean /= (mInteractionTimeRecords.size() - 1); // Average interaction time record used as reference |
| 428 | + const auto& hbfUtils = o2::raw::HBFUtils::Instance(); |
| 429 | + // Get the start time of the second orbit after the last interaction record |
| 430 | + const auto& lastIR = mInteractionTimeRecords.back(); |
| 431 | + o2::InteractionRecord finalOrbitIR(0, lastIR.orbit + 2); // Final orbit, BC = 0 |
| 432 | + mTimeEnd = finalOrbitIR.bc2ns(); |
| 433 | + LOG(debug) << "Final orbit start time: " << mTimeEnd << " ns while last interaction record time is " << mInteractionTimeRecords.back().bc2ns() << " ns"; |
427 | 434 | } |
428 | 435 | } else { |
429 | 436 | mFlatGasNumber = -1; |
@@ -470,6 +477,7 @@ class GenTPCLoopers : public Generator |
470 | 477 | Int_t mFlatGasNumber = -1; // Number of flat gas loopers per event |
471 | 478 | double mIntTimeRecMean = 1.0; // Average interaction time record used for the reference |
472 | 479 | double mTimeLimit = 0.0; // Time limit for the current event |
| 480 | + double mTimeEnd = 0.0; // Time limit for the last event |
473 | 481 | float mLoopsFractionPairs = 0.08; // Fraction of loopers from Pairs |
474 | 482 | }; |
475 | 483 |
|
|
0 commit comments