CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCThrTurnOnFcn.cc
Go to the documentation of this file.
3 #include <cmath>
4 #include <iostream>
5 #include <vector>
6 #include "TMath.h"
7 
8 double CSCThrTurnOnFcn::operator()(const std::vector<double>& par) const {
9  double x, y, er, fn;
10  double N = norm;
11  double chi2 = 0.;
12 
13  int size = xdata.size();
14  for (int i = 0; i < size; ++i) {
15  x = xdata[i];
16  y = ydata[i];
17  er = ery[i];
18 
19  fn = (x - par[0]) / (par[1] * 1.4142);
20  fn = N * (1. - TMath::Erf(fn)) / 2.;
21 
22  double diff = y - fn;
23  chi2 += diff * diff / (er * er);
24 
25  // std::cout<<"CSC AFEB threshold fit "<<i+1<<" "<<x<<" "<<y<<" "
26  // <<er<<" "<<fn<<" "<<chi2<<" "
27  // <<par[0]<<" "<<par[1]<<"\n";
28 
29  LogDebug("CSC") << " AFEB threshold fit " << i + 1 << " " << x << " " << y << " " << er << " " << fn << " " << chi2
30  << " " << par[0] << " " << par[1] << "\n";
31  }
32  // std::cout<<"Chi2 "<<chi2<<std::endl;
33  return chi2;
34 }
std::vector< float > ydata
double operator()(const std::vector< double > &) const override
Provide the chi-squared function for the given data.
std::vector< float > ery
#define N
Definition: blowfish.cc:9
std::vector< float > xdata
data
tuple size
Write out results.
#define LogDebug(id)