12 #include <utl/config.h>
18 #include <TPolyMarker3D.h>
20 #include <utl/Reader.h>
21 #include <utl/ErrorLogger.h>
22 #include <utl/AugerUnits.h>
23 #include <utl/MathConstants.h>
25 #include <utl/PhysicalConstants.h>
26 #include <utl/PhysicalFunctions.h>
27 #include <utl/Point.h>
28 #include <utl/TabulatedFunction.h>
29 #include <utl/TabulatedFunctionErrors.h>
30 #include <utl/Trace.h>
31 #include <utl/MultiTabulatedFunction.h>
32 #include <utl/Photon.h>
33 #include <utl/RandomEngine.h>
34 #include <utl/UTMPoint.h>
36 #include <fwk/CentralConfig.h>
37 #include <fwk/CoordinateSystemRegistry.h>
38 #include <fwk/RandomEngineRegistry.h>
40 #include <det/Detector.h>
42 #include <fdet/FDetector.h>
44 #include <fdet/Telescope.h>
45 #include <fdet/Camera.h>
46 #include <fdet/Pixel.h>
47 #include <fdet/Mirror.h>
48 #include <fdet/Filter.h>
49 #include <fdet/Corrector.h>
51 #include <evt/Event.h>
53 #include <fevt/FEvent.h>
55 #include <fevt/TelescopeSimData.h>
56 #include <fevt/Telescope.h>
57 #include <fevt/PixelSimData.h>
58 #include <fevt/Pixel.h>
60 #include <boost/tuple/tuple.hpp>
62 #include <TDirectory.h>
66 #include <CLHEP/Random/Randomize.h>
72 using namespace TestTorusKG;
80 using CLHEP::RandFlat;
92 cout <<
" Init TestTorus " << endl;
101 cout <<
" Run TestTorus " << endl;
105 Detector& detector = Detector::GetInstance();
106 detector.
Update (simTime);
114 &RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector);
116 const double tubeRadius = 524351.7*
mm;
117 const double torusRadius = 750.*
mm;
118 const double torusZ = tubeRadius + 9.39*
mm;
120 const double phiMin = 0;
121 const double phiMax = 360*
deg;
122 const double distMin = 0.*
m;
123 const double distMax = 1.1*(tubeRadius+torusRadius);
128 const Point origin(0,0,torusZ ,telCS);
129 const Vector inwards(0,0,-1,telCS);
131 TCanvas* canvas =
new TCanvas(
"torus");
133 const int n = 100000;
135 TPolyMarker3D* poly =
new TPolyMarker3D(n*4);
138 for (
int i=0; i<n; ++i) {
140 const double phi = RandFlat::shoot(&theRandomEngine->
GetEngine(), phiMin, phiMax);
141 const double dist = RandFlat::shoot(&theRandomEngine->
GetEngine(), distMin, distMax);
143 const utl::Point point(dist*cos(phi), dist*sin(phi), 3.*tubeRadius, telCS);
151 Photon phot(point, dir, 1, 1, 1);
156 if (intersections.size()==0)
159 if (intersections.size() != 2 && intersections.size() != 4 ) {
160 cout <<
" s=" << intersections.size() << endl;
163 unsigned int indexOfSmallestZ = 4;
164 double smallestZ = 10*tubeRadius/
m;
165 for (
unsigned int j=0; j<intersections.size(); ++j) {
167 const double tmp_x = intersections[j].first.GetPosition().GetX(telCS);
168 const double tmp_y = intersections[j].first.GetPosition().GetY(telCS);
169 const double tmp_r =
sqrt(tmp_x*tmp_x + tmp_y*tmp_y);
170 const double tmp_z = intersections[j].first.GetPosition().GetZ(telCS);
172 if( tmp_r/m < 1.1*m && tmp_r/m > 0.85*
m && tmp_z/
m < smallestZ/
m ) {
174 indexOfSmallestZ = j;
176 poly->SetPoint(count++, tmp_x, tmp_y, tmp_z);
179 if (indexOfSmallestZ < 4) {
180 const double tmpx = intersections[indexOfSmallestZ].first.GetPosition().GetX(telCS);
181 const double tmpy = intersections[indexOfSmallestZ].first.GetPosition().GetY(telCS);
182 const double tmpz = intersections[indexOfSmallestZ].first.GetPosition().GetZ(telCS);
183 const double tmpr =
sqrt(tmpx*tmpx + tmpy*tmpy);
185 cout <<
"lenspoint " << tmpx/
mm <<
" "
201 canvas->SaveAs(
"torus.C");
202 canvas->SaveAs(
"torus.eps");
211 cout <<
" Finish TestTorus " << endl;
std::vector< PhotonNormalPair > IntersectionList
void Update(const utl::TimeStamp &time, const bool invData=true, const bool invComp=true, const bool forceRadio=false)
Update detector: deletes currently constructed stations and sets new time.
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
RandomEngineType & GetEngine()
EyeIterator EyesBegin(const FDetComponentSelector::Type type=FDetComponentSelector::ePhysical) const
iterator pointing to first eye of given type (ePhysical, eVirtual, eAll)
Detector description interface for Eye-related data.
Detector description interface for FDetector-related data.
A TimeStamp holds GPS second and nanosecond for some event.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
utl::CoordinateSystemPtr GetTelescopeCoordinateSystem() const
Wraps the random number engine used to generate distributions.
TelescopeIterator TelescopesBegin() const
Beginning of the collection of telescopes.
Top of the hierarchy of the detector description interface.
const fdet::FDetector & GetFDetector() const
fwk::VModule::ResultFlag Run(evt::Event &event)
Run: invoked once per event.
Detector description interface for Telescope-related data.
ResultFlag
Flag returned by module methods to the RunController.
void Torus(const utl::Point &origin, const utl::Vector &inwards, const double torusRadius, const double tubeRadius, const utl::Photon &photonIn, IntersectionList &intersections)
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)