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
G4ParticleHPContAngularPar.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4ParticleHPContAngularPar.hh
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
// 080718 Add ClearHistories method and related class member
29
//
30
// P. Arce, June-2014 Conversion neutron_hp to particle_hp
31
//
32
#ifndef G4ParticleHPContAngularPar_h
33
#define G4ParticleHPContAngularPar_h 1
34
35
#include <fstream>
36
#include <set>
37
38
#include "
G4ios.hh
"
39
#include "
globals.hh
"
40
#include "
G4ParticleHPList.hh
"
41
#include "
G4ReactionProduct.hh
"
42
#include "
G4ParticleHPInterpolator.hh
"
43
#include "
G4InterpolationManager.hh
"
44
#include "
G4Cache.hh
"
45
46
class
G4ParticleDefinition
;
47
48
class
G4ParticleHPContAngularPar
49
{
50
51
struct
toBeCached
52
{
53
G4bool
fresh
;
54
G4double
currentMeanEnergy
;
55
G4double
remaining_energy
;
56
G4double
theTargetCode
;
57
G4ReactionProduct
*
theTarget
;
58
G4ReactionProduct
*
thePrimary
;
59
toBeCached
()
60
:
fresh
(
true
),
currentMeanEnergy
(-2.0),
remaining_energy
(0.0),
61
theTargetCode
(-1.0),
theTarget
(0),
thePrimary
(0) {}
62
};
63
64
public
:
65
66
G4ParticleHPContAngularPar
()
67
{
68
theAngular
= 0;
69
//currentMeanEnergy = -2;
70
//fresh = true;
71
fCache
.
Put
(0);
72
theMinEner
=
DBL_MAX
;
73
theMaxEner
= -
DBL_MAX
;
74
theEnergy
= -1;
75
nEnergies
= -1;
76
nDiscreteEnergies
= -1;
77
nAngularParameters
= -1;
78
theProjectile
= 0;
79
adjustResult
=
true
;
80
}
81
82
G4ParticleHPContAngularPar
(
G4ParticleDefinition
* projectile);
83
84
~G4ParticleHPContAngularPar
()
85
{
86
if
(
theAngular
!=0 )
delete
[]
theAngular
;
87
if
(
fCache
.
Get
() != 0)
delete
fCache
.
Get
();
88
}
89
90
void
Init
(std::istream & aDataFile,
G4ParticleDefinition
* projectile);
91
92
G4ReactionProduct
*
Sample
(
G4double
anEnergy,
G4double
massCode,
G4double
mass
,
93
G4int
angularRep,
G4int
interpol);
94
95
G4double
GetEnergy
()
96
{
97
if
( std::getenv(
"G4PHPTEST"
) )
98
G4cout
<<
this
<<
" G4ParticleHPContAngularPar::GetEnergy "
99
<<
theEnergy
<<
" nE "
<<
nEnergies
<<
G4endl
;
100
return
theEnergy
;
101
}
102
103
void
SetPrimary
(
G4ReactionProduct
* aPrimary)
104
{
105
fCache
.
Get
()->thePrimary = aPrimary;
106
}
107
108
void
SetTarget
(
G4ReactionProduct
* aTarget)
109
{
110
fCache
.
Get
()->theTarget = aTarget;
111
}
112
113
void
SetTargetCode
(
G4double
aTargetCode)
114
{
115
fCache
.
Get
()->theTargetCode = aTargetCode;
116
}
117
118
void
SetInterpolation
(
G4int
theInterpolation)
119
{
120
theManager
.
Init
(theInterpolation,
nEnergies
);
// one range only
121
}
122
123
void
BuildByInterpolation
(
G4double
anEnergy,
G4InterpolationScheme
aScheme,
124
G4ParticleHPContAngularPar
& store1,
125
G4ParticleHPContAngularPar
& store2);
126
// NOTE: this interpolates legendre coefficients
127
128
void
PrepareTableInterpolation
(
const
G4ParticleHPContAngularPar
* angularPrev);
129
130
G4double
MeanEnergyOfThisInteraction
()
131
{
132
G4double
result;
133
if
(
fCache
.
Get
()->currentMeanEnergy<-1)
134
{
135
return
0;
136
// throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPContAngularPar: Logical error in Product class");
137
}
138
else
139
{
140
result =
fCache
.
Get
()->currentMeanEnergy;
141
}
142
fCache
.
Get
()->currentMeanEnergy = -2;
143
return
result;
144
}
145
146
G4int
GetNEnergies
()
const
147
{
148
return
nEnergies
;
149
}
150
G4int
GetNDiscreteEnergies
()
const
151
{
152
return
nDiscreteEnergies
;
153
}
154
std::set<G4double>
GetEnergiesTransformed
()
const
155
{
156
return
theEnergiesTransformed
;
157
}
158
G4int
GetNEnergiesTransformed
()
const
159
{
160
return
theEnergiesTransformed
.size();
161
}
162
G4double
GetMinEner
()
const
163
{
164
return
theMinEner
;
165
}
166
G4double
GetMaxEner
()
const
167
{
168
return
theMaxEner
;
169
}
170
std::map<G4double,G4int>
GetDiscreteEnergiesOwn
()
const
171
{
172
return
theDiscreteEnergiesOwn
;
173
}
174
G4ParticleHPList
*
GetAngDataList
()
const
175
{
176
return
theAngular
;
177
}
178
179
void
ClearHistories
()
180
{
181
if
(
fCache
.
Get
() == 0 )
cacheInit
();
182
fCache
.
Get
()->fresh =
true
;
183
}
184
185
void
Dump
();
186
187
private
:
188
189
// incoming particle
190
G4double
theEnergy
;
191
// number of exit channel energies
192
G4int
nEnergies
;
193
// number of discrete exit channels
194
G4int
nDiscreteEnergies
;
195
// number of angular paramerers per channel
196
G4int
nAngularParameters
;
197
// knows the interpolation between List labels
198
G4InterpolationManager
theManager
;
199
// on per exit-channel energy
200
G4ParticleHPList
*
theAngular
;
201
202
G4ParticleHPInterpolator
theInt
;
203
204
private
:
205
206
G4Cache< toBeCached* >
fCache
;
207
void
cacheInit
()
208
{
209
toBeCached
* val =
new
toBeCached
;
210
val->
currentMeanEnergy
= -2;
211
val->
remaining_energy
= 0;
212
val->
fresh
=
true
;
213
fCache
.
Put
( val );
214
};
215
216
G4ParticleDefinition
*
theProjectile
;
217
218
G4bool
adjustResult
;
219
// if not set it will not force the conservation of energy in angularRep==1,
220
// but will sample the particle energy according to the database
221
222
G4double
theMinEner
;
223
G4double
theMaxEner
;
224
std::set<G4double>
theEnergiesTransformed
;
225
std::set<G4double>
theDiscreteEnergies
;
226
std::map<G4double,G4int>
theDiscreteEnergiesOwn
;
227
};
228
229
#endif
geant4
tree
geant4-10.6-release
source
processes
hadronic
models
particle_hp
include
G4ParticleHPContAngularPar.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:47
using
1.8.2 with
ECCE GitHub integration