CMS 3D CMS Logo

Functions | Variables

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/Alignment/MuonAlignmentAlgorithms/src/MuonResidualsAngleFitter.cc File Reference

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

Go to the source code of this file.

Functions

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

Variables

static TMinuit * MuonResidualsAngleFitter_TMinuit

Function Documentation

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

Definition at line 9 of file MuonResidualsAngleFitter.cc.

References MuonResidualsFitterFitInfo::fitter(), MuonResidualsAngleFitter::kAngle, MuonResidualsAngleFitter::kGamma, MuonResidualsFitter::kGaussPowerTails, MuonResidualsFitter::kPowerLawTails, MuonResidualsFitter::kPureGaussian, MuonResidualsAngleFitter::kResidual, MuonResidualsFitter::kROOTVoigt, MuonResidualsAngleFitter::kSigma, MuonResidualsAngleFitter::kXAngle, MuonResidualsAngleFitter::kXControl, MuonResidualsAngleFitter::kYAngle, MuonResidualsAngleFitter::kYControl, MuonResidualsAngleFitter_TMinuit, MuonResidualsFitter_logGaussPowerTails(), MuonResidualsFitter_logPowerLawTails(), MuonResidualsFitter_logPureGaussian(), MuonResidualsFitter_logROOTVoigt(), MuonResidualsFitter::residuals_begin(), MuonResidualsFitter::residuals_end(), and MuonResidualsFitter::residualsModel().

Referenced by MuonResidualsAngleFitter::fit().

                                                                                                {
  MuonResidualsFitterFitInfo *fitinfo = (MuonResidualsFitterFitInfo*)(MuonResidualsAngleFitter_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)[MuonResidualsAngleFitter::kResidual];
    const double xangle = (*resiter)[MuonResidualsAngleFitter::kXAngle];
    const double yangle = (*resiter)[MuonResidualsAngleFitter::kYAngle];
    
    double center = 0.;
    center += par[MuonResidualsAngleFitter::kAngle];
    center += par[MuonResidualsAngleFitter::kXControl] * xangle;
    center += par[MuonResidualsAngleFitter::kYControl] * yangle;
    
    if (fitter->residualsModel() == MuonResidualsFitter::kPureGaussian) {
      fval += -MuonResidualsFitter_logPureGaussian(residual, center, par[MuonResidualsAngleFitter::kSigma]);
    }
    else if (fitter->residualsModel() == MuonResidualsFitter::kPowerLawTails) {
      fval += -MuonResidualsFitter_logPowerLawTails(residual, center, par[MuonResidualsAngleFitter::kSigma], par[MuonResidualsAngleFitter::kGamma]);
    }
    else if (fitter->residualsModel() == MuonResidualsFitter::kROOTVoigt) {
      fval += -MuonResidualsFitter_logROOTVoigt(residual, center, par[MuonResidualsAngleFitter::kSigma], par[MuonResidualsAngleFitter::kGamma]);
    }
    else if (fitter->residualsModel() == MuonResidualsFitter::kGaussPowerTails) {
      fval += -MuonResidualsFitter_logGaussPowerTails(residual, center, par[MuonResidualsAngleFitter::kSigma]);
    }
    else { assert(false); }
  }
}

Variable Documentation