ScintillatorLDFFinderKG/NKGLDF.h
Go to the documentation of this file.
1 #ifndef _LDFFinderKG_NKGLDF_h_
2 #define _LDFFinderKG_NKGLDF_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 ScintillatorLDFFinderKG {
13 
14  class NKGLDF : public VLDF {
15 
16  public:
17  NKGLDF(const double refDistance) : VLDF(refDistance, 18, 2) { }
18 
19  protected:
20  NKGLDF(const double refDistance, const unsigned int shapeSize) : VLDF(refDistance, shapeSize, 2) { }
21 
22  public:
23  double
24  Value(const double r, const std::vector<double>& shape)
25  const
26  {
27  const double rRef = fReferenceDistance;
28  const double beta = shape[0];
29  const double gamma = shape[1];
30 
31  const double k700 = 700*utl::meter;
32 
33  return std::pow(r/rRef, beta) *
34  std::pow((k700 + r)/(rRef + k700), beta+gamma);
35  }
36 
37  double
38  FirstDerivative(const double r, const std::vector<double>& shape)
39  const
40  {
41  const double beta = shape[0];
42  const double gamma = shape[1];
43  const double rRef = fReferenceDistance;
44  const double k700 = 700*utl::meter;
45  return (beta*std::pow(r/rRef,beta-1)
46  * std::pow((r+k700)/(k700+rRef),beta+gamma)/rRef)
47  + (std::pow(r/rRef,beta)*std::pow((r+k700)/(k700+rRef),beta+gamma-1)
48  * (beta + gamma))/(k700+rRef);
49  }
50 
51  double
52  SecondDerivative(const double r, const std::vector<double>& shape)
53  const
54  {
55  const double beta = shape[0];
56  const double gamma = shape[1];
57 
58  const double k700 = 700*utl::meter;
59 
60  const double tbg = 2*beta + gamma;
61  const double r2 = utl::Sqr(r);
62  return Value(r, shape) * (
63  utl::Sqr(k700)*beta*(beta - 1) +
64  (tbg - 1)*(2*k700*beta*r + tbg*r2)
65  ) / (r2 * utl::Sqr(r+k700));
66  }
67 
68  std::vector<double>
69  ShapeModel(const double cosTheta, const double showerSize)
70  const
71  {
72  const double lgSRef = std::log10(showerSize);
73  const double secTheta = 1/cosTheta;
74  const double sec2Theta = utl::Sqr(secTheta);
75  const double cos2Theta = utl::Sqr(cosTheta);
76 
77  const double a0 = fShapeModelVector[0];
78  const double a1 = fShapeModelVector[1];
79  const double b0 = fShapeModelVector[2];
80  const double b1 = fShapeModelVector[3];
81  const double c0 = fShapeModelVector[4];
82  const double c1 = fShapeModelVector[5];
83 
84  const double fo0 = fShapeModelVector[6];
85  const double fo1 = fShapeModelVector[7];
86  const double fa0 = fShapeModelVector[8];
87  const double fa1 = fShapeModelVector[9];
88  const double fp0 = fShapeModelVector[10];
89  const double fp1 = fShapeModelVector[11];
90  const double fs0 = fShapeModelVector[12];
91  const double fs1 = fShapeModelVector[13];
92  const double fb = fShapeModelVector[14];
93  const double fet = fShapeModelVector[15];
94  const double fps = fShapeModelVector[16];
95  const double fss = fShapeModelVector[17];
96 
97  std::vector<double> shape(2);
98  double& beta = shape[0];
99  double& gamma = shape[1];
100 
101  beta =
102  a0 + a1*lgSRef +
103  (b0 + b1*lgSRef) * secTheta +
104  (c0 + c1*lgSRef) * sec2Theta;
105  gamma =
106  fo0 + fo1 * lgSRef +
107  (fa0 + fa1 * lgSRef) / (std::exp((fs0 + fs1 * lgSRef) *
108  (cos2Theta - (fp0 + fp1 * lgSRef))) + 1) +
109  fb * std::pow(cos2Theta, fet) / (std::exp((lgSRef - fps) * fss) + 1) -
110  beta; // define as modification of exponent on second term for backwards compatibility
111  return shape;
112  }
113 
114  double
115  BetaUncertainty(const double showerSize)
116  const
117  {
118  const double lgS = std::log10(showerSize);
120  }
121 
122  unsigned int GetNShapeParameters() const { return 2; }
123 
124  };
125 
126 }
127 
128 
129 #endif
constexpr T Sqr(const T &x)
virtual std::vector< double > ShapeModel(const double cosTheta, double showerSize) const =0
return fBetaUncertaintyModelVector *[0] exp(fBetaUncertaintyModelVector[1]*lgS)
double pow(const double x, const unsigned int i)
virtual double BetaUncertainty(const double showerSize) const =0
constexpr double meter
Definition: AugerUnits.h:81
virtual double FirstDerivative(const double r, const std::vector< double > &shape) const =0
NKGLDF(const double refDistance, const unsigned int shapeSize)
std::vector< double > fBetaUncertaintyModelVector
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

, generated on Tue Sep 26 2023.