test
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 <TText.h>
34 
35 #include <iostream>
36 #include <fstream>
37 #include <vector>
38 
39 
40 // #################
41 // # Fit variables #
42 // #################
43 #define DIM 3
44 typedef struct
45 {
46  double x;
47  double y;
48  double z;
49  double Covariance[DIM][DIM];
50 } VertexType;
51 
52 
54 {
55 
56 
57  public:
60 
61  protected:
62  double Gauss3DFunc(const double* par);
63 
64  private:
65  void analyze (const edm::Event& iEvent, const edm::EventSetup& iSetup);
66  void beginLuminosityBlock (const edm::LuminosityBlock& lumiBlock, const edm::EventSetup& iSetup);
67  void endLuminosityBlock (const edm::LuminosityBlock& lumiBlock, const edm::EventSetup& iSetup);
68  void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
69 
70  unsigned int HitCounter (const edm::Event& iEvent);
71  std::string formatTime (const time_t& t);
72  int MyFit (std::vector<double>* vals);
73  void reset (std::string ResetType);
74  void writeToFile (std::vector<double>* vals,
75  edm::TimeValue_t BeginTimeOfFit,
76  edm::TimeValue_t EndTimeOfFit,
77  unsigned int BeginLumiOfFit,
78  unsigned int EndLumiOfFit,
79  int dataType);
80  void printFitParams (const std::vector<double>& fitResults);
81 
82 
83  // #######################
84  // # cfg file parameters #
85  // #######################
88  bool debugMode;
90  unsigned int nLumiFit;
91  unsigned int maxLumiIntegration;
92  unsigned int nLumiXaxisRange;
93  unsigned int minNentries;
94  double xRange;
95  double xStep;
96  double yRange;
97  double yStep;
98  double zRange;
99  double zStep;
100  double VxErrCorr; // Coefficient to compensate the under-estimation of the vertex errors
101  double minVxDoF;
102  double minVxWgt;
104 
105 
106  // ##############
107  // # Histograms #
108  // ##############
112 
116 
119 
123 
127 
131 
135 
139 
142 
144 
145 
146  // ######################
147  // # Internal variables #
148  // ######################
149  std::ofstream outputFile;
150  std::ofstream outputDebugFile;
153  unsigned int runNumber;
154  unsigned int lumiCounter;
155  unsigned int totalHits;
156  unsigned int numberGoodFits;
157  unsigned int numberFits;
158  unsigned int beginLumiOfFit;
159  unsigned int endLumiOfFit;
160  unsigned int lastLumiOfFit;
161  unsigned int nParams;
163 
164  std::vector<VertexType> Vertices;
166  unsigned int counterVx; // Counts the number of vertices taken into account for the fit
167  double maxTransRadius; // Max transverse radius in which the vertices must be [cm]
168  double maxLongLength; // Max longitudinal length in which the vertices must be [cm]
169  double xPos,yPos,zPos; // x,y,z approximate positions of the beam spot
170  double pi;
171 };
172 
173 #endif
unsigned int lumiCounter
MonitorElement * statusCounter
MonitorElement * dxdzlumi
MonitorElement * Vx_ZX
unsigned int totalHits
unsigned int maxLumiIntegration
unsigned int numberFits
MonitorElement * Vx_Y_Cum
edm::EDGetTokenT< reco::VertexCollection > vertexCollection
unsigned int nLumiXaxisRange
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
double Gauss3DFunc(const double *par)
void writeToFile(std::vector< double > *vals, edm::TimeValue_t BeginTimeOfFit, edm::TimeValue_t EndTimeOfFit, unsigned int BeginLumiOfFit, unsigned int EndLumiOfFit, int dataType)
unsigned int nParams
MonitorElement * Vx_XY
MonitorElement * sZlumi
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
unsigned int counterVx
std::string fileName
std::string formatTime(const time_t &t)
unsigned int endLumiOfFit
unsigned int numberGoodFits
MonitorElement * reportSummary
MonitorElement * Vx_ZY_Cum
MonitorElement * goodVxCounter
std::ofstream outputDebugFile
MonitorElement * dydzlumi
MonitorElement * Vx_ZX_Cum
MonitorElement * Vx_Z
MonitorElement * mXlumi
void reset(std::string ResetType)
unsigned long long TimeValue_t
Definition: Timestamp.h:28
MonitorElement * Vx_X_Cum
void beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
std::vector< VertexType > Vertices
MonitorElement * mZlumi
MonitorElement * sXlumi
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
unsigned int lastLumiOfFit
std::ofstream outputFile
#define DIM
MonitorElement * Vx_XY_Cum
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void printFitParams(const std::vector< double > &fitResults)
unsigned int runNumber
MonitorElement * Vx_Z_Cum
unsigned int nLumiFit
MonitorElement * hitCounter
Definition: Run.h:43
MonitorElement * Vx_Y