CMS 3D CMS Logo

Functions | Variables

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Alignment/MuonAlignmentAlgorithms/src/MuonResiduals5DOFFitter.cc File Reference

#include "Alignment/MuonAlignmentAlgorithms/interface/MuonResiduals5DOFFitter.h"
#include "TH2F.h"
#include "TMath.h"

Go to the source code of this file.

Functions

void MuonResiduals5DOFFitter_FCN (int &npar, double *gin, double &fval, double *par, int iflag)
double MuonResiduals5DOFFitter_residual (double delta_x, double delta_z, double delta_phix, double delta_phiy, double delta_phiz, double track_x, double track_y, double track_dxdz, double track_dydz, double alpha, double resslope)
Double_t MuonResiduals5DOFFitter_residual_trackdxdz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals5DOFFitter_residual_trackdydz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals5DOFFitter_residual_trackx_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals5DOFFitter_residual_tracky_TF1 (Double_t *xvec, Double_t *par)
double MuonResiduals5DOFFitter_resslope (double delta_x, double delta_z, double delta_phix, double delta_phiy, double delta_phiz, double track_x, double track_y, double track_dxdz, double track_dydz)
Double_t MuonResiduals5DOFFitter_resslope_trackdxdz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals5DOFFitter_resslope_trackdydz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals5DOFFitter_resslope_trackx_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals5DOFFitter_resslope_tracky_TF1 (Double_t *xvec, Double_t *par)

Variables

static double MuonResiduals5DOFFitter_number_of_hits
static double MuonResiduals5DOFFitter_sum_of_weights
static TMinuit * MuonResiduals5DOFFitter_TMinuit
static bool MuonResiduals5DOFFitter_weightAlignment

Function Documentation

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

Definition at line 32 of file MuonResiduals5DOFFitter.cc.

References alpha, MuonResidualsFitterFitInfo::fitter(), MuonResiduals5DOFFitter::kAlignPhiX, MuonResiduals5DOFFitter::kAlignPhiY, MuonResiduals5DOFFitter::kAlignPhiZ, MuonResiduals5DOFFitter::kAlignX, MuonResiduals5DOFFitter::kAlignZ, MuonResiduals5DOFFitter::kAlpha, MuonResiduals5DOFFitter::kAngleX, MuonResiduals5DOFFitter::kAngleY, MuonResidualsFitter::kGaussPowerTails, MuonResiduals5DOFFitter::kPositionX, MuonResiduals5DOFFitter::kPositionY, MuonResidualsFitter::kPowerLawTails, MuonResidualsFitter::kPureGaussian, MuonResiduals5DOFFitter::kRedChi2, MuonResiduals5DOFFitter::kResid, MuonResiduals5DOFFitter::kResidGamma, MuonResiduals5DOFFitter::kResidSigma, MuonResiduals5DOFFitter::kResSlope, MuonResiduals5DOFFitter::kResSlopeGamma, MuonResiduals5DOFFitter::kResSlopeSigma, MuonResidualsFitter::kROOTVoigt, MuonResiduals5DOFFitter_number_of_hits, MuonResiduals5DOFFitter_residual(), MuonResiduals5DOFFitter_resslope(), MuonResiduals5DOFFitter_sum_of_weights, MuonResiduals5DOFFitter_TMinuit, MuonResiduals5DOFFitter_weightAlignment, MuonResidualsFitter_logGaussPowerTails(), MuonResidualsFitter_logPowerLawTails(), MuonResidualsFitter_logPureGaussian(), MuonResidualsFitter_logROOTVoigt(), MuonResidualsFitter::residuals_begin(), MuonResidualsFitter::residuals_end(), MuonResidualsFitter::residualsModel(), and CommonMethods::weight().

Referenced by MuonResiduals5DOFFitter::fit().

                                                                                               {
  MuonResidualsFitterFitInfo *fitinfo = (MuonResidualsFitterFitInfo*)(MuonResiduals5DOFFitter_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)[MuonResiduals5DOFFitter::kResid];
    const double resslope = (*resiter)[MuonResiduals5DOFFitter::kResSlope];
    const double positionX = (*resiter)[MuonResiduals5DOFFitter::kPositionX];
    const double positionY = (*resiter)[MuonResiduals5DOFFitter::kPositionY];
    const double angleX = (*resiter)[MuonResiduals5DOFFitter::kAngleX];
    const double angleY = (*resiter)[MuonResiduals5DOFFitter::kAngleY];
    const double redchi2 = (*resiter)[MuonResiduals5DOFFitter::kRedChi2];

    const double alignx = par[MuonResiduals5DOFFitter::kAlignX];
    const double alignz = par[MuonResiduals5DOFFitter::kAlignZ];
    const double alignphix = par[MuonResiduals5DOFFitter::kAlignPhiX];
    const double alignphiy = par[MuonResiduals5DOFFitter::kAlignPhiY];
    const double alignphiz = par[MuonResiduals5DOFFitter::kAlignPhiZ];
    const double residsigma = par[MuonResiduals5DOFFitter::kResidSigma];
    const double resslopesigma = par[MuonResiduals5DOFFitter::kResSlopeSigma];
    const double alpha = par[MuonResiduals5DOFFitter::kAlpha];
    const double residgamma = par[MuonResiduals5DOFFitter::kResidGamma];
    const double resslopegamma = par[MuonResiduals5DOFFitter::kResSlopeGamma];

    double residpeak = MuonResiduals5DOFFitter_residual(alignx, alignz, alignphix, alignphiy, alignphiz, positionX, positionY, angleX, angleY, alpha, resslope);
    double resslopepeak = MuonResiduals5DOFFitter_resslope(alignx, alignz, alignphix, alignphiy, alignphiz, positionX, positionY, angleX, angleY);

    double weight = (1./redchi2) * MuonResiduals5DOFFitter_number_of_hits / MuonResiduals5DOFFitter_sum_of_weights;
    if (!MuonResiduals5DOFFitter_weightAlignment) weight = 1.;

    if (!MuonResiduals5DOFFitter_weightAlignment  ||  TMath::Prob(redchi2*8, 8) < 0.99) {  // no spikes allowed

      if (fitter->residualsModel() == MuonResidualsFitter::kPureGaussian) {
        fval += -weight * MuonResidualsFitter_logPureGaussian(residual, residpeak, residsigma);
        fval += -weight * MuonResidualsFitter_logPureGaussian(resslope, resslopepeak, resslopesigma);
      }
      else if (fitter->residualsModel() == MuonResidualsFitter::kPowerLawTails) {
        fval += -weight * MuonResidualsFitter_logPowerLawTails(residual, residpeak, residsigma, residgamma);
        fval += -weight * MuonResidualsFitter_logPowerLawTails(resslope, resslopepeak, resslopesigma, resslopegamma);
      }
      else if (fitter->residualsModel() == MuonResidualsFitter::kROOTVoigt) {
        fval += -weight * MuonResidualsFitter_logROOTVoigt(residual, residpeak, residsigma, residgamma);
        fval += -weight * MuonResidualsFitter_logROOTVoigt(resslope, resslopepeak, resslopesigma, resslopegamma);
      }
      else if (fitter->residualsModel() == MuonResidualsFitter::kGaussPowerTails) {
        fval += -weight * MuonResidualsFitter_logGaussPowerTails(residual, residpeak, residsigma);
        fval += -weight * MuonResidualsFitter_logGaussPowerTails(resslope, resslopepeak, resslopesigma);
      }
      else { assert(false); }

    }
  }
}
double MuonResiduals5DOFFitter_residual ( double  delta_x,
double  delta_z,
double  delta_phix,
double  delta_phiy,
double  delta_phiz,
double  track_x,
double  track_y,
double  track_dxdz,
double  track_dydz,
double  alpha,
double  resslope 
)

Definition at line 14 of file MuonResiduals5DOFFitter.cc.

References alpha.

Referenced by MuonResiduals5DOFFitter_FCN(), MuonResiduals5DOFFitter_residual_trackdxdz_TF1(), MuonResiduals5DOFFitter_residual_trackdydz_TF1(), MuonResiduals5DOFFitter_residual_trackx_TF1(), MuonResiduals5DOFFitter_residual_tracky_TF1(), and MuonResiduals5DOFFitter::plot().

                                                                                                                                                                                                                                      {
  return delta_x - track_dxdz * delta_z - track_y * track_dxdz * delta_phix + track_x * track_dxdz * delta_phiy - track_y * delta_phiz + resslope * alpha;
}
Double_t MuonResiduals5DOFFitter_residual_trackdxdz_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 24 of file MuonResiduals5DOFFitter.cc.

References MuonResiduals5DOFFitter_residual().

Referenced by MuonResiduals5DOFFitter::plot().

{ return 10.*MuonResiduals5DOFFitter_residual(par[0], par[2], par[3], par[4], par[5], par[6], par[7], xvec[0], par[9], par[10], par[11]); }
Double_t MuonResiduals5DOFFitter_residual_trackdydz_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 25 of file MuonResiduals5DOFFitter.cc.

References MuonResiduals5DOFFitter_residual().

Referenced by MuonResiduals5DOFFitter::plot().

{ return 10.*MuonResiduals5DOFFitter_residual(par[0], par[2], par[3], par[4], par[5], par[6], par[7], par[8], xvec[0], par[10], par[11]); }
Double_t MuonResiduals5DOFFitter_residual_trackx_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 22 of file MuonResiduals5DOFFitter.cc.

References MuonResiduals5DOFFitter_residual().

Referenced by MuonResiduals5DOFFitter::plot().

{ return 10.*MuonResiduals5DOFFitter_residual(par[0], par[2], par[3], par[4], par[5], xvec[0], par[7], par[8], par[9], par[10], par[11]); }
Double_t MuonResiduals5DOFFitter_residual_tracky_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 23 of file MuonResiduals5DOFFitter.cc.

References MuonResiduals5DOFFitter_residual().

Referenced by MuonResiduals5DOFFitter::plot().

{ return 10.*MuonResiduals5DOFFitter_residual(par[0], par[2], par[3], par[4], par[5], par[6], xvec[0], par[8], par[9], par[10], par[11]); }
double MuonResiduals5DOFFitter_resslope ( double  delta_x,
double  delta_z,
double  delta_phix,
double  delta_phiy,
double  delta_phiz,
double  track_x,
double  track_y,
double  track_dxdz,
double  track_dydz 
)

Definition at line 18 of file MuonResiduals5DOFFitter.cc.

Referenced by MuonResiduals5DOFFitter_FCN(), MuonResiduals5DOFFitter_resslope_trackdxdz_TF1(), MuonResiduals5DOFFitter_resslope_trackdydz_TF1(), MuonResiduals5DOFFitter_resslope_trackx_TF1(), MuonResiduals5DOFFitter_resslope_tracky_TF1(), and MuonResiduals5DOFFitter::plot().

                                                                                                                                                                                                       {
  return -track_dxdz * track_dydz * delta_phix + (1. + track_dxdz * track_dxdz) * delta_phiy - track_dydz * delta_phiz;
}
Double_t MuonResiduals5DOFFitter_resslope_trackdxdz_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 29 of file MuonResiduals5DOFFitter.cc.

References MuonResiduals5DOFFitter_resslope().

Referenced by MuonResiduals5DOFFitter::plot().

{ return 1000.*MuonResiduals5DOFFitter_resslope(par[0], par[2], par[3], par[4], par[5], par[6], par[7], xvec[0], par[9]); }
Double_t MuonResiduals5DOFFitter_resslope_trackdydz_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 30 of file MuonResiduals5DOFFitter.cc.

References MuonResiduals5DOFFitter_resslope().

Referenced by MuonResiduals5DOFFitter::plot().

{ return 1000.*MuonResiduals5DOFFitter_resslope(par[0], par[2], par[3], par[4], par[5], par[6], par[7], par[8], xvec[0]); }
Double_t MuonResiduals5DOFFitter_resslope_trackx_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 27 of file MuonResiduals5DOFFitter.cc.

References MuonResiduals5DOFFitter_resslope().

Referenced by MuonResiduals5DOFFitter::plot().

{ return 1000.*MuonResiduals5DOFFitter_resslope(par[0], par[2], par[3], par[4], par[5], xvec[0], par[7], par[8], par[9]); }
Double_t MuonResiduals5DOFFitter_resslope_tracky_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 28 of file MuonResiduals5DOFFitter.cc.

References MuonResiduals5DOFFitter_resslope().

Referenced by MuonResiduals5DOFFitter::plot().

{ return 1000.*MuonResiduals5DOFFitter_resslope(par[0], par[2], par[3], par[4], par[5], par[6], xvec[0], par[8], par[9]); }

Variable Documentation