CMS 3D CMS Logo

Functions | Variables

/data/git/CMSSW_5_3_11_patch5/src/Alignment/MuonAlignmentAlgorithms/src/MuonResidualsBfieldAngleFitter.cc File Reference

#include "Alignment/MuonAlignmentAlgorithms/interface/MuonResidualsBfieldAngleFitter.h"

Go to the source code of this file.

Functions

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

Variables

static TMinuit * MuonResidualsBfieldAngleFitter_TMinuit

Function Documentation

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

Definition at line 9 of file MuonResidualsBfieldAngleFitter.cc.

References MuonResidualsFitterFitInfo::fitter(), MuonResidualsBfieldAngleFitter::kAngle, MuonResidualsBfieldAngleFitter::kBfrompt, MuonResidualsBfieldAngleFitter::kBfrompz, MuonResidualsBfieldAngleFitter::kdEdx, MuonResidualsBfieldAngleFitter::kGamma, MuonResidualsFitter::kGaussPowerTails, MuonResidualsFitter::kPowerLawTails, MuonResidualsFitter::kPureGaussian, MuonResidualsBfieldAngleFitter::kQoverPt, MuonResidualsBfieldAngleFitter::kQoverPz, MuonResidualsBfieldAngleFitter::kResidual, MuonResidualsFitter::kROOTVoigt, MuonResidualsBfieldAngleFitter::kSigma, MuonResidualsBfieldAngleFitter_TMinuit, MuonResidualsFitter_logGaussPowerTails(), MuonResidualsFitter_logPowerLawTails(), MuonResidualsFitter_logPureGaussian(), MuonResidualsFitter_logROOTVoigt(), MuonResidualsFitter::residuals_begin(), MuonResidualsFitter::residuals_end(), and MuonResidualsFitter::residualsModel().

Referenced by MuonResidualsBfieldAngleFitter::fit().

                                                                                                      {
  MuonResidualsFitterFitInfo *fitinfo = (MuonResidualsFitterFitInfo*)(MuonResidualsBfieldAngleFitter_TMinuit->GetObjectFit());
  MuonResidualsFitter *fitter = fitinfo->fitter();

  fval = 0.;
  for (std::vector<double*>::const_iterator resiter = fitter->residuals_begin();  resiter != fitter->residuals_end();  ++resiter) {
    const double residual = (*resiter)[MuonResidualsBfieldAngleFitter::kResidual];
    const double qoverpt = (*resiter)[MuonResidualsBfieldAngleFitter::kQoverPt];
    const double qoverpz = (*resiter)[MuonResidualsBfieldAngleFitter::kQoverPz];
    
    double center = 0.;
    center += par[MuonResidualsBfieldAngleFitter::kAngle];
    center += par[MuonResidualsBfieldAngleFitter::kBfrompt] * qoverpt;
    center += par[MuonResidualsBfieldAngleFitter::kBfrompz] * qoverpz;
    center += par[MuonResidualsBfieldAngleFitter::kdEdx] * (1./qoverpt/qoverpt + 1./qoverpz/qoverpz) * (qoverpt > 0. ? 1. : -1.);
    
    if (fitter->residualsModel() == MuonResidualsFitter::kPureGaussian) {
      fval += -MuonResidualsFitter_logPureGaussian(residual, center, par[MuonResidualsBfieldAngleFitter::kSigma]);
    }
    else if (fitter->residualsModel() == MuonResidualsFitter::kPowerLawTails) {
      fval += -MuonResidualsFitter_logPowerLawTails(residual, center, par[MuonResidualsBfieldAngleFitter::kSigma], par[MuonResidualsBfieldAngleFitter::kGamma]);
    }
    else if (fitter->residualsModel() == MuonResidualsFitter::kROOTVoigt) {
      fval += -MuonResidualsFitter_logROOTVoigt(residual, center, par[MuonResidualsBfieldAngleFitter::kSigma], par[MuonResidualsBfieldAngleFitter::kGamma]);
    }
    else if (fitter->residualsModel() == MuonResidualsFitter::kGaussPowerTails) {
      fval += -MuonResidualsFitter_logGaussPowerTails(residual, center, par[MuonResidualsBfieldAngleFitter::kSigma]);
    }
    else { assert(false); }
  }
}

Variable Documentation