diff --git a/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibData.h b/Detectors/ZDC/calib/include/ZDCCalib/WaveformCalibData.h index 87bb6886f7cad..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; } } @@ -77,6 +83,7 @@ struct WaveformCalibData { int getLastValid(int is) const; void print() const; void clear(); + void clearWaveforms(); void setCreationTime(uint64_t ctime); void setN(int n); int saveDebugHistos(const std::string fn); 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/BaselineCalibConfig.cxx b/Detectors/ZDC/calib/src/BaselineCalibConfig.cxx index ac462250d20e6..ad9b889bd7d10 100644 --- a/Detectors/ZDC/calib/src/BaselineCalibConfig.cxx +++ b/Detectors/ZDC/calib/src/BaselineCalibConfig.cxx @@ -83,6 +83,6 @@ void BaselineCalibConfig::setCuts(int low, int high) void BaselineCalibConfig::setCuts(int isig, int low, int high) { - cutHigh[isig] = low; - cutLow[isig] = high; + cutLow[isig] = low; + cutHigh[isig] = high; } diff --git a/Detectors/ZDC/calib/src/InterCalibConfig.cxx b/Detectors/ZDC/calib/src/InterCalibConfig.cxx index c351cb31cf3c9..d0caff4c97d40 100644 --- a/Detectors/ZDC/calib/src/InterCalibConfig.cxx +++ b/Detectors/ZDC/calib/src/InterCalibConfig.cxx @@ -106,8 +106,8 @@ void InterCalibConfig::setCuts(double low, double high) void InterCalibConfig::setCuts(int ih, double low, double high) { - cutHigh[ih] = low; - cutLow[ih] = high; + cutLow[ih] = low; + cutHigh[ih] = high; } void InterCalibConfig::setBinning1D(int nb, double amin, double amax) diff --git a/Detectors/ZDC/calib/src/TDCCalibConfig.cxx b/Detectors/ZDC/calib/src/TDCCalibConfig.cxx index 7ca0254161ec9..d2bbbefb39abc 100644 --- a/Detectors/ZDC/calib/src/TDCCalibConfig.cxx +++ b/Detectors/ZDC/calib/src/TDCCalibConfig.cxx @@ -106,8 +106,8 @@ void TDCCalibConfig::setCuts(double low, double high) void TDCCalibConfig::setCuts(int ih, double low, double high) { - cutHigh[ih] = low; - cutLow[ih] = high; + cutLow[ih] = low; + cutHigh[ih] = high; } void TDCCalibConfig::setBinning1D(int nb, double amin, double amax) 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 14063f9e93f40..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; @@ -130,23 +136,23 @@ int WaveformCalibChData::getLastValid() const //______________________________________________________________________________ void WaveformCalibData::setN(int n) { - if (n >= 0 && n < NBT) { + if (n > 0 && n <= NBT) { mN = n; for (int is = 0; is < NChannels; is++) { mWave[is].setN(n); } } else { - LOG(fatal) << "WaveformCalibData " << __func__ << " wrong stored b.c. setting " << n << " not in range [0:" << NBT << "]"; + LOG(warn) << "WaveformCalibData " << __func__ << " wrong stored b.c. setting " << n << " not in range [1:" << NBT << "]"; } } void WaveformCalibChData::setN(int n) { - if (n >= 0 && n < NBT) { + if (n > 0 && n <= NBT) { mFirstValid = 0; mLastValid = n * NTimeBinsPerBC * TSN - 1; } else { - LOG(fatal) << "WaveformCalibChData " << __func__ << " wrong stored b.c. setting " << n << " not in range [0:" << NBT << "]"; + LOG(warn) << "WaveformCalibChData " << __func__ << " wrong stored b.c. setting " << n << " not in range [1:" << NBT << "]"; } } @@ -172,6 +178,8 @@ int WaveformCalibData::saveDebugHistos(const std::string fn) } h.SetEntries(mWave[is].mEntries); h.Write("", TObject::kOverwrite); + } else { + LOG(warn) << "WaveformCalibData " << __func__ << " waveform for ch " << is << " has too few entries: " << mWave[is].mEntries; } } f->Close(); @@ -191,6 +199,16 @@ void WaveformCalibData::clear() } } +//______________________________________________________________________________ +void WaveformCalibData::clearWaveforms() +{ + mCTimeBeg = 0; + mCTimeEnd = 0; + for (int32_t is = 0; is < NChannels; is++) { + mWave[is].clear(); + } +} + void WaveformCalibChData::clear() { mEntries = 0; 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 d90f26d341515..62ee862905524 100644 --- a/Detectors/ZDC/calib/src/WaveformCalibEPNSpec.cxx +++ b/Detectors/ZDC/calib/src/WaveformCalibEPNSpec.cxx @@ -88,10 +88,13 @@ 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 WaveformCalibData& data = mWorker.getData(); + data.setCreationTime(creationTime); auto bcrec = pc.inputs().get>("bcrec"); diff --git a/Detectors/ZDC/calib/src/WaveformCalibQueue.cxx b/Detectors/ZDC/calib/src/WaveformCalibQueue.cxx index 25d48d9cbf825..c62306f21b1ad 100644 --- a/Detectors/ZDC/calib/src/WaveformCalibQueue.cxx +++ b/Detectors/ZDC/calib/src/WaveformCalibQueue.cxx @@ -52,6 +52,9 @@ uint32_t WaveformCalibQueue::append(RecEventFlat& ev) auto& last = mIR.back(); // If BC are not consecutive, clear queue if (toadd.differenceInBC(last) > 1) { +#ifdef O2_ZDC_WAVEFORMCALIB_DEBUG + LOG(info) << "WaveformCalibQueue::" << __func__ << " gap detected. Clearing " << mIR.size() << " bc"; +#endif clear(); } // If queue is not empty and is too long remove first element @@ -61,6 +64,9 @@ uint32_t WaveformCalibQueue::append(RecEventFlat& ev) // If BC are consecutive or cleared queue append element appendEv(ev); if (mIR.size() == mN) { +#ifdef O2_ZDC_WAVEFORMCALIB_DEBUG + LOG(info) << "WaveformCalibQueue::" << __func__ << " processing " << mIR.size() << " bcs"; +#endif uint32_t mask = 0; for (int32_t itdc = 0; itdc < NTDCChannels; itdc++) { // Check which channels satisfy the condition on TDC @@ -92,6 +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 return 0; } } @@ -182,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; } } @@ -277,7 +291,7 @@ int WaveformCalibQueue::addData(int isig, const gsl::span 0) { + if (!printed) { + printf("mNTDC:"); + printed = true; + } printf(" %2d=%6u", j, mNTDC[j][i]); } } - printf("\n"); - printf("mTDCA:"); + if (printed) { + printf("\n"); + printed = false; + } for (int j = 0; j < NTDCChannels; j++) { if (mNTDC[j][i] > 0) { + if (!printed) { + printf("mTDCA:"); + printed = true; + } printf(" %2d=%6.1f", j, mTDCA[j][i]); } } - printf("\n"); - printf("mTDCP:"); + if (printed) { + printf("\n"); + printed = false; + } for (int j = 0; j < NTDCChannels; j++) { if (mNTDC[j][i] > 0) { + if (!printed) { + printf("mTDCP:"); + printed = true; + } printf(" %2d=%6.1f", j, mTDCP[j][i]); } } - printf("\n"); + if (printed) { + printf("\n"); + } } } diff --git a/Detectors/ZDC/macro/CreateRecoConfigZDC.C b/Detectors/ZDC/macro/CreateRecoConfigZDC.C index 30808371bcff2..c504241346787 100644 --- a/Detectors/ZDC/macro/CreateRecoConfigZDC.C +++ b/Detectors/ZDC/macro/CreateRecoConfigZDC.C @@ -33,16 +33,16 @@ void CreateRecoConfigZDC(long tmin = 0, long tmax = -1, std::string ccdbHost = " // Offline trigger // Set trigger bitsincoincidence to ignore dead channels - // conf.setBit(IdZNAC); - // conf.setBit(IdZNASum); - // conf.setBit(IdZPAC); - // conf.setBit(IdZPASum); - // conf.setBit(IdZEM1); - // conf.setBit(IdZEM2); - // conf.setBit(IdZNCC); - // conf.setBit(IdZNCSum); - // conf.setBit(IdZPCC); - // conf.setBit(IdZPCSum); + // conf.setBit(TDCZNAC); + // conf.setBit(TDCZNAS); + // conf.setBit(TDCZPAC); + // conf.setBit(TDCZPAS); + // conf.setBit(TDCZEM1); + // conf.setBit(TDCZEM2); + // conf.setBit(TDCZNCC); + // conf.setBit(TDCZNCS); + // conf.setBit(TDCZPCC); + // conf.setBit(TDCZPCS); // conf.setTripleTrigger(); conf.setDoubleTrigger(); diff --git a/Detectors/ZDC/macro/CreateWaveformCalibConfig.C b/Detectors/ZDC/macro/CreateWaveformCalibConfig.C index 7c19eef5bbd64..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,13 +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::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/raw/include/ZDCRaw/DumpRaw.h b/Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h index 11da9a96533cf..41158552d86cb 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h @@ -54,6 +54,7 @@ class DumpRaw std::unique_ptr mCounts[NDigiChannels] = {nullptr}; std::unique_ptr mSignalA[NDigiChannels] = {nullptr}; std::unique_ptr mSignalT[NDigiChannels] = {nullptr}; + std::unique_ptr mSignalTH[NDigiChannels] = {nullptr}; std::unique_ptr mBunchA[NDigiChannels] = {nullptr}; // Bunch pattern ALICE std::unique_ptr mBunchT[NDigiChannels] = {nullptr}; // Bunch pattern Autotrigger std::unique_ptr mBunchH[NDigiChannels] = {nullptr}; // Bunch pattern Hit diff --git a/Detectors/ZDC/raw/src/DumpRaw.cxx b/Detectors/ZDC/raw/src/DumpRaw.cxx index 3a2cfd79f9ccb..7375c946fb3e3 100644 --- a/Detectors/ZDC/raw/src/DumpRaw.cxx +++ b/Detectors/ZDC/raw/src/DumpRaw.cxx @@ -133,6 +133,11 @@ void DumpRaw::init() TString htit = TString::Format("Signal mod. %d ch. %d AUTOT; Sample; ADC", imod, ich); mSignalT[i] = std::make_unique(hname, htit, nbx, xmin, xmax, ADCRange, ADCMin - 0.5, ADCMax + 0.5); } + if (mSignalTH[i] == nullptr) { + TString hname = TString::Format("hsth%d%d", imod, ich); + TString htit = TString::Format("Signal mod. %d ch. %d AUTOT & Hit; Sample; ADC", imod, ich); + mSignalTH[i] = std::make_unique(hname, htit, 2 * NTimeBinsPerBC, -0.5 - NTimeBinsPerBC, NTimeBinsPerBC - 0.5, ADCRange, ADCMin - 0.5, ADCMax + 0.5); + } if (mBunchA[i] == nullptr) { TString hname = TString::Format("hba%d%d", imod, ich); TString htit = TString::Format("Bunch mod. %d ch. %d ALICET; Sample; ADC", imod, ich); @@ -203,6 +208,10 @@ void DumpRaw::write() setStat(mSignalT[i].get()); mSignalT[i]->Write(); } + if (mSignalTH[i] && mSignalTH[i]->GetEntries() > 0) { + setStat(mSignalTH[i].get()); + mSignalTH[i]->Write(); + } } mTransmitted->Write(); mFired->Write(); @@ -279,11 +288,11 @@ int DumpRaw::process(const EventChData& ch) // Not empty event auto f = ch.f; int ih = getHPos(f.board, f.ch); - if (ih < 0) { + if (ih < 0 || ih >= NDigiChannels) { return -1; } - if (mVerbosity > 0) { + if (mVerbosity > 1) { for (int32_t iw = 0; iw < NWPerBc; iw++) { Digits2Raw::print_gbt_word(ch.w[iw]); } @@ -294,6 +303,10 @@ int DumpRaw::process(const EventChData& ch) mFired->Fill(f.board, f.ch); } + static int16_t prev_s[NDigiChannels][NTimeBinsPerBC] = {0}; + static uint32_t prev_orbit[NDigiChannels] = {0}; + static uint16_t prev_bc[NDigiChannels] = {0}; + uint16_t us[12]; int16_t s[12]; us[0] = f.s00; @@ -386,6 +399,12 @@ int DumpRaw::process(const EventChData& ch) mBits->Fill(ih, 2); if (f.Hit) { mBitsH->Fill(ih, 2); + if ((prev_orbit[ih] == f.orbit && (f.bc - prev_bc[ih]) == 1) || ((f.orbit - prev_orbit[ih]) == 1 && prev_bc[ih] == 3563 && f.bc == 0)) { + for (int32_t i = 0; i < 12; i++) { + mSignalTH[ih]->Fill(i + 0., double(s[i])); + mSignalTH[ih]->Fill(i - NTimeBinsPerBC + 0., double(prev_s[ih][i])); + } + } } for (int32_t i = 0; i < 12; i++) { mSignalT[ih]->Fill(i + 0., double(s[i])); @@ -429,6 +448,12 @@ int DumpRaw::process(const EventChData& ch) mError->Fill(ih); } } + // Save information to process next bunch crossing + prev_orbit[ih] = f.orbit; + prev_bc[ih] = f.bc; + for (int32_t i = 0; i < 12; i++) { + prev_s[ih][i] = s[i]; + } return 0; } diff --git a/Detectors/ZDC/reconstruction/include/ZDCReconstruction/DigiReco.h b/Detectors/ZDC/reconstruction/include/ZDCReconstruction/DigiReco.h index 32368791f9817..f611da568b2a8 100644 --- a/Detectors/ZDC/reconstruction/include/ZDCReconstruction/DigiReco.h +++ b/Detectors/ZDC/reconstruction/include/ZDCReconstruction/DigiReco.h @@ -157,6 +157,7 @@ class DigiReco bool mLowPassFilterSet = false; /// Low pass filtering set via function call bool mFullInterpolation = false; /// Full waveform interpolation bool mFullInterpolationSet = false; /// Full waveform interpolation set via function call + int mFullInterpolationMinLength = 2; /// Minimum length to perform full interpolation int mInterpolationStep = 25; /// Coarse interpolation step bool mCorrSignal = true; /// Enable TDC signal correction bool mCorrSignalSet = false; /// TDC signal correction set via function call diff --git a/Detectors/ZDC/reconstruction/include/ZDCReconstruction/RecoParamZDC.h b/Detectors/ZDC/reconstruction/include/ZDCReconstruction/RecoParamZDC.h index 79b6bca3b1bc4..fe5652da6fc15 100644 --- a/Detectors/ZDC/reconstruction/include/ZDCReconstruction/RecoParamZDC.h +++ b/Detectors/ZDC/reconstruction/include/ZDCReconstruction/RecoParamZDC.h @@ -33,10 +33,11 @@ struct RecoParamZDC : public o2::conf::ConfigurableParamHelper { uint8_t triggerCondition = 0x0; // Trigger condition: 0x1 single, 0x3 double and 0x7 triple // Signal processing - int low_pass_filter = -1; // Low pass filtering - int full_interpolation = -1; // Full interpolation of waveform - int corr_signal = -1; // TDC signal correction - int corr_background = -1; // TDC pile-up correction + int low_pass_filter = -1; // Low pass filtering + int full_interpolation = -1; // Full interpolation of waveform + int full_interpolation_min_length = -1; // Minimum length to perform full interpolation + int corr_signal = -1; // TDC signal correction + int corr_background = -1; // TDC pile-up correction int debug_output = -1; // Debug output diff --git a/Detectors/ZDC/reconstruction/src/DigiReco.cxx b/Detectors/ZDC/reconstruction/src/DigiReco.cxx index 136588cd0fdf4..bdf66c8a45a77 100644 --- a/Detectors/ZDC/reconstruction/src/DigiReco.cxx +++ b/Detectors/ZDC/reconstruction/src/DigiReco.cxx @@ -101,8 +101,12 @@ void DigiReco::init() } mFullInterpolation = ropt.full_interpolation > 0 ? true : false; } + if (ropt.full_interpolation_min_length >= 2) { + // Minimum is 2 consecutive bunch crossings + mFullInterpolationMinLength = ropt.full_interpolation_min_length; + } if (mVerbosity > DbgZero) { - LOG(info) << "Full waveform interpolation is " << (mFullInterpolation ? "enabled" : "disabled"); + LOG(info) << "Full waveform interpolation is " << (mFullInterpolation ? "enabled" : "disabled") << " min length is " << mFullInterpolationMinLength; } if (ropt.triggerCondition == 0) { @@ -828,8 +832,8 @@ int DigiReco::reconstructTDC(int ibeg, int iend) istop = ibun; } else { // No data from channel // A gap is detected - if (istart >= 0 && (istop - istart) > 0) { - // Need data for at least two consecutive bunch crossings + if (istart >= 0 && (istop - istart + 1) >= mFullInterpolationMinLength) { + // Need data for at least mFullInterpolationMinLength (two) consecutive bunch crossings int rval = fullInterpolation(isig, istart, istop); if (rval) { return rval; @@ -839,8 +843,8 @@ int DigiReco::reconstructTDC(int ibeg, int iend) istop = -1; } } - // Check if there are consecutive bunch crossings at the end of group - if (istart >= 0 && (istop - istart) > 0) { + // Check if there are mFullInterpolationMinLength consecutive bunch crossings at the end of group + if (istart >= 0 && (istop - istart + 1) >= mFullInterpolationMinLength) { int rval = fullInterpolation(isig, istart, istop); if (rval) { return rval; diff --git a/Detectors/ZDC/reconstruction/src/RecoConfigZDC.cxx b/Detectors/ZDC/reconstruction/src/RecoConfigZDC.cxx index 001c64100b82f..8e4bd173691b3 100644 --- a/Detectors/ZDC/reconstruction/src/RecoConfigZDC.cxx +++ b/Detectors/ZDC/reconstruction/src/RecoConfigZDC.cxx @@ -14,6 +14,15 @@ using namespace o2::zdc; +void RecoConfigZDC::setBit(uint32_t ibit, bool val) +{ + if (ibit >= 0 && ibit < NTDCChannels) { + bitset[ibit] = val; + } else { + LOG(fatal) << __func__ << " channel " << ibit << " not in allowed range"; + } +} + void RecoConfigZDC::setSearch(uint32_t ich, int val) { if (ich >= 0 && ich < NTDCChannels) { @@ -95,7 +104,7 @@ void RecoConfigZDC::print() const (storeEvPileup ? " StoreEvPileup(EvE)" : " DontStoreEvPileup(EvE)"), (triggerCondition == 0x1 ? " SINGLEtrigger" : (triggerCondition == 0x3 ? " DOUBLEtrigger" : (triggerCondition == 0x7 ? "TRIPLEtrigger" : "WRONGtrigger")))); for (int itdc = 0; itdc < NTDCChannels; itdc++) { - LOG(info) << itdc << " " << ChannelNames[TDCSignal[itdc]] << " search= " << tdc_search[itdc] << " = " << tdc_search[itdc] * FTDCVal << " ns"; + LOG(info) << itdc << " " << ChannelNames[TDCSignal[itdc]] << " search= " << tdc_search[itdc] << " = " << tdc_search[itdc] * FTDCVal << " ns" << (bitset[itdc] ? " BITSET" : ""); } for (Int_t ich = 0; ich < NChannels; ich++) { LOG(info) << ChannelNames[ich] << " integration: signal=[" << beg_int[ich] << ":" << end_int[ich] << "] pedestal=[" << beg_ped_int[ich] << ":" << end_ped_int[ich] 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; } }