5 #include <utl/Reader.h>
6 #include <utl/ErrorLogger.h>
7 #include <utl/AugerUnits.h>
8 #include <utl/AugerException.h>
9 #include <utl/MathConstants.h>
10 #include <utl/PhysicalConstants.h>
11 #include <utl/PhysicalFunctions.h>
12 #include <utl/Point.h>
13 #include <utl/Vector.h>
14 #include <utl/AxialVector.h>
15 #include <utl/TabulatedFunction.h>
16 #include <utl/TabulatedFunctionErrors.h>
17 #include <utl/UTMPoint.h>
18 #include <utl/ReferenceEllipsoid.h>
19 #include <utl/TransformationMatrix.h>
20 #include <utl/TimeStamp.h>
21 #include <utl/AugerCoordinateSystem.h>
23 #include <utl/Particle.h>
25 #include <evt/Event.h>
26 #include <evt/ShowerSimData.h>
27 #include <evt/LaserData.h>
29 #include <fevt/FEvent.h>
31 #include <fevt/TelescopeSimData.h>
32 #include <fevt/Telescope.h>
34 #include <fwk/CentralConfig.h>
35 #include <fwk/LocalCoordinateSystem.h>
37 #include <det/Detector.h>
38 #include <fdet/FDetector.h>
40 #include <fdet/Telescope.h>
41 #include <fdet/Camera.h>
43 #include <atm/AttenuationResult.h>
44 #include <atm/ScatteringResult.h>
45 #include <atm/Atmosphere.h>
46 #include <atm/ProfileResult.h>
57 using namespace FieldOfViewCalculatorKG;
70 CentralConfig::GetInstance()->
GetTopBranch(
"FieldOfViewCalculator");
79 << GetVersionInfo(VModule::eRevisionNumber) <<
"\n"
81 " time binning: " << fBinning <<
" (relative to FADC sampling)" <<
"\n"
82 " min. angular step: "<< fMaxAngleBinWidth/
deg <<
" deg \n ";
109 ERROR(
"Missing FEvent. Check your module configurations and ModuleSequence.");
115 ERROR(
"Event has no simulated shower.");
122 const Point core(0, 0, 0, showerCS);
123 const Vector showerAxis(0, 0, -1, showerCS);
128 Detector& detector = Detector::GetInstance();
137 double atmDepthMin = distanceVsSlantDepth.
MinX();
138 double atmDepthMax = distanceVsSlantDepth.
MaxX();
139 double distStart = distanceVsSlantDepth.
Y(atmDepthMin);
140 double distStop = distanceVsSlantDepth.
Y(atmDepthMax);
144 double profStartDist = distanceVsSlantDepth.
Y(profStartX);
145 if (profStartDist > distStart)
146 distStart = profStartDist;
151 const double distInitFinal = distStop - distStart;
153 info <<
"Shower geometry parameters: distance_start=" << distStart/
km <<
" km, "
154 <<
" distance_stop=" << distStop/
km <<
" km, "
155 <<
" length=" << distInitFinal/
km <<
" km";
162 unsigned int sumAllBins = 0;
165 iEye != detFD.
EyesEnd(); ++iEye) {
167 const unsigned int eyeId = iEye->GetId();
170 ERROR(
"EYE already there!!!!");
176 iTel != iEye->TelescopesEnd(); ++iTel) {
178 const unsigned int telId = iTel->
GetId();
181 ERROR(
"TELESCOPE already there!!!!");
204 const Vector d_initial = core - telPosition;
207 info <<
"Eye=" << eyeId <<
" Tel=" << telId;
219 const double b1 =
std::pow(d_initial * axis, 2);
220 const double b2 = 2 * (d_initial * axis) * (axis * showerAxis);
221 const double b3 =
std::pow(axis * showerAxis, 2);
222 const double a1 = d_initial * d_initial;
223 const double a2 = 2 * (d_initial * showerAxis);
227 const double cosFOV2 = cosFOV * cosFOV;
229 const double A = cosFOV2 * a3 - b3;
230 const double B = cosFOV2 * a2 - b2;
231 const double C = cosFOV2 * a1 - b1;
234 if (B*B - 4*A*C < 0) {
240 double distMin = (-B -
sqrt(B*B - 4*A*C)) / (2*A);
241 double distMax = (-B +
sqrt(B*B - 4*A*C)) / (2*A);
251 if (distMin > distMax)
252 swap(distMin, distMax);
263 const Point pMin = core + distMin*showerAxis;
264 const Point pMax = core + distMax*showerAxis;
267 const bool invalidPointMin = ((pMin - telPosition)*axis < 0);
268 const bool invalidPointMax = ((pMax - telPosition)*axis < 0);
270 if (invalidPointMin && invalidPointMax) {
276 }
else if (invalidPointMax) {
278 if (distMin > distStart) {
291 }
else if (invalidPointMin) {
293 if (distMax<distStop) {
315 distMin =
max(distMin, distStart);
316 distMax = min(distMax, distStop);
325 if (distMin >= distMax) {
335 const Point pointMin = core + distMin*showerAxis;
336 const Point pointMax = core + distMax*showerAxis;
339 double tMinAtDia = (distMin + (pointMin - telPosition).GetMag()) /
kSpeedOfLight;
350 double tMaxAtDia = (distMax + (pointMax - telPosition).GetMag()) /
kSpeedOfLight;
361 if (tMinAtDia > tMaxAtDia)
362 swap(tMinAtDia, tMaxAtDia);
368 const double deltaT = tMaxAtDia - tMinAtDia;
372 info <<
" - track too short: deltaT/ns=" << deltaT/
ns;
377 const double minimalDist = min((telPosition - pointMin).GetMag(),
378 (telPosition - pointMax).GetMag());
379 double deltaD = fabs(distMax - distMin) / numbins;
380 double deltaPhi = atan(deltaD / minimalDist);
387 if (deltaPhi>fMaxAngleBinWidth) {
388 deltaPhi = fMaxAngleBinWidth;
389 deltaD = tan(deltaPhi) * minimalDist;
390 numbins = fabs(distMax-distMin) / deltaD;
393 const double tracebin = deltaT / numbins;
395 info << resetiosflags(std::ios::scientific) << setiosflags(std::ios::fixed);
397 <<
", nBins=" << setw(4) << numbins <<
", dT=" << setw(5) << setprecision(1) << tracebin/
ns <<
" ns, "
399 <<
"dDist=" << setw(7) << setprecision(2) << deltaD/
m <<
" m, "
400 <<
"dAngle=" << setw(5) << setprecision(3) << deltaPhi/
deg <<
" deg";
413 sumAllBins += numbins;
420 info <<
"Looping over " << sumAllBins <<
" bins in all telescopes combined";
428 FieldOfViewCalculator::Finish()
Telescope & GetTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Telescope by Id, throw exception if not existent.
Branch GetTopBranch() const
unsigned int GetId() const
Top of the interface to Atmosphere information.
double GetFADCBinSize() const
void swap(utl::Trace< T > &t1, utl::Trace< T > &t2)
const utl::TimeStamp & GetTimeStamp() const
Get the TimeStamp of the absolute shower core-time.
void InitSlantProfileModel(const utl::Point &core, const utl::Vector &dir, const double deltaX) const
double GetFieldOfView() const
Fluorescence Detector Eye Event.
bool HasSimShower() const
const atm::ProfileResult & EvaluateDistanceVsSlantDepth() const
Table of distance as a function of slant depth.
utl::Vector GetAxis() const
#define INFO(message)
Macro for logging informational messages.
void MakeEye(const unsigned int eyeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
void Init()
Initialise the registry.
EyeIterator EyesBegin(const FDetComponentSelector::Type type=FDetComponentSelector::ePhysical) const
iterator pointing to first eye of given type (ePhysical, eVirtual, eAll)
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
double pow(const double x, const unsigned int i)
void MakeTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Make Telescope telescopeId.
const Camera & GetCamera() const
Get the Camera object that belongs to the telescope.
Detector description interface for FDetector-related data.
double Y(const double x) const
Get the Y value (coordinate) for given X (ordinate)
void MakeDistanceTrace(const unsigned int size=0, const double binSize=0)
Make the trace of distance along the shower axis of light at the diaphragm.
A TimeStamp holds GPS second and nanosecond for some event.
Interface class to access Shower Simulated parameters.
void SetPhotonsStartTime(const utl::TimeStamp &ts)
const atm::Atmosphere & GetAtmosphere() const
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
fevt::TelescopeSimData & GetSimData()
Description of simulated data for one Telescope.
Class representing a document branch.
boost::filter_iterator< FDetComponentSelector, AllEyeIterator > EyeIterator
Class describing the Atmospheric profile.
Top of the hierarchy of the detector description interface.
const fdet::FDetector & GetFDetector() const
void GetData(bool &b) const
Overloads of the GetData member template function.
Top of Fluorescence Detector event hierarchy.
Eye & GetEye(const unsigned int eyeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
return Eye by id
bool HasDistanceTrace() const
Check that trace for the distance along the shower axis is present.
boost::filter_iterator< TelIsCommissioned, InternalConstTelescopeIterator > TelescopeIterator
An iterator over telescopes.
bool HasEye(const unsigned int eyeId, const ComponentSelector::Status status=ComponentSelector::eHasData) const
constexpr double kSpeedOfLight
Detector description interface for Telescope-related data.
A TimeInterval is used to represent time elapsed between two events.
double MinX() const
Return the minimum value for X (ordinate) stored in the profile.
ResultFlag
Flag returned by module methods to the RunController.
bool HasTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData) const
Check if the telescope is in the event.
utl::Point GetPosition() const
Fluorescence Detector Telescope Event.
#define ERROR(message)
Macro for logging error messages.
utl::CoordinateSystemPtr GetShowerCoordinateSystem() const
double MaxX() const
Return the maximum value for X (ordinate) stored in the profile.
double GetXInject() const
Get depth particle injection.
EyeIterator EyesEnd(const FDetComponentSelector::Type type=FDetComponentSelector::ePhysical) const
iterator pointing to end of available eyes of given type (ePhysical, eVirtual, eAll) ...