CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PrimaryVertexValidation.h
Go to the documentation of this file.
1 #ifndef PrimaryVertexValidation_h
2 #define PrimaryVertexValidation_h
3 
4 // system include files
5 #include <string>
6 #include <sstream>
7 #include <vector>
8 #include <map>
9 
10 // ROOT Included
11 #include "TFile.h"
12 #include "TH1D.h"
13 #include "TH1I.h"
14 #include "TH2D.h"
15 #include "TTree.h"
16 
17 // CMSSW includes
55 
56 //
57 // class decleration
58 //
59 
60 class PrimaryVertexValidation : public edm::one::EDAnalyzer<edm::one::SharedResources> {
61 
62  public:
65 
66  private:
67  virtual void beginJob();
68  virtual void analyze(const edm::Event&, const edm::EventSetup&);
69  virtual void endJob();
70  bool isHit2D(const TrackingRecHit &hit) const;
72  std::pair<Double_t,Double_t> getMedian(TH1F *histo);
73  std::pair<Double_t,Double_t> getMAD(TH1F *histo);
74  std::pair<std::pair<Double_t,Double_t>, std::pair<Double_t,Double_t> > fitResiduals(TH1 *hist);
75  void fillTrendPlot(TH1F* trendPlot, TH1F *residualsPlot[100], TString fitPar_, TString var_);
76  static bool vtxSort( const reco::Vertex & a, const reco::Vertex & b );
77  bool passesTrackCuts(const reco::Track & track, const reco::Vertex & vertex,std::string qualityString_, double dxyErrMax_,double dzErrMax_, double ptErrMax_);
78  std::map<std::string, TH1*> bookVertexHistograms(TFileDirectory dir);
79  void fillTrackHistos(std::map<std::string, TH1*> & h, const std::string & ttype, const reco::TransientTrack *tt, const reco::Vertex & v,const reco::BeamSpot & beamSpot, double fBfield);
80  void add(std::map<std::string, TH1*>& h, TH1* hist);
81  void fill(std::map<std::string, TH1*>& h, std::string s, double x);
82  void fill(std::map<std::string, TH1*>& h, std::string s, double x, double y);
83  void fillMap(TH2F* trendMap, TH1F* residualsMapPlot[100][100], TString fitPar_);
84 
85  inline double square(double x){
86  return x*x;
87  }
88 
89  // ----------member data ---------------------------
91  int Nevt_;
92 
95 
96  // setting of the number of plots
97  static const int nMaxBins_ = 100; // maximum number of bookable histograms
98 
99  // Output
101  bool lightNtupleSwitch_; // switch to keep only info for daily validation
103 
104  // requirements on the vertex
105  double vertexZMax_;
106 
107  // requirements on the probe
108  bool askFirstLayerHit_; // ask hit in the first layer of pixels
109  double ptOfProbe_;
110  double etaOfProbe_;
111  int nBins_; // actual number of histograms
112  std::vector<unsigned int> runControlNumbers_;
113 
114  bool debug_;
116 
120 
121  TTree* rootTree_;
122 
123  // Root-Tuple variables :
124  //=======================
125  void SetVarToZero();
126 
127  static const int nMaxtracks_ = 1000;
128  static const int cmToum = 10000;
129 
130  float phiSect_;
131  float etaSect_;
132 
133  // event-related quantities
134  int nTracks_;
136  int nClus_;
138  unsigned int RunNumber_;
139  unsigned int EventNumber_;
144 
148 
149  double BSx0_;
150  double BSy0_;
151  double BSz0_;
152  double Beamsigmaz_;
153  double Beamdxdz_;
154  double BeamWidthX_;
155  double BeamWidthY_;
156  double wxy2_;
157 
158  // track-related quantities
159  double pt_[nMaxtracks_];
160  double p_[nMaxtracks_];
171  double eta_[nMaxtracks_];
173  double phi_[nMaxtracks_];
178  double dz_[nMaxtracks_];
179  double dxy_[nMaxtracks_];
180  double dxyBs_[nMaxtracks_];
181  double dzBs_[nMaxtracks_];
194 
198 
202 
206 
209 
210  // ---- directly histograms // ===> unbiased residuals
211 
212  // absolute residuals
213 
216 
219 
222 
225 
228 
231 
232  // normalized residuals
233 
236 
239 
242 
245 
248 
251 
252  // for the maps
253 
257 
261 
262  // ---- trends as function of phi
263 
268 
273 
278 
283 
284  // ---- medians and MAD
285 
290 
295 
300 
305 
306  // 2D residuals
307 
308  TH2F* a_dxyVsPhi;
309  TH2F* a_dzVsPhi;
310 
311  TH2F* n_dxyVsPhi;
312  TH2F* n_dzVsPhi;
313 
314  TH2F* a_dxyVsEta;
315  TH2F* a_dzVsEta;
316 
317  TH2F* n_dxyVsEta;
318  TH2F* n_dzVsEta;
319 
320  // 2D maps
321 
323  TH2F* a_dzMeanMap;
324 
326  TH2F* n_dzMeanMap;
327 
330 
333 
334  // ---- directly histograms =================> biased residuals
335 
336  // absolute residuals
337 
340 
343 
344  // normalized BiasResiduals
345 
348 
351 
352  // for the maps
353 
356 
359 
360  // ---- trends as function of phi
361 
366 
371 
376 
381 
382  // ---- medians and MAD
383 
388 
393 
398 
403 
404  // 2D maps
405 
408 
411 
414 
417 
418  // check event
419  TH1F* h_nTracks;
420  TH1F* h_nClus;
422  TH1F* h_runNumber;
429  TH1F* h_BSx0;
430  TH1F* h_BSy0;
431  TH1F* h_BSz0;
432  TH1F* h_Beamsigmaz;
434  TH1F* h_BeamWidthY;
435 
436  // check probe
437 
440 
441  TH1F* h_probeP_;
442  TH1F* h_probePt_;
443  TH1F* h_probeEta_;
444  TH1F* h_probePhi_;
449 
452 
455 
458 
462 
470 
471  TH1F* h_probeHits_;
480 
481  // check vertex
482 
490 
495 
496  std::map<std::string, TH1*> hDA;
497 
498 };
499 
500 #endif
TH1F * n_dzResidualsMap[nMaxBins_][nMaxBins_]
TH1F * a_IP3DEtaResiduals[nMaxBins_]
std::vector< unsigned int > runControlNumbers_
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
static bool vtxSort(const reco::Vertex &a, const reco::Vertex &b)
TH1F * n_IP2DPhiResiduals[nMaxBins_]
TrackFilterForPVFindingBase * theTrackFilter_
TH1F * a_dxyResidualsMap[nMaxBins_][nMaxBins_]
std::map< std::string, TH1 * > hDA
TH1F * n_dxyEtaBiasResiduals[nMaxBins_]
PrimaryVertexValidation(const edm::ParameterSet &)
std::pair< Double_t, Double_t > getMAD(TH1F *histo)
TH1F * n_dxyBiasResidualsMap[nMaxBins_][nMaxBins_]
float DOFUnbiasedVertex_[nMaxtracks_]
TH1F * a_dzPhiBiasResiduals[nMaxBins_]
bool passesTrackCuts(const reco::Track &track, const reco::Vertex &vertex, std::string qualityString_, double dxyErrMax_, double dzErrMax_, double ptErrMax_)
double d3DFromMyVertex_[nMaxtracks_]
TH1F * n_dzEtaBiasResiduals[nMaxBins_]
virtual void analyze(const edm::Event &, const edm::EventSetup &)
float chi2ProbUnbiasedVertex_[nMaxtracks_]
double dxyFromMyVertex_[nMaxtracks_]
double dzErrorFromMyVertex_[nMaxtracks_]
void fillTrackHistos(std::map< std::string, TH1 * > &h, const std::string &ttype, const reco::TransientTrack *tt, const reco::Vertex &v, const reco::BeamSpot &beamSpot, double fBfield)
TH1F * a_dxyPhiBiasResiduals[nMaxBins_]
double IPTsigFromMyVertex_[nMaxtracks_]
std::pair< Double_t, Double_t > getMedian(TH1F *histo)
void fillMap(TH2F *trendMap, TH1F *residualsMapPlot[100][100], TString fitPar_)
TH1F * a_IP2DEtaResiduals[nMaxBins_]
int tracksUsedForVertexing_[nMaxtracks_]
TH1F * n_IP2DEtaResiduals[nMaxBins_]
bool hasFirstLayerPixelHits(const reco::TransientTrack track)
TH1F * n_reszEtaResiduals[nMaxBins_]
TH1F * n_dzPhiBiasResiduals[nMaxBins_]
double yUnbiasedVertex_[nMaxtracks_]
std::pair< std::pair< Double_t, Double_t >, std::pair< Double_t, Double_t > > fitResiduals(TH1 *hist)
TH1F * n_IP3DEtaResiduals[nMaxBins_]
double zUnbiasedVertex_[nMaxtracks_]
TH1F * a_reszPhiResiduals[nMaxBins_]
float chi2normUnbiasedVertex_[nMaxtracks_]
TH1F * n_d3DResidualsMap[nMaxBins_][nMaxBins_]
edm::EDGetTokenT< reco::VertexCollection > theVertexCollectionToken
TH1F * a_d3DResidualsMap[nMaxBins_][nMaxBins_]
double IPLsigFromMyVertex_[nMaxtracks_]
TH1F * a_IP2DPhiResiduals[nMaxBins_]
bool isHit2D(const TrackingRecHit &hit) const
TH1F * n_dxyPhiBiasResiduals[nMaxBins_]
TrackClusterizerInZ * theTrackClusterizer_
double b
Definition: hdecay.h:120
double xUnbiasedVertex_[nMaxtracks_]
TH1F * a_dxyEtaBiasResiduals[nMaxBins_]
edm::EDGetTokenT< reco::BeamSpot > theBeamspotToken
edm::EDGetTokenT< reco::TrackCollection > theTrackCollectionToken
double dzFromMyVertex_[nMaxtracks_]
TH1F * n_IP3DPhiResiduals[nMaxBins_]
double a
Definition: hdecay.h:121
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
void fill(std::map< std::string, TH1 * > &h, std::string s, double x)
TH1F * a_reszEtaResiduals[nMaxBins_]
TH1F * a_dxyBiasResidualsMap[nMaxBins_][nMaxBins_]
TH1F * a_IP3DPhiResiduals[nMaxBins_]
TH1F * n_dxyResidualsMap[nMaxBins_][nMaxBins_]
double dxyErrorFromMyVertex_[nMaxtracks_]
dbl *** dir
Definition: mlp_gen.cc:35
TH1F * n_reszPhiResiduals[nMaxBins_]
float sumOfWeightsUnbiasedVertex_[nMaxtracks_]
TH1F * n_dzBiasResidualsMap[nMaxBins_][nMaxBins_]
double d3DErrorFromMyVertex_[nMaxtracks_]
TH1F * a_dzBiasResidualsMap[nMaxBins_][nMaxBins_]
TH1F * a_dzEtaBiasResiduals[nMaxBins_]
void fillTrendPlot(TH1F *trendPlot, TH1F *residualsPlot[100], TString fitPar_, TString var_)
TH1F * a_dzResidualsMap[nMaxBins_][nMaxBins_]
float chi2UnbiasedVertex_[nMaxtracks_]
std::map< std::string, TH1 * > bookVertexHistograms(TFileDirectory dir)
double IP3DsigFromMyVertex_[nMaxtracks_]