47 const auto*
h = cont->histo.get();
48 auto nx =
h->getNBinsX(), ny =
h->getNBinsY();
49 std::array<double, 3> parg;
51 double sS = 0, sX = 0, sY = 0, sXX = 0, sXY = 0;
53 for (
auto ix = nx; ix--;) {
54 const auto sliceY =
h->getSliceY(ix);
59 double err2 = mat(1, 1);
63 double err2i = 1. / err2, xb =
h->getBinXCenter(ix), xbw = xb * err2i, ybw = parg[1] * err2i;
71 if (!mSaveHistosFile.empty()) {
72 TFile savf(mSaveHistosFile.c_str(),
"update");
75 LOGP(info,
"Saved histo for slot {}-{} to {}", slot.
getTFStart(), slot.
getTFEnd(), mSaveHistosFile);
77 double det = sS * sXX - sX * sX;
78 if (!det || npval < 2) {
79 LOGP(alarm,
"VDrift fit failed for slot {}<=TF<={} with {} entries: det={} npoints={}", slot.
getTFStart(), slot.
getTFEnd(), cont->entries, det, npval);
82 double offs = (sXX * sY - sX * sXY) * det,
slope = (sS * sXY - sX * sY) * det;
83 double offsErr = sXX * det, slopErr = sS * det;
84 offsErr = offsErr > 0. ? std::sqrt(offsErr) : 0.;
85 slopErr = slopErr > 0. ? std::sqrt(slopErr) : 0.;
86 float corrFact = 1. / (1. -
slope);
87 float corrFactErr = corrFact * corrFact * slopErr;
90 std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(),
93 float(cont->driftVFullMean),
94 cont->tOffsetRef, 0.f});
96 vd.normalize(cont->driftVRef);
100 std::map<std::string, std::string> md;
101 mCCDBInfoPerSlot.emplace_back(
"TPC/Calib/VDriftTgl", clName, flName, md,
103 LOGP(info,
"Finalize slot {}({})<=TF<={}({}) with {} entries | dTgl vs Tgl_ITS offset: {:.4f}+-{:.4f} Slope: {:.4f}+-{:.4f} -> Corr factor = {:.4f}+-{:.4f} wrt <VD>={:.4f} -> {:.4f} wrt {:.4f}",
104 slot.
getTFStart(), slot.
getStartTimeMS(), slot.
getTFEnd(), slot.
getEndTimeMS(), cont->entries, offs, offsErr,
slope, slopErr, corrFact, corrFactErr, cont->driftVFullMean, vd.corrFact, vd.refVDrift);