13 #include <TPolyLine3D.h>
14 #include <TObjArray.h>
16 #include <utl/MathConstants.h>
17 #include <utl/AugerUnits.h>
19 #include <utl/Photon.h>
20 #include <utl/Point.h>
21 #include <utl/Vector.h>
22 #include <utl/RandomEngine.h>
23 #include <utl/CoordinateSystemPtr.h>
25 #include <fdet/Telescope.h>
26 #include <fdet/Corrector.h>
28 #include <det/Detector.h>
30 #include <atm/Atmosphere.h>
31 #include <atm/ProfileResult.h>
37 using namespace TelescopeSimulatorKG;
49 fOrigin =
Point (0,0,0, fTelCS);
61 det::Detector::GetInstance().GetAtmosphere().EvaluateRefractionIndexVsHeight();
62 fInd1 = refractiveIndexVsHeight.
Y(refractiveIndexVsHeight.
MinX());
76 if (nIn.
GetZ(fTelCS)>0) {
82 const double x = pIn.
GetX(fTelCS);
83 const double y = pIn.
GetY(fTelCS);
84 const double r2 = x*x + y*y;
85 const double r =
sqrt(r2);
97 const Vector normal1 = Curvature(x, y);
98 const double z = Profile(r);
101 const double r_index_12 = fInd1 / fRefractiveIndex->Y(lambda);
105 if (photonsRefracted.size() != 2) {
108 Photon photonRefracted = photonsRefracted[0];
111 const double thickness = z / cosThetaPhoton;
113 if (fTransmittance->Y(lambda) == 0)
116 const double internal_absorption = exp(thickness/(1.*
cm)*log(fTransmittance->Y(lambda)));
128 Vector normal2 (0., 0., 1., fTelCS);
132 if (photonsOut.size() != 2) {
136 photonOut = photonsOut[0];
137 const double weight = photonOut.
GetWeight();
138 photonOut.
SetWeight(weight*internal_absorption);
146 TObjArray* objs =
new TObjArray();
152 for (
int i=0; i<nSeg; i++) {
154 double theta_1 = 360.*
deg/nSeg * i;
155 double theta_2 = 360.*
deg/nSeg * (i+1);
157 TPolyLine3D *l_in =
new TPolyLine3D (1);
158 l_in->SetPoint (0, cos(theta_1)*fR1, sin(theta_1)*fR1, 0);
159 l_in->SetPoint (1, cos(theta_2)*fR1, sin(theta_2)*fR1, 0);
160 l_in->SetLineColor(color);
161 l_in->SetLineWidth(width);
165 TPolyLine3D *l_out =
new TPolyLine3D (1);
166 l_out->SetPoint (0, cos(theta_1)*fR2, sin(theta_1)*fR2, 0);
167 l_out->SetPoint (1, cos(theta_2)*fR2, sin(theta_2)*fR2, 0);
168 l_out->SetLineColor(color);
169 l_out->SetLineWidth(width);
171 objs->AddLast(l_out);
173 TPolyLine3D *l_seg =
new TPolyLine3D (1);
174 l_seg->SetPoint (0, cos(theta_1)*fR1, sin(theta_1)*fR1, 0);
175 l_seg->SetPoint (1, cos(theta_1)*fR2, sin(theta_1)*fR2, 0);
176 l_seg->SetLineColor(color);
177 l_seg->SetLineWidth(width);
179 objs->AddLast(l_seg);
188 const double r =
sqrt(x*x + y*y);
190 static const double f = 3.4*
m - 1.743*
m;
191 static const double Rd = .85*
m;
193 static const double A = 3./2. * Rd*Rd;
194 static const double n = 1.5;
196 static const double denominator = 32.*(n-1.)*f*f*f;
197 static const double a1 = 1./denominator;
198 static const double a2 = A/denominator;
200 double dTdr = 4.*a1*r*r*r - 2.*a2*r;
218 double phi = atan2(y,x);
220 return Vector (-nr*cos(phi), -nr*sin(phi), nz, fTelCS);
250 static const double f = 3.4*
m - 1.743*
m;
251 static const double Rd = .85*
m;
252 static const double A = 3./2. * Rd*Rd;
253 static const double n = 1.5;
255 static const double denominator = 32.*(n-1.)*f*f*f;
256 static const double a1 = 1./denominator;
257 static const double a2 = A/denominator;
259 static const double z0 = 10.*
mm;
261 double z = z0 + a1*r2*r2 - a2*r2;
double GetInnerRadius() const
Inner radius of the ring.
std::vector< utl::Photon > PhotonList
const Corrector & GetCorrector() const
Get the Corrector (corrector ring) object that belongs to the telescope.
double GetCosTheta(const CoordinateSystemPtr &coordinateSystem) const
cos of zenith (theta) angle
const utl::TabulatedFunction & GetTransmittance() const
Transmittance as a function of the wavelength.
double GetWeight() const
weight assigned to the photon
void SetPosition(const utl::Point &p)
double Y(const double x) const
Get the Y value (coordinate) for given X (ordinate)
double GetSigmaNormal() const
Variable to model the lens surface imperfection.
utl::Vector Curvature(const double x, const double y) const
double GetOuterRadius() const
Outer radius of the ring.
utl::CoordinateSystemPtr GetTelescopeCoordinateSystem() const
double GetX(const CoordinateSystemPtr &coordinateSystem) const
Wraps the random number engine used to generate distributions.
Class describing the Atmospheric profile.
void SetWeight(const double w)
source of the photons. Should use Eye::LightSource enum types
Description of a corrector ring.
double Profile(const double r) const
RTResult Trace(const utl::Photon &photonIn, utl::Photon &photonOut)
const utl::Vector & GetDirection() const
int Refraction(const double n12, const utl::Photon &photonIn, const Vector &normal, PhotonList &photonsOut)
double GetY(const CoordinateSystemPtr &coordinateSystem) const
const utl::TabulatedFunction & GetRefractiveIndex() const
Index of refraction as a funcction of the wavelength.
Detector description interface for Telescope-related data.
double MinX() const
Return the minimum value for X (ordinate) stored in the profile.
Lens(utl::RandomEngine &rndm, const fdet::Telescope &tel)
double GetWavelength() const
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
const utl::Point & GetPosition() const