DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4Primary.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 #ifndef DDG4_GEANT4PRIMARY_H
15 #define DDG4_GEANT4PRIMARY_H
16 
17 // Framework include files
18 #include <DD4hep/Memory.h>
19 #include <DDG4/Geant4Vertex.h>
20 #include <DDG4/Geant4Particle.h>
21 
22 // C/C++ include files
23 #include <set>
24 #include <map>
25 #include <vector>
26 #include <memory>
27 
28 // Forward declarations
29 class G4PrimaryParticle;
30 
32 namespace dd4hep {
33 
35  namespace sim {
36 
37  // Forward declarations
38  class Geant4Particle;
39  class Geant4Vertex;
40 
42 
48  public:
50  PrimaryExtension() = default;
52  virtual ~PrimaryExtension();
53  };
54 
56 
65  public:
66  typedef std::map<const G4PrimaryParticle*,Geant4Particle*> Primaries;
67  private:
70 
71  public:
73  Geant4PrimaryMap() = default;
75  virtual ~Geant4PrimaryMap();
77  void insert(G4PrimaryParticle* g4_particle,Geant4Particle* particle);
79  Geant4Particle* get(const G4PrimaryParticle* particle);
81  const Geant4Particle* get(const G4PrimaryParticle* particle) const;
85  const Primaries& primaries() const { return m_primaryMap; }
86  };
87 
88 
90  /*
91  * \author M.Frank
92  * \version 1.0
93  * \ingroup DD4HEP_SIMULATION
94  */
96  private:
101 
102  public:
105  typedef std::map<int,Particle*> ParticleMap;
106  typedef std::map<int,std::vector<Vertex*>> VertexMap;
108 
116  int mask = 0;
118  int locked = 0;
121 
122  public:
126  virtual ~Geant4PrimaryInteraction();
128  int nextPID();
130  void setNextPID(int value);
132  bool applyMask();
133  };
134 
136  /*
137  * Multiple interactions allow a simple handling of overlay events
138  *
139  * \author M.Frank
140  * \version 1.0
141  * \ingroup DD4HEP_SIMULATION
142  */
144  private:
149 
150  public:
152  typedef std::map<int,Interaction*> Interactions;
154 
155  protected:
158 
159  public:
162 
163  public:
165  Geant4PrimaryEvent() = default;
167  virtual ~Geant4PrimaryEvent();
169  void add(int id, Geant4PrimaryInteraction* interaction);
171  Geant4PrimaryInteraction* get(int id) const;
173  size_t size() const { return m_interactions.size(); }
175  std::vector<Geant4PrimaryInteraction*> interactions() const;
176  };
177 
178  } // End namespace sim
179 } // End namespace dd4hep
180 #endif // DDG4_GEANT4PRIMARY_H
dd4hep::sim::Geant4PrimaryEvent::Geant4PrimaryEvent
Geant4PrimaryEvent(const Geant4PrimaryEvent &c)=delete
Copy constructor.
dd4hep::sim::Geant4PrimaryEvent
Class modelling a complete primary event with multiple interactions.
Definition: Geant4Primary.h:143
dd4hep::sim::Geant4PrimaryMap
Data structure to map primaries to particles.
Definition: Geant4Primary.h:64
dd4hep::sim::Geant4PrimaryInteraction::nextPID
int nextPID()
Access a new particle identifier within the interaction.
Definition: Geant4Primary.cpp:65
dd4hep::sim::Geant4PrimaryEvent::operator=
Geant4PrimaryEvent & operator=(const Geant4PrimaryEvent &c)=delete
Assignment operator.
dd4hep::sim::Geant4PrimaryInteraction::Particle
Geant4Particle Particle
Definition: Geant4Primary.h:103
dd4hep::sim::Geant4PrimaryMap::primaries
Primaries & primaries()
Access primary map directly.
Definition: Geant4Primary.h:83
dd4hep::sim::Geant4PrimaryEvent::interactions
std::vector< Geant4PrimaryInteraction * > interactions() const
Retrieve all interactions.
Definition: Geant4Primary.cpp:113
dd4hep::sim::Geant4PrimaryEvent::ExtensionHandle
dd4hep_ptr< PrimaryExtension > ExtensionHandle
Definition: Geant4Primary.h:153
dd4hep::sim::Geant4PrimaryInteraction
Class modelling a single interaction with multiple primary vertices and particles.
Definition: Geant4Primary.h:95
dd4hep::sim::Geant4PrimaryInteraction::locked
int locked
Flag that the event is locked for G4 native generators.
Definition: Geant4Primary.h:118
dd4hep::sim::Geant4PrimaryEvent::Geant4PrimaryEvent
Geant4PrimaryEvent()=default
Default constructor.
dd4hep::sim::Geant4PrimaryInteraction::vertices
VertexMap vertices
The map of primary vertices for the particles.
Definition: Geant4Primary.h:110
dd4hep::sim::Geant4PrimaryInteraction::applyMask
bool applyMask()
Apply mask to all contained vertices (max. 1) and particles.
Definition: Geant4Primary.cpp:75
dd4hep::sim::Geant4PrimaryInteraction::particles
ParticleMap particles
The map of particles participating in this primary interaction.
Definition: Geant4Primary.h:112
dd4hep::sim::Geant4PrimaryMap::Geant4PrimaryMap
Geant4PrimaryMap()=default
not persistent
dd4hep::sim::Geant4PrimaryInteraction::mask
int mask
User mask to flag the interaction. Also unique identifier.
Definition: Geant4Primary.h:116
dd4hep::sim::Geant4PrimaryMap::primaries
const Primaries & primaries() const
Access primary map directly (const)
Definition: Geant4Primary.h:85
dd4hep::sim::Geant4PrimaryInteraction::setNextPID
void setNextPID(int value)
Set the next PID value.
Definition: Geant4Primary.cpp:70
dd4hep::sim::Geant4PrimaryMap::insert
void insert(G4PrimaryParticle *g4_particle, Geant4Particle *particle)
Add a new object pair (G4 primary particle, DDG4 particle) into the maps.
Definition: Geant4Primary.cpp:39
dd4hep::sim::Geant4PrimaryEvent::Interaction
Geant4PrimaryInteraction Interaction
Definition: Geant4Primary.h:151
dd4hep::sim::Geant4PrimaryEvent::m_interactions
Interactions m_interactions
Set of primary interactions.
Definition: Geant4Primary.h:157
dd4hep::sim::Geant4PrimaryInteraction::next_particle_identifier
int next_particle_identifier
Next PID indentifier.
Definition: Geant4Primary.h:120
dd4hep::sim::Geant4PrimaryMap::~Geant4PrimaryMap
virtual ~Geant4PrimaryMap()
Default destructor.
Definition: Geant4Primary.cpp:34
dd4hep::sim::PrimaryExtension::PrimaryExtension
PrimaryExtension()=default
Default constructor.
dd4hep::sim::PrimaryExtension
Base structure to extend primary information with user data.
Definition: Geant4Primary.h:47
dd4hep::sim::Geant4PrimaryEvent::size
size_t size() const
Number of interaction contained in the primary event.
Definition: Geant4Primary.h:173
dd4hep::sim::PrimaryExtension::~PrimaryExtension
virtual ~PrimaryExtension()
Default destructor.
Definition: Geant4Primary.cpp:30
Geant4Vertex.h
dd4hep::sim::Geant4PrimaryMap::Primaries
std::map< const G4PrimaryParticle *, Geant4Particle * > Primaries
Definition: Geant4Primary.h:66
Memory.h
dd4hep::sim::Geant4PrimaryInteraction::ExtensionHandle
dd4hep_ptr< PrimaryExtension > ExtensionHandle
Definition: Geant4Primary.h:107
dd4hep::sim::Geant4PrimaryInteraction::operator=
Geant4PrimaryInteraction & operator=(const Geant4PrimaryInteraction &c)=delete
Assignment operator.
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4PrimaryEvent::Interactions
std::map< int, Interaction * > Interactions
Definition: Geant4Primary.h:152
Geant4Particle.h
dd4hep::sim::Geant4PrimaryEvent::extension
ExtensionHandle extension
User data extension if required.
Definition: Geant4Primary.h:161
dd4hep::sim::Geant4PrimaryInteraction::Geant4PrimaryInteraction
Geant4PrimaryInteraction()=default
Default constructor.
dd4hep::sim::Geant4PrimaryInteraction::ParticleMap
std::map< int, Particle * > ParticleMap
Definition: Geant4Primary.h:105
dd4hep::sim::Geant4Particle
Data structure to store the MC particle information.
Definition: Geant4Particle.h:103
dd4hep::sim::Geant4Vertex
Data structure to store the MC vertex information.
Definition: Geant4Vertex.h:45
dd4hep::sim::Geant4PrimaryInteraction::~Geant4PrimaryInteraction
virtual ~Geant4PrimaryInteraction()
Default destructor.
Definition: Geant4Primary.cpp:56
dd4hep::sim::Geant4PrimaryMap::m_primaryMap
Primaries m_primaryMap
Mapping of primary particles of this event.
Definition: Geant4Primary.h:69
dd4hep::sim::Geant4PrimaryEvent::~Geant4PrimaryEvent
virtual ~Geant4PrimaryEvent()
Default destructor.
Definition: Geant4Primary.cpp:87
dd4hep::sim::Geant4PrimaryMap::get
Geant4Particle * get(const G4PrimaryParticle *particle)
Access DDG4 particle by G4 primary particle.
Definition: Geant4Primary.cpp:44
dd4hep::sim::Geant4PrimaryEvent::add
void add(int id, Geant4PrimaryInteraction *interaction)
Add a new interaction object to the event.
Definition: Geant4Primary.cpp:92
dd4hep::sim::Geant4PrimaryInteraction::extension
ExtensionHandle extension
User data extension if required.
Definition: Geant4Primary.h:114
dd4hep::sim::Geant4PrimaryInteraction::Vertex
Geant4Vertex Vertex
Definition: Geant4Primary.h:104
dd4hep::sim::Geant4PrimaryInteraction::Geant4PrimaryInteraction
Geant4PrimaryInteraction(const Geant4PrimaryInteraction &c)=delete
Copy constructor.
dd4hep::dd4hep_ptr< PrimaryExtension >
dd4hep::sim::Geant4PrimaryEvent::get
Geant4PrimaryInteraction * get(int id) const
Retrieve an interaction by its ID.
Definition: Geant4Primary.cpp:107
dd4hep::sim::Geant4PrimaryInteraction::VertexMap
std::map< int, std::vector< Vertex * > > VertexMap
Definition: Geant4Primary.h:106