Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TGeant4.icc
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4// All rights reserved.
5//
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
9
10/// \file TGeant4.icc
11/// \brief Implementation of the inline functions for the TGeant4
12/// class
13///
14/// \author I. Hrivnacova; IPN Orsay
15
16#include "TG4Globals.h"
17#include "TG4StepManager.h"
18
19#include <G4Threading.hh>
20
21//
22// methods for step management
23//
24
25//_____________________________________________________________________________
26inline TGeant4* TGeant4::MasterInstance() { return fgMasterInstance; }
27
28//_____________________________________________________________________________
29inline TVirtualMCApplication* TGeant4::MasterApplicationInstance()
30{
31 return fgMasterApplicationInstance;
32}
33
34//_____________________________________________________________________________
35inline void TGeant4::StopTrack()
36{
37 /// Stop track
38
39 fStepManager->StopTrack();
40}
41
42//_____________________________________________________________________________
43inline void TGeant4::InterruptTrack()
44{
45 /// Interrupt track
46
47 fStepManager->InterruptTrack();
48}
49
50//_____________________________________________________________________________
51inline void TGeant4::StopEvent()
52{
53 /// Aborts the current event processing.
54
55 fStepManager->StopEvent();
56}
57
58//_____________________________________________________________________________
59inline void TGeant4::StopRun()
60{
61 /// Aborts the current run processing.
62
63 fStepManager->StopRun();
64}
65
66//_____________________________________________________________________________
67inline void TGeant4::SetMaxStep(Double_t step)
68{
69 /// Sets the maximum step allowed in the current logical volume.
70
71 fStepManager->SetMaxStep(step);
72}
73
74//_____________________________________________________________________________
75inline void TGeant4::SetMaxNStep(Int_t number)
76{
77 /// Sets the maximum number of steps.
78
79 fStepManager->SetMaxNStep(number);
80}
81
82//_____________________________________________________________________________
83inline void TGeant4::ForceDecayTime(Float_t time)
84{
85 /// Force decay time. \n Not yet implemented.
86
87 fStepManager->ForceDecayTime(time);
88}
89
90//_____________________________________________________________________________
91inline Int_t TGeant4::CurrentVolID(Int_t& copyNo) const
92{
93 /// Return the current sensitive detector ID
94 /// and the copy number of the current physical volume.
95
96 return fStepManager->CurrentVolID(copyNo);
97}
98
99//_____________________________________________________________________________
100inline Int_t TGeant4::CurrentVolOffID(Int_t off, Int_t& copyNo) const
101{
102 /// Returns the off-th mother's of the current volume
103 /// the sensitive detector ID and the copy number.
104
105 return fStepManager->CurrentVolOffID(off, copyNo);
106}
107
108//_____________________________________________________________________________
109inline const char* TGeant4::CurrentVolName() const
110{
111 /// Returns the current physical volume name.
112
113 return fStepManager->CurrentVolName();
114}
115
116//_____________________________________________________________________________
117inline const char* TGeant4::CurrentVolOffName(Int_t off) const
118{
119 /// Returns the off-th mother's physical volume name.
120
121 return fStepManager->CurrentVolOffName(off);
122}
123
124//_____________________________________________________________________________
125inline const char* TGeant4::CurrentVolPath()
126{
127 /// Returns the current volume path.
128
129 return fStepManager->CurrentVolPath();
130}
131
132//_____________________________________________________________________________
133inline Bool_t TGeant4::CurrentBoundaryNormal(
134 Double_t& x, Double_t& y, Double_t& z) const
135{
136 /// Returns the normal vector of the surface of the last volume exited
137
138 return fStepManager->CurrentBoundaryNormal(x, y, z);
139}
140
141//_____________________________________________________________________________
142inline Int_t TGeant4::CurrentMaterial(
143 Float_t& a, Float_t& z, Float_t& dens, Float_t& radl, Float_t& absl) const
144{
145 /// Returns the parameters of the current material during transport;
146 /// the return value is the number of elements in the mixture.
147
148 return fStepManager->CurrentMaterial(a, z, dens, radl, absl);
149}
150
151//_____________________________________________________________________________
152inline Int_t TGeant4::CurrentMedium() const
153{
154 /// Returns the second index of the current material (corresponding to
155 /// G3 tracking medium index).
156
157 return fStepManager->CurrentMedium();
158}
159
160//_____________________________________________________________________________
161inline Int_t TGeant4::GetMedium() const
162{
163 /// Returns the second index of the current material (corresponding to
164 /// G3 tracking medium index).
165
166 TG4Globals::Warning("TGeant4", "GetMedium",
167 "Deprecated function - use CurrentMedium() instead");
168
169 return CurrentMedium();
170}
171
172//_____________________________________________________________________________
173inline void TGeant4::Gmtod(Float_t* xm, Float_t* xd, Int_t iflag)
174{
175 /// Transforms a position from the world reference frame
176 /// to the current volume reference frame.
177
178 fStepManager->Gmtod(xm, xd, iflag);
179}
180
181//_____________________________________________________________________________
182inline void TGeant4::Gmtod(Double_t* xm, Double_t* xd, Int_t iflag)
183{
184 /// Transforms a position from the world reference frame
185 /// to the current volume reference frame.
186
187 fStepManager->Gmtod(xm, xd, iflag);
188}
189
190//_____________________________________________________________________________
191inline void TGeant4::Gdtom(Float_t* xd, Float_t* xm, Int_t iflag)
192{
193 /// Transforms a position from the current volume reference frame
194 /// to the world reference frame.
195
196 fStepManager->Gdtom(xd, xm, iflag);
197}
198
199//_____________________________________________________________________________
200inline void TGeant4::Gdtom(Double_t* xd, Double_t* xm, Int_t iflag)
201{
202 /// Transforms a position from the current volume reference frame
203 /// to the world reference frame.
204
205 fStepManager->Gdtom(xd, xm, iflag);
206}
207
208//_____________________________________________________________________________
209inline Double_t TGeant4::MaxStep() const
210{
211 /// Returns the maximum step allowed in the current logical volume
212 /// by user limits.
213
214 return fStepManager->MaxStep();
215}
216
217//_____________________________________________________________________________
218inline Int_t TGeant4::GetMaxNStep() const
219{
220 /// Returns the maximum number of steps.
221
222 return fStepManager->GetMaxNStep();
223}
224
225//_____________________________________________________________________________
226inline void TGeant4::TrackPosition(TLorentzVector& position) const
227{
228 /// The current particle position (in the world reference frame)
229 /// and the local time since the current track is created
230 /// (position of the PostStepPoint).
231
232 fStepManager->TrackPosition(position);
233}
234
235//_____________________________________________________________________________
236inline void TGeant4::TrackPosition(Double_t& x, Double_t& y, Double_t& z) const
237{
238 /// The current particle position (in the world reference frame)
239 /// and the local time since the current track is created
240 /// (position of the PostStepPoint).
241
242 fStepManager->TrackPosition(x, y, z);
243}
244
245//_____________________________________________________________________________
246inline void TGeant4::TrackPosition(Float_t& x, Float_t& y, Float_t& z) const
247{
248 /// The current particle position (in the world reference frame)
249 /// and the local time since the current track is created
250 /// (position of the PostStepPoint) as float.
251
252 fStepManager->TrackPosition(x, y, z);
253}
254
255//_____________________________________________________________________________
256inline void TGeant4::TrackMomentum(TLorentzVector& momentum) const
257{
258 /// The current particle "momentum" (px, py, pz, Etot).
259
260 fStepManager->TrackMomentum(momentum);
261}
262
263//_____________________________________________________________________________
264inline void TGeant4::TrackMomentum(
265 Double_t& px, Double_t& py, Double_t& pz, Double_t& etot) const
266{
267 /// The current particle "momentum" (px, py, pz, Etot).
268
269 fStepManager->TrackMomentum(px, py, pz, etot);
270}
271
272//_____________________________________________________________________________
273inline void TGeant4::TrackMomentum(
274 Float_t& px, Float_t& py, Float_t& pz, Float_t& etot) const
275{
276 /// The current particle "momentum" (px, py, pz, Etot) as float.
277
278 fStepManager->TrackMomentum(px, py, pz, etot);
279}
280
281//_____________________________________________________________________________
282inline Double_t TGeant4::TrackStep() const
283{
284 /// Returns the current step length.
285
286 return fStepManager->TrackStep();
287}
288
289//_____________________________________________________________________________
290inline Double_t TGeant4::TrackLength() const
291{
292 /// Returns the length of the current track from its origin.
293
294 return fStepManager->TrackLength();
295}
296
297//_____________________________________________________________________________
298inline Double_t TGeant4::TrackTime() const
299{
300 /// Returns the local time since the current track is created. \n Comment: in
301 /// Geant4: there is also defined proper time as the proper time of the
302 /// dynamical particle of the current track.
303
304 return fStepManager->TrackTime();
305}
306
307//_____________________________________________________________________________
308inline Double_t TGeant4::Edep() const
309{
310 /// Returns the total energy deposit in this step.
311
312 return fStepManager->Edep();
313}
314
315//_____________________________________________________________________________
316inline Double_t TGeant4::NIELEdep() const
317{
318 /// Returns the total energy deposit in this step.
319
320 return fStepManager->NIELEdep();
321}
322
323//_____________________________________________________________________________
324inline Int_t TGeant4::StepNumber() const
325{
326 /// Returns the current step number.
327
328 return fStepManager->StepNumber();
329}
330
331//_____________________________________________________________________________
332inline Double_t TGeant4::TrackWeight() const
333{
334 /// Returns the current weight.
335
336 return fStepManager->TrackWeight();
337}
338
339//_____________________________________________________________________________
340inline void TGeant4::TrackPolarization(
341 Double_t& polX, Double_t& polY, Double_t& polZ) const
342{
343 /// Returns the current polarization.
344
345 fStepManager->TrackPolarization(polX, polY, polZ);
346}
347
348//_____________________________________________________________________________
349inline void TGeant4::TrackPolarization(TVector3& pol) const
350{
351 /// Returns the current polarization.
352
353 fStepManager->TrackPolarization(pol);
354}
355
356//_____________________________________________________________________________
357inline Int_t TGeant4::TrackPid() const
358{
359 /// Returns the current particle PDG encoding.
360
361 return fStepManager->TrackPid();
362}
363
364//_____________________________________________________________________________
365inline Double_t TGeant4::TrackCharge() const
366{
367 /// Returns the current particle charge.
368
369 return fStepManager->TrackCharge();
370}
371
372//_____________________________________________________________________________
373inline Double_t TGeant4::TrackMass() const
374{
375 /// Returns the current particle mass at rest.
376
377 return fStepManager->TrackMass();
378}
379
380//_____________________________________________________________________________
381inline Double_t TGeant4::Etot() const
382{
383 /// Returns the total energy of the current particle.
384
385 return fStepManager->Etot();
386}
387
388//_____________________________________________________________________________
389inline Bool_t TGeant4::IsTrackInside() const
390{
391 /// Returns true if the particle does not cross a geometrical boundary
392 /// and is not in the vertex.
393
394 return fStepManager->IsTrackInside();
395}
396
397//_____________________________________________________________________________
398inline Bool_t TGeant4::IsTrackEntering() const
399{
400 /// Returns true if the particle crosses a geometrical boundary
401 /// or is in the vertex.
402
403 return fStepManager->IsTrackEntering();
404}
405
406//_____________________________________________________________________________
407inline Bool_t TGeant4::IsTrackExiting() const
408{
409 /// Returns true if the particle crosses a geometrical boundary.
410
411 return fStepManager->IsTrackExiting();
412}
413
414//_____________________________________________________________________________
415inline Bool_t TGeant4::IsTrackOut() const
416{
417 /// Returns true if the particle crosses the world boundary
418 /// at the post-step point.
419
420 return fStepManager->IsTrackOut();
421}
422
423//_____________________________________________________________________________
424inline Bool_t TGeant4::IsTrackDisappeared() const
425{
426 /// Returns true if particle has disappeared
427 /// (due to any physical process)
428 /// or has been killed, suspended or postponed to next event.
429
430 return fStepManager->IsTrackDisappeared();
431}
432
433//_____________________________________________________________________________
434inline Bool_t TGeant4::IsTrackStop() const
435{
436 /// Returns true if the particle has stopped
437 /// or has been killed, suspended or postponed to the next event.
438
439 return fStepManager->IsTrackStop();
440}
441
442//_____________________________________________________________________________
443inline Bool_t TGeant4::IsTrackAlive() const
444{
445 /// Returns true if particle continues tracking.
446
447 return fStepManager->IsTrackAlive();
448}
449
450//_____________________________________________________________________________
451inline Bool_t TGeant4::IsNewTrack() const
452{
453 /// Returns true when the track performs the first step.
454
455 return fStepManager->IsNewTrack();
456}
457
458//_____________________________________________________________________________
459inline Int_t TGeant4::NSecondaries() const
460{
461 /// Returns the number of secondary particles generated
462 /// in the current step.
463
464 return fStepManager->NSecondaries();
465}
466
467//_____________________________________________________________________________
468inline void TGeant4::GetSecondary(Int_t isec, Int_t& particleId,
469 TLorentzVector& position, TLorentzVector& momentum)
470{
471 /// Fills the parameters (particle encoding, position, momentum)
472 /// of the generated secondary particle which is specified by index.
473
474 fStepManager->GetSecondary(isec, particleId, position, momentum);
475}
476
477//_____________________________________________________________________________
478inline TMCProcess TGeant4::ProdProcess(Int_t isec) const
479{
480 /// Returns the process that has produced the secondary particles specified
481 /// with isec index in the current step.
482
483 return fStepManager->ProdProcess(isec);
484}
485
486//_____________________________________________________________________________
487inline Int_t TGeant4::StepProcesses(TArrayI& proc) const
488{
489 /// Fills the array of processes that were active in the current step
490 /// and returns the number of them.
491
492 return fStepManager->StepProcesses(proc);
493}
494
495//_____________________________________________________________________________
496inline Bool_t TGeant4::IsMT() const
497{
498 /// Returns true if Geant4 is built in multi-threading mode and
499 /// MT mode is not inactivated in runConfiguration.
500
501 return fIsMT;
502}