CMS 3D CMS Logo

CSCThrTurnOnFcn.h
Go to the documentation of this file.
1 #ifndef CSCCalibration_CSCThrTurnOnFcn_h
2 #define CSCCalibration_CSCThrTurnOnFcn_h
3 
12 #include "Minuit2/FCNBase.h"
13 #include <vector>
14 #include <RVersion.h>
15 #if ROOT_VERSION_CODE >= ROOT_VERSION(6, 33, 1)
16 #include <span>
17 #endif
18 
19 class CSCThrTurnOnFcn : public ROOT::Minuit2::FCNBase {
20 private:
22  std::vector<float> xdata;
23  std::vector<float> ydata;
24  std::vector<float> ery;
25  float norm;
26 
27 public:
29  void setData(const std::vector<float>& x, const std::vector<float>& y) {
30  for (unsigned int i = 0; i < x.size(); i++) {
31  xdata.push_back(x[i]);
32  ydata.push_back(y[i]);
33  }
34  };
35 
37  void setErrors(const std::vector<float>& er) {
38  for (unsigned int i = 0; i < er.size(); i++)
39  ery.push_back(er[i]);
40  };
41 
43  void setNorm(float n) { norm = n; };
44 
46 #if ROOT_VERSION_CODE >= ROOT_VERSION(6, 33, 1)
47  double operator()(std::span<const double>) const override;
48 #else
49  double operator()(const std::vector<double>&) const override;
50 #endif
51 
53  double Up() const override { return 1.; }
54 };
55 
56 #endif
double Up() const override
@ What?
void setNorm(float n)
Set the norm (if needed)
std::vector< float > ydata
void setData(const std::vector< float > &x, const std::vector< float > &y)
Cache the current data, x and y.
std::vector< float > ery
std::vector< float > xdata
data
void setErrors(const std::vector< float > &er)
Set the errors.
double operator()(std::span< const double >) const override
Provide the chi-squared function for the given data.