CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Vx3DHLTAnalyzer.h
Go to the documentation of this file.
1 #ifndef Vx3DHLTAnalyzer_H
2 #define Vx3DHLTAnalyzer_H
3 
4 // -*- C++ -*-
5 // Package: Vx3DHLTAnalyzer
6 // Class: Vx3DHLTAnalyzer
7 
8 /*
9  Class Vx3DHLTAnalyzer Vx3DHLTAnalyzer.cc plugins/Vx3DHLTAnalyzer.cc
10 
11  Description: beam-spot monitor entirely based on pixel detector information
12  Implementation: the monitoring is based on a 3D fit to the vertex cloud
13 */
14 
15 // Original Author: Mauro Dinardo, 28 S-012, +41-22-767-8302
16 // Created: Tue Feb 23 13:15:31 CET 2010
17 
18 
19 #include <memory>
20 
24 
28 
32 
33 #include <TF3.h>
34 
35 #include <iostream>
36 #include <fstream>
37 #include <vector>
38 
39 
40 // #################
41 // # Fit variables #
42 // #################
43 #define DIM 3
44 double Gauss3DFunc(const double* par);
45 typedef struct
46 {
47  double x;
48  double y;
49  double z;
50  double Covariance[DIM][DIM];
51 } VertexType;
52 std::vector<VertexType> Vertices;
54 unsigned int counterVx; // Counts the number of vertices taken into account for the fit
55 double maxTransRadius; // Max transverse radius in which the vertices must be [cm]
56 double maxLongLength; // Max longitudinal length in which the vertices must be [cm]
57 double xPos,yPos,zPos; // x,y,z approximate positions of the beam spot
58 double pi;
59 // ######################
60 // # cfg file parameter #
61 // ######################
62 double VxErrCorr; // Coefficient to compensate the under-estimation of the vertex errors
63 
64 
66 {
67 
68 
69  public:
72 
73 
74  private:
75  void analyze (const edm::Event& iEvent, const edm::EventSetup& iSetup);
76  void beginLuminosityBlock (const edm::LuminosityBlock& lumiBlock, const edm::EventSetup& iSetup);
77  void endLuminosityBlock (const edm::LuminosityBlock& lumiBlock, const edm::EventSetup& iSetup);
78  void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
79 
80  unsigned int HitCounter (const edm::Event& iEvent);
81  std::string formatTime (const time_t& t);
82  int MyFit (std::vector<double>* vals);
83  void reset (std::string ResetType);
84  void writeToFile (std::vector<double>* vals,
85  edm::TimeValue_t BeginTimeOfFit,
86  edm::TimeValue_t EndTimeOfFit,
87  unsigned int BeginLumiOfFit,
88  unsigned int EndLumiOfFit,
89  int dataType);
90  void printFitParams (const std::vector<double>& fitResults);
91 
92 
93  // #######################
94  // # cfg file parameters #
95  // #######################
98  bool debugMode;
100  unsigned int nLumiFit;
101  unsigned int maxLumiIntegration;
102  unsigned int nLumiXaxisRange;
103  unsigned int minNentries;
104  double xRange;
105  double xStep;
106  double yRange;
107  double yStep;
108  double zRange;
109  double zStep;
110  double minVxDoF;
111  double minVxWgt;
113 
114 
115  // ##############
116  // # Histograms #
117  // ##############
121 
125 
128 
132 
136 
140 
143 
145 
146 
147  // ######################
148  // # Internal variables #
149  // ######################
150  std::ofstream outputFile;
151  std::ofstream outputDebugFile;
154  unsigned int runNumber;
155  unsigned int lumiCounter;
156  unsigned int totalHits;
157  unsigned int numberGoodFits;
158  unsigned int numberFits;
159  unsigned int beginLumiOfFit;
160  unsigned int endLumiOfFit;
161  unsigned int lastLumiOfFit;
162  unsigned int nParams;
164 };
165 
166 #endif
unsigned int lumiCounter
tuple t
Definition: tree.py:139
MonitorElement * statusCounter
MonitorElement * dxdzlumi
MonitorElement * Vx_ZX
unsigned int totalHits
double maxLongLength
unsigned int maxLumiIntegration
unsigned int numberFits
edm::EDGetTokenT< reco::VertexCollection > vertexCollection
unsigned int nLumiXaxisRange
double zPos
unsigned int beginLumiOfFit
int MyFit(std::vector< double > *vals)
unsigned int minNentries
MonitorElement * Vx_X
edm::EDGetTokenT< SiPixelRecHitCollection > pixelHitCollection
MonitorElement * mYlumi
edm::TimeValue_t beginTimeOfFit
edm::TimeValue_t endTimeOfFit
MonitorElement * sYlumi
unsigned int HitCounter(const edm::Event &iEvent)
MonitorElement * reportSummaryMap
void writeToFile(std::vector< double > *vals, edm::TimeValue_t BeginTimeOfFit, edm::TimeValue_t EndTimeOfFit, unsigned int BeginLumiOfFit, unsigned int EndLumiOfFit, int dataType)
const Double_t pi
double maxTransRadius
unsigned int nParams
MonitorElement * Vx_XY
MonitorElement * sZlumi
double Gauss3DFunc(const double *par)
bool considerVxCovariance
double xPos
void endLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
MonitorElement * fitResults
Vx3DHLTAnalyzer(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:230
MonitorElement * Vx_ZY
std::string fileName
std::string formatTime(const time_t &t)
unsigned int endLumiOfFit
unsigned int numberGoodFits
MonitorElement * reportSummary
MonitorElement * goodVxCounter
std::ofstream outputDebugFile
MonitorElement * dydzlumi
double yPos
MonitorElement * Vx_Z
MonitorElement * mXlumi
void reset(std::string ResetType)
unsigned long long TimeValue_t
Definition: Timestamp.h:28
void beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
MonitorElement * mZlumi
MonitorElement * sXlumi
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
unsigned int lastLumiOfFit
std::ofstream outputFile
#define DIM
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void printFitParams(const std::vector< double > &fitResults)
unsigned int runNumber
std::vector< VertexType > Vertices
unsigned int counterVx
double VxErrCorr
unsigned int nLumiFit
MonitorElement * hitCounter
Definition: Run.h:43
MonitorElement * Vx_Y