CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
18 
21 
25 
26 #include <TText.h>
27 
28 #include <iostream>
29 #include <fstream>
30 #include <vector>
31 
32 // #################
33 // # Fit variables #
34 // #################
35 #define DIM 3
36 typedef struct {
37  double x;
38  double y;
39  double z;
40  double Covariance[DIM][DIM];
41 } VertexType;
42 
44 public:
46  ~Vx3DHLTAnalyzer() override;
47 
48 protected:
49  double Gauss3DFunc(const double* par);
50 
51 private:
52  void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override;
53  void dqmBeginLuminosityBlock(const edm::LuminosityBlock& lumiBlock, const edm::EventSetup& iSetup) override;
54  void dqmEndLuminosityBlock(const edm::LuminosityBlock& lumiBlock, const edm::EventSetup& iSetup) override;
55  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
56 
57  unsigned int HitCounter(const edm::Event& iEvent);
58  std::string formatTime(const time_t& t);
59  int MyFit(std::vector<double>* vals);
60  void reset(std::string ResetType);
61  void writeToFile(std::vector<double>* vals,
62  edm::TimeValue_t BeginTimeOfFit,
63  edm::TimeValue_t EndTimeOfFit,
64  unsigned int BeginLumiOfFit,
65  unsigned int EndLumiOfFit,
66  int dataType);
67  void printFitParams(const std::vector<double>& fitResults);
68 
69  // #######################
70  // # cfg file parameters #
71  // #######################
74  bool debugMode;
76  unsigned int nLumiFit;
77  unsigned int maxLumiIntegration;
78  unsigned int nLumiXaxisRange;
79  unsigned int minNentries;
80  double xRange;
81  double xStep;
82  double yRange;
83  double yStep;
84  double zRange;
85  double zStep;
86  double VxErrCorr; // Coefficient to compensate the under-estimation of the vertex errors
87  double minVxDoF;
88  double minVxWgt;
90 
91  // ##############
92  // # Histograms #
93  // ##############
97 
101 
104 
108 
112 
116 
120 
124 
128 
131 
133 
134  // ######################
135  // # Internal variables #
136  // ######################
137  std::ofstream outputFile;
138  std::ofstream outputDebugFile;
141  unsigned int runNumber;
142  unsigned int lumiCounter;
143  unsigned int totalHits;
144  unsigned int numberGoodFits;
145  unsigned int numberFits;
146  unsigned int beginLumiOfFit;
147  unsigned int endLumiOfFit;
148  unsigned int lastLumiOfFit;
149  unsigned int nParams;
151 
152  std::vector<VertexType> Vertices;
154  unsigned int counterVx; // Counts the number of vertices taken into account for the fit
155  double maxTransRadius; // Max transverse radius in which the vertices must be [cm]
156  double maxLongLength; // Max longitudinal length in which the vertices must be [cm]
157  double xPos, yPos, zPos; // x,y,z approximate positions of the beam spot
158  double pi;
159 };
160 
161 #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