13#include <fairlogger/Logger.h>
22 mTRMerrorProb.clear();
40 long timems =
long(mTimeStamp) * 1000;
41 LOG(info) <<
"TOF get active map with timestamp (ms) = " << timems;
42 auto fee = mgr.getForTimeStamp<
TOFFEElightInfo>(
"TOF/Calib/FEELIGHT", timems);
53 LOG(info) <<
"read Active map (TOFFEELIGHT) for TOF ";
61 LOG(info) <<
"Active map (TOFFEELIGHT) not available in ccdb";
73 long timems =
long(mTimeStamp) * 1000;
74 LOG(info) <<
"TOF get LHCphase with timestamp (ms) = " << timems;
75 mLHCphase = mgr.getForTimeStamp<
LhcPhase>(
"TOF/Calib/LHCphase", timems);
77 LOG(info) <<
"read LHCphase for TOF " << mLHCphase->
getLHCphase(mTimeStamp);
79 LOG(info) <<
"LHC phase not available in ccdb";
92 long timems =
long(mTimeStamp) * 1000;
93 LOG(info) <<
"TOF get time calibrations with timestamp (ms) = " << timems;
94 mSlewParam = mgr.getForTimeStamp<
SlewParam>(
"TOF/Calib/ChannelCalib", timems);
96 LOG(info) <<
"read TimeSlewingParam for TOF";
98 LOG(info) <<
"TimeSlewingParam for TOF not available in ccdb";
107 mSlewParam = (
SlewParam*)
f->Get(
"ccdb_object");
118 long timems =
long(mTimeStamp) * 1000;
119 LOG(info) <<
"TOF get Diagnostics with timestamp (ms) = " << timems;
120 mDiaFreq = mgr.getForTimeStamp<
Diagnostic>(
"TOF/Calib/Diagnostic", timems);
155 mEmptyCrateProb[
i] = ncrate[
i] / nrow;
158 const auto vectorDia = mDiaFreq->
getVector();
160 for (
auto pair : vectorDia) {
161 auto key = pair.first;
164 if (slot < 13 && slot > 2) {
166 int crateslot = icrate * 100 + slot;
167 mTRMerrorProb.push_back(std::make_pair(crateslot, pair.second / (nrow - ncrate[icrate])));
168 mTRMmask.push_back(
key - mDiaFreq->
getTRMKey(icrate, slot));
178 int crate = channel / NCH_PER_CRATE;
179 float prob = pair.second / (nrow - ncrate[crate]);
180 mNoisy.push_back(std::make_pair(channel, prob));
185 std::sort(mTRMerrorProb.begin(), mTRMerrorProb.end(), [](
const auto&
a,
const auto&
b) {
186 return a.first < b.first;
189 std::sort(mNoisy.begin(), mNoisy.end(), [](
const auto&
a,
const auto&
b) {
190 return a.first < b.first;
195 for (
auto [ch, p] : mNoisy) {
197 if (ich != -1 && prob > 0.5) {
198 mIsNoisy[ich] =
true;
206 if (ich != -1 && prob > 0.5) {
207 mIsNoisy[ich] =
true;
220 api.
init(mgr.getURL());
233 api.
init(mgr.getURL());
234 if (maxTimeStamp == 0) {
237 api.
storeAsTFileAny(
param,
"TOF/Calib/ChannelCalib", metadataChannelCalib, minTimeStamp, maxTimeStamp);
256 return mIsNoisy[ich];
263 return mIsOffCh[ich];
274 if (!mLHCphase || !mSlewParam) {
275 LOG(warning) <<
"Either LHC phase or slewing object null: mLHCphase = " << mLHCphase <<
", mSlewParam = " << mSlewParam;
297 LOG(warning) <<
"slewing object null: mSlewParam = " << mSlewParam;
324 for (
auto index : mFillErrChannel) {
325 mIsErrorCh[
index] =
false;
328 mFillErrChannel.clear();
338 int ech = (crate << 12) + ((trm - 3) << 8);
339 for (
int i = ech;
i < ech + 256;
i++) {
344 mIsErrorCh[channel] =
true;
345 mFillErrChannel.push_back(channel);
360 return mIsErrorCh[channel];
ClassImp(o2::tof::CalibTOFapi)
Class to use TOF calibration (decalibration, calibration)
static BasicCCDBManager & instance()
int storeAsTFileAny(const T *obj, std::string const &path, std::map< std::string, std::string > const &metadata, long startValidityTimestamp=-1, long endValidityTimestamp=-1, std::vector< char >::size_type maxSize=0) const
void init(std::string const &hosts)
bool isChannelError(int channel) const
void loadDiagnosticFrequencies()
void writeLHCphase(LhcPhase *phase, std::map< std::string, std::string > metadataLHCphase, uint64_t minTimeSTamp, uint64_t maxTimeStamp)
void readTimeSlewingParamFromFile(const char *filename)
void writeTimeSlewingParam(SlewParam *param, std::map< std::string, std::string > metadataChannelCalib, uint64_t minTimeSTamp, uint64_t maxTimeStamp=0)
void readDiagnosticFrequencies()
bool checkTRMPolicy(int mask) const
void readTimeSlewingParam()
void processError(int crate, int trm, int mask)
void loadActiveMap(TOFFEElightInfo *fee)
void setURL(const std::string url)
float getTimeDecalibration(int ich, float tot) const
bool isProblematic(int ich)
float getTimeCalibration(int ich, float tot) const
Diagnostic class for TOF.
uint32_t getFrequencyROW() const
void print(bool longFormat=false) const
uint32_t getFrequencyEmptyCrate(int crate) const
static int getCrate(ULong64_t pattern)
static ULong64_t getTRMKey(int crate, int trm)
static int getChannel(ULong64_t pattern)
uint32_t getFrequencyEmptyTOF() const
const std::map< ULong64_t, uint32_t > & getVector() const
bool isNoisyChannel(int channel, int thr=0) const
static int getSlot(ULong64_t pattern)
static constexpr Int_t NSTRIPXSECTOR
static constexpr Int_t NPADS
static Int_t getCHFromECH(int echan)
static constexpr int NCHANNELS
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
bool getChannelEnabled(int idx) const
static constexpr int NCHANNELS
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"