2 #include <atm/Atmosphere.h>
3 #include <atm/ProfileResult.h>
4 #include <det/Detector.h>
6 #include <utl/Vector.h>
7 #include <utl/AugerUnits.h>
8 #include <utl/UTCDateTime.h>
9 #include <utl/Branch.h>
10 #include <fwk/CentralConfig.h>
55 const double x2,
const double y2,
65 const double x2,
const double y2,
69 return exp(
Interpolate(x1, log(y1), x2, log(y2), x));
85 const double spRadius,
const double spPsi,
const double groundHeight,
86 const double xMax,
const double theta,
const int month)
94 auto& detector = det::Detector::GetInstance();
99 const auto& cs = detector.GetReferenceCoordinateSystem();
102 constexpr
double paReferenceHeight = 1400;
103 const double paHeight = groundHeight - paReferenceHeight;
105 const Point core(0, 0, paHeight, cs);
106 const Vector axis(1, theta, 0, cs, Vector::kSpherical);
108 const double gpcm2 =
g/
cm2;
110 const auto& atm = detector.GetAtmosphere();
112 atm.InitSlantProfileModel(core, axis, 0.5*gpcm2);
115 const double projectedStationDistance = -spRadius * tan(theta) * cos(spPsi);
118 const auto& dVsX = atm.EvaluateDistanceVsSlantDepth();
119 const double distanceToXMax = dVsX.Y(xMax * gpcm2) /
meter;
120 return projectedStationDistance - distanceToXMax;
122 const auto& xVsD = atm.EvaluateSlantDepthVsDistance();
123 const double d = projectedStationDistance *
meter;
127 else if (d < xVsD.MaxX()) {
128 const double depthOfProjectedStation = xVsD.Y(d) / gpcm2;
129 return depthOfProjectedStation - xMax;
132 const auto& dists = xVsD.GetXValues();
133 const auto& depths = xVsD.GetYValues();
134 const unsigned int n = dists.size();
135 const double d1 = dists[n-2];
136 const double d2 = dists[n-1];
137 const double depth1 = depths[n-2];
138 const double depth2 = depths[n-1];
139 const double extrapolatedDepth =
ExpInterpolate(d1, depth1, d2, depth2, d);
140 return extrapolatedDepth / gpcm2 - xMax;
149 const double spRadius,
const double spPsi,
const double groundHeight,
150 const double xMax,
const double theta,
const int month)
160 const auto m = monthsDict.at(month);
163 const auto hs2 = mB.GetChild(
"hs2").Get<
double>();
170 const double hProj = spRadius * cos(spPsi) * sin(theta);
171 return (hXmax - hProj - 1400.) / cos(theta);
175 return AnalyticDX(spRadius, spPsi, theta, xMax, xVert, hs, hs2, groundHeight);
182 CalcDX(
const bool realAtmosphere,
const bool useDL,
183 const double spRadius,
const double spPsi,
const double groundHeight,
184 const double xMax,
const double theta,
const int month,
const bool silent)
191 return (realAtmosphere) ?
192 CalcDXRealAtm(useDL, spRadius, spPsi, groundHeight, xMax, theta, month) :
double CalcDX(const bool realAtmosphere, const bool useDL, const double spRadius, const double spPsi, const double groundHeight, const double xMax, const double theta, const int month, const bool silent)
double Interpolate(const double dx, const double dy, const double x)
void SetStream(std::ostream &stream)
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
double ExpInterpolate(const double x1, const double y1, const double x2, const double y2, const double x)
virtual const std::vector< double > & GetGroundLevelDepths() const =0
double AnalyticDX(const double r, const double psi, const double theta, const double Xmax, const double Xvert, const double hs, const double hs2, const double height)
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
double AnalyticHeightFromDepth(const double depth, const double theta, const double xVertGround, const double hs, const double hs2)
double CalcDXRealAtm(const bool useDL, const double spRadius, const double spPsi, const double groundHeight, const double xMax, const double theta, const int month)
static ErrorLogger & GetInstance()
Main configuration utility.
double CalcDXCorsikaAtm(const bool useDL, const double spRadius, const double spPsi, const double groundHeight, const double xMax, const double theta, const int month)
virtual const std::map< unsigned int, std::string > & GetMonthsMapReverse() const =0
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)