Project
Loading...
Searching...
No Matches
Configuration.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 _CTP_CONFIGURATION_H_
17#define _CTP_CONFIGURATION_H_
21#include <string>
22#include <vector>
23#include <bitset>
24#include <map>
25#include <set>
26#include <iosfwd>
27namespace o2
28{
29namespace ctp
30{
32const std::string CCDBPathCTPConfig = "CTP/Config/Config";
36// Bunch Crossing (BC) mask
37struct BCMask {
38 BCMask() = default;
39 std::string name = "";
40 std::string mask = "";
41 std::bitset<o2::constants::lhc::LHCMaxBunches> BCmask;
42 int setBCmask(std::vector<std::string>& tokens);
43 void printStream(std::ostream& stream) const;
45};
48 static const std::set<std::string> Generators;
49 std::string name = "";
50 std::string frequency = "";
51 void printStream(std::ostream& stream) const;
53};
56struct CTPInput {
57 const static std::map<std::string, std::string> run2DetToRun3Det;
58 CTPInput() = default;
59 CTPInput(std::string& name, std::string& det, uint32_t index);
60 CTPInput(const char* name, const char* det, uint32_t index);
61 std::string name = "";
62 std::string level = "";
63 std::uint64_t inputMask = 0;
65 bool neg = 1;
66 uint32_t getIndex() const { return ((inputMask > 0) ? 1 + log2(inputMask) : 0xff); }
67 std::string getInputDetName() const { return o2::detectors::DetID::getName(detID); }
68 void setRun3DetName(std::string& run2Name);
69 void printStream(std::ostream& strem) const;
71};
74 CTPDescriptor() = default;
75 std::string name = "";
76 std::vector<CTPInput const*> inputs;
77 std::uint64_t getInputsMask() const;
78 // void createInputsFromName();
79 void printStream(std::ostream& strem) const;
80 ClassDefNV(CTPDescriptor, 2)
81};
84 CTPDetector() = default;
87 const char* getName() const { return o2::detectors::DetID::getName(detID); }
89 std::string mode = "";
91 void printStream(std::ostream& stream) const;
92 ClassDefNV(CTPDetector, 1)
93};
95struct CTPCluster {
96 CTPCluster() = default;
97 std::string name = "";
101 void printStream(std::ostream& strem) const;
102 ClassDefNV(CTPCluster, 3)
103};
105struct CTPClass {
106 CTPClass() = default;
107 std::string name = "";
108 std::uint64_t classMask = 0;
109 CTPDescriptor const* descriptor = nullptr;
110 CTPCluster const* cluster = nullptr;
111 int clusterIndex = 0xff;
112 int descriptorIndex = 0xff;
114 std::vector<BCMask const*> BCClassMask;
115 int getIndex() const { return ((classMask > 0) ? log2(classMask) : 0xff); }
116 void printStream(std::ostream& strem) const;
118};
121 std::vector<CTPInput> CTPInputs;
122 static const std::vector<CTPInput> CTPInputsDefault;
123 int createInputsConfigFromFile(std::string& filename);
124 void printStream(std::ostream& strem) const;
126 static void initDefaultInputConfig();
127 static std::string getInputNameFromIndex100(uint32_t index);
128 static std::string getInputNameFromIndex(uint32_t index);
129 static int getInputIndexFromName(std::string& name);
131};
133{
134 public:
135 // static CTPInputsConfiguration mCTPInputsConfiguration;
136 const static std::map<std::string, std::string> detName2LTG;
137 CTPConfiguration() = default;
138 bool isDetector(const o2::detectors::DetID& det);
139 static void capitaliseString(std::string& str);
140 static bool isNumber(const std::string& s);
141 int addInput(std::string& inp, int clsindex, std::map<int, std::vector<int>>& descInputsIndex);
154 int loadConfigurationRun3(const std::string& ctpconfiguartion);
155 void printStream(std::ostream& stream) const;
156 void setRunNumber(uint32_t runnumber) { mRunNumber = runnumber; }
157 std::vector<CTPInput>& getCTPInputs() { return mInputs; }
158 std::vector<CTPClass>& getCTPClasses() { return mCTPClasses; }
159 const std::vector<CTPInput>& getCTPInputs() const { return mInputs; } // Read-only interface
160 const std::vector<CTPClass>& getCTPClasses() const { return mCTPClasses; } // Read-only interface
161 uint64_t getInputMask(const std::string& name) const;
162 int getInputIndex(const std::string& name) const;
163 std::string getClassNameFromIndex(int index);
164 std::string getClassNameFromHWIndex(int index);
165 const CTPClass* getCTPClassFromHWIndex(const int index) const;
166 bool isMaskInInputs(const uint64_t& mask) const;
167 bool isBCMaskInConfig(const std::string maskname) const;
168 const BCMask* isBCMaskInConfigP(const std::string bcmask) const;
169 const CTPInput* isInputInConfig(const std::string inpname) const;
170 const CTPInput* isInputInConfig(const uint32_t index) const;
171 const CTPDescriptor* isDescriptorInConfig(const std::string descname, int& index) const;
173 uint64_t getDecrtiptorInputsMask(const std::string& name) const;
174 std::map<o2::detectors::DetID::ID, std::vector<CTPInput>> getDet2InputMap();
178 std::vector<int> getTriggerClassList() const;
179 uint32_t getRunNumber() { return mRunNumber; };
180 std::vector<std::string> getDetectorList() const;
183 void printConfigString();
184 std::string getConfigString() { return mConfigString; };
185 CTPDescriptor* getDescriptor(int index) { return &mDescriptors[index]; };
186 int assignDescriptors();
187 int checkConfigConsistency() const;
188
189 private:
190 std::string mConfigString = "";
191 uint32_t mRunNumber = 0;
192 std::string mName = "";
193 std::string mVersion = "0";
194 std::vector<BCMask> mBCMasks;
195 std::vector<CTPGenerator> mGenerators;
196 std::vector<CTPInput> mInputs;
197 std::vector<CTPDescriptor> mDescriptors;
198 std::vector<CTPDetector> mDetectors;
199 std::vector<CTPCluster> mClusters;
200 std::vector<CTPClass> mCTPClasses;
201 int processConfigurationLineRun3(std::string& line, int& level, std::map<int, std::vector<int>>& descInputsIndex);
202 int processConfigurationLineRun3v2(std::string& line, int& level, std::map<int, std::vector<int>>& descInputsIndex);
203 ClassDefNV(CTPConfiguration, 6);
204};
205
206std::ostream& operator<<(std::ostream& in, const CTPConfiguration& conf);
207
208struct CtpCfg {
209 CtpCfg() = default;
210 std::string filename = "ctp.cfg";
211 int readAndSave(std::string& path);
213 int ccdb = -1; // -1 means def constructor was called
217 std::vector<int> listOfUsedInputs();
218 ClassDefNV(CtpCfg, 2)
219};
220} // namespace ctp
221} // namespace o2
222#endif //_CTP_CONFIGURATION_H_
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
Header to collect LHC related constants.
definition of CTPScalerRaw, CTPScalerO2
std::vector< CTPClass > & getCTPClasses()
std::vector< std::string > getDetectorList() const
std::vector< int > getTriggerClassList() const
static bool isNumber(const std::string &s)
uint64_t getInputMask(const std::string &name) const
uint64_t getTriggerClassMaskWInputsNoTrgDets() const
uint64_t getTriggerClassMask() const
std::string getClassNameFromIndex(int index)
const std::vector< CTPClass > & getCTPClasses() const
const CTPInput * isInputInConfig(const std::string inpname) const
std::string getClassNameFromHWIndex(int index)
std::vector< CTPInput > & getCTPInputs()
const BCMask * isBCMaskInConfigP(const std::string bcmask) const
bool isBCMaskInConfig(const std::string maskname) const
const std::vector< CTPInput > & getCTPInputs() const
int addInput(std::string &inp, int clsindex, std::map< int, std::vector< int > > &descInputsIndex)
int getInputIndex(const std::string &name) const
o2::detectors::DetID::mask_t getDetectorMask() const
static void capitaliseString(std::string &str)
uint64_t getClassMaskForInputMask(uint64_t inputMask) const
const CTPDescriptor * isDescriptorInConfig(const std::string descname, int &index) const
void printStream(std::ostream &stream) const
CTPDescriptor * getDescriptor(int index)
int loadConfigurationRun3(const std::string &ctpconfiguartion)
const CTPClass * getCTPClassFromHWIndex(const int index) const
uint64_t getTriggerClassMaskWInputs() const
std::map< o2::detectors::DetID::ID, std::vector< CTPInput > > getDet2InputMap()
bool isMaskInInputs(const uint64_t &mask) const
uint64_t getDecrtiptorInputsMask(const std::string &name) const
bool isDetector(const o2::detectors::DetID &det)
void setRunNumber(uint32_t runnumber)
static const std::map< std::string, std::string > detName2LTG
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:60
static constexpr const char * getName(ID id)
names of defined detectors
Definition DetID.h:148
static std::string getNames(mask_t mask, char delimiter=',')
Definition DetID.cxx:75
int ID
Detector identifiers: continuous, starting from 0.
Definition DetID.h:63
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:43
GLuint index
Definition glcorearb.h:781
GLuint const GLchar * name
Definition glcorearb.h:781
GLsizei const GLchar *const * path
Definition glcorearb.h:3591
GLint level
Definition glcorearb.h:275
GLuint GLuint stream
Definition glcorearb.h:1806
GLint GLuint mask
Definition glcorearb.h:291
std::ostream & operator<<(std::ostream &in, const CTPConfiguration &conf)
const std::string CCDBPathCTPConfig
Database constants.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string filename()
BCMask()=default
std::bitset< o2::constants::lhc::LHCMaxBunches > BCmask
ClassDefNV(BCMask, 1)
int setBCmask(std::vector< std::string > &tokens)
void printStream(std::ostream &stream) const
Class = Mask+Descriptor+Cluster.
ClassDefNV(CTPClass, 4)
std::vector< BCMask const * > BCClassMask
void printStream(std::ostream &strem) const
int getIndex() const
std::uint64_t classMask
CTPCluster const * cluster
CTPClass()=default
CTPDescriptor const * descriptor
List of detectors.
o2::detectors::DetID::mask_t maskCluster
std::string getClusterDetNames() const
void printStream(std::ostream &strem) const
Descriptor = Generator or List of [negated] inputs.
std::vector< CTPInput const * > inputs
std::uint64_t getInputsMask() const
void printStream(std::ostream &strem) const
The main part is Local Trigger Generator (LTG)
o2::detectors::DetID::mask_t getMask() const
void printStream(std::ostream &stream) const
const char * getName() const
o2::detectors::DetID::ID detID
CTP internal generator: 4 for L0 and 4 for LM levels.
ClassDefNV(CTPGenerator, 1)
void printStream(std::ostream &stream) const
static const std::set< std::string > Generators
uint32_t getIndex() const
CTPInput()=default
o2::detectors::DetID::ID detID
ClassDefNV(CTPInput, 3)
void printStream(std::ostream &strem) const
void setRun3DetName(std::string &run2Name)
static const std::map< std::string, std::string > run2DetToRun3Det
std::uint64_t inputMask
std::string getInputDetName() const
static CTPInputsConfiguration defaultInputConfig
std::vector< CTPInput > CTPInputs
int createInputsConfigFromFile(std::string &filename)
void printStream(std::ostream &strem) const
static std::string getInputNameFromIndex(uint32_t index)
static int getInputIndexFromName(std::string &name)
static const std::vector< CTPInput > CTPInputsDefault
ClassDefNV(CTPInputsConfiguration, 0)
static std::string getInputNameFromIndex100(uint32_t index)
uint32_t irInputs_25_48
uint32_t irInputs_1_24
CtpCfg()=default
std::vector< int > listOfUsedInputs()
int readAndSave(std::string &path)
std::string filename
const std::string str