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
12
13// HepMC3
14#include "HepMC3/GenEvent.h"
15#include "HepMC3/GenVertex.h"
16
17// Geant4
18
19// STL
20#include <memory>
21#include <vector>
22
23namespace simcore::hepmc {
24
35 public:
40 HepMCEvent(std::shared_ptr<HepMC3::GenEvent> event);
41
45 virtual ~HepMCEvent() = default;
46
51 int getNumParticles() const;
52
57 double getEventWeight() const;
58
63 const double* getVertex() const;
64
69 double getVertexTime() const;
70
76 const std::vector<std::unique_ptr<HepMCParticle>>& getParticles() const;
77
82 std::shared_ptr<HepMC3::GenEvent> getGenEvent() const;
83
84 private:
88 std::shared_ptr<HepMC3::GenEvent> event_;
89
93 mutable double vtx_[3];
94
98 mutable double vtxt_{0.};
99
103 mutable std::vector<std::unique_ptr<HepMCParticle>> particles_;
104
108 mutable bool particles_extracted_{false};
109
113 void extractParticles() const;
114};
115
116} // namespace simcore::hepmc
117
118#endif
Class defining a single particle record in a HepMC event.
Wrapper for HepMC3::GenEvent with convenience methods.
Definition HepMCEvent.h:34
double vtxt_
Vertex time (in ns)
Definition HepMCEvent.h:98
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:108
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:8
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:93
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:103
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:88