Project
Loading...
Searching...
No Matches
GRPECSObject.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_DATA_GRPECSOBJECT_H_
17#define ALICEO2_DATA_GRPECSOBJECT_H_
18
19#include <Rtypes.h>
20#include <cstdint>
21#include <ctime>
24
25namespace o2
26{
27namespace parameters
28{
29/*
30 * Collects parameters describing the run that come from ECS only.
31 */
32
34{
36
37 public:
38 using timePoint = uint64_t;
40
41 enum ROMode : int { ABSENT = 0,
42 PRESENT = 0x1,
43 CONTINUOUS = PRESENT + (0x1 << 1),
44 TRIGGERING = PRESENT + (0x1 << 2) };
45 GRPECSObject() = default;
46 ~GRPECSObject() = default;
47
49 timePoint getTimeStart() const { return mTimeStart; }
50 void setTimeStart(timePoint t) { mTimeStart = t; }
51
52 timePoint getTimeEnd() const { return mTimeEnd; }
53 void setTimeEnd(timePoint t) { mTimeEnd = t; }
54
55 timePoint getTimeStartCTPasSet() const { return mTimeStartCTP; }
56 timePoint getTimeStartCTP() const { return mTimeStartCTP ? mTimeStartCTP : mTimeStart; }
57 void setTimeStartCTP(timePoint t) { mTimeStartCTP = t; }
58
59 timePoint getTimeEndCTPasSet() const { return mTimeEndCTP; }
60 timePoint getTimeEndCTP() const { return mTimeEndCTP ? mTimeEndCTP : mTimeEnd; }
61 void setTimeEndCTP(timePoint t) { mTimeEndCTP = t; }
62
63 void setNHBFPerTF(uint32_t n) { mNHBFPerTF = n; }
64 uint32_t getNHBFPerTF() const { return mNHBFPerTF; }
65
67 const std::string& getDataPeriod() const { return mDataPeriod; }
68 void setDataPeriod(const std::string v) { mDataPeriod = v; }
69 // getter/setter for run identifier
70 void setRun(int r) { mRun = r; }
71 int getRun() const { return mRun; }
73 DetID::mask_t getDetsReadOut() const { return mDetsReadout; }
74 void setDetsReadOut(DetID::mask_t mask) { mDetsReadout = mask; }
76 DetID::mask_t getDetsContinuousReadOut() const { return mDetsContinuousRO; }
77 void setDetsContinuousReadOut(DetID::mask_t mask) { mDetsContinuousRO = mask; }
79 DetID::mask_t getDetsTrigger() const { return mDetsTrigger; }
80 void setDetsTrigger(DetID::mask_t mask) { mDetsTrigger = mask; }
82 void addDetReadOut(DetID id) { mDetsReadout |= id.getMask(); }
85 {
86 mDetsReadout &= ~id.getMask();
88 remDetTrigger(id);
89 }
91 void addDetContinuousReadOut(DetID id) { mDetsContinuousRO |= id.getMask(); }
93 void remDetContinuousReadOut(DetID id) { mDetsContinuousRO &= ~id.getMask(); }
95 void addDetTrigger(DetID id) { mDetsTrigger |= id.getMask(); }
97 void remDetTrigger(DetID id) { mDetsTrigger &= ~id.getMask(); }
99 bool isDetReadOut(DetID id) const { return (mDetsReadout & id.getMask()) != 0; }
101 bool isDetContinuousReadOut(DetID id) const { return (mDetsContinuousRO & id.getMask()) != 0; }
103 bool isDetTriggers(DetID id) const { return (mDetsTrigger & id.getMask()) != 0; }
105 void setDetROMode(DetID id, ROMode status);
106 ROMode getDetROMode(DetID id) const;
107
108 void setRunType(RunType t) { mRunType = t; }
109 auto getRunType() const { return mRunType; }
110
111 bool isMC() const { return mIsMC; }
112 void setIsMC(bool v = true) { mIsMC = v; }
113
116 DetID::mask_t getDetsReadOut(DetID::mask_t only, DetID::mask_t skip = 0) const { return only.any() ? (mDetsReadout & only) : (mDetsReadout ^ skip); }
118 DetID::mask_t getDetsReadOut(const std::string& only, const std::string& skip = "") const { return getDetsReadOut(DetID::getMask(only), DetID::getMask(skip)); }
119
120 // methods to manipulate the list of FLPs in the run
121 const std::vector<unsigned short>& getListOfFLPs() const { return mFLPs; }
122 void addFLP(unsigned short flp) { mFLPs.push_back(flp); }
123 void setListOfFLPs(const std::vector<unsigned short>& listFLPs) { mFLPs = listFLPs; }
124 bool getFLPStatus(unsigned short flp) const
125 {
126 return std::find(mFLPs.begin(), mFLPs.end(), flp) == mFLPs.end() ? false : true;
127 }
128 bool listOfFLPsSet() const
129 {
130 return mFLPs.size() > 0 ? true : false;
131 }
132
134 void print() const;
135
136 static GRPECSObject* loadFrom(const std::string& grpecsFileName = "");
137 static constexpr bool alwaysTriggeredRO(DetID::ID det) { return DefTriggeredDets[det]; }
138
139 private:
140 timePoint mTimeStart = 0;
141 timePoint mTimeEnd = 0;
142 timePoint mTimeStartCTP = 0;
143 timePoint mTimeEndCTP = 0;
144
145 uint32_t mNHBFPerTF = 128;
146
147 DetID::mask_t mDetsReadout;
148 DetID::mask_t mDetsContinuousRO;
149 DetID::mask_t mDetsTrigger;
150 bool mIsMC = false;
151 int mRun = 0;
152 RunType mRunType = RunType::NONE;
153 std::string mDataPeriod{};
154 std::vector<unsigned short> mFLPs;
155
156 // detectors which are always readout in triggered mode. Others are continuous by default but exceptionally can be triggered
158
159 ClassDefNV(GRPECSObject, 6);
160};
161
162} // namespace parameters
163} // namespace o2
164
165#endif
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
static constexpr ID PHS
Definition DetID.h:67
static constexpr ID CPV
Definition DetID.h:68
static constexpr ID TRD
Definition DetID.h:65
static constexpr ID EMC
Definition DetID.h:69
static mask_t getMask(const std::string_view detList)
detector masks from any non-alpha-num delimiter-separated list (empty if NONE is supplied)
Definition DetID.cxx:42
static constexpr ID HMP
Definition DetID.h:70
timePoint getTimeStart() const
getters/setters for Start and Stop times according to logbook
static constexpr bool alwaysTriggeredRO(DetID::ID det)
bool isDetTriggers(DetID id) const
test if detector is triggering
void setListOfFLPs(const std::vector< unsigned short > &listFLPs)
void setDetsContinuousReadOut(DetID::mask_t mask)
bool isDetContinuousReadOut(DetID id) const
test if detector is read out
bool getFLPStatus(unsigned short flp) const
timePoint getTimeEndCTP() const
o2::parameters::GRPECS::RunType RunType
const std::string & getDataPeriod() const
getter/setter for data taking period name
timePoint getTimeStartCTP() const
DetID::mask_t getDetsReadOut(DetID::mask_t only, DetID::mask_t skip=0) const
void addDetTrigger(DetID id)
add specific detector to the list of triggering detectors
ROMode getDetROMode(DetID id) const
void addFLP(unsigned short flp)
void setDetsReadOut(DetID::mask_t mask)
DetID::mask_t getDetsContinuousReadOut() const
getter/setter for masks of detectors with continuos readout
const std::vector< unsigned short > & getListOfFLPs() const
void setTimeEnd(timePoint t)
DetID::mask_t getDetsReadOut(const std::string &only, const std::string &skip="") const
same with comma-separate list of detector names
void remDetTrigger(DetID id)
remove specific detector from the list of triggering detectors
void setTimeStart(timePoint t)
void setTimeEndCTP(timePoint t)
void setNHBFPerTF(uint32_t n)
bool isDetReadOut(DetID id) const
test if detector is read out
timePoint getTimeEndCTPasSet() const
void setTimeStartCTP(timePoint t)
void setDetROMode(DetID id, ROMode status)
set detector readout mode status
timePoint getTimeStartCTPasSet() const
DetID::mask_t getDetsReadOut() const
getter/setter for masks of detectors in the readout
void addDetReadOut(DetID id)
add specific detector to the list of readout detectors
timePoint getTimeEnd() const
void addDetContinuousReadOut(DetID id)
add specific detector to the list of continuously readout detectors
void print() const
print itself
uint32_t getNHBFPerTF() const
void setDataPeriod(const std::string v)
void setDetsTrigger(DetID::mask_t mask)
void remDetReadOut(DetID id)
remove specific detector from the list of readout detectors
static GRPECSObject * loadFrom(const std::string &grpecsFileName="")
void remDetContinuousReadOut(DetID id)
remove specific detector from the list of continuouslt readout detectors
DetID::mask_t getDetsTrigger() const
getter/setter for masks of detectors providing the trigger
GLdouble n
Definition glcorearb.h:1982
const GLdouble * v
Definition glcorearb.h:832
GLboolean r
Definition glcorearb.h:1233
GLint GLuint mask
Definition glcorearb.h:291
GLuint id
Definition glcorearb.h:650
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...