forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimTraits.h
More file actions
265 lines (249 loc) · 6.43 KB
/
SimTraits.h
File metadata and controls
265 lines (249 loc) · 6.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// @brief global simulation properties per detectors ID
///
/// Specifying branch names, hit types, and other properties
/// per DetID. Allows to write generic code that works for data manipulation
/// across detectors.
///
/// @author Sandro Wenzel, sandro.wenzel@cern.ch
#ifndef O2_BASE_SIMTRAITS_
#define O2_BASE_SIMTRAITS_
#include "DetectorsCommonDataFormats/DetID.h"
namespace o2
{
namespace detectors
{
/// Static class standardizing names / branches / other properties for simulation properties
class SimTraits
{
using VS = std::vector<std::string>;
public:
// initialization fragile since depends on correct order. Can we do better?
// clang-format off
static inline const std::array<std::vector<std::string>, DetID::nDetectors> DETECTORBRANCHNAMES =
{ /*ITS*/ VS{ "ITSHit" },
/*TPC*/ VS{ "TPCHitsShiftedSector0",
"TPCHitsShiftedSector1",
"TPCHitsShiftedSector2",
"TPCHitsShiftedSector3",
"TPCHitsShiftedSector4",
"TPCHitsShiftedSector5",
"TPCHitsShiftedSector6",
"TPCHitsShiftedSector7",
"TPCHitsShiftedSector8",
"TPCHitsShiftedSector9",
"TPCHitsShiftedSector10",
"TPCHitsShiftedSector11",
"TPCHitsShiftedSector12",
"TPCHitsShiftedSector13",
"TPCHitsShiftedSector14",
"TPCHitsShiftedSector15",
"TPCHitsShiftedSector16",
"TPCHitsShiftedSector17",
"TPCHitsShiftedSector18",
"TPCHitsShiftedSector19",
"TPCHitsShiftedSector20",
"TPCHitsShiftedSector21",
"TPCHitsShiftedSector22",
"TPCHitsShiftedSector23",
"TPCHitsShiftedSector24",
"TPCHitsShiftedSector25",
"TPCHitsShiftedSector26",
"TPCHitsShiftedSector27",
"TPCHitsShiftedSector28",
"TPCHitsShiftedSector29",
"TPCHitsShiftedSector30",
"TPCHitsShiftedSector31",
"TPCHitsShiftedSector32",
"TPCHitsShiftedSector33",
"TPCHitsShiftedSector34",
"TPCHitsShiftedSector35"},
/*TRD*/ VS{ "TRDHit" },
/*TOF*/ VS{ "TOFHit" },
/*PHS*/ VS{ "PHSHit" },
/*CPV*/ VS{ "CPVHit" },
/*EMC*/ VS{ "EMCHit" },
/*HMP*/ VS{ "HMPHit" },
/*MFT*/ VS{ "MFTHit" },
/*MCH*/ VS{ "MCHHit" },
/*MID*/ VS{ "MIDHit" },
/*ZDC*/ VS{ "ZDCHit" },
/*FT0*/ VS{ "FT0Hit" },
/*FV0*/ VS{ "FV0Hit" },
/*FDD*/ VS{ "FDDHit" },
/*TST*/ VS{ "TSTHit" }, // former ACO
/*CTP*/ VS{ "CTPHit" },
/*FOC*/ VS{ "FOCHit" }
#ifdef ENABLE_UPGRADES
,
/*IT3*/ VS{ "IT3Hit" },
/*TRK*/ VS{ "TRKHit" },
/*FT3*/ VS{ "FT3Hit" },
/*FCT*/ VS{ "FCTHit" },
/*TF3*/ VS{ "TF3Hit" },
/*RCH*/ VS{ "RCHHit" },
/*MI3*/ VS{ "MI3Hit" },
/*ECL*/ VS{ "ECLHit" },
/*FD */ VS{ "FDHit" }
#endif
};
// clang-format on
// branches that are related to kinematics and general event information
static inline const std::vector<std::string> KINEMATICSBRANCHES =
{"MCTrack", "MCEventHeader", "TrackRefs"};
ClassDefNV(SimTraits, 1);
};
} // namespace detectors
// some forward declarations
// forward declares the HitTypes
namespace trd
{
class Hit;
}
namespace itsmft
{
class Hit;
}
namespace tof
{
class HitType;
}
namespace emcal
{
class Hit;
}
namespace phos
{
class Hit;
}
namespace ft0
{
class HitType;
}
namespace hmpid
{
class HitType;
}
namespace fdd
{
class Hit;
}
namespace fv0
{
class Hit;
}
namespace mch
{
class Hit;
}
namespace mid
{
class Hit;
}
namespace zdc
{
class Hit;
}
namespace tpc
{
class HitGroup;
}
namespace focal
{
class Hit;
}
namespace detectors
{
// mapping the DetID to hit types
// traits for detectors
template <int N>
struct DetIDToHitTypes {
using HitType = void;
};
// specialize for detectors
template <>
struct DetIDToHitTypes<o2::detectors::DetID::TRD> {
using HitType = o2::trd::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::ITS> {
using HitType = o2::itsmft::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::MFT> {
using HitType = o2::itsmft::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::TOF> {
using HitType = o2::tof::HitType;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::EMC> {
using HitType = o2::emcal::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::PHS> {
using HitType = o2::phos::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::FT0> {
using HitType = o2::ft0::HitType;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::FV0> {
using HitType = o2::fv0::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::MCH> {
using HitType = o2::mch::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::MID> {
using HitType = o2::mid::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::ZDC> {
using HitType = o2::zdc::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::HMP> {
using HitType = o2::hmpid::HitType;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::TPC> {
using HitType = o2::tpc::HitGroup;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::FOC> {
using HitType = o2::focal::Hit;
};
#ifdef ENABLE_UPGRADES
template <>
struct DetIDToHitTypes<o2::detectors::DetID::IT3> {
using HitType = o2::itsmft::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::TRK> {
using HitType = o2::itsmft::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::FT3> {
using HitType = o2::itsmft::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::FCT> {
using HitType = o2::itsmft::Hit;
};
#endif
} // namespace detectors
} // namespace o2
#endif