CbmRoot
Loading...
Searching...
No Matches
CbmDefs.h
Go to the documentation of this file.
1/* Copyright (C) 2017-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig, Volker Friese [committer], Semen Lebedev */
4
12#ifndef CBMDEFS_H
13#define CBMDEFS_H 1
14
15#include <iosfwd> // for ostream
16#include <string>
17#include <type_traits> // for underlying_type
18
19#include <xpu/defines.h> // for XPU_D
20
21// Convert an element of enum class to its underlying intergral type
22// since with C++11 the return type can't be deduced automatically it has
23// to be put explicitely
24// constexpr should result in a compile time evaluation of the function
25// call where possible
26// E.g. ToIntegralType(ECbmModuleId::KSts) should be evaluated at compile
27// time and should not affect the run time performance at all
28template<typename T>
29XPU_D constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type<T>::type
30{
31 return static_cast<typename std::underlying_type<T>::type>(enumerator);
32}
33
38enum class ECbmModuleId
39{
40 kRef = 0,
41 kMvd = 1,
42 kSts = 2,
43 kRich = 3,
44 kMuch = 4,
45 kTrd = 5,
46 kTof = 6,
47 kEcal = 7,
48 kPsd = 8,
49 kHodo = 9,
50 kDummyDet = 10,
51 kBmon = 11, //< Bmon Counter
52 kTrd2d = 12,
53 kFsd = 13,
54 kNofSystems = 14,
55 kMagnet = 17,
56 kTarget = 18,
57 kPipe = 19,
58 kShield = 20,
59 // kBmon = 21, ///< Bmon counter, hallo detector BMON
60 kPlatform = 21,
61 kCave = 22,
62 kLastModule = 23,
63 kNotExist = -1
64};
65
66// operator ++ for ECbmModuleId for convenient usage in loops
67// This operator is tuned for ECbmModuleID. It takes into account non
68// continuous values for the enum. Since the detectorID which is stored
69// in the generated output has only 4 bit the maximum number of detectors
70// can be 16 (0-15). To avoid that the enum class has to be changed again
71// the values 11-15 are reserved for future detectors.
72// The ids of the passive modules are only relevant at run time so they can
73// be shifted easily
74// The opeartor takes care about the non continuous values for the enum
75// When it reaches the last detector it automatically continuous with the
76// first passive module
78
79// operator << for convenient output to std::ostream.
80// Converts the enum value to a string which is put in the stream
81std::ostream& operator<<(std::ostream&, const ECbmModuleId&);
82
83// conversion functions between ECbmModuleId and std::string
84std::string ToString(ECbmModuleId modId);
85ECbmModuleId ToCbmModuleId(std::string modIdStr);
86ECbmModuleId ToCbmModuleIdCaseInsensitive(std::string modIdStr);
87
138
139// operator << for convenient output to std::ostream.
140// Converts the enum value to a string which is put in the stream
141std::ostream& operator<<(std::ostream&, const ECbmDataType&);
142
152{
153 kRegular,
154 kRepeat,
155 kRandom
156};
157
161enum class ECbmRecoMode
162{
163 Timeslice,
166};
167
170namespace cbm::algo::ca
171{
175 enum class EDetectorID
176 {
177 kMvd = 0,
178 kSts,
179 kMuch,
180 kTrd,
181 kTof,
182 END
183 };
184
188
192
193} // namespace cbm::algo::ca
194
195
197inline double CbmProtonMass() { return 0.938272046; }
198inline double CbmNeutronMass() { return 0.939565379; }
199inline double CbmElectronMass() { return 0.000510998928; }
200
201#endif
ECbmModuleId & operator++(ECbmModuleId &)
Definition CbmDefs.cxx:24
ECbmRecoMode
Reconstruct the full time slice or event-by-event.
Definition CbmDefs.h:162
XPU_D constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
Definition CbmDefs.h:29
double CbmProtonMass()
Definition CbmDefs.h:197
double CbmNeutronMass()
Definition CbmDefs.h:198
std::string ToString(ECbmModuleId modId)
Definition CbmDefs.cxx:70
ECbmModuleId ToCbmModuleIdCaseInsensitive(std::string modIdStr)
Definition CbmDefs.cxx:86
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
Definition CbmDefs.h:152
ECbmDataType
Definition CbmDefs.h:90
ECbmModuleId
Definition CbmDefs.h:39
@ kMvd
Micro-Vertex Detector.
@ kPipe
Beam pipe.
@ kHodo
Hodoscope (for test beam times)
@ kEcal
EM-Calorimeter.
@ kTrd
Transition Radiation Detector.
@ kShield
Beam pipe shielding in MUCH section.
@ kMagnet
Magnet.
@ kTof
Time-of-flight Detector.
@ kNotExist
If not found.
@ kTarget
Target.
@ kPsd
Projectile spectator detector.
@ kSts
Silicon Tracking System.
@ kTrd2d
TRD-FASP Detector (FIXME)
@ kDummyDet
Dummy for tutorials or tests.
@ kLastModule
For loops over all modules.
@ kPlatform
RICH rail platform.
@ kRef
Reference plane.
@ kMuch
Muon detection system.
@ kFsd
Forward spectator detector.
@ kNofSystems
For loops over active systems.
@ kRich
Ring-Imaging Cherenkov Detector.
ECbmModuleId ToCbmModuleId(std::string modIdStr)
Definition CbmDefs.cxx:78
std::ostream & operator<<(std::ostream &, const ECbmModuleId &)
Definition CbmDefs.cxx:38
double CbmElectronMass()
Definition CbmDefs.h:199
TODO: SZh 8.11.2022: add selection of parameterisation.
Definition CaBranch.h:14
EDetectorID ToCaDetectorID(ECbmModuleId modId)
Conversion map from EDetectorID to ECbmModuleId.
Definition CbmDefs.cxx:120
EDetectorID
Enumeration for the tracking detector subsystems in CBM-CA.
Definition CbmDefs.h:176
ECbmModuleId ToCbmModuleId(EDetectorID detID)
Conversion map from EDetectorID to ECbmModuleId.
Definition CbmDefs.cxx:108