OscProb
OscProb::EarthModelBase Class Referenceabstract

Base class for implementing an earth model. More...

#include <EarthModelBase.h>

Inheritance diagram for OscProb::EarthModelBase:
OscProb::EarthModelBinned OscProb::PremModel

Public Member Functions

virtual void SetDetPos (double rad, double lat=0, double lon=0)=0
 
virtual int FillPath (double cosT, double phi)=0
 
virtual std::vector< NuPathGetNuPath ()
 
virtual std::vector< NuPathGetMergedPaths (double prec=0.25)
 Get merged path sequence in a vector. More...
 
virtual double GetTotalL (double cosT)
 Get the total baseline for a given cosTheta. More...
 
virtual double GetCosT (double L)
 Get the cosTheta for a given total baseline. More...
 
virtual void SetRemoveSmallPaths (bool rp=true)
 Set tag to remove small paths. More...
 

Protected Member Functions

virtual void SetDetectorCoordinates (double rad, double lat, double lon)
 
virtual void AddPathSegment (double length, double density, double zoa, int index)
 Add a path segment to the sequence. More...
 
 ClassDef (EarthModelBase, 1)
 

Protected Attributes

std::vector< NuPathfNuPath
 The current neutrino path sequence. More...
 
double fRadiusMax
 Maximum radius in Earth model (in km) More...
 
double fDetRadius
 The radius where the detector sits (in km) More...
 
double fDetLat
 The latitude (in rad) where the detector sits. More...
 
double fDetLon
 The longitude (in rad) where the detector sits. More...
 
bool fRemoveSmallPaths
 Tag whether to merge small paths. More...
 

Detailed Description

This abstract class provides the structure to able to produce path sequences through the Earth as a function of the azimuthal angle and cosine of the zenith angle with respect to the detector.

The detector can be positioned at any point within the Earth (except at the exact center), and the path sequences will take into account the fact that some layers are above the detector.

This class inherits from TObject and can be saved in ROOT files.

Author
rpestes@apc.in2p3.fr

Definition at line 27 of file EarthModelBase.h.

Member Function Documentation

◆ AddPathSegment()

void EarthModelBase::AddPathSegment ( double  length,
double  density,
double  zoa,
int  index 
)
protectedvirtual

Add a path segment to the sequence.

For a given EarthBin, adds a path of a given length in that material

Parameters
length- The length of the path segment in km
density- The density along the path segment
zoa- Z/A along the path segment
index- Index for the matter along the path segment

Definition at line 65 of file EarthModelBase.cxx.

67{
68 fNuPath.push_back(NuPath(length, density, zoa, index));
69}
std::vector< NuPath > fNuPath
The current neutrino path sequence.
A struct representing a neutrino path segment.
Definition: NuPath.h:34

References fNuPath.

Referenced by OscProb::EarthModelBinned::AddPath(), and OscProb::PremModel::AddPath().

◆ ClassDef()

OscProb::EarthModelBase::ClassDef ( EarthModelBase  ,
 
)
protected

◆ FillPath()

virtual int OscProb::EarthModelBase::FillPath ( double  cosT,
double  phi 
)
pure virtual

Construct the neutrino path through the Earth having zenith angle defined by cosT and azimuthal angle phi.

Not implemented in base class. Fill the path sequence in a vector (phi in degrees)

Implemented in OscProb::EarthModelBinned, and OscProb::PremModel.

◆ GetCosT()

double EarthModelBase::GetCosT ( double  L)
virtual

Get the cosTheta for a given total baseline.

Given a baseline, find the direction of the neutrino. This could be useful for experiments with fixed baselines for example.

The baseline must be within the range of possible values in this earth model. Will return vertical neutrinos otherwise.

Parameters
L- The total baseline of the neutrino

Definition at line 99 of file EarthModelBase.cxx.

100{
101 if (L < fRadiusMax - fDetRadius) return 1;
102 if (L > fRadiusMax + fDetRadius) return -1;
103
104 return (fRadiusMax * fRadiusMax - fDetRadius * fDetRadius - L * L) /
105 (2 * fDetRadius * L);
106}
double fRadiusMax
Maximum radius in Earth model (in km)
double fDetRadius
The radius where the detector sits (in km)

References fDetRadius, and fRadiusMax.

◆ GetMergedPaths()

vector< NuPath > EarthModelBase::GetMergedPaths ( double  prec = 0.25)
virtual

Merge similar paths to reduce number of steps

This method will merge consecutive paths and take their averages until it finds a large enough gap to start a new merged path.

The merged paths will be returned, and the original detailed path will not be changed and will stay stored as an attribute.

Parameters
prec- The precision to merge paths in g/cm^3
Returns
The vector of merged path segments

Definition at line 121 of file EarthModelBase.cxx.

122{
123 // The output vector
124 vector<NuPath> mergedPath;
125
126 // Start with the first path
127 NuPath path = fNuPath[0];
128
129 // Track the total length
130 double totL = 0;
131
132 // Loop over all paths starting from second
133 for (int i = 1; i < fNuPath.size(); i++) {
134 // If this path electron density is beyond the tolerance
135 if (fabs(path.density * path.zoa - fNuPath[i].density * fNuPath[i].zoa) >
136 prec * path.zoa) {
137 // Add merged path to vector
138 mergedPath.push_back(path);
139
140 // Set this path as new merged path
141 path = fNuPath[i];
142 }
143 else { // If path is within tolerance
144
145 // Merge the path with current merged path
146 path = AvgPath(path, fNuPath[i]);
147 }
148
149 // Increment total length
150 totL += fNuPath[i].length;
151
152 } // End of loop over paths
153
154 // Add the final merged path to vector
155 mergedPath.push_back(path);
156
157 // If tag is true, remove small paths
158 if (fRemoveSmallPaths) {
159 // Start at first path
160 int k = 0;
161
162 // While not at the end of vector
163 while (k + 1 < mergedPath.size()) {
164 // If length is less than 1% of total
165 if (mergedPath[k].length < 0.01 * totL) {
166 // Merge path with following path
167 mergedPath = MergePaths(mergedPath, k, k + 1);
168 }
169 // If path is long enough skip it
170 else
171 k++;
172
173 } // End of while loop
174
175 } // End of if statement
176
177 // return the merged vector
178 return mergedPath;
179}
bool fRemoveSmallPaths
Tag whether to merge small paths.
std::vector< NuPath > MergePaths(std::vector< NuPath > &inputPath, int j, int k)
Merge paths j and k in vector.
Definition: NuPath.cxx:89
NuPath AvgPath(NuPath &p1, NuPath &p2)
Get the average of two paths.
Definition: NuPath.cxx:27
double density
The density of the path segment in g/cm^3.
Definition: NuPath.h:79
double zoa
The effective Z/A value of the path segment.
Definition: NuPath.h:80

References OscProb::AvgPath(), OscProb::NuPath::density, fNuPath, fRemoveSmallPaths, OscProb::MergePaths(), and OscProb::NuPath::zoa.

◆ GetNuPath()

vector< NuPath > EarthModelBase::GetNuPath ( )
virtual

Get the current neutrino path sequence

Get the current neutrino path sequence

The path needs to be filled for a given cosTheta before calling this function.

Definition at line 52 of file EarthModelBase.cxx.

52{ return fNuPath; }

References fNuPath.

◆ GetTotalL()

double EarthModelBase::GetTotalL ( double  cosT)
virtual

Get the total baseline for a given cosTheta.

Parameters
cosT- The cosine of the neutrino direction

Definition at line 77 of file EarthModelBase.cxx.

78{
79 if (fabs(cosT) > 1) return 0;
80
81 double sinsqrT = 1 - cosT * cosT;
82
83 return -fDetRadius * cosT +
84 sqrt(fRadiusMax * fRadiusMax - fDetRadius * fDetRadius * sinsqrT);
85}

References fDetRadius, and fRadiusMax.

◆ SetDetectorCoordinates()

void EarthModelBase::SetDetectorCoordinates ( double  rad,
double  lat,
double  lon 
)
protectedvirtual

Set the coordinates of the detector (rad = radius in km, lat/lon in deg)

Set the coordinates of the detector: radius in km, latitude in degrees, longitude in degrees

Parameters
rad- The distance from the detector to the Earth's center in km
lat- The latitude of the detector in deg N (between -90 and 90)
lon- The longitude of the detector in deg E (between 0 and 360)

Definition at line 25 of file EarthModelBase.cxx.

26{
27 // Force radius to be non-negative
28 if (rad < 0) {
29 cerr << "WARNING: Negative radius detected. Setting to absolute value."
30 << endl;
31 rad = -rad;
32 }
33 fDetRadius = rad;
34
35 // Force latitude to be between -90 and 90 deg
36 lat -= floor((lat + 90.0) / 360.0) * 360.0;
37 if (lat > 90) { lat = 180.0 - lat; }
38 fDetLat = lat / 180.0 * M_PI; // convert to radians
39
40 // Force longitude to be between 0 and 360 deg
41 lon -= floor(lon / 360.0) * 360.0;
42 fDetLon = lon / 180.0 * M_PI; // convert to radians
43}
double fDetLat
The latitude (in rad) where the detector sits.
double fDetLon
The longitude (in rad) where the detector sits.

References fDetLat, fDetLon, and fDetRadius.

Referenced by OscProb::EarthModelBinned::SetDetPos(), and OscProb::PremModel::SetDetPos().

◆ SetDetPos()

virtual void OscProb::EarthModelBase::SetDetPos ( double  rad,
double  lat = 0,
double  lon = 0 
)
pure virtual

Set the coordinates of the detector: radius in km, latitude in degrees, longitude in degrees

Not implemented in base class. Set the detector position (rad = radius in km, lat/lon in deg)

Implemented in OscProb::EarthModelBinned, and OscProb::PremModel.

◆ SetRemoveSmallPaths()

void EarthModelBase::SetRemoveSmallPaths ( bool  rp = true)
virtual

Set the boolean to tag whether to remove small paths when merging Small is defined as <1% of the total baseline

Parameters
rp- Boolean value to set

Definition at line 188 of file EarthModelBase.cxx.

188{ fRemoveSmallPaths = rp; }

References fRemoveSmallPaths.

Referenced by OscProb::EarthModelBinned::EarthModelBinned(), and OscProb::PremModel::PremModel().

Member Data Documentation

◆ fDetLat

double OscProb::EarthModelBase::fDetLat
protected

◆ fDetLon

double OscProb::EarthModelBase::fDetLon
protected

◆ fDetRadius

◆ fNuPath

std::vector<NuPath> OscProb::EarthModelBase::fNuPath
protected

◆ fRadiusMax

◆ fRemoveSmallPaths

bool OscProb::EarthModelBase::fRemoveSmallPaths
protected

Definition at line 81 of file EarthModelBase.h.

Referenced by GetMergedPaths(), and SetRemoveSmallPaths().


The documentation for this class was generated from the following files: