17#include <TDirectory.h>
31 if (opt.debugOutput ==
true) {
39 for (
int isig = 0; isig <
NChannels; isig++) {
41 if (
mH[0][isig] ==
nullptr) {
47 if (
mH[1][isig] ==
nullptr) {
53 if (
mH[2][isig] ==
nullptr) {
94 if (ih >= 0 && ih < NChannels && iarr >= 0 && iarr <
NHA) {
95 mH[iarr][ih]->add(h1);
97 LOG(error) <<
"InterCalib::add: unsupported FlatHisto1D ih=" << ih <<
" iarr=" << iarr;
106 LOGF(info,
"Finalizing NoiseCalibData object");
109 if (mSaveDebugHistos) {
113 for (
int isig = 0; isig <
NChannels; isig++) {
115 double mean = 0, var = 0;
117 mData.
getStat(isig, en, mean, var);
137 std::map<std::string, std::string> md;
138 md[
"config"] = opt.descr;
141 if (starting >= 10000) {
142 starting = starting - 10000;
144 uint64_t stopping = mData.
mCTimeEnd + 10000;
148 LOGF(info,
"Validity: %llu:%llu", starting, stopping);
156 LOG(info) <<
"Saving debug histograms on file " << fn;
161 TDirectory* cwd = gDirectory;
162 TFile*
f =
new TFile(fn.data(),
"update");
164 LOG(error) <<
"Cannot update file: " << fn;
167 for (int32_t is = 0; is <
NChannels; is++) {
168 auto p =
mH[0][is]->createTH1F(TString::Format(
"hs%d", is).Data());
169 p->SetTitle(TString::Format(
"Baseline samples %s",
ChannelNames[is].
data()));
170 p->Write(
"", TObject::kOverwrite);
172 for (int32_t is = 0; is <
NChannels; is++) {
173 auto p =
mH[1][is]->createTH1F(TString::Format(
"hss%d", is).Data());
174 p->SetTitle(TString::Format(
"Bunch sum of samples %s",
ChannelNames[is].
data()));
175 p->Write(
"", TObject::kOverwrite);
177 for (int32_t is = 0; is <
NChannels; is++) {
178 auto p =
mH[2][is]->createTH1F(TString::Format(
"hsd%d", is).Data());
179 p->SetTitle(TString::Format(
"Baseline estimation difference %s",
ChannelNames[is].
data()));
180 p->Write(
"", TObject::kOverwrite);
ZDC calibration common parameters.
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, int iarr, o2::dataformats::FlatHisto1D< double > &h1)
void setSaveDebugHistos()
int process(const o2::zdc::NoiseCalibSummaryData *data)
std::array< std::array< o2::dataformats::FlatHisto1D< double > *, NChannels >, NHA > mH
int saveDebugHistos(const std::string fn="ZDCNoiseCalib.root")
constexpr int NTimeBinsPerBC
constexpr std::string_view ChannelNames[]
const std::string CCDBPathNoiseCalib
static std::string getClassName(const T &obj)
get the class name of the object
int saveDebugHistos(const std::string fn, bool is_epn=false)
uint64_t mCTimeEnd
Time of processed time frame.
int getStat(int is, uint64_t &en, double &mean, double &var) const
uint64_t entries[NChannels]
void setCalib(uint32_t ich, float val)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"