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() (std::span< const 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 19 of file CSCThrTurnOnFcn.h.

Member Function Documentation

◆ operator()()

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

Provide the chi-squared function for the given data.

Definition at line 9 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.

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

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

Referenced by CSCFitAFEBThr::ThresholdNoise().

29  {
30  for (unsigned int i = 0; i < x.size(); i++) {
31  xdata.push_back(x[i]);
32  ydata.push_back(y[i]);
33  }
34  };
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 37 of file CSCThrTurnOnFcn.h.

References ery, and mps_fire::i.

Referenced by CSCFitAFEBThr::ThresholdNoise().

37  {
38  for (unsigned int i = 0; i < er.size(); i++)
39  ery.push_back(er[i]);
40  };
std::vector< float > ery

◆ setNorm()

void CSCThrTurnOnFcn::setNorm ( float  n)
inline

Set the norm (if needed)

Definition at line 43 of file CSCThrTurnOnFcn.h.

References create_idmaps::n, and norm.

Referenced by CSCFitAFEBThr::ThresholdNoise().

◆ Up()

double CSCThrTurnOnFcn::Up ( ) const
inlineoverride

@ What?

Definition at line 53 of file CSCThrTurnOnFcn.h.

53 { return 1.; }

Member Data Documentation

◆ ery

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

Definition at line 24 of file CSCThrTurnOnFcn.h.

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

◆ norm

float CSCThrTurnOnFcn::norm
private

Definition at line 25 of file CSCThrTurnOnFcn.h.

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

◆ xdata

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

data

Definition at line 22 of file CSCThrTurnOnFcn.h.

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

◆ ydata

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

Definition at line 23 of file CSCThrTurnOnFcn.h.

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