ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4ErrorTrackLengthTarget.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4ErrorTrackLengthTarget.cc
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
27
// ------------------------------------------------------------
28
// GEANT 4 class implementation file
29
// ------------------------------------------------------------
30
//
31
32
#include "
G4ErrorTrackLengthTarget.hh
"
33
34
#include "
G4ParticleTable.hh
"
35
#include "
G4ParticleDefinition.hh
"
36
#include "
G4VProcess.hh
"
37
#include "
G4ProcessVector.hh
"
38
#include "
G4ProcessManager.hh
"
39
40
#ifdef G4VERBOSE
41
#include "
G4ErrorPropagatorData.hh
"
//for verbosity checking
42
#endif
43
44
//----------------------------------------------------------------------------
45
G4ErrorTrackLengthTarget::
46
G4ErrorTrackLengthTarget
(
const
G4double
maxTrkLength )
47
:
G4VDiscreteProcess
(
"G4ErrorTrackLengthTarget"
),
48
theMaximumTrackLength( maxTrkLength )
49
{
50
theType
=
G4ErrorTarget_TrkL
;
51
52
G4ParticleTable::G4PTblDicIterator
*
theParticleIterator
53
=
G4ParticleTable::GetParticleTable
()->
GetIterator
();
54
55
// loop over all particles in G4ParticleTable
56
57
theParticleIterator->
reset
();
58
while
( (*theParticleIterator)() )
// Loop checking, 06.08.2015, G.Cosmo
59
{
60
G4ParticleDefinition
*
particle
= theParticleIterator->
value
();
61
G4ProcessManager
* pmanager = particle->
GetProcessManager
();
62
if
(!particle->
IsShortLived
())
63
{
64
// Add transportation process for all particles other than "shortlived"
65
if
( pmanager == 0)
66
{
67
// Error !! no process manager
68
G4String
particleName = particle->
GetParticleName
();
69
G4Exception
(
"G4ErrorTrackLengthTarget::G4ErrorTrackLengthTarget"
,
70
"No process manager"
,
RunMustBeAborted
, particleName );
71
}
72
else
73
{
74
G4ProcessVector
* procvec = pmanager->
GetProcessList
();
75
size_t
isiz = procvec->
size
();
76
77
for
(
size_t
ii=0; ii < isiz; ii++ )
78
{
79
if
( ((*procvec)[ii])->
GetProcessName
() ==
"G4ErrorTrackLengthTarget"
)
80
{
81
pmanager->
RemoveProcess
( (*procvec)[ii] );
82
}
83
}
84
pmanager ->
AddDiscreteProcess
(
this
,4);
85
isiz = procvec->
size
();
86
}
87
}
88
else
89
{
90
// shortlived particle case
91
}
92
}
93
}
94
95
96
//-----------------------------------------------------------------------
97
G4double
G4ErrorTrackLengthTarget::
98
PostStepGetPhysicalInteractionLength
(
const
G4Track
&
track
,
G4double
,
99
G4ForceCondition
*
condition
)
100
{
101
*condition =
NotForced
;
102
return
GetMeanFreePath
( track, 0., condition );
103
}
104
105
106
//-----------------------------------------------------------------------
107
G4double
G4ErrorTrackLengthTarget::
108
GetMeanFreePath
(
const
class
G4Track
&
track
,
G4double
,
enum
G4ForceCondition
*)
109
{
110
#ifdef G4VERBOSE
111
if
(
G4ErrorPropagatorData::verbose
() >= 3 )
112
{
113
G4cout
<<
" G4ErrorTrackLengthTarget::GetMeanFreePath "
114
<<
theMaximumTrackLength
- track.
GetTrackLength
() <<
G4endl
;
115
}
116
#endif
117
118
return
theMaximumTrackLength
- track.
GetTrackLength
();
119
}
120
121
122
G4VParticleChange
*
G4ErrorTrackLengthTarget::
123
PostStepDoIt
(
const
G4Track
& aTrack,
const
G4Step
& )
124
{
125
theParticleChange
.
Initialize
(aTrack);
126
return
&
theParticleChange
;
127
}
128
129
130
//-----------------------------------------------------------------------
131
void
G4ErrorTrackLengthTarget::Dump
(
const
G4String
& msg )
const
132
{
133
G4cout
<< msg <<
"G4ErrorTrackLengthTarget: max track length = "
134
<<
theMaximumTrackLength
<<
G4endl
;
135
}
geant4
tree
geant4-10.6-release
source
error_propagation
src
G4ErrorTrackLengthTarget.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:13
using
1.8.2 with
ECCE GitHub integration