CMS 3D CMS Logo

Vx3DHLTAnalyzer.h
Go to the documentation of this file.
1 #ifndef Vx3DHLTAnalyzer_H
2 #define Vx3DHLTAnalyzer_H
3 
4 /*
5  \File Vx3DHLTAnalyzer.h
6  \Display Beam-spot monitor entirely based on pixel detector information
7  the monitoring is based on a 3D fit to the vertex cloud
8  \Author Mauro Dinardo
9  \Version $ Revision: 3.5 $
10  \Date $ Date: 2010/23/02 13:15:00 $
11 */
12 
13 
14 #include <memory>
15 
19 
23 
27 
28 #include <TText.h>
29 
30 #include <iostream>
31 #include <fstream>
32 #include <vector>
33 
34 
35 // #################
36 // # Fit variables #
37 // #################
38 #define DIM 3
39 typedef struct
40 {
41  double x;
42  double y;
43  double z;
44  double Covariance[DIM][DIM];
45 } VertexType;
46 
47 
49 {
50 
51 
52  public:
55 
56  protected:
57  double Gauss3DFunc(const double* par);
58 
59  private:
60  void analyze (const edm::Event& iEvent, const edm::EventSetup& iSetup) override;
61  void beginLuminosityBlock (const edm::LuminosityBlock& lumiBlock, const edm::EventSetup& iSetup) override;
62  void endLuminosityBlock (const edm::LuminosityBlock& lumiBlock, const edm::EventSetup& iSetup) override;
63  void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
64 
65  unsigned int HitCounter (const edm::Event& iEvent);
66  std::string formatTime (const time_t& t);
67  int MyFit (std::vector<double>* vals);
68  void reset (std::string ResetType);
69  void writeToFile (std::vector<double>* vals,
70  edm::TimeValue_t BeginTimeOfFit,
71  edm::TimeValue_t EndTimeOfFit,
72  unsigned int BeginLumiOfFit,
73  unsigned int EndLumiOfFit,
74  int dataType);
75  void printFitParams (const std::vector<double>& fitResults);
76 
77 
78  // #######################
79  // # cfg file parameters #
80  // #######################
83  bool debugMode;
85  unsigned int nLumiFit;
86  unsigned int maxLumiIntegration;
87  unsigned int nLumiXaxisRange;
88  unsigned int minNentries;
89  double xRange;
90  double xStep;
91  double yRange;
92  double yStep;
93  double zRange;
94  double zStep;
95  double VxErrCorr; // Coefficient to compensate the under-estimation of the vertex errors
96  double minVxDoF;
97  double minVxWgt;
99 
100 
101  // ##############
102  // # Histograms #
103  // ##############
107 
111 
114 
118 
122 
126 
130 
134 
137 
139 
140 
141  // ######################
142  // # Internal variables #
143  // ######################
144  std::ofstream outputFile;
145  std::ofstream outputDebugFile;
148  unsigned int runNumber;
149  unsigned int lumiCounter;
150  unsigned int totalHits;
151  unsigned int numberGoodFits;
152  unsigned int numberFits;
153  unsigned int beginLumiOfFit;
154  unsigned int endLumiOfFit;
155  unsigned int lastLumiOfFit;
156  unsigned int nParams;
158 
159  std::vector<VertexType> Vertices;
161  unsigned int counterVx; // Counts the number of vertices taken into account for the fit
162  double maxTransRadius; // Max transverse radius in which the vertices must be [cm]
163  double maxLongLength; // Max longitudinal length in which the vertices must be [cm]
164  double xPos,yPos,zPos; // x,y,z approximate positions of the beam spot
165  double pi;
166 };
167 
168 #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)
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
unsigned int minNentries
void endLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override
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 beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override
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
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
std::vector< VertexType > Vertices
MonitorElement * mZlumi
MonitorElement * sXlumi
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:42
MonitorElement * Vx_Y