@@ -43,8 +43,8 @@ class TimeSlotCalibration
4343
4444 TimeSlotCalibration () = default ;
4545 virtual ~TimeSlotCalibration () = default ;
46- TFType getMaxSlotsDelay () const { return mMaxSlotsDelay ; }
47- void setMaxSlotsDelay (TFType v) { mMaxSlotsDelay = v; }
46+ float getMaxSlotsDelay () const { return mMaxSlotsDelay ; }
47+ void setMaxSlotsDelay (float v) { mMaxSlotsDelay = v > 0 . ? v : 0 . ; }
4848
4949 TFType getSlotLength () const { return mSlotLength ; }
5050 void setSlotLength (TFType v)
@@ -172,7 +172,6 @@ class TimeSlotCalibration
172172 TFType mFirstTF = 0 ;
173173 TFType mMaxSeenTF = 0 ; // largest TF processed
174174 TFType mSlotLength = 1 ; // slot length in TFs
175- TFType mMaxSlotsDelay = 3 ; // difference between the current TF slot ID and the oldest slot to account for the TF
176175 TFType mCheckIntervalInfiniteSlot = 1 ; // will be used if the TF length is INFINITE_TF_int64 to decide
177176 // when to check if to call the finalize; otherwise it is called
178177 // at every new TF; note that this is an approximation,
@@ -182,6 +181,8 @@ class TimeSlotCalibration
182181 TFType mCheckDeltaIntervalInfiniteSlot = 1 ; // will be used if the TF length is INFINITE_TF_int64 when
183182 // the check on the statistics returned false, to determine
184183 // after how many TF to check again.
184+ float mMaxSlotsDelay = 3.0 ; // difference in slot units between the current TF and oldest slot (end TF) to account for the TF
185+
185186 bool mWasCheckedInfiniteSlot = false ; // flag to know whether the statistics of the infinite slot was already checked
186187 bool mUpdateAtTheEndOfRunOnly = false ;
187188 bool mFinalizeWhenReady = false ; // if true: single bin is filled until ready, then closed and new one is added
@@ -193,10 +194,15 @@ template <typename Input, typename Container>
193194template <typename DATA >
194195bool TimeSlotCalibration<Input, Container>::process(const DATA & data)
195196{
197+ static bool firstCall = true ;
198+ if (firstCall) {
199+ firstCall = false ;
200+ checkSlotLength ();
201+ }
196202
197203 // process current TF
198204 TFType tf = mCurrentTFInfo .tfCounter ;
199- uint64_t maxDelay64 = uint64_t (mSlotLength ) * mMaxSlotsDelay ;
205+ uint64_t maxDelay64 = uint64_t (mSlotLength * mMaxSlotsDelay ) ;
200206 TFType maxDelay = maxDelay64 > o2::calibration::INFINITE_TF ? o2::calibration::INFINITE_TF : TFType (maxDelay64);
201207 if (!mUpdateAtTheEndOfRunOnly ) { // if you update at the end of run only, then you accept everything
202208 if (tf < mLastClosedTF || (!mSlots .empty () && getLastSlot ().getTFStart () > tf + maxDelay64)) { // ignore TF; note that if you have only 1 timeslot
@@ -331,7 +337,6 @@ TimeSlot<Container>& TimeSlotCalibration<Input, Container>::getSlotForTF(TFType
331337{
332338
333339 LOG (debug) << " Getting slot for TF " << tf;
334- checkSlotLength ();
335340 if (mUpdateAtTheEndOfRunOnly ) {
336341 if (!mSlots .empty () && mSlots .back ().getTFEnd () < tf) {
337342 mSlots .back ().setTFEnd (tf);
0 commit comments