11 #include <tst/Verify.h>
13 #include <utl/CoordinateSystem.h>
14 #include <utl/AugerCoordinateSystem.h>
15 #include <utl/Probability.h>
16 #include <utl/CoordinateSystem.h>
17 #include <utl/CoordinateSystemPtr.h>
18 #include <utl/Vector.h>
19 #include <utl/AugerUnits.h>
21 #include <fwk/CentralConfig.h>
22 #include <fwk/CoordinateSystemRegistry.h>
24 #include <cppunit/extensions/HelperMacros.h>
45 CPPUNIT_TEST(TestFisher);
46 CPPUNIT_TEST(TestVonMises);
50 CPPUNIT_TEST_SUITE_END();
67 const double kappa = 708.99;
68 for (
int j = 0; j < 100; ++j) {
69 const double x = (0.5*j - 25) *
utl::deg;
70 const double prob = Probability::GetInstance().GetVonMisesPDF(x, 0, kappa);
71 const double probGaus = Probability::GetInstance().GetNormalPDF(x, 0,
sqrt(1./kappa));
72 CPPUNIT_ASSERT(Verify<CloseTo>(prob, probGaus, 2e-3));
79 const int nTheta = 100;
81 const int nAlpha = 100;
82 for (
int iTheta = 0; iTheta < nTheta; ++iTheta) {
83 const double theta = 0.5 * iTheta / nTheta * M_PI;
84 for (
int iPhi = 0; iPhi < nPhi; ++iPhi) {
85 const double phi = 2. * iPhi / nPhi * M_PI;
86 const Vector showeraxis(1, theta, phi, fCS, Vector::kSpherical);
87 for (
int iAlpha = 0; iAlpha < nAlpha; ++iAlpha) {
88 double alpha = 5. * iAlpha/nAlpha *
utl::deg;
89 const Vector smearedVector = Probability::GetInstance().GetFisher(showeraxis, alpha);
90 const double angle =
Angle(showeraxis, smearedVector);
91 CPPUNIT_ASSERT(Verify<CloseTo>(alpha, angle, 1e-8));
100 const int n = 10000000;
101 TH1D h = TH1D(
"h",
"", 90, 0, 0.5);
103 for (
int i = 0; i < n; ++i) {
104 h.Fill(Probability::GetInstance().GetRandomFisher(250));
105 const double x = 1. * i/n * M_PI;
106 g.SetPoint(i, x, Probability::GetFisherPDF(x, 250));
108 h.Scale(1/h.Integral(
"width"));
110 for (
int i = 1; i <= 90; ++i) {
111 const double x = h.GetBinCenter(i);
112 CPPUNIT_ASSERT(Verify<CloseTo>(h.GetBinContent(i), Probability::GetFisherPDF(x, 250), 1e-2));
115 gStyle->SetOptStat(
"merou");
116 TCanvas*
const c =
new TCanvas();
118 h.GetXaxis()->SetTitle(
"angle [deg]");
121 c->SaveAs(
"hFisher.png");
128 const int n = 10000000;
129 TH1D h = TH1D(
"h",
"", 90, 0, 0.5);
132 for (
int i = 0; i < n; ++i) {
133 h.Fill(Probability::GetInstance().GetRandomFisher(1/(sigma*sigma)));
134 const double x = 1. * i/n * M_PI;
135 g.SetPoint(i, x, Probability::GetRayleighPDF(x, sigma));
137 h.Scale(1/h.Integral(
"width"));
139 gStyle->SetOptStat(
"merou");
140 TCanvas*
const c =
new TCanvas();
142 h.GetXaxis()->SetTitle(
"angle [deg]");
145 c->SaveAs(
"hFisher_Rayleigh.png");
double Angle(const double theta1, const double phi1, const double theta2, const double phi2)
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.