CbmRoot
CbmDefs.h
Go to the documentation of this file.
1 
8 #ifndef CBMDEFS_H
9 #define CBMDEFS_H 1
10 
11 #include <RtypesCore.h> // for Double_t
12 
13 #include <iostream> // for ostream
14 #include <type_traits> // for underlying_type
15 
16 // Convert an element of enum class to its underlying intergral type
17 // since with C++11 the return type can't be deduced automatically it has
18 // to be put explicitely
19 // constexpr should result in a compile time evaluation of the function
20 // call where possible
21 // E.g. ToIntegralType(ECbmModuleId::KSts) should be evaluated at compile
22 // time and should not affect the run time performance at all
23 template<typename T>
24 constexpr auto ToIntegralType(T enumerator) ->
25  typename std::underlying_type<T>::type {
26  return static_cast<typename std::underlying_type<T>::type>(enumerator);
27 }
28 
33 enum class ECbmModuleId {
34  kRef = 0,
35  kMvd = 1,
36  kSts = 2,
37  kRich = 3,
38  kMuch = 4,
39  kTrd = 5,
40  kTof = 6,
41  kEcal = 7,
42  kPsd = 8,
43  kHodo = 9,
44  kDummyDet = 10,
45  kT0 = 11,
46  kNofSystems = 12,
47  kMagnet = 17,
48  kTarget = 18,
49  kPipe = 19,
50  kShield = 20,
51  kPlatform = 21,
52  kCave = 22,
53  kLastModule = 23,
54  kNotExist = -1
55 };
56 
57 // operator ++ for ECbmModuleId for convenient usage in loops
58 // This operator is tuned for ECbmModuleID. It takes into account non
59 // continuous values for the enum. Since the detectorID which is stored
60 // in the generated output has only 4 bit the maximum number of detectors
61 // can be 16 (0-15). To avoid that the enum class has to be changed again
62 // the values 11-15 are reserved for future detectors.
63 // The ids of the passive modules are only relevant at run time so they can
64 // be shifted easily
65 // The opeartor takes care about the non continuous values for the enum
66 // When it reaches the last detector it automatically continuous with the
67 // first passive module
69 
70 // operator << for convenient output to std::ostream.
71 // Converts the enum value to a string which is put in the stream
72 std::ostream& operator<<(std::ostream&, const ECbmModuleId&);
73 
74 
76 enum class ECbmDataType {
77  kUnknown = -1,
78  kMCTrack = 0,
80  kMvdDigi,
82  kMvdHit, // MVD
84  kStsDigi,
86  kStsHit,
87  kStsTrack, // STS
89  kRichDigi,
90  kRichHit,
91  kRichRing, // RICH
93  kMuchDigi,
97  kMuchTrack, // MUCH
99  kTrdDigi,
100  kTrdCluster,
101  kTrdHit,
102  kTrdTrack, // TRD
104  kTofDigi,
105  kTofCalDigi,
106  kTofHit,
107  kTofTrack, // TOF
109  kPsdDigi,
110  kPsdHit, // PSD
112  kT0Digi,
113  kT0CalDigi,
114  kT0Hit, // T0
115  kGlobalTrack = 2000 // Global
116 };
117 
118 // operator << for convenient output to std::ostream.
119 // Converts the enum value to a string which is put in the stream
120 std::ostream& operator<<(std::ostream&, const ECbmDataType&);
121 
131 
132 
134 inline Double_t CbmProtonMass() { return 0.938272046; }
135 inline Double_t CbmNeutronMass() { return 0.939565379; }
136 inline Double_t CbmElectronMass() { return 0.000510998928; }
137 
138 #endif
ECbmDataType::kMvdCluster
@ kMvdCluster
ECbmDataType::kMvdHit
@ kMvdHit
ECbmDataType::kTrdHit
@ kTrdHit
ECbmDataType::kStsHit
@ kStsHit
ECbmDataType::kT0Hit
@ kT0Hit
ECbmDataType::kRichDigi
@ kRichDigi
ECbmDataType::kStsDigi
@ kStsDigi
ECbmDataType::kMvdDigi
@ kMvdDigi
ECbmModuleId::kMagnet
@ kMagnet
Magnet.
ECbmDataType::kMvdPoint
@ kMvdPoint
ECbmDataType::kMuchPixelHit
@ kMuchPixelHit
ECbmDataType::kT0Point
@ kT0Point
ECbmModuleId::kT0
@ kT0
ToF start Detector.
ECbmDataType::kTofPoint
@ kTofPoint
ECbmDataType::kMuchStrawHit
@ kMuchStrawHit
ECbmDataType::kTofDigi
@ kTofDigi
ECbmDataType::kRichHit
@ kRichHit
ECbmModuleId::kMvd
@ kMvd
Micro-Vertex Detector.
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
ECbmTreeAccess::kRegular
@ kRegular
ECbmDataType::kMCTrack
@ kMCTrack
ECbmDataType::kTofHit
@ kTofHit
ECbmModuleId::kTof
@ kTof
Time-of-flight Detector.
ECbmDataType::kPsdPoint
@ kPsdPoint
ECbmDataType::kRichRing
@ kRichRing
ECbmModuleId::kShield
@ kShield
Beam pipe shielding in MUCH section.
ECbmModuleId::kTarget
@ kTarget
Target.
ECbmDataType::kTofTrack
@ kTofTrack
ECbmDataType::kStsTrack
@ kStsTrack
ECbmTreeAccess
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
Definition: CbmDefs.h:130
ECbmDataType::kT0Digi
@ kT0Digi
ECbmDataType::kTrdCluster
@ kTrdCluster
ECbmDataType::kTrdPoint
@ kTrdPoint
ECbmModuleId::kHodo
@ kHodo
Hodoscope (for test beam times)
ECbmDataType::kPsdDigi
@ kPsdDigi
ECbmDataType
ECbmDataType
Definition: CbmDefs.h:76
ECbmModuleId::kCave
@ kCave
Cave.
CbmNeutronMass
Double_t CbmNeutronMass()
Definition: CbmDefs.h:135
ECbmModuleId::kNofSystems
@ kNofSystems
For loops over active systems.
ECbmModuleId::kRich
@ kRich
Ring-Imaging Cherenkov Detector.
ECbmModuleId::kRef
@ kRef
Reference plane.
operator++
ECbmModuleId & operator++(ECbmModuleId &)
Definition: CbmDefs.cxx:17
ECbmDataType::kMuchTrack
@ kMuchTrack
ECbmDataType::kTrdDigi
@ kTrdDigi
ECbmModuleId::kDummyDet
@ kDummyDet
Dummy for tutorials or tests.
ECbmDataType::kUnknown
@ kUnknown
ECbmModuleId::kPipe
@ kPipe
Beam pipe.
ECbmModuleId::kTrd
@ kTrd
Transition Radiation Detector.
ECbmModuleId::kLastModule
@ kLastModule
For loops over all modules.
ECbmTreeAccess::kRepeat
@ kRepeat
ECbmDataType::kT0CalDigi
@ kT0CalDigi
ECbmDataType::kMuchCluster
@ kMuchCluster
ECbmDataType::kTrdTrack
@ kTrdTrack
ToIntegralType
constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
Definition: CbmDefs.h:24
ECbmDataType::kGlobalTrack
@ kGlobalTrack
ECbmDataType::kMuchPoint
@ kMuchPoint
ECbmModuleId::kMuch
@ kMuch
Muon detection system.
ECbmModuleId::kPsd
@ kPsd
Projectile spectator detector.
ECbmModuleId::kPlatform
@ kPlatform
RICH rail platform.
CbmProtonMass
Double_t CbmProtonMass()
Definition: CbmDefs.h:134
CbmElectronMass
Double_t CbmElectronMass()
Definition: CbmDefs.h:136
ECbmTreeAccess::kRandom
@ kRandom
ECbmModuleId::kNotExist
@ kNotExist
If not found.
ECbmDataType::kTofCalDigi
@ kTofCalDigi
ECbmDataType::kRichPoint
@ kRichPoint
ECbmModuleId::kEcal
@ kEcal
EM-Calorimeter.
ECbmDataType::kPsdHit
@ kPsdHit
ECbmModuleId::kSts
@ kSts
Silicon Tracking System.
ECbmDataType::kMuchDigi
@ kMuchDigi
ECbmDataType::kStsPoint
@ kStsPoint
ECbmDataType::kStsCluster
@ kStsCluster
operator<<
std::ostream & operator<<(std::ostream &, const ECbmModuleId &)
Definition: CbmDefs.cxx:31