3737#include " CCDB/CcdbApi.h"
3838#include < boost/format.hpp>
3939
40+ // #define DEBUGGING
41+
42+ #ifdef DEBUGGING
43+ #include " TProfile.h"
44+ #include " TH2F.h"
45+ #endif
46+
4047using o2::math_utils::fitGaus;
4148
4249namespace o2
@@ -59,7 +66,11 @@ class TOFChannelData
5966 LOG (INFO ) << " Default c-tor, not to be used" ;
6067 }
6168
69+ #ifndef DEBUGGING
6270 TOFChannelData (int nb, float r, CalibTOFapi* cta, int nElsPerSector = o2::tof::Geo::NPADSXSECTOR , bool perstrip = false , bool safe = false ) : mNBins(nb), mRange(r), mCalibTOFapi(cta), mNElsPerSector(nElsPerSector), mPerStrip(perstrip), mSafeMode(safe)
71+ #else
72+ TOFChannelData (int nb, float r, CalibTOFapi* cta, int nElsPerSector = o2::tof::Geo::NPADSXSECTOR , bool perstrip = false , bool safe = false , TH2F * h = nullptr ) : mNBins(nb), mRange(r), mCalibTOFapi(cta), mNElsPerSector(nElsPerSector), mPerStrip(perstrip), mSafeMode(safe), mChannelDist(h)
73+ #endif
6374 {
6475 if (r <= 0 . || nb < 1 ) {
6576 throw std::runtime_error (" Wrong initialization of the histogram" );
@@ -111,6 +122,10 @@ class TOFChannelData
111122 std::array<boostHisto, 18 > mHisto ;
112123 std::vector<int > mEntries ; // vector containing number of entries per channel
113124
125+ #ifdef DEBUGGING
126+ TH2F * mChannelDist ;
127+ #endif
128+
114129 CalibTOFapi* mCalibTOFapi = nullptr ; // calibTOFapi to correct the t-text
115130 int mNElsPerSector = o2::tof::Geo::NPADSXSECTOR ;
116131
@@ -131,6 +146,11 @@ class TOFChannelCalibrator final : public o2::calibration::TimeSlotCalibration<T
131146 using CcdbObjectInfoVector = std::vector<CcdbObjectInfo>;
132147 using TimeSlewingVector = std::vector<TimeSlewing>;
133148
149+ #ifdef DEBUGGING
150+ TProfile* mFitCal ; // ("fitCal",";channel;offset (ps)",13104,0,157248);
151+ TH2F * mChannelDist ; // ("channelDist",";channel; t - t_{exp}^{#pi} (ps)",13104,0,157248,1000,-100000,100000);
152+ #endif
153+
134154 protected:
135155 std::deque<o2::calibration::TimeSlot<o2::tof::TOFChannelData>>& getSlots () { return o2::calibration::TimeSlotCalibration<T, o2::tof::TOFChannelData>::getSlots (); }
136156
@@ -166,6 +186,10 @@ class TOFChannelCalibrator final : public o2::calibration::TimeSlotCalibration<T
166186 mLinFitters [i].SetDim (3 );
167187 mLinFitters [i].SetFormula (" pol2" );
168188 }
189+ #ifdef DEBUGGING
190+ mFitCal = new TProfile (" fitCal" , " ;channel;offset (ps)" , 157248 , 0 , 157248 );
191+ mChannelDist = new TH2F (" channelDist" , " ;channel; t - t_{exp}^{#pi} (ps)" , 157248 , 0 , 157248 , 1000 , -100000 , 100000 );
192+ #endif
169193 }
170194
171195 ~TOFChannelCalibrator () final = default ;
@@ -202,7 +226,12 @@ class TOFChannelCalibrator final : public o2::calibration::TimeSlotCalibration<T
202226 auto & cont = getSlots ();
203227 auto & slot = front ? cont.emplace_front (tstart, tend) : cont.emplace_back (tstart, tend);
204228 int nElements = mCalibWithCosmics ? NCOMBINSTRIP * Geo::NSTRIPXSECTOR : Geo::NPADSXSECTOR ; // if we calibrate with cosmics, we pass the number of possible combinations per sector; otherwise, the number of pads per sector
229+ #ifndef DEBUGGING
205230 slot.setContainer (std::make_unique<TOFChannelData>(mNBins , mRange , mCalibTOFapi , nElements, mPerStrip , mSafeMode ));
231+ #else
232+ slot.setContainer (std::make_unique<TOFChannelData>(mNBins , mRange , mCalibTOFapi , nElements, mPerStrip , mSafeMode , mChannelDist ));
233+ #endif
234+
206235 return slot;
207236 }
208237
0 commit comments