LDMX Software
HepMCEvent.h
Go to the documentation of this file.
1
7#ifndef SIMCORE_HEPMCEVENT_H_
8#define SIMCORE_HEPMCEVENT_H_
9
10// LDMX
11#include "Framework/Exception/Exception.h"
13
14// HepMC3
15#include "HepMC3/GenEvent.h"
16#include "HepMC3/GenVertex.h"
17
18// Geant4
19#include "globals.hh"
20
21// STL
22#include <iostream>
23#include <memory>
24#include <vector>
25
26namespace simcore::hepmc {
27
38 public:
43 HepMCEvent(std::shared_ptr<HepMC3::GenEvent> event);
44
48 virtual ~HepMCEvent() = default;
49
54 int getNumParticles() const;
55
60 double getEventWeight() const;
61
66 const double* getVertex() const;
67
72 double getVertexTime() const;
73
79 const std::vector<std::unique_ptr<HepMCParticle>>& getParticles() const;
80
85 std::shared_ptr<HepMC3::GenEvent> getGenEvent() const;
86
87 private:
91 std::shared_ptr<HepMC3::GenEvent> event_;
92
96 mutable double vtx_[3];
97
101 mutable double vtxt_{0.};
102
106 mutable std::vector<std::unique_ptr<HepMCParticle>> particles_;
107
111 mutable bool particles_extracted_{false};
112
116 void extractParticles() const;
117};
118
119} // namespace simcore::hepmc
120
121#endif
Class defining a single particle record in a HepMC event.
Wrapper for HepMC3::GenEvent with convenience methods.
Definition HepMCEvent.h:37
double vtxt_
Vertex time (in ns)
Definition HepMCEvent.h:101
const std::vector< std::unique_ptr< HepMCParticle > > & getParticles() const
Get the list of final state particles in the event.
bool particles_extracted_
Flag to indicate if particles have been extracted.
Definition HepMCEvent.h:111
const double * getVertex() const
Get the vertex location (in mm, as expected by Geant4).
virtual ~HepMCEvent()=default
Class destructor.
HepMCEvent(std::shared_ptr< HepMC3::GenEvent > event)
Class constructor.
Definition HepMCEvent.cxx:6
void extractParticles() const
Extract final state particles from the HepMC event.
double getEventWeight() const
Get the event weight.
double vtx_[3]
Vertex location (in mm)
Definition HepMCEvent.h:96
double getVertexTime() const
Get the vertex time (in ns, as expected by Geant4).
std::vector< std::unique_ptr< HepMCParticle > > particles_
The list of final state particles to be tracked.
Definition HepMCEvent.h:106
std::shared_ptr< HepMC3::GenEvent > getGenEvent() const
Get the underlying HepMC3 GenEvent.
int getNumParticles() const
Get the number of particles in the event.
std::shared_ptr< HepMC3::GenEvent > event_
The underlying HepMC3 GenEvent.
Definition HepMCEvent.h:91