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