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 #include <memory>
14 
17 
20 
24 
25 #include <TText.h>
26 
27 #include <iostream>
28 #include <fstream>
29 #include <vector>
30 
31 // #################
32 // # Fit variables #
33 // #################
34 #define DIM 3
35 typedef struct {
36  double x;
37  double y;
38  double z;
39  double Covariance[DIM][DIM];
40 } VertexType;
41 
43 public:
45  ~Vx3DHLTAnalyzer() override;
46 
47 protected:
48  double Gauss3DFunc(const double* par);
49 
50 private:
51  void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override;
52  void dqmBeginLuminosityBlock(const edm::LuminosityBlock& lumiBlock, const edm::EventSetup& iSetup) override;
53  void dqmEndLuminosityBlock(const edm::LuminosityBlock& lumiBlock, const edm::EventSetup& iSetup) override;
54  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
55 
56  unsigned int HitCounter(const edm::Event& iEvent);
57  std::string formatTime(const time_t& t);
58  int MyFit(std::vector<double>* vals);
59  void reset(std::string ResetType);
60  void writeToFile(std::vector<double>* vals,
61  edm::TimeValue_t BeginTimeOfFit,
62  edm::TimeValue_t EndTimeOfFit,
63  unsigned int BeginLumiOfFit,
64  unsigned int EndLumiOfFit,
65  int dataType);
66  void printFitParams(const std::vector<double>& fitResults);
67 
68  // #######################
69  // # cfg file parameters #
70  // #######################
73  bool debugMode;
75  unsigned int nLumiFit;
76  unsigned int maxLumiIntegration;
77  unsigned int nLumiXaxisRange;
78  unsigned int minNentries;
79  double xRange;
80  double xStep;
81  double yRange;
82  double yStep;
83  double zRange;
84  double zStep;
85  double VxErrCorr; // Coefficient to compensate the under-estimation of the vertex errors
86  double minVxDoF;
87  double minVxWgt;
89 
90  // ##############
91  // # Histograms #
92  // ##############
96 
100 
103 
107 
111 
115 
119 
123 
127 
130 
132 
133  // ######################
134  // # Internal variables #
135  // ######################
136  std::ofstream outputFile;
137  std::ofstream outputDebugFile;
140  unsigned int runNumber;
141  unsigned int lumiCounter;
142  unsigned int totalHits;
143  unsigned int numberGoodFits;
144  unsigned int numberFits;
145  unsigned int beginLumiOfFit;
146  unsigned int endLumiOfFit;
147  unsigned int lastLumiOfFit;
148  unsigned int nParams;
150 
151  std::vector<VertexType> Vertices;
153  unsigned int counterVx; // Counts the number of vertices taken into account for the fit
154  double maxTransRadius; // Max transverse radius in which the vertices must be [cm]
155  double maxLongLength; // Max longitudinal length in which the vertices must be [cm]
156  double xPos, yPos, zPos; // x,y,z approximate positions of the beam spot
157  double pi;
158 };
159 
160 #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 dqmBeginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override
MonitorElement * Vx_X
void dqmEndLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override
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
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