Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:57:13

0001 #include <OnlineDB/CSCCondDB/interface/CSCThrTurnOnFcn.h>
0002 #include <FWCore/MessageLogger/interface/MessageLogger.h>
0003 #include <cmath>
0004 #include <iostream>
0005 #include <vector>
0006 #include "TMath.h"
0007 
0008 double CSCThrTurnOnFcn::operator()(const std::vector<double>& par) const {
0009   double x, y, er, fn;
0010   double N = norm;
0011   double chi2 = 0.;
0012 
0013   int size = xdata.size();
0014   for (int i = 0; i < size; ++i) {
0015     x = xdata[i];
0016     y = ydata[i];
0017     er = ery[i];
0018 
0019     fn = (x - par[0]) / (par[1] * 1.4142);
0020     fn = N * (1. - TMath::Erf(fn)) / 2.;
0021 
0022     double diff = y - fn;
0023     chi2 += diff * diff / (er * er);
0024 
0025     //    std::cout<<"CSC AFEB threshold fit "<<i+1<<" "<<x<<" "<<y<<" "
0026     //                   <<er<<" "<<fn<<" "<<chi2<<" "
0027     //                   <<par[0]<<" "<<par[1]<<"\n";
0028 
0029     LogDebug("CSC") << " AFEB threshold fit " << i + 1 << " " << x << " " << y << " " << er << " " << fn << " " << chi2
0030                     << " " << par[0] << " " << par[1] << "\n";
0031   }
0032   //  std::cout<<"Chi2 "<<chi2<<std::endl;
0033   return chi2;
0034 }