@@ -125,7 +125,7 @@ void RawDecoderSpec::endOfStream(framework::EndOfStreamContext& ec)
125125 auto [mu, correctedRate1] = pileupCorrection (rate1);
126126 double correctedLumi1 = correctedRate1 / mCrossSection ;
127127 writeMassiLinePerBC (bc, mWindowStartTime , lumi1, lumiErr1, correctedLumi1, correctedRate1, mu);
128- }
128+ }
129129 if (mLHCBCs .test (bc)) {
130130 totalLumi1 += mCountsPerBC1 [bc] / (timeInterval * mCrossSection );
131131 totalLumi2 += mCountsPerBC2 [bc] / (timeInterval * mCrossSection );
@@ -136,21 +136,21 @@ void RawDecoderSpec::endOfStream(framework::EndOfStreamContext& ec)
136136 }
137137 LOG (info) << " Flushed trailing partial window of " << mTFsInCurrentWindow << " TFs at end of stream" ;
138138 }
139- // Calculate and print total luminosity for given fill
140- double totalFillCountsInp1 = 0.0 ;
141- double totalFillCountsInp2 = 0.0 ;
142- for (const auto & count : mTotalCountsPerBC1 ) {
143- totalFillCountsInp1 += count;
144- }
145- for (const auto & count : mTotalCountsPerBC2 ) {
146- totalFillCountsInp2 += count;
147- }
148- // Estimate the total integrated luminosity for the fill in ub^-1 and the rate in Hz
149- double avgRate1 = totalFillCountsInp1 / mTotalElapsedTime ;
150- double fillDurationSec = (mRunInfo .eor - mRunInfo .sor ) / 1000.0 ;
151- double totalIntLumiInp1 = totalFillCountsInp1 / mCrossSection ;
152- double estimatedTotalIntLumiInp1 = (avgRate1 / mCrossSection ) * fillDurationSec;
153- LOG (info) << " Total Integrated Luminosity Input 1: " << totalIntLumiInp1 << " ub^-1" << " Rate (vis): " << avgRate1 << " Hz, Estimated Total Integrated Lumi: " << estimatedTotalIntLumiInp1 << " ub^-1" ;
139+ // Calculate and print total luminosity for given fill
140+ double totalFillCountsInp1 = 0.0 ;
141+ double totalFillCountsInp2 = 0.0 ;
142+ for (const auto & count : mTotalCountsPerBC1 ) {
143+ totalFillCountsInp1 += count;
144+ }
145+ for (const auto & count : mTotalCountsPerBC2 ) {
146+ totalFillCountsInp2 += count;
147+ }
148+ // Estimate the total integrated luminosity for the fill in ub^-1 and the rate in Hz
149+ double avgRate1 = totalFillCountsInp1 / mTotalElapsedTime ;
150+ double fillDurationSec = (mRunInfo .eor - mRunInfo .sor ) / 1000.0 ;
151+ double totalIntLumiInp1 = totalFillCountsInp1 / mCrossSection ;
152+ double estimatedTotalIntLumiInp1 = (avgRate1 / mCrossSection ) * fillDurationSec;
153+ LOG (info) << " Total Integrated Luminosity Input 1: " << totalIntLumiInp1 << " ub^-1" << " Rate (vis): " << avgRate1 << " Hz, Estimated Total Integrated Lumi: " << estimatedTotalIntLumiInp1 << " ub^-1" ;
154154 // Close files at end of stream
155155 for (auto & [bucket, ofs] : mMassiFiles ) {
156156 ofs.close ();
@@ -213,9 +213,8 @@ void RawDecoderSpec::run(framework::ProcessingContext& ctx)
213213 int64_t diff = static_cast <int64_t >(mFirstOrbit ) - static_cast <int64_t >(mPrevTFLastOrbit );
214214 if (diff < 0 ) {
215215 LOG (warning) << " TF arrived out of order: previous TF ended at orbit " << mPrevTFLastOrbit << " , this TF starts at " << mFirstOrbit << " (orbit went backwards by " << diff << " )" ;
216- }
217- else if (diff > 0 ) {
218- LOG (warning) << " Gap detected: previous TF ended at orbit " << expectedOrbit << " , this TF starts at " << mFirstOrbit << " (missing " << (mFirstOrbit - expectedOrbit) << " orbits)" ;
216+ } else if (diff > 0 ) {
217+ LOG (warning) << " Gap detected: previous TF ended at orbit " << expectedOrbit << " , this TF starts at " << mFirstOrbit << " (missing " << (mFirstOrbit - expectedOrbit) << " orbits)" ;
219218 }
220219 }
221220 }
@@ -325,8 +324,10 @@ void RawDecoderSpec::computeLumiPerBC(const o2::pmr::vector<CTPDigit>& ctpdigits
325324 uint64_t mask = digit.CTPInputMask .to_ullong ();
326325 uint16_t bc = digit.intRecord .bc ;
327326 if (bc < o2::constants::lhc::LHCMaxBunches) {
328- if (mask & inputMask1) tfCountsPerBC1[bc] += 1.0 ;
329- if (mask & inputMask2) tfCountsPerBC2[bc] += 1.0 ;
327+ if (mask & inputMask1)
328+ tfCountsPerBC1[bc] += 1.0 ;
329+ if (mask & inputMask2)
330+ tfCountsPerBC2[bc] += 1.0 ;
330331 }
331332 }
332333 int64_t unixTimeStart = unixTimeForOrbitStart (firstOrbit);
@@ -341,7 +342,7 @@ void RawDecoderSpec::computeLumiPerBC(const o2::pmr::vector<CTPDigit>& ctpdigits
341342 }
342343 }
343344 flushReadyTFs ();
344- // integrateLumi(tfCountsPerBC1, tfCountsPerBC2, unixTimeStart, orbitsPerTF);
345+ // integrateLumi(tfCountsPerBC1, tfCountsPerBC2, unixTimeStart, orbitsPerTF);
345346}
346347// Accumulate luminosity per BC over multiple time frames
347348void RawDecoderSpec::integrateLumi (const std::array<double , o2::constants::lhc::LHCMaxBunches>& tfCounts1, const std::array<double , o2::constants::lhc::LHCMaxBunches>& tfCounts2, int64_t unixTimeStart, uint32_t nOrbitsThisTF)
@@ -386,12 +387,12 @@ void RawDecoderSpec::integrateLumi(const std::array<double, o2::constants::lhc::
386387 auto [mu, correctedRate1] = pileupCorrection (rate1);
387388 double correctedLumi1 = correctedRate1 / mCrossSection ;
388389 if (mCountsPerBC1 [bc] > 0 ) {
389- // LOG(info) << "BC: " << bc + 1 << " Rate: " << rate1 << " Corrected Rate: " << correctedRate1 << " mu: " << mu;
390+ // LOG(info) << "BC: " << bc + 1 << " Rate: " << rate1 << " Corrected Rate: " << correctedRate1 << " mu: " << mu;
390391 writeMassiLinePerBC (bc, mWindowStartTime , lumi1, lumiErr1, correctedRate1, correctedLumi1, mu);
391392 }
392393 }
393394
394- // Total luminosity over filled BCs for this window
395+ // Total luminosity over filled BCs for this window
395396 if (mLHCBCs .test (bc)) {
396397 totalLumi1 += mCountsPerBC1 [bc] / (timeInterval * mCrossSection );
397398 totalLumi2 += mCountsPerBC2 [bc] / (timeInterval * mCrossSection );
@@ -429,7 +430,7 @@ void RawDecoderSpec::writeMassiLinePerBC(int bc, int64_t unixTimeStart, double l
429430 ofs << (std::abs (lumi) < 1e-3 ? std::scientific : std::fixed) << std::setprecision (7 ) << lumi << " " ;
430431 ofs << (std::abs (lumiErr) < 1e-3 ? std::scientific : std::fixed) << std::setprecision (7 ) << lumiErr << " " ;
431432 ofs << (std::abs (correctedLumi) < 1e-3 ? std::scientific : std::fixed) << std::setprecision (7 ) << correctedLumi << " " ;
432- ofs << std::fixed << std::setprecision (7 ) << correctedRate << " " << mu << " " << std::endl;
433+ ofs << std::fixed << std::setprecision (7 ) << correctedRate << " " << mu << " " << std::endl;
433434 ofs.flush ();
434435}
435436void RawDecoderSpec::writeMassiLineLumi (int64_t unixTimeStart, double lumi, double lumiErr)
@@ -466,9 +467,9 @@ void RawDecoderSpec::fetchRunInfo(int runNumber)
466467 mOrbitsPerTF = mRunInfo .orbitsPerTF ;
467468 mMassiYear = yearFromUnixTime (mRunInfo .sor / 1000.0 );
468469 mOrbitResetTimeSec = mRunInfo .orbitReset * 1e-6 ;
469- mRunStartTime = mRunInfo .sor / 1000 ;
470+ mRunStartTime = mRunInfo .sor / 1000 ;
470471 mRunEndTime = mRunInfo .eor / 1000 ;
471- LOG (info) << " Run start time: " << mRunStartTime << " Run end time: " << mRunEndTime ;
472+ LOG (info) << " Run start time: " << mRunStartTime << " Run end time: " << mRunEndTime ;
472473}
473474void RawDecoderSpec::flushReadyTFs ()
474475{
@@ -493,7 +494,7 @@ std::pair<double, double> RawDecoderSpec::pileupCorrection(double rate) const
493494 LOG (warning) << " Pile-up correction: p = " << p << " >= 1" ;
494495 return {0 , 0 };
495496 }
496- double mu = -std::log (1 - p);
497+ double mu = -std::log (1 - p);
497498 double correctedRate = mu * o2::constants::lhc::LHCRevFreq;
498499 return {mu, correctedRate};
499500}
@@ -566,6 +567,6 @@ void RawDecoderSpec::updateTimeDependentParams(framework::ProcessingContext& pc)
566567 mFillNumber = std::to_string (grplhcif->getFillNumber ());
567568 }
568569 int runNumber = pc.services ().get <o2::framework::TimingInfo>().runNumber ;
569- fetchRunInfo (runNumber);
570+ fetchRunInfo (runNumber);
570571 }
571572}
0 commit comments