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 
9 (const std::vector<double>& par) const {
10 
11  double x,y,er,fn;
12  double N=norm;
13  double chi2 = 0.;
14 
15  int size=xdata.size();
16  for(int i = 0; i < size; ++i) {
17  x=xdata[i];
18  y=ydata[i];
19  er=ery[i];
20 
21  fn=(x-par[0])/(par[1]*1.4142);
22  fn=N * (1.- TMath::Erf(fn))/2.;
23 
24  double diff = y-fn;
25  chi2 += diff*diff / (er*er);
26 
27  // std::cout<<"CSC AFEB threshold fit "<<i+1<<" "<<x<<" "<<y<<" "
28  // <<er<<" "<<fn<<" "<<chi2<<" "
29  // <<par[0]<<" "<<par[1]<<"\n";
30 
31  LogDebug("CSC")<<" AFEB threshold fit "<<i+1<<" "<<x<<" "<<y<<" "
32  <<er<<" "<<fn<<" "<<chi2<<" "
33  <<par[0]<<" "<<par[1]<<"\n";
34  }
35  // std::cout<<"Chi2 "<<chi2<<std::endl;
36  return chi2;
37 }
#define LogDebug(id)
size
Write out results.
T x() const
Cartesian x coordinate.
#define N
Definition: blowfish.cc:9