Project
Loading...
Searching...
No Matches
CalibTOFapi.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
15
16#ifndef ALICEO2_TOF_CALIBTOFAPI_H_
17#define ALICEO2_TOF_CALIBTOFAPI_H_
18
19#include <iostream>
23#include "TOFBase/Geo.h"
26
27namespace o2
28{
29namespace tof
30{
31
33{
34
39
40 public:
41 void resetDia();
42 CalibTOFapi() = default;
43 CalibTOFapi(const std::string url);
44 CalibTOFapi(long timestamp, o2::dataformats::CalibLHCphaseTOF* phase, o2::dataformats::CalibTimeSlewingParamTOF* slew, Diagnostic* dia = nullptr) : mTimeStamp(timestamp), mLHCphase(phase), mSlewParam(slew), mDiaFreq(dia) {}
46 {
47 if (mLHCphase) {
48 // delete mLHCphase;
49 }
50 if (mSlewParam) {
51 // delete mSlewParam;
52 }
53 if (mDiaFreq) {
54 // delete mDiaFreq;
55 }
56 }
57
58 void setTimeStamp(long t)
59 {
60 mTimeStamp = t;
61 }
62 void setURL(const std::string url)
63 {
64 auto& mgr = CcdbManager::instance();
65 mgr.setURL(url);
66 }
67 void readLHCphase();
69 void readTimeSlewingParamFromFile(const char* filename);
72 void readActiveMap();
74 void writeLHCphase(LhcPhase* phase, std::map<std::string, std::string> metadataLHCphase, uint64_t minTimeSTamp, uint64_t maxTimeStamp);
75 void writeTimeSlewingParam(SlewParam* param, std::map<std::string, std::string> metadataChannelCalib, uint64_t minTimeSTamp, uint64_t maxTimeStamp = 0);
76 float getTimeCalibration(int ich, float tot) const;
77 float getTimeCalibration(int ich, float tot, float phase) const;
78 float getTimeDecalibration(int ich, float tot) const;
79 bool isProblematic(int ich);
80 bool isNoisy(int ich);
81 bool isOff(int ich);
82 float getFractionUnderPeak(int ich) const { return mSlewParam->getFractionUnderPeak(ich); }
83 float currentLHCphase() const { return mLHCphase->getLHCphase(mTimeStamp); }
84
85 SlewParam* getSlewParam() { return mSlewParam; }
86 SlewParam& getSlewParamObj() { return *mSlewParam; }
87 void setSlewParam(SlewParam* obj) { mSlewParam = obj; }
88 LhcPhase* getLhcPhase() { return mLHCphase; }
89 void setLhcPhase(LhcPhase* obj) { mLHCphase = obj; }
90 Diagnostic* getDiagnostic() { return mDiaFreq; }
91 void setDiagnostic(Diagnostic* obj) { mDiaFreq = obj; }
92
93 int getNoisyThreshold() const { return mNoisyThreshold; }
94 void setNoisyThreshold(int val) { mNoisyThreshold = val; }
95 float getEmptyTOFProb() const { return mEmptyTOF; }
96 const float* getEmptyCratesProb() const { return mEmptyCrateProb; }
97 const std::vector<std::pair<int, float>>& getNoisyProb() const { return mNoisy; }
98 const std::vector<std::pair<int, float>>& getTRMerrorProb() const { return mTRMerrorProb; }
99 const std::vector<int>& getTRMmask() const { return mTRMmask; }
100
101 void resetTRMErrors();
102 void processError(int crate, int trm, int mask);
103 bool isChannelError(int channel) const;
104 bool checkTRMPolicy(int mask) const;
105
106 private:
107 long mTimeStamp;
108 LhcPhase* mLHCphase = nullptr;
109 SlewParam* mSlewParam = nullptr;
110 Diagnostic* mDiaFreq = nullptr;
111
112 // info from diagnostic
113 int mNoisyThreshold = 1;
114 float mEmptyTOF = 0;
115 float mEmptyCrateProb[Geo::kNCrate] = {};
116 std::vector<std::pair<int, float>> mNoisy;
117 std::vector<std::pair<int, float>> mTRMerrorProb;
118 std::vector<int> mTRMmask;
119
120 bool mIsErrorCh[Geo::NCHANNELS] = {};
121 std::vector<int> mFillErrChannel;
122 bool mIsOffCh[Geo::NCHANNELS] = {};
123 bool mIsNoisy[Geo::NCHANNELS] = {};
124
125 ClassDefNV(CalibTOFapi, 1);
126};
127} // namespace tof
128} // namespace o2
129#endif
Class to store the output of the matching to TOF for calibration.
Class to store the output of the matching to TOF for calibration.
Definition of the TOF cluster.
uint64_t phase
Definition RawEventData.h:7
static BasicCCDBManager & instance()
float getLHCphase(int timestamp) const
float getFractionUnderPeak(int sector, int channel) const
bool isChannelError(int channel) const
CalibTOFapi(long timestamp, o2::dataformats::CalibLHCphaseTOF *phase, o2::dataformats::CalibTimeSlewingParamTOF *slew, Diagnostic *dia=nullptr)
Definition CalibTOFapi.h:44
void writeLHCphase(LhcPhase *phase, std::map< std::string, std::string > metadataLHCphase, uint64_t minTimeSTamp, uint64_t maxTimeStamp)
void setSlewParam(SlewParam *obj)
Definition CalibTOFapi.h:87
void readTimeSlewingParamFromFile(const char *filename)
const float * getEmptyCratesProb() const
Definition CalibTOFapi.h:96
const std::vector< std::pair< int, float > > & getNoisyProb() const
Definition CalibTOFapi.h:97
const std::vector< std::pair< int, float > > & getTRMerrorProb() const
Definition CalibTOFapi.h:98
void writeTimeSlewingParam(SlewParam *param, std::map< std::string, std::string > metadataChannelCalib, uint64_t minTimeSTamp, uint64_t maxTimeStamp=0)
bool checkTRMPolicy(int mask) const
float getFractionUnderPeak(int ich) const
Definition CalibTOFapi.h:82
LhcPhase * getLhcPhase()
Definition CalibTOFapi.h:88
void setTimeStamp(long t)
Definition CalibTOFapi.h:58
SlewParam * getSlewParam()
Definition CalibTOFapi.h:85
void setNoisyThreshold(int val)
Definition CalibTOFapi.h:94
float getEmptyTOFProb() const
Definition CalibTOFapi.h:95
bool isNoisy(int ich)
Diagnostic * getDiagnostic()
Definition CalibTOFapi.h:90
void processError(int crate, int trm, int mask)
void loadActiveMap(TOFFEElightInfo *fee)
void setLhcPhase(LhcPhase *obj)
Definition CalibTOFapi.h:89
float currentLHCphase() const
Definition CalibTOFapi.h:83
SlewParam & getSlewParamObj()
Definition CalibTOFapi.h:86
int getNoisyThreshold() const
Definition CalibTOFapi.h:93
void setURL(const std::string url)
Definition CalibTOFapi.h:62
float getTimeDecalibration(int ich, float tot) const
bool isProblematic(int ich)
float getTimeCalibration(int ich, float tot) const
const std::vector< int > & getTRMmask() const
Definition CalibTOFapi.h:99
void setDiagnostic(Diagnostic *obj)
Definition CalibTOFapi.h:91
Diagnostic class for TOF.
Definition Diagnostic.h:32
@ kNCrate
Definition Geo.h:95
static constexpr int NCHANNELS
Definition Geo.h:124
GLuint GLfloat * val
Definition glcorearb.h:1582
GLenum GLfloat param
Definition glcorearb.h:271
GLint GLuint mask
Definition glcorearb.h:291
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string filename()