101{
102 std::vector<G4TwoPeaksHadXS*>* ptr = nullptr;
103 if(nullptr == p) { return ptr; }
104
105
106
107
108
111 ptr = new std::vector<G4TwoPeaksHadXS*>;
112 ptr->resize(n, nullptr);
113
114 G4double e1peak, e1deep, e2peak, e2deep, e3peak;
116
119 if(nbin < 4) { nbin = 4; }
121
122 for (
size_t i=0; i<
n; ++i) {
123 auto mat = (*theMatTable)[i];
125
127 e1peak = e1deep = e2peak = e2deep = e3peak =
DBL_MAX;
128 for(
G4int j=0; j<=nbin; ++j) {
129 e = (j+1 < nbin) ? e*fact : emax;
131
133 if(ss >= xs) {
134 xs = ss;
135 ee = e;
136 continue;
137 } else {
138 e1peak = ee;
139 }
140 }
141
143 if(ss <= xs) {
144 xs = ss;
145 ee = e;
146 continue;
147 } else {
148 e1deep = ee;
149 isDeep = true;
150 }
151 }
152
154 if(ss >= xs) {
155 xs = ss;
156 ee = e;
157 continue;
158 } else {
159 e2peak = ee;
160 }
161 }
163 if(ss <= xs) {
164 xs = ss;
165 ee = e;
166 continue;
167 } else {
168 e2deep = ee;
169 break;
170 }
171 }
172
174 if(ss >= xs) {
175 xs = ss;
176 ee = e;
177 continue;
178 } else {
179 e3peak = ee;
180 }
181 }
182 }
184 if(nullptr == x) {
186 (*ptr)[i] = x;
187 }
193
194
195 }
196
197 if(!isDeep) {
198 for (auto& x : *ptr) {
199 delete x;
200 }
201 delete ptr;
202 ptr = nullptr;
203 }
204 return ptr;
205}
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
std::vector< G4Material * > G4MaterialTable
G4double ComputeCrossSection(const G4ParticleDefinition *, const G4Material *, const G4double kinEnergy)
static std::size_t GetNumberOfMaterials()
static G4MaterialTable * GetMaterialTable()