CMS 3D CMS Logo

Functions | Variables
MuonResiduals1DOFFitter.cc File Reference
#include "Alignment/MuonAlignmentAlgorithms/interface/MuonResiduals1DOFFitter.h"
#include "TMath.h"

Go to the source code of this file.

Functions

void MuonResiduals1DOFFitter_FCN (int &npar, double *gin, double &fval, double *par, int iflag)
 

Variables

static double MuonResiduals1DOFFitter_number_of_hits
 
static double MuonResiduals1DOFFitter_sum_of_weights
 
static TMinuit * MuonResiduals1DOFFitter_TMinuit
 
static bool MuonResiduals1DOFFitter_weightAlignment
 

Function Documentation

◆ MuonResiduals1DOFFitter_FCN()

void MuonResiduals1DOFFitter_FCN ( int &  npar,
double *  gin,
double &  fval,
double *  par,
int  iflag 
)

Definition at line 11 of file MuonResiduals1DOFFitter.cc.

References cms::cuda::assert(), MuonResidualsFitterFitInfo::fitter(), MuonResiduals1DOFFitter::kAlign, MuonResiduals1DOFFitter::kGamma, MuonResidualsFitter::kGaussPowerTails, MuonResidualsFitter::kPowerLawTails, MuonResidualsFitter::kPureGaussian, MuonResiduals1DOFFitter::kRedChi2, MuonResiduals1DOFFitter::kResid, MuonResidualsFitter::kROOTVoigt, MuonResiduals1DOFFitter::kSigma, MuonResiduals1DOFFitter_number_of_hits, MuonResiduals1DOFFitter_sum_of_weights, MuonResiduals1DOFFitter_TMinuit, MuonResiduals1DOFFitter_weightAlignment, MuonResidualsFitter_logGaussPowerTails(), MuonResidualsFitter_logPowerLawTails(), MuonResidualsFitter_logPureGaussian(), MuonResidualsFitter_logROOTVoigt(), MuonResidualsFitter::residuals_begin(), MuonResidualsFitter::residuals_end(), and MuonResidualsFitter::residualsModel().

Referenced by MuonResiduals1DOFFitter::fit().

11  {
13  MuonResidualsFitter *fitter = fitinfo->fitter();
14 
15  fval = 0.;
16  for (std::vector<double *>::const_iterator resiter = fitter->residuals_begin(); resiter != fitter->residuals_end();
17  ++resiter) {
18  const double residual = (*resiter)[MuonResiduals1DOFFitter::kResid];
19  const double redchi2 = (*resiter)[MuonResiduals1DOFFitter::kRedChi2];
20 
21  const double residpeak = par[MuonResiduals1DOFFitter::kAlign];
22  const double residsigma = par[MuonResiduals1DOFFitter::kSigma];
23  const double residgamma = par[MuonResiduals1DOFFitter::kGamma];
24 
27  weight = 1.;
28 
29  if (!MuonResiduals1DOFFitter_weightAlignment || TMath::Prob(redchi2 * 8, 8) < 0.99) { // no spikes allowed
31  fval += -weight * MuonResidualsFitter_logPureGaussian(residual, residpeak, residsigma);
32  } else if (fitter->residualsModel() == MuonResidualsFitter::kPowerLawTails) {
33  fval += -weight * MuonResidualsFitter_logPowerLawTails(residual, residpeak, residsigma, residgamma);
34  } else if (fitter->residualsModel() == MuonResidualsFitter::kROOTVoigt) {
35  fval += -weight * MuonResidualsFitter_logROOTVoigt(residual, residpeak, residsigma, residgamma);
36  } else if (fitter->residualsModel() == MuonResidualsFitter::kGaussPowerTails) {
37  fval += -weight * MuonResidualsFitter_logGaussPowerTails(residual, residpeak, residsigma);
38  } else {
39  assert(false);
40  }
41  }
42  }
43 }
double MuonResidualsFitter_logGaussPowerTails(double residual, double center, double sigma)
std::vector< double * >::const_iterator residuals_begin() const
static double MuonResiduals1DOFFitter_number_of_hits
MuonResidualsFitter * fitter()
Definition: weight.py:1
std::vector< double * >::const_iterator residuals_end() const
assert(be >=bs)
double MuonResidualsFitter_logROOTVoigt(double residual, double center, double sigma, double gamma)
static TMinuit * MuonResiduals1DOFFitter_TMinuit
double MuonResidualsFitter_logPowerLawTails(double residual, double center, double sigma, double gamma)
static bool MuonResiduals1DOFFitter_weightAlignment
static double MuonResiduals1DOFFitter_sum_of_weights
double MuonResidualsFitter_logPureGaussian(double residual, double center, double sigma)

Variable Documentation

◆ MuonResiduals1DOFFitter_number_of_hits

double MuonResiduals1DOFFitter_number_of_hits
static

◆ MuonResiduals1DOFFitter_sum_of_weights

double MuonResiduals1DOFFitter_sum_of_weights
static

◆ MuonResiduals1DOFFitter_TMinuit

TMinuit* MuonResiduals1DOFFitter_TMinuit
static

◆ MuonResiduals1DOFFitter_weightAlignment

bool MuonResiduals1DOFFitter_weightAlignment
static