Geant4
11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UCNMultiScattering.cc
Go to the documentation of this file.
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
// UCN Multiple Scattering Class Implementation
29
///////////////////////////////////////////////////////////////////////
30
//
31
// File: G4UCNMultiScattering.cc
32
// Description: G4VDiscreteProcess -- MultiScattering of UCNs
33
// Version: 1.0
34
// Created: 2014-05-12
35
// Author: Peter Gumplinger
36
// adopted from Geant4UCN by Peter Fierlinger (7.9.04) and
37
// Marcin Kuzniak (21.4.06)
38
// Calculate "elastic scattering" inside materials
39
// Updated:
40
//
41
// mail:
[email protected]
42
//
43
///////////////////////////////////////////////////////////////////////
44
45
#include "
G4UCNProcessSubType.hh
"
46
47
#include "
G4UCNMultiScattering.hh
"
48
49
#include "
G4SystemOfUnits.hh
"
50
#include "
G4PhysicalConstants.hh
"
51
52
/////////////////////////
53
// Class Implementation
54
/////////////////////////
55
56
//////////////
57
// Operators
58
//////////////
59
60
// G4UCNMultiScattering::operator=(const G4UCNMultiScattering &right)
61
// {
62
// }
63
64
/////////////////
65
// Constructors
66
/////////////////
67
68
G4UCNMultiScattering::G4UCNMultiScattering
(
const
G4String
& processName,
69
G4ProcessType
type)
70
:
G4VDiscreteProcess
(processName, type)
71
{
72
if
(
verboseLevel
>0)
G4cout
<<
GetProcessName
() <<
" is created "
<<
G4endl
;
73
74
SetProcessSubType
(
fUCNMultiScattering
);
75
}
76
77
// G4UCNMultiScattering::G4UCNMultiScattering(const G4UCNMultiScattering &right)
78
// {
79
// }
80
81
////////////////
82
// Destructors
83
////////////////
84
85
G4UCNMultiScattering::~G4UCNMultiScattering
(){}
86
87
////////////
88
// Methods
89
////////////
90
91
// PostStepDoIt
92
// ------------
93
94
G4VParticleChange
*
95
G4UCNMultiScattering::PostStepDoIt
(
const
G4Track
& aTrack,
const
G4Step
& aStep)
96
{
97
aParticleChange
.
Initialize
(aTrack);
98
99
if
(
verboseLevel
> 0 )
G4cout
<<
"UCNMULTISCATTER at: "
100
<< aTrack.
GetProperTime
()/s <<
"s, "
101
<< aTrack.
GetGlobalTime
()/s <<
"s. "
102
<<
", after track length "
<< aTrack.
GetTrackLength
()/cm <<
"cm, "
103
<<
"in volume "
104
<< aStep.
GetPostStepPoint
()->
GetPhysicalVolume
()->
GetName
()
105
<<
G4endl
;
106
107
G4ThreeVector
scattered =
Scatter
();
108
109
aParticleChange
.
ProposeMomentumDirection
(-scattered);
110
111
return
G4VDiscreteProcess::PostStepDoIt
(aTrack, aStep);
112
}
113
114
// GetMeanFreePath
115
// ---------------
116
117
G4double
G4UCNMultiScattering::GetMeanFreePath
(
const
G4Track
& aTrack,
118
G4double
,
119
G4ForceCondition
*)
120
{
121
G4double
AttenuationLength =
DBL_MAX
;
122
123
const
G4Material
* aMaterial = aTrack.
GetMaterial
();
124
G4MaterialPropertiesTable
* aMaterialPropertiesTable =
125
aMaterial->
GetMaterialPropertiesTable
();
126
127
G4double
crossect = 0.0;
128
if
(aMaterialPropertiesTable) {
129
crossect = aMaterialPropertiesTable->
GetConstProperty
(
"SCATCS"
);
130
// if(crossect == 0.0)
131
// G4cout << "No UCN MultiScattering length specified" << G4endl;
132
}
133
// else G4cout << "No UCN MultiScattering length specified" << G4endl;
134
135
if
(crossect) {
136
137
// Calculate a UCN MultiScattering length for this cross section
138
139
G4double
density = aMaterial->
GetTotNbOfAtomsPerVolume
();
140
141
crossect *= barn;
142
143
// attenuation length in mm
144
AttenuationLength = 1./density/crossect;
145
}
146
147
return
AttenuationLength;
148
}
149
150
G4ThreeVector
G4UCNMultiScattering::Scatter
()
151
{
152
153
G4ThreeVector
final
(0.,0.,1.);
154
155
// Make a simple uniform distribution in 4 pi
156
// apply scattering, calculate angle phi, theta
157
158
G4double
theta = std::acos(2*
G4UniformRand
()-1);
159
G4double
phi =
G4UniformRand
() * 2 * pi;
160
161
final
.rotateY(theta);
162
final
.rotateZ(phi);
163
final
=
final
.unit();
164
165
return
final
;
166
}
G4ForceCondition
G4ForceCondition
Definition
G4ForceCondition.hh:41
G4PhysicalConstants.hh
G4ProcessType
G4ProcessType
Definition
G4ProcessType.hh:38
G4SystemOfUnits.hh
G4double
double G4double
Definition
G4Types.hh:83
G4UCNMultiScattering.hh
G4UCNProcessSubType.hh
fUCNMultiScattering
@ fUCNMultiScattering
Definition
G4UCNProcessSubType.hh:48
G4endl
#define G4endl
Definition
G4ios.hh:67
G4cout
G4GLOB_DLL std::ostream G4cout
G4UniformRand
#define G4UniformRand()
Definition
Randomize.hh:52
CLHEP::Hep3Vector
Definition
ThreeVector.h:36
G4MaterialPropertiesTable
Definition
G4MaterialPropertiesTable.hh:60
G4MaterialPropertiesTable::GetConstProperty
G4double GetConstProperty(const G4String &key) const
Definition
G4MaterialPropertiesTable.cc:229
G4Material
Definition
G4Material.hh:117
G4Material::GetMaterialPropertiesTable
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition
G4Material.hh:233
G4Material::GetTotNbOfAtomsPerVolume
G4double GetTotNbOfAtomsPerVolume() const
Definition
G4Material.hh:197
G4ParticleChange::Initialize
void Initialize(const G4Track &) override
Definition
G4ParticleChange.cc:107
G4ParticleChange::ProposeMomentumDirection
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4StepPoint::GetPhysicalVolume
G4VPhysicalVolume * GetPhysicalVolume() const
G4Step
Definition
G4Step.hh:62
G4Step::GetPostStepPoint
G4StepPoint * GetPostStepPoint() const
G4String
Definition
G4String.hh:62
G4Track
Definition
G4Track.hh:67
G4Track::GetTrackLength
G4double GetTrackLength() const
G4Track::GetGlobalTime
G4double GetGlobalTime() const
G4Track::GetProperTime
G4double GetProperTime() const
G4Track::GetMaterial
G4Material * GetMaterial() const
G4UCNMultiScattering::~G4UCNMultiScattering
virtual ~G4UCNMultiScattering()
Definition
G4UCNMultiScattering.cc:85
G4UCNMultiScattering::PostStepDoIt
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
Definition
G4UCNMultiScattering.cc:95
G4UCNMultiScattering::G4UCNMultiScattering
G4UCNMultiScattering(const G4String &processName="UCNMultiScattering", G4ProcessType type=fUCN)
Definition
G4UCNMultiScattering.cc:68
G4UCNMultiScattering::GetMeanFreePath
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *condition)
Definition
G4UCNMultiScattering.cc:117
G4UCNMultiScattering::Scatter
G4ThreeVector Scatter()
Definition
G4UCNMultiScattering.cc:150
G4VDiscreteProcess
Definition
G4VDiscreteProcess.hh:46
G4VDiscreteProcess::PostStepDoIt
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
Definition
G4VDiscreteProcess.cc:120
G4VParticleChange
Definition
G4VParticleChange.hh:69
G4VPhysicalVolume::GetName
const G4String & GetName() const
G4VProcess::aParticleChange
G4ParticleChange aParticleChange
Definition
G4VProcess.hh:331
G4VProcess::verboseLevel
G4int verboseLevel
Definition
G4VProcess.hh:360
G4VProcess::SetProcessSubType
void SetProcessSubType(G4int)
Definition
G4VProcess.hh:410
G4VProcess::GetProcessName
const G4String & GetProcessName() const
Definition
G4VProcess.hh:386
DBL_MAX
#define DBL_MAX
Definition
templates.hh:62
geant4-v11.2.2
source
processes
hadronic
processes
src
G4UCNMultiScattering.cc
Generated by
1.12.0