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 xlatextreme;
148 };
149
150 struct EarthBin {
170 EarthBin(double r_out = 0, double r_in = 0, double lat = 0,
171 double lon = 0, double den = 0, double z = 0.5, int n = 0)
172 {
173 SetBin(r_out, r_in, lat, lon, den, z, n);
174 }
175
193 void SetBin(double r_out = 0, double r_in = 0, double lat = 0,
194 double lon = 0, double den = 0, double z = 0.5, int n = 0)
195 {
196 radius_out = r_out;
197 radius_in = r_in;
198 latitude = lat * M_PI / 180.0; // convert to radians
199 longitude = lon * M_PI / 180.0; // convert to radians
200 density = den;
201 zoa = z;
202 index = n;
203 }
204
205 double radius_out;
206 double radius_in;
207 double latitude;
208 double longitude;
209 double density;
210 double zoa;
211 int index;
212 };
213
215 public:
216 EarthModelBinned(std::string filename = "");
217 virtual ~EarthModelBinned();
218
219 void SetDetPos(double rad, double lat = 0,
220 double lon = 0);
222
223 int FillPath(double cosT, double phi = 0);
225
226 virtual void LoadModel(
227 std::string filename);
228
229 virtual std::vector<EarthBin> GetEarthBins();
231
232 virtual void SetRegionZoA(
233 int index,
234 double zoa);
235 virtual double GetRegionZoA(
236 int index);
237 virtual void ScaleRegionDensity(
238 int index, double scalingfactor);
240
241 protected:
242 struct LatBinInfo {
243 int bin;
251 int sign;
255 double dLat;
262 };
263
264 struct LonBinInfo {
265 int bin;
273 double dLon;
277 double min;
278 double max;
279 int error = 0;
281 std::string
283 };
284
285 virtual void ClearModel();
286
287 virtual void AddBin(
288 double radius_out, double radius_in, double latitude,
289 double longitude, double density, double zoa,
290 double layer);
291
292 virtual void AddPath(
293 double length, EarthBin bin);
294
295 virtual double DetDistForNextLatBin(
296 int cur_index,
298 L);
300
301 virtual double DetDistForNextLonBin(
302 double prev_lon,
303 LonBinInfo& L);
306
307 virtual void RecordLatLonBinCrossings(
308 double detDist_nextDbin, double& DetDist, int& index,
309 LatBinInfo& latI,
311 lonI);
313
314 virtual int LonBinIndex(
315 double longitude);
316
318
319 std::vector<EarthBin> fEarthBins;
327
329
330 // For Latitude Calculation Error Message
334
335 // Required for saving in ROOT files
337 };
338
339} // namespace OscProb
340
341#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 xlatextreme
rDet*cos(phi)*cos(DetLat)/[sin(T)*sin(DetLat)-cos(phi)*cosT*cos(DetLat)], unless the denominator is 0...
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.