Parameter.h
Go to the documentation of this file.
1 // Object to keep track of parameter information
2 //
3 // Created by Brian Rebel on 8/17/20.
4 //
5 
6 #ifndef COVARIANCEMATRIXFIT_DATAPRODUCTS_PARAMETER_H
7 #define COVARIANCEMATRIXFIT_DATAPRODUCTS_PARAMETER_H
8 
9 #include "NovaDAQConventions/DAQConventions.h"
10 
13 
14 #include <iomanip>
15 
16 namespace cmf{
17  class Parameter;
18  class OscPar;
19  class SystPar;
20 
21  typedef std::map<std::string, Parameter> ParameterSpaceLoc;
22 
23 }
24 
25 
26 //----------------------------------------------------------------------------
28 
29 public:
30 
34  {}
35 
37  float const& val)
38  : fParm(par)
39  , fVal(val)
40  {}
41 
42  cmf::OscParm_t const& Param() const { return fParm; }
43  float const& Value() const { return fVal; }
44 
45  bool operator==(cmf::OscPar const& other) const { return fParm == other.Param(); }
46  bool operator< (cmf::OscPar const& other) const { return fParm < other.Param(); }
47 
48  friend std::ostream& operator << (std::ostream & o, cmf::OscPar const& op);
49 
50 private:
51 
52  cmf::OscParm_t fParm; ///< the parameter
53  float fVal; ///< the value of the parameter
54 };
55 
56 //----------------------------------------------------------------------------
58 
59 public:
60 
64  {}
65 
66  SystPar(uint8_t const& par,
67  float const& val)
68  : fParm(par)
69  , fVal(val)
70  {}
71 
72  uint8_t const& Param() const { return fParm; }
73  float const& Value() const { return fVal; }
74 
75  bool operator==(cmf::SystPar const& other) const { return fParm == other.Param(); }
76  bool operator< (cmf::SystPar const& other) const { return fParm < other.Param(); }
77 
78 private:
79 
80  uint8_t fParm; ///< the parameter
81  float fVal; ///< the value of the parameter
82 };
83 
84 // cmf::Parameter is used in the definition of cmf::ParameterSpaceLoc
85 //.............................................................................
87 
88 public:
89  Parameter();
90 
91  Parameter(std::string const& name,
92  cmf::DetType_t const& det,
93  double const& val,
94  bool const& fixed,
95  float const& sigmaSize,
96  float const& cv,
97  float const& variance,
98  bool const& nuisance,
99  bool const& constrained,
100  float const& lowerBound,
101  float const& upperBound);
102 
103  std::string const Name() const { return (fParType == cmf::kOscPar) ? cmf::cOscParams_Strings[fKey] : cmf::KeyToVarName(fKey); }
104  cmf::ParType_t const& ParType() const { return fParType; }
105  double const& Value() const { return fVal; }
106  uint8_t const& Key() const { return fKey; }
107  cmf::DetType_t const Detector() const { return (cmf::DetType_t)fDetector; }
108  float const& CentralValue() const { return fCentralVal; }
109  float const& Sigma() const { return fSigmaSize; }
110  float const& Variance() const { return fVariance; }
111  bool const& IsFixed() const { return fIsFixed; }
112  bool IsOscPar() const { return (fParType == cmf::kOscPar); }
113  bool const& IsConstrained() const { return fIsConstrained; }
114  bool const& IsNuisance() const { return fIsNuisance; }
115  float const& LowerBound() const { return fLowerBound; }
116  float const& UpperBound() const { return fUpperBound; }
117 
118  void SetValue(double const& val) { fVal = val; }
119 
120  bool operator<(cmf::Parameter const& other) const;
121  bool operator==(cmf::Parameter const& other) const;
122 
123  friend std::ostream& operator << (std::ostream & o, cmf::Parameter const& par);
124 
125 private:
126  uint8_t fKey; ///< key for this parameter
127  uint8_t fDetector; ///< which detector is this parameter for?
128  double fVal; ///< current value for the parameter in the fit
129  float fCentralVal; ///< central value for the parameter
130  float fSigmaSize; ///< size of 1 sigma
131  float fVariance; ///< amount parameter can vary when making random universes
132  bool fIsFixed; ///< is this parameter fixed during fits?
133  bool fIsNuisance; ///< is this parameter treated as a nuisance parameter?
134  bool fIsConstrained; ///< is this parameter constrained in allowed values?
135  float fLowerBound; ///< lower bound for the constrained parameter
136  float fUpperBound; ///< upper bound for the constrained parameter
137  cmf::ParType_t fParType; ///< type of paramter this is
138 
139 };
140 
141 namespace cmf{
142 
143  class Location {
144 
145  public:
146 
148  {}
149 
151  ParameterSpaceLoc const& fd)
152  : fNDLoc(nd)
153  , fFDLoc(fd)
154  {}
155 
156  Location(cmf::OscillationParameterMap const& oscPars);
157 
158  cmf::OscillationParameterMap AsOscillationParameterMap();
159 
160  cmf::ParameterSpaceLoc const& NDLocation() const { return fNDLoc; }
161  cmf::ParameterSpaceLoc const& FDLocation() const { return fFDLoc; }
162 
163  void InsertParameter(cmf::Parameter const& par);
164  void SetParameterValue(std::string const& parName,
165  double const& value,
166  cmf::DetType_t const& det);
167 
168 
169  private:
170 
173 
174  friend std::ostream& operator<<(std::ostream& o, cmf::Location const& loc);
175  };
176 }
177 
178 #endif //COVARIANCEMATRIXFIT_DATAPRODUCTS_PARAMETER_H
cmf::ParType_t const & ParType() const
Definition: Parameter.h:104
const XML_Char * name
Definition: expat.h:151
float const & LowerBound() const
Definition: Parameter.h:115
enum cmf::osc_params OscParm_t
uint8_t fParm
the parameter
Definition: Parameter.h:80
bool operator<(cmf::OscPar const &other) const
Definition: Parameter.h:46
float fVal
the value of the parameter
Definition: Parameter.h:81
SystPar(uint8_t const &par, float const &val)
Definition: Parameter.h:66
bool const & IsConstrained() const
Definition: Parameter.h:113
float fSigmaSize
size of 1 sigma
Definition: Parameter.h:130
float fCentralVal
central value for the parameter
Definition: Parameter.h:129
Int_t par
Definition: SimpleIterate.C:24
void SetValue(double const &val)
Definition: Parameter.h:118
bool const & IsFixed() const
Definition: Parameter.h:111
bool fIsConstrained
is this parameter constrained in allowed values?
Definition: Parameter.h:134
enum cmf::det_type DetType_t
float fUpperBound
upper bound for the constrained parameter
Definition: Parameter.h:136
cmf::OscParm_t fParm
the parameter
Definition: Parameter.h:52
Location(ParameterSpaceLoc const &nd, ParameterSpaceLoc const &fd)
Definition: Parameter.h:150
bool IsOscPar() const
Definition: Parameter.h:112
enum cmf::par_type ParType_t
const std::string cOscParams_Strings[kNumOscParams]
Definition: Constants.h:272
float const & Value() const
Definition: Parameter.h:73
ParameterSpaceLoc fFDLoc
Definition: Parameter.h:172
float const & Sigma() const
Definition: Parameter.h:109
bool operator==(cmf::OscPar const &other) const
Definition: Parameter.h:45
std::map< cmf::OscParm_t, float > OscillationParameterMap
Definition: Constants.h:761
const XML_Char int const XML_Char * value
Definition: expat.h:331
cmf::ParameterSpaceLoc const & NDLocation() const
Definition: Parameter.h:160
float fLowerBound
lower bound for the constrained parameter
Definition: Parameter.h:135
float fVal
the value of the parameter
Definition: Parameter.h:53
static const float kGarbageFloat
Definition: Constants.h:19
const std::string cv[Ncv]
bool const & IsNuisance() const
Definition: Parameter.h:114
OscPar(cmf::OscParm_t const &par, float const &val)
Definition: Parameter.h:36
cmf::ParameterSpaceLoc const & FDLocation() const
Definition: Parameter.h:161
uint8_t fDetector
which detector is this parameter for?
Definition: Parameter.h:127
cmf::DetType_t const Detector() const
Definition: Parameter.h:107
float const & Value() const
Definition: Parameter.h:43
uint8_t const & Key() const
Definition: Parameter.h:106
float const & CentralValue() const
Definition: Parameter.h:108
bool fIsNuisance
is this parameter treated as a nuisance parameter?
Definition: Parameter.h:133
ParameterSpaceLoc fNDLoc
Definition: Parameter.h:171
double fVal
current value for the parameter in the fit
Definition: Parameter.h:128
cmf::ParType_t fParType
type of paramter this is
Definition: Parameter.h:137
bool operator==(cmf::SystPar const &other) const
Definition: Parameter.h:75
float fVariance
amount parameter can vary when making random universes
Definition: Parameter.h:131
Module to combine a set of results into a single file currently only does one data product type at a ...
Definition: Event.cxx:24
cmf::OscParm_t const & Param() const
Definition: Parameter.h:42
static const uint8_t kNumSigmaSysts
Definition: Constants.h:584
bool fIsFixed
is this parameter fixed during fits?
Definition: Parameter.h:132
float const & UpperBound() const
Definition: Parameter.h:116
friend std::ostream & operator<<(std::ostream &o, cmf::OscPar const &op)
Definition: Parameter.cxx:12
uint8_t fKey
key for this parameter
Definition: Parameter.h:126
uint8_t const & Param() const
Definition: Parameter.h:72
std::map< std::string, Parameter > ParameterSpaceLoc
Definition: Parameter.h:19
double const & Value() const
Definition: Parameter.h:105
float const & Variance() const
Definition: Parameter.h:110
std::string const Name() const
Definition: Parameter.h:103
double variance(Eigen::VectorXd x)
static std::string KeyToVarName(uint8_t const &key)
Definition: StaticFuncs.h:560
enum BeamMode string