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 15 of file CSCThrTurnOnFcn.h.

Member Function Documentation

◆ operator()()

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

Provide the chi-squared function for the given data.

Definition at line 8 of file CSCThrTurnOnFcn.cc.

References isoTrack_cff::chi2, change_name::diff, ery, personalPlayback::fn, mps_fire::i, LogDebug, N, norm, findQualityFiles::size, x, xdata, y, and ydata.

8  {
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
std::vector< float > ery
#define N
Definition: blowfish.cc:9
std::vector< float > xdata
data
#define LogDebug(id)

◆ setData()

void CSCThrTurnOnFcn::setData ( const std::vector< float > &  x,
const std::vector< float > &  y 
)
inline

Cache the current data, x and y.

Definition at line 25 of file CSCThrTurnOnFcn.h.

References mps_fire::i, x, xdata, y, and ydata.

Referenced by CSCFitAFEBThr::ThresholdNoise().

25  {
26  for (unsigned int i = 0; i < x.size(); i++) {
27  xdata.push_back(x[i]);
28  ydata.push_back(y[i]);
29  }
30  };
std::vector< float > ydata
std::vector< float > xdata
data

◆ setErrors()

void CSCThrTurnOnFcn::setErrors ( const std::vector< float > &  er)
inline

Set the errors.

Definition at line 33 of file CSCThrTurnOnFcn.h.

References ery, and mps_fire::i.

Referenced by CSCFitAFEBThr::ThresholdNoise().

33  {
34  for (unsigned int i = 0; i < er.size(); i++)
35  ery.push_back(er[i]);
36  };
std::vector< float > ery

◆ setNorm()

void CSCThrTurnOnFcn::setNorm ( float  n)
inline

Set the norm (if needed)

Definition at line 39 of file CSCThrTurnOnFcn.h.

References create_idmaps::n, and norm.

Referenced by CSCFitAFEBThr::ThresholdNoise().

◆ Up()

double CSCThrTurnOnFcn::Up ( ) const
inlineoverride

@ What?

Definition at line 45 of file CSCThrTurnOnFcn.h.

45 { return 1.; }

Member Data Documentation

◆ ery

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

Definition at line 20 of file CSCThrTurnOnFcn.h.

Referenced by operator()(), and setErrors().

◆ norm

float CSCThrTurnOnFcn::norm
private

Definition at line 21 of file CSCThrTurnOnFcn.h.

Referenced by operator()(), and setNorm().

◆ xdata

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

data

Definition at line 18 of file CSCThrTurnOnFcn.h.

Referenced by operator()(), and setData().

◆ ydata

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

Definition at line 19 of file CSCThrTurnOnFcn.h.

Referenced by operator()(), and setData().