55int main(
int argc,
char* argv[])
67 JParser<> zap(
"Example program to histogram radiation cross sections, shower energy, range and b(E).");
76 catch(
const exception &error) {
86 h0 =
new TH1D(
"total",
NULL, 160, 2.0, 10.0);
89 if (option == ENERGY) {
90 h0 =
new TH1D(
"total",
NULL, 24, 2.0, 10.0);
93 NOTICE(
"Setting up radiation tables... " << flush);
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);
130 for (
int i = 1; i <= h0->GetNbinsX(); ++i) {
132 const double x = h0->GetBinCenter(i);
133 const double E = pow(10.0, x);
139 const double li = p->first->getInverseInteractionLength(E);
141 p->second->Fill(x, 1.0/
li);
148 if (option == ENERGY) {
150 for (
int i = 1; i <= h0->GetNbinsX(); ++i) {
152 const double x = h0->GetBinCenter(i);
153 const double E = pow(10.0, x);
162 Q.
put(p->first->getEnergyOfShower(E));
165 p->second->SetBinContent(i, Q.
getMean());
173 if (option ==
RANGE) {
178 for (
int i = 1; i <=
Ra->GetNbinsX(); ++i) {
180 const double x =
Ra->GetBinCenter(i);
181 const double E0 = pow(10.0, x);
182 const double Z = gWater(E0);
184 Ra->SetBinContent(i, Z*1e-3);
187 for (
int j = 1; j <=
Rb->GetNbinsX(); ++j) {
189 const double x =
Rb->GetBinCenter(j);
190 const double E0 = pow(10.0, x);
208 for (
int i = 0; i != N; ++i) {
209 ls +=
li[i] =
radiation[i].first->getInverseInteractionLength(E);
212 double dz = min(
gRandom->Exp(1.0) /
ls, gWater(E));
214 E -= gWater.getA() *
dz;
219 for (
int i = 0; i != N; ++i) {
236 Rb->SetBinContent(j, Q.
getMean() * 1e-3);
243 if (option ==
ELOSS) {
247 for (
int j = 1; j <=
hb->GetNbinsX(); ++j) {
249 const double x =
hb->GetBinCenter(j);
250 const double E = pow(10.0, x);
261 for (
int i = 0; i != N; ++i) {
262 ls +=
li[i] =
radiation[i].first->getInverseInteractionLength(E);
270 for (
int i = 0; i != N; ++i) {