3 #ifndef DD4POD_Geant4ParticleCollection_H
4 #define DD4POD_Geant4ParticleCollection_H
12 #include "podio/ICollectionProvider.h"
13 #include "podio/CollectionBase.h"
14 #include "podio/CollectionIDTable.h"
34 return m_index != x.m_index;
60 void clear() override final;
70 template<
typename... Args>
74 size_t size() const override final;
77 std::
string getValueTypeName()
const override {
return std::string(
"dd4pod::Geant4Particle"); }
94 void setBuffer(
void* address) override final;
95 bool setReferences(const podio::ICollectionProvider* collectionProvider) override final;
99 podio::VectorMembersInfo*
vectorMembers()
override {
return &m_vecmem_info; }
103 std::for_each(m_entries.begin(),m_entries.end(),
108 unsigned getID() const override final {
109 return m_collectionID;
128 std::vector<Geant4ParticleData>*
_getBuffer() {
return m_data; }
130 template<
size_t arraysize>
131 const std::array<int, arraysize> ID()
const;
132 template<
size_t arraysize>
133 const std::array<int, arraysize> g4Parent()
const;
134 template<
size_t arraysize>
135 const std::array<int, arraysize> reason()
const;
136 template<
size_t arraysize>
137 const std::array<int, arraysize> mask()
const;
138 template<
size_t arraysize>
139 const std::array<int, arraysize> steps()
const;
140 template<
size_t arraysize>
141 const std::array<int, arraysize> secondaries()
const;
142 template<
size_t arraysize>
143 const std::array<int, arraysize> pdgID()
const;
144 template<
size_t arraysize>
145 const std::array<int, arraysize> status()
const;
146 template<
size_t arraysize>
147 const std::array<std::array<int, 2>, arraysize> colorFlow()
const;
148 template<
size_t arraysize>
149 const std::array<int, arraysize> genStatus()
const;
150 template<
size_t arraysize>
151 const std::array<int, arraysize> charge()
const;
152 template<
size_t arraysize>
153 const std::array<std::array<int, 1>, arraysize> spare()
const;
154 template<
size_t arraysize>
155 const std::array<std::array<float, 3>, arraysize> spin()
const;
156 template<
size_t arraysize>
157 const std::array<double, arraysize> vsx()
const;
158 template<
size_t arraysize>
159 const std::array<double, arraysize> vsy()
const;
160 template<
size_t arraysize>
161 const std::array<double, arraysize> vsz()
const;
162 template<
size_t arraysize>
163 const std::array<double, arraysize> vex()
const;
164 template<
size_t arraysize>
165 const std::array<double, arraysize> vey()
const;
166 template<
size_t arraysize>
167 const std::array<double, arraysize> vez()
const;
168 template<
size_t arraysize>
169 const std::array<double, arraysize> psx()
const;
170 template<
size_t arraysize>
171 const std::array<double, arraysize> psy()
const;
172 template<
size_t arraysize>
173 const std::array<double, arraysize> psz()
const;
174 template<
size_t arraysize>
175 const std::array<double, arraysize> pex()
const;
176 template<
size_t arraysize>
177 const std::array<double, arraysize> pey()
const;
178 template<
size_t arraysize>
179 const std::array<double, arraysize> pez()
const;
180 template<
size_t arraysize>
181 const std::array<double, arraysize> mass()
const;
182 template<
size_t arraysize>
183 const std::array<double, arraysize> time()
const;
184 template<
size_t arraysize>
185 const std::array<double, arraysize> properTime()
const;
189 bool m_isReadFromFile{
false};
196 std::vector<int>* m_vec_parents;
197 std::vector<std::vector<int>*> m_vecs_parents;
198 std::vector<int>* m_vec_daughters;
199 std::vector<std::vector<int>*> m_vecs_daughters;
201 podio::CollRefCollection m_refCollections;
202 podio::VectorMembersInfo m_vecmem_info;
206 std::ostream&
operator<<(std::ostream& o,
const Geant4ParticleCollection& v);
208 template<
typename... Args>
210 const int size = m_entries.size();
212 m_entries.push_back(obj);
216 template<
size_t arraysize>
217 const std::array<int, arraysize> Geant4ParticleCollection::ID()
const {
218 std::array<int, arraysize> tmp;
219 const auto valid_size = std::min(arraysize, m_entries.size());
220 for (
unsigned i = 0; i < valid_size; ++i) {
221 tmp[i] = m_entries[i]->data.ID;
226 template<
size_t arraysize>
227 const std::array<int, arraysize> Geant4ParticleCollection::g4Parent()
const {
228 std::array<int, arraysize> tmp;
229 const auto valid_size = std::min(arraysize, m_entries.size());
230 for (
unsigned i = 0; i < valid_size; ++i) {
231 tmp[i] = m_entries[i]->data.g4Parent;
236 template<
size_t arraysize>
237 const std::array<int, arraysize> Geant4ParticleCollection::reason()
const {
238 std::array<int, arraysize> tmp;
239 const auto valid_size = std::min(arraysize, m_entries.size());
240 for (
unsigned i = 0; i < valid_size; ++i) {
241 tmp[i] = m_entries[i]->data.reason;
246 template<
size_t arraysize>
247 const std::array<int, arraysize> Geant4ParticleCollection::mask()
const {
248 std::array<int, arraysize> tmp;
249 const auto valid_size = std::min(arraysize, m_entries.size());
250 for (
unsigned i = 0; i < valid_size; ++i) {
251 tmp[i] = m_entries[i]->data.mask;
256 template<
size_t arraysize>
257 const std::array<int, arraysize> Geant4ParticleCollection::steps()
const {
258 std::array<int, arraysize> tmp;
259 const auto valid_size = std::min(arraysize, m_entries.size());
260 for (
unsigned i = 0; i < valid_size; ++i) {
261 tmp[i] = m_entries[i]->data.steps;
266 template<
size_t arraysize>
267 const std::array<int, arraysize> Geant4ParticleCollection::secondaries()
const {
268 std::array<int, arraysize> tmp;
269 const auto valid_size = std::min(arraysize, m_entries.size());
270 for (
unsigned i = 0; i < valid_size; ++i) {
271 tmp[i] = m_entries[i]->data.secondaries;
276 template<
size_t arraysize>
277 const std::array<int, arraysize> Geant4ParticleCollection::pdgID()
const {
278 std::array<int, arraysize> tmp;
279 const auto valid_size = std::min(arraysize, m_entries.size());
280 for (
unsigned i = 0; i < valid_size; ++i) {
281 tmp[i] = m_entries[i]->data.pdgID;
286 template<
size_t arraysize>
287 const std::array<int, arraysize> Geant4ParticleCollection::status()
const {
288 std::array<int, arraysize> tmp;
289 const auto valid_size = std::min(arraysize, m_entries.size());
290 for (
unsigned i = 0; i < valid_size; ++i) {
291 tmp[i] = m_entries[i]->data.status;
296 template<
size_t arraysize>
297 const std::array<std::array<int, 2>, arraysize> Geant4ParticleCollection::colorFlow()
const {
298 std::array<std::array<int, 2>, arraysize> tmp;
299 const auto valid_size = std::min(arraysize, m_entries.size());
300 for (
unsigned i = 0; i < valid_size; ++i) {
301 tmp[i] = m_entries[i]->data.colorFlow;
306 template<
size_t arraysize>
307 const std::array<int, arraysize> Geant4ParticleCollection::genStatus()
const {
308 std::array<int, arraysize> tmp;
309 const auto valid_size = std::min(arraysize, m_entries.size());
310 for (
unsigned i = 0; i < valid_size; ++i) {
311 tmp[i] = m_entries[i]->data.genStatus;
316 template<
size_t arraysize>
317 const std::array<int, arraysize> Geant4ParticleCollection::charge()
const {
318 std::array<int, arraysize> tmp;
319 const auto valid_size = std::min(arraysize, m_entries.size());
320 for (
unsigned i = 0; i < valid_size; ++i) {
321 tmp[i] = m_entries[i]->data.charge;
326 template<
size_t arraysize>
327 const std::array<std::array<int, 1>, arraysize> Geant4ParticleCollection::spare()
const {
328 std::array<std::array<int, 1>, arraysize> tmp;
329 const auto valid_size = std::min(arraysize, m_entries.size());
330 for (
unsigned i = 0; i < valid_size; ++i) {
331 tmp[i] = m_entries[i]->data.spare;
336 template<
size_t arraysize>
337 const std::array<std::array<float, 3>, arraysize> Geant4ParticleCollection::spin()
const {
338 std::array<std::array<float, 3>, arraysize> tmp;
339 const auto valid_size = std::min(arraysize, m_entries.size());
340 for (
unsigned i = 0; i < valid_size; ++i) {
341 tmp[i] = m_entries[i]->data.spin;
346 template<
size_t arraysize>
347 const std::array<double, arraysize> Geant4ParticleCollection::vsx()
const {
348 std::array<double, arraysize> tmp;
349 const auto valid_size = std::min(arraysize, m_entries.size());
350 for (
unsigned i = 0; i < valid_size; ++i) {
351 tmp[i] = m_entries[i]->data.vsx;
356 template<
size_t arraysize>
357 const std::array<double, arraysize> Geant4ParticleCollection::vsy()
const {
358 std::array<double, arraysize> tmp;
359 const auto valid_size = std::min(arraysize, m_entries.size());
360 for (
unsigned i = 0; i < valid_size; ++i) {
361 tmp[i] = m_entries[i]->data.vsy;
366 template<
size_t arraysize>
367 const std::array<double, arraysize> Geant4ParticleCollection::vsz()
const {
368 std::array<double, arraysize> tmp;
369 const auto valid_size = std::min(arraysize, m_entries.size());
370 for (
unsigned i = 0; i < valid_size; ++i) {
371 tmp[i] = m_entries[i]->data.vsz;
376 template<
size_t arraysize>
377 const std::array<double, arraysize> Geant4ParticleCollection::vex()
const {
378 std::array<double, arraysize> tmp;
379 const auto valid_size = std::min(arraysize, m_entries.size());
380 for (
unsigned i = 0; i < valid_size; ++i) {
381 tmp[i] = m_entries[i]->data.vex;
386 template<
size_t arraysize>
387 const std::array<double, arraysize> Geant4ParticleCollection::vey()
const {
388 std::array<double, arraysize> tmp;
389 const auto valid_size = std::min(arraysize, m_entries.size());
390 for (
unsigned i = 0; i < valid_size; ++i) {
391 tmp[i] = m_entries[i]->data.vey;
396 template<
size_t arraysize>
397 const std::array<double, arraysize> Geant4ParticleCollection::vez()
const {
398 std::array<double, arraysize> tmp;
399 const auto valid_size = std::min(arraysize, m_entries.size());
400 for (
unsigned i = 0; i < valid_size; ++i) {
401 tmp[i] = m_entries[i]->data.vez;
406 template<
size_t arraysize>
407 const std::array<double, arraysize> Geant4ParticleCollection::psx()
const {
408 std::array<double, arraysize> tmp;
409 const auto valid_size = std::min(arraysize, m_entries.size());
410 for (
unsigned i = 0; i < valid_size; ++i) {
411 tmp[i] = m_entries[i]->data.psx;
416 template<
size_t arraysize>
417 const std::array<double, arraysize> Geant4ParticleCollection::psy()
const {
418 std::array<double, arraysize> tmp;
419 const auto valid_size = std::min(arraysize, m_entries.size());
420 for (
unsigned i = 0; i < valid_size; ++i) {
421 tmp[i] = m_entries[i]->data.psy;
426 template<
size_t arraysize>
427 const std::array<double, arraysize> Geant4ParticleCollection::psz()
const {
428 std::array<double, arraysize> tmp;
429 const auto valid_size = std::min(arraysize, m_entries.size());
430 for (
unsigned i = 0; i < valid_size; ++i) {
431 tmp[i] = m_entries[i]->data.psz;
436 template<
size_t arraysize>
437 const std::array<double, arraysize> Geant4ParticleCollection::pex()
const {
438 std::array<double, arraysize> tmp;
439 const auto valid_size = std::min(arraysize, m_entries.size());
440 for (
unsigned i = 0; i < valid_size; ++i) {
441 tmp[i] = m_entries[i]->data.pex;
446 template<
size_t arraysize>
447 const std::array<double, arraysize> Geant4ParticleCollection::pey()
const {
448 std::array<double, arraysize> tmp;
449 const auto valid_size = std::min(arraysize, m_entries.size());
450 for (
unsigned i = 0; i < valid_size; ++i) {
451 tmp[i] = m_entries[i]->data.pey;
456 template<
size_t arraysize>
457 const std::array<double, arraysize> Geant4ParticleCollection::pez()
const {
458 std::array<double, arraysize> tmp;
459 const auto valid_size = std::min(arraysize, m_entries.size());
460 for (
unsigned i = 0; i < valid_size; ++i) {
461 tmp[i] = m_entries[i]->data.pez;
466 template<
size_t arraysize>
467 const std::array<double, arraysize> Geant4ParticleCollection::mass()
const {
468 std::array<double, arraysize> tmp;
469 const auto valid_size = std::min(arraysize, m_entries.size());
470 for (
unsigned i = 0; i < valid_size; ++i) {
471 tmp[i] = m_entries[i]->data.mass;
476 template<
size_t arraysize>
477 const std::array<double, arraysize> Geant4ParticleCollection::time()
const {
478 std::array<double, arraysize> tmp;
479 const auto valid_size = std::min(arraysize, m_entries.size());
480 for (
unsigned i = 0; i < valid_size; ++i) {
481 tmp[i] = m_entries[i]->data.time;
486 template<
size_t arraysize>
487 const std::array<double, arraysize> Geant4ParticleCollection::properTime()
const {
488 std::array<double, arraysize> tmp;
489 const auto valid_size = std::min(arraysize, m_entries.size());
490 for (
unsigned i = 0; i < valid_size; ++i) {
491 tmp[i] = m_entries[i]->data.properTime;