CMS 3D CMS Logo

Functions | Variables

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

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

Go to the source code of this file.

Functions

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

Variables

static TMinuit * MuonResidualsPositionFitter_TMinuit

Function Documentation

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

Definition at line 9 of file MuonResidualsPositionFitter.cc.

References MuonResidualsFitterFitInfo::fitter(), MuonResidualsPositionFitter::kAngleError, MuonResidualsPositionFitter::kGamma, MuonResidualsFitter::kGaussPowerTails, MuonResidualsPositionFitter::kPhiz, MuonResidualsPositionFitter::kPosition, MuonResidualsFitter::kPowerLawTails, MuonResidualsFitter::kPureGaussian, MuonResidualsPositionFitter::kResidual, MuonResidualsFitter::kROOTVoigt, MuonResidualsPositionFitter::kScattering, MuonResidualsPositionFitter::kSigma, MuonResidualsPositionFitter::kTrackAngle, MuonResidualsPositionFitter::kTrackPosition, MuonResidualsPositionFitter::kZpos, MuonResidualsFitter_logGaussPowerTails(), MuonResidualsFitter_logPowerLawTails(), MuonResidualsFitter_logPureGaussian(), MuonResidualsFitter_logROOTVoigt(), MuonResidualsPositionFitter_TMinuit, MuonResidualsFitter::residuals_begin(), MuonResidualsFitter::residuals_end(), and MuonResidualsFitter::residualsModel().

Referenced by MuonResidualsPositionFitter::fit().

                                                                                                   {
  MuonResidualsFitterFitInfo *fitinfo = (MuonResidualsFitterFitInfo*)(MuonResidualsPositionFitter_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)[MuonResidualsPositionFitter::kResidual];
    const double angleerror = (*resiter)[MuonResidualsPositionFitter::kAngleError];
    const double trackangle = (*resiter)[MuonResidualsPositionFitter::kTrackAngle];
    const double trackposition = (*resiter)[MuonResidualsPositionFitter::kTrackPosition];
      
    double center = 0.;
    center += par[MuonResidualsPositionFitter::kPosition];
    center += par[MuonResidualsPositionFitter::kZpos] * trackangle;
    center += par[MuonResidualsPositionFitter::kPhiz] * trackposition;
    center += par[MuonResidualsPositionFitter::kScattering] * angleerror;

    if (fitter->residualsModel() == MuonResidualsFitter::kPureGaussian) {
      fval += -MuonResidualsFitter_logPureGaussian(residual, center, par[MuonResidualsPositionFitter::kSigma]);
    }
    else if (fitter->residualsModel() == MuonResidualsFitter::kPowerLawTails) {
      fval += -MuonResidualsFitter_logPowerLawTails(residual, center, par[MuonResidualsPositionFitter::kSigma], par[MuonResidualsPositionFitter::kGamma]);
    }
    else if (fitter->residualsModel() == MuonResidualsFitter::kROOTVoigt) {
      fval += -MuonResidualsFitter_logROOTVoigt(residual, center, par[MuonResidualsPositionFitter::kSigma], par[MuonResidualsPositionFitter::kGamma]);
    }
    else if (fitter->residualsModel() == MuonResidualsFitter::kGaussPowerTails) {
      fval += -MuonResidualsFitter_logGaussPowerTails(residual, center, par[MuonResidualsPositionFitter::kSigma]);
    }
    else { assert(false); }
  }
}

Variable Documentation