Tools/InclinedShowers/TankResponse/Aachen/TankResponse.cc
Go to the documentation of this file.
1 #include "TankResponse.h"
2 
3 #include <utl/AugerException.h>
4 #include <utl/Reader.h>
5 #include <utl/Branch.h>
6 #include <utl/AugerUnits.h>
7 #include <utl/NormalDistribution.h>
8 
9 #include <cmath>
10 #include <string>
11 #include <sstream>
12 
13 using namespace AachenTankResponseNS;
14 using namespace utl;
15 using namespace std;
16 using namespace tls;
17 
19 {
20  static TankResponse singleton(topBranch);
21  return singleton;
22 }
23 
25 {
26  string dataFilePath;
27  branch.GetChild("DataFile").GetData(dataFilePath);
28 
29  fTable.OpenFile(dataFilePath);
30 }
31 
32 double
33 TankResponse::Mean(const double theta, const double /*r*/, const ulong nmuon)
34  const
35 {
36  if (nmuon == 0) return 0;
37  if (nmuon < ulong(fTable.GetTableLimit()))
38  return fTable.Moment(theta,nmuon,1);
39  return fTable.GetFittedMean(theta,nmuon);
40 }
41 
42 double
43 TankResponse::StDev(const double theta, const double /*r*/, const ulong nmuon)
44  const
45 {
46  if (nmuon == 0) return 0;
47  if (nmuon < ulong(fTable.GetTableLimit())) {
48  const double m = fTable.Moment(theta,nmuon,1);
49  return sqrt(fTable.Moment(theta,nmuon,2)-m*m);
50  }
51  return fTable.GetFittedSigma(theta,nmuon);
52 }
53 
54 double
55 TankResponse::PDF(const double signal, const double theta, const double /*r*/, const ulong nmuon)
56  const
57 {
58  if (nmuon == 0) return signal == 0;
59  if (nmuon < (unsigned long)(fTable.GetTableLimit()))
60  return fTable.PDF(signal,theta,nmuon);
61  else {
62  const double m = fTable.GetFittedMean(theta,nmuon);
63  const double s = fTable.GetFittedSigma(theta,nmuon);
64  return NormalPDF(signal,m,s);
65  }
66 }
67 
68 double
69 TankResponse::CDF(const double signalmin, const double theta, const double /*r*/, const ulong nmuon)
70  const
71 {
72  if (nmuon == 0) return 0;
73  if (nmuon < (unsigned long)(fTable.GetTableLimit()))
74  return fTable.CDF(signalmin,theta,nmuon);
75  else {
76  const double m = fTable.GetFittedMean(theta,nmuon);
77  const double s = fTable.GetFittedSigma(theta,nmuon);
78  return NormalCDF(signalmin,m,s);
79  }
80 }
unsigned long ulong
Definition: VTankResponse.h:28
virtual double PDF(const double signal, const double theta, const double r, const ulong muons) const
PDF of signal, given a fixed number of muons.
virtual double Mean(const double theta, const double r, const ulong muons) const
Average signal, given fixed number of muons.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
double NormalPDF(const double x)
double NormalCDF(const double x)
virtual double CDF(const double threshold, const double theta, const double r, const ulong muons) const
Probability of signal begin smaller than smax, given a fixed number of muons.
Class representing a document branch.
Definition: Branch.h:107
constexpr double s
Definition: AugerUnits.h:163
virtual double StDev(const double theta, const double r, const ulong muons) const
Standard deviation of signal, given fixed number of muons.
void GetData(bool &b) const
Overloads of the GetData member template function.
Definition: Branch.cc:644
unsigned long ulong
Definition: extractEvent.cc:36
constexpr double m
Definition: AugerUnits.h:121

, generated on Tue Sep 26 2023.