56{
59
62 string option;
64
65 try {
66
67 JParser<> zap(
"Example program to histogram radiation cross sections, shower energy, range and b(E).");
68
73
75 }
76 catch(const exception &error) {
78 }
79
80
82
84
86 h0 =
new TH1D(
"total",
NULL, 160, 2.0, 10.0);
87 }
88
89 if (option == ENERGY) {
90 h0 =
new TH1D(
"total",
NULL, 24, 2.0, 10.0);
91 }
92
93 NOTICE(
"Setting up radiation tables... " << flush);
94
97
99
101 const JRadiation oxygen (JSeaWater::O .Z, JSeaWater::O .A, 40, 0.01, 0.1, 0.1);
103 const JRadiation sodium (JSeaWater::Na.Z, JSeaWater::Na.A, 40, 0.01, 0.1, 0.1);
104
109
114
119
124
126
127
129
130 for (int i = 1; i <= h0->GetNbinsX(); ++i) {
131
132 const double x = h0->GetBinCenter(i);
133 const double E =
pow(10.0, x);
134
136
138
139 const double li = p->first->getInverseInteractionLength(E);
140
141 p->second->Fill(x, 1.0/
li);
142 }
143 }
145 }
146
147
148 if (option == ENERGY) {
149
150 for (int i = 1; i <= h0->GetNbinsX(); ++i) {
151
152 const double x = h0->GetBinCenter(i);
153 const double E =
pow(10.0, x);
154
156
158
160
162 Q.
put(p->first->getEnergyOfShower(E));
163 }
164
165 p->second->SetBinContent(i, Q.
getMean());
166
167 }
168 }
170 }
171
172
173 if (option ==
RANGE) {
174
177
178 for (
int i = 1; i <=
Ra->GetNbinsX(); ++i) {
179
180 const double x =
Ra->GetBinCenter(i);
181 const double E0 =
pow(10.0, x);
182 const double Z = gWater(E0);
183
184 Ra->SetBinContent(i, Z*1e-3);
185 }
186
187 for (
int j = 1;
j <=
Rb->GetNbinsX(); ++
j) {
188
189 const double x =
Rb->GetBinCenter(j);
190 const double E0 =
pow(10.0, x);
191
193
195
197
198 double E = E0;
199 double z = 0.0;
200
201 while (E >= 0.5) {
202
204
207
208 for (int i = 0; i != N; ++i) {
209 ls +=
li[i] =
radiation[i].first->getInverseInteractionLength(E);
210 }
211
212 double dz = min(
gRandom->Exp(1.0) /
ls, gWater(E));
213
214 E -= gWater.getA() *
dz;
215
218
219 for (int i = 0; i != N; ++i) {
220
222
223 if (y < 0.0) {
225 break;
226 }
227 }
228
231 }
232
234 }
235
236 Rb->SetBinContent(j, Q.
getMean() * 1e-3);
237
238 }
240 }
241
242
243 if (option ==
ELOSS) {
244
246
247 for (
int j = 1;
j <=
hb->GetNbinsX(); ++
j) {
248
249 const double x =
hb->GetBinCenter(j);
250 const double E =
pow(10.0, x);
251
253
255
257
260
261 for (int i = 0; i != N; ++i) {
262 ls +=
li[i] =
radiation[i].first->getInverseInteractionLength(E);
263 }
264
266
269
270 for (int i = 0; i != N; ++i) {
271
273
274 if (y < 0.0) {
276 break;
277 }
278 }
279
281 }
282
284
285 }
287 }
288
289 delete h0;
290
291 out.Write();
292 out.Close();
293}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
Auxiliary class for the calculation of the muon radiative cross sections.
T pow(const T &x, const double y)
Power .
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure to list files in directory.
Auxiliary data structure for floating point format specification.