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

, generated on Tue Sep 26 2023.