15#include <TDirectory.h>
27 double mean = 0, var = 0;
28 if (
getStat(is, en, mean, var) == 0) {
29 LOGF(info,
"Baseline %2d %s with %10llu events mean %8.1f rms %8.1f (ch)", is,
ChannelNames[is].
data(), en, mean, TMath::Sqrt(var));
37 if (
other.mOverflow) {
39 LOG(warn) <<
"BaselineCalibData" << __func__ <<
" Refusing to add an overflow. BREAK!";
42 for (int32_t is = 0; is <
NChannels; is++) {
43 if (
other.mHisto[is].mOverflow) {
45 LOG(warn) <<
"BaselineCalibData::" << __func__ <<
" Refusing to add an overflow histogram for ch " << is <<
" BREAK!";
51 if (
sum > 0xffffffff) {
52 LOG(warn) <<
"BaselineCalibData::" << __func__ <<
" Addition would result in an overflow for ch " << is <<
" BREAK!";
58 for (int32_t is = 0; is <
NChannels; is++) {
70 LOG(info) << __func__;
80 LOGF(info) <<
"BaselineCalibData assigning BaselineCalibSummaryData" s.print();
85 for (int32_t is = 0; is <
NChannels; is++) {
91 LOG(warn) <<
"Overflow bit set on signal " << is;
105 LOG(error) <<
"BaselineCalibData::operator+=(const BaselineCalibSummaryData* s): null pointer";
109 LOGF(info) <<
"BaselineCalibData cumulating BaselineCalibSummaryData" s.print();
113 LOG(warn) << __func__ <<
" Refusing to add an overflow BaselineCalibSummaryData BREAK!";
117 for (int32_t is = 0; is <
NChannels; is++) {
118 if (s->mOverflowCh[is]) {
120 LOG(warn) << __func__ <<
" Refusing to add an overflow histogram for ch " << is <<
" BREAK!";
126 for (
auto& bin : s->mData) {
128 if (
sum > 0xffffffff) {
129 LOG(warn) << __func__ <<
" Addition would result in an overflow for ch " << bin.id <<
" BREAK!";
139 for (
auto& bin : s->mData) {
151 LOGF(info,
"BaselineCalibData::setCreationTime %llu", ctime);
165 LOGF(info,
"BaselineCalibData::mergeCreationTime %llu", ctime);
173 LOGF(error,
"BaselineCalibData::getEntries channel index %d is out of range", is);
182 for (int32_t
i = 0;
i <
NW;
i++) {
192 LOGF(error,
"BaselineCalibData::getStat channel index %d is out of range", is);
202 for (uint64_t
i = 0;
i <
NW;
i++) {
209 mean = double(
sum) / double(en);
212 for (int32_t
i = 0;
i <
NW;
i++) {
213 double diff =
i - mean;
214 sums += (
mData[
i] * diff * diff);
216 var = sums / (en - 1);
228 TDirectory* cwd = gDirectory;
229 TFile*
f =
new TFile(fn.data(),
"recreate");
231 LOG(error) <<
"Cannot create file: " << fn;
234 for (int32_t is = 0; is <
NChannels; is++) {
237 TString
n = TString::Format(
"h%d", is);
241 h.SetBinContent(ibx + 1,
mHisto[is].mData[ibx]);
244 h.Write(
"", TObject::kOverwrite);
259 for (int32_t is = 0; is <
NChannels; is++) {
267 for (
int iw = 0; iw <
NW; iw++) {
288 for (int32_t is = 0; is <
NChannels; is++) {
306 for (
int ich = 0; ich <
NChannels; ich++) {
315 for (
auto& bin :
mData) {
317 ccont[bin.id] += bin.cont;
319 for (int32_t is = 0; is <
NChannels; is++) {
320 LOGF(info,
"Summary ch %2d nbin = %d events = %llu", is, nbin[is], ccont[is]);
Baseline calibration intermediate data.
Class for time synchronization of RawReader instances.
float sum(float s, o2::dcs::DataPointValue v)
constexpr int BaselineMax
constexpr int BaselineMin
constexpr int BaselineRange
constexpr std::string_view ChannelNames[]
uint64_t getEntries() const
Overflow flag (cannot accept more data)
bool mOverflow
Histogram container.
int getStat(uint64_t &en, double &mean, double &var) const
std::array< uint32_t, NW > mData
2^16 bins
BaselineCalibSummaryData & getSummary()
uint64_t getEntries(int is) const
bool mOverflow
Time of processed time frame.
BaselineCalibData & operator=(const BaselineCalibSummaryData &s)
void setCreationTime(uint64_t ctime)
BaselineCalibData & operator+=(const BaselineCalibData &other)
int saveDebugHistos(const std::string fn, float factor)
BaselineCalibSummaryData mSummary
Histogram for single channel.
int getStat(int is, uint64_t &en, double &mean, double &var) const
uint64_t mCTimeEnd
Time of processed time frame.
BaselineCalibChData mHisto[NChannels]
Overflow at least one ZDC channel.
void mergeCreationTime(uint64_t ctime)
std::vector< BaselineCalibBinData > mData
Channel overflow information.
std::array< bool, NChannels > mOverflowCh
Overflow of one channel.
uint64_t mCTimeEnd
Time of processed time frame.
bool mOverflow
Time of processed time frame.
void clear()
Data of not empty bins.
VectorOfTObjectPtrs other
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"