43{
46
48
54 double A;
55 double Z;
56 string option;
57 double precision;
59
60 try {
61
62 JParser<> zap(
"Program to determine the energy loss due to visible delta-rays.");
63
74
76 }
77 catch(const exception &error) {
79 }
80
81 if (option.find('R') == string::npos) { option += 'R'; }
82 if (option.find('S') == string::npos) { option += 'S'; }
84
86
95 else
97
98 const double Tmin = (
T_GeV.is_valid() ?
99 T_GeV.constrain(JDeltaRays::getTmin()) : JDeltaRays::getTmin());
100
102
103 const double xmin = -3.00;
104 const double xmax = +9.25;
105
106 TH1D h0(
"h0",
NULL, 320, xmin, xmax);
107 TH1D h1(
"h1",
NULL, 320, xmin, xmax);
108
109 for (int i = 1; i <= h0.GetNbinsX(); ++i) {
110
111 const double x = h0.GetBinCenter(i);
112 const double E =
pow(10.0,x);
113
116 0.5 * getKineticEnergy(E, MASS_ELECTRON));
117
118 if (
T_GeV.is_valid()) { Tmax =
T_GeV.constrain(Tmax); }
119
122
124
127
129
132
133 } else {
134
135 dEdx = JDeltaRays::getEnergyLoss(E,
MASS_LEPTON, Tmin, Tmax, Z, A) * 1.0e3;
137 }
138
144
145 h0.SetBinContent(i,
dEdx);
146 h1.SetBinContent(i,
dNdx);
147 }
148
150
151 TF1 f1("f1", "[0] + [1]*x + [2]*x*x + [3]*x*x*x");
152
153 if (option.find('W') == string::npos) {
154 option += "W";
155 }
156
157 f1.SetParameter(0, h0.GetMinimum());
158 f1.SetParameter(1, (h0.GetMaximum() - h0.GetMinimum()) / (h0.GetXaxis()->GetXmax() - h0.GetXaxis()->GetXmin()));
159 f1.SetParameter(2, 0.0);
160 f1.SetParameter(3, 0.0);
161
162 f1.SetLineColor(
kRed);
163
164
165
167
169
171 cout <<
"\t// dE/dX = a + bx + cx^2 + dx^3; // [MeV g^-1 cm^2]; x = log10(E/GeV);" <<
endl;
172
173 for (int i = 0; i != 4; ++i) {
174 cout <<
"\tstatic const double " << (
char) (
'a' + i) <<
" = " <<
SCIENTIFIC(10,3) << f1.GetParameter(i) <<
";" <<
endl;
175 }
176
179
180 for (
double E = 0.5 * (Emin +
Emax); ; E = 0.5 * (Emin +
Emax)) {
181
182 const double Tmax = JDeltaRays::getTmax(E,
MASS_LEPTON);
183
184 if (fabs(Tmax - Tmin) < precision) {
185 cout <<
"\tstatic const double Emin = " <<
FIXED(7,5) << E <<
"; // [GeV]" <<
endl;
186 break;
187 }
188
189 if (Tmax > Tmin)
191 else
192 Emin = E;
193 }
194 }
195
196 out.Write();
197 out.Close();
198}
#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.
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 for floating point format specification.
Auxiliary data structure for floating point format specification.