MTimeVariance.cc
Go to the documentation of this file.
1 #include <utl/Math.h>
2 #include <utl/AugerUnits.h>
3 #include <utl/MathConstants.h>
4 #include <utl/ErrorLogger.h>
5 #include <mdet/MTimeVariance.h>
6 
7 using namespace utl;
8 using namespace mdet;
9 
10 
11 namespace mdet {
12 
13  inline
14  double
15  VarianceForm1(unsigned int n, double r, double a, double b, double c)
16  {
17 
18  // approximating the median variance by the mean variance
19  // valid for an exponential distribution in the large sample limit
20  const double var = (a*a + r*r * b*b)/n + c*c;
21 
22  return var;
23  }
24 
25 
26  // Variance model from Dec 28 2017
27  // Parameters:
28  // n: number of muons
29  // r: core distance
30  // sigma0: width of the single muon time distribution at the reference distance
31  // alpha: slope of the muon width with the distance
32  // sigma2: all contributions independent of the number of muons (RMS GPS SD and MD sinchronisation)
33 
34  inline
35  double
36  VarianceForm2(unsigned int n, double r, double sigma0, double alpha, double sigma2)
37  {
38 
39  // Width of the time distribution of a single muon
40  // Modelled as a broken function:
41  // constant if distance is less than 200 m
42  // linear with r if distance is greater than 200 m
43 
44  double sigma1;
45  //const double rcut = 200;
46  const double r0 = 450; // reference distance
47 
48  if (r < 200) {
49  sigma1 = 25;
50  } else {
51  sigma1 = sigma0 + alpha * (r - r0);
52  }
53 
54  // Conversion factor between the variance of the mean to the variance of the median
55  if (n <= 2) {
56  alpha = 1;
57  } else {
58  alpha = double(n) / double(n+1) * kPi / 2.;
59  }
60 
61  // Variance propagation
62  const double var = alpha*(sigma1*sigma1)/n + sigma2*sigma2;
63 
64  return var;
65  }
66 
67 }
68 
69 
70 double
71 MTimeVariance::GetTimeSigma2(const unsigned int nmuons, const double distance)
72  const
73 {
74  switch (fModel) {
75  case eVersion1: {
76  const double a = 21; // in ns
77  const double b = 0.1204; // in ns/m
78  const double sigma2 = 17; // in ns
79  const double var = VarianceForm1(nmuons, distance, a, b, sigma2);
80  return var;
81  }
82  case eVersion2: {
83  const double sigma0 = 58.1; // in ns
84  const double alpha = 0.130; // in ns/m
85  const double sigma2 = 17; // in ns
86  const double var = VarianceForm2(nmuons, distance, sigma0, alpha, sigma2);
87  return var;
88  }
89  case eNone:
90  default:
91  ERROR("You should specify a TimeVariance model!");
92  return 0;
93  }
94 }
double VarianceForm2(unsigned int n, double r, double sigma0, double alpha, double sigma2)
double VarianceForm1(unsigned int n, double r, double a, double b, double c)
constexpr double kPi
Definition: MathConstants.h:24
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165

, generated on Tue Sep 26 2023.