CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
Vx3DHLTAnalyzer.cc File Reference
#include "DQM/BeamMonitor/plugins/Vx3DHLTAnalyzer.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include <TFitterMinuit.h>

Go to the source code of this file.

Functions

 DEFINE_FWK_MODULE (Vx3DHLTAnalyzer)
 
void Gauss3DFunc (int &, double *, double &fval, double *par, int)
 

Function Documentation

DEFINE_FWK_MODULE ( Vx3DHLTAnalyzer  )
void Gauss3DFunc ( int &  ,
double *  ,
double &  fval,
double *  par,
int   
)

Definition at line 177 of file Vx3DHLTAnalyzer.cc.

References considerVxCovariance, counterVx, DIM, i, create_public_lumi_plots::log, maxLongLength, maxTransRadius, pi, mathSSE::sqrt(), Vertices, VxErrCorr, x, xPos, detailsBasic3DVector::y, yPos, detailsBasic3DVector::z, and zPos.

Referenced by Vx3DHLTAnalyzer::MyFit().

178 {
179  double K[DIM][DIM]; // Covariance Matrix
180  double M[DIM][DIM]; // K^-1
181  double det;
182  double sumlog = 0.;
183 
184 // par[0] = K(0,0) --> Var[X]
185 // par[1] = K(1,1) --> Var[Y]
186 // par[2] = K(2,2) --> Var[Z]
187 // par[3] = K(0,1) = K(1,0) --> Cov[X,Y]
188 // par[4] = K(1,2) = K(2,1) --> Cov[Y,Z] --> dy/dz
189 // par[5] = K(0,2) = K(2,0) --> Cov[X,Z] --> dx/dz
190 // par[6] = mean x
191 // par[7] = mean y
192 // par[8] = mean z
193 
194  counterVx = 0;
195  for (unsigned int i = 0; i < Vertices.size(); i++)
196  {
198  (std::fabs(Vertices[i].z-zPos) <= maxLongLength))
199  {
200  if (considerVxCovariance == true)
201  {
202  K[0][0] = std::fabs(par[0]) + VxErrCorr*VxErrCorr * std::fabs(Vertices[i].Covariance[0][0]);
203  K[1][1] = std::fabs(par[1]) + VxErrCorr*VxErrCorr * std::fabs(Vertices[i].Covariance[1][1]);
204  K[2][2] = std::fabs(par[2]) + VxErrCorr*VxErrCorr * std::fabs(Vertices[i].Covariance[2][2]);
205  K[0][1] = K[1][0] = par[3] + VxErrCorr*VxErrCorr * Vertices[i].Covariance[0][1];
206  K[1][2] = K[2][1] = par[4]*(std::fabs(par[2])-std::fabs(par[1])) - par[5]*par[3] + VxErrCorr*VxErrCorr * Vertices[i].Covariance[1][2];
207  K[0][2] = K[2][0] = par[5]*(std::fabs(par[2])-std::fabs(par[0])) - par[4]*par[3] + VxErrCorr*VxErrCorr * Vertices[i].Covariance[0][2];
208  }
209  else
210  {
211  K[0][0] = std::fabs(par[0]);
212  K[1][1] = std::fabs(par[1]);
213  K[2][2] = std::fabs(par[2]);
214  K[0][1] = K[1][0] = par[3];
215  K[1][2] = K[2][1] = par[4]*(std::fabs(par[2])-std::fabs(par[1])) - par[5]*par[3];
216  K[0][2] = K[2][0] = par[5]*(std::fabs(par[2])-std::fabs(par[0])) - par[4]*par[3];
217  }
218 
219  det = K[0][0]*(K[1][1]*K[2][2] - K[1][2]*K[1][2]) -
220  K[0][1]*(K[0][1]*K[2][2] - K[0][2]*K[1][2]) +
221  K[0][2]*(K[0][1]*K[1][2] - K[0][2]*K[1][1]);
222 
223  M[0][0] = (K[1][1]*K[2][2] - K[1][2]*K[1][2]) / det;
224  M[1][1] = (K[0][0]*K[2][2] - K[0][2]*K[0][2]) / det;
225  M[2][2] = (K[0][0]*K[1][1] - K[0][1]*K[0][1]) / det;
226  M[0][1] = M[1][0] = (K[0][2]*K[1][2] - K[0][1]*K[2][2]) / det;
227  M[1][2] = M[2][1] = (K[0][2]*K[0][1] - K[1][2]*K[0][0]) / det;
228  M[0][2] = M[2][0] = (K[0][1]*K[1][2] - K[0][2]*K[1][1]) / det;
229 
230  sumlog += double(DIM)*std::log(2.*pi) + std::log(std::fabs(det)) +
231  (M[0][0]*(Vertices[i].x-par[6])*(Vertices[i].x-par[6]) +
232  M[1][1]*(Vertices[i].y-par[7])*(Vertices[i].y-par[7]) +
233  M[2][2]*(Vertices[i].z-par[8])*(Vertices[i].z-par[8]) +
234  2.*M[0][1]*(Vertices[i].x-par[6])*(Vertices[i].y-par[7]) +
235  2.*M[1][2]*(Vertices[i].y-par[7])*(Vertices[i].z-par[8]) +
236  2.*M[0][2]*(Vertices[i].x-par[6])*(Vertices[i].z-par[8]));
237 
238  counterVx++;
239  }
240  }
241 
242  fval = sumlog;
243 }
int i
Definition: DBlmapReader.cc:9
double maxLongLength
double zPos
double double double z
double maxTransRadius
bool considerVxCovariance
double xPos
T sqrt(T t)
Definition: SSEVec.h:46
double yPos
#define DIM
std::vector< VertexType > Vertices
unsigned int counterVx
double pi
double VxErrCorr
Definition: DDAxes.h:10