Geant4
10.03.p03
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4InterpolationManager.hh
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
#ifndef G4InterpolationManager_h
29
#define G4InterpolationManager_h 1
30
31
#include "
globals.hh
"
32
#include "
G4InterpolationScheme.hh
"
33
#include "
G4ios.hh
"
34
#include <fstream>
35
#include "
G4HadronicException.hh
"
36
37
class
G4InterpolationManager
38
{
39
public
:
40
41
friend
class
G4InterpolationIterator
;
42
43
G4InterpolationManager
()
44
{
45
nRanges = 1;
46
start =
new
G4int
[1];
47
start[0] = 0;
48
range
=
new
G4int
[1];
49
range
[0] = 100000;
50
scheme =
new
G4InterpolationScheme
[1];
51
scheme[0] =
LINLIN
;
52
nEntries = 0;
53
}
54
55
~G4InterpolationManager
()
56
{
57
if
(start!=0)
delete
[] start;
58
if
(
range
!=0)
delete
[]
range
;
59
if
(scheme!=0)
delete
[] scheme;
60
}
61
62
G4InterpolationManager
&
operator=
(
const
G4InterpolationManager
& aManager)
63
{
64
if
(
this
!= &aManager)
65
{
66
nRanges = aManager.nRanges;
67
nEntries = aManager.nEntries;
68
if
(scheme!=0)
delete
[] scheme;
69
if
(start!=0)
delete
[] start;
70
if
(
range
!=0)
delete
[]
range
;
71
scheme =
new
G4InterpolationScheme
[nRanges];
72
start =
new
G4int
[nRanges];
73
range
=
new
G4int
[nRanges];
74
for
(
G4int
i=0; i<nRanges; i++)
75
{
76
scheme[i]=aManager.scheme[i];
77
start[i]=aManager.start[i];
78
range
[i]=aManager.range[i];
79
}
80
}
81
return
*
this
;
82
}
83
84
inline
void
Init
(
G4int
aScheme,
G4int
aRange)
85
{
86
nRanges = 1;
87
start[0] = 0;
88
range
[0] = aRange;
89
scheme[0] =
MakeScheme
(aScheme);
90
nEntries = aRange;
91
}
92
inline
void
Init
(
G4InterpolationScheme
aScheme,
G4int
aRange)
93
{
94
nRanges = 1;
95
start[0] = 0;
96
range
[0] = aRange;
97
scheme[0] = aScheme;
98
nEntries = aRange;
99
}
100
101
inline
void
Init
(std::istream & aDataFile)
102
{
103
delete
[] start;
104
delete
[]
range
;
105
delete
[] scheme;
106
aDataFile >> nRanges;
107
start =
new
G4int
[nRanges];
108
range
=
new
G4int
[nRanges];
109
scheme =
new
G4InterpolationScheme
[nRanges];
110
start[0] = 0;
111
G4int
it;
112
for
(
G4int
i=0; i<nRanges; i++)
113
{
114
aDataFile>>
range
[i];
115
//***************************************************************
116
//EMendoza -> there is a bug here.
117
/*
118
if(i!=0) start[i] = start[i-1]+range[i-1];
119
*/
120
//***************************************************************
121
if
(i!=0) start[i] = range[i-1];
122
//***************************************************************
123
aDataFile>>it;
124
scheme[i] =
MakeScheme
(it);
125
}
126
nEntries = start[nRanges-1]+
range
[nRanges-1];
127
}
128
129
G4InterpolationScheme
MakeScheme
(
G4int
it);
130
131
inline
G4InterpolationScheme
GetScheme
(
G4int
index)
const
132
{
133
G4int
it = 0;
134
for
(
G4int
i=1; i<nRanges; i++)
135
{
136
if
(index<start[i])
break
;
137
it = i;
138
}
139
return
scheme[it];
140
}
141
142
inline
void
CleanUp
()
143
{
144
nRanges = 0;
145
nEntries = 0;
146
}
147
148
inline
G4InterpolationScheme
GetInverseScheme
(
G4int
index)
149
{
150
G4InterpolationScheme
result
=
GetScheme
(index);
151
if
(result ==
HISTO
)
152
{
153
result =
RANDOM
;
154
}
155
else
if
(result ==
LINLOG
)
156
{
157
result =
LOGLIN
;
158
}
159
else
if
(result ==
LOGLIN
)
160
{
161
result =
LINLOG
;
162
}
163
else
if
(result ==
CHISTO
)
164
{
165
result =
CRANDOM
;
166
}
167
else
if
(result ==
CLINLOG
)
168
{
169
result =
CLOGLIN
;
170
}
171
else
if
(result ==
CLOGLIN
)
172
{
173
result =
CLINLOG
;
174
}
175
else
if
(result ==
UHISTO
)
176
{
177
result =
URANDOM
;
178
}
179
else
if
(result ==
ULINLOG
)
180
{
181
result =
ULOGLIN
;
182
}
183
else
if
(result ==
ULOGLIN
)
184
{
185
result =
ULINLOG
;
186
}
187
return
result
;
188
}
189
190
void
AppendScheme
(
G4int
aPoint,
const
G4InterpolationScheme
& aScheme);
191
192
private
:
193
194
G4int
nRanges;
195
G4InterpolationScheme
* scheme;
196
G4int
* start;
197
G4int
*
range
;
198
G4int
nEntries;
199
200
};
201
#endif
result
G4double G4ParticleHPJENDLHEData::G4double result
Definition:
G4ParticleHPJENDLHEData.cc:257
LINLOG
Definition:
G4InterpolationScheme.hh:39
HISTO
Definition:
G4InterpolationScheme.hh:39
G4InterpolationScheme.hh
G4InterpolationManager::Init
void Init(G4int aScheme, G4int aRange)
Definition:
G4InterpolationManager.hh:84
ULOGLIN
Definition:
G4InterpolationScheme.hh:41
LINLIN
Definition:
G4InterpolationScheme.hh:39
G4InterpolationManager::operator=
G4InterpolationManager & operator=(const G4InterpolationManager &aManager)
Definition:
G4InterpolationManager.hh:62
G4HadronicException.hh
CLINLOG
Definition:
G4InterpolationScheme.hh:40
CLOGLIN
Definition:
G4InterpolationScheme.hh:40
G4int
int G4int
Definition:
G4Types.hh:78
G4InterpolationManager::Init
void Init(G4InterpolationScheme aScheme, G4int aRange)
Definition:
G4InterpolationManager.hh:92
ULINLOG
Definition:
G4InterpolationScheme.hh:41
G4InterpolationManager::AppendScheme
void AppendScheme(G4int aPoint, const G4InterpolationScheme &aScheme)
Definition:
G4InterpolationManager.cc:90
pyG4EmCalculator::range
const G4ParticleDefinition const G4Material *G4double range
Definition:
pyG4EmCalculator.cc:185
CRANDOM
Definition:
G4InterpolationScheme.hh:40
G4InterpolationManager::GetScheme
G4InterpolationScheme GetScheme(G4int index) const
Definition:
G4InterpolationManager.hh:131
CHISTO
Definition:
G4InterpolationScheme.hh:40
G4InterpolationManager::~G4InterpolationManager
~G4InterpolationManager()
Definition:
G4InterpolationManager.hh:55
globals.hh
G4InterpolationManager::CleanUp
void CleanUp()
Definition:
G4InterpolationManager.hh:142
G4InterpolationManager::G4InterpolationManager
G4InterpolationManager()
Definition:
G4InterpolationManager.hh:43
G4InterpolationScheme
G4InterpolationScheme
Definition:
G4InterpolationScheme.hh:37
G4ios.hh
G4InterpolationManager
Definition:
G4InterpolationManager.hh:37
G4InterpolationManager::MakeScheme
G4InterpolationScheme MakeScheme(G4int it)
Definition:
G4InterpolationManager.cc:33
G4InterpolationManager::Init
void Init(std::istream &aDataFile)
Definition:
G4InterpolationManager.hh:101
G4InterpolationManager::GetInverseScheme
G4InterpolationScheme GetInverseScheme(G4int index)
Definition:
G4InterpolationManager.hh:148
LOGLIN
Definition:
G4InterpolationScheme.hh:39
URANDOM
Definition:
G4InterpolationScheme.hh:41
RANDOM
Definition:
G4InterpolationScheme.hh:39
G4InterpolationIterator
Definition:
G4InterpolationIterator.hh:35
UHISTO
Definition:
G4InterpolationScheme.hh:41
source
geant4.10.03.p03
source
processes
hadronic
models
particle_hp
include
G4InterpolationManager.hh
Generated on Tue Nov 28 2017 21:44:15 for Geant4 by
1.8.5