TimeRangeCalculator.cc
Go to the documentation of this file.
1 
10 #include "TimeRangeCalculator.h"
11 
12 #include <vector>
13 #include <list>
14 #include <limits>
15 
16 #include <evt/Event.h>
17 
18 #include <fevt/FEvent.h>
19 #include <fevt/Eye.h>
20 #include <fevt/Telescope.h>
21 #include <fevt/EyeRecData.h>
22 #include <fevt/TelescopeRecData.h>
23 #include <fevt/FdConstants.h>
24 
25 #include <utl/AugerException.h>
26 #include <utl/ErrorLogger.h>
27 
28 #include <sstream>
29 
30 using namespace FdLightCollectionEfficiencyKG;
31 using namespace utl;
32 using namespace evt;
33 using namespace fevt;
34 using namespace std;
35 
36 
37 /*************************************************************************/
39  const int verbosity) :
40  fTelRec(telRec), fVerbosity(verbosity)
41 {
42 }
43 
44 
45 /*************************************************************************/
46 void
48 {
50  if (fVerbosity > 1)
51  INFO("Skipping telescope. No telescope-aperture light trace");
52  return;
53  }
54 
56  // Calculate the start/stop times of each light component and use the smallest range
57  std::pair<double, double> startStop
60  for (utl::MultiTabulatedFunctionErrors::ConstIterator lcIt = lcEff.Begin(), end = lcEff.End();
61  lcIt != end; ++lcIt)
62  {
63  const utl::TabulatedFunctionErrors& componentLCEff = lcIt->GetTabulatedFunctionErrors();
64  pair<double, double> thisStartStop
65  = CalculateStartStopTimes(componentLCEff, totalLAtAperture, effThreshold);
66 
67  if (fVerbosity > 1) {
68  ostringstream msg;
69  msg << "Determined start/stop for light component " << lcIt->GetLabel()
70  << ": Start=" << thisStartStop.first << " End=" << thisStartStop.second;
71  INFO(msg);
72  }
73  if (thisStartStop.first > startStop.first)
74  startStop.first = thisStartStop.first;
75  if (thisStartStop.second < startStop.second)
76  startStop.second = thisStartStop.second;
77  }
78 
79  if (fVerbosity > 0) {
80  ostringstream msg;
81  msg << "Determined telescope lc-eff start/stop: Start="
82  << startStop.first << " End=" << startStop.second;
83  INFO(msg);
84  }
85 
86  // Update the time ranges to include only the time range we deduced from the
87  // light collection efficiency
88  list<pair<double, double> >& timeRanges = fTelRec.GetSpotFarFromBorderTimeRanges();
89  timeRanges.clear();
90  timeRanges.push_back(startStop);
91 }
92 
93 
94 /*************************************************************************/
95 std::pair<double, double>
97  const utl::TabulatedFunctionErrors& lAtAperture,
98  const double effThreshold)
99 {
100  const unsigned int nPoints = lcEff.GetNPoints();
101  unsigned int iStart = 0;
102  for (; iStart < nPoints; ++iStart) {
103  if (lcEff.GetY(iStart) > effThreshold)
104  break;
105  }
106 
107  int iStop = nPoints-1;
108  for (; iStop > 0; --iStop) {
109  if (lcEff.GetY(iStop) > effThreshold)
110  break;
111  }
112 
113  // assumes similar size bins
114  const double start = (iStart == 0
115  ? lAtAperture.GetX(iStart)
116  : (lAtAperture.GetX(iStart-1) + lAtAperture.GetX(iStart)) / 2.);
117 
118  // assumes similar size bins
119  const double stop = (iStop == (int)nPoints-1
120  ? lAtAperture.GetX(iStop)
121  : (lAtAperture.GetX(iStop+1) + lAtAperture.GetX(iStop)) / 2.);
122 
123  return std::make_pair(start, stop);
124 }
125 
126 
127 // Configure (x)emacs for this file ...
128 // Local Variables:
129 // mode: c++
130 // End:
unsigned int GetNPoints() const
const std::list< std::pair< double, double > > & GetSpotFarFromBorderTimeRanges() const
fevt::TelescopeRecData & fTelRec
The depth binning for the profile that&#39;s calculated from the GH fit.
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
Iterator Begin()
Definition: MultiObject.h:83
boost::transform_iterator< LabeledObjectFunctor, typename MultiObjectContainer::const_iterator, LabeledTabulatedFunctionErrors > ConstIterator
Definition: MultiObject.h:81
#define max(a, b)
utl::TabulatedFunctionErrors & GetLightFlux(const FdConstants::LightSource source=fevt::FdConstants::eTotal)
Light flux at diaphragm, photons/m^2 versus time in ns.
bool HasLightFlux(const FdConstants::LightSource source=FdConstants::eTotal) const
Check that light profile for source /par source is present.
std::pair< double, double > CalculateStartStopTimes(const utl::TabulatedFunctionErrors &lcEff, const utl::TabulatedFunctionErrors &lAtAperture, const double effThreshold)
Telescope-specific shower reconstruction data.
utl::MultiTabulatedFunctionErrors & GetLightCollectionEfficiency()
Get the light-collection-efficiency multi tabulated function (for various LightSources) ...
A collection of TabulatedFunctionErrors, which provides methods to access different sources...
TimeRangeCalculator(fevt::TelescopeRecData &telRec, const int verbosity=0)
const double & GetY(const unsigned int idx) const
void UpdateSpotFarFromBorderTimes(const double effThreshold)
total (shower and background)
const double & GetX(const unsigned int idx) const
Iterator End()
Definition: MultiObject.h:85

, generated on Tue Sep 26 2023.