Iguana 0.9.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 <string>
6#include <optional>
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 UNDEFINED = 0,
138 BMT = 1,
139 BST = 2,
140 CND = 3,
141 CTOF = 4,
142 CVT = 5,
143 DC = 6,
144 ECAL = 7,
145 FMT = 8,
146 FT = 9,
147 FTCAL = 10,
148 FTHODO = 11,
149 FTOF = 12,
150 FTTRK = 13,
151 HTCC = 15,
152 LTCC = 16,
153 RF = 17,
154 RICH = 18,
155 RTPC = 19,
156 HEL = 20,
157 BAND = 21,
158 RASTER = 22,
159 URWELL = 23,
160 AHDC = 24,
161 ATOF = 25,
162 RECOIL = 26,
163 TARGET = 100,
164 MAGNETS = 101,
165 ECIN = 110,
166 ECOUT = 111,
167 ECTOT = 112,
168 LAC = 113,
169 SC = 114,
170 CC = 115,
171 };
172
175 public:
177 static int const CND_INNER=1;
178 static int const CND_MIDDLE=2;
179 static int const CND_OUTER=3;
180
181 static int const PCAL_U=1;
182 static int const PCAL_V=2;
183 static int const PCAL_W=3;
184 static int const PCAL_Z=9; // layer number used to define the longitudinal coordinate of the cluster
185
186 static int const EC_INNER_U=4;
187 static int const EC_INNER_V=5;
188 static int const EC_INNER_W=6;
189 static int const EC_INNER_Z=9; // layer number used to define the longitudinal coordinate of the cluster
190
191 static int const EC_OUTER_U=7;
192 static int const EC_OUTER_V=8;
193 static int const EC_OUTER_W=9;
194 static int const EC_OUTER_Z=9; // layer number used to define the longitudinal coordinate of the cluster
195
196 static int const PCAL=PCAL_U;
197 static int const EC_INNER=EC_INNER_U;
198 static int const EC_OUTER=EC_OUTER_U;
199
200 static int const FTOF1A=1;
201 static int const FTOF1B=2;
202 static int const FTOF2=3;
203
204 static int const TARGET_CENTER=1;
205 static int const TARGET_DOWNSTREAM=2;
206 static int const TARGET_UPSTREAM=3;
207
208 static int const FTTRK_MODULE1=1;
209 static int const FTTRK_MODULE2=2;
210 static int const FTTRK_LAYER1=1;
211 static int const FTTRK_LAYER2=2;
212 static int const FTTRK_LAYER3=3;
213 static int const FTTRK_LAYER4=4;
214
215 static int const RICH_MAPMT=1;
216 static int const RICH_AEROGEL_B1=2;
217 static int const RICH_AEROGEL_B2=3;
218 static int const RICH_AEROGEL_L1=4;
220 };
221
222}
detector layer IDs; this is a copy of coatjava's DetectorLayer class
Definition TypeDefs.h:174
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
General, top-level namespace for algorithms and infrastructure. For algorithms and bindings,...
Definition Algorithm.h:14
DetectorType
detector IDs; this is a copy of coatjava's DetectorType enum
Definition TypeDefs.h:136
double vector_element_t
Vector element type.
Definition TypeDefs.h:12
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