CMS 3D CMS Logo

Functions | Variables
MuonResidualsFitter.cc File Reference
#include "Alignment/MuonAlignmentAlgorithms/interface/MuonResidualsFitter.h"
#include <fstream>
#include <set>
#include "TMath.h"
#include "TH1.h"
#include "TF1.h"
#include "TRobustEstimator.h"

Go to the source code of this file.

Functions

double MuonResidualsFitter_compute_log_convolution (double toversigma, double gammaoversigma, double max, double step, double power)
 
Double_t MuonResidualsFitter_GaussPowerTails_TF1 (Double_t *xvec, Double_t *par)
 
double MuonResidualsFitter_integrate_pureGaussian (double low, double high, double center, double sigma)
 
double MuonResidualsFitter_logGaussPowerTails (double residual, double center, double sigma)
 
double MuonResidualsFitter_logPowerLawTails (double residual, double center, double sigma, double gamma)
 
double MuonResidualsFitter_logPureGaussian (double residual, double center, double sigma)
 
double MuonResidualsFitter_logPureGaussian2D (double x, double y, double x0, double y0, double sx, double sy, double r)
 
double MuonResidualsFitter_logROOTVoigt (double residual, double center, double sigma, double gamma)
 
Double_t MuonResidualsFitter_powerLawTails_TF1 (Double_t *xvec, Double_t *par)
 
Double_t MuonResidualsFitter_pureGaussian_TF1 (Double_t *xvec, Double_t *par)
 
Double_t MuonResidualsFitter_ROOTVoigt_TF1 (Double_t *xvec, Double_t *par)
 

Variables

const double MuonResidualsFitter_gsbinsize = 0.01
 
double MuonResidualsFitter_lookup_table [MuonResidualsFitter_numgsbins][MuonResidualsFitter_numtsbins]
 
const int MuonResidualsFitter_numgsbins = 500
 
const int MuonResidualsFitter_numtsbins = 500
 
bool MuonResidualsFitter_table_initialized = false
 
static TMinuit * MuonResidualsFitter_TMinuit
 
const double MuonResidualsFitter_tsbinsize = 0.1
 

Function Documentation

◆ MuonResidualsFitter_compute_log_convolution()

double MuonResidualsFitter_compute_log_convolution ( double  toversigma,
double  gammaoversigma,
double  max,
double  step,
double  power 
)

Definition at line 54 of file MuonResidualsFitter.cc.

55  {
56  if (gammaoversigma == 0.)
57  return (-toversigma * toversigma / 2.) - log(sqrt(2 * M_PI));
58 
59  double sum = 0.;
60  double uplus = 0.;
61  double integrandplus_last = 0.;
62  double integrandminus_last = 0.;
63  for (double inc = 0.; uplus < max; inc += step) {
64  double uplus_last = uplus;
65  uplus = pow(inc, power);
66 
67  double integrandplus = exp(-pow(uplus - toversigma, 2) / 2.) / (uplus * uplus / gammaoversigma + gammaoversigma) /
68  M_PI / sqrt(2. * M_PI);
69  double integrandminus = exp(-pow(-uplus - toversigma, 2) / 2.) / (uplus * uplus / gammaoversigma + gammaoversigma) /
70  M_PI / sqrt(2. * M_PI);
71 
72  sum += integrandplus * (uplus - uplus_last);
73  sum += 0.5 * fabs(integrandplus_last - integrandplus) * (uplus - uplus_last);
74 
75  sum += integrandminus * (uplus - uplus_last);
76  sum += 0.5 * fabs(integrandminus_last - integrandminus) * (uplus - uplus_last);
77 
78  integrandplus_last = integrandplus;
79  integrandminus_last = integrandminus;
80  }
81  return log(sum);
82 }

References JetChargeProducer_cfi::exp, dqm-mbProfile::log, M_PI, SiStripPI::max, funct::pow(), and mathSSE::sqrt().

Referenced by MuonResidualsFitter::initialize_table().

◆ MuonResidualsFitter_GaussPowerTails_TF1()

Double_t MuonResidualsFitter_GaussPowerTails_TF1 ( Double_t *  xvec,
Double_t *  par 
)

◆ MuonResidualsFitter_integrate_pureGaussian()

double MuonResidualsFitter_integrate_pureGaussian ( double  low,
double  high,
double  center,
double  sigma 
)

Definition at line 146 of file MuonResidualsFitter.cc.

146  {
147  static const double isqr2 = 1. / sqrt(2.);
148  return (erf((high + center) * isqr2 / sigma) - erf((low + center) * isqr2 / sigma)) * exp(0.5 / sigma / sigma) * 0.5;
149 }

References JetChargeProducer_cfi::exp, LaserClient_cfi::high, LaserClient_cfi::low, and mathSSE::sqrt().

◆ MuonResidualsFitter_logGaussPowerTails()

double MuonResidualsFitter_logGaussPowerTails ( double  residual,
double  center,
double  sigma 
)

Definition at line 128 of file MuonResidualsFitter.cc.

128  {
129  double x = residual - center;
130  double s = fabs(sigma);
131  double m = 2. * s;
132  static const double e2 = exp(-2.), sqerf = sqrt(2. * M_PI) * erf(sqrt(2.));
133  double a = pow(m, 4) * e2;
134  double n = sqerf * s + 2. * a * pow(m, -3) / 3.;
135 
136  if (fabs(x) < m)
137  return -x * x / (2. * s * s) - log(n);
138  else
139  return log(a) - 4. * log(fabs(x)) - log(n);
140 }

References a, JetChargeProducer_cfi::exp, dqm-mbProfile::log, visualization-live-secondInstance_cfg::m, M_PI, dqmiodumpmetadata::n, funct::pow(), alignCSCRings::s, mathSSE::sqrt(), and genVertex_cff::x.

Referenced by MuonResiduals1DOFFitter_FCN(), MuonResiduals5DOFFitter_FCN(), MuonResiduals6DOFFitter_FCN(), MuonResiduals6DOFrphiFitter_FCN(), MuonResidualsAngleFitter_FCN(), MuonResidualsBfieldAngleFitter_FCN(), MuonResidualsFitter_GaussPowerTails_TF1(), and MuonResidualsPositionFitter_FCN().

◆ MuonResidualsFitter_logPowerLawTails()

double MuonResidualsFitter_logPowerLawTails ( double  residual,
double  center,
double  sigma,
double  gamma 
)

Definition at line 85 of file MuonResidualsFitter.cc.

85  {
86  sigma = fabs(sigma);
87  double gammaoversigma = fabs(gamma / sigma);
88  double toversigma = fabs((residual - center) / sigma);
89 
90  int gsbin0 = int(floor(gammaoversigma / MuonResidualsFitter_gsbinsize));
91  int gsbin1 = int(ceil(gammaoversigma / MuonResidualsFitter_gsbinsize));
92  int tsbin0 = int(floor(toversigma / MuonResidualsFitter_tsbinsize));
93  int tsbin1 = int(ceil(toversigma / MuonResidualsFitter_tsbinsize));
94 
95  bool gsisbad = (gsbin0 >= MuonResidualsFitter_numgsbins || gsbin1 >= MuonResidualsFitter_numgsbins);
96  bool tsisbad = (tsbin0 >= MuonResidualsFitter_numtsbins || tsbin1 >= MuonResidualsFitter_numtsbins);
97 
98  if (gsisbad || tsisbad) {
99  return log(gammaoversigma / M_PI) - log(toversigma * toversigma + gammaoversigma * gammaoversigma) - log(sigma);
100  } else {
101  double val00 = MuonResidualsFitter_lookup_table[gsbin0][tsbin0];
102  double val01 = MuonResidualsFitter_lookup_table[gsbin0][tsbin1];
103  double val10 = MuonResidualsFitter_lookup_table[gsbin1][tsbin0];
104  double val11 = MuonResidualsFitter_lookup_table[gsbin1][tsbin1];
105 
106  double val0 = val00 + ((toversigma / MuonResidualsFitter_tsbinsize) - tsbin0) * (val01 - val00);
107  double val1 = val10 + ((toversigma / MuonResidualsFitter_tsbinsize) - tsbin0) * (val11 - val10);
108 
109  double val = val0 + ((gammaoversigma / MuonResidualsFitter_gsbinsize) - gsbin0) * (val1 - val0);
110 
111  return val - log(sigma);
112  }
113 }

References reco::ceil(), CustomPhysics_cfi::gamma, createfilelist::int, dqm-mbProfile::log, M_PI, MuonResidualsFitter_gsbinsize, MuonResidualsFitter_lookup_table, MuonResidualsFitter_numgsbins, MuonResidualsFitter_numtsbins, MuonResidualsFitter_tsbinsize, and heppy_batch::val.

Referenced by MuonResiduals1DOFFitter_FCN(), MuonResiduals5DOFFitter_FCN(), MuonResiduals6DOFFitter_FCN(), MuonResiduals6DOFrphiFitter_FCN(), MuonResidualsAngleFitter_FCN(), MuonResidualsBfieldAngleFitter_FCN(), MuonResidualsFitter_powerLawTails_TF1(), and MuonResidualsPositionFitter_FCN().

◆ MuonResidualsFitter_logPureGaussian()

double MuonResidualsFitter_logPureGaussian ( double  residual,
double  center,
double  sigma 
)

Definition at line 31 of file MuonResidualsFitter.cc.

31  {
32  sigma = fabs(sigma);
33  static const double cgaus = 0.5 * log(2. * M_PI);
34  return (-pow(residual - center, 2) * 0.5 / sigma / sigma) - cgaus - log(sigma);
35 }

References dqm-mbProfile::log, M_PI, and funct::pow().

Referenced by MuonResiduals1DOFFitter_FCN(), MuonResiduals5DOFFitter_FCN(), MuonResiduals6DOFFitter_FCN(), MuonResiduals6DOFrphiFitter_FCN(), MuonResidualsAngleFitter_FCN(), MuonResidualsBfieldAngleFitter_FCN(), MuonResidualsFitter_pureGaussian_TF1(), and MuonResidualsPositionFitter_FCN().

◆ MuonResidualsFitter_logPureGaussian2D()

double MuonResidualsFitter_logPureGaussian2D ( double  x,
double  y,
double  x0,
double  y0,
double  sx,
double  sy,
double  r 
)

Definition at line 43 of file MuonResidualsFitter.cc.

43  {
44  sx = fabs(sx);
45  sy = fabs(sy);
46  static const double c2gaus = log(2. * M_PI);
47  double one_r2 = 1. - r * r;
48  double dx = x - x0;
49  double dy = y - y0;
50  return -0.5 / one_r2 * (pow(dx / sx, 2) + pow(dy / sy, 2) - 2. * r * dx / sx * dy / sy) - c2gaus -
51  log(sx * sy * sqrt(one_r2));
52 }

References PVValHelper::dx, PVValHelper::dy, dqm-mbProfile::log, M_PI, funct::pow(), alignCSCRings::r, mathSSE::sqrt(), fftjetcommon_cfi::sx, fftjetcommon_cfi::sy, genVertex_cff::x, and detailsBasic3DVector::y.

Referenced by MuonResiduals5DOFFitter_FCN(), MuonResiduals6DOFFitter_FCN(), and MuonResiduals6DOFrphiFitter_FCN().

◆ MuonResidualsFitter_logROOTVoigt()

double MuonResidualsFitter_logROOTVoigt ( double  residual,
double  center,
double  sigma,
double  gamma 
)

◆ MuonResidualsFitter_powerLawTails_TF1()

Double_t MuonResidualsFitter_powerLawTails_TF1 ( Double_t *  xvec,
Double_t *  par 
)

◆ MuonResidualsFitter_pureGaussian_TF1()

Double_t MuonResidualsFitter_pureGaussian_TF1 ( Double_t *  xvec,
Double_t *  par 
)

◆ MuonResidualsFitter_ROOTVoigt_TF1()

Double_t MuonResidualsFitter_ROOTVoigt_TF1 ( Double_t *  xvec,
Double_t *  par 
)

Variable Documentation

◆ MuonResidualsFitter_gsbinsize

const double MuonResidualsFitter_gsbinsize = 0.01

◆ MuonResidualsFitter_lookup_table

double MuonResidualsFitter_lookup_table[MuonResidualsFitter_numgsbins][MuonResidualsFitter_numtsbins]

◆ MuonResidualsFitter_numgsbins

const int MuonResidualsFitter_numgsbins = 500

◆ MuonResidualsFitter_numtsbins

const int MuonResidualsFitter_numtsbins = 500

◆ MuonResidualsFitter_table_initialized

bool MuonResidualsFitter_table_initialized = false

Definition at line 25 of file MuonResidualsFitter.cc.

Referenced by MuonResidualsFitter::initialize_table().

◆ MuonResidualsFitter_TMinuit

TMinuit* MuonResidualsFitter_TMinuit
static

Definition at line 28 of file MuonResidualsFitter.cc.

Referenced by MuonResidualsFitter::dofit().

◆ MuonResidualsFitter_tsbinsize

const double MuonResidualsFitter_tsbinsize = 0.1
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
step
step
Definition: StallMonitor.cc:94
CustomPhysics_cfi.gamma
gamma
Definition: CustomPhysics_cfi.py:17
MuonResidualsFitter_logGaussPowerTails
double MuonResidualsFitter_logGaussPowerTails(double residual, double center, double sigma)
Definition: MuonResidualsFitter.cc:128
MuonResidualsFitter_lookup_table
double MuonResidualsFitter_lookup_table[MuonResidualsFitter_numgsbins][MuonResidualsFitter_numtsbins]
Definition: MuonResidualsFitter.cc:26
alignCSCRings.s
s
Definition: alignCSCRings.py:92
reco::ceil
constexpr int32_t ceil(float num)
Definition: constexpr_cmath.h:7
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:79
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
MuonResidualsFitter_numgsbins
const int MuonResidualsFitter_numgsbins
Definition: MuonResidualsFitter.cc:22
a
double a
Definition: hdecay.h:119
MuonResidualsFitter_gsbinsize
const double MuonResidualsFitter_gsbinsize
Definition: MuonResidualsFitter.cc:20
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
createfilelist.int
int
Definition: createfilelist.py:10
fftjetcommon_cfi.sy
sy
Definition: fftjetcommon_cfi.py:203
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
MuonResidualsFitter_logPureGaussian
double MuonResidualsFitter_logPureGaussian(double residual, double center, double sigma)
Definition: MuonResidualsFitter.cc:31
PVValHelper::dy
Definition: PVValidationHelpers.h:50
MuonResidualsFitter_numtsbins
const int MuonResidualsFitter_numtsbins
Definition: MuonResidualsFitter.cc:23
alignCSCRings.r
r
Definition: alignCSCRings.py:93
LaserClient_cfi.high
high
Definition: LaserClient_cfi.py:50
heppy_batch.val
val
Definition: heppy_batch.py:351
genVertex_cff.x
x
Definition: genVertex_cff.py:13
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
MuonResidualsFitter_tsbinsize
const double MuonResidualsFitter_tsbinsize
Definition: MuonResidualsFitter.cc:21
MuonResidualsFitter_logPowerLawTails
double MuonResidualsFitter_logPowerLawTails(double residual, double center, double sigma, double gamma)
Definition: MuonResidualsFitter.cc:85
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
LaserClient_cfi.low
low
Definition: LaserClient_cfi.py:52
PVValHelper::dx
Definition: PVValidationHelpers.h:49
fftjetcommon_cfi.sx
sx
Definition: fftjetcommon_cfi.py:202