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 
48 class Vx3DHLTAnalyzer : public one::DQMEDAnalyzer<one::DQMLuminosityBlockElements>
49 {
50 
51 
52  public:
54  ~Vx3DHLTAnalyzer () override;
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 
138 
141 
143 
144 
145  // ######################
146  // # Internal variables #
147  // ######################
148  std::ofstream outputFile;
149  std::ofstream outputDebugFile;
152  unsigned int runNumber;
153  unsigned int lumiCounter;
154  unsigned int totalHits;
155  unsigned int numberGoodFits;
156  unsigned int numberFits;
157  unsigned int beginLumiOfFit;
158  unsigned int endLumiOfFit;
159  unsigned int lastLumiOfFit;
160  unsigned int nParams;
162 
163  std::vector<VertexType> Vertices;
165  unsigned int counterVx; // Counts the number of vertices taken into account for the fit
166  double maxTransRadius; // Max transverse radius in which the vertices must be [cm]
167  double maxLongLength; // Max longitudinal length in which the vertices must be [cm]
168  double xPos,yPos,zPos; // x,y,z approximate positions of the beam spot
169  double pi;
170 };
171 
172 #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:224
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
MonitorElement * Vx_Z_Fit
unsigned int lastLumiOfFit
std::ofstream outputFile
#define DIM
MonitorElement * Vx_XY_Cum
~Vx3DHLTAnalyzer() override
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void printFitParams(const std::vector< double > &fitResults)
unsigned int runNumber
MonitorElement * Vx_X_Fit
MonitorElement * Vx_Z_Cum
unsigned int nLumiFit
MonitorElement * hitCounter
Definition: Run.h:45
MonitorElement * Vx_Y_Fit
MonitorElement * Vx_Y