GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GGSTHits.cpp
Go to the documentation of this file.
1 /*
2  * GGSTHits.cpp
3  *
4  * Created on: 17 Aug 2011
5  * Author: Nicola Mori
6  */
7 
11 #ifdef GGS_USE_G4
13 #endif
14 
15 /* ********************************** *
16  * Position hits class implementation *
17  * ********************************** */
18 
19 ClassImp(GGSTPosHitBase)
20 
22  : TObject(), eDep(0.) {}
23 
24 void GGSTPosHitBase::Clear(Option_t *) { eDep = 0.; }
25 
26 ClassImp(GGSTPosHit)
27 
29  : GGSTPosHitBase(), time(0.), pathLength(0.), startEnergy(0.) {
30 
31  startPoint[0] = startPoint[1] = startPoint[2] = 0.;
32  endPoint[0] = endPoint[1] = endPoint[2] = 0.;
33  startMomentum[0] = startMomentum[1] = startMomentum[2] = 0.;
34 }
35 
36 void GGSTPosHit::Clear(Option_t *opt) {
37  time = 0.;
38  pathLength = 0.;
39  startPoint[0] = startPoint[1] = startPoint[2] = 0.;
40  endPoint[0] = endPoint[1] = endPoint[2] = 0.;
41  startMomentum[0] = startMomentum[1] = startMomentum[2] = 0.;
42  startEnergy = 0.;
44 }
45 
46 #ifdef GGS_USE_G4
47 void GGSTPosHit::UserConversion(const GGSPosHit &posHit) {
48  time = posHit.GetTime() / CLHEP::ns;
49  pathLength = posHit.GetPathLength() / CLHEP::cm;
50  startPoint[0] = posHit.GetStartPoint()[0] / CLHEP::cm;
51  startPoint[1] = posHit.GetStartPoint()[1] / CLHEP::cm;
52  startPoint[2] = posHit.GetStartPoint()[2] / CLHEP::cm;
53  endPoint[0] = posHit.GetEndPoint()[0] / CLHEP::cm;
54  endPoint[1] = posHit.GetEndPoint()[1] / CLHEP::cm;
55  endPoint[2] = posHit.GetEndPoint()[2] / CLHEP::cm;
56  startMomentum[0] = posHit.GetStartMomentum()[0] / CLHEP::GeV;
57  startMomentum[1] = posHit.GetStartMomentum()[1] / CLHEP::GeV;
58  startMomentum[2] = posHit.GetStartMomentum()[2] / CLHEP::GeV;
59  startEnergy = posHit.GetStartEnergy() / CLHEP::GeV;
60 }
61 #endif
62 
63 /* ************************************ *
64  * Particle hits classes implementation *
65  * ************************************ */
66 
67 ClassImp(GGSTPartHitBase)
68 
70  : TObject(), eDep(0.), _posHits(nullptr), _posHitIndex(0) {}
71 
73  // Position hits array is managed externally (by GGSTClonesArrayService during the
74  // transient->persistent transformation in GGSHitsAction or by the TObjArray container
75  // during data readout). So it must not be destroyed here.
76 }
77 
78 void GGSTPartHitBase::Clear(Option_t *) {
79  eDep = 0.;
80  if (_posHits) {
81  _posHits->Clear("C");
82  }
83  _posHitIndex = 0;
84 }
85 
87  if (_posHits)
88  return (_posHits->GetEntries());
89  else
90  return 0;
91 }
92 
94  GGSTPosHitBase *hit = nullptr;
95  if (_posHits) {
96  hit = (GGSTPosHitBase *)(_posHits->At(iHit));
97  }
98  return hit;
99 }
100 
102  if (_posHits == nullptr) {
103  return "";
104  }
105  std::string retValue = _posHits->GetName();
106  return retValue.substr(0, retValue.size() - 1);
107 }
108 
109 ClassImp(GGSTPartHit)
110 
112  : GGSTPartHitBase(), time(0.), pathLength(0.), entranceEnergy(0.), trackID(-1), parentID(-2), particlePdg(0) {
113 
114  entrancePoint[0] = entrancePoint[1] = entrancePoint[2] = 0.;
115  exitPoint[0] = exitPoint[1] = exitPoint[2] = 0.;
116  entranceMomentum[0] = entranceMomentum[1] = entranceMomentum[2] = 0.;
117 }
118 
119 void GGSTPartHit::Clear(Option_t *opt) {
120  time = 0.;
121  pathLength = 0.;
122  entrancePoint[0] = entrancePoint[1] = entrancePoint[2] = 0.;
123  exitPoint[0] = exitPoint[1] = exitPoint[2] = 0.;
125  trackID = -1;
126  parentID = -2;
127  particlePdg = 0;
129 }
130 
131 #ifdef GGS_USE_G4
132 void GGSTPartHit::UserConversion(const GGSPartHit &partHit) {
133  time = partHit.GetTime() / CLHEP::ns;
134  pathLength = partHit.GetPathLength() / CLHEP::cm;
135  entrancePoint[0] = partHit.GetEntrancePoint()[0] / CLHEP::cm;
136  entrancePoint[1] = partHit.GetEntrancePoint()[1] / CLHEP::cm;
137  entrancePoint[2] = partHit.GetEntrancePoint()[2] / CLHEP::cm;
138  exitPoint[0] = partHit.GetExitPoint()[0] / CLHEP::cm;
139  exitPoint[1] = partHit.GetExitPoint()[1] / CLHEP::cm;
140  exitPoint[2] = partHit.GetExitPoint()[2] / CLHEP::cm;
141  entranceMomentum[0] = partHit.GetEntranceMomentum()[0] / CLHEP::GeV;
142  entranceMomentum[1] = partHit.GetEntranceMomentum()[1] / CLHEP::GeV;
143  entranceMomentum[2] = partHit.GetEntranceMomentum()[2] / CLHEP::GeV;
144  entranceEnergy = partHit.GetEntranceEnergy() / CLHEP::GeV;
145  trackID = partHit.GetTrackID();
146  parentID = partHit.GetParentID();
147  particlePdg = partHit.GetParticlePdg();
148 }
149 #endif
150 
151 /* ************************************** *
152  * Integrated hits classes implementation *
153  * ************************************** */
154 
155 ClassImp(GGSTIntHitBase)
156 
158  : TObject(), eDep(0.), eDepTimeBin(), _volumeIndex(0), _partHits(nullptr), _hitDetInfo(nullptr),
159  _hitVolInfo(nullptr), _timeBins(nullptr) {}
160 
162  // Particle hits array is managed externally (by GGSTClonesArrayService during the
163  // transient->persistent transformation in GGSHitsAction or by the TObjArray container
164  // during data readout). So it must not be destroyed here.
165 }
166 
167 void GGSTIntHitBase::Clear(Option_t *) {
168  eDep = 0.;
169  eDepTimeBin.Reset();
170  _volumeIndex = 0;
171  if (_partHits)
172  _partHits->Clear("C");
173 }
174 
176  if (_partHits)
177  return (_partHits->GetEntries());
178  else
179  return 0;
180 }
181 
183  GGSTPartHitBase *hit = nullptr;
184  if (_partHits) {
185  hit = (GGSTPartHitBase *)(_partHits->At(iHit));
186  }
187  return hit;
188 }
189 
191  if (_partHits == nullptr) {
192  return "";
193  }
194  std::string retValue = _partHits->GetName();
195  return retValue.substr(0, retValue.size() - 1);
196 }
197 
198 ClassImp(GGSTIntHit)
199 
201  : GGSTIntHitBase(), time(0) {}
202 
203 void GGSTIntHit::Clear(Option_t *opt) {
204  time = 0.;
206 }
207 
208 #ifdef GGS_USE_G4
209 void GGSTIntHit::UserConversion(const GGSIntHit &intHit) { time = intHit.GetTime() / CLHEP::ns; }
210 #endif
Float_t startMomentum[3]
Start momentum.
Definition: GGSTHits.h:76
G4double GetPathLength() const
Path length getter.
Definition: GGSPosHit.h:144
Float_t time
Time of the hit.
Definition: GGSTHits.h:72
GGSTPosHitBase * GetPosHit(unsigned int iHit)
Get the specified position hit.
Definition: GGSTHits.cpp:93
G4double GetStartEnergy() const
Start energy getter.
Definition: GGSPosHit.h:174
Float_t eDep
Deposited energy.
Definition: GGSTHits.h:109
Float_t pathLength
Path length of the hit.
Definition: GGSTHits.h:73
~GGSTPartHitBase()
Destructor.
Definition: GGSTHits.cpp:72
G4ThreeVector GetEntrancePoint() const
Entrance point getter.
Definition: GGSPartHit.h:168
GGSTPartHitBase * GetPartHit(unsigned int iHit)
Get the specified particle hit.
Definition: GGSTHits.cpp:182
Float_t startEnergy
Start kinetic energy.
Definition: GGSTHits.h:77
Float_t entranceEnergy
Entrance kinetic energy.
Definition: GGSTHits.h:183
G4ThreeVector GetStartPoint() const
Start point getter.
Definition: GGSPosHit.h:152
void Clear(Option_t *opt)
Resets the particle hit.
Definition: GGSTHits.cpp:203
Float_t entrancePoint[3]
Entrance point.
Definition: GGSTHits.h:180
Float_t time
Time of the hit.
Definition: GGSTHits.h:178
void Clear(Option_t *=nullptr)
Resets the data members.
Definition: GGSTHits.cpp:36
Float_t pathLength
Path length of the hit.
Definition: GGSTHits.h:179
void Clear(Option_t *opt)
Resets the particle hit.
Definition: GGSTHits.cpp:119
G4ThreeVector GetStartMomentum() const
Momentum getter.
Definition: GGSPosHit.h:168
G4double GetTime() const
Time getter.
Definition: GGSPartHit.h:154
Class to store G4 particle hits.
Definition: GGSTHits.h:176
Int_t trackID
GEANT4 track ID.
Definition: GGSTHits.h:184
Definition of GGS Particle Hit.
Definition: GGSPartHit.h:36
Float_t eDep
Total deposited energy.
Definition: GGSTHits.h:41
Definition of GGS Position Hit.
Definition: GGSPosHit.h:33
Base class for storing G4 particle hits.
Definition: GGSTHits.h:106
void Clear(Option_t *)
Resets the data members.
Definition: GGSTHits.cpp:24
G4int GetParentID() const
Parent's track ID getter.
Definition: GGSPartHit.h:204
Float_t time
Time of the hit (in ns).
Definition: GGSTHits.h:347
G4ThreeVector GetEndPoint() const
End point getter.
Definition: GGSPosHit.h:160
G4double GetTime() const
Time getter.
Definition: GGSIntHit.h:194
G4int GetParticlePdg() const
PDG code getter.
Definition: GGSPartHit.h:210
G4ThreeVector GetExitPoint() const
Exit point getter.
Definition: GGSPartHit.h:176
G4ThreeVector GetEntranceMomentum() const
Entrance momentum getter.
Definition: GGSPartHit.h:184
Float_t eDep
Deposited energy (transient).
Definition: GGSTHits.h:222
~GGSTIntHitBase()
Destructor.
Definition: GGSTHits.cpp:161
G4double GetPathLength() const
Path length getter.
Definition: GGSPartHit.h:160
Class to store G4 position hits.
Definition: GGSTHits.h:70
Class to store G4 integrated hits.
Definition: GGSTHits.h:345
void Clear(Option_t *opt)
Resets the data members.
Definition: GGSTHits.cpp:78
G4int GetTrackID() const
Track ID getter.
Definition: GGSPartHit.h:198
Int_t particlePdg
Particle PDG ID.
Definition: GGSTHits.h:186
Definition of GGS Integrated Hit.
Definition: GGSIntHit.h:32
Int_t GetNPosHits()
Prints members values on standard output.
Definition: GGSTHits.cpp:86
Float_t startPoint[3]
Start point.
Definition: GGSTHits.h:74
std::string GetPartHitsClassName()
Gets the name of the class of the particle hits.
Definition: GGSTHits.cpp:190
void Clear(Option_t *)
Resets the data members.
Definition: GGSTHits.cpp:167
Float_t exitPoint[3]
Exit point.
Definition: GGSTHits.h:181
std::string GetPosHitsClassName()
Gets the name of the class of the position hits.
Definition: GGSTHits.cpp:101
G4double GetEntranceEnergy() const
Entrance energy getter.
Definition: GGSPartHit.h:192
Base class for storing G4 position hits.
Definition: GGSTHits.h:38
TArrayF eDepTimeBin
Energy deposit in each time bin.
Definition: GGSTHits.h:223
Int_t GetNPartHits()
Gets the number of particle hits.
Definition: GGSTHits.cpp:175
G4double GetTime() const
Time getter.
Definition: GGSPosHit.h:138
Base class for storing G4 integrated hits.
Definition: GGSTHits.h:218
Int_t parentID
GEANT4 parent ID.
Definition: GGSTHits.h:185
Float_t entranceMomentum[3]
Entrance momentum.
Definition: GGSTHits.h:182
Float_t endPoint[3]
End point.
Definition: GGSTHits.h:75