Iguana LATEST
Implementation Guardian of Analysis Algorithms
Loading...
Searching...
No Matches
TypeDefs.h
Go to the documentation of this file.
1
3#pragma once
4
5#include <optional>
6#include <string>
7#include <unordered_map>
8
9namespace iguana {
10
12 using vector_element_t = double;
13
23
35
37
39 namespace particle {
40 // clang-format off
41
43 enum PDG {
44 electron = 11,
45 positron = -11,
46 photon = 22,
47 proton = 2212,
48 antiproton = -2212,
49 neutron = 2112,
50 antineutron = -2112,
51 pi_plus = 211,
52 pi_minus = -211,
53 kaon_plus = 321,
54 kaon_minus = -321
55 };
56
58 const std::unordered_map<PDG, std::string> name{
59 { electron, "electron" },
60 { positron, "positron" },
61 { photon, "photon" },
62 { proton, "proton" },
63 { antiproton, "antiproton" },
64 { neutron, "neutron" },
65 { antineutron, "antineutron" },
66 { pi_plus, "pi_plus" },
67 { pi_minus, "pi_minus" },
68 { kaon_plus, "kaon_plus" },
69 { kaon_minus, "kaon_minus" }
70 };
71
73 const std::unordered_map<PDG, std::string> title{
74 { electron, "e^{-}" },
75 { positron, "e^{+}" },
76 { photon, "#gamma" },
77 { proton, "p" },
78 { antiproton, "#bar{p}" },
79 { neutron, "n" },
80 { antineutron, "#bar{n}" },
81 { pi_plus, "#pi^{+}" },
82 { pi_minus, "#pi^{-}" },
83 { kaon_plus, "K^{+}" },
84 { kaon_minus, "K^{-}" }
85 };
86
88 const std::unordered_map<PDG, double> mass{
89 { electron, 0.000511 },
90 { positron, 0.000511 },
91 { photon, 0.0 },
92 { proton, 0.938272 },
93 { antiproton, 0.938272 },
94 { neutron, 0.939565 },
95 { antineutron, 0.939565 },
96 { pi_plus, 0.139570 },
97 { pi_minus, 0.139570 },
98 { kaon_plus, 0.493677 },
99 { kaon_minus, 0.493677 }
100 };
101
111 template <typename VALUE_TYPE>
112 std::optional<VALUE_TYPE> const get(std::unordered_map<PDG,VALUE_TYPE> const& property, PDG const& pdg_code)
113 {
114 if(auto const& it = property.find(pdg_code); it != property.end())
115 return it->second;
116 return std::nullopt;
117 }
118
128 template <typename VALUE_TYPE>
129 std::optional<VALUE_TYPE> const get(std::unordered_map<PDG,VALUE_TYPE> const& property, int const& pdg_code)
130 {
131 return get(property, static_cast<particle::PDG>(pdg_code));
132 }
133
134 // clang-format on
135 }
136
138
141 inline bool IsValidSector(int const& sec)
142 {
143 return sec >= 1 && sec <= 6;
144 }
145
148 UNDEFINED = 0,
149 BMT = 1,
150 BST = 2,
151 CND = 3,
152 CTOF = 4,
153 CVT = 5,
154 DC = 6,
155 ECAL = 7,
156 FMT = 8,
157 FT = 9,
158 FTCAL = 10,
159 FTHODO = 11,
160 FTOF = 12,
161 FTTRK = 13,
162 HTCC = 15,
163 LTCC = 16,
164 RF = 17,
165 RICH = 18,
166 RTPC = 19,
167 HEL = 20,
168 BAND = 21,
169 RASTER = 22,
170 URWELL = 23,
171 AHDC = 24,
172 ATOF = 25,
173 RECOIL = 26,
174 TARGET = 100,
175 MAGNETS = 101,
176 };
177
180 {
181 public:
183 static int const CND_INNER = 1;
184 static int const CND_MIDDLE = 2;
185 static int const CND_OUTER = 3;
186
187 static int const PCAL_U = 1;
188 static int const PCAL_V = 2;
189 static int const PCAL_W = 3;
190 static int const PCAL_Z = 9; // layer number used to define the longitudinal coordinate of the cluster
191
192 static int const EC_INNER_U = 4;
193 static int const EC_INNER_V = 5;
194 static int const EC_INNER_W = 6;
195 static int const EC_INNER_Z = 9; // layer number used to define the longitudinal coordinate of the cluster
196
197 static int const EC_OUTER_U = 7;
198 static int const EC_OUTER_V = 8;
199 static int const EC_OUTER_W = 9;
200 static int const EC_OUTER_Z = 9; // layer number used to define the longitudinal coordinate of the cluster
201
202 static int const PCAL = PCAL_U;
203 static int const EC_INNER = EC_INNER_U;
204 static int const EC_OUTER = EC_OUTER_U;
205
206 static int const FTOF1A = 1;
207 static int const FTOF1B = 2;
208 static int const FTOF2 = 3;
209
210 static int const TARGET_CENTER = 1;
211 static int const TARGET_DOWNSTREAM = 2;
212 static int const TARGET_UPSTREAM = 3;
213
214 static int const FTTRK_MODULE1 = 1;
215 static int const FTTRK_MODULE2 = 2;
216 static int const FTTRK_LAYER1 = 1;
217 static int const FTTRK_LAYER2 = 2;
218 static int const FTTRK_LAYER3 = 3;
219 static int const FTTRK_LAYER4 = 4;
220
221 static int const RICH_MAPMT = 1;
222 static int const RICH_AEROGEL_B1 = 2;
223 static int const RICH_AEROGEL_B2 = 3;
224 static int const RICH_AEROGEL_L1 = 4;
226 };
227
229 int const MC_RUN_NUM = 11;
230
231}
DetectorType
detector IDs; this is a copy of coatjava's DetectorType enum
Definition TypeDefs.h:147
double vector_element_t
Vector element type.
Definition TypeDefs.h:12
bool IsValidSector(int const &sec)
Definition TypeDefs.h:141
int const MC_RUN_NUM
MC run number.
Definition TypeDefs.h:229
detector layer IDs; this is a copy of coatjava's DetectorLayer class
Definition TypeDefs.h:180
Light-weight namespace for particle constants.
Definition TypeDefs.h:39
const std::unordered_map< PDG, std::string > name
Particle names.
Definition TypeDefs.h:58
std::optional< VALUE_TYPE > const get(std::unordered_map< PDG, VALUE_TYPE > const &property, PDG const &pdg_code)
get a particle property given a PDG code
Definition TypeDefs.h:112
const std::unordered_map< PDG, double > mass
Particle mass in GeV.
Definition TypeDefs.h:88
PDG
PDG codes.
Definition TypeDefs.h:43
const std::unordered_map< PDG, std::string > title
Particle titles.
Definition TypeDefs.h:73
3-momentum type
Definition TypeDefs.h:15
vector_element_t pz
-component
Definition TypeDefs.h:21
vector_element_t py
-component
Definition TypeDefs.h:19
vector_element_t px
-component
Definition TypeDefs.h:17
4-momentum type
Definition TypeDefs.h:25
vector_element_t px
-component
Definition TypeDefs.h:27
vector_element_t E
-component
Definition TypeDefs.h:33
vector_element_t py
-component
Definition TypeDefs.h:29
vector_element_t pz
-component
Definition TypeDefs.h:31