SphericalFitFunction.cc
Go to the documentation of this file.
1 #include "SphericalFitFunction.h"
2 
3 #include <utl/PhysicalConstants.h>
4 
5 #include <TMath.h>
6 
7 
8 using namespace utl;
9 
10 
11 namespace RdSphericalFit {
12 
13  double
14  SphericalFitFunction::operator()(const std::vector<double>& pars)
15  const
16  {
17  // store parameters in class
18  UpdateParameters(pars);
19 
20  const utl::Vector source(fRadius, fTheta, fPhi, fLocalCS, utl::Vector::kSpherical);
21 
22 
23  std::vector<double> expectedTimes;
24  for (const auto& s : fStationData) {
25  double expectedTime = (s.antennaPos - source).GetMag() / (fGamma * kSpeedOfLight);
26  expectedTimes.push_back(expectedTime);
27  }
28  const double t0 = TMath::Mean(expectedTimes.begin(), expectedTimes.end());
29 
30  double chi2 = 0;
31  for (unsigned int i=0; i<fStationData.size(); i++) {
32  chi2 += pow(((fStationData[i].signalTime - ftmean) - (expectedTimes[i] - t0)) / fStationData[i].signalTimeErr, 2);
33  }
34 
35  return chi2;
36  }
37 
38  int
39  SphericalFitFunction::GetNDF()
40  {
41  // 1 additional degree of freedom lost by the choice of the absolute event time
42  return fStationData.size() - GetNFreeParameters() - 1;
43  }
44 
45 
46  double
47  SphericalFitFunction::GetChi2(const std::vector<double>& pars)
48  {
49  return this->operator()(pars);
50  }
51 
52 }
double pow(const double x, const unsigned int i)
constexpr double s
Definition: AugerUnits.h:163
static const CSpherical kSpherical
Definition: BasicVector.h:335
constexpr double kSpeedOfLight
Vector object.
Definition: Vector.h:30
double Mean(const std::vector< double > &v)
Definition: Functions.h:31

, generated on Tue Sep 26 2023.