14 #include <fwk/CentralConfig.h>
16 #include <utl/Vector.h>
17 #include <utl/AugerUnits.h>
18 #include <utl/MathConstants.h>
19 #include <utl/PhysicalConstants.h>
21 #include <det/Detector.h>
23 #include <atm/Atmosphere.h>
24 #include <atm/CherenkovModel.h>
25 #include <atm/AttenuationResult.h>
34 CherenkovModel::CherenkovModel()
46 const double x = (chi - chi0) / (chimax - chi0);
47 const double p = (chimax - chi0) / lambda;
48 const double q = (chimax - chi) / lambda;
49 return Nmax *
std::pow(x, p) * std::exp(q);
58 return utl::ElectronMass/
std::sqrt(1 - beta*beta);
67 const double gammaInv = utl::ElectronMass / energy;
74 CherenkovModel::CKVThreshold(
const double nIndex)
77 return utl::ElectronMass /
std::sqrt(1 - 1 / (nIndex * nIndex));
88 for (
int k = 0; k < 3; ++k) {
89 const double dx = x1[k] - x2[k];
99 CherenkovModel::GDistance(
const double x1[],
const double x2[])
102 double gdistance = 0;
103 const double chi1 = det::Detector::GetInstance().GetAtmosphere().EvaluateDepth(x1[2]);
104 const double chi2 = det::Detector::GetInstance().GetAtmosphere().EvaluateDepth(x2[2]);
118 CherenkovModel::TrackLengthH(
const double energy,
const double chi,
const double chimax)
121 const double s = 3 / (1 + 2*chimax/chi);
122 const double e0 = (s < 0.4) ? 26 : 44 - 17*
std::pow(s - 1.46, 2);
124 return std::pow((0.89*e0 - 1.20) / (e0 + energy), s) /
std::pow(1 + 1e-4 * s * energy, 2);
130 CherenkovModel::TrackLengthN(
const double energy,
const double chi,
const double chimax)
133 const double s = 3 / (1 + 2*chimax/chi);
135 const double a0 = 102.24;
136 const double a1 = 6.425 - 1.532 *
s;
137 const double a2 = 168.13 - 42.14 *
s;
139 return a0 / ((energy + a1)*
std::pow(energy + a2, s));
145 CherenkovModel::CKVPhot(
const double trl,
const double nIndex,
const double beta,
const double dl,
const double l1,
const double l2)
148 const double cte = 2*
utl::kPi * utl::Alpha;
150 return cte * trl *
std::abs(1/l1 - 1/l2) * (1 - 1/
std::pow(beta*nIndex, 2)) * dl;
156 CherenkovModel::Fu(
const double x,
const double a)
159 return std::exp(-x/a) * std::sin(x);
165 CherenkovModel::CKVIntegral(
const double xlo,
const double xhi,
const double xb,
double& integral)
170 double suma = Fu(xlo, xb);
171 const double step = (xhi - xlo) / 10;
173 for (
int i = 1; i <= 5; ++i) {
174 const double a1 = xlo + (2*i - 1)*step;
175 const double a2 = a1 + step;
177 const double s1 = 4 * Fu(a1, xb);
183 integral = (suma - s2/2) * step / 3;
189 CherenkovModel::CKVDirect(
const double bin,
const double theta,
const double height,
const double rp,
const double chimax, std::vector<double>& dirCh)
192 std::vector<double> nphot(kN_WAVE_BIN);
193 std::vector<double> ophot(kN_WAVE_BIN);
197 for (
int w = 0; w < kN_WAVE_BIN; ++w) {
203 double th1 = theta - bin/2;
207 const double th2 = theta + bin/2;
209 const double dl = rp *
std::abs(1 / std::tan(th1) - 1 / std::tan(th2));
211 const double a = 0.83;
212 const double b = -0.67;
214 const double chi = det::Detector::GetInstance().GetAtmosphere().EvaluateDepth(height);
215 const double nIndex = det::Detector::GetInstance().GetAtmosphere().EvaluateRefractionIndex(height);
217 const double em = min(CKVThreshold(nIndex), 2e3);
219 const double th0 = a *
std::pow(em, b);
223 CKVIntegral(th1, th2, th0, integral);
226 const double norm = integral / th0;
229 const double dE = 10;
232 double jmax = 361.33;
235 for (
double j = em; j <= jmax; j += dE) {
236 const double tl1 = TrackLengthN(j, chi, chimax);
237 const double tl2 = TrackLengthN(j+dE, chi, chimax);
239 const double aux1 = tl1 - tl2;
240 const double aux2 = j + dE/2;
241 const double aux3 =
Beta(aux2);
242 lambda = kWAVE_MIN - kWAVE_STEP/2;
244 for (
int w = 0; w < kN_WAVE_BIN; ++w) {
245 lambda += kWAVE_STEP;
246 const double aux4 = lambda - kWAVE_STEP/2;
247 const double aux5 = lambda + kWAVE_STEP/2;
249 nphot[w] = CKVPhot(aux1, nIndex, aux3, dl, aux4, aux5) + ophot[w];
257 lambda = kWAVE_MIN - kWAVE_STEP/2;
258 const double aux1 = TrackLengthN(jmax, chi, chimax);
259 const double aux3 = 1;
261 for (
int w = 0; w < kN_WAVE_BIN; ++w) {
262 lambda += kWAVE_STEP;
263 const double aux4 = lambda - kWAVE_STEP/2;
264 const double aux5 = lambda + kWAVE_STEP/2;
266 nphot[w] = CKVPhot(aux1, nIndex, aux3, dl, aux4, aux5) + ophot[w];
270 const double dA = 2*
utl::kPi * rp*rp * bin;
272 for (
int w = 0; w < kN_WAVE_BIN; ++w)
273 dirCh[w] = nphot[w] * norm / dA;
279 CherenkovModel::CKVBeam(
const double h1,
const double h2,
const double theta,
const double chimax, std::vector<double>& beamCh)
282 std::vector<double> nphot(kN_WAVE_BIN);
283 std::vector<double> ophot(kN_WAVE_BIN);
288 for (
int w = 0; w < kN_WAVE_BIN; ++w) {
294 const double chi1 = det::Detector::GetInstance().GetAtmosphere().EvaluateDepth(h1);
295 const double chi2 = det::Detector::GetInstance().GetAtmosphere().EvaluateDepth(h2);
297 const double dl =
std::abs(h2 - h1) / std::cos(theta);
299 const double nIndex = det::Detector::GetInstance().GetAtmosphere().EvaluateRefractionIndex((h1 + h2) / 2);
301 const double em = min(CKVThreshold(n_index), 2e3);
304 const double dE = 10;
307 double jmax = 361.33;
309 const double aux1 = (chi1 + chi2) / 2;
311 for (
double j = em; j <= jmax; j += dE) {
312 const double tl1 = TrackLengthN(j, aux1, chimax);
313 const double tl2 = TrackLengthN(j+dE, aux1, chimax);
315 const double aux2 = tl1 - tl2;
316 const double aux3 = j + dE/2;
317 const double aux4 =
Beta(aux3);
318 lambda = kWAVE_MIN - kWAVE_STEP/2;
320 for (
int w = 0; w < kN_WAVE_BIN; ++w) {
321 lambda += kWAVE_STEP;
322 const double aux5 = lambda - kWAVE_STEP/2;
323 const double aux6 = lambda + kWAVE_STEP/2;
325 nphot[w] = CKVPhot(aux2, nIndex, aux4, dl, aux5, aux6) + ophot[w];
333 lambda = kWAVE_MIN - kWAVE_STEP/2;
334 const double aux2 = TrackLengthN(jmax, aux1, chimax);
335 const double aux4 = 1;
337 for (
int w = 0; w < kN_WAVE_BIN; ++w) {
338 lambda += kWAVE_STEP;
339 const double aux4 = lambda - kWAVE_STEP/2;
340 const double aux5 = lambda + kWAVE_STEP/2;
342 nphot[w] = CKVPhot(aux2, nIndex, aux4, dl, aux5, aux6) + ophot[w];
345 for (
int w = 0; w < kN_WAVE_BIN; ++w)
346 beamCh[w] = nphot[w];
352 CherenkovModel::CKVRayleigh(
const double h1,
const double h2,
const double theta,
const double rr, std::vector<double>& rayCh)
355 std::vector<double> lambda(kN_WAVE_BIN);
357 const double aux = kWAVE_MIN - kWAVE_STEP/2;
359 for (
int w = 0; w < kN_WAVE_BIN; ++w)
360 lambda[w] += aux + kWAVE_STEP;
364 const Point p1(0, 0, h1, cs);
365 const Point p2(0, 0, h2, cs);
368 det::Detector::GetInstance().GetAtmosphere().EvaluateRayleighAttenuation(p1, p2, lambda);
372 const double anfc = 1 +
std::pow(std::cos(theta), 2);
373 const double factor = 3 / (16*
utl::kPi) * anfc / (rr*rr);
374 for (
int wl = 0; wl < kN_WAVE_BIN; ++wl) {
375 const double probScat = 1 - attenuationVector[wl];
376 rayCh[wl] = factor * probScat;
383 CherenkovModel::CKVAerosol(
const double h1,
const double h2,
const double theta,
const double rr, std::vector<double>& aerCh)
386 const double a = 0.8;
389 std::vector<double> lambda(kN_WAVE_BIN);
391 const double aux = kWAVE_MIN - kWAVE_STEP/2;
393 for (
int w = 0; w < kN_WAVE_BIN; ++w)
394 lambda[w] += aux + kWAVE_STEP;
398 const Point p1(0, 0, h1, cs);
399 const Point p2(0, 0, h2, cs);
402 det::Detector::GetInstance().GetAtmosphere().EvaluateMieAttenuation(p1, p2, lambda);
406 const double factor = a * std::exp(-theta/thM) / (rr*rr);
407 for (
int wl = 0; wl < kN_WAVE_BIN; ++wl) {
408 const double prob_scat = 1 - attenuationVector[wl];
409 aerCh[wl] = factor * prob_scat;
double Energy(const double beta)
Calculate the electron energy for a relativistic beta.
const utl::TabulatedFunctionErrors & GetTransmissionFactor() const
Transmission factor.
double pow(const double x, const unsigned int i)
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
double abs(const SVector< n, T > &v)
double Beta(const double energy)
Calculate the electron energy versus the relativistic beta.
double GaisserHillas(const double x, const double x0, const double xMax, const double nMax, const double lambda)
Calculate the Gaisser-Hillas function.
double Distance(const Point &p, const sdet::Station &s)
Class describing the Atmospheric attenuation.