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 "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
 
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 168 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().

169 {
170  double K[DIM][DIM]; // Covariance Matrix
171  double M[DIM][DIM]; // K^-1
172  double det;
173  double sumlog = 0.;
174 
175 // par[0] = K(0,0) --> Var[X]
176 // par[1] = K(1,1) --> Var[Y]
177 // par[2] = K(2,2) --> Var[Z]
178 // par[3] = K(0,1) = K(1,0) --> Cov[X,Y]
179 // par[4] = K(1,2) = K(2,1) --> Cov[Y,Z] --> dy/dz
180 // par[5] = K(0,2) = K(2,0) --> Cov[X,Z] --> dx/dz
181 // par[6] = mean x
182 // par[7] = mean y
183 // par[8] = mean z
184 
185  counterVx = 0;
186  for (unsigned int i = 0; i < Vertices.size(); i++)
187  {
189  (std::fabs(Vertices[i].z-zPos) <= maxLongLength))
190  {
191  if (considerVxCovariance == true)
192  {
193  K[0][0] = std::fabs(par[0]) + VxErrCorr*VxErrCorr * std::fabs(Vertices[i].Covariance[0][0]);
194  K[1][1] = std::fabs(par[1]) + VxErrCorr*VxErrCorr * std::fabs(Vertices[i].Covariance[1][1]);
195  K[2][2] = std::fabs(par[2]) + VxErrCorr*VxErrCorr * std::fabs(Vertices[i].Covariance[2][2]);
196  K[0][1] = K[1][0] = par[3] + VxErrCorr*VxErrCorr * Vertices[i].Covariance[0][1];
197  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];
198  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];
199  }
200  else
201  {
202  K[0][0] = std::fabs(par[0]);
203  K[1][1] = std::fabs(par[1]);
204  K[2][2] = std::fabs(par[2]);
205  K[0][1] = K[1][0] = par[3];
206  K[1][2] = K[2][1] = par[4]*(std::fabs(par[2])-std::fabs(par[1])) - par[5]*par[3];
207  K[0][2] = K[2][0] = par[5]*(std::fabs(par[2])-std::fabs(par[0])) - par[4]*par[3];
208  }
209 
210  det = K[0][0]*(K[1][1]*K[2][2] - K[1][2]*K[1][2]) -
211  K[0][1]*(K[0][1]*K[2][2] - K[0][2]*K[1][2]) +
212  K[0][2]*(K[0][1]*K[1][2] - K[0][2]*K[1][1]);
213 
214  M[0][0] = (K[1][1]*K[2][2] - K[1][2]*K[1][2]) / det;
215  M[1][1] = (K[0][0]*K[2][2] - K[0][2]*K[0][2]) / det;
216  M[2][2] = (K[0][0]*K[1][1] - K[0][1]*K[0][1]) / det;
217  M[0][1] = M[1][0] = (K[0][2]*K[1][2] - K[0][1]*K[2][2]) / det;
218  M[1][2] = M[2][1] = (K[0][2]*K[0][1] - K[1][2]*K[0][0]) / det;
219  M[0][2] = M[2][0] = (K[0][1]*K[1][2] - K[0][2]*K[1][1]) / det;
220 
221  sumlog += double(DIM)*std::log(2.*pi) + std::log(std::fabs(det)) +
222  (M[0][0]*(Vertices[i].x-par[6])*(Vertices[i].x-par[6]) +
223  M[1][1]*(Vertices[i].y-par[7])*(Vertices[i].y-par[7]) +
224  M[2][2]*(Vertices[i].z-par[8])*(Vertices[i].z-par[8]) +
225  2.*M[0][1]*(Vertices[i].x-par[6])*(Vertices[i].y-par[7]) +
226  2.*M[1][2]*(Vertices[i].y-par[7])*(Vertices[i].z-par[8]) +
227  2.*M[0][2]*(Vertices[i].x-par[6])*(Vertices[i].z-par[8]));
228 
229  counterVx++;
230  }
231  }
232 
233  return sumlog;
234 }
int i
Definition: DBlmapReader.cc:9
double maxLongLength
double zPos
vector< VertexType > Vertices
float float float z
const Double_t pi
double maxTransRadius
bool considerVxCovariance
T x() const
Cartesian x coordinate.
double xPos
T sqrt(T t)
Definition: SSEVec.h:48
double yPos
#define DIM
unsigned int counterVx
double VxErrCorr

Variable Documentation

bool considerVxCovariance

Definition at line 63 of file Vx3DHLTAnalyzer.h.

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

unsigned int counterVx
double maxLongLength

Definition at line 66 of file Vx3DHLTAnalyzer.h.

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

double maxTransRadius

Definition at line 65 of file Vx3DHLTAnalyzer.h.

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

double pi

Definition at line 68 of file Vx3DHLTAnalyzer.h.

vector<VertexType> Vertices

Definition at line 62 of file Vx3DHLTAnalyzer.h.

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

double VxErrCorr

Definition at line 72 of file Vx3DHLTAnalyzer.h.

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

double xPos
double yPos
double zPos