CMS 3D CMS Logo

Functions | Variables

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/Alignment/MuonAlignmentAlgorithms/src/MuonResiduals6DOFrphiFitter.cc File Reference

#include "Alignment/MuonAlignmentAlgorithms/interface/MuonResiduals6DOFrphiFitter.h"
#include "DataFormats/MuonDetId/interface/CSCDetId.h"
#include "TH2F.h"
#include "TMath.h"

Go to the source code of this file.

Functions

double MuonResiduals6DOFrphiFitter_effectiveR (double x, double y)
void MuonResiduals6DOFrphiFitter_FCN (int &npar, double *gin, double &fval, double *par, int iflag)
double MuonResiduals6DOFrphiFitter_residual (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 R, double alpha, double resslope)
Double_t MuonResiduals6DOFrphiFitter_residual_trackdxdz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFrphiFitter_residual_trackdydz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFrphiFitter_residual_trackx_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFrphiFitter_residual_tracky_TF1 (Double_t *xvec, Double_t *par)
double MuonResiduals6DOFrphiFitter_resslope (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 R)
Double_t MuonResiduals6DOFrphiFitter_resslope_trackdxdz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFrphiFitter_resslope_trackdydz_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFrphiFitter_resslope_trackx_TF1 (Double_t *xvec, Double_t *par)
Double_t MuonResiduals6DOFrphiFitter_resslope_tracky_TF1 (Double_t *xvec, Double_t *par)

Variables

static CSCDetId MuonResiduals6DOFrphiFitter_cscDetId
const CSCGeometryMuonResiduals6DOFrphiFitter_cscGeometry
static double MuonResiduals6DOFrphiFitter_number_of_hits
static double MuonResiduals6DOFrphiFitter_R
static double MuonResiduals6DOFrphiFitter_sum_of_weights
static TMinuit * MuonResiduals6DOFrphiFitter_TMinuit
static bool MuonResiduals6DOFrphiFitter_weightAlignment

Function Documentation

double MuonResiduals6DOFrphiFitter_effectiveR ( double  x,
double  y 
)

Definition at line 27 of file MuonResiduals6DOFrphiFitter.cc.

References MuonResiduals6DOFrphiFitter_R.

Referenced by MuonResiduals6DOFrphiFitter_FCN(), MuonResiduals6DOFrphiFitter_residual_trackdxdz_TF1(), MuonResiduals6DOFrphiFitter_residual_trackdydz_TF1(), MuonResiduals6DOFrphiFitter_residual_trackx_TF1(), MuonResiduals6DOFrphiFitter_residual_tracky_TF1(), MuonResiduals6DOFrphiFitter_resslope_trackdxdz_TF1(), MuonResiduals6DOFrphiFitter_resslope_trackdydz_TF1(), MuonResiduals6DOFrphiFitter_resslope_trackx_TF1(), MuonResiduals6DOFrphiFitter_resslope_tracky_TF1(), and MuonResiduals6DOFrphiFitter::plot().

                                                                  {
//   CSCDetId id = MuonResiduals6DOFrphiFitter_cscDetId;
//   CSCDetId layerId(id.endcap(), id.station(), id.ring(), id.chamber(), 3);

//   int strip = MuonResiduals6DOFrphiFitter_cscGeometry->layer(layerId)->geometry()->nearestStrip(LocalPoint(x, y, 0.));
//   double angle = MuonResiduals6DOFrphiFitter_cscGeometry->layer(layerId)->geometry()->stripAngle(strip) - M_PI/2.;

//   if (fabs(angle) < 1e-10) return MuonResiduals6DOFrphiFitter_R;
//   else return x/tan(angle) - y;

  return MuonResiduals6DOFrphiFitter_R;
}
void MuonResiduals6DOFrphiFitter_FCN ( int &  npar,
double *  gin,
double &  fval,
double *  par,
int  iflag 
)

Definition at line 50 of file MuonResiduals6DOFrphiFitter.cc.

References alpha, MuonResidualsFitterFitInfo::fitter(), MuonResiduals6DOFrphiFitter::kAlignPhiX, MuonResiduals6DOFrphiFitter::kAlignPhiY, MuonResiduals6DOFrphiFitter::kAlignPhiZ, MuonResiduals6DOFrphiFitter::kAlignX, MuonResiduals6DOFrphiFitter::kAlignY, MuonResiduals6DOFrphiFitter::kAlignZ, MuonResiduals6DOFrphiFitter::kAlpha, MuonResiduals6DOFrphiFitter::kAngleX, MuonResiduals6DOFrphiFitter::kAngleY, MuonResidualsFitter::kGaussPowerTails, MuonResiduals6DOFrphiFitter::kPositionX, MuonResiduals6DOFrphiFitter::kPositionY, MuonResidualsFitter::kPowerLawTails, MuonResidualsFitter::kPureGaussian, MuonResiduals6DOFrphiFitter::kRedChi2, MuonResiduals6DOFrphiFitter::kResid, MuonResiduals6DOFrphiFitter::kResidGamma, MuonResiduals6DOFrphiFitter::kResidSigma, MuonResiduals6DOFrphiFitter::kResSlope, MuonResiduals6DOFrphiFitter::kResSlopeGamma, MuonResiduals6DOFrphiFitter::kResSlopeSigma, MuonResidualsFitter::kROOTVoigt, MuonResiduals6DOFrphiFitter_effectiveR(), MuonResiduals6DOFrphiFitter_number_of_hits, MuonResiduals6DOFrphiFitter_residual(), MuonResiduals6DOFrphiFitter_resslope(), MuonResiduals6DOFrphiFitter_sum_of_weights, MuonResiduals6DOFrphiFitter_TMinuit, MuonResiduals6DOFrphiFitter_weightAlignment, MuonResidualsFitter_logGaussPowerTails(), MuonResidualsFitter_logPowerLawTails(), MuonResidualsFitter_logPureGaussian(), MuonResidualsFitter_logROOTVoigt(), MuonResidualsFitter::residuals_begin(), MuonResidualsFitter::residuals_end(), MuonResidualsFitter::residualsModel(), and CommonMethods::weight().

Referenced by MuonResiduals6DOFrphiFitter::fit().

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

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

    double residpeak = MuonResiduals6DOFrphiFitter_residual(alignx, aligny, alignz, alignphix, alignphiy, alignphiz, positionX, positionY, angleX, angleY, MuonResiduals6DOFrphiFitter_effectiveR(positionX, positionY), alpha, resslope);
    double resslopepeak = MuonResiduals6DOFrphiFitter_resslope(alignx, aligny, alignz, alignphix, alignphiy, alignphiz, positionX, positionY, angleX, angleY, MuonResiduals6DOFrphiFitter_effectiveR(positionX, positionY));

    double weight = (1./redchi2) * MuonResiduals6DOFrphiFitter_number_of_hits / MuonResiduals6DOFrphiFitter_sum_of_weights;
    if (!MuonResiduals6DOFrphiFitter_weightAlignment) weight = 1.;

    if (!MuonResiduals6DOFrphiFitter_weightAlignment  ||  TMath::Prob(redchi2*6, 6) < 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 MuonResiduals6DOFrphiFitter_residual ( 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  R,
double  alpha,
double  resslope 
)

Definition at line 19 of file MuonResiduals6DOFrphiFitter.cc.

References funct::pow().

Referenced by MuonResiduals6DOFrphiFitter_FCN(), MuonResiduals6DOFrphiFitter_residual_trackdxdz_TF1(), MuonResiduals6DOFrphiFitter_residual_trackdydz_TF1(), MuonResiduals6DOFrphiFitter_residual_trackx_TF1(), MuonResiduals6DOFrphiFitter_residual_tracky_TF1(), and MuonResiduals6DOFrphiFitter::plot().

                                                                                                                                                                                                                                                                    {
  return delta_x - (track_x/R - 3.*pow(track_x/R, 3)) * delta_y - track_dxdz * delta_z - track_y * track_dxdz * delta_phix + track_x * track_dxdz * delta_phiy - track_y * delta_phiz + resslope * alpha;
}
Double_t MuonResiduals6DOFrphiFitter_residual_trackdxdz_TF1 ( Double_t *  xvec,
Double_t *  par 
)
Double_t MuonResiduals6DOFrphiFitter_residual_trackdydz_TF1 ( Double_t *  xvec,
Double_t *  par 
)
Double_t MuonResiduals6DOFrphiFitter_residual_trackx_TF1 ( Double_t *  xvec,
Double_t *  par 
)
Double_t MuonResiduals6DOFrphiFitter_residual_tracky_TF1 ( Double_t *  xvec,
Double_t *  par 
)
double MuonResiduals6DOFrphiFitter_resslope ( 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  R 
)

Definition at line 23 of file MuonResiduals6DOFrphiFitter.cc.

Referenced by MuonResiduals6DOFrphiFitter_FCN(), MuonResiduals6DOFrphiFitter_resslope_trackdxdz_TF1(), MuonResiduals6DOFrphiFitter_resslope_trackdydz_TF1(), MuonResiduals6DOFrphiFitter_resslope_trackx_TF1(), MuonResiduals6DOFrphiFitter_resslope_tracky_TF1(), and MuonResiduals6DOFrphiFitter::plot().

                                                                                                                                                                                                                                     {
  return -track_dxdz/2./R * delta_y + (track_x/R - track_dxdz * track_dydz) * delta_phix + (1. + track_dxdz * track_dxdz) * delta_phiy - track_dydz * delta_phiz;
}
Double_t MuonResiduals6DOFrphiFitter_resslope_trackdxdz_TF1 ( Double_t *  xvec,
Double_t *  par 
)
Double_t MuonResiduals6DOFrphiFitter_resslope_trackdydz_TF1 ( Double_t *  xvec,
Double_t *  par 
)
Double_t MuonResiduals6DOFrphiFitter_resslope_trackx_TF1 ( Double_t *  xvec,
Double_t *  par 
)
Double_t MuonResiduals6DOFrphiFitter_resslope_tracky_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Variable Documentation

Definition at line 12 of file MuonResiduals6DOFrphiFitter.cc.

Definition at line 11 of file MuonResiduals6DOFrphiFitter.cc.