CFMatrixCalculator.h
Go to the documentation of this file.
1 #ifndef _CFMatrixCalculator_h_
2 #define _CFMatrixCalculator_h_
3 
4 #include "LinearAlgebra.h"
5 #include "TelescopeData.h"
7 
8 #include <fevt/FdConstants.h>
9 #include <utl/Vector.h>
10 
11 #include <vector>
12 #include <boost/iterator/filter_iterator.hpp>
13 
14 
15 namespace fevt {
16  class Eye;
17  class TelescopeRecData;
18 }
19 
20 namespace utl {
21  class TabulatedFunctionErrors;
22  class TabulatedFunction;
23  class Point;
24 }
25 
26 namespace FdEnergyDepositFinderKG {
27 
29 
30 
32 
33  public:
34  enum EMethod {
37  };
38 
39  public:
40  CFMatrixCalculator() = default;
42  void Init();
43  void BuildMatrix(const fevt::Eye& eye, const bool leavingAtmoIsError = false, const unsigned int addDense = 1);
44  bool HasMatrix() const { return GetSize(); }
45  unsigned int GetSize() const { return fOnlyDirect ? fDirectCFMatrix.GetSize() : fCFMatrix.GetSize(); }
46  unsigned int GetFOVSize() const { return fFOVsize; }
47  double GetXmax() const { return fXmax; }
48  unsigned int GetEyeId() const { return fEyeId; }
49  bool GetOnlyDirect() const { return fOnlyDirect; }
50 
52  { assert(!fOnlyDirect); return fCFMatrix; } //would have to break const or always needlessly create
53 
55  { assert(fOnlyDirect); return fDirectCFMatrix; }
56 
58  GetInverseCFMatrix()
59  const
60  {
61  if (!fOnlyDirect)
62  return fCFMatrix.GetInverse();
64  }
65 
66  //TODO? avoid blowing up diagonal matrix in direct case
67  // by doing dedx = CFM^-1* lightFlux in one method
68  // -- would not look elegant though.
69  // alternatively create cases in CalculateProfile.
70  //ColumnVector inverseCFMTimes(ColumnVector& lightFlux) const;
71 
77  { return fDirectFluorescenceMatrix;}
79  { return fDirectCherenkovMatrix;}
80 
81  typedef std::vector<TelescopeData>::const_iterator ConstTelDataIterator;
83  { return fTelescopeData.begin(); }
85  { return fTelescopeData.end(); }
86 
88  { return fNoiseTelescopeData.begin(); }
90  { return fNoiseTelescopeData.end(); }
91 
92  typedef boost::filter_iterator<TelescopeFilter, ConstTelDataIterator> FilteredTelDataIterator;
97 
98  void SetVerbosity(const int v) { fVerbosity = v; }
101  void SetOnlyDirect(const bool od) { fOnlyDirect = od;}
102 
103  private:
104  void Clear();
105  bool CalculateTelescopeData(const fevt::Eye& eye, const bool leavingAtmoIsError, const unsigned int addDense);
106 
107  bool InitCalculation(const fevt::Eye& eye);
108  void AddBinsOutsideFOV(const fevt::Eye& eye);
109 
114 
115  double MultipleScatteringFraction(const TelescopeDataBin& telDataBin,
116  const std::vector<double>& waveLengths,
117  const utl::TabulatedFunction& yield,
118  const double zeta,
119  const utl::Point& telescopePosition,
120  const utl::TabulatedFunction& efficiency) const;
121 
125  const fevt::TelescopeRecData& telRecData) const;
126 
127  void SetTelescopeParameters(const fevt::Eye& eye,
128  TelescopeData& telData) const;
129 
130  // telescope data 'random access'
131  std::pair<const TelescopeData*, const TelescopeDataBin*> GetTelescopeDataBin(const unsigned int i) const;
132  // check for telescope range overlaps
133  bool IsOverlapBin(const int i, const int j) const;
134 
135  int fVerbosity = 0;
136  unsigned int fEyeId = 0;
137  unsigned int fNumberOfDepthBins = 0;
138 
145 
146  std::vector<TelescopeData> fTelescopeData;
147  // for likelihood calculation of "near border" showers (for PCGF)
148  std::vector<TelescopeData> fNoiseTelescopeData;
149 
150  // wavelengths to be used for Fluorescence and Cherenkov
151  std::vector<double> fCherWaveLength;
152  std::vector<double> fFluoWaveLength;
153 
154  // transmission vectors
155  std::vector<std::vector<double>> fCherTransmissionToTel;
156  std::vector<std::vector<double>> fFluoTransmissionToTel;
157  std::vector<std::vector<double>> fCherTransmissionShower;
158  // scattering vectors
159  std::vector<std::vector<double>> fRayScatToTel;
160  std::vector<std::vector<double>> fMieScatToTel;
161  // multiple scattering factors
162  std::vector<double> fFluorescenceMultipleScattering;
163  std::vector<double> fCherenkovMultipleScattering;
164  // cherenkov at track
165  std::vector<std::vector<double>> fCherenkovAtTrack;
166  // geometrical factor
167  std::vector<double> fGeometricalFactor;
168  // distance to shower axis given zeta
169  std::vector<double> fZetaDistance;
170  // average energy deposit per electron
171  std::vector<double> fMeandEdXPerElectron;
172  // energy threshold for electrons
174  // shower maximum
175  double fXmax = 0;
176  // shower axis (physical direction)
178  // cos(zenith) in core CS
179  // double fCosTheta;
180  // cos(zenith) local in air
181  std::vector<double> fCosTheta;
182 
184  bool fOnlyDirect = false;
185  unsigned int fFOVsize = 0;
186 
187  // for lateral light distributions
189  bool fDoMultipleScattering = false;
190 
191  };
192 
193 }
194 
195 
196 #endif
std::vector< std::vector< double > > fCherTransmissionShower
Point object.
Definition: Point.h:32
FilteredTelDataIterator TelDataEnd(const TelescopeData::ETelDataType type)
FilteredTelDataIterator TelDataBegin(const TelescopeData::ETelDataType type)
Fluorescence Detector Eye Event.
Definition: FEvent/Eye.h:29
void SetTelescopeParameters(const fevt::Eye &eye, TelescopeData &telData) const
std::vector< std::vector< double > > fRayScatToTel
Class to hold collection (x,y) points and provide interpolation between them.
return LowerTriangularMatrix(fNumberOfDepthBins)+fDirectCFMatrix.GetInverse()
utl::TabulatedFunctionErrors * CalculateLCEff(const fevt::FdConstants::LightSource lightSource, const fevt::TelescopeRecData &telRecData) const
Fetches the light collection efficiency of the given light source from the TelescopeRecData (if avail...
void SetLDFMethod(const LateralLightCalculator::ECalculationMethod m)
ConstTelDataIterator AllTelDataBegin() const
std::vector< TelescopeData >::const_iterator ConstTelDataIterator
const LowerTriangularMatrix & GetMieScatteredCherenkovMatrix() const
double MultipleScatteringFraction(const TelescopeDataBin &telDataBin, const std::vector< double > &waveLengths, const utl::TabulatedFunction &yield, const double zeta, const utl::Point &telescopePosition, const utl::TabulatedFunction &efficiency) const
LightSource
Possible light sources.
Definition: FdConstants.h:9
ConstTelDataIterator NoiseTelDataEnd() const
const LowerTriangularMatrix & GetCFMatrix() const
LowerTriangularMatrix GetInverse() const
Get the inverse of the matrix.
std::vector< std::vector< double > > fCherenkovAtTrack
Telescope-specific shower reconstruction data.
std::pair< const TelescopeData *, const TelescopeDataBin * > GetTelescopeDataBin(const unsigned int i) const
std::vector< std::vector< double > > fMieScatToTel
bool IsOverlapBin(const int i, const int j) const
const DiagonalMatrix & GetDirectFluorescenceMatrix() const
ConstTelDataIterator NoiseTelDataBegin() const
bool CalculateTelescopeData(const fevt::Eye &eye, const bool leavingAtmoIsError, const unsigned int addDense)
Vector object.
Definition: Vector.h:30
const DiagonalMatrix & GetDirectCFMatrix() const
std::vector< TelescopeData > fNoiseTelescopeData
const LowerTriangularMatrix & GetRayScatteredCherenkovMatrix() const
void SetMethod(const CFMatrixCalculator::EMethod m)
boost::filter_iterator< TelescopeFilter, ConstTelDataIterator > FilteredTelDataIterator
constexpr double m
Definition: AugerUnits.h:121
std::vector< std::vector< double > > fCherTransmissionToTel
ConstTelDataIterator AllTelDataEnd() const
const DiagonalMatrix & GetDirectCherenkovMatrix() const
std::vector< std::vector< double > > fFluoTransmissionToTel
void BuildMatrix(const fevt::Eye &eye, const bool leavingAtmoIsError=false, const unsigned int addDense=1)

, generated on Tue Sep 26 2023.