AtmosphericProfile.cc
Go to the documentation of this file.
1 
9 #include "AtmosphericProfile.h"
10 
11 // basic headers with top-level offline classes
12 #include <evt/Event.h>
13 #include <fwk/CentralConfig.h>
14 #include <det/Detector.h>
15 #include <utl/ErrorLogger.h>
16 
17 // geometry headers
18 #include <utl/UTMPoint.h>
19 #include <utl/Point.h>
20 #include <utl/Vector.h>
21 #include <fwk/CoordinateSystemRegistry.h>
22 #include <utl/CoordinateSystemPtr.h>
23 
24 // These are the ones needed for the profiles
25 #include <atm/Atmosphere.h>
26 #include <atm/ProfileResult.h>
27 
28 #include <TFile.h>
29 #include <TGraph.h>
30 
31 using namespace std;
32 using namespace evt;
33 using namespace atm;
34 using namespace fwk;
35 using namespace utl;
36 
37 using namespace AtmosphericProfileNS;
38 
39 AtmosphericProfile::AtmosphericProfile(){}
40 
41 AtmosphericProfile::~AtmosphericProfile(){}
42 
43 
46 {
47  //CentralConfig* theConfig = CentralConfig::GetInstance();
48  return eSuccess;
49 }
50 
51 
53 AtmosphericProfile::Run(evt::Event& /*event*/)
54 {
55  TFile file("profiles.root", "RECREATE");
56 
57  CoordinateSystemPtr pampaCS =
58  CoordinateSystemRegistry::Get("PampaAmarilla");
59 
60  const Atmosphere& theAtm = det::Detector::GetInstance().GetAtmosphere();
61  // These do not need to be initialized because they are not slanted:
62  // const ProfileResult& densityVsHeight = theAtm.EvaluateDensityVsHeight();
63  const ProfileResult& depthVsHeight = theAtm.EvaluateDepthVsHeight();
64  // const ProfileResult& heightVsDepth = theAtm.EvaluateHeightVsDepth();
65 
66 
67  const Point corePosition(0,0,0,pampaCS);
68  const UTMPoint utm_core(corePosition, ReferenceEllipsoid::eWGS84);
69  const double z_ground = depthVsHeight.Y(utm_core.GetHeight());
70 
71  // Let's make a zenith angle scan and make a few plots:
72  double azimuth = 0;
73  TGraph* depthVsZenith = new TGraph();
74  TGraph* depthVsZenith2 = new TGraph();
75  for (double zenith = 0; zenith < 80*deg; zenith += 5*deg) {
76  const CoordinateSystemPtr showerCs =
77  CoordinateSystem::RotationY(zenith,
78  CoordinateSystem::RotationZ(azimuth,
79  pampaCS));
80  const Vector showerDirection(0,0,-1, showerCs);
81  // Important! One has to call this method before using any slant profile
82  // Note the minus sign (showerDirection points in the negative-z direction).
83  theAtm.InitSlantProfileModel(corePosition, -showerDirection, 20*g/cm/cm);
84  // const ProfileResult& slantProfile_DistanceVsDepth = theAtm.EvaluateDistanceVsSlantDepth();
85  const ProfileResult& slantProfile_DepthVsDistance = theAtm.EvaluateSlantDepthVsDistance();
86  const double x_ground = slantProfile_DepthVsDistance.Y(0);
87 
88  depthVsZenith->SetPoint(depthVsZenith->GetN(), zenith/deg, x_ground/(g/cm2));
89  depthVsZenith2->SetPoint(depthVsZenith->GetN(), zenith/deg, z_ground/(g/cm2)/cos(zenith));
90  }
91  depthVsZenith->Write("depthVsZenithCurveAtm");
92  depthVsZenith2->Write("depthVsZenithFlatAtm");
93 
94  const double maxh = 30*km;
95  const double minh = 0*m;
96  const unsigned int N = 200;
97  const double dh = (maxh - minh)/N;
98  TGraph* verticalDepthProfile = new TGraph();
99  for (unsigned int i = 0; i != N; ++i) {
100  const double h = minh+dh*i;
101  const double depth = depthVsHeight.Y(h)/(g/cm2);
102  verticalDepthProfile->SetPoint(i, h/km, depth);
103  }
104  verticalDepthProfile->Write("verticalDepthProfile");
105 
106  // Now let's plot the slant depth as a function of the distance to the ground for a particular zenith angle
107  CoordinateSystemPtr showerCs = CoordinateSystem::RotationY(85*deg, CoordinateSystem::RotationZ(azimuth, pampaCS));
108  Vector showerDirection(0,0,-1, showerCs);
109  theAtm.InitSlantProfileModel(corePosition, -showerDirection, 20*g/cm/cm);
110  const ProfileResult& slantProfile_DepthVsDistance = theAtm.EvaluateSlantDepthVsDistance();
111 
112  TGraph* slantDepthPlot = new TGraph();
113  const double dmax = maxh/cos(85.*utl::deg);
114  for (int i = 0; i != int(dmax/dh); ++i) {
115  // SD people: note the minus sign!
116  slantDepthPlot->SetPoint(i, i*dh/km, slantProfile_DepthVsDistance.Y(-i*dh)/g*cm2);
117  }
118  slantDepthPlot->Write("slantDepthProfile");
119 
120  file.Close();
121 
122  return eSuccess;
123 }
124 
125 
127 AtmosphericProfile::Finish(){
128  return eSuccess;
129 }
Top of the interface to Atmosphere information.
Point object.
Definition: Point.h:32
void InitSlantProfileModel(const utl::Point &core, const utl::Vector &dir, const double deltaX) const
Class to hold and convert a point in geodetic coordinates.
Definition: UTMPoint.h:40
void Init()
Initialise the registry.
double Y(const double x) const
Get the Y value (coordinate) for given X (ordinate)
constexpr double deg
Definition: AugerUnits.h:140
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
double GetHeight() const
Get the height.
Definition: UTMPoint.h:212
Class describing the Atmospheric profile.
Definition: ProfileResult.h:25
const atm::ProfileResult & EvaluateDepthVsHeight() const
Tabulated function giving Y=depth as a function of X=height.
const double km
constexpr double g
Definition: AugerUnits.h:200
const string file
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
constexpr double cm
Definition: AugerUnits.h:117
Vector object.
Definition: Vector.h:30
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
const atm::ProfileResult & EvaluateSlantDepthVsDistance() const
constexpr double m
Definition: AugerUnits.h:121
constexpr double cm2
Definition: AugerUnits.h:118

, generated on Tue Sep 26 2023.