33 LOG(info) <<
"Default c-tor, not to be used";
40 for (
int i =
data.size();
i--;) {
49 auto ch =
data[
i].getTOFChIndex();
50 auto dt =
data[
i].getDeltaTimePi();
51 auto tot =
data[
i].getTot();
59 float dtRange = dt +
range;
60 if (dtRange > 0 && dtRange < 2 *
range) {
63 mTimeHist->Fill(mSlot, dt);
74 for (
int i =
histo.size();
i--;) {
93 mLHCphaseVector.clear();
107 <<
c->getEntries() <<
" entries";
108 std::array<double, 3> fitValues;
109 std::vector<float> histoValues;
110 int imax =
c->nbins / 2;
112 for (
unsigned i = 0;
i <
c->nbins; ++
i) {
113 const auto&
v =
c->histo.at(
i);
126 double binwidth = 2 *
c->range /
c->nbins;
127 int binrange =
int(1500 / binwidth) + 1;
128 for (
unsigned i = 0;
i <
c->nbins; ++
i) {
129 const auto&
v =
c->histo.at(
i);
130 if (
i >= imax - binrange &&
i < imax + binrange) {
131 histoValues.push_back(
v *
renorm);
136 float minRange = (imax -
c->nbins / 2 - binrange) * binwidth;
137 float maxRange = (imax -
c->nbins / 2 + binrange) * binwidth;
139 double fitres = fitGaus(nbinsUsed, histoValues.data(), minRange, maxRange, fitValues,
nullptr, 2.,
false);
141 LOG(info) <<
"Fit result " << fitres <<
" Mean = " << fitValues[1] <<
" Sigma = " << fitValues[2];
143 LOG(warning) <<
"Fit failed with result = " << fitres;
146 std::map<std::string, std::string> md;
156 auto stopping = slot.
getEndTimeMS() + endValidityMarging;
157 LOG(info) <<
"starting = " << starting <<
" - stopping = " << stopping <<
" -> phase = " << fitValues[1] <<
" ps (added BC = " << tobeused <<
")";
161 mInfoVector.emplace_back(
"TOF/Calib/LHCphase", clName, flName, md, starting, stopping);
162 mLHCphaseVector.emplace_back(l);
166 TFile fout(
"debug_tof_phase.root",
"RECREATE");
176 auto& slot = front ? cont.emplace_front(tstart, tend) : cont.emplace_back(tstart, tend);
178 slot.setContainer(std::make_unique<LHCClockDataHisto>(mNBins, mRange, mCalibTOFapi));
180 slot.setContainer(std::make_unique<LHCClockDataHisto>(mNBins, mRange, mCalibTOFapi, mNslot, mTimeHist));
Utils and constants for calibration and related workflows.
std::tuple< ransState_t, stream_IT > renorm(ransState_t state, stream_IT outputIter, count_t frequency, size_t symbolTablePrecision)
static int getNHBFPerTF()
float getMaxSlotsDelay() const
TFType getSlotLength() const
long getStartTimeMS() const
long getEndTimeMS() const
const Container * getContainer() const
TFType getTFStart() const
static std::string generateFileName(const std::string &inp)
static constexpr long SECOND
static constexpr long INFINITE_TIMESTAMP_SECONDS
float getTimeCalibration(int ich, float tot) const
static constexpr Double_t BC_TIME_INPS
Slot & emplaceNewSlot(bool front, TFType tstart, TFType tend) final
void finalizeSlot(Slot &slot) final
static int addMaskBC(int mask, int channel)
constexpr double LHCOrbitMUS
Double_t fitGaus(const size_t nBins, const T *arr, const T xMin, const T xMax, std::vector< T > ¶m)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< float > histo
o2::tof::CalibTOFapi * calibApi
void fill(const gsl::span< const o2::dataformats::CalibInfoTOF > data)
void merge(const LHCClockDataHisto *prev)
static std::string getClassName(const T &obj)
get the class name of the object
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"