CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Macros | Functions | Variables
Vx3DHLTAnalyzer.h File Reference
#include <memory>
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/MonitorElement.h"
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include <TF3.h>
#include <iostream>
#include <fstream>
#include <vector>

Go to the source code of this file.

Classes

struct  VertexType
 
class  Vx3DHLTAnalyzer
 

Macros

#define DIM   3
 

Functions

double Gauss3DFunc (const double *par)
 

Variables

bool considerVxCovariance
 
unsigned int counterVx
 
double maxLongLength
 
double maxTransRadius
 
double pi
 
std::vector< VertexTypeVertices
 
double VxErrCorr
 
double xPos
 
double yPos
 
double zPos
 

Macro Definition Documentation

#define DIM   3

Function Documentation

double Gauss3DFunc ( const double *  par)

Definition at line 218 of file Vx3DHLTAnalyzer.cc.

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

Referenced by Vx3DHLTAnalyzer::MyFit().

219 {
220  double K[DIM][DIM]; // Covariance Matrix
221  double M[DIM][DIM]; // K^-1
222  double det;
223  double sumlog = 0.;
224 
225 // par[0] = K(0,0) --> Var[X]
226 // par[1] = K(1,1) --> Var[Y]
227 // par[2] = K(2,2) --> Var[Z]
228 // par[3] = K(0,1) = K(1,0) --> Cov[X,Y]
229 // par[4] = K(1,2) = K(2,1) --> Cov[Y,Z] --> dy/dz
230 // par[5] = K(0,2) = K(2,0) --> Cov[X,Z] --> dx/dz
231 // par[6] = mean x
232 // par[7] = mean y
233 // par[8] = mean z
234 
235  counterVx = 0;
236  for (unsigned int i = 0; i < Vertices.size(); i++)
237  {
239  (std::fabs(Vertices[i].z-zPos) <= maxLongLength))
240  {
241  if (considerVxCovariance == true)
242  {
243  K[0][0] = std::fabs(par[0]) + VxErrCorr*VxErrCorr * std::fabs(Vertices[i].Covariance[0][0]);
244  K[1][1] = std::fabs(par[1]) + VxErrCorr*VxErrCorr * std::fabs(Vertices[i].Covariance[1][1]);
245  K[2][2] = std::fabs(par[2]) + VxErrCorr*VxErrCorr * std::fabs(Vertices[i].Covariance[2][2]);
246  K[0][1] = K[1][0] = par[3] + VxErrCorr*VxErrCorr * Vertices[i].Covariance[0][1];
247  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];
248  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];
249  }
250  else
251  {
252  K[0][0] = std::fabs(par[0]);
253  K[1][1] = std::fabs(par[1]);
254  K[2][2] = std::fabs(par[2]);
255  K[0][1] = K[1][0] = par[3];
256  K[1][2] = K[2][1] = par[4]*(std::fabs(par[2])-std::fabs(par[1])) - par[5]*par[3];
257  K[0][2] = K[2][0] = par[5]*(std::fabs(par[2])-std::fabs(par[0])) - par[4]*par[3];
258  }
259 
260  det = K[0][0]*(K[1][1]*K[2][2] - K[1][2]*K[1][2]) -
261  K[0][1]*(K[0][1]*K[2][2] - K[0][2]*K[1][2]) +
262  K[0][2]*(K[0][1]*K[1][2] - K[0][2]*K[1][1]);
263 
264  M[0][0] = (K[1][1]*K[2][2] - K[1][2]*K[1][2]) / det;
265  M[1][1] = (K[0][0]*K[2][2] - K[0][2]*K[0][2]) / det;
266  M[2][2] = (K[0][0]*K[1][1] - K[0][1]*K[0][1]) / det;
267  M[0][1] = M[1][0] = (K[0][2]*K[1][2] - K[0][1]*K[2][2]) / det;
268  M[1][2] = M[2][1] = (K[0][2]*K[0][1] - K[1][2]*K[0][0]) / det;
269  M[0][2] = M[2][0] = (K[0][1]*K[1][2] - K[0][2]*K[1][1]) / det;
270 
271  sumlog += double(DIM)*std::log(2.*pi) + std::log(std::fabs(det)) +
272  (M[0][0]*(Vertices[i].x-par[6])*(Vertices[i].x-par[6]) +
273  M[1][1]*(Vertices[i].y-par[7])*(Vertices[i].y-par[7]) +
274  M[2][2]*(Vertices[i].z-par[8])*(Vertices[i].z-par[8]) +
275  2.*M[0][1]*(Vertices[i].x-par[6])*(Vertices[i].y-par[7]) +
276  2.*M[1][2]*(Vertices[i].y-par[7])*(Vertices[i].z-par[8]) +
277  2.*M[0][2]*(Vertices[i].x-par[6])*(Vertices[i].z-par[8]));
278 
279  counterVx++;
280  }
281  }
282 
283  return sumlog;
284 }
int i
Definition: DBlmapReader.cc:9
double maxLongLength
double zPos
float float float z
const Double_t pi
double maxTransRadius
bool considerVxCovariance
double xPos
T sqrt(T t)
Definition: SSEVec.h:48
double yPos
#define DIM
std::vector< VertexType > Vertices
unsigned int counterVx
double VxErrCorr
Definition: DDAxes.h:10
tuple log
Definition: cmsBatch.py:347

Variable Documentation

bool considerVxCovariance

Definition at line 53 of file Vx3DHLTAnalyzer.h.

Referenced by Gauss3DFunc(), and Vx3DHLTAnalyzer::Vx3DHLTAnalyzer().

unsigned int counterVx
double maxLongLength

Definition at line 56 of file Vx3DHLTAnalyzer.h.

Referenced by Gauss3DFunc(), and Vx3DHLTAnalyzer::MyFit().

double maxTransRadius

Definition at line 55 of file Vx3DHLTAnalyzer.h.

Referenced by Gauss3DFunc(), and Vx3DHLTAnalyzer::MyFit().

double pi

Definition at line 58 of file Vx3DHLTAnalyzer.h.

std::vector<VertexType> Vertices

Definition at line 52 of file Vx3DHLTAnalyzer.h.

Referenced by Vx3DHLTAnalyzer::analyze(), Gauss3DFunc(), and Vx3DHLTAnalyzer::reset().

double VxErrCorr

Definition at line 62 of file Vx3DHLTAnalyzer.h.

Referenced by Gauss3DFunc(), and Vx3DHLTAnalyzer::Vx3DHLTAnalyzer().

double xPos
double yPos
double zPos