diff --git a/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibData.h b/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibData.h index e75661e132a54..2818146d75f32 100644 --- a/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibData.h +++ b/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibData.h @@ -59,12 +59,18 @@ struct WaveformCalibData { inline void setFirstValid(int isig, int ipos) { if (ipos > mWave[isig].mFirstValid) { +#ifdef O2_ZDC_WAVEFORMCALIB_DEBUG + printf("WaveformCalibChData::%s isig=%-2d mFirstValid %5d -> %5d\n", __func__, isig, mWave[isig].mFirstValid, ipos); +#endif mWave[isig].mFirstValid = ipos; } } inline void setLastValid(int isig, int ipos) { if (ipos < mWave[isig].mLastValid) { +#ifdef O2_ZDC_WAVEFORMCALIB_DEBUG + printf("WaveformCalibChData::%s isig=%-2d mLastValid %5d -> %5d\n", __func__, isig, mWave[isig].mLastValid, ipos); +#endif mWave[isig].mLastValid = ipos; } } diff --git a/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibEPN.h b/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibEPN.h index b759d94ff781a..929190f09d162 100644 --- a/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibEPN.h +++ b/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibEPN.h @@ -29,7 +29,7 @@ class WaveformCalibEPN public: WaveformCalibEPN() = default; int init(); - void clear(int ih = -1); + void clear(); int process(const gsl::span& bcrec, const gsl::span& energy, const gsl::span& tdc, @@ -54,7 +54,7 @@ class WaveformCalibEPN int mFirst = 0; int mLast = 0; - int mN = 1; + int mN = 10; void configure(int ifirst, int ilast) { @@ -64,6 +64,7 @@ class WaveformCalibEPN mFirst = ifirst; mLast = ilast; mN = ilast - ifirst + 1; + LOG(info) << "WaveformCalibEPN::" << __func__ << " mN=" << mN << "[" << mFirst << ":" << mLast << "]"; } WaveformCalibQueue mQueue; diff --git a/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibQueue.h b/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibQueue.h index a18f23fab7ea8..20d39b6fdb8ce 100644 --- a/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibQueue.h +++ b/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibQueue.h @@ -47,6 +47,7 @@ struct WaveformCalibQueue { int mNP = 0; // Number of interpolated points in waveform int mTimeLow[NChannels]; /// Cut on position difference low int mTimeHigh[NChannels]; /// Cut on position difference high + int mVerbosity = 0; const WaveformCalibConfig* mCfg = nullptr; diff --git a/Detectors/ZDC/calib/src/WaveformCalibConfig.cxx b/Detectors/ZDC/calib/src/WaveformCalibConfig.cxx index fa0a5a78b3fcb..f0aeff5d53fc7 100644 --- a/Detectors/ZDC/calib/src/WaveformCalibConfig.cxx +++ b/Detectors/ZDC/calib/src/WaveformCalibConfig.cxx @@ -21,8 +21,8 @@ WaveformCalibConfig::WaveformCalibConfig() cutHigh[isig] = std::numeric_limits::infinity(); } for (int itdc = 0; itdc < NTDCChannels; itdc++) { - cutTimeLow[itdc] = -2.5; - cutTimeHigh[itdc] = 2.5; + cutTimeLow[itdc] = -1.25; + cutTimeHigh[itdc] = 1.25; } } @@ -132,8 +132,8 @@ void WaveformCalibConfig::setCuts(double low, double high) void WaveformCalibConfig::setCuts(int isig, double low, double high) { - cutHigh[isig] = low; - cutLow[isig] = high; + cutLow[isig] = low; + cutHigh[isig] = high; } void WaveformCalibConfig::setTimeCuts(double low, double high) diff --git a/Detectors/ZDC/calib/src/WaveformCalibData.cxx b/Detectors/ZDC/calib/src/WaveformCalibData.cxx index 54c7255f37c72..759d85a6a0f88 100644 --- a/Detectors/ZDC/calib/src/WaveformCalibData.cxx +++ b/Detectors/ZDC/calib/src/WaveformCalibData.cxx @@ -59,9 +59,15 @@ WaveformCalibChData& WaveformCalibChData::operator+=(const WaveformCalibChData& { if (other.mEntries > 0) { if (other.mFirstValid > mFirstValid) { +#ifdef O2_ZDC_WAVEFORMCALIB_DEBUG + printf("WaveformCalibChData::+= mFirstValid %5d -> %5d\n", mFirstValid, other.mFirstValid); +#endif mFirstValid = other.mFirstValid; } if (other.mLastValid < mLastValid) { +#ifdef O2_ZDC_WAVEFORMCALIB_DEBUG + printf("WaveformCalibChData::+= mLastValid %5d -> %5d\n", mLastValid, other.mLastValid); +#endif mLastValid = other.mLastValid; } mEntries = mEntries + other.mEntries; @@ -172,7 +178,7 @@ int WaveformCalibData::saveDebugHistos(const std::string fn) } h.SetEntries(mWave[is].mEntries); h.Write("", TObject::kOverwrite); - }else{ + } else { LOG(warn) << "WaveformCalibData " << __func__ << " waveform for ch " << is << " has too few entries: " << mWave[is].mEntries; } } diff --git a/Detectors/ZDC/calib/src/WaveformCalibEPN.cxx b/Detectors/ZDC/calib/src/WaveformCalibEPN.cxx index 37590995d9701..cda158e9f5b6a 100644 --- a/Detectors/ZDC/calib/src/WaveformCalibEPN.cxx +++ b/Detectors/ZDC/calib/src/WaveformCalibEPN.cxx @@ -45,17 +45,29 @@ int WaveformCalibEPN::init() if (mVerbosity > DbgZero) { mQueue.printConf(); } + mQueue.mVerbosity = mVerbosity; // number of bins - mNBin = cfg->nbun * TSN; + mNBin = cfg->nbun * TSN * NTimeBinsPerBC; mFirst = cfg->ibeg; mLast = cfg->iend; mData.setN(cfg->nbun); mData.mPeak = mQueue.mPeak; + LOGF(info, "o2::zdc::WaveformCalibEPN::%s mNBin=%d mFirst=%d mLast=%d mN=%d mPeak=%d", __func__, mNBin, mFirst, mLast, cfg->nbun, mData.mPeak); mInitDone = true; return 0; } +void WaveformCalibEPN::clear() +{ +#ifdef O2_ZDC_WAVEFORMCALIB_DEBUG + LOG(info) << "o2::zdc::WaveformCalibEPN::" << __func__; +#endif + // mQueue.clear(); + mData.clearWaveforms(); + mData.setN(mN); +} + //______________________________________________________________________________ int WaveformCalibEPN::process(const gsl::span& RecBC, const gsl::span& Energy, @@ -111,9 +123,10 @@ int WaveformCalibEPN::endOfRun() LOGF(info, "WaveformCalibEPN::endOfRun ts (%llu:%llu)", mData.mCTimeBeg, mData.mCTimeEnd); for (int is = 0; is < NChannels; is++) { if (mData.getEntries(is) > 0) { - LOGF(info, "Waveform %2d %s with %10d events and cuts AMP:(%g:%g) TDC:(%g:%g) Valid:[%d:%d:%d]", is, ChannelNames[is].data(), + int itdc = SignalTDC[is]; + LOGF(info, "Waveform %2d %s with %10d events and cuts AMP:(%g:%g) TDC:%d:(%g:%g) Valid:[%d:%d:%d]", is, ChannelNames[is].data(), mData.getEntries(is), mConfig->cutLow[is], mConfig->cutHigh[is], - mConfig->cutTimeLow[is], mConfig->cutTimeHigh[is], + itdc, mConfig->cutTimeLow[itdc], mConfig->cutTimeHigh[itdc], mData.getFirstValid(is), mData.mPeak, mData.getLastValid(is)); } } diff --git a/Detectors/ZDC/calib/src/WaveformCalibEPNSpec.cxx b/Detectors/ZDC/calib/src/WaveformCalibEPNSpec.cxx index fa87ca9eccde5..62ee862905524 100644 --- a/Detectors/ZDC/calib/src/WaveformCalibEPNSpec.cxx +++ b/Detectors/ZDC/calib/src/WaveformCalibEPNSpec.cxx @@ -88,6 +88,8 @@ void WaveformCalibEPNSpec::run(ProcessingContext& pc) mTimer.Stop(); mTimer.Reset(); mTimer.Start(false); + } else { + mWorker.clear(); } auto creationTime = pc.services().get().creation; // approximate time in ms diff --git a/Detectors/ZDC/calib/src/WaveformCalibQueue.cxx b/Detectors/ZDC/calib/src/WaveformCalibQueue.cxx index a63ee1b2a2ac4..c62306f21b1ad 100644 --- a/Detectors/ZDC/calib/src/WaveformCalibQueue.cxx +++ b/Detectors/ZDC/calib/src/WaveformCalibQueue.cxx @@ -98,9 +98,9 @@ uint32_t WaveformCalibQueue::append(RecEventFlat& ev) } return mask; } else { -// #ifdef O2_ZDC_WAVEFORMCALIB_DEBUG -// LOG(info) << "WaveformCalibQueue::" << __func__ << " IR size = " << mIR.size() << " != " << mN; -// #endif + // #ifdef O2_ZDC_WAVEFORMCALIB_DEBUG + // LOG(info) << "WaveformCalibQueue::" << __func__ << " IR size = " << mIR.size() << " != " << mN; + // #endif return 0; } } @@ -191,7 +191,7 @@ int WaveformCalibQueue::hasData(int isig, const gsl::span mTimeHigh[itdc]) { - // Put a warning message for a signal out of time - LOGF(warning, "%d.%04d Signal %2d peak position %d-%d=%d is outside allowed range [%d:%d]", mIR[mPk].orbit, mIR[mPk].bc, isig, ppos, mPeak, ppos - mPeak, mTimeLow[isig], mTimeHigh[isig]); + if (mVerbosity > DbgMinimal) { + // Put a warning message for a signal out of time + LOGF(warning, "%d.%04d Signal %2d peak position %d-%d=%d is outside allowed range [%d:%d]", mIR[mPk].orbit, mIR[mPk].bc, isig, ppos, mPeak, ppos - mPeak, mTimeLow[isig], mTimeHigh[isig]); + } return -1; } } @@ -289,7 +291,7 @@ int WaveformCalibQueue::addData(int isig, const gsl::span 0) { - if(!printed){ + if (!printed) { printf("mNTDC:"); - printed=true; + printed = true; } printf(" %2d=%6u", j, mNTDC[j][i]); } } - if(printed){ + if (printed) { printf("\n"); - printed=false; + printed = false; } for (int j = 0; j < NTDCChannels; j++) { if (mNTDC[j][i] > 0) { - if(!printed){ + if (!printed) { printf("mTDCA:"); - printed=true; + printed = true; } printf(" %2d=%6.1f", j, mTDCA[j][i]); } } - if(printed){ + if (printed) { printf("\n"); - printed=false; + printed = false; } for (int j = 0; j < NTDCChannels; j++) { if (mNTDC[j][i] > 0) { - if(!printed){ + if (!printed) { printf("mTDCP:"); - printed=true; + printed = true; } printf(" %2d=%6.1f", j, mTDCP[j][i]); } } - if(printed){ + if (printed) { printf("\n"); } } diff --git a/Detectors/ZDC/macro/CreateWaveformCalibConfig.C b/Detectors/ZDC/macro/CreateWaveformCalibConfig.C index 2dc429bc1ec71..fbe1063b0933d 100644 --- a/Detectors/ZDC/macro/CreateWaveformCalibConfig.C +++ b/Detectors/ZDC/macro/CreateWaveformCalibConfig.C @@ -13,6 +13,7 @@ #include #include +#include #include "Framework/Logger.h" #include "CCDB/CcdbApi.h" #include "ZDCBase/Constants.h" @@ -38,14 +39,29 @@ void CreateWaveformCalibConfig(long tmin = 0, long tmax = -1, std::string ccdbHo // range -2048 : 2047 one should not use signals too close to // maximum allowed amplitude (1800+2048) conf.setCuts(100, 3000); - conf.setCuts(o2::zdc::IdZPA1, 50, 3000); + conf.setCuts(o2::zdc::IdZNA1, 100, 2500); + conf.setCuts(o2::zdc::IdZNA2, 100, 2500); + conf.setCuts(o2::zdc::IdZNA3, 100, 2500); + conf.setCuts(o2::zdc::IdZNA4, 100, 2500); + conf.setCuts(o2::zdc::IdZPA1, 50, 2500); + conf.setCuts(o2::zdc::IdZPA2, 100, 2500); + conf.setCuts(o2::zdc::IdZPA3, 100, 2500); + conf.setCuts(o2::zdc::IdZPA4, 100, 2500); + conf.setCuts(o2::zdc::IdZNC1, 100, 2500); + conf.setCuts(o2::zdc::IdZNC2, 100, 2500); + conf.setCuts(o2::zdc::IdZNC3, 100, 2500); + conf.setCuts(o2::zdc::IdZNC4, 100, 2500); + conf.setCuts(o2::zdc::IdZPC1, 100, 2500); + conf.setCuts(o2::zdc::IdZPC2, 100, 2500); + conf.setCuts(o2::zdc::IdZPC3, 100, 2500); + conf.setCuts(o2::zdc::IdZPC4, 50, 2500); conf.setDescription("Simulated data"); conf.setMinEntries(200); // Restrict waveform range (default is -3, 6 as defined in WaveformCalib_NBB // WaveformCalib_NBA in file Detectors/ZDC/base/include/ZDCBase/Constants.h) - conf.restrictRange(-1, 0); + // conf.restrictRange(-1, 0); conf.print(); diff --git a/Detectors/ZDC/workflow/src/DigitRecoSpec.cxx b/Detectors/ZDC/workflow/src/DigitRecoSpec.cxx index 1d47b1884c3f5..d504d33483081 100644 --- a/Detectors/ZDC/workflow/src/DigitRecoSpec.cxx +++ b/Detectors/ZDC/workflow/src/DigitRecoSpec.cxx @@ -229,7 +229,9 @@ void DigitRecoSpec::run(ProcessingContext& pc) } // Limit the number of waveforms in output message if (mMaxWave > 0 && ntw >= mMaxWave) { - LOG(warning) << "Maximum number of output waveforms per TF reached: " << mMaxWave; + if (mVerbosity > DbgMinimal) { + LOG(warning) << "Maximum number of output waveforms per TF reached: " << mMaxWave; + } break; } }