ScintillatorLDFFinderKG/LDF.h
Go to the documentation of this file.
1 #ifndef _ScintillatorLDFFinderKG_LDF_h_
2 #define _ScintillatorLDFFinderKG_LDF_h_
3 
4 #include "VLDF.h"
5 #include "NKGLDF.h"
6 #include "NKGScintillatorLDF.h"
7 
8 #include <string>
9 #include <vector>
10 #include <utl/AugerException.h>
11 #include <boost/shared_ptr.hpp>
12 
13 
14 namespace ScintillatorLDFFinderKG {
15 
16  class LDF {
17 
18  public:
19  LDF() : fType("Undefined") { }
20 
21  LDF(const std::string& type,
22  const double rRef,
23  const std::vector<double>& pars,
24  const std::vector<double>& uncPars) :
25  fType(type)
26  {
27  if (type == "NKG")
28  fPtr.reset(new NKGLDF(rRef));
29  else if (type == "NKGScintillator")
30  fPtr.reset(new NKGScintillatorLDF(rRef));
31  else
32  throw utl::NonExistentComponentException("undefined LDF type");
33 
34  if (pars.size() != fPtr->fShapeModelVector.size()) {
35  const std::string err =
36  "number of required parameters does not match XML data vector (shape model)";
38  }
39  fPtr->fShapeModelVector = pars;
40 
41  if (uncPars.size() != fPtr->fBetaUncertaintyModelVector.size()) {
42  const std::string err =
43  "number of required parameters does not match XML data vector (shape uncertainty model)";
45  }
46  fPtr->fBetaUncertaintyModelVector = uncPars;
47  }
48 
49  // forward these to VLDF...
50 
51  double operator()(const double r, const std::vector<double>& shape) const
52  { return fPtr->Value(r, shape); }
53 
54  double FirstDerivative(const double r, const std::vector<double>& shape) const
55  { return fPtr->FirstDerivative(r, shape); }
56 
57  double SecondDerivative(const double r, const std::vector<double>& shape) const
58  { return fPtr->SecondDerivative(r, shape); }
59 
60  std::vector<double> ShapeModel(const double cosTheta, const double showerSize) const
61  { return fPtr->ShapeModel(cosTheta, showerSize); }
62 
63  double BetaUncertainty(const double showerSize) const
64  { return fPtr->BetaUncertainty(showerSize); }
65 
66  // some getters, setters
67 
68  const std::string& GetType() const
69  { return fType; }
70 
71  unsigned int GetNShapeParameters() const
72  { return fPtr->GetNShapeParameters(); }
73 
74  double GetReferenceDistance() const
75  { return fPtr->fReferenceDistance; }
76 
77  protected:
78  std::string fType;
79  boost::shared_ptr<VLDF> fPtr;
80 
81  };
82 
83 }
84 
85 
86 #endif
double SecondDerivative(const double r, const std::vector< double > &shape) const
double BetaUncertainty(const double showerSize) const
std::vector< double > ShapeModel(const double cosTheta, const double showerSize) const
Base class for exceptions trying to access non-existing components.
double operator()(const double r, const std::vector< double > &shape) const
LDF(const std::string &type, const double rRef, const std::vector< double > &pars, const std::vector< double > &uncPars)
double FirstDerivative(const double r, const std::vector< double > &shape) const
const std::string & GetType() const

, generated on Tue Sep 26 2023.