17#include <TDirectory.h>
18#include <TPaveStats.h>
32 if (mTDCCalibConfig ==
nullptr) {
33 LOG(fatal) <<
"o2::zdc::TDCCalib: missing configuration object";
40 if (opt.debugOutput ==
true) {
45 auto* cfg = mTDCCalibConfig;
62 LOGF(info,
"Computing TDC Calibration coefficients");
67 if (!mTDCCalibConfig->
enabled[ih]) {
68 LOGF(info,
"DISABLED processing of RUN3 data for ih = %d: %s", ih,
TDCCalibData::CTDC[ih]);
72 else if (mData.
entries[ih] >= mTDCCalibConfig->
min_e[ih]) {
76 LOGF(info,
"FAILED processing RUN3 data for ih = %d: %s: TOO FEW EVENTS: %d", ih,
TDCCalibData::CTDC[ih], mData.
entries[ih]);
86 std::map<std::string, std::string> md;
87 md[
"config"] = mTDCCalibConfig->
desc;
90 if (starting >= 10000) {
91 starting = starting - 10000;
93 uint64_t stopping = mData.
mCTimeEnd + 10000;
97 if (mSaveDebugHistos) {
108void TDCCalib::assign(
int ih,
bool ismod)
110 if (ih >= 0 && ih <= 9) {
111 auto oldval = mTDCParam->
getShift(ih);
118 LOGF(error,
"Negative value of shift: %8.6f not acceptable",
val);
121 else if (
val >= 25) {
122 LOGF(error,
"Value of shift: %8.6f >= 25 ns not acceptable",
val);
140 LOG(fatal) <<
"TDCCalib::assign accessing not existing ih = " << ih;
149 for (int32_t ii = ihstart; ii < ihstop; ii++) {
173 if (ih >= 0 && ih < nh) {
176 LOG(error) <<
"TDCCalib::add: unsupported FlatHisto1D " << ih;
185 int nEntries = h1->GetEntries();
187 if ((ih >= 0 && ih <= 9) && (nEntries >= mTDCCalibConfig->
min_e[ih])) {
188 double avgShift = h1->GetMean();
191 LOG(error) <<
"TDCCalib::extractShift TDC out of range " << ih;
199 LOG(info) <<
"Saving aggregator histos on file " << fn;
201 TDirectory* cwd = gDirectory;
202 TFile*
f =
new TFile(fn.data(),
"recreate");
204 LOG(error) <<
"Cannot create file: " << fn;
211 p->Write(
"", TObject::kOverwrite);
213 LOG(info) << p->GetName() <<
" entries: " << p->GetEntries();
ZDC calibration common parameters.
TDC calibration intermediate data.
Parameters to correct TDCs (produced by QA)
static std::string generateFileName(const std::string &inp)
void setStartValidityTimestamp(long start)
void setFileName(const std::string &nm)
void setPath(const std::string &path)
void setEndValidityTimestamp(long end)
void setObjectType(const std::string &tp)
void setMetaData(const std::map< std::string, std::string > &md)
static const CalibParamZDC & Instance()
void add(int ih, o2::dataformats::FlatHisto1D< float > &h1)
double extractShift(int ih)
int write(const std::string fn="ZDCTDCCalib.root")
int process(const gsl::span< const o2::zdc::BCRecData > &bcrec, const gsl::span< const o2::zdc::ZDCEnergy > &energy, const gsl::span< const o2::zdc::ZDCTDCData > &tdc, const gsl::span< const uint16_t > &info)
void setSaveDebugHistos()
const std::string CCDBPathTDCCalib
static std::string getClassName(const T &obj)
get the class name of the object
bool enabled[NTDCChannels]
double min_e[NTDCChannels]
double cutLow[NTDCChannels]
double cutHigh[NTDCChannels]
uint64_t mCTimeBeg
ZNAC, ZNAS, ZPAC, ZPAS, ZEM1, ZEM2, ZNCC, ZNCS, ZPCC, ZPCS.
uint64_t mCTimeEnd
Time of processed time frame.
static constexpr const char * CTDC[NTDC]
Time of processed time frame.
static constexpr int NTDC
void setShift(uint32_t ich, float val)
float getShift(uint32_t ich) const
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"