Project
Loading...
Searching...
No Matches
Diagnostic.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
14
15#ifndef ALICEO2_TOF_DIAGNOSTIC_H
16#define ALICEO2_TOF_DIAGNOSTIC_H
17
18#include <map>
19#include <TObject.h>
20#include <gsl/gsl>
22
23namespace o2
24{
25namespace tof
26{
30
32{
33 public:
34 Diagnostic() = default;
35 uint32_t fill(ULong64_t pattern);
36 uint32_t fill(ULong64_t pattern, uint32_t frequency);
37 uint32_t getFrequency(ULong64_t pattern) const; // Get frequency
38 uint32_t getFrequencyROW() const { return getFrequency(0); } // Readout window frequency
39 uint32_t getFrequencyEmptyCrate(int crate) const { return getFrequency(getEmptyCrateKey(crate)); } // empty crate frequency
40 uint32_t getFrequencyEmptyTOF() const { return getFrequency(1); } // empty crate frequency
41 uint32_t fillNoisy(int channel, int frequency = 1) { return fill(getNoisyChannelKey(channel), frequency); }
42 uint32_t fillROW() { return fill(0); }
43 uint32_t fillEmptyCrate(int crate, uint32_t frequency = 1) { return fill(getEmptyCrateKey(crate), frequency); }
44 uint32_t fillEmptyTOF(uint32_t frequency = 1) { return fill(1, frequency); }
45 static ULong64_t getEmptyCrateKey(int crate);
46 static ULong64_t getNoisyChannelKey(int channel);
47 static ULong64_t getTRMKey(int crate, int trm);
48 void print(bool longFormat = false) const;
49 void clear() { mVector.clear(); }
50 void fill(const Diagnostic& diag); // for calibration
51 void fill(const gsl::span<const o2::tof::Diagnostic>){}; // for calibration
52 void merge(const Diagnostic* prev);
53 void getNoisyMap(Bool_t* output, int noisyThr = 1) const; // set true in output channel array
54 void getNoisyLevelMap(Char_t* output) const; // set true in output channel array
55 bool isNoisyChannel(int channel, int thr = 0) const;
56 unsigned long size() const { return mVector.size(); }
57 ULong64_t getPattern(int i) const
58 {
59 auto iter = mVector.begin();
60 for (; i-- > 0;) {
61 iter++;
62 }
63 return iter->first;
64 }
65 static int getSlot(ULong64_t pattern) { return (pattern & 68719476735) / 4294967296; }
66 static int getCrate(ULong64_t pattern) { return (pattern & 8796093022207) / 68719476736; }
67 static int getChannel(ULong64_t pattern)
68 {
69 if (getSlot(pattern) == 14) {
70 return (pattern & 262143);
71 }
72 return -1;
73 }
74 static int getNoisyLevel(ULong64_t pattern)
75 {
76 if (getChannel(pattern)) {
77 if (pattern & (1 << 20)) {
78 return 3;
79 } else if (pattern & (1 << 19)) {
80 return 2;
81 } else {
82 return 1;
83 }
84 }
85 return 0;
86 }
87
88 const std::map<ULong64_t, uint32_t>& getVector() const { return mVector; }
89
90 int getTimeStamp() const { return mTimestamp; }
91 void setTimeStamp(int val) { mTimestamp = val; }
92
93 void setTFIDInfo(const o2::dataformats::TFIDInfo& val) { mTFinfo = val; }
94 const o2::dataformats::TFIDInfo& getTFIDInfo() const { return mTFinfo; }
95
96 private:
97 std::map<ULong64_t, uint32_t> mVector; // diagnostic frequency vector (key/pattern , frequency)
98 int mTimestamp = 0;
99 o2::dataformats::TFIDInfo mTFinfo; // TF id info
100
101 ClassDefNV(Diagnostic, 3);
102};
103
104} // namespace tof
105} // namespace o2
106#endif
void print() const
int32_t i
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
Diagnostic class for TOF.
Definition Diagnostic.h:32
uint32_t getFrequencyROW() const
Definition Diagnostic.h:38
void setTFIDInfo(const o2::dataformats::TFIDInfo &val)
Definition Diagnostic.h:93
const o2::dataformats::TFIDInfo & getTFIDInfo() const
Definition Diagnostic.h:94
uint32_t fillEmptyCrate(int crate, uint32_t frequency=1)
Definition Diagnostic.h:43
int getTimeStamp() const
Definition Diagnostic.h:90
uint32_t fillEmptyTOF(uint32_t frequency=1)
Definition Diagnostic.h:44
uint32_t getFrequencyEmptyCrate(int crate) const
Definition Diagnostic.h:39
void merge(const Diagnostic *prev)
void fill(const gsl::span< const o2::tof::Diagnostic >)
Definition Diagnostic.h:51
static int getCrate(ULong64_t pattern)
Definition Diagnostic.h:66
static ULong64_t getTRMKey(int crate, int trm)
uint32_t fillROW()
Definition Diagnostic.h:42
void getNoisyMap(Bool_t *output, int noisyThr=1) const
uint32_t fill(ULong64_t pattern)
unsigned long size() const
Definition Diagnostic.h:56
static int getChannel(ULong64_t pattern)
Definition Diagnostic.h:67
uint32_t getFrequency(ULong64_t pattern) const
void getNoisyLevelMap(Char_t *output) const
static int getNoisyLevel(ULong64_t pattern)
Definition Diagnostic.h:74
void setTimeStamp(int val)
Definition Diagnostic.h:91
ULong64_t getPattern(int i) const
Definition Diagnostic.h:57
uint32_t fillNoisy(int channel, int frequency=1)
Definition Diagnostic.h:41
uint32_t getFrequencyEmptyTOF() const
Definition Diagnostic.h:40
static ULong64_t getNoisyChannelKey(int channel)
static ULong64_t getEmptyCrateKey(int crate)
const std::map< ULong64_t, uint32_t > & getVector() const
Definition Diagnostic.h:88
bool isNoisyChannel(int channel, int thr=0) const
static int getSlot(ULong64_t pattern)
Definition Diagnostic.h:65
GLuint GLfloat * val
Definition glcorearb.h:1582
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::array< uint16_t, 5 > pattern