CMS 3D CMS Logo

BSpdfsFcn.cc
Go to the documentation of this file.
1 
14 #include "TMath.h"
15 
16 #include <cmath>
17 #include <vector>
18 
19 //______________________________________________________________________
20 double BSpdfsFcn::PDFGauss_d(double z, double d, double sigmad, double phi, const std::vector<double>& parms) const {
21  //---------------------------------------------------------------------------
22  // PDF for d0 distribution. This PDF is a simple gaussian in the
23  // beam reference frame.
24  //---------------------------------------------------------------------------
25  double fsqrt2pi = sqrt(2. * TMath::Pi());
26 
27  double sig = sqrt(parms[fPar_SigmaBeam] * parms[fPar_SigmaBeam] + sigmad * sigmad);
28 
29  double dprime =
30  d - ((parms[fPar_X0] + z * parms[fPar_dxdz]) * sin(phi) - (parms[fPar_Y0] + z * parms[fPar_dydz]) * cos(phi));
31 
32  double result = (exp(-(dprime * dprime) / (2.0 * sig * sig))) / (sig * fsqrt2pi);
33 
34  return result;
35 }
36 
37 //______________________________________________________________________
39  double z, double d, double phi, double pt, const std::vector<double>& parms) const {
40  //---------------------------------------------------------------------------
41  // PDF for d0 distribution. This PDF is a simple gaussian in the
42  // beam reference frame. The IP resolution is parametrize by a linear
43  // function as a function of 1/pt.
44  //---------------------------------------------------------------------------
45  double fsqrt2pi = sqrt(2. * TMath::Pi());
46 
47  double sigmad = parms[fPar_c0] + parms[fPar_c1] / pt;
48 
49  double sig = sqrt(parms[fPar_SigmaBeam] * parms[fPar_SigmaBeam] + sigmad * sigmad);
50 
51  double dprime =
52  d - ((parms[fPar_X0] + z * parms[fPar_dxdz]) * sin(phi) - (parms[fPar_Y0] + z * parms[fPar_dydz]) * cos(phi));
53 
54  double result = (exp(-(dprime * dprime) / (2.0 * sig * sig))) / (sig * fsqrt2pi);
55 
56  return result;
57 }
58 
59 //______________________________________________________________________
60 double BSpdfsFcn::PDFGauss_z(double z, double sigmaz, const std::vector<double>& parms) const {
61  //---------------------------------------------------------------------------
62  // PDF for z-vertex distribution. This distribution
63  // is parametrized by a simple normalized gaussian distribution.
64  //---------------------------------------------------------------------------
65  double fsqrt2pi = sqrt(2. * TMath::Pi());
66 
67  double sig = sqrt(sigmaz * sigmaz + parms[fPar_SigmaZ] * parms[fPar_SigmaZ]);
68  //double sig = sqrt(sigmaz*sigmaz+parms[1]*parms[1]);
69  double result = (exp(-((z - parms[fPar_Z0]) * (z - parms[fPar_Z0])) / (2.0 * sig * sig))) / (sig * fsqrt2pi);
70  //double result = (exp(-((z-parms[0])*(z-parms[0]))/(2.0*sig*sig)))/(sig*fsqrt2pi);
71 
72  return result;
73 }
74 
75 //______________________________________________________________________
76 double BSpdfsFcn::operator()(const std::vector<double>& params) const {
77  double f = 0.0;
78 
79  //std::cout << "fusepdfs=" << fusepdfs << " params.size="<<params.size() << std::endl;
80 
81  std::vector<BSTrkParameters>::const_iterator iparam = fBSvector.begin();
82 
83  double pdf = 0;
84 
85  for (iparam = fBSvector.begin(); iparam != fBSvector.end(); ++iparam) {
86  if (fusepdfs == "PDFGauss_z") {
87  pdf = PDFGauss_z(iparam->z0(), iparam->sigz0(), params);
88  } else if (fusepdfs == "PDFGauss_d") {
89  pdf = PDFGauss_d(iparam->z0(), iparam->d0(), iparam->sigd0(), iparam->phi0(), params);
90  } else if (fusepdfs == "PDFGauss_d_resolution") {
91  pdf = PDFGauss_d_resolution(iparam->z0(), iparam->d0(), iparam->phi0(), iparam->pt(), params);
92  } else if (fusepdfs == "PDFGauss_d*PDFGauss_z") {
93  //std::cout << "pdf= " << pdf << std::endl;
94  pdf = PDFGauss_d(iparam->z0(), iparam->d0(), iparam->sigd0(), iparam->phi0(), params) *
95  PDFGauss_z(iparam->z0(), iparam->sigz0(), params);
96  } else if (fusepdfs == "PDFGauss_d_resolution*PDFGauss_z") {
97  pdf = PDFGauss_d_resolution(iparam->z0(), iparam->d0(), iparam->phi0(), iparam->pt(), params) *
98  PDFGauss_z(iparam->z0(), iparam->sigz0(), params);
99  }
100 
101  f = log(pdf) + f;
102  }
103 
104  f = -2.0 * f;
105  return f;
106 }
BSpdfsFcn::PDFGauss_z
double PDFGauss_z(double z, double sigmaz, const std::vector< double > &parms) const
Definition: BSpdfsFcn.cc:60
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
detailsBasic3DVector::z
float float float z
Definition: extBasic3DVector.h:14
BSpdfsFcn::fusepdfs
std::string fusepdfs
Definition: BSpdfsFcn.h:38
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
BSpdfsFcn::PDFGauss_d_resolution
double PDFGauss_d_resolution(double z, double d, double phi, double pt, const std::vector< double > &parms) const
Definition: BSpdfsFcn.cc:38
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
BSpdfsFcn::fPar_c0
static const int fPar_c0
Definition: BSpdfsFcn.h:48
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
BSpdfsFcn::fPar_dxdz
static const int fPar_dxdz
Definition: BSpdfsFcn.h:45
BSpdfsFcn::fPar_SigmaBeam
static const int fPar_SigmaBeam
Definition: BSpdfsFcn.h:47
PVValHelper::phi
Definition: PVValidationHelpers.h:69
BSpdfsFcn::fPar_Z0
static const int fPar_Z0
Definition: BSpdfsFcn.h:43
BSpdfsFcn::PDFGauss_d
double PDFGauss_d(double z, double d, double sigmad, double phi, const std::vector< double > &parms) const
Definition: BSpdfsFcn.cc:20
DDAxes::phi
BSpdfsFcn::fPar_dydz
static const int fPar_dydz
Definition: BSpdfsFcn.h:46
BSpdfsFcn::fPar_SigmaZ
static const int fPar_SigmaZ
Definition: BSpdfsFcn.h:44
BSpdfsFcn::fPar_c1
static const int fPar_c1
Definition: BSpdfsFcn.h:49
BSpdfsFcn.h
BSpdfsFcn::fBSvector
std::vector< BSTrkParameters > fBSvector
Definition: BSpdfsFcn.h:39
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
BSpdfsFcn::operator()
double operator()(const std::vector< double > &) const override
Definition: BSpdfsFcn.cc:76
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
ztail.d
d
Definition: ztail.py:151
mps_fire.result
result
Definition: mps_fire.py:311
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
BSpdfsFcn::fPar_X0
static const int fPar_X0
Definition: BSpdfsFcn.h:41
BSpdfsFcn::fPar_Y0
static const int fPar_Y0
Definition: BSpdfsFcn.h:42