12#ifndef O2_CTP_RAWDECODER_H
13#define O2_CTP_RAWDECODER_H
29namespace reco_workflow
36class RawDecoderSpec :
public framework::Task
63 void integrateLumi(
const std::array<double, o2::constants::lhc::LHCMaxBunches>& tfCounts1,
const std::array<double, o2::constants::lhc::LHCMaxBunches>& tfCounts2, int64_t unixTime, uint32_t nOrbitsThisTF);
64 void writeMassiLinePerBC(
int bc, int64_t unixTime,
double lumi,
double lumiErr,
double correctedRate,
double correctedLumi,
double mu);
73 bool mDoDigits =
true;
75 int mMaxInputSize = 0;
76 bool mMaxInputSizeFatal = 0;
81 bool mVerbose =
false;
92 double mWindowStartTime = 0.0;
93 bool mDecodeinputs = 0;
94 std::deque<size_t> mHistoryT;
95 std::deque<size_t> mHistoryV;
98 int mLostDueToShiftInps = 0;
102 int mTCRRejected = 0;
103 std::array<uint64_t, o2::ctp::CTP_NCLASSES> mClsEA{};
104 std::array<uint64_t, o2::ctp::CTP_NCLASSES> mClsEB{};
105 std::array<uint64_t, o2::ctp::CTP_NCLASSES> mClsA{};
106 std::array<uint64_t, o2::ctp::CTP_NCLASSES> mClsB{};
107 bool mCheckConsistency =
false;
108 std::array<double, o2::constants::lhc::LHCMaxBunches> mCountsPerBC1{};
109 std::array<double, o2::constants::lhc::LHCMaxBunches> mCountsPerBC2{};
110 double totalTime = 0.0;
112 const double tfTime = mOrbitsPerTF * o2::constants::lhc::LHCOrbitMUS * 1
e-6;
113 std::bitset<3564> mLHCBCs;
114 static constexpr double orbitTime = o2::constants::lhc::LHCOrbitMUS * 1
e-6;
115 std::array<double, o2::constants::lhc::LHCMaxBunches> mTotalCountsPerBC1{};
116 std::array<double, o2::constants::lhc::LHCMaxBunches> mTotalCountsPerBC2{};
117 double mTotalElapsedTime = 0.0;
119 std::string mFillNumber =
"unknown";
120 std::string mMassiOutDir;
122 double mOrbitResetTimeSec = 0.0;
123 bool mStableBeams =
false;
124 std::map<int, std::ofstream> mMassiFiles;
126 double mCrossSection = 1.0;
127 double mTFsInMin = 0.0;
129 bool mHavePrevTF =
false;
130 int mRunStartTime = 0;
133 std::array<double, o2::constants::lhc::LHCMaxBunches> countsPerBC1{};
134 std::array<double, o2::constants::lhc::LHCMaxBunches> countsPerBC2{};
138 std::map<uint32_t, PendingTF> mPendingTFs;
140 void flushReadyTFs();
141 void flushAllPendingTFs();
142 std::pair<double, double> pileupCorrection(
double rate)
const;
definition of CTPDigit, CTPInputDigit
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
Digits tw Raw translation.
void run(framework::ProcessingContext &ctx) final
Run conversion of raw data to cells.
void computeLumiPerBC(const o2::pmr::vector< CTPDigit > &ctpdigits, uint32_t firstOrbit, uint32_t orbitsPerTF)
Compute per BC luminosity from the interaction counts from CTP digits.
void writeMassiLinePerBC(int bc, int64_t unixTime, double lumi, double lumiErr, double correctedRate, double correctedLumi, double mu)
~RawDecoderSpec() override=default
Destructor.
void writeMassiLineLumi(int64_t unixTime, double lumi, double lumiErr)
void integrateLumi(const std::array< double, o2::constants::lhc::LHCMaxBunches > &tfCounts1, const std::array< double, o2::constants::lhc::LHCMaxBunches > &tfCounts2, int64_t unixTime, uint32_t nOrbitsThisTF)
Integrate luminosity per BC over multiple time frames.
void init(framework::InitContext &ctx) final
Initializing the RawDecoderSpec.
void fetchRunInfo(int runNumber)
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
RawDecoderSpec(bool digits, bool lumi)
Constructor.
void updateTimeDependentParams(framework::ProcessingContext &pc)
int yearFromUnixTime(int64_t unixTime) const
int64_t unixTimeForOrbitStart(uint32_t orbit) const
o2::framework::DataProcessorSpec getRawDecoderSpec(bool askSTFDist, bool digits, bool lumi)
Creating DataProcessorSpec for the CTP.
std::vector< T, fair::mq::pmr::polymorphic_allocator< T > > vector
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< Digit > digits