7 #include <fdet/Telescope.h>
9 #include <utl/RandomEngine.h>
10 #include <utl/Photon.h>
11 #include <utl/ErrorLogger.h>
12 #include <utl/AugerUnits.h>
15 #include <fwk/RunController.h>
16 #include <evt/Event.h>
17 #include <evt/Header.h>
19 #include <TPolyLine3D.h>
21 #include <TObjArray.h>
30 using namespace TelescopeSimulatorKG2;
36 fX.push_back(p.
GetX(fCS));
37 fY.push_back(p.
GetY(fCS));
38 fZ.push_back(p.
GetZ(fCS));
42 RayTracer::Track::GetLine()
44 TPolyLine3D* track =
new TPolyLine3D(fX.size(), &fX.front(), &fY.front(), &fZ.front());
45 track->SetLineColor(fColor);
50 RayTracer::RayTracer(
const int Verbosity,
54 bool simualteCameraSupportShadow,
55 bool simulateMercedesStars,
56 bool simulateFilterStructure,
57 bool simulateHaloEffects,
58 bool simulateGhostEffects,
59 const int maxMirrorReflections,
60 const double mirrorSize,
61 const double mirrorSegmentSigma,
62 const double mirrorRadiusSigma,
63 const double mirrorAbsorptionTop,
64 const double mirrorAbsorptionBot,
67 const double filterIncreaseReflInside,
68 const double filterIncreaseReflOutside,
69 const double filterPosition,
70 const double filterPositionVertical,
71 const double filterPositionVertical2,
72 const double filterPositionHorizontal,
73 const double filterDustAbsorption,
74 const double lensIncreaseRefl,
75 const double lensPosition,
76 const double minLensThickness,
77 const double torusRadius,
78 const double tubeRadius,
81 bool plotPhotonTracks,
82 bool plotPhotonTracksAtMercedes,
83 double drawPhotonsProbabilty) :
84 fVerbosity(Verbosity),
87 fSimulateCameraShadow(simulateShadow),
88 fSimualteCameraSupportShadow(simualteCameraSupportShadow),
89 fSimulateMercedesStars(simulateMercedesStars),
90 fSimulateFilterStructure(simulateFilterStructure),
91 fSimulateHaloEffects(simulateHaloEffects),
92 fSimulateGhostEffects(simulateGhostEffects),
93 fMaxMirrorReflections(maxMirrorReflections),
94 fPlotPhotonTracks(plotPhotonTracks),
95 fDrawPhotonProbability(drawPhotonsProbabilty),
96 fNTooManyReflections(0)
102 filterIncreaseReflInside,
103 filterIncreaseReflOutside,
105 filterPositionVertical,
106 filterPositionVertical2,
107 filterPositionHorizontal,
108 filterDustAbsorption,
133 plotPhotonTracksAtMercedes,
139 if (plotPhotonTracks)
149 ostringstream fnameBase, fnameRoot, fnameCanvas;
150 const string id = fwk::RunController::GetInstance().GetCurrentEvent().GetHeader().GetId();
151 fnameBase <<
"raytrace_" <<
id
154 fnameRoot << fnameBase.str() <<
".root";
155 fnameCanvas << fnameBase.str() <<
".eps";
162 TPolyLine3D* photon =
dynamic_cast<TPolyLine3D*
>((*fObjectsPhotons)[iObj]);
166 c.Print(fnameCanvas.str().c_str());
167 TFile f(fnameRoot.str().c_str(),
"RECREATE");
179 ostringstream bugMsg;
194 int& nMercReflections,
199 nMercReflections = 0;
202 int nMirrorReflections = 0;
205 int trackColor = kBlue;
218 bool finished =
false;
219 bool detected =
false;
220 bool terminate =
false;
232 cout <<
"RayTracer ------- new photon ------- " << endl;
240 cout <<
"RayTracer: w=" << setprecision(3) << setw(6) << photon.
GetWeight()
241 <<
" x=" << setprecision(3) << setw(6) << photon.
GetPosition().
GetX(telCS)
242 <<
" y=" << setprecision(3) << setw(6) << photon.
GetPosition().
GetY(telCS)
243 <<
" z=" << setprecision(3) << setw(6) << photon.
GetPosition().
GetZ(telCS)
244 <<
" nx=" << setprecision(3) << setw(6) << photon.
GetDirection().
GetX(telCS)
245 <<
" ny=" << setprecision(3) << setw(6) << photon.
GetDirection().
GetY(telCS)
246 <<
" nz=" << setprecision(3) << setw(6) << photon.
GetDirection().
GetZ(telCS)
280 if (!backwards && next==
eFilter)
292 ++nMirrorReflections;
296 next =
fCamera->
Trace(photon, photon, nMercReflections, nBackScattered, col,row);
302 photonTrack.SetColor(kGray+1);
321 err <<
"do not use SIZE_RTNext for anything but output";
354 TPolyLine3D* track = photonTrack.GetLine();
void SetPhotonTrack(RayTracer::Track *const track)
TObjArray * Draw(const bool do3D=true)
RTNext TraceShadow(const utl::Photon &photonIn, utl::Photon &photonOut, const bool doSupport=true)
Simulates the UV filter in the raytracing of the TelescopeSimulator module.
const int fMaxMirrorReflections
Simulates the corrector ring in the raytracing of the TelescopeSimulator module.
double GetR(const CoordinateSystemPtr &coordinateSystem) const
radius r in spherical coordinates coordinates (distance to origin)
Class to hold collection (x,y) points and provide interpolation between them.
RTNext Trace(const utl::Photon &photonIn, utl::Photon &photonOut, int &nreflections, int &nbackscattered, int &col, int &row)
unsigned int GetEyeId() const
#define INFO(message)
Macro for logging informational messages.
double GetWeight() const
weight assigned to the photon
int GetSource() const
source of the photons. Should use Eye::LightSource enum types
bool HasCorrectorRing() const
flag for corrector ring presence
RTNext Trace(const utl::Photon &photonIn, utl::Photon &photonOut)
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Iterator next(Iterator it)
utl::CoordinateSystemPtr GetTelescopeCoordinateSystem() const
double GetX(const CoordinateSystemPtr &coordinateSystem) const
Wraps the random number engine used to generate distributions.
RTNext Trace(const utl::Photon &photonIn, utl::Photon &photonOut)
Simulate the filter.
RTNext TraceWithTorus(const utl::Photon &photonIn, utl::Photon &photonOut)
Simulate the lens.
RTResult Trace(const utl::Photon &photonIn, utl::Photon &photonOut, int &nreflections, int &nbackscattered, int &col, int &row)
Raytracing through the telescope components.
bool fSimulateHaloEffects
double GetInterval() const
Get the time interval as a double (in Auger base units)
const utl::Vector & GetDirection() const
void SetColor(const int color)
double GetY(const CoordinateSystemPtr &coordinateSystem) const
Detector description interface for Telescope-related data.
bool fSimulateMercedesStars
bool fSimualteCameraSupportShadow
void SetPhotonTrack(RayTracer::Track *const track)
bool fSimulateFilterStructure
bool fSimulateGhostEffects
const std::string RTNextName[SIZE_RTNext]
TObjArray * fObjectsPhotons
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
Simulates the mirror in the raytracing of the TelescopeSimulator module.
#define ERROR(message)
Macro for logging error messages.
utl::TimeInterval GetTime() const
unsigned int GetId() const
const fdet::Telescope * fTel
const utl::Point & GetPosition() const