@@ -211,7 +211,7 @@ class TPCAggregateCMVDevice : public o2::framework::Task
211211 // independent of the GRPECS/config nHBFPerTF value.
212212 const auto batchLastOrbit = static_cast <uint32_t >(pc.services ().get <o2::framework::TimingInfo>().firstTForbit );
213213 const auto defaultOrbitStep = static_cast <uint32_t >(o2::base::GRPGeomHelper::instance ().getNHBFPerTF ());
214- mOrbitStep [relTF] = (mNTFsBuffer > 1 && batchLastOrbit > batchFirstOrbit) ? (batchLastOrbit - batchFirstOrbit) / static_cast <uint32_t >(mNTFsBuffer - 1 ) : defaultOrbitStep;
214+ mOrbitStep [relTF] = ((batchFirstOrbit > 0 ) && ( mNTFsBuffer > 1 ) && ( batchLastOrbit > batchFirstOrbit) ) ? (batchLastOrbit - batchFirstOrbit) / static_cast <uint32_t >(mNTFsBuffer - 1 ) : defaultOrbitStep;
215215 mLastOrbitStep = mOrbitStep [relTF];
216216 mOrbitInfoSeen [relTF] = true ;
217217 break ;
@@ -307,6 +307,7 @@ class TPCAggregateCMVDevice : public o2::framework::Task
307307 uint64_t mRun {0 }; // /< run number, captured once per run
308308 uint32_t mIntervalFirstOrbit {0 }; // /< first orbit of the first TF in the current interval
309309 uint32_t mIntervalLastOrbit {0 }; // /< first orbit of the last TF in the current interval
310+ uint32_t mFirstOrbitDPL {0 }; // /< first orbit of the first TF in the current interval
310311 bool mIntervalOrbitSet {false }; // /< true once first orbit has been captured for the current interval
311312 dataformats::Pair<long , int > mTFInfo {}; // /< orbit-reset time (ms) and NHBFPerTF forwarded by distribute lane 0 for precise timestamps
312313 std::shared_ptr<o2::base::GRPGeomRequest> mCCDBRequest ; // /< GRPECS request so GRPGeomHelper::getNHBFPerTF() is valid in this process
@@ -396,8 +397,9 @@ class TPCAggregateCMVDevice : public o2::framework::Task
396397 // prefer the measured stride; fall back to NHBFPerTF from GRPECS
397398 const int nHBFPerTF = (orbitStep > 0 ) ? static_cast <int >(orbitStep) : o2::base::GRPGeomHelper::instance ().getNHBFPerTF ();
398399 const auto nOrbitsOffset = (relTF * mNTFsBuffer + (mNTFsBuffer - 1 )) * nHBFPerTF;
400+ mFirstOrbitDPL = tinfo.firstTForbit - nOrbitsOffset;
399401 mTimestampStart = mUsePreciseTimestamp ? (mTFInfo .first + (tinfo.firstTForbit - nOrbitsOffset) * o2::constants::lhc::LHCOrbitMUS * 0.001 ) : tinfo.creation ;
400- LOGP (detail , " Setting time stamp reset reference to: {}, at tfCounter: {}, firstTForbit: {}, NHBFPerTF: {}, relTF: {}, nOrbitsOffset: {}" ,
402+ LOGP (info , " Setting timestamp reset reference to: {}, at tfCounter: {}, firstTForbit: {}, NHBFPerTF: {}, relTF: {}, nOrbitsOffset: {}" ,
401403 mTFInfo .first , tinfo.tfCounter , tinfo.firstTForbit , nHBFPerTF, relTF, nOrbitsOffset);
402404 }
403405
@@ -480,11 +482,13 @@ class TPCAggregateCMVDevice : public o2::framework::Task
480482
481483 const auto firstOrbit = static_cast <uint32_t >(orbitInfo >> 32 );
482484 const auto firstBC = static_cast <uint16_t >(orbitInfo & 0xFFFFu );
485+ // Use the DPL-derived orbit as fallback when the FLP orbit info is missing (firstOrbit == 0)
486+ const auto batchFirstOrbitDPL = (firstOrbit > 0 ) ? firstOrbit : mFirstOrbitDPL ;
483487 if (!mIntervalOrbitSet ) {
484- mIntervalFirstOrbit = firstOrbit ;
488+ mIntervalFirstOrbit = batchFirstOrbitDPL ;
485489 mIntervalOrbitSet = true ;
486490 }
487- mIntervalLastOrbit = firstOrbit + static_cast <uint32_t >(nTFsInBatch - 1 ) * orbitStep;
491+ mIntervalLastOrbit = batchFirstOrbitDPL + static_cast <uint32_t >(nTFsInBatch - 1 ) * orbitStep;
488492 const uint8_t flags = buildCompressionFlags ();
489493 std::vector<PreparedTF> prepared (nTFsInBatch);
490494 const int nThreads = std::max (1 , std::min (mThreads , nTFsInBatch));
@@ -497,7 +501,7 @@ class TPCAggregateCMVDevice : public o2::framework::Task
497501
498502 auto & preparedTF = prepared[tfIndex];
499503 preparedTF.tf .firstOrbit = firstOrbit + static_cast <uint32_t >(tfIndex) * orbitStep;
500- preparedTF.tf .firstBC = (tfIndex == 0 ) ? firstBC : 0 ;
504+ preparedTF.tf .firstOrbitDPL = batchFirstOrbitDPL + static_cast < uint32_t >(tfIndex) * orbitStep ;
501505
502506 for (const auto & [cru, values] : rawCMVs) {
503507 const uint32_t offset = static_cast <uint32_t >(tfIndex) * cmv::NTimeBinsPerTF;
@@ -558,7 +562,7 @@ class TPCAggregateCMVDevice : public o2::framework::Task
558562 mIntervalTree ->GetUserInfo ()->Add (new TParameter<long >(" firstTF" , mIntervalFirstTF ));
559563 mIntervalTree ->GetUserInfo ()->Add (new TParameter<long >(" lastTF" , lastTF));
560564
561- LOGP (detail , " CMVPerTF TTree lane {}: {} entries, firstTF={}, lastTF={}" , mLaneId , mIntervalTFCount , mIntervalFirstTF , lastTF);
565+ LOGP (info , " CMVPerTF TTree lane {}: {} entries, firstTF={}, lastTF={}" , mLaneId , mIntervalTFCount , mIntervalFirstTF , lastTF);
562566 auto start = timer::now ();
563567
564568 const int nHBFPerTF = o2::base::GRPGeomHelper::instance ().getNHBFPerTF ();
@@ -569,7 +573,7 @@ class TPCAggregateCMVDevice : public o2::framework::Task
569573 mRun , mIntervalFirstOrbit , mIntervalLastOrbit , mTimestampStart , timeStampEnd);
570574 try {
571575 CMVPerTF::writeToFile (mOutputDir + calibFName, mIntervalTree );
572- LOGP (detail , " CMV file written to {}" , mOutputDir + calibFName);
576+ LOGP (info , " CMV file written to {}" , mOutputDir + calibFName);
573577 } catch (const std::exception& e) {
574578 LOGP (error, " Failed to write CMV file {}: {}" , mOutputDir + calibFName, e.what ());
575579 }
@@ -614,13 +618,13 @@ class TPCAggregateCMVDevice : public o2::framework::Task
614618 mf.Close ();
615619 }
616620
617- LOGP (detail , " Sending object {} / {} of size {} bytes, valid for {} : {}" , ccdbInfoCMV.getPath (), ccdbInfoCMV.getFileName (), image->size (), ccdbInfoCMV.getStartValidityTimestamp (), ccdbInfoCMV.getEndValidityTimestamp ());
621+ LOGP (info , " Sending object {} / {} of size {} bytes, valid for {} : {}" , ccdbInfoCMV.getPath (), ccdbInfoCMV.getFileName (), image->size (), ccdbInfoCMV.getStartValidityTimestamp (), ccdbInfoCMV.getEndValidityTimestamp ());
618622 output.snapshot (Output{o2::calibration::Utils::gDataOriginCDBPayload , getDataDescriptionCCDBCMV (), 0 }, *image);
619623 output.snapshot (Output{o2::calibration::Utils::gDataOriginCDBWrapper , getDataDescriptionCCDBCMV (), 0 }, ccdbInfoCMV);
620624
621625 auto stop = timer::now ();
622626 std::chrono::duration<float > elapsed = stop - start;
623- LOGP (detail , " CMV CCDB serialisation time: {:.3f} s" , elapsed.count ());
627+ LOGP (info , " CMV CCDB serialisation time: {:.3f} s" , elapsed.count ());
624628 }
625629
626630 // / Reset all per-interval state after a successful sendOutput(); prepares for the next interval
@@ -652,6 +656,7 @@ class TPCAggregateCMVDevice : public o2::framework::Task
652656 mIntervalTFCount = 0 ;
653657 mIntervalFirstOrbit = 0 ;
654658 mIntervalLastOrbit = 0 ;
659+ mFirstOrbitDPL = 0 ;
655660 mIntervalOrbitSet = false ;
656661 mCurrentTF = CMVPerTF{};
657662 mCurrentCompressedTF = CMVPerTFCompressed{};
0 commit comments