Geant4 VMC
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
source
physics
src
TG4VSpecialCuts.cxx
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
14
15
#include "
TG4VSpecialCuts.h
"
16
#include "
TG4G3CutVector.h
"
17
#include "
TG4GeometryServices.h
"
18
#include "
TG4Limits.h
"
19
#include "
TG4TrackInformation.h
"
20
#include "
TG4TrackManager.h
"
21
22
#include <G4EnergyLossTables.hh>
23
#include <G4LossTableManager.hh>
24
#include <G4PhysicalConstants.hh>
25
#include <G4TransportationProcessType.hh>
26
#include <G4UserLimits.hh>
27
28
//_____________________________________________________________________________
29
TG4VSpecialCuts::TG4VSpecialCuts
(
const
G4String& processName)
30
:
G4VProcess
(processName, fUserDefined),
31
fLossTableManager
(G4LossTableManager::Instance()),
32
fTrackManager
(
TG4TrackManager
::Instance())
33
{
35
36
SetProcessSubType(USER_SPECIAL_CUTS);
37
}
38
39
//_____________________________________________________________________________
40
TG4VSpecialCuts::~TG4VSpecialCuts
()
41
{
43
}
44
45
//
46
// public methods
47
//
48
49
//_____________________________________________________________________________
50
G4double
TG4VSpecialCuts::PostStepGetPhysicalInteractionLength
(
51
const
G4Track& track, G4double
/*previousStepSize*/
,
52
G4ForceCondition* condition)
53
{
56
57
// set condition
58
*condition = NotForced;
59
G4double proposedStep = DBL_MAX;
60
61
// get limits
62
#ifdef MCDEBUG
63
TG4Limits
* limits =
TG4GeometryServices::Instance
()->
GetLimits
(
64
track.GetVolume()->GetLogicalVolume()->GetUserLimits());
65
#else
66
TG4Limits
* limits =
67
(
TG4Limits
*)track.GetVolume()->GetLogicalVolume()->GetUserLimits();
68
#endif
69
70
if
(!limits)
return
proposedStep;
71
72
// tracks flagged to stop
73
TG4TrackInformation
* trackInformation =
74
fTrackManager
->GetTrackInformation(&track);
75
if
(trackInformation && trackInformation->
IsStop
()) {
76
return
0.;
77
}
78
79
// min kinetic energy (from limits)
80
G4double minEkine =
GetMinEkine
(*limits, track);
81
if
(track.GetKineticEnergy() <= minEkine)
return
0.;
82
83
// max track length
84
proposedStep =
85
(limits->GetUserMaxTrackLength(track) - track.GetTrackLength());
86
if
(proposedStep < 0.)
return
0.;
87
88
// max time limit
89
G4double tlimit = limits->GetUserMaxTime(track);
90
if
(tlimit < DBL_MAX) {
91
G4double beta = (track.GetDynamicParticle()->GetTotalMomentum()) /
92
(track.GetTotalEnergy());
93
G4double dTime = (tlimit - track.GetGlobalTime());
94
G4double temp = beta * c_light * dTime;
95
if
(temp < 0.) {
96
return
0.;
97
}
98
if
(proposedStep > temp) {
99
proposedStep = temp;
100
}
101
}
102
103
// min remaining range
104
// (only for charged particle except for chargedGeantino)
105
G4double rmin = limits->GetUserMinRange(track);
106
if
(rmin > DBL_MIN) {
107
G4ParticleDefinition
* particle = track.GetDefinition();
108
if
((particle->GetPDGCharge() != 0.) && (particle->GetPDGMass() > 0.0)) {
109
G4double ekin = track.GetKineticEnergy();
110
const
G4MaterialCutsCouple* couple = track.GetMaterialCutsCouple();
111
G4double rangeNow =
fLossTableManager
->GetRange(particle, ekin, couple);
112
G4double temp = rangeNow - rmin;
113
if
(temp < 0.) {
114
return
0.;
115
}
116
if
(proposedStep > temp) {
117
proposedStep = temp;
118
}
119
}
120
}
121
return
proposedStep;
122
}
123
124
//_____________________________________________________________________________
125
G4VParticleChange*
TG4VSpecialCuts::PostStepDoIt
(
126
const
G4Track& track,
const
G4Step&
/*step*/
)
127
{
131
132
aParticleChange.Initialize(track);
133
aParticleChange.ProposeEnergy(0.);
134
aParticleChange.ProposeLocalEnergyDeposit(track.GetKineticEnergy());
135
aParticleChange.ProposeTrackStatus(fStopButAlive);
136
return
&aParticleChange;
137
}
TG4G3CutVector.h
Definition of the TG4G3CutVector class.
TG4GeometryServices.h
Definition of the TG4GeometryServices class.
TG4Limits.h
Definition of the TG4Limits class.
TG4TrackInformation.h
Definition of the TG4TrackInformation class.
TG4TrackManager.h
Definition of the TG4TrackManager class.
TG4VSpecialCuts.h
Definition of the TG4VSpecialCuts class.
G4ParticleDefinition
G4VProcess
TG4GeometryServices::Instance
static TG4GeometryServices * Instance()
Definition
TG4GeometryServices.h:169
TG4GeometryServices::GetLimits
TG4Limits * GetLimits(G4UserLimits *limits) const
Definition
TG4GeometryServices.cxx:750
TG4Limits
Extended G4UserLimits class.
Definition
TG4Limits.h:38
TG4TrackInformation
Defines additional track information.
Definition
TG4TrackInformation.h:31
TG4TrackInformation::IsStop
G4bool IsStop() const
TG4TrackManager
The class for storing G4 tracks in VMC sack.
Definition
TG4TrackManager.h:53
TG4VSpecialCuts::~TG4VSpecialCuts
virtual ~TG4VSpecialCuts()
Definition
TG4VSpecialCuts.cxx:40
TG4VSpecialCuts::GetMinEkine
virtual G4double GetMinEkine(const TG4Limits &limits, const G4Track &track) const =0
Return the kinetic energy limit.
TG4VSpecialCuts::fTrackManager
TG4TrackManager * fTrackManager
Cached pointer to thread-local track manager.
Definition
TG4VSpecialCuts.h:92
TG4VSpecialCuts::fLossTableManager
G4LossTableManager * fLossTableManager
The G4LossTableManager instance.
Definition
TG4VSpecialCuts.h:89
TG4VSpecialCuts::PostStepGetPhysicalInteractionLength
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
Definition
TG4VSpecialCuts.cxx:50
TG4VSpecialCuts::PostStepDoIt
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &step)
Definition
TG4VSpecialCuts.cxx:125
TG4VSpecialCuts::TG4VSpecialCuts
TG4VSpecialCuts()
Not implemented.
Generated on
for Geant4 VMC by
1.17.0