OscProb
EarthModelBinned.h
Go to the documentation of this file.
1
30
43
54
63
72
73#ifndef EARTHMODELBINNED_H
74#define EARTHMODELBINNED_H
75
76#include "EarthModelBase.h"
77
78namespace OscProb {
79
96 TrajConstants(double cosT = 0, double phi = 0, double DetLat = 0,
97 double DetLon = 0, double rDet = 6368)
98 {
99 UpdateNuAngles(cosT, phi);
100 UpdateDetPos(DetLat, DetLon, rDet);
101 }
102
103 void UpdateNuAngles(
104 double cosTheta,
105 double phi);
107 void UpdateDetPos(double rDet, double DetLat,
108 double DetLon);
110 void Recalculate();
113
114 // Variables defining trajectory
115 double cosT;
116 double cosA;
117 double sinA;
118 double sinDetLat;
119 double cosDetLon;
120 double sinDetLon;
121 double DetRadius;
122
123 // Derived Variables Calculated by UpdateNuAngles()
124 double sinSqT;
125 double sinT;
126 double sinTsinA;
127 double sinTcosA;
128
129 // Derived Variables Calculated by UpdateDetPos()
130 double cosDetLat;
133
134 // Derived Variables Calculated by Recalculate()
138 double rDetCosT;
139 double rDetSinT;
140 double alpha;
141 double beta;
142 double gamma;
143 double gammaSq;
144 double
146 double maxSinSqLat;
147 double
151 };
152
153 struct EarthBin {
173 EarthBin(double r_out = 0, double r_in = 0, double lat = 0,
174 double lon = 0, double den = 0, double z = 0.5, int n = 0)
175 {
176 SetBin(r_out, r_in, lat, lon, den, z, n);
177 }
178
196 void SetBin(double r_out = 0, double r_in = 0, double lat = 0,
197 double lon = 0, double den = 0, double z = 0.5, int n = 0)
198 {
199 radius_out = r_out;
200 radius_in = r_in;
201 latitude = lat * M_PI / 180.0; // convert to radians
202 longitude = lon * M_PI / 180.0; // convert to radians
203 density = den;
204 zoa = z;
205 index = n;
206 }
207
208 double radius_out;
209 double radius_in;
210 double latitude;
211 double longitude;
212 double density;
213 double zoa;
214 int index;
215 };
216
218 public:
219 EarthModelBinned(std::string filename = "");
220 virtual ~EarthModelBinned();
221
222 void SetDetPos(double rad, double lat = 0,
223 double lon = 0);
225
226 int FillPath(double cosT, double phi = 0);
228
229 virtual void LoadModel(
230 std::string filename);
231
232 virtual std::vector<EarthBin> GetEarthBins();
234
235 virtual void SetRegionZoA(
236 int index,
237 double zoa);
238 virtual double GetRegionZoA(
239 int index);
240 virtual void ScaleRegionDensity(
241 int index, double scalingfactor);
243
244 protected:
245 struct LatBinInfo {
246 int bin;
254 int sign;
258 double dLat;
265 };
266
267 struct LonBinInfo {
268 int bin;
276 double dLon;
280 double min;
281 double max;
282 int error = 0;
284 std::string
286 };
287
288 virtual void ClearModel();
289
290 virtual void AddBin(
291 double radius_out, double radius_in, double latitude,
292 double longitude, double density, double zoa,
293 double layer);
294
295 virtual void AddPath(
296 double length, EarthBin bin);
297
298 virtual double DetDistForNextLatBin(
299 int cur_index,
301 L);
303
304 virtual double DetDistForNextLonBin(
305 double prev_lon,
306 LonBinInfo& L);
309
310 virtual void RecordLatLonBinCrossings(
311 double detDist_nextDbin, double& DetDist, int& index,
312 LatBinInfo& latI,
314 lonI);
316
317 virtual int LonBinIndex(
318 double longitude);
319
321
322 std::vector<EarthBin> fEarthBins;
330
332
333 // For Latitude Calculation Error Message
337
338 // Required for saving in ROOT files
340 };
341
342} // namespace OscProb
343
344#endif
Base class for implementing an earth model.
Implements an earth model with depth/latitude/longitude bins.
virtual double GetRegionZoA(int index)
Get Z/A of all bins with specified region index.
virtual double DetDistForNextLonBin(double prev_lon, LonBinInfo &L)
std::vector< EarthBin > fEarthBins
The bins in the earth model.
virtual void ClearModel()
Clear the earth model information.
double fInvLonBinWidth
1/binwidth for each longitude bin
virtual void AddPath(double length, EarthBin bin)
Add a path segment to the sequence.
virtual ~EarthModelBinned()
Destructor.
int fnDepthBins
Total number of depth bins.
int FillPath(double cosT, double phi=0)
virtual std::vector< EarthBin > GetEarthBins()
virtual void LoadModel(std::string filename)
Load an earth model from a file.
EarthModelBinned(std::string filename="")
Constructor.
virtual void RecordLatLonBinCrossings(double detDist_nextDbin, double &DetDist, int &index, LatBinInfo &latI, LonBinInfo &lonI)
double fHalfLonBinWidth
Half-width of each longitude bin.
void SetDetPos(double rad, double lat=0, double lon=0)
virtual void SetRegionZoA(int index, double zoa)
Set Z/A of all bins with specified region index.
int fnLatBins
Total number of latitude bins.
virtual void AddBin(double radius_out, double radius_in, double latitude, double longitude, double density, double zoa, double layer)
Add a bin to the model (angles in degrees)
double fHalfLatBinWidth
Half-width of each latitude bin.
double fInvLatBinWidth
1/binwidth for each latitude bin
virtual int LonBinIndex(double longitude)
Find lon bin index containing longitude.
TrajConstants fC
Useful constants for the trajectory.
int fmaxRegIndex
Largest region index in model.
ClassDef(EarthModelBinned, 1)
virtual void ScaleRegionDensity(int index, double scalingfactor)
virtual double DetDistForNextLatBin(int cur_index, LatBinInfo &L)
int fnLonBins
Total number of longitude bins.
Some useful general definitions.
Definition: Absorption.h:6
double radius_in
The inner radius of the bin in km.
double latitude
The latitude of the bin center in radians.
double longitude
The longitude of the bin center in radians.
double zoa
The effective Z/A value of the matter in the bin.
EarthBin(double r_out=0, double r_in=0, double lat=0, double lon=0, double den=0, double z=0.5, int n=0)
Constructor.
double radius_out
The outer radius of the bin in km.
int index
Region index.
void SetBin(double r_out=0, double r_in=0, double lat=0, double lon=0, double den=0, double z=0.5, int n=0)
Set the properties of the bin.
double density
The density of the matter in the bin in g/cm^3.
A struct holding information about upcoming latitude bin crossings along the neutrino's trajectory.
int nextBin
Index of next latitude bin.
int bin
Index of current latitude bin.
A struct holding information about upcoming longitude bin crossings along the neutrino's trajectory.
int nextBin
Index of next longitude bin.
int bin
Index of current longitude bin.
std::string err_message
Part of error message specific to piece of path.
A struct holding useful combinations of trajectory variables.
double cosTcosDetLat
cosT*cos(DetLat)
double sinTsinA
sin(T)*sin(phi)
double cosDetLon
cos(DetLon)
double beta
sin(T)*sin(DetLat)-cos(phi)*cosT*cos(DetLat)
double gammaSq
[sin(T)*cos(phi)*cos(DetLat)+cosT*sin(DetLat)]^2
double sinDetLat
sin(DetLat)
double rDetSinT
rDet*sin(T)
double sinTcosA
sin(T)*cos(phi)
double alpha
sin(T)*cos(phi)*sin(DetLat)-cosT*cos(DetLat)
double rDetCosT
rDet*cosT
double rDetGammaSinDetLat
rDet*sin(DetLat)*[sin(T)*cos(phi)*cos(DetLat)+cosT*sin(DetLat)]
double sinSqT
sin^2(T) = 1 - (cosT)^2
double sinDetLon
sin(DetLon)
double sinTsinAsinDetLon
sin(T)*sin(phi)*sin(DetLon)
void UpdateDetPos(double rDet, double DetLat, double DetLon)
double gamma
sin(T)*cos(phi)*cos(DetLat)+cosT*sin(DetLat)
double maxSinSqLat
1 - [sin(phi)*cos(DetLat)]^2
void UpdateNuAngles(double cosTheta, double phi)
double rDetSinDetLat
rDet*sin(DetLat)
double rDetCosDetLat
rDet*cos(DetLat)
double cosDetLat
cos(DetLat)
double sinT
sin(T) = sqrt(sinSqT)
double sinTsinAcosDetLon
sin(T)*sin(phi)*cos(DetLon)
TrajConstants(double cosT=0, double phi=0, double DetLat=0, double DetLon=0, double rDet=6368)
Constructor.