CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CSCThrTurnOnFcn Class Reference

#include <CSCThrTurnOnFcn.h>

Inheritance diagram for CSCThrTurnOnFcn:

Public Member Functions

double operator() (const std::vector< double > &) const override
 Provide the chi-squared function for the given data. More...
 
void setData (const std::vector< float > &x, const std::vector< float > &y)
 Cache the current data, x and y. More...
 
void setErrors (const std::vector< float > &er)
 Set the errors. More...
 
void setNorm (float n)
 Set the norm (if needed) More...
 
double Up () const override
 @ What? More...
 

Private Attributes

std::vector< float > ery
 
float norm
 
std::vector< float > xdata
 data More...
 
std::vector< float > ydata
 

Detailed Description

Model functional form for fitting AFEB turn-on threshold information from Muon Endcap CSC's. This version is for ROOT Minuit2. Based on CSCPulseHeightFcn as an example.

Definition at line 18 of file CSCThrTurnOnFcn.h.

Member Function Documentation

double CSCThrTurnOnFcn::operator() ( const std::vector< double > &  par) const
override

Provide the chi-squared function for the given data.

Definition at line 9 of file CSCThrTurnOnFcn.cc.

References vertices_cff::chi2, diffTreeTool::diff, mps_fire::i, LogDebug, N, findQualityFiles::size, vertices_cff::x, and detailsBasic3DVector::y.

Referenced by setNorm().

9  {
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.
std::vector< float > ydata
std::vector< float > ery
#define N
Definition: blowfish.cc:9
std::vector< float > xdata
data
void CSCThrTurnOnFcn::setData ( const std::vector< float > &  x,
const std::vector< float > &  y 
)
inline

Cache the current data, x and y.

Definition at line 29 of file CSCThrTurnOnFcn.h.

References mps_fire::i.

Referenced by CSCFitAFEBThr::ThresholdNoise().

29  {
30  for(unsigned int i=0;i<x.size();i++) {
31  xdata.push_back(x[i]); ydata.push_back(y[i]);
32  }
33 };
std::vector< float > ydata
std::vector< float > xdata
data
void CSCThrTurnOnFcn::setErrors ( const std::vector< float > &  er)
inline

Set the errors.

Definition at line 36 of file CSCThrTurnOnFcn.h.

References mps_fire::i.

Referenced by CSCFitAFEBThr::ThresholdNoise().

36  {
37  for(unsigned int i=0;i<er.size();i++) ery.push_back(er[i]);
38  };
std::vector< float > ery
void CSCThrTurnOnFcn::setNorm ( float  n)
inline

Set the norm (if needed)

Definition at line 41 of file CSCThrTurnOnFcn.h.

References gen::n, and operator()().

Referenced by CSCFitAFEBThr::ThresholdNoise().

41 {norm=n;};
double CSCThrTurnOnFcn::Up ( ) const
inlineoverride

@ What?

Definition at line 47 of file CSCThrTurnOnFcn.h.

47 {return 1.;}

Member Data Documentation

std::vector<float> CSCThrTurnOnFcn::ery
private

Definition at line 24 of file CSCThrTurnOnFcn.h.

float CSCThrTurnOnFcn::norm
private

Definition at line 25 of file CSCThrTurnOnFcn.h.

std::vector<float> CSCThrTurnOnFcn::xdata
private

data

Definition at line 22 of file CSCThrTurnOnFcn.h.

std::vector<float> CSCThrTurnOnFcn::ydata
private

Definition at line 23 of file CSCThrTurnOnFcn.h.