CMS 3D CMS Logo

Functions | Variables

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

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

Go to the source code of this file.

Functions

double MuonResiduals6DOFFitter_dxdz (double delta_x, double delta_y, 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 MuonResiduals6DOFFitter_dxdz_trackdxdz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFFitter_dxdz_trackdydz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFFitter_dxdz_trackx_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFFitter_dxdz_tracky_TF1 (Double_t *xvec, Double_t *par)
double MuonResiduals6DOFFitter_dydz (double delta_x, double delta_y, 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 MuonResiduals6DOFFitter_dydz_trackdxdz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFFitter_dydz_trackdydz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFFitter_dydz_trackx_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFFitter_dydz_tracky_TF1 (Double_t *xvec, Double_t *par)
void MuonResiduals6DOFFitter_FCN (int &npar, double *gin, double &fval, double *par, int iflag)
double MuonResiduals6DOFFitter_x (double delta_x, double delta_y, 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 alphax, double residual_dxdz)
Double_t MuonResiduals6DOFFitter_x_trackdxdz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFFitter_x_trackdydz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFFitter_x_trackx_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFFitter_x_tracky_TF1 (Double_t *xvec, Double_t *par)
double MuonResiduals6DOFFitter_y (double delta_x, double delta_y, 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 alphay, double residual_dydz)
Double_t MuonResiduals6DOFFitter_y_trackdxdz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFFitter_y_trackdydz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFFitter_y_trackx_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFFitter_y_tracky_TF1 (Double_t *xvec, Double_t *par)

Variables

static double MuonResiduals6DOFFitter_number_of_hits
static double MuonResiduals6DOFFitter_sum_of_weights
static TMinuit * MuonResiduals6DOFFitter_TMinuit
static bool MuonResiduals6DOFFitter_weightAlignment

Function Documentation

double MuonResiduals6DOFFitter_dxdz ( double  delta_x,
double  delta_y,
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 23 of file MuonResiduals6DOFFitter.cc.

Referenced by MuonResiduals6DOFFitter_dxdz_trackdxdz_TF1(), MuonResiduals6DOFFitter_dxdz_trackdydz_TF1(), MuonResiduals6DOFFitter_dxdz_trackx_TF1(), MuonResiduals6DOFFitter_dxdz_tracky_TF1(), MuonResiduals6DOFFitter_FCN(), and MuonResiduals6DOFFitter::plot().

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

Definition at line 43 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_dxdz().

Referenced by MuonResiduals6DOFFitter::plot().

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

Definition at line 44 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_dxdz().

Referenced by MuonResiduals6DOFFitter::plot().

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

Definition at line 41 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_dxdz().

Referenced by MuonResiduals6DOFFitter::plot().

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

Definition at line 42 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_dxdz().

Referenced by MuonResiduals6DOFFitter::plot().

{ return 1000.*MuonResiduals6DOFFitter_dxdz(par[0], par[1], par[2], par[3], par[4], par[5], par[6], xvec[0], par[8], par[9]); }
double MuonResiduals6DOFFitter_dydz ( double  delta_x,
double  delta_y,
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 27 of file MuonResiduals6DOFFitter.cc.

Referenced by MuonResiduals6DOFFitter_dydz_trackdxdz_TF1(), MuonResiduals6DOFFitter_dydz_trackdydz_TF1(), MuonResiduals6DOFFitter_dydz_trackx_TF1(), MuonResiduals6DOFFitter_dydz_tracky_TF1(), MuonResiduals6DOFFitter_FCN(), and MuonResiduals6DOFFitter::plot().

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

Definition at line 48 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_dydz().

Referenced by MuonResiduals6DOFFitter::plot().

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

Definition at line 49 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_dydz().

Referenced by MuonResiduals6DOFFitter::plot().

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

Definition at line 46 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_dydz().

Referenced by MuonResiduals6DOFFitter::plot().

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

Definition at line 47 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_dydz().

Referenced by MuonResiduals6DOFFitter::plot().

{ return 1000.*MuonResiduals6DOFFitter_dydz(par[0], par[1], par[2], par[3], par[4], par[5], par[6], xvec[0], par[8], par[9]); }
void MuonResiduals6DOFFitter_FCN ( int &  npar,
double *  gin,
double &  fval,
double *  par,
int  iflag 
)

Definition at line 51 of file MuonResiduals6DOFFitter.cc.

References MuonResidualsFitterFitInfo::fitter(), MuonResiduals6DOFFitter::kAlignPhiX, MuonResiduals6DOFFitter::kAlignPhiY, MuonResiduals6DOFFitter::kAlignPhiZ, MuonResiduals6DOFFitter::kAlignX, MuonResiduals6DOFFitter::kAlignY, MuonResiduals6DOFFitter::kAlignZ, MuonResiduals6DOFFitter::kAlphaX, MuonResiduals6DOFFitter::kAlphaY, MuonResiduals6DOFFitter::kAngleX, MuonResiduals6DOFFitter::kAngleY, MuonResidualsFitter::kGaussPowerTails, MuonResiduals6DOFFitter::kPositionX, MuonResiduals6DOFFitter::kPositionY, MuonResidualsFitter::kPowerLawTails, MuonResidualsFitter::kPureGaussian, MuonResiduals6DOFFitter::kRedChi2, MuonResiduals6DOFFitter::kResidX, MuonResiduals6DOFFitter::kResidXGamma, MuonResiduals6DOFFitter::kResidXSigma, MuonResiduals6DOFFitter::kResidY, MuonResiduals6DOFFitter::kResidYGamma, MuonResiduals6DOFFitter::kResidYSigma, MuonResiduals6DOFFitter::kResSlopeX, MuonResiduals6DOFFitter::kResSlopeXGamma, MuonResiduals6DOFFitter::kResSlopeXSigma, MuonResiduals6DOFFitter::kResSlopeY, MuonResiduals6DOFFitter::kResSlopeYGamma, MuonResiduals6DOFFitter::kResSlopeYSigma, MuonResidualsFitter::kROOTVoigt, MuonResiduals6DOFFitter_dxdz(), MuonResiduals6DOFFitter_dydz(), MuonResiduals6DOFFitter_number_of_hits, MuonResiduals6DOFFitter_sum_of_weights, MuonResiduals6DOFFitter_TMinuit, MuonResiduals6DOFFitter_weightAlignment, MuonResiduals6DOFFitter_x(), MuonResiduals6DOFFitter_y(), MuonResidualsFitter_logGaussPowerTails(), MuonResidualsFitter_logPowerLawTails(), MuonResidualsFitter_logPureGaussian(), MuonResidualsFitter_logROOTVoigt(), MuonResidualsFitter::residuals_begin(), MuonResidualsFitter::residuals_end(), MuonResidualsFitter::residualsModel(), and CommonMethods::weight().

Referenced by MuonResiduals6DOFFitter::fit().

                                                                                               {
  MuonResidualsFitterFitInfo *fitinfo = (MuonResidualsFitterFitInfo*)(MuonResiduals6DOFFitter_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 residX = (*resiter)[MuonResiduals6DOFFitter::kResidX];
    const double residY = (*resiter)[MuonResiduals6DOFFitter::kResidY];
    const double resslopeX = (*resiter)[MuonResiduals6DOFFitter::kResSlopeX];
    const double resslopeY = (*resiter)[MuonResiduals6DOFFitter::kResSlopeY];
    const double positionX = (*resiter)[MuonResiduals6DOFFitter::kPositionX];
    const double positionY = (*resiter)[MuonResiduals6DOFFitter::kPositionY];
    const double angleX = (*resiter)[MuonResiduals6DOFFitter::kAngleX];
    const double angleY = (*resiter)[MuonResiduals6DOFFitter::kAngleY];
    const double redchi2 = (*resiter)[MuonResiduals6DOFFitter::kRedChi2];

    const double alignx = par[MuonResiduals6DOFFitter::kAlignX];
    const double aligny = par[MuonResiduals6DOFFitter::kAlignY];
    const double alignz = par[MuonResiduals6DOFFitter::kAlignZ];
    const double alignphix = par[MuonResiduals6DOFFitter::kAlignPhiX];
    const double alignphiy = par[MuonResiduals6DOFFitter::kAlignPhiY];
    const double alignphiz = par[MuonResiduals6DOFFitter::kAlignPhiZ];
    const double resXsigma = par[MuonResiduals6DOFFitter::kResidXSigma];
    const double resYsigma = par[MuonResiduals6DOFFitter::kResidYSigma];
    const double slopeXsigma = par[MuonResiduals6DOFFitter::kResSlopeXSigma];
    const double slopeYsigma = par[MuonResiduals6DOFFitter::kResSlopeYSigma];
    const double alphax = par[MuonResiduals6DOFFitter::kAlphaX];
    const double alphay = par[MuonResiduals6DOFFitter::kAlphaY];
    const double resXgamma = par[MuonResiduals6DOFFitter::kResidXGamma];
    const double resYgamma = par[MuonResiduals6DOFFitter::kResidYGamma];
    const double slopeXgamma = par[MuonResiduals6DOFFitter::kResSlopeXGamma];
    const double slopeYgamma = par[MuonResiduals6DOFFitter::kResSlopeYGamma];

    double residXpeak = MuonResiduals6DOFFitter_x(alignx, aligny, alignz, alignphix, alignphiy, alignphiz, positionX, positionY, angleX, angleY, alphax, resslopeX);
    double residYpeak = MuonResiduals6DOFFitter_y(alignx, aligny, alignz, alignphix, alignphiy, alignphiz, positionX, positionY, angleX, angleY, alphay, resslopeY);
    double slopeXpeak = MuonResiduals6DOFFitter_dxdz(alignx, aligny, alignz, alignphix, alignphiy, alignphiz, positionX, positionY, angleX, angleY);
    double slopeYpeak = MuonResiduals6DOFFitter_dydz(alignx, aligny, alignz, alignphix, alignphiy, alignphiz, positionX, positionY, angleX, angleY);

    double weight = (1./redchi2) * MuonResiduals6DOFFitter_number_of_hits / MuonResiduals6DOFFitter_sum_of_weights;
    if (!MuonResiduals6DOFFitter_weightAlignment) weight = 1.;

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

      if (fitter->residualsModel() == MuonResidualsFitter::kPureGaussian) {
        fval += -weight * MuonResidualsFitter_logPureGaussian(residX, residXpeak, resXsigma);
        fval += -weight * MuonResidualsFitter_logPureGaussian(residY, residYpeak, resYsigma);
        fval += -weight * MuonResidualsFitter_logPureGaussian(resslopeX, slopeXpeak, slopeXsigma);
        fval += -weight * MuonResidualsFitter_logPureGaussian(resslopeY, slopeYpeak, slopeYsigma);
      }
      else if (fitter->residualsModel() == MuonResidualsFitter::kPowerLawTails) {
        fval += -weight * MuonResidualsFitter_logPowerLawTails(residX, residXpeak, resXsigma, resXgamma);
        fval += -weight * MuonResidualsFitter_logPowerLawTails(residY, residYpeak, resYsigma, resYgamma);
        fval += -weight * MuonResidualsFitter_logPowerLawTails(resslopeX, slopeXpeak, slopeXsigma, slopeXgamma);
        fval += -weight * MuonResidualsFitter_logPowerLawTails(resslopeY, slopeYpeak, slopeYsigma, slopeYgamma);
      }
      else if (fitter->residualsModel() == MuonResidualsFitter::kROOTVoigt) {
        fval += -weight * MuonResidualsFitter_logROOTVoigt(residX, residXpeak, resXsigma, resXgamma);
        fval += -weight * MuonResidualsFitter_logROOTVoigt(residY, residYpeak, resYsigma, resYgamma);
        fval += -weight * MuonResidualsFitter_logROOTVoigt(resslopeX, slopeXpeak, slopeXsigma, slopeXgamma);
        fval += -weight * MuonResidualsFitter_logROOTVoigt(resslopeY, slopeYpeak, slopeYsigma, slopeYgamma);
      }
      else if (fitter->residualsModel() == MuonResidualsFitter::kGaussPowerTails) {
        fval += -weight * MuonResidualsFitter_logGaussPowerTails(residX, residXpeak, resXsigma);
        fval += -weight * MuonResidualsFitter_logGaussPowerTails(residY, residYpeak, resYsigma);
        fval += -weight * MuonResidualsFitter_logGaussPowerTails(resslopeX, slopeXpeak, slopeXsigma);
        fval += -weight * MuonResidualsFitter_logGaussPowerTails(resslopeY, slopeYpeak, slopeYsigma);
      }
      else { assert(false); }

    }
  }
}
double MuonResiduals6DOFFitter_x ( double  delta_x,
double  delta_y,
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  alphax,
double  residual_dxdz 
)

Definition at line 15 of file MuonResiduals6DOFFitter.cc.

Referenced by MuonResiduals6DOFFitter_FCN(), MuonResiduals6DOFFitter_x_trackdxdz_TF1(), MuonResiduals6DOFFitter_x_trackdydz_TF1(), MuonResiduals6DOFFitter_x_trackx_TF1(), MuonResiduals6DOFFitter_x_tracky_TF1(), and MuonResiduals6DOFFitter::plot().

                                                                                                                                                                                                                                                     {
  return delta_x - track_dxdz * delta_z - track_y * track_dxdz * delta_phix + track_x * track_dxdz * delta_phiy - track_y * delta_phiz + residual_dxdz * alphax;
}
Double_t MuonResiduals6DOFFitter_x_trackdxdz_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 33 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_x().

Referenced by MuonResiduals6DOFFitter::plot().

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

Definition at line 34 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_x().

Referenced by MuonResiduals6DOFFitter::plot().

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

Definition at line 31 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_x().

Referenced by MuonResiduals6DOFFitter::plot().

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

Definition at line 32 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_x().

Referenced by MuonResiduals6DOFFitter::plot().

{ return 10.*MuonResiduals6DOFFitter_x(par[0], par[1], par[2], par[3], par[4], par[5], par[6], xvec[0], par[8], par[9], par[10], par[11]); }
double MuonResiduals6DOFFitter_y ( double  delta_x,
double  delta_y,
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  alphay,
double  residual_dydz 
)

Definition at line 19 of file MuonResiduals6DOFFitter.cc.

Referenced by MuonResiduals6DOFFitter_FCN(), MuonResiduals6DOFFitter_y_trackdxdz_TF1(), MuonResiduals6DOFFitter_y_trackdydz_TF1(), MuonResiduals6DOFFitter_y_trackx_TF1(), MuonResiduals6DOFFitter_y_tracky_TF1(), and MuonResiduals6DOFFitter::plot().

                                                                                                                                                                                                                                                     {
  return delta_y - track_dydz * delta_z - track_y * track_dydz * delta_phix + track_x * track_dydz * delta_phiy + track_x * delta_phiz + residual_dydz * alphay;
}
Double_t MuonResiduals6DOFFitter_y_trackdxdz_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 38 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_y().

Referenced by MuonResiduals6DOFFitter::plot().

{ return 10.*MuonResiduals6DOFFitter_y(par[0], par[1], par[2], par[3], par[4], par[5], par[6], par[7], xvec[0], par[9], par[12], par[13]); }
Double_t MuonResiduals6DOFFitter_y_trackdydz_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 39 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_y().

Referenced by MuonResiduals6DOFFitter::plot().

{ return 10.*MuonResiduals6DOFFitter_y(par[0], par[1], par[2], par[3], par[4], par[5], par[6], par[7], par[8], xvec[0], par[12], par[13]); }
Double_t MuonResiduals6DOFFitter_y_trackx_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 36 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_y().

Referenced by MuonResiduals6DOFFitter::plot().

{ return 10.*MuonResiduals6DOFFitter_y(par[0], par[1], par[2], par[3], par[4], par[5], xvec[0], par[7], par[8], par[9], par[12], par[13]); }
Double_t MuonResiduals6DOFFitter_y_tracky_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Definition at line 37 of file MuonResiduals6DOFFitter.cc.

References MuonResiduals6DOFFitter_y().

Referenced by MuonResiduals6DOFFitter::plot().

{ return 10.*MuonResiduals6DOFFitter_y(par[0], par[1], par[2], par[3], par[4], par[5], par[6], xvec[0], par[8], par[9], par[12], par[13]); }

Variable Documentation