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
Geant4Data.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_GEANT4DATA_H
16 #define DD4HEP_GEANT4DATA_H
17 
18 // Framework include files
19 #include "DD4hep/Memory.h"
20 #include "Math/Vector3D.h"
21 
22 // C/C++ include files
23 #include <set>
24 #include <vector>
25 
26 // Forward declarations
27 class G4Step;
28 class G4StepPoint;
29 
31 namespace DD4hep {
32 
34  namespace Simulation {
35 
36  // Forward type definitions
37  typedef ROOT::Math::XYZVector Position;
38  typedef ROOT::Math::XYZVector Direction;
39 
41 
48  class SimpleRun {
49  public:
51  int runID;
53  int numEvents;
55  SimpleRun();
57  virtual ~SimpleRun();
58  };
59 
61 
68  class SimpleEvent {
69  public:
70  typedef std::vector<long> Seeds;
72  int runID;
74  int eventID;
78  SimpleEvent();
80  virtual ~SimpleEvent();
81  };
82 
84 
89  class DataExtension {
90  public:
94  virtual ~DataExtension();
95  };
96 
98  /*
99  * Base class for geant4 hit structures created by the
100  * example sensitive detectors. This is a generic class
101  * only dealing with the cellID. Users may add an extension
102  * object, which normally should not be necessary.
103  *
104  * \author M.Frank
105  * \version 1.0
106  * \ingroup DD4HEP_SIMULATION
107  */
109  public:
110  enum HitFlags {
120  };
122  long long int cellID;
124  long flag;
126  long g4ID;
128 #ifdef DD4HEP_DD4HEP_PTR_AUTO
130 #else
132 #endif
133 
135 
141  public:
143  int trackID;
145  int pdgID;
147  double deposit;
149  double time;
151  float x,y,z;
152 
155  : trackID(-1), pdgID(-1), deposit(0.0), time(0.0), x(0), y(0), z(0) {
156  }
158  MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp)
159  : trackID(track_id), pdgID(pdg), deposit(dep), time(time_stamp), x(0), y(0), z(0) {
160  }
162  MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp, float* pos)
163  : trackID(track_id), pdgID(pdg), deposit(dep), time(time_stamp),
164  x(pos[0]), y(pos[1]), z(pos[2])
165  {
166  }
168  MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp, double* pos)
169  : trackID(track_id), pdgID(pdg), deposit(dep), time(time_stamp),
170  x(pos[0]), y(pos[1]), z(pos[2])
171  {
172  }
175  : trackID(c.trackID), pdgID(c.pdgID), deposit(c.deposit), time(c.time),
176  x(c.x), y(c.y), z(c.z) {
177  }
180  if ( this != &c ) {
181  trackID = c.trackID;
182  pdgID = c.pdgID;
183  deposit = c.deposit;
184  time = c.time;
185  x = c.x;
186  y = c.y;
187  z = c.z;
188  }
189  return *this;
190  }
192  void clear() {
193  x = y = z = 0.0;
194  time = deposit = 0.0;
195  pdgID = trackID = -1;
196  }
197  };
199  typedef std::vector<MonteCarloContrib> Contributions;
200  public:
202  Geant4HitData();
204  virtual ~Geant4HitData();
206  static Contribution extractContribution(const G4Step* step);
208  static Contribution extractContribution(const G4Step* step, bool ApplyBirksLaw);
209  };
210 
212 
218  public:
220 
228  class Hit : public Geant4HitData {
229  public:
235  double length;
241  Hit();
243  Hit(int track_id, int pdg_id, double deposit, double time_stamp);
245  virtual ~Hit();
247  Hit& operator=(const Hit& c);
249  Hit& clear();
251  Hit& storePoint(const G4Step* step, const G4StepPoint* point);
252  };
253  };
254 
256 
262  public:
263 
265 
273  class Hit : public Geant4HitData {
274  public:
281  public:
283  Hit();
285  Hit(const Position& cell_pos);
287  virtual ~Hit();
288  };
289  };
290 
295 
296  } // End namespace Simulation
297 } // End namespace DD4hep
298 #endif // DD4HEP_GEANT4DATA_H
DDG4 tracker hit class used by the generic DDG4 tracker sensitive detector.
Definition: Geant4Data.h:228
Geant4Tracker SimpleTracker
Definition: Geant4Data.h:293
Seeds seeds
Random number generator seeds.
Definition: Geant4Data.h:76
std::vector< MonteCarloContrib > Contributions
Definition: Geant4Data.h:199
DataExtension()
Default constructor.
Definition: Geant4Data.h:92
double length
Length of the track segment contributing to this hit.
Definition: Geant4Data.h:235
MonteCarloContrib & operator=(const MonteCarloContrib &c)
Assignment operator.
Definition: Geant4Data.h:179
Direction momentum
Hit direction.
Definition: Geant4Data.h:233
MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp, float *pos)
Initializing constructor.
Definition: Geant4Data.h:162
DDG4 calorimeter hit class used by the generic DDG4 calorimeter sensitive detector.
Definition: Geant4Data.h:273
int numEvents
Number of events in this run.
Definition: Geant4Data.h:53
virtual ~SimpleRun()
Default destructor.
Definition: Geant4Data.cpp:37
double energyDeposit
Energy deposit in the tracker hit.
Definition: Geant4Data.h:239
virtual ~DataExtension()
Default destructor.
Definition: Geant4Data.cpp:53
Helper class to define structures used by the generic DDG4 calorimeter sensitive detector.
Definition: Geant4Data.h:261
Out version of the std auto_ptr implementation base either on auto_ptr or unique_ptr.
Definition: Memory.h:43
Contribution truth
Monte Carlo / Geant4 information.
Definition: Geant4Data.h:237
Position Direction
Definition: Defs.h:35
long long int cellID
cellID
Definition: Geant4Data.h:122
Contributions truth
Hit contributions by individual particles.
Definition: Geant4Data.h:278
SimpleRun()
Default constructor.
Definition: Geant4Data.cpp:31
Generic user-extendible data extension class.
Definition: Geant4Data.h:89
double deposit
Total energy deposit in this hit.
Definition: Geant4Data.h:147
not persisten. ROOT cannot handle
Definition: Geant4Data.h:140
Hit & clear()
Clear hit content.
Definition: Geant4Data.cpp:120
virtual ~Hit()
Default destructor.
Definition: Geant4Data.cpp:104
Hit & storePoint(const G4Step *step, const G4StepPoint *point)
Store Geant4 point and step information into tracker hit structure.
Definition: Geant4Data.cpp:129
Position position
Hit position.
Definition: Geant4Data.h:231
Hit & operator=(const Hit &c)
Assignment operator.
Definition: Geant4Data.cpp:109
static Contribution extractContribution(const G4Step *step)
Extract the MC contribution for a given hit from the step information.
Definition: Geant4Data.cpp:68
int runID
Run identifiers.
Definition: Geant4Data.h:51
Helper class to define structures used by the generic DDG4 tracker sensitive detector.
Definition: Geant4Data.h:217
MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp)
Initializing constructor.
Definition: Geant4Data.h:158
MonteCarloContrib Contribution
Definition: Geant4Data.h:198
ROOT::Math::XYZVector Position
Definition: Objects.h:75
int runID
Run identifiers.
Definition: Geant4Data.h:72
dd4hep_ptr< DataExtension > extension
User data extension if required.
Definition: Geant4Data.h:131
Position Direction
Definition: Fields.h:31
virtual ~Geant4HitData()
Default destructor.
Definition: Geant4Data.cpp:63
Hit()
Default constructor (for ROOT)
Definition: Geant4Data.cpp:145
float x
Proper position of the hit contribution.
Definition: Geant4Data.h:151
MonteCarloContrib(const MonteCarloContrib &c)
Copy constructor.
Definition: Geant4Data.h:174
int pdgID
Particle ID from the PDG table.
Definition: Geant4Data.h:145
MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp, double *pos)
Initializing constructor.
Definition: Geant4Data.h:168
Geant4Calorimeter SimpleCalorimeter
Definition: Geant4Data.h:294
Geant4HitData()
Default constructor.
Definition: Geant4Data.cpp:57
SimpleEvent()
Default constructor.
Definition: Geant4Data.cpp:42
Simple run description structure. Used in the default I/O mechanism.
Definition: Geant4Data.h:48
long g4ID
Original Geant 4 track identifier of the creating track (debugging)
Definition: Geant4Data.h:126
Geant4HitData SimpleHit
Backward compatibility definitions.
Definition: Geant4Data.h:292
double energyDeposit
Total energy deposit.
Definition: Geant4Data.h:280
virtual ~SimpleEvent()
Default destructor.
Definition: Geant4Data.cpp:48
long flag
User flag to classify hits.
Definition: Geant4Data.h:124
ROOT::Math::XYZVector Position
Definition: Geant4Data.h:37
double time
Timestamp when this energy was deposited.
Definition: Geant4Data.h:149
virtual ~Hit()
Default destructor.
Definition: Geant4Data.cpp:157
std::vector< long > Seeds
Definition: Geant4Data.h:70
int eventID
Event identifier.
Definition: Geant4Data.h:74
Simple event description structure. Used in the default I/O mechanism.
Definition: Geant4Data.h:68
Base class for geant4 hit structures used by the default DDG4 sensitive detector implementations.
Definition: Geant4Data.h:108