4 #include <det/Detector.h>
7 #include <atm/Atmosphere.h>
8 #include <atm/ProfileResult.h>
11 #include <utl/TabulatedFunction.h>
12 #include <utl/ErrorLogger.h>
13 #include <utl/MathConstants.h>
14 #include <utl/Particle.h>
15 #include <utl/PhysicalConstants.h>
16 #include <utl/PhysicalFunctions.h>
19 #include <fwk/CentralConfig.h>
22 #include <evt/Event.h>
23 #include <evt/ShowerSimData.h>
30 #include <TGraphErrors.h>
37 using namespace TimeModelTestKG;
39 TimeModelTest::TimeModelTest() {}
41 TimeModelTest::~TimeModelTest() {}
67 Detector& theDetector = Detector::GetInstance();
79 bool HasMuonProductionProfile =
90 ERROR (
"No muon profile !!!!!!!!!");
94 if (HasMuonProductionProfile)
95 SimMuonProductionProfile =
98 ERROR (
"No muon production profile !!!!!!!!!");
103 double zenith = simShower.GetZenith();
105 double cosTheta = cos (zenith);
106 double logE = log10 (simEnergy/
eV);
109 switch (simPrimary) {
123 ERROR (
"Unknown LorenzoPrimary!");
129 cout <<
" " << zenith <<
" " << lorenzoPrimary << endl;
132 double rMin = 100.*
m;
133 double rMax = 2000.*
m;
134 double dR = (rMax-rMin)/nPoints;
182 cout <<
" model 1 " << endl;
183 cout <<
" zenith " << zenith/
deg
185 <<
" primary " << lorenzoPrimary
189 TGraphErrors *g1 =
new TGraphErrors (nPoints);
193 for (r=rMin; r<=rMax; r+=dR) {
198 double time, timeErr = 0;
204 g1->SetPoint (iPoint, r/1000, time);
205 g1->SetPointError (iPoint, 0, timeErr);
213 cout <<
" model 2 " << endl;
215 double XobsVert = 850.*
g/
cm/
cm;
238 TGraphErrors *g2 =
new TGraphErrors (nPoints);
241 for (r=rMin; r<=rMax; r+=dR) {
246 double time, timeErr = 0;
251 g2->SetPoint (iPoint, r/1000, time);
252 g2->SetPointError (iPoint, 0, timeErr);
259 TLegend *l =
new TLegend (0.15, 0.7, 0.4, 0.99);
260 l->AddEntry (g1,
"using model",
"l");
261 l->AddEntry (g2,
"using MuonProduction profile",
"l");
264 g2->SetLineColor (2);
266 g1->SetLineColor (4);
269 c2.Print (
"test.ps");
271 static int iEvent = 1;
272 ostringstream g1Name, g2Name;
273 g1Name <<
"model_" << int(zenith/
deg) <<
"deg_" << iEvent;
274 g2Name <<
"dndz_" << int(zenith/
deg) <<
"deg_" << iEvent;
276 TFile
file (
"test.root",
"UPDATE");
277 g1->Write (g1Name.str().c_str(), TFile::kOverwrite);
278 g2->Write (g2Name.str().c_str(), TFile::kOverwrite);
309 double atmDepthMin = heightVsSlantDepth.
MinX();
310 double atmDepthMax = heightVsSlantDepth.
MaxX();
314 vector <double> ValueZ;
315 vector <double> ValuedNdZ;
322 double dXslant =
abs (prof [1].X() - prof [0].X());
324 for (
unsigned int iBin=0; iBin<prof.
GetNPoints(); iBin++) {
326 double nDmu = prof [iBin].
Y();
327 double xSlant = prof [iBin].X();
329 double xSlantLow = xSlant-dXslant/2;
330 double xSlantHigh = xSlant+dXslant/2;
334 if (xSlantLow<atmDepthMin || xSlantHigh>atmDepthMax) {
345 double heightLow = heightVsSlantDepth.
Y (xSlantHigh);
346 double heightHigh = heightVsSlantDepth.
Y (xSlantLow);
347 double height = heightVsSlantDepth.
Y (xSlant);
348 double z = -distanceVsHeight.
Y (height);
349 double zLow = -distanceVsHeight.
Y (heightLow);
350 double zHigh = -distanceVsHeight.
Y (heightHigh);
357 double dz =
abs (zHigh-zLow);
375 double logz = log10 (z);
376 double dLogz = log10 (dz);
377 double dMuLogz = (nDmu*dXslant/dLogz) /
g*
cm*
cm *
m;
381 ValueZ.insert (ValueZ.begin(), logz);
382 ValuedNdZ.insert (ValuedNdZ.begin(), dMuLogz);
499 double C = TMath::Gamma (4.5-s) /
500 (TMath::Gamma (s) * TMath::Gamma (4.5-2*s));
502 double rho = C * N/(2.*
kPi*Rmoliere*Rmoliere);
504 rho *=
pow (R, s-2.);
505 rho *=
pow (1.+R, s-4.5);
int GetPrimaryParticle() const
Get the type of the shower primary particle.
unsigned int GetNPoints() const
void InitSlantProfileModel(const utl::Point &core, const utl::Vector &dir, const double deltaX) const
const atm::ProfileResult & EvaluateHeightVsSlantDepth() const
Table of height as a function of slant depth.
Class to hold collection (x,y) points and provide interpolation between them.
bool HasSimShower() const
void Init()
Initialise the registry.
double pow(const double x, const unsigned int i)
double Y(const double x) const
Get the Y value (coordinate) for given X (ordinate)
Interface class to access Shower Simulated parameters.
const atm::Atmosphere & GetAtmosphere() const
const utl::Vector & GetDirection() const
Get the direction of the shower axis. This is the true direction of shower movement.
Class describing the Atmospheric profile.
double abs(const SVector< n, T > &v)
const utl::Point & GetPosition() const
Get the position of the shower core.
Top of the hierarchy of the detector description interface.
const atm::ProfileResult & EvaluateDepthVsHeight() const
Tabulated function giving Y=depth as a function of X=height.
double GetEnergy() const
Get the energy of the shower primary particle.
constexpr double kSpeedOfLight
double MinX() const
Return the minimum value for X (ordinate) stored in the profile.
ResultFlag
Flag returned by module methods to the RunController.
void GetMeanAndRMSOfFirstTime(double &mean_t1, double &rms_t1, const int n=1, const int stats=1000)
const atm::ProfileResult & EvaluateHeightVsDepth() const
Tabulated function giving Y=height as a function of X=depth.
double Y(const double x) const
Get or interpolate the Y value that corresponds to parameter x.
#define ERROR(message)
Macro for logging error messages.
double NKG(const double r, const double n, const double rG, const double s)
bool HasLongitudinalProfile(const ProfileType type=eCharged) const
Check initialization of the longitudinal profile.
double MaxX() const
Return the maximum value for X (ordinate) stored in the profile.
const utl::TabulatedFunction & GetLongitudinalProfile(const ProfileType type=eCharged) const
Get the longitudinal charge profile of the shower.
void SetCoordinates(const double r, const double zeta)