NKGFermiLDF.h
Go to the documentation of this file.
1 #ifndef _LDFFinderKG_NKGFermiLDF_h_
2 #define _LDFFinderKG_NKGFermiLDF_h_
3 
4 
5 #include "VLDF.h"
6 #include <cmath>
7 #include <vector>
8 #include <utl/Math.h>
9 #include <utl/AugerUnits.h>
10 
11 
12 namespace LDFFinderKG {
13 
14  class NKGFermiLDF : public VLDF {
15 
16  public:
17  NKGFermiLDF(const double refDistance) : VLDF(refDistance, 20, 2) { }
18 
19  double
20  Value(const double r, const std::vector<double>& shape)
21  const
22  {
23  const double rRef = fReferenceDistance;
24  const double beta = shape[0];
25  const double gamma = shape[1];
26  const double mu = shape[2];
27  const double tau = shape[3];
28 
29  return NKG(r, rRef, beta, gamma) * FermiSuppression(r, rRef, mu, tau);
30  }
31 
32  double
33  SecondDerivative(const double r, const std::vector<double>& shape)
34  const
35  {
36  const double rRef = fReferenceDistance;
37  const double beta = shape[0];
38  const double gamma = shape[1];
39  const double mu = shape[2];
40  const double tau = shape[3];
41  const double k700 = 700*utl::meter;
42 
43  const double expofunc = std::exp((r - mu)/tau);
44  const double fermi = 1 / (expofunc + 1);
45  const double fermi2 = utl::Sqr(fermi);
46  const double nkgFirstDerivative =
47  NKG(r, rRef, beta, gamma) * (2*beta*r + beta*k700 + gamma*r) / (r * (r + k700));
48  return NKGSecondDerivative(r, rRef, beta, gamma) * fermi +
49  nkgFirstDerivative * (expofunc/tau * fermi2) +
50  NKG(r, rRef, beta, gamma) * fermi2 / (tau*tau) * expofunc * (2*fermi + 1);
51  }
52 
53  std::vector<double>
54  ShapeModel(const double cosTheta, const double showerSize)
55  const
56  {
57  const double lgSRef = std::log10(showerSize);
58  const double secTheta = 1 / cosTheta;
59  const double cos2Theta = utl::Sqr(cosTheta);
60 
61  const double a0 = fShapeModelVector[0];
62  const double a1 = fShapeModelVector[1];
63  const double b0 = fShapeModelVector[2];
64  const double b1 = fShapeModelVector[3];
65  const double c0 = fShapeModelVector[4];
66  const double c1 = fShapeModelVector[5];
67 
68  const double fo0 = fShapeModelVector[6];
69  const double fo1 = fShapeModelVector[7];
70  const double fa0 = fShapeModelVector[8];
71  const double fa1 = fShapeModelVector[9];
72  const double fp0 = fShapeModelVector[10];
73  const double fp1 = fShapeModelVector[11];
74  const double fs0 = fShapeModelVector[12];
75  const double fs1 = fShapeModelVector[13];
76  const double fb = fShapeModelVector[14];
77  const double fet = fShapeModelVector[15];
78  const double fps = fShapeModelVector[16];
79  const double fss = fShapeModelVector[17];
80 
81  std::vector<double> shape(4);
82  double& beta = shape[0];
83  double& gamma = shape[1];
84  double& mu = shape[2];
85  double& tau = shape[3];
86 
87  beta = a0 + a1*lgSRef + secTheta*(b0 + b1*lgSRef + secTheta*(c0 + c1*lgSRef));
88  gamma =
89  fo0 + fo1 * lgSRef +
90  (fa0 + fa1 * lgSRef) / (exp((fs0 + fs1 * lgSRef) * (cos2Theta - (fp0 + fp1 * lgSRef))) + 1) +
91  fb * pow(cos2Theta, fet) / (exp((lgSRef - fps) * fss) + 1) -
92  beta; // define as modification of exponent on second term for backwards compatibility
93 
95  tau = fShapeModelVector[19];
96 
97  return shape;
98  }
99 
100  double
101  BetaUncertainty(const double showerSize)
102  const
103  {
104  const double lgS = std::log10(showerSize);
106  }
107 
108  unsigned int GetNShapeParameters() const { return 4; }
109 
110  protected:
111  double
112  FermiSuppression(const double r, const double rRef, const double mu, const double tau)
113  const
114  {
115  // Fermi suppression term which conserves normalization of LDF at 1000m
116  return (exp((rRef - mu)/tau) + 1) / (exp((r - mu)/tau) + 1);
117  }
118 
119  double
120  NKG(const double r, const double rRef, const double beta, const double gamma)
121  const
122  {
123  const double k700 = 700*utl::meter;
124  return pow(r/rRef, beta) *
125  pow((k700 + r) / (rRef + k700), beta+gamma);
126  }
127 
128  double
129  NKGSecondDerivative(const double r, const double rRef, const double beta, const double gamma)
130  const
131  {
132  const double k700 = 700*utl::meter;
133  const double tbg = 2*beta + gamma;
134  const double r2 = utl::Sqr(r);
135  return NKG(r, rRef, beta, gamma) * (
136  utl::Sqr(k700)*beta*(beta - 1) +
137  (tbg - 1)*(2*k700*beta*r + tbg*r2)
138  ) / (r2 * utl::Sqr(r+k700));
139  }
140 
141  };
142 
143 }
144 
145 
146 #endif
return fBetaUncertaintyModelVector *[0] exp(fBetaUncertaintyModelVector[1]*lgS)
constexpr T Sqr(const T &x)
const double fReferenceDistance
std::vector< double > fShapeModelVector
return pow(r/rRef, beta)*pow((k700+r)/(rRef+k700)
const double nkgFirstDerivative
Definition: NKGFermiLDF.h:46
virtual double Value(const double r, const std::vector< double > &shape) const =0
virtual double SecondDerivative(const double r, const std::vector< double > &shape) const =0
constexpr double meter
Definition: AugerUnits.h:81
std::vector< double > fBetaUncertaintyModelVector
return NKG(r, rRef, beta, gamma)*FermiSuppression(r
const double cos2Theta
Definition: NKGFermiLDF.h:59
return NKGSecondDerivative(r, rRef, beta, gamma)*fermi+nkgFirstDerivative *(expofunc/tau *fermi2)+NKG(r
NKGFermiLDF(const double refDistance)
Definition: NKGFermiLDF.h:17
virtual std::vector< double > ShapeModel(const double cosTheta, double showerSize) const =0
unsigned int GetNShapeParameters() const
Definition: NKGFermiLDF.h:108
virtual double BetaUncertainty(const double showerSize) const =0

, generated on Tue Sep 26 2023.