ShowerFRecData.cc
Go to the documentation of this file.
1 #include <evt/ShowerFRecData.h>
2 #include <utl/ErrorLogger.h>
3 #include <utl/PhysicalConstants.h>
4 
5 #include <utl/LameShadowPtr_imp.h>
7 
8 #include <sstream>
9 
10 using namespace utl;
11 using namespace evt;
12 using namespace std;
13 
14 
15 inline
16 double
18 {
19  double variance = 0.;
20  for (ShowerFRecData::UncertaintyMapConstIterator iE = uncertainties.begin();
21  iE != uncertainties.end(); ++iE)
22  variance += pow(iE->second, 2);
23 
24  return variance;
25 }
26 
27 ShowerFRecData::ShowerFRecData() :
28  fEmEnergy(0),
29  fTotalEnergy(0),
30  fEnergyCutoff(0),
31  fCorrelationXY(0),
32  fCoreTimeError(0),
33  fCorrelationThetaPhi(0),
34  fSDTimeResidual(0)
35 {
36 }
37 
38 void
40 {
41  if (fEnergyDeposit) {
42  ERROR("ShowerFRecData::EnergyDeposit already exists - Not replacing");
43  }
44  else
46 }
47 
48 
49 void
51 {
53  ERROR("ShowerFRecData::LongitudinalProfile already exists - Not replacing");
54  }
55  else
57 }
58 
59 
60 void
62 {
64  ERROR("ShowerFRecData::FluorescenecePhotons already exists - Not replacing");
65  }
66  else
68 }
69 
70 
71 void
73 {
74  if (fCherenkovPhotons) {
75  ERROR("ShowerFRecData::CherenkovPhotons already exists - Not replacing");
76  }
77  else
79 }
80 
81 
82 void
84 {
85  if (fGHParameters) {
86  ERROR("ShowerFRecData::GHParameters already exists - Not replacing");
87  }
88  else
89  fGHParameters = gh.Clone();
90 }
91 
92 
93 double
95  const
96 {
97  if (fEmEnergyError.find(type) != fEmEnergyError.end())
98  return fEmEnergyError.find(type)->second;
99  else {
100  if (type == eTotal)
102  else {
103  ostringstream err;
104  err << " No uncertainty type " << type
105  << " available ";
106  ERROR(err.str());
107  throw utl::MissingEventDataException(err.str());
108  }
109  }
110 }
111 
112 bool
114  const
115 {
116  if (type == eTotal)
117  return !fEmEnergyError.empty();
118  else
119  return fEmEnergyError.find(type) != fEmEnergyError.end();
120 }
121 
122 double
124  const
125 {
126  if (fTotalEnergyError.find(type) != fTotalEnergyError.end())
127  return fTotalEnergyError.find(type)->second;
128  else {
129  // quadratically sum up errors for eTotal
130  if (type == eTotal)
132  else {
133  ostringstream err;
134  err << " No uncertainty type " << type
135  << " available ";
136  ERROR(err.str());
137  throw utl::MissingEventDataException(err.str());
138  }
139  }
140 }
141 
142 
143 bool
145  const
146 {
147  if (type == eTotal)
148  return !fTotalEnergyError.empty();
149  else
150  return fTotalEnergyError.find(type) != fTotalEnergyError.end();
151 }
152 
153 
154 double
156  const
157 {
158  if (fXmaxError.find(type) != fXmaxError.end())
159  return fXmaxError.find(type)->second;
160  else {
161  if (type == eTotal)
162  return sqrt(QuadraticSum(fXmaxError));
163  else {
164  ostringstream err;
165  err << " No uncertainty type " << type
166  << " available ";
167  ERROR(err.str());
168  throw utl::MissingEventDataException(err.str());
169  }
170  }
171 }
172 
173 
174 bool
176  const
177 {
178  if (type == eTotal)
179  return !fXmaxError.empty();
180  else
181  return fXmaxError.find(type) != fXmaxError.end();
182 }
183 
184 
185 void
187  const double rp, const double chi0,
188  const double t0)
189 {
190 
191  fCoreTime = eyeTriggerTime + TimeInterval(t0-rp/tan(chi0)/kSpeedOfLight);
192 
193 }
194 
197  const utl::Point& telescopePosition)
198  const
199 {
200  /*
201 
202  for distance from shower core to emission point (a)
203  law of cosines: b^2 = a^2 + c^2 - 2 * a * c * cos(beta)
204  c = distance(telescope, core)
205  b - a = (telTime - coreTime)/c_light = delta
206 
207  */
208 
209 
210  const Vector coreTelescopeVec = telescopePosition - fCore;
211  const double c = coreTelescopeVec.GetMag();
212  const double cosBeta = CosAngle(fAxis, coreTelescopeVec);
213  const double delta = (timeAtTelescope - fCoreTime).GetInterval() * kSpeedOfLight;
214  const double distance =
215  -(c * c - delta * delta)/(2 * (delta + c * cosBeta));
216  const utl::Point pointOnShower = fCore - distance * fAxis;
217  return pointOnShower;
218 
219 }
220 
221 
bool HasEmEnergyError(const EUncertaintyType type=eTotal) const
#define LAMESHADOWPTR_INST(_T_...)
bool HasTotalEnergyError(const EUncertaintyType type=eTotal) const
Point object.
Definition: Point.h:32
utl::ShadowPtr< utl::TabulatedFunction > fCherenkovPhotons
utl::Point CalculatePointOnShower(const utl::TimeStamp &timeAtTelescope, const utl::Point &telescopePosition) const
point on shower corresponding to a certain light arrival time at telescope
Class to hold collection (x,y) points and provide interpolation between them.
utl::ShadowPtr< utl::TabulatedFunctionErrors > fFluorescencePhotons
UncertaintyMap fTotalEnergyError
double pow(const double x, const unsigned int i)
utl::ShadowPtr< utl::TabulatedFunctionErrors > fLongitudinalProfile
double GetMag() const
Definition: Vector.h:58
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
double QuadraticSum(const ShowerFRecData::UncertaintyMap &uncertainties)
utl::ShadowPtr< evt::VGaisserHillasParameter > fGHParameters
UncertaintyMap fXmaxError
void SetCoreTime(const utl::TimeStamp &coreTime, const utl::TimeInterval &coreTimeErr)
double GetXmaxError(const EUncertaintyType type=eTotal) const
retrieve Xmax uncertainties
utl::TimeStamp fCoreTime
double GetTotalEnergyError(const EUncertaintyType type=eTotal) const
UncertaintyMap fEmEnergyError
double GetEmEnergyError(const EUncertaintyType type=eTotal) const
Base class for exceptions arising because required info not present in the Event. ...
constexpr double kSpeedOfLight
A TimeInterval is used to represent time elapsed between two events.
Definition: TimeInterval.h:43
UncertaintyMap::const_iterator UncertaintyMapConstIterator
bool HasXmaxError(const EUncertaintyType type=eTotal) const
utl::ShadowPtr< utl::TabulatedFunctionErrors > fEnergyDeposit
virtual VGaisserHillasParameter * Clone() const =0
Interface class for access to the Gaisser-Hillas parameters.
Vector object.
Definition: Vector.h:30
Interface class to access to Fluorescence reconstruction of a Shower.
double CosAngle(const Vector &l, const Vector &r)
Definition: OperationsVV.h:71
void MakeGHParameters(const VGaisserHillasParameter &gh)
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
std::map< EUncertaintyType, double > UncertaintyMap
EUncertaintyType
profile reconstruction uncertainty types

, generated on Tue Sep 26 2023.