CorrectedApLightCalculator.cc
Go to the documentation of this file.
1 
11 
12 #include <vector>
13 #include <list>
14 #include <limits>
15 #include <sstream>
16 #include <iostream>
17 
18 #include <evt/Event.h>
19 
20 #include <fevt/FEvent.h>
21 #include <fevt/Eye.h>
22 #include <fevt/Telescope.h>
23 #include <fevt/EyeRecData.h>
24 #include <fevt/TelescopeRecData.h>
25 #include <fevt/TelescopeSimData.h>
26 #include <fevt/FdConstants.h>
27 
28 #include <utl/AugerException.h>
29 #include <utl/ErrorLogger.h>
30 
31 #include <det/Detector.h>
32 #include <fdet/FDetector.h>
33 #include <fdet/Eye.h>
34 #include <fdet/Telescope.h>
35 
36 using namespace FdLightCollectionEfficiencyKG;
37 using namespace utl;
38 using namespace evt;
39 using namespace fevt;
40 using namespace std;
41 
42 
43 /*************************************************************************/
45  utl::TraceD& outputApTrace,
46  //const unsigned int eyeId, // unused. LN.
47  const unsigned int telId,
48  const int verbosity) :
49  fTelSimData(telSimData),
50  fOutputApTrace(outputApTrace),
51  //fEyeId(eyeId), // unused. LN.
52  fTelId(telId),
53  fVerbosity(verbosity)
54 {
55 }
56 
57 /*************************************************************************/
58 void
60 {
61  if (fVerbosity > 1) {
62  ostringstream msg;
63  msg << "Calculating time-corrected aperture light trace for telescope "
64  << fTelId << " ...";
65  INFO(msg);
66  }
67 
68  const utl::TraceI& rtPhotTrace = fTelSimData.GetRayTracedPhotonTrace();
69 
70  // initialize
71  if (fOutputApTrace.GetSize() != rtPhotTrace.GetSize()) {
72  fOutputApTrace.SetBinning(rtPhotTrace.GetBinning());
73  fOutputApTrace.SetStart(rtPhotTrace.GetStart());
74  fOutputApTrace.SetStop(rtPhotTrace.GetStop());
75 
76  for (unsigned int i = 0; i < rtPhotTrace.GetSize(); ++i)
78  }
79  //const fdet::FDetector& theFDet = det::Detector::GetInstance().GetFDetector();
80  //const fdet::Telescope& detTel = theFDet.GetEye(fEyeId).GetTelescope(fTelId);
81  //const double diaArea = detTel.GetDiaphragmArea();
82 
83  const int telTraceNBins = fOutputApTrace.GetSize();
84  const double traceBinWidth = fOutputApTrace.GetBinning();
85 
86  double sumOutOfBounds = 0.;
87  double sumInBounds = 0.;
88 
89  // Loop over all photons and add them to the corrected aperture
90  // light trace
92  end = fTelSimData.PhotonsEnd(); iPhoton != end; ++iPhoton)
93  {
94  const utl::Photon& p = *iPhoton;
95  const double time = p.GetTime().GetInterval();
96  const int bin = int(time/traceBinWidth);
97 
98  if (bin < 0 || bin >= int(telTraceNBins)) { // FIXME think about this
99  if (fVerbosity > 2) {
100  ostringstream err;
101  err << "Bin out of range. bin=" << bin
102  << " weight=" << p.GetWeight();
103  WARNING(err);
104  }
105  sumOutOfBounds += p.GetWeight();
106  continue;
107  }
108  sumInBounds += p.GetWeight();
109 
110  const double photonWeight = p.GetWeight();
111  //fOutputApTrace[bin] += photonWeight * diaArea;
112  fOutputApTrace[bin] += photonWeight;
113  } // end for photons
114 
115  if (fVerbosity > 1) {
116  ostringstream msg;
117  msg << " For this ray-tracing iteration: Total sum of photon weights in range: " << sumInBounds
118  << " out of range: " << sumOutOfBounds << endl;
119  INFO(msg);
120  }
121 }
122 
123 
124 // Configure (x)emacs for this file ...
125 // Local Variables:
126 // mode: c++
127 // End:
void SetStop(const SizeType stop)
Set valid data stop bin.
Definition: Trace.h:151
SizeType GetStop() const
Get valid data stop bin.
Definition: Trace.h:148
CorrectedApLightCalculator(const fevt::TelescopeSimData &telSimData, utl::TraceD &outputApTrace, const unsigned int telId, const int verbosity)
double GetBinning() const
size of one slot
Definition: Trace.h:138
utl::TraceI & GetRayTracedPhotonTrace()
Number of photons that were actually ray-traced (per time bin)
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
double GetWeight() const
weight assigned to the photon
Definition: Photon.h:21
PhotonIterator PhotonsEnd()
Description of simulated data for one Telescope.
void SetStart(const SizeType start)
Set valid data start bin.
Definition: Trace.h:145
SizeType GetSize() const
Definition: Trace.h:156
#define WARNING(message)
Macro for logging warning messages.
Definition: ErrorLogger.h:163
double GetInterval() const
Get the time interval as a double (in Auger base units)
Definition: TimeInterval.h:69
std::list< utl::Photon >::const_iterator ConstPhotonIterator
void SetBinning(const double binning)
Definition: Trace.h:139
PhotonIterator PhotonsBegin()
SizeType GetStart() const
Get valid data start bin.
Definition: Trace.h:142
void PushBack(const T &value)
Insert a single value at the end.
Definition: Trace.h:119
utl::TimeInterval GetTime() const
Definition: Photon.h:28

, generated on Tue Sep 26 2023.