GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
Public Member Functions | Protected Attributes
GGSPartHit Class Reference

Definition of GGS Particle Hit. More...

#include <GGSPartHit.h>

Inheritance diagram for GGSPartHit:
Inheritance graph
[legend]
Collaboration diagram for GGSPartHit:
Collaboration graph
[legend]

Public Member Functions

 GGSPartHit ()
 Constructor.
 
 ~GGSPartHit ()
 Destructor.
 
 GGSPartHit (const GGSPartHit &right)
 Copy constructor. More...
 
const GGSPartHitoperator= (const GGSPartHit &right)
 Assignment operator. More...
 
bool operator== (const GGSPartHit &right) const
 Comparison operator. More...
 
void * operator new (size_t size)
 Operator new. More...
 
void operator delete (void *aHit)
 Operator delete. More...
 
virtual void UserInit (G4Step *aStep)
 User initialization of hit global properties. More...
 
virtual void AddStep (const G4Step &step)
 Adds a step to the particle hit. More...
 
void SetTrackID (G4int id)
 Track ID setter. More...
 
void SetParentID (G4int id)
 Parent's track ID setter. More...
 
void SetParticlePdg (G4int pdg)
 PDG code setter. More...
 
void SetPosHitsStorage (bool flag)
 Turn on or off the storage of position hits. More...
 
G4double GetEnergyDeposit () const
 Energy deposit getter. More...
 
G4double GetTime () const
 Time getter. More...
 
G4double GetPathLength () const
 Path length getter. More...
 
G4ThreeVector GetEntrancePoint () const
 Entrance point getter. More...
 
G4ThreeVector GetExitPoint () const
 Exit point getter. More...
 
G4ThreeVector GetEntranceMomentum () const
 Entrance momentum getter. More...
 
G4double GetEntranceEnergy () const
 Entrance energy getter. More...
 
G4int GetTrackID () const
 Track ID getter. More...
 
G4int GetParentID () const
 Parent's track ID getter. More...
 
G4int GetParticlePdg () const
 PDG code getter. More...
 
GGSPosHitsCollectionGetPosHits ()
 Getter of container of position hits. More...
 

Protected Attributes

G4double _eDep
 
G4double _time
 
G4double _pathLength
 
G4ThreeVector _entrancePoint
 
G4ThreeVector _exitPoint
 
G4ThreeVector _entranceMomentum
 
G4double _entranceEnergy
 
G4int _trackID
 
G4int _parentID
 
G4int _particlePdg
 
bool _isReset
 
GGSPosHitsCollection_posHits
 

Detailed Description

Definition of GGS Particle Hit.

A particle hit is associated to a sensitive physical volume and a particle. It carries information about total energy release of that particle in that volume during the current event. So if in the current event there are N volumes and the i-th volume is traversed by M_i particles, then there will be sum_i (M_i) particle hits in the event. Note that if a particle passes through a sensitive volume without releasing energy (eg., a neutrino) the corresponding particle hit will be generated anyway with zero energy release.

Definition at line 36 of file GGSPartHit.h.

Constructor & Destructor Documentation

GGSPartHit::GGSPartHit ( const GGSPartHit right)

Copy constructor.

Parameters
rightThe object to be copied into current one.

Definition at line 23 of file GGSPartHit.cpp.

23  : G4VHit() {
24  _eDep = right._eDep;
25  _time = right._time;
26  _pathLength = right._pathLength;
27  _entrancePoint = right._entrancePoint;
28  _exitPoint = right._exitPoint;
29  _entranceMomentum = right._entranceMomentum;
30  _entranceEnergy = right._entranceEnergy;
31  _trackID = right._trackID;
32  _parentID = right._parentID;
33  _particlePdg = right._particlePdg;
34  _isReset = right._isReset;
35 
36  if (right._posHits == NULL) {
37  _posHits = NULL;
38  } else
39  _posHits = new GGSPosHitsCollection(*right._posHits);
40 }
G4THitsCollection< GGSPosHit > GGSPosHitsCollection
Alias for G4 template hits collection for GGSPosHit.
Definition: GGSPosHit.h:194

Member Function Documentation

void GGSPartHit::AddStep ( const G4Step &  step)
virtual

Adds a step to the particle hit.

This method adds a step to the particle hit. The particle hit integral quantities (scoring value and path length) will be incremented by the corresponding step quantities. The exit point from the volume will be updated with the value of the end point of the step; if the step is the first to be added, its values for start point, energy, momentum and time will be used to set the values of entrance point, energy, momentum and time of the particle hit.

The step object itself can be stored as a GGSPosHit by calling SetPosHitsStorage with proper parameter. The container of stored position hit objects can be retrieved with the GetPosHits method. Default behavior is to not store GGSPosHit objects; user must be aware that storing GGSPosHit objects could result in a great increase in memory consumption if the sensitive element is thick or traversed by many particles (e.g. a scintillating bar in an e.m. calorimeter).

Parameters
stepthe G4Step object representing the simulation step to be added.

Definition at line 101 of file GGSPartHit.cpp.

101  {
102  _eDep += step.GetTotalEnergyDeposit();
103  _pathLength += step.GetStepLength();
104  _exitPoint = step.GetPostStepPoint()->GetPosition();
105 
106  if (_isReset) {
107  // First step for this particle hit: store initial values
108  _isReset = false;
109  _time = step.GetPreStepPoint()->GetGlobalTime();
110  _entrancePoint = step.GetPreStepPoint()->GetPosition();
111  _entranceMomentum = step.GetPreStepPoint()->GetMomentum();
112  _entranceEnergy = step.GetPreStepPoint()->GetKineticEnergy();
113  _trackID = step.GetTrack()->GetTrackID();
114  _parentID = step.GetTrack()->GetParentID();
115  _particlePdg = step.GetTrack()->GetDefinition()->GetPDGEncoding();
116  }
117 }
G4double GGSPartHit::GetEnergyDeposit ( ) const
inline

Energy deposit getter.

Returns
The energy deposit.

Definition at line 148 of file GGSPartHit.h.

148 { return _eDep; }
G4double GGSPartHit::GetEntranceEnergy ( ) const
inline

Entrance energy getter.

Gets the energy of the particle at entrance in the volume.

Returns
The entrance energy.

Definition at line 192 of file GGSPartHit.h.

192 { return _entranceEnergy; }
G4ThreeVector GGSPartHit::GetEntranceMomentum ( ) const
inline

Entrance momentum getter.

Gets the momentum of the particle at entrance in the volume.

Returns
The entrance moemntum.

Definition at line 184 of file GGSPartHit.h.

184 { return _entranceMomentum; }
G4ThreeVector GGSPartHit::GetEntrancePoint ( ) const
inline

Entrance point getter.

Gets the particle's entrance point in the volume.

Returns
The entrance point.

Definition at line 168 of file GGSPartHit.h.

168 { return _entrancePoint; }
G4ThreeVector GGSPartHit::GetExitPoint ( ) const
inline

Exit point getter.

Gets the particle's exit point from the volume.

Returns
The exit point.

Definition at line 176 of file GGSPartHit.h.

176 { return _exitPoint; }
G4int GGSPartHit::GetParentID ( ) const
inline

Parent's track ID getter.

Returns
The track ID of the parent of the particle.

Definition at line 204 of file GGSPartHit.h.

204 { return _parentID; }
G4int GGSPartHit::GetParticlePdg ( ) const
inline

PDG code getter.

Returns
PDG code of the particle.

Definition at line 210 of file GGSPartHit.h.

210 { return _particlePdg; }
G4double GGSPartHit::GetPathLength ( ) const
inline

Path length getter.

Returns
The total path length of particles traversing the volume.

Definition at line 160 of file GGSPartHit.h.

160 { return _pathLength; }
GGSPosHitsCollection* GGSPartHit::GetPosHits ( )
inline

Getter of container of position hits.

Returns
pointer to the position hit container (NULL if storage of position hits has not been previously turned on by calling SetPosHitsStorage).

Definition at line 218 of file GGSPartHit.h.

218 { return _posHits; }
G4double GGSPartHit::GetTime ( ) const
inline

Time getter.

Returns
The time of initial energy deposit.

Definition at line 154 of file GGSPartHit.h.

154 { return _time; }
G4int GGSPartHit::GetTrackID ( ) const
inline

Track ID getter.

Returns
The track ID of the particle.

Definition at line 198 of file GGSPartHit.h.

198 { return _trackID; }
void GGSPartHit::operator delete ( void *  aHit)
inline

Operator delete.

This implementation uses G4Allocator.

Parameters
aHitThe current hit to be deleted.
See Also
GGSPartHitAllocator.

Definition at line 253 of file GGSPartHit.h.

253 { GGSPartHitAllocator.FreeSingle((GGSPartHit *)aHit); }
Definition of GGS Particle Hit.
Definition: GGSPartHit.h:36
G4Allocator< GGSPartHit > GGSPartHitAllocator
Alias for G4 template memory allocator for GGSPartHit.
Definition: GGSPartHit.cpp:7
void * GGSPartHit::operator new ( size_t  size)
inline

Operator new.

This implementation uses G4Allocator.

Parameters
sizeUnused (needed by the interface).
See Also
GGSPartHitAllocator.

Definition at line 245 of file GGSPartHit.h.

245  {
246  void *aHit;
247  aHit = (void *)GGSPartHitAllocator.MallocSingle();
248  return aHit;
249 }
G4Allocator< GGSPartHit > GGSPartHitAllocator
Alias for G4 template memory allocator for GGSPartHit.
Definition: GGSPartHit.cpp:7
const GGSPartHit & GGSPartHit::operator= ( const GGSPartHit right)

Assignment operator.

Parameters
rightThe object to be assigned to current one.
Returns
The new current object.

Definition at line 44 of file GGSPartHit.cpp.

44  {
45  if (this != &right) {
46  _eDep = right._eDep;
47  _time = right._time;
48  _pathLength = right._pathLength;
49  _entrancePoint = right._entrancePoint;
50  _exitPoint = right._exitPoint;
51  _entranceMomentum = right._entranceMomentum;
52  _entranceEnergy = right._entranceEnergy;
53  _trackID = right._trackID;
54  _parentID = right._parentID;
55  _particlePdg = right._particlePdg;
56  _isReset = right._isReset;
57  if (right._posHits == NULL) {
58  delete _posHits;
59  _posHits = NULL;
60  } else
61  *_posHits = *(right._posHits);
62  }
63  return *this;
64 }
bool GGSPartHit::operator== ( const GGSPartHit right) const

Comparison operator.

Parameters
rightRHS of comparison.
Returns
true if LHS==RHS.

Definition at line 68 of file GGSPartHit.cpp.

68  {
69  if ((_eDep == right._eDep) && //
70  (_time == right._time) && //
71  (_pathLength == right._pathLength) && //
72  (_entrancePoint == right._entrancePoint) && //
73  (_exitPoint == right._exitPoint) && //
74  (_entranceMomentum == right._entranceMomentum) && //
75  (_entranceEnergy == right._entranceEnergy) && //
76  (_trackID == right._trackID) && //
77  (_parentID == right._parentID) && //
78  (_particlePdg == right._particlePdg)) {
79 
80  if (_posHits != NULL) {
81  if (right._posHits != NULL) {
82  return (*_posHits == *(right._posHits));
83  }
84 
85  else {
86  return false;
87  }
88  } else {
89  if (right._posHits != NULL) {
90  return false;
91  } else {
92  return true;
93  }
94  }
95  } else
96  return false;
97 }
void GGSPartHit::SetParentID ( G4int  id)
inline

Parent's track ID setter.

Parameters
idThe ID of the track of the particle's parent.

Definition at line 126 of file GGSPartHit.h.

126 { _parentID = id; }
void GGSPartHit::SetParticlePdg ( G4int  pdg)
inline

PDG code setter.

Parameters
pdgThe PDG code of the particle.

Definition at line 132 of file GGSPartHit.h.

132 { _particlePdg = pdg; }
void GGSPartHit::SetPosHitsStorage ( bool  flag)

Turn on or off the storage of position hits.

Position hits added to particle hit by AddStep are by default not stored. This method enables or disables position hit storage.

Parameters
flagif true, position hits will be stored.

Definition at line 121 of file GGSPartHit.cpp.

121  {
122 
123  if (flag == true) {
124  if (!_posHits)
125  _posHits = new GGSPosHitsCollection;
126  } else {
127  if (_posHits) {
128  delete _posHits;
129  _posHits = NULL;
130  }
131  }
132 }
G4THitsCollection< GGSPosHit > GGSPosHitsCollection
Alias for G4 template hits collection for GGSPosHit.
Definition: GGSPosHit.h:194
void GGSPartHit::SetTrackID ( G4int  id)
inline

Track ID setter.

Parameters
idThe ID of particle's track

Definition at line 120 of file GGSPartHit.h.

120 { _trackID = id; }
virtual void GGSPartHit::UserInit ( G4Step *  aStep)
inlinevirtual

User initialization of hit global properties.

This method is called by GGSIntHitSD after initializing the hit object just after its creation, before calling AddStep. Users can override this method in custom hit classes to perform additional custom initialization. The #aStep argument is the simulation step at which the hit is created.

Parameters
aStepThe step at which the hit has been created.

Definition at line 90 of file GGSPartHit.h.

90 { GGS_IGNORE_VAR(aStep); }
void GGS_IGNORE_VAR(const T &)
Small utility to avoid compiler warnings for unused methods.
Definition: GGSMiscUtils.h:14

The documentation for this class was generated from the following files: