Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:44

0001 #ifndef CSCCalibration_CSCThrTurnOnFcn_h
0002 #define CSCCalibration_CSCThrTurnOnFcn_h
0003 
0004 /** \class CSCThrTurnOnFcn
0005  *
0006  * Model functional form for fitting AFEB turn-on threshold
0007  * information from Muon Endcap CSC's. This version
0008  * is for ROOT Minuit2. Based on CSCPulseHeightFcn  as an example.
0009  *
0010  */
0011 
0012 #include "Minuit2/FCNBase.h"
0013 #include <vector>
0014 
0015 class CSCThrTurnOnFcn : public ROOT::Minuit2::FCNBase {
0016 private:
0017   ///  data
0018   std::vector<float> xdata;
0019   std::vector<float> ydata;
0020   std::vector<float> ery;
0021   float norm;
0022 
0023 public:
0024   ///Cache the current data, x and y
0025   void setData(const std::vector<float>& x, const std::vector<float>& y) {
0026     for (unsigned int i = 0; i < x.size(); i++) {
0027       xdata.push_back(x[i]);
0028       ydata.push_back(y[i]);
0029     }
0030   };
0031 
0032   /// Set the errors
0033   void setErrors(const std::vector<float>& er) {
0034     for (unsigned int i = 0; i < er.size(); i++)
0035       ery.push_back(er[i]);
0036   };
0037 
0038   /// Set the norm (if needed)
0039   void setNorm(float n) { norm = n; };
0040 
0041   /// Provide the chi-squared function for the given data
0042   double operator()(const std::vector<double>&) const override;
0043 
0044   ///@@ What?
0045   double Up() const override { return 1.; }
0046 };
0047 
0048 #endif