DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geant4Primary.h
Go to the documentation of this file.
1 // $Id: $
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 
15 #ifndef DD4HEP_GEANT4PRIMARY_H
16 #define DD4HEP_GEANT4PRIMARY_H
17 
18 // Framework include files
19 #include "DD4hep/Memory.h"
20 #include "DDG4/Geant4Vertex.h"
21 #include "DDG4/Geant4Particle.h"
22 
23 // C/C++ include files
24 #include <set>
25 #include <map>
26 #include <vector>
27 #include <memory>
28 
29 // Forward declarations
30 class G4PrimaryParticle;
31 
33 namespace DD4hep {
34 
36  namespace Simulation {
37 
38  // Forward declarations
39  class Geant4Particle;
40  class Geant4Vertex;
41 
43 
49  public:
51  PrimaryExtension() = default;
53  virtual ~PrimaryExtension();
54  };
55 
57 
66  public:
67  typedef std::map<const G4PrimaryParticle*,Geant4Particle*> Primaries;
68  private:
71 
72  public:
74  Geant4PrimaryMap() = default;
76  virtual ~Geant4PrimaryMap();
78  void insert(G4PrimaryParticle* g4_particle,Geant4Particle* particle);
80  Geant4Particle* get(const G4PrimaryParticle* particle);
82  const Geant4Particle* get(const G4PrimaryParticle* particle) const;
86  const Primaries& primaries() const { return m_primaryMap; }
87  };
88 
89 
91  /*
92  * \author M.Frank
93  * \version 1.0
94  * \ingroup DD4HEP_SIMULATION
95  */
97  private:
102 
103  public:
106  typedef std::map<int,Particle*> ParticleMap;
107  typedef std::map<int,Vertex*> VertexMap;
109 
117  int mask = 0;
119  int locked = 0;
122 
123  public:
125  Geant4PrimaryInteraction() = default;
127  virtual ~Geant4PrimaryInteraction();
129  int nextPID();
131  void setNextPID(int value);
133  bool applyMask();
134  };
135 
137  /*
138  * Multiple interactions allow a simple handling of overlay events
139  *
140  * \author M.Frank
141  * \version 1.0
142  * \ingroup DD4HEP_SIMULATION
143  */
145  private:
147  Geant4PrimaryEvent(const Geant4PrimaryEvent& c) = delete;
149  Geant4PrimaryEvent& operator=(const Geant4PrimaryEvent& c) = delete;
150 
151  public:
153  typedef std::map<int,Interaction*> Interactions;
155 
156  protected:
159 
160  public:
163 
164  public:
166  Geant4PrimaryEvent() = default;
168  virtual ~Geant4PrimaryEvent();
170  void add(int id, Geant4PrimaryInteraction* interaction);
172  Geant4PrimaryInteraction* get(int id) const;
174  size_t size() const { return m_interactions.size(); }
176  std::vector<Geant4PrimaryInteraction*> interactions() const;
177  };
178 
179  } // End namespace Simulation
180 } // End namespace DD4hep
181 #endif // DD4HEP_GEANT4PRIMARY_H
VertexMap vertices
The map of primary vertices for the particles.
int nextPID()
Access a new particle identifier within the interaction.
void setNextPID(int value)
Set the next PID value.
Data structure to store the MC particle information.
Geant4PrimaryInteraction Interaction
std::map< const G4PrimaryParticle *, Geant4Particle * > Primaries
Definition: Geant4Primary.h:67
Geant4PrimaryInteraction & operator=(const Geant4PrimaryInteraction &c)=delete
Assignment operator.
int next_particle_identifier
Next PID indentifier.
Geant4PrimaryEvent & operator=(const Geant4PrimaryEvent &c)=delete
Assignment operator.
virtual ~Geant4PrimaryMap()
Default destructor.
Class modelling a single interaction with multiple primary vertices and particles.
Definition: Geant4Primary.h:96
dd4hep_ptr< PrimaryExtension > ExtensionHandle
dd4hep_ptr< PrimaryExtension > ExtensionHandle
Class modelling a complete primary event with multiple interactions.
Data structure to map primaries to particles.
Definition: Geant4Primary.h:65
Data structure to store the MC vertex information.
Definition: Geant4Vertex.h:46
ExtensionHandle extension
User data extension if required.
Base structure to extend primary information with user data.
Definition: Geant4Primary.h:48
std::map< int, Interaction * > Interactions
Interactions m_interactions
Set of primary interactions.
bool applyMask()
Apply mask to all contained vertices (max. 1) and particles.
ParticleMap particles
The map of particles participating in this primary interaction.
size_t size() const
Number of interaction contained in the primary event.
Geant4PrimaryInteraction()=default
Default constructor.
Primaries & primaries()
Access primary map directly.
Definition: Geant4Primary.h:84
Primaries m_primaryMap
Mapping of primary particles of this event.
Definition: Geant4Primary.h:70
virtual ~Geant4PrimaryEvent()
Default destructor.
std::vector< Geant4PrimaryInteraction * > interactions() const
Retrieve all interactions.
void insert(G4PrimaryParticle *g4_particle, Geant4Particle *particle)
Add a new object pair (G4 primary particle, DDG4 particle) into the maps.
int mask
User mask to flag the interaction. Also unique identifier.
int locked
Flag that the event is locked for G4 native generators.
const Primaries & primaries() const
Access primary map directly (const)
Definition: Geant4Primary.h:86
Geant4PrimaryEvent()=default
Default constructor.
std::map< int, Particle * > ParticleMap
void add(int id, Geant4PrimaryInteraction *interaction)
Add a new interaction object to the event.
ExtensionHandle extension
User data extension if required.
virtual ~Geant4PrimaryInteraction()
Default destructor.
PrimaryExtension()=default
Default constructor.
virtual ~PrimaryExtension()
Default destructor.
Geant4PrimaryMap()=default
not persistent