CMS 3D CMS Logo

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 }
size
Write out results.
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
#define LogDebug(id)