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 
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
Vx3DHLTAnalyzer::numberFits
unsigned int numberFits
Definition: Vx3DHLTAnalyzer.h:145
Vx3DHLTAnalyzer::Vx_Y
MonitorElement * Vx_Y
Definition: Vx3DHLTAnalyzer.h:106
Vx3DHLTAnalyzer::mXlumi
MonitorElement * mXlumi
Definition: Vx3DHLTAnalyzer.h:94
VertexType::x
double x
Definition: Vx3DHLTAnalyzer.h:37
Vx3DHLTAnalyzer::dataFromFit
bool dataFromFit
Definition: Vx3DHLTAnalyzer.h:75
Vx3DHLTAnalyzer::Vx_X_Fit
MonitorElement * Vx_X_Fit
Definition: Vx3DHLTAnalyzer.h:113
DIM
#define DIM
Definition: Vx3DHLTAnalyzer.h:35
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
Vx3DHLTAnalyzer::HitCounter
unsigned int HitCounter(const edm::Event &iEvent)
Definition: Vx3DHLTAnalyzer.cc:182
Vx3DHLTAnalyzer::maxTransRadius
double maxTransRadius
Definition: Vx3DHLTAnalyzer.h:155
Vx3DHLTAnalyzer::sYlumi
MonitorElement * sYlumi
Definition: Vx3DHLTAnalyzer.h:99
edm::Run
Definition: Run.h:45
edm::EDGetTokenT< reco::VertexCollection >
Vx3DHLTAnalyzer::Vx_Z_Cum
MonitorElement * Vx_Z_Cum
Definition: Vx3DHLTAnalyzer.h:119
Vx3DHLTAnalyzer::lumiCounter
unsigned int lumiCounter
Definition: Vx3DHLTAnalyzer.h:142
Vx3DHLTAnalyzer::Vx_X
MonitorElement * Vx_X
Definition: Vx3DHLTAnalyzer.h:105
Vx3DHLTAnalyzer::mYlumi
MonitorElement * mYlumi
Definition: Vx3DHLTAnalyzer.h:95
Vx3DHLTAnalyzer::goodVxCounter
MonitorElement * goodVxCounter
Definition: Vx3DHLTAnalyzer.h:125
DQMStore.h
Vx3DHLTAnalyzer::maxLongLength
double maxLongLength
Definition: Vx3DHLTAnalyzer.h:156
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
Vx3DHLTAnalyzer::~Vx3DHLTAnalyzer
~Vx3DHLTAnalyzer() override
Definition: Vx3DHLTAnalyzer.cc:76
EDAnalyzer.h
Vx3DHLTAnalyzer::fitResults
MonitorElement * fitResults
Definition: Vx3DHLTAnalyzer.h:132
Vx3DHLTAnalyzer::Vertices
std::vector< VertexType > Vertices
Definition: Vx3DHLTAnalyzer.h:152
Vx3DHLTAnalyzer::beginLumiOfFit
unsigned int beginLumiOfFit
Definition: Vx3DHLTAnalyzer.h:146
Vx3DHLTAnalyzer::MyFit
int MyFit(std::vector< double > *vals)
Definition: Vx3DHLTAnalyzer.cc:268
Vx3DHLTAnalyzer::dydzlumi
MonitorElement * dydzlumi
Definition: Vx3DHLTAnalyzer.h:103
Vx3DHLTAnalyzer::xStep
double xStep
Definition: Vx3DHLTAnalyzer.h:81
DTskim_cfg.dataType
dataType
Definition: DTskim_cfg.py:56
Vx3DHLTAnalyzer::dqmBeginLuminosityBlock
void dqmBeginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override
Definition: Vx3DHLTAnalyzer.cc:925
Vx3DHLTAnalyzer::formatTime
std::string formatTime(const time_t &t)
Definition: Vx3DHLTAnalyzer.cc:195
Vx3DHLTAnalyzer::lastLumiOfFit
unsigned int lastLumiOfFit
Definition: Vx3DHLTAnalyzer.h:148
Vx3DHLTAnalyzer::statusCounter
MonitorElement * statusCounter
Definition: Vx3DHLTAnalyzer.h:127
DQMOneEDAnalyzer.h
Vx3DHLTAnalyzer::runNumber
unsigned int runNumber
Definition: Vx3DHLTAnalyzer.h:141
Vx3DHLTAnalyzer::yStep
double yStep
Definition: Vx3DHLTAnalyzer.h:83
Vx3DHLTAnalyzer::Vx_XY_Cum
MonitorElement * Vx_XY_Cum
Definition: Vx3DHLTAnalyzer.h:123
MakerMacros.h
Vx3DHLTAnalyzer::Vx_ZY
MonitorElement * Vx_ZY
Definition: Vx3DHLTAnalyzer.h:110
Vx3DHLTAnalyzer::outputDebugFile
std::ofstream outputDebugFile
Definition: Vx3DHLTAnalyzer.h:138
Vx3DHLTAnalyzer::zStep
double zStep
Definition: Vx3DHLTAnalyzer.h:85
Vx3DHLTAnalyzer::maxLumiIntegration
unsigned int maxLumiIntegration
Definition: Vx3DHLTAnalyzer.h:77
Vx3DHLTAnalyzer::Vx_Z
MonitorElement * Vx_Z
Definition: Vx3DHLTAnalyzer.h:107
Vx3DHLTAnalyzer::reset
void reset(std::string ResetType)
Definition: Vx3DHLTAnalyzer.cc:671
Vx3DHLTAnalyzer::writeToFile
void writeToFile(std::vector< double > *vals, edm::TimeValue_t BeginTimeOfFit, edm::TimeValue_t EndTimeOfFit, unsigned int BeginLumiOfFit, unsigned int EndLumiOfFit, int dataType)
Definition: Vx3DHLTAnalyzer.cc:781
Vx3DHLTAnalyzer::nLumiFit
unsigned int nLumiFit
Definition: Vx3DHLTAnalyzer.h:76
Vx3DHLTAnalyzer::Vx3DHLTAnalyzer
Vx3DHLTAnalyzer(const edm::ParameterSet &)
Definition: Vx3DHLTAnalyzer.cc:25
Vx3DHLTAnalyzer::considerVxCovariance
bool considerVxCovariance
Definition: Vx3DHLTAnalyzer.h:153
Vx3DHLTAnalyzer::sXlumi
MonitorElement * sXlumi
Definition: Vx3DHLTAnalyzer.h:98
VertexType::y
double y
Definition: Vx3DHLTAnalyzer.h:38
Vx3DHLTAnalyzer::nParams
unsigned int nParams
Definition: Vx3DHLTAnalyzer.h:149
SiPixelRecHitCollection.h
edm::ParameterSet
Definition: ParameterSet.h:47
reco::btag::Vertices::VertexType
VertexType
Definition: VertexTypes.h:18
Vx3DHLTAnalyzer::zRange
double zRange
Definition: Vx3DHLTAnalyzer.h:84
Vx3DHLTAnalyzer::minNentries
unsigned int minNentries
Definition: Vx3DHLTAnalyzer.h:79
Event.h
DQMOneLumiEDAnalyzer
Definition: DQMOneEDAnalyzer.h:90
Vx3DHLTAnalyzer::yRange
double yRange
Definition: Vx3DHLTAnalyzer.h:82
Vx3DHLTAnalyzer::minVxWgt
double minVxWgt
Definition: Vx3DHLTAnalyzer.h:88
Vx3DHLTAnalyzer::reportSummary
MonitorElement * reportSummary
Definition: Vx3DHLTAnalyzer.h:129
Vx3DHLTAnalyzer::debugMode
bool debugMode
Definition: Vx3DHLTAnalyzer.h:74
Vx3DHLTAnalyzer::hitCounter
MonitorElement * hitCounter
Definition: Vx3DHLTAnalyzer.h:126
Vx3DHLTAnalyzer::Vx_ZX_Cum
MonitorElement * Vx_ZX_Cum
Definition: Vx3DHLTAnalyzer.h:121
iEvent
int iEvent
Definition: GenABIO.cc:224
Vx3DHLTAnalyzer
Definition: Vx3DHLTAnalyzer.h:43
Vx3DHLTAnalyzer::Vx_Y_Cum
MonitorElement * Vx_Y_Cum
Definition: Vx3DHLTAnalyzer.h:118
Vx3DHLTAnalyzer::vertexCollection
edm::EDGetTokenT< reco::VertexCollection > vertexCollection
Definition: Vx3DHLTAnalyzer.h:72
Vx3DHLTAnalyzer::nLumiXaxisRange
unsigned int nLumiXaxisRange
Definition: Vx3DHLTAnalyzer.h:78
Vx3DHLTAnalyzer::endTimeOfFit
edm::TimeValue_t endTimeOfFit
Definition: Vx3DHLTAnalyzer.h:140
Vx3DHLTAnalyzer::yPos
double yPos
Definition: Vx3DHLTAnalyzer.h:157
edm::EventSetup
Definition: EventSetup.h:58
Vx3DHLTAnalyzer::sZlumi
MonitorElement * sZlumi
Definition: Vx3DHLTAnalyzer.h:100
Vx3DHLTAnalyzer::pi
double pi
Definition: Vx3DHLTAnalyzer.h:158
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Vx3DHLTAnalyzer::xRange
double xRange
Definition: Vx3DHLTAnalyzer.h:80
Vx3DHLTAnalyzer::Vx_XY
MonitorElement * Vx_XY
Definition: Vx3DHLTAnalyzer.h:111
Vx3DHLTAnalyzer::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override
Definition: Vx3DHLTAnalyzer.cc:937
Vx3DHLTAnalyzer::xPos
double xPos
Definition: Vx3DHLTAnalyzer.h:157
VertexFwd.h
Vx3DHLTAnalyzer::fileName
std::string fileName
Definition: Vx3DHLTAnalyzer.h:89
Vx3DHLTAnalyzer::Vx_X_Cum
MonitorElement * Vx_X_Cum
Definition: Vx3DHLTAnalyzer.h:117
Vx3DHLTAnalyzer::pixelHitCollection
edm::EDGetTokenT< SiPixelRecHitCollection > pixelHitCollection
Definition: Vx3DHLTAnalyzer.h:73
Vx3DHLTAnalyzer::Vx_Z_Fit
MonitorElement * Vx_Z_Fit
Definition: Vx3DHLTAnalyzer.h:115
Vx3DHLTAnalyzer::VxErrCorr
double VxErrCorr
Definition: Vx3DHLTAnalyzer.h:86
Vertex.h
Vx3DHLTAnalyzer::minVxDoF
double minVxDoF
Definition: Vx3DHLTAnalyzer.h:87
Vx3DHLTAnalyzer::reportSummaryMap
MonitorElement * reportSummaryMap
Definition: Vx3DHLTAnalyzer.h:130
Vx3DHLTAnalyzer::endLumiOfFit
unsigned int endLumiOfFit
Definition: Vx3DHLTAnalyzer.h:147
Vx3DHLTAnalyzer::Gauss3DFunc
double Gauss3DFunc(const double *par)
Definition: Vx3DHLTAnalyzer.cc:204
Covariance
Definition: Histograms.h:1877
Vx3DHLTAnalyzer::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: Vx3DHLTAnalyzer.cc:1317
Vx3DHLTAnalyzer::outputFile
std::ofstream outputFile
Definition: Vx3DHLTAnalyzer.h:137
dqm::implementation::IBooker
Definition: DQMStore.h:43
Vx3DHLTAnalyzer::internalDebug
bool internalDebug
Definition: Vx3DHLTAnalyzer.h:150
Vx3DHLTAnalyzer::beginTimeOfFit
edm::TimeValue_t beginTimeOfFit
Definition: Vx3DHLTAnalyzer.h:139
Vx3DHLTAnalyzer::Vx_Y_Fit
MonitorElement * Vx_Y_Fit
Definition: Vx3DHLTAnalyzer.h:114
Vx3DHLTAnalyzer::counterVx
unsigned int counterVx
Definition: Vx3DHLTAnalyzer.h:154
edm::Event
Definition: Event.h:73
Vx3DHLTAnalyzer::Vx_ZX
MonitorElement * Vx_ZX
Definition: Vx3DHLTAnalyzer.h:109
Vx3DHLTAnalyzer::analyze
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: Vx3DHLTAnalyzer.cc:78
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
Vx3DHLTAnalyzer::printFitParams
void printFitParams(const std::vector< double > &fitResults)
Definition: Vx3DHLTAnalyzer.cc:913
Vx3DHLTAnalyzer::numberGoodFits
unsigned int numberGoodFits
Definition: Vx3DHLTAnalyzer.h:144
Vx3DHLTAnalyzer::mZlumi
MonitorElement * mZlumi
Definition: Vx3DHLTAnalyzer.h:96
edm::TimeValue_t
unsigned long long TimeValue_t
Definition: Timestamp.h:28
VertexType::z
double z
Definition: Vx3DHLTAnalyzer.h:39
Vx3DHLTAnalyzer::dxdzlumi
MonitorElement * dxdzlumi
Definition: Vx3DHLTAnalyzer.h:102
Vx3DHLTAnalyzer::zPos
double zPos
Definition: Vx3DHLTAnalyzer.h:157
Vx3DHLTAnalyzer::Vx_ZY_Cum
MonitorElement * Vx_ZY_Cum
Definition: Vx3DHLTAnalyzer.h:122
Vx3DHLTAnalyzer::totalHits
unsigned int totalHits
Definition: Vx3DHLTAnalyzer.h:143