CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackAnalyzer.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Suchandra Dutta , Giorgia Mila
5  */
6 
14 
19 #include <string>
20 #include "TMath.h"
21 
23  : conf_( iConfig )
24  , doTrackerSpecific_ ( conf_.getParameter<bool>("doTrackerSpecific") )
25  , doAllPlots_ ( conf_.getParameter<bool>("doAllPlots") )
26  , doBSPlots_ ( conf_.getParameter<bool>("doBeamSpotPlots") )
27  , doPVPlots_ ( conf_.getParameter<bool>("doPrimaryVertexPlots") )
28  , doDCAPlots_ ( conf_.getParameter<bool>("doDCAPlots") )
29  , doGeneralPropertiesPlots_ ( conf_.getParameter<bool>("doGeneralPropertiesPlots") )
30  , doMeasurementStatePlots_ ( conf_.getParameter<bool>("doMeasurementStatePlots") )
31  , doHitPropertiesPlots_ ( conf_.getParameter<bool>("doHitPropertiesPlots") )
32  , doRecHitVsPhiVsEtaPerTrack_ ( conf_.getParameter<bool>("doRecHitVsPhiVsEtaPerTrack") )
33  , doLayersVsPhiVsEtaPerTrack_ ( conf_.getParameter<bool>("doLayersVsPhiVsEtaPerTrack") )
34  , doRecHitsPerTrackProfile_ ( conf_.getParameter<bool>("doRecHitsPerTrackProfile") )
35  , doThetaPlots_ ( conf_.getParameter<bool>("doThetaPlots") )
36  , doTrackPxPyPlots_ ( conf_.getParameter<bool>("doTrackPxPyPlots") )
37  , doDCAwrtPVPlots_ ( conf_.getParameter<bool>("doDCAwrtPVPlots") )
38  , doDCAwrt000Plots_ ( conf_.getParameter<bool>("doDCAwrt000Plots") )
39  , doLumiAnalysis_ ( conf_.getParameter<bool>("doLumiAnalysis") )
40  , doTestPlots_ ( conf_.getParameter<bool>("doTestPlots") )
41  , doHIPlots_ ( conf_.getParameter<bool>("doHIPlots") )
42  , doSIPPlots_ ( conf_.getParameter<bool>("doSIPPlots") )
43 {
44  initHistos();
45  TopFolder_ = conf_.getParameter<std::string>("FolderName");
46 
47 }
48 
50  : TrackAnalyzer(iConfig)
51 {
52  edm::InputTag bsSrc = conf_.getParameter<edm::InputTag>("beamSpot");
53  edm::InputTag primaryVertexInputTag = conf_.getParameter<edm::InputTag>("primaryVertex");
55  pvToken_ = iC.consumes<reco::VertexCollection>(primaryVertexInputTag);
56 }
57 
59 {
60  Chi2 = NULL;
61  Chi2Prob = NULL;
64  Chi2oNDF = NULL;
71 
75 
79 
81 
84 
87 
102  algorithm = NULL;
103  // TESTING
106 
107 // by Mia in order to deal w/ LS transitions
110 
112  //special Plots for HI DQM //SHOULD I ADD THE BOOL HERE??
114  LongDCASig = NULL;
115  TransDCASig = NULL;
116 
117 
118  // IP significance
119  sipDxyToBS = NULL;
120  sipDzToBS = NULL;
121  sip3dToPV = NULL;
122  sip2dToPV = NULL;
123  sipDxyToPV = NULL;
124  sipDzToPV = NULL;
125 
126 }
127 
129 {
130 }
131 
133 {
134 
136  bookHistosForBeamSpot(ibooker);
138 
139  // book tracker specific related histograms
140  // ---------------------------------------------------------------------------------//
142 
143  // book state related histograms
144  // ---------------------------------------------------------------------------------//
146 
147  std::string StateName = conf_.getParameter<std::string>("MeasurementState");
148 
149  if (StateName == "All") {
150  bookHistosForState("OuterSurface", ibooker);
151  bookHistosForState("InnerSurface", ibooker);
152  bookHistosForState("ImpactPoint" , ibooker);
153  } else if (
154  StateName != "OuterSurface" &&
155  StateName != "InnerSurface" &&
156  StateName != "ImpactPoint" &&
157  StateName != "default"
158  ) {
159  bookHistosForState("default", ibooker);
160 
161  } else {
162  bookHistosForState(StateName, ibooker);
163  }
164 
165  }
166 }
167 
169 
170  // parameters from the configuration
171  std::string QualName = conf_.getParameter<std::string>("Quality");
173  std::string MEBSFolderName = conf_.getParameter<std::string>("BSFolderName");
174 
175  // use the AlgoName and Quality Name
176  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
177 
178  // get binning from the configuration
179  int TKHitBin = conf_.getParameter<int>( "RecHitBin");
180  double TKHitMin = conf_.getParameter<double>("RecHitMin");
181  double TKHitMax = conf_.getParameter<double>("RecHitMax");
182 
183  int TKLostBin = conf_.getParameter<int>( "RecLostBin");
184  double TKLostMin = conf_.getParameter<double>("RecLostMin");
185  double TKLostMax = conf_.getParameter<double>("RecLostMax");
186 
187  int TKLayBin = conf_.getParameter<int>( "RecLayBin");
188  double TKLayMin = conf_.getParameter<double>("RecLayMin");
189  double TKLayMax = conf_.getParameter<double>("RecLayMax");
190 
191  int PhiBin = conf_.getParameter<int>( "PhiBin");
192  double PhiMin = conf_.getParameter<double>("PhiMin");
193  double PhiMax = conf_.getParameter<double>("PhiMax");
194 
195  int EtaBin = conf_.getParameter<int>( "EtaBin");
196  double EtaMin = conf_.getParameter<double>("EtaMin");
197  double EtaMax = conf_.getParameter<double>("EtaMax");
198 
199  int VXBin = conf_.getParameter<int>( "VXBin");
200  double VXMin = conf_.getParameter<double>("VXMin");
201  double VXMax = conf_.getParameter<double>("VXMax");
202 
203  int VYBin = conf_.getParameter<int>( "VYBin");
204  double VYMin = conf_.getParameter<double>("VYMin");
205  double VYMax = conf_.getParameter<double>("VYMax");
206 
207  int VZBin = conf_.getParameter<int>( "VZBin");
208  double VZMin = conf_.getParameter<double>("VZMin");
209  double VZMax = conf_.getParameter<double>("VZMax");
210 
211  ibooker.setCurrentFolder(TopFolder_);
212 
213  // book the Hit Property histograms
214  // ---------------------------------------------------------------------------------//
215 
216  TkParameterMEs tkmes;
218 
219  ibooker.setCurrentFolder(TopFolder_+"/HitProperties");
220 
221  histname = "NumberOfRecHitsPerTrack_";
222  NumberOfRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax);
223  NumberOfRecHitsPerTrack->setAxisTitle("Number of all RecHits of each Track");
224  NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
225 
226  histname = "NumberOfValidRecHitsPerTrack_";
227  NumberOfValidRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax);
228  NumberOfValidRecHitsPerTrack->setAxisTitle("Number of valid RecHits for each Track");
229  NumberOfValidRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
230 
231  histname = "NumberOfLostRecHitsPerTrack_";
232  NumberOfLostRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKLostBin, TKLostMin, TKLostMax);
233  NumberOfLostRecHitsPerTrack->setAxisTitle("Number of lost RecHits for each Track");
234  NumberOfLostRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
235 
236  histname = "NumberOfLayersPerTrack_";
237  NumberOfLayersPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKLayBin, TKLayMin, TKLayMax);
238  NumberOfLayersPerTrack->setAxisTitle("Number of Layers of each Track", 1);
239  NumberOfLayersPerTrack->setAxisTitle("Number of Tracks", 2);
240 
241 
243 
244  histname = "NumberOfRecHitVsPhiVsEtaPerTrack_";
245  NumberOfRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
246  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 40., "");
249  }
250 
252 
253  histname = "NumberOfLayersVsPhiVsEtaPerTrack_";
254  NumberOfLayersVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
255  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 40., "");
258  }
259  }
260 
261  // book the General Property histograms
262  // ---------------------------------------------------------------------------------//
263 
265 
266  int Chi2Bin = conf_.getParameter<int>( "Chi2Bin");
267  double Chi2Min = conf_.getParameter<double>("Chi2Min");
268  double Chi2Max = conf_.getParameter<double>("Chi2Max");
269 
270  int Chi2NDFBin = conf_.getParameter<int>( "Chi2NDFBin");
271  double Chi2NDFMin = conf_.getParameter<double>("Chi2NDFMin");
272  double Chi2NDFMax = conf_.getParameter<double>("Chi2NDFMax");
273 
274  int Chi2ProbBin = conf_.getParameter<int>( "Chi2ProbBin");
275  double Chi2ProbMin = conf_.getParameter<double>("Chi2ProbMin");
276  double Chi2ProbMax = conf_.getParameter<double>("Chi2ProbMax");
277 
278 
279  //HI PLOTS////
280  int TransDCABins = conf_.getParameter<int>("TransDCABins");
281  double TransDCAMin = conf_.getParameter<double>("TransDCAMin");
282  double TransDCAMax = conf_.getParameter<double>("TransDCAMax");
283 
284  int LongDCABins = conf_.getParameter<int>("LongDCABins");
285  double LongDCAMin = conf_.getParameter<double>("LongDCAMin");
286  double LongDCAMax = conf_.getParameter<double>("LongDCAMax");
288 
289 
290  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
291 
292  histname = "Chi2_";
293  Chi2 = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2Bin, Chi2Min, Chi2Max);
294  Chi2->setAxisTitle("Track #chi^{2}" ,1);
295  Chi2->setAxisTitle("Number of Tracks",2);
296 
297  histname = "Chi2Prob_";
298  Chi2Prob = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2ProbBin, Chi2ProbMin, Chi2ProbMax);
299  Chi2Prob->setAxisTitle("Track #chi^{2} probability",1);
300  Chi2Prob->setAxisTitle("Number of Tracks" ,2);
301 
302  histname = "Chi2oNDF_";
303  Chi2oNDF = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax);
304  Chi2oNDF->setAxisTitle("Track #chi^{2}/ndf",1);
305  Chi2oNDF->setAxisTitle("Number of Tracks" ,2);
306 
307 
309  //HI PLOTS///
311  if (doHIPlots_)
312  {
313  histname = "LongDCASig_";
314  LongDCASig = ibooker.book1D(histname+CategoryName, histname+CategoryName,LongDCABins,LongDCAMin,LongDCAMax);
315  LongDCASig->setAxisTitle("dz/#sigma_{dz}",1);
316 
317  histname = "TransDCASig_";
318  TransDCASig = ibooker.book1D(histname+CategoryName,histname+CategoryName,TransDCABins,TransDCAMin,TransDCAMax);
319  TransDCASig->setAxisTitle("dxy/#sigma_{dxy}",1);
320  }
321 
322 
323 
324  if (doDCAPlots_) {
325  histname = "xPointOfClosestApproach_";
326  xPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VXBin, VXMin, VXMax);
327  xPointOfClosestApproach->setAxisTitle("x component of Track PCA to beam line (cm)",1);
328  xPointOfClosestApproach->setAxisTitle("Number of Tracks",2);
329 
330  histname = "yPointOfClosestApproach_";
331  yPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VYBin, VYMin, VYMax);
332  yPointOfClosestApproach->setAxisTitle("y component of Track PCA to beam line (cm)",1);
333  yPointOfClosestApproach->setAxisTitle("Number of Tracks",2);
334 
335  histname = "zPointOfClosestApproach_";
336  zPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VZBin, VZMin, VZMax);
337  zPointOfClosestApproach->setAxisTitle("z component of Track PCA to beam line (cm)",1);
338  zPointOfClosestApproach->setAxisTitle("Number of Tracks",2);
339 
340  histname = "xPointOfClosestApproachToPV_";
341  xPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VXBin, VXMin, VXMax);
342  xPointOfClosestApproachToPV->setAxisTitle("x component of Track PCA to pv (cm)",1);
343  xPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2);
344 
345  histname = "yPointOfClosestApproachToPV_";
346  yPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VYBin, VYMin, VYMax);
347  yPointOfClosestApproachToPV->setAxisTitle("y component of Track PCA to pv line (cm)",1);
348  yPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2);
349 
350  histname = "zPointOfClosestApproachToPV_";
351  zPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VZBin, VZMin, VZMax);
352  zPointOfClosestApproachToPV->setAxisTitle("z component of Track PCA to pv line (cm)",1);
353  zPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2);
354  }
355 
356  // See DataFormats/TrackReco/interface/TrackBase.h for track algorithm enum definition
357  // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/DataFormats/TrackReco/interface/TrackBase.h?view=log
358  histname = "algorithm_";
359  algorithm = ibooker.book1D(histname+CategoryName, histname+CategoryName, reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize));
360  algorithm->setAxisTitle("Tracking algorithm",1);
361  algorithm->setAxisTitle("Number of Tracks",2);
362  for (size_t ibin=0; ibin<reco::TrackBase::algoSize-1; ibin++)
364  }
365 
366 }
367 
369 
370  // parameters from the configuration
371  std::string QualName = conf_.getParameter<std::string>("Quality");
373 
374  // use the AlgoName and Quality Name
375  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
376 
377 
378  // book LS analysis related histograms
379  // -----------------------------------
380  if ( doLumiAnalysis_ ) {
381 
382  // get binning from the configuration
383  int TKHitBin = conf_.getParameter<int>( "RecHitBin");
384  double TKHitMin = conf_.getParameter<double>("RecHitMin");
385  double TKHitMax = conf_.getParameter<double>("RecHitMax");
386 
387  int Chi2NDFBin = conf_.getParameter<int>( "Chi2NDFBin");
388  double Chi2NDFMin = conf_.getParameter<double>("Chi2NDFMin");
389  double Chi2NDFMax = conf_.getParameter<double>("Chi2NDFMax");
390 
391  // add by Mia in order to deal w/ LS transitions
392  ibooker.setCurrentFolder(TopFolder_+"/LSanalysis");
393 
394  histname = "NumberOfRecHitsPerTrack_lumiFlag_";
395  NumberOfRecHitsPerTrack_lumiFlag = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax);
396  NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of all RecHits of each Track");
397  NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of Tracks", 2);
398 
399  histname = "Chi2oNDF_lumiFlag_";
400  Chi2oNDF_lumiFlag = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax);
401  Chi2oNDF_lumiFlag->setAxisTitle("Track #chi^{2}/ndf",1);
402  Chi2oNDF_lumiFlag->setAxisTitle("Number of Tracks" ,2);
403 
404  }
405 }
406 
408 
409  // parameters from the configuration
410  std::string QualName = conf_.getParameter<std::string>("Quality");
412 
413  // use the AlgoName and Quality Name
414  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
415 
416  // book the Beam Spot related histograms
417  // ---------------------------------------------------------------------------------//
418 
420 
421  int DxyBin = conf_.getParameter<int>( "DxyBin");
422  double DxyMin = conf_.getParameter<double>("DxyMin");
423  double DxyMax = conf_.getParameter<double>("DxyMax");
424 
425  int PhiBin = conf_.getParameter<int>( "PhiBin");
426  double PhiMin = conf_.getParameter<double>("PhiMin");
427  double PhiMax = conf_.getParameter<double>("PhiMax");
428 
429  int X0Bin = conf_.getParameter<int>( "X0Bin");
430  double X0Min = conf_.getParameter<double>("X0Min");
431  double X0Max = conf_.getParameter<double>("X0Max");
432 
433  int Y0Bin = conf_.getParameter<int>( "Y0Bin");
434  double Y0Min = conf_.getParameter<double>("Y0Min");
435  double Y0Max = conf_.getParameter<double>("Y0Max");
436 
437  int Z0Bin = conf_.getParameter<int>( "Z0Bin");
438  double Z0Min = conf_.getParameter<double>("Z0Min");
439  double Z0Max = conf_.getParameter<double>("Z0Max");
440 
441  int VZBinProf = conf_.getParameter<int>( "VZBinProf");
442  double VZMinProf = conf_.getParameter<double>("VZMinProf");
443  double VZMaxProf = conf_.getParameter<double>("VZMaxProf");
444 
445 
446  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
447 
448  histname = "DistanceOfClosestApproachToBS_";
449  DistanceOfClosestApproachToBS = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax);
450  DistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1);
451  DistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2);
452 
453  histname = "DistanceOfClosestApproachToBSVsPhi_";
454  DistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,"");
455  DistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes);
457  DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2);
458 
459  histname = "xPointOfClosestApproachVsZ0wrt000_";
460  xPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,"");
462  xPointOfClosestApproachVsZ0wrt000->setAxisTitle("x component of Track PCA to beam line (cm)",2);
463 
464  histname = "yPointOfClosestApproachVsZ0wrt000_";
465  yPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,"");
467  yPointOfClosestApproachVsZ0wrt000->setAxisTitle("y component of Track PCA to beam line (cm)",2);
468 
469  histname = "xPointOfClosestApproachVsZ0wrtBS_";
470  xPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,"");
471  xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1);
472  xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("x component of Track PCA to BS (cm)",2);
473 
474  histname = "yPointOfClosestApproachVsZ0wrtBS_";
475  yPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,"");
476  yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1);
477  yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("y component of Track PCA to BS (cm)",2);
478 
479  histname = "zPointOfClosestApproachVsPhi_";
480  zPointOfClosestApproachVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, VZBinProf, VZMinProf, VZMaxProf, "");
482  zPointOfClosestApproachVsPhi->setAxisTitle("y component of Track PCA to beam line (cm)",2);
483  }
484 
486 
487  int DxyBin = conf_.getParameter<int>( "DxyBin");
488  double DxyMin = conf_.getParameter<double>("DxyMin");
489  double DxyMax = conf_.getParameter<double>("DxyMax");
490 
491  int PhiBin = conf_.getParameter<int>( "PhiBin");
492  double PhiMin = conf_.getParameter<double>("PhiMin");
493  double PhiMax = conf_.getParameter<double>("PhiMax");
494 
495  int X0Bin = conf_.getParameter<int>( "X0Bin");
496  double X0Min = conf_.getParameter<double>("X0Min");
497  double X0Max = conf_.getParameter<double>("X0Max");
498 
499  int Y0Bin = conf_.getParameter<int>( "Y0Bin");
500  double Y0Min = conf_.getParameter<double>("Y0Min");
501  double Y0Max = conf_.getParameter<double>("Y0Max");
502 
503  int Z0Bin = conf_.getParameter<int>( "Z0Bin");
504  double Z0Min = conf_.getParameter<double>("Z0Min");
505  double Z0Max = conf_.getParameter<double>("Z0Max");
506 
507  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
508 
509  histname = "DistanceOfClosestApproachToPV_";
510  DistanceOfClosestApproachToPV = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax);
511  DistanceOfClosestApproachToPV->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1);
512  DistanceOfClosestApproachToPV->setAxisTitle("Number of Tracks",2);
513 
514  histname = "DistanceOfClosestApproachToPVVsPhi_";
515  DistanceOfClosestApproachToPVVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,"");
516  DistanceOfClosestApproachToPVVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes);
518  DistanceOfClosestApproachToPVVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2);
519 
520  histname = "xPointOfClosestApproachVsZ0wrtPV_";
521  xPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,"");
522  xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1);
523  xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("x component of Track PCA to PV (cm)",2);
524 
525  histname = "yPointOfClosestApproachVsZ0wrtPV_";
526  yPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,"");
527  yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1);
528  yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("y component of Track PCA to PV (cm)",2);
529 
530  }
531 
532  if (doBSPlots_ || doAllPlots_) {
533  if (doTestPlots_) {
534 
535  int DxyBin = conf_.getParameter<int>( "DxyBin");
536  double DxyMin = conf_.getParameter<double>("DxyMin");
537  double DxyMax = conf_.getParameter<double>("DxyMax");
538 
539  int PhiBin = conf_.getParameter<int>( "PhiBin");
540  double PhiMin = conf_.getParameter<double>("PhiMin");
541  double PhiMax = conf_.getParameter<double>("PhiMax");
542 
543  histname = "TESTDistanceOfClosestApproachToBS_";
544  TESTDistanceOfClosestApproachToBS = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax);
545  TESTDistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1);
546  TESTDistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2);
547 
548  histname = "TESTDistanceOfClosestApproachToBSVsPhi_";
549  TESTDistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,"");
550  TESTDistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes);
552  TESTDistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2);
553 
554  }
555 
556  }
557 
558  // book the Profile plots for DCA related histograms
559  // ---------------------------------------------------------------------------------//
560  if(doDCAPlots_ || doAllPlots_) {
561 
562  if (doDCAwrt000Plots_) {
563 
564  int EtaBin = conf_.getParameter<int>( "EtaBin");
565  double EtaMin = conf_.getParameter<double>("EtaMin");
566  double EtaMax = conf_.getParameter<double>("EtaMax");
567 
568  int PhiBin = conf_.getParameter<int>( "PhiBin");
569  double PhiMin = conf_.getParameter<double>("PhiMin");
570  double PhiMax = conf_.getParameter<double>("PhiMax");
571 
572  int DxyBin = conf_.getParameter<int>( "DxyBin");
573  double DxyMin = conf_.getParameter<double>("DxyMin");
574  double DxyMax = conf_.getParameter<double>("DxyMax");
575 
576  if (doThetaPlots_) {
577  int ThetaBin = conf_.getParameter<int>( "ThetaBin");
578  double ThetaMin = conf_.getParameter<double>("ThetaMin");
579  double ThetaMax = conf_.getParameter<double>("ThetaMax");
580 
581  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
582  histname = "DistanceOfClosestApproachVsTheta_";
583  DistanceOfClosestApproachVsTheta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, ThetaBin, ThetaMin, ThetaMax, DxyMin,DxyMax,"");
585  DistanceOfClosestApproachVsTheta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2);
586  }
587 
588  histname = "DistanceOfClosestApproachVsEta_";
589  DistanceOfClosestApproachVsEta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, EtaBin, EtaMin, EtaMax, DxyMin, DxyMax,"");
591  DistanceOfClosestApproachVsEta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2);
592  // temporary patch in order to put back those MEs in Muon Workspace
593 
594  histname = "DistanceOfClosestApproach_";
595  DistanceOfClosestApproach = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax);
596  DistanceOfClosestApproach->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",1);
597  DistanceOfClosestApproach->setAxisTitle("Number of Tracks",2);
598 
599  histname = "DistanceOfClosestApproachVsPhi_";
600  DistanceOfClosestApproachVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyMin,DxyMax,"");
601  DistanceOfClosestApproachVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes);
603  DistanceOfClosestApproachVsPhi->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2);
604  }
605  }
606 
607 
608  if (doSIPPlots_ || doAllPlots_) {
609  const double sipBins = 200;
610  const double sipMin = -20;
611  const double sipMax = 20;
612 
613  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
614 
615  // SIP wrt. beamspot
616  histname = "SIPDxyToBS_";
617  sipDxyToBS = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
618  sipDxyToBS->setAxisTitle("Track dxy significance wrt beam spot",1);
619  sipDxyToBS->setAxisTitle("Number of Tracks",2);
620 
621  histname = "SIPDzToBS_";
622  sipDzToBS = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
623  sipDzToBS->setAxisTitle("Track dz significance wrt beam spot",1);
624  sipDzToBS->setAxisTitle("Number of Tracks",2);
625 
626  // SIP wrt. vertex
627  histname = "SIP3DToPV_";
628  sip3dToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
629  sip3dToPV->setAxisTitle("3D IP significance wrt primary vertex",1);
630  sip3dToPV->setAxisTitle("Number of Tracks",2);
631 
632  histname = "SIP2DToPV_";
633  sip2dToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
634  sip2dToPV->setAxisTitle("2D IP significance wrt primary vertex",1);
635  sip2dToPV->setAxisTitle("Number of Tracks",2);
636 
637  histname = "SIPDxyToPV_";
638  sipDxyToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
639  sipDxyToPV->setAxisTitle("Track dxy significance wrt primary vertex",1);
640  sipDxyToPV->setAxisTitle("Number of Tracks",2);
641 
642  histname = "SIPDzToPV_";
643  sipDzToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
644  sipDzToPV->setAxisTitle("Track dz significance wrt primary vertex",1);
645  sipDzToPV->setAxisTitle("Number of Tracks",2);
646  }
647 }
648 
649 // -- Analyse
650 // ---------------------------------------------------------------------------------//
651 void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track)
652 {
653  double phi = track.phi();
654  double eta = track.eta();
655 
656  int nRecHits = track.hitPattern().numberOfHits(reco::HitPattern::TRACK_HITS);
657  int nValidRecHits = track.numberOfValidHits();
658  int nLostRecHits = track.numberOfLostHits();
659 
660  double chi2 = track.chi2();
661  double chi2prob = TMath::Prob(track.chi2(),(int)track.ndof());
662  double chi2oNDF = track.normalizedChi2();
663 
665  // rec hits
666  NumberOfRecHitsPerTrack -> Fill(nRecHits);
667  NumberOfValidRecHitsPerTrack-> Fill(nValidRecHits);
668  NumberOfLostRecHitsPerTrack -> Fill(nLostRecHits);
669 
670  // 2D plots
672  NumberOfRecHitVsPhiVsEtaPerTrack->Fill(eta,phi,nRecHits);
673 
674  int nLayers = track.hitPattern().trackerLayersWithMeasurement();
675  // layers
676  NumberOfLayersPerTrack->Fill(nLayers);
677 
678  // 2D plots
680  NumberOfLayersVsPhiVsEtaPerTrack->Fill(eta,phi,nLayers);
681  }
682 
684  // fitting
685  Chi2 -> Fill(chi2);
686  Chi2Prob -> Fill(chi2prob);
687  Chi2oNDF -> Fill(chi2oNDF);
688 
689  // DCA
690  // temporary patch in order to put back those MEs in Muon Workspace
691  if (doDCAPlots_) {
692  if (doDCAwrt000Plots_) {
694  DistanceOfClosestApproachVsPhi->Fill(phi, track.dxy());
695  }
696 
697  // PCA
701  }
702 
703  // algorithm
704  algorithm->Fill(static_cast<double>(track.algo()));
705  }
706 
707  if ( doLumiAnalysis_ ) {
709  Chi2oNDF_lumiFlag -> Fill(chi2oNDF);
710  }
711 
713 
714  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
715  iEvent.getByToken(beamSpotToken_,recoBeamSpotHandle);
716  const reco::BeamSpot& bs = *recoBeamSpotHandle;
717 
719  DistanceOfClosestApproachToBSVsPhi -> Fill(track.phi(), track.dxy(bs.position()));
720  zPointOfClosestApproachVsPhi -> Fill(track.phi(), track.vz());
721  xPointOfClosestApproachVsZ0wrt000 -> Fill(track.dz(), track.vx());
722  yPointOfClosestApproachVsZ0wrt000 -> Fill(track.dz(), track.vy());
723  xPointOfClosestApproachVsZ0wrtBS -> Fill(track.dz(bs.position()),(track.vx()-bs.position(track.vz()).x()));
724  yPointOfClosestApproachVsZ0wrtBS -> Fill(track.dz(bs.position()),(track.vy()-bs.position(track.vz()).y()));
725  if (doTestPlots_) {
726  TESTDistanceOfClosestApproachToBS -> Fill(track.dxy(bs.position(track.vz())));
727  TESTDistanceOfClosestApproachToBSVsPhi -> Fill(track.phi(), track.dxy(bs.position(track.vz())));
728  }
729 
730  if(doSIPPlots_) {
731  sipDxyToBS->Fill(track.dxy(bs.position())/track.dxyError());
732  sipDzToBS->Fill(track.dz(bs.position())/track.dzError());
733  }
734  }
735 
737  edm::Handle<reco::VertexCollection> recoPrimaryVerticesHandle;
738  iEvent.getByToken(pvToken_,recoPrimaryVerticesHandle);
739  if (recoPrimaryVerticesHandle->size() > 0) {
740  const reco::Vertex& pv = (*recoPrimaryVerticesHandle)[0];
741 
742 
744  //HI PLOTS///////
746 
747  if(doHIPlots_)
748  {
749  double longDCAsig = 0, transDCAsig = 0;
750  double zerr2 = track.dzError()*track.dzError()+pv.zError()*pv.zError();
751  double xyerr2 = track.d0Error()*track.d0Error()+pv.xError()*pv.yError();
752  if(zerr2 > 0) longDCAsig = track.dz(pv.position())/zerr2;
753  if(xyerr2 > 0) transDCAsig = track.dxy(pv.position())/xyerr2;
754  LongDCASig->Fill(longDCAsig);
755  TransDCASig->Fill(transDCAsig);
756  }
757 
758 
759 
761  DistanceOfClosestApproachToPVVsPhi -> Fill(track.phi(), track.dxy(pv.position()));
762  xPointOfClosestApproachVsZ0wrtPV -> Fill(track.dz(pv.position()),(track.vx()-pv.position().x()));
763  yPointOfClosestApproachVsZ0wrtPV -> Fill(track.dz(pv.position()),(track.vy()-pv.position().y()));
764 
765 
766  if(doSIPPlots_) {
768  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
769  reco::TransientTrack transTrack = theB->build(track);
770 
771  GlobalVector dir(track.px(), track.py(), track.pz());
772  std::pair<bool, Measurement1D> ip3d = IPTools::signedImpactParameter3D(transTrack, dir, pv);
773  std::pair<bool, Measurement1D> ip2d = IPTools::signedTransverseImpactParameter(transTrack, dir, pv);
774  if(ip3d.first) sip3dToPV->Fill(ip3d.second.value() / ip3d.second.error());
775  if(ip2d.first) sip2dToPV->Fill(ip2d.second.value() / ip2d.second.error());
776  sipDxyToPV->Fill(track.dxy(pv.position())/track.dxyError());
777  sipDzToPV->Fill(track.dz(pv.position())/track.dzError());
778  }
779  }
780  }
781 
782  if(doDCAPlots_ || doAllPlots_) {
783  if (doDCAwrt000Plots_) {
784  if (doThetaPlots_) {
785  DistanceOfClosestApproachVsTheta->Fill(track.theta(), track.d0());
786  }
787  DistanceOfClosestApproachVsEta->Fill(track.eta(), track.d0());
788  }
789 
790  }
791 
792  //Tracker Specific Histograms
795  }
796 
798  std::string StateName = conf_.getParameter<std::string>("MeasurementState");
799 
800  if (StateName == "All") {
801  fillHistosForState(iSetup, track, std::string("OuterSurface"));
802  fillHistosForState(iSetup, track, std::string("InnerSurface"));
803  fillHistosForState(iSetup, track, std::string("ImpactPoint"));
804  } else if (
805  StateName != "OuterSurface" &&
806  StateName != "InnerSurface" &&
807  StateName != "ImpactPoint" &&
808  StateName != "default"
809  ) {
810  fillHistosForState(iSetup, track, std::string("default"));
811  } else {
812  fillHistosForState(iSetup, track, StateName);
813  }
814  }
815 
816  if ( doAllPlots_ ) {
817  }
818 
819 }
820 
821 // book histograms at differnt measurement points
822 // ---------------------------------------------------------------------------------//
824 {
825 
826  // parameters from the configuration
827  std::string QualName = conf_.getParameter<std::string>("Quality");
829 
830  // use the AlgoName and Quality Name
831  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
832 
833  // get binning from the configuration
834  double Chi2NDFMin = conf_.getParameter<double>("Chi2NDFMin");
835  double Chi2NDFMax = conf_.getParameter<double>("Chi2NDFMax");
836 
837  int RecHitBin = conf_.getParameter<int>( "RecHitBin");
838  double RecHitMin = conf_.getParameter<double>("RecHitMin");
839  double RecHitMax = conf_.getParameter<double>("RecHitMax");
840 
841  int RecLayBin = conf_.getParameter<int>( "RecHitBin");
842  double RecLayMin = conf_.getParameter<double>("RecHitMin");
843  double RecLayMax = conf_.getParameter<double>("RecHitMax");
844 
845 
846  int PhiBin = conf_.getParameter<int>( "PhiBin");
847  double PhiMin = conf_.getParameter<double>("PhiMin");
848  double PhiMax = conf_.getParameter<double>("PhiMax");
849 
850  int EtaBin = conf_.getParameter<int>( "EtaBin");
851  double EtaMin = conf_.getParameter<double>("EtaMin");
852  double EtaMax = conf_.getParameter<double>("EtaMax");
853 
854  int ThetaBin = conf_.getParameter<int>( "ThetaBin");
855  double ThetaMin = conf_.getParameter<double>("ThetaMin");
856  double ThetaMax = conf_.getParameter<double>("ThetaMax");
857 
858  int TrackQBin = conf_.getParameter<int>( "TrackQBin");
859  double TrackQMin = conf_.getParameter<double>("TrackQMin");
860  double TrackQMax = conf_.getParameter<double>("TrackQMax");
861 
862  int TrackPtBin = conf_.getParameter<int>( "TrackPtBin");
863  double TrackPtMin = conf_.getParameter<double>("TrackPtMin");
864  double TrackPtMax = conf_.getParameter<double>("TrackPtMax");
865 
866  int TrackPBin = conf_.getParameter<int>( "TrackPBin");
867  double TrackPMin = conf_.getParameter<double>("TrackPMin");
868  double TrackPMax = conf_.getParameter<double>("TrackPMax");
869 
870  int TrackPxBin = conf_.getParameter<int>( "TrackPxBin");
871  double TrackPxMin = conf_.getParameter<double>("TrackPxMin");
872  double TrackPxMax = conf_.getParameter<double>("TrackPxMax");
873 
874  int TrackPyBin = conf_.getParameter<int>( "TrackPyBin");
875  double TrackPyMin = conf_.getParameter<double>("TrackPyMin");
876  double TrackPyMax = conf_.getParameter<double>("TrackPyMax");
877 
878  int TrackPzBin = conf_.getParameter<int>( "TrackPzBin");
879  double TrackPzMin = conf_.getParameter<double>("TrackPzMin");
880  double TrackPzMax = conf_.getParameter<double>("TrackPzMax");
881 
882  int ptErrBin = conf_.getParameter<int>( "ptErrBin");
883  double ptErrMin = conf_.getParameter<double>("ptErrMin");
884  double ptErrMax = conf_.getParameter<double>("ptErrMax");
885 
886  int pxErrBin = conf_.getParameter<int>( "pxErrBin");
887  double pxErrMin = conf_.getParameter<double>("pxErrMin");
888  double pxErrMax = conf_.getParameter<double>("pxErrMax");
889 
890  int pyErrBin = conf_.getParameter<int>( "pyErrBin");
891  double pyErrMin = conf_.getParameter<double>("pyErrMin");
892  double pyErrMax = conf_.getParameter<double>("pyErrMax");
893 
894  int pzErrBin = conf_.getParameter<int>( "pzErrBin");
895  double pzErrMin = conf_.getParameter<double>("pzErrMin");
896  double pzErrMax = conf_.getParameter<double>("pzErrMax");
897 
898  int pErrBin = conf_.getParameter<int>( "pErrBin");
899  double pErrMin = conf_.getParameter<double>("pErrMin");
900  double pErrMax = conf_.getParameter<double>("pErrMax");
901 
902  int phiErrBin = conf_.getParameter<int>( "phiErrBin");
903  double phiErrMin = conf_.getParameter<double>("phiErrMin");
904  double phiErrMax = conf_.getParameter<double>("phiErrMax");
905 
906  int etaErrBin = conf_.getParameter<int>( "etaErrBin");
907  double etaErrMin = conf_.getParameter<double>("etaErrMin");
908  double etaErrMax = conf_.getParameter<double>("etaErrMax");
909 
910 
911  double Chi2ProbMin = conf_.getParameter<double>("Chi2ProbMin");
912  double Chi2ProbMax = conf_.getParameter<double>("Chi2ProbMax");
913 
914  ibooker.setCurrentFolder(TopFolder_);
915 
916  TkParameterMEs tkmes;
917 
918  std::string histTag = (sname == "default") ? CategoryName : sname + "_" + CategoryName;
919 
920  if(doAllPlots_) {
921 
922  // general properties
923  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
924 
925  if (doThetaPlots_) {
926  histname = "Chi2oNDFVsTheta_" + histTag;
927  tkmes.Chi2oNDFVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax,"");
928  tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta",1);
929  tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf",2);
930  }
931  histname = "Chi2oNDFVsPhi_" + histTag;
932  tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax,"");
933  tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi",1);
934  tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf",2);
935 
936  histname = "Chi2oNDFVsEta_" + histTag;
937  tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax,"");
938  tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta",1);
939  tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf",2);
940 
941  histname = "Chi2ProbVsPhi_" + histTag;
942  tkmes.Chi2ProbVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax);
943  tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi" ,1);
944  tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability",2);
945 
946  histname = "Chi2ProbVsEta_" + histTag;
947  tkmes.Chi2ProbVsEta = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax);
948  tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta" ,1);
949  tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability",2);
950 
951  }
952 
953  // general properties
954  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
955 
956  histname = "TrackP_" + histTag;
957  tkmes.TrackP = ibooker.book1D(histname, histname, TrackPBin, TrackPMin, TrackPMax);
958  tkmes.TrackP->setAxisTitle("Track |p| (GeV/c)", 1);
959  tkmes.TrackP->setAxisTitle("Number of Tracks",2);
960 
961  histname = "TrackPt_" + histTag;
962  tkmes.TrackPt = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax);
963  tkmes.TrackPt->setAxisTitle("Track p_{T} (GeV/c)", 1);
964  tkmes.TrackPt->setAxisTitle("Number of Tracks",2);
965 
966  if (doTrackPxPyPlots_) {
967  histname = "TrackPx_" + histTag;
968  tkmes.TrackPx = ibooker.book1D(histname, histname, TrackPxBin, TrackPxMin, TrackPxMax);
969  tkmes.TrackPx->setAxisTitle("Track p_{x} (GeV/c)", 1);
970  tkmes.TrackPx->setAxisTitle("Number of Tracks",2);
971 
972  histname = "TrackPy_" + histTag;
973  tkmes.TrackPy = ibooker.book1D(histname, histname, TrackPyBin, TrackPyMin, TrackPyMax);
974  tkmes.TrackPy->setAxisTitle("Track p_{y} (GeV/c)", 1);
975  tkmes.TrackPy->setAxisTitle("Number of Tracks",2);
976  }
977  histname = "TrackPz_" + histTag;
978  tkmes.TrackPz = ibooker.book1D(histname, histname, TrackPzBin, TrackPzMin, TrackPzMax);
979  tkmes.TrackPz->setAxisTitle("Track p_{z} (GeV/c)", 1);
980  tkmes.TrackPz->setAxisTitle("Number of Tracks",2);
981 
982  histname = "TrackPhi_" + histTag;
983  tkmes.TrackPhi = ibooker.book1D(histname, histname, PhiBin, PhiMin, PhiMax);
984  tkmes.TrackPhi->setAxisTitle("Track #phi", 1);
985  tkmes.TrackPhi->setAxisTitle("Number of Tracks",2);
986 
987  histname = "TrackEta_" + histTag;
988  tkmes.TrackEta = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax);
989  tkmes.TrackEta->setAxisTitle("Track #eta", 1);
990  tkmes.TrackEta->setAxisTitle("Number of Tracks",2);
991 
992  if (doThetaPlots_) {
993  histname = "TrackTheta_" + histTag;
994  tkmes.TrackTheta = ibooker.book1D(histname, histname, ThetaBin, ThetaMin, ThetaMax);
995  tkmes.TrackTheta->setAxisTitle("Track #theta", 1);
996  tkmes.TrackTheta->setAxisTitle("Number of Tracks",2);
997  }
998  histname = "TrackQ_" + histTag;
999  tkmes.TrackQ = ibooker.book1D(histname, histname, TrackQBin, TrackQMin, TrackQMax);
1000  tkmes.TrackQ->setAxisTitle("Track Charge", 1);
1001  tkmes.TrackQ->setAxisTitle("Number of Tracks",2);
1002 
1003  histname = "TrackPErrOverP_" + histTag;
1004  tkmes.TrackPErr = ibooker.book1D(histname, histname, pErrBin, pErrMin, pErrMax);
1005  tkmes.TrackPErr->setAxisTitle("track error(p)/p", 1);
1006  tkmes.TrackPErr->setAxisTitle("Number of Tracks",2);
1007 
1008  histname = "TrackPtErrOverPt_" + histTag;
1009  tkmes.TrackPtErr = ibooker.book1D(histname, histname, ptErrBin, ptErrMin, ptErrMax);
1010  tkmes.TrackPtErr->setAxisTitle("track error(p_{T})/p_{T}", 1);
1011  tkmes.TrackPtErr->setAxisTitle("Number of Tracks",2);
1012 
1013  histname = "TrackPtErrOverPtVsEta_" + histTag;
1014  tkmes.TrackPtErrVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, ptErrMin, ptErrMax);
1015  tkmes.TrackPtErrVsEta->setAxisTitle("Track #eta",1);
1016  tkmes.TrackPtErrVsEta->setAxisTitle("track error(p_{T})/p_{T}", 2);
1017 
1018  if (doTrackPxPyPlots_) {
1019  histname = "TrackPxErrOverPx_" + histTag;
1020  tkmes.TrackPxErr = ibooker.book1D(histname, histname, pxErrBin, pxErrMin, pxErrMax);
1021  tkmes.TrackPxErr->setAxisTitle("track error(p_{x})/p_{x}", 1);
1022  tkmes.TrackPxErr->setAxisTitle("Number of Tracks",2);
1023 
1024  histname = "TrackPyErrOverPy_" + histTag;
1025  tkmes.TrackPyErr = ibooker.book1D(histname, histname, pyErrBin, pyErrMin, pyErrMax);
1026  tkmes.TrackPyErr->setAxisTitle("track error(p_{y})/p_{y}", 1);
1027  tkmes.TrackPyErr->setAxisTitle("Number of Tracks",2);
1028  }
1029  histname = "TrackPzErrOverPz_" + histTag;
1030  tkmes.TrackPzErr = ibooker.book1D(histname, histname, pzErrBin, pzErrMin, pzErrMax);
1031  tkmes.TrackPzErr->setAxisTitle("track error(p_{z})/p_{z}", 1);
1032  tkmes.TrackPzErr->setAxisTitle("Number of Tracks",2);
1033 
1034  histname = "TrackPhiErr_" + histTag;
1035  tkmes.TrackPhiErr = ibooker.book1D(histname, histname, phiErrBin, phiErrMin, phiErrMax);
1036  tkmes.TrackPhiErr->setAxisTitle("track error(#phi)");
1037  tkmes.TrackPhiErr->setAxisTitle("Number of Tracks",2);
1038 
1039  histname = "TrackEtaErr_" + histTag;
1040  tkmes.TrackEtaErr = ibooker.book1D(histname, histname, etaErrBin, etaErrMin, etaErrMax);
1041  tkmes.TrackEtaErr->setAxisTitle("track error(#eta)");
1042  tkmes.TrackEtaErr->setAxisTitle("Number of Tracks",2);
1043 
1044  // rec hit profiles
1045  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
1046  histname = "NumberOfRecHitsPerTrackVsPhi_" + histTag;
1047  tkmes.NumberOfRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitBin, RecHitMin, RecHitMax,"");
1048  tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1);
1049  tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of RecHits in each Track",2);
1050 
1051  if (doThetaPlots_) {
1052  histname = "NumberOfRecHitsPerTrackVsTheta_" + histTag;
1053  tkmes.NumberOfRecHitsPerTrackVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecHitBin, RecHitMin, RecHitMax,"");
1054  tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Track #phi",1);
1055  tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Number of RecHits in each Track",2);
1056  }
1057  histname = "NumberOfRecHitsPerTrackVsEta_" + histTag;
1058  tkmes.NumberOfRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitBin, RecHitMin, RecHitMax,"");
1059  tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1);
1060  tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of RecHits in each Track",2);
1061 
1062  histname = "NumberOfValidRecHitsPerTrackVsPhi_" + histTag;
1063  tkmes.NumberOfValidRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitMin, RecHitMax,"");
1064  tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1);
1065  tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Number of valid RecHits in each Track",2);
1066 
1067  // std::cout << "[TrackAnalyzer::bookHistosForState] histTag: " << histTag << std::endl;
1068  histname = "NumberOfValidRecHitsPerTrackVsEta_" + histTag;
1069  tkmes.NumberOfValidRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitMin, RecHitMax,"");
1070  tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1);
1071  tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Number of valid RecHits in each Track",2);
1072 
1074  histname = "NumberOfLayersPerTrackVsPhi_" + histTag;
1075  tkmes.NumberOfLayersPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecLayBin, RecLayMin, RecLayMax,"");
1076  tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi",1);
1077  tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of Layers in each Track",2);
1078 
1079  if (doThetaPlots_) {
1080  histname = "NumberOfLayersPerTrackVsTheta_" + histTag;
1081  tkmes.NumberOfLayersPerTrackVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecLayBin, RecLayMin, RecLayMax,"");
1082  tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Track #phi",1);
1083  tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Number of Layers in each Track",2);
1084  }
1085  histname = "NumberOfLayersPerTrackVsEta_" + histTag;
1086  tkmes.NumberOfLayersPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecLayBin, RecLayMin, RecLayMax,"");
1087  tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta",1);
1088  tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of Layers in each Track",2);
1089 
1090  if (doThetaPlots_) {
1091  histname = "Chi2oNDFVsTheta_" + histTag;
1092  tkmes.Chi2oNDFVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax,"");
1093  tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta",1);
1094  tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf",2);
1095  }
1096  if (doAllPlots_) {
1097  histname = "Chi2oNDFVsPhi_" + histTag;
1098  tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax,"");
1099  tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi",1);
1100  tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf",2);
1101 
1102  histname = "Chi2oNDFVsEta_" + histTag;
1103  tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax,"");
1104  tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta",1);
1105  tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf",2);
1106 
1107  histname = "Chi2ProbVsPhi_" + histTag;
1108  tkmes.Chi2ProbVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax);
1109  tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi" ,1);
1110  tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability",2);
1111 
1112  histname = "Chi2ProbVsEta_" + histTag;
1113  tkmes.Chi2ProbVsEta = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax);
1114  tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta" ,1);
1115  tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability",2);
1116  }
1117 
1118  // now put the MEs in the map
1119  TkParameterMEMap.insert( std::make_pair(sname, tkmes) );
1120 
1121 }
1122 
1123 
1124 // fill histograms at differnt measurement points
1125 // ---------------------------------------------------------------------------------//
1127 {
1128  //get the kinematic parameters
1129  double p, px, py, pz, pt, theta, phi, eta, q;
1130  double pxerror, pyerror, pzerror, pterror, perror, phierror, etaerror;
1131 
1132  if (sname == "default") {
1133 
1134  p = track.p();
1135  px = track.px();
1136  py = track.py();
1137  pz = track.pz();
1138  pt = track.pt();
1139  phi = track.phi();
1140  theta = track.theta();
1141  eta = track.eta();
1142  q = track.charge();
1143 
1144  pterror = (pt) ? track.ptError()/(pt*pt) : 0.0;
1145  pxerror = -1.0;
1146  pyerror = -1.0;
1147  pzerror = -1.0;
1148  perror = -1.0;
1149  phierror = track.phiError();
1150  etaerror = track.etaError();
1151 
1152  } else {
1153 
1155  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
1156  reco::TransientTrack TransTrack = theB->build(track);
1157 
1159 
1160  if (sname == "OuterSurface") TSOS = TransTrack.outermostMeasurementState();
1161  else if (sname == "InnerSurface") TSOS = TransTrack.innermostMeasurementState();
1162  else if (sname == "ImpactPoint") TSOS = TransTrack.impactPointState();
1163 
1164  p = TSOS.globalMomentum().mag();
1165  px = TSOS.globalMomentum().x();
1166  py = TSOS.globalMomentum().y();
1167  pz = TSOS.globalMomentum().z();
1168  pt = TSOS.globalMomentum().perp();
1169  phi = TSOS.globalMomentum().phi();
1170  theta = TSOS.globalMomentum().theta();
1171  eta = TSOS.globalMomentum().eta();
1172  q = TSOS.charge();
1173 
1174  //get the error of the kinimatic parameters
1176  double partialPterror = errors(3,3)*pow(TSOS.globalMomentum().x(),2) + errors(4,4)*pow(TSOS.globalMomentum().y(),2);
1177  pterror = sqrt(partialPterror)/TSOS.globalMomentum().perp();
1178  pxerror = sqrt(errors(3,3))/TSOS.globalMomentum().x();
1179  pyerror = sqrt(errors(4,4))/TSOS.globalMomentum().y();
1180  pzerror = sqrt(errors(5,5))/TSOS.globalMomentum().z();
1181  perror = sqrt(partialPterror+errors(5,5)*pow(TSOS.globalMomentum().z(),2))/TSOS.globalMomentum().mag();
1182  phierror = sqrt(TSOS.curvilinearError().matrix()(2,2));
1183  etaerror = sqrt(TSOS.curvilinearError().matrix()(1,1))*fabs(sin(TSOS.globalMomentum().theta()));
1184 
1185  }
1186 
1187  std::map<std::string, TkParameterMEs>::iterator iPos = TkParameterMEMap.find(sname);
1188  if (iPos != TkParameterMEMap.end()) {
1189 
1190  TkParameterMEs tkmes = iPos->second;
1191 
1192  // momentum
1193  tkmes.TrackP->Fill(p);
1194  if (doTrackPxPyPlots_) {
1195  tkmes.TrackPx->Fill(px);
1196  tkmes.TrackPy->Fill(py);
1197  }
1198  tkmes.TrackPz->Fill(pz);
1199  tkmes.TrackPt->Fill(pt);
1200 
1201  // angles
1202  tkmes.TrackPhi->Fill(phi);
1203  tkmes.TrackEta->Fill(eta);
1204  if (doThetaPlots_) {
1205  tkmes.TrackTheta->Fill(theta);
1206  }
1207  tkmes.TrackQ->Fill(q);
1208 
1209  // errors
1210  tkmes.TrackPtErr->Fill(pterror);
1211  tkmes.TrackPtErrVsEta->Fill(eta,pterror);
1212  if (doTrackPxPyPlots_) {
1213  tkmes.TrackPxErr->Fill(pxerror);
1214  tkmes.TrackPyErr->Fill(pyerror);
1215  }
1216  tkmes.TrackPzErr->Fill(pzerror);
1217  tkmes.TrackPErr->Fill(perror);
1218  tkmes.TrackPhiErr->Fill(phierror);
1219  tkmes.TrackEtaErr->Fill(etaerror);
1220 
1221  int nRecHits = track.hitPattern().numberOfHits(reco::HitPattern::TRACK_HITS);
1222  int nValidRecHits = track.numberOfValidHits();
1223  // rec hits
1224  tkmes.NumberOfRecHitsPerTrackVsPhi->Fill(phi, nRecHits);
1225  if (doThetaPlots_) {
1226  tkmes.NumberOfRecHitsPerTrackVsTheta->Fill(theta,nRecHits);
1227  }
1228  tkmes.NumberOfRecHitsPerTrackVsEta->Fill(eta, nRecHits);
1229 
1230  tkmes.NumberOfValidRecHitsPerTrackVsPhi->Fill(phi, nValidRecHits);
1231  tkmes.NumberOfValidRecHitsPerTrackVsEta->Fill(eta, nValidRecHits);
1232 
1233  int nLayers = track.hitPattern().trackerLayersWithMeasurement();
1234  // rec layers
1235  tkmes.NumberOfLayersPerTrackVsPhi->Fill(phi, nLayers);
1236  if (doThetaPlots_) {
1237  tkmes.NumberOfLayersPerTrackVsTheta->Fill(theta, nLayers);
1238  }
1239  tkmes.NumberOfLayersPerTrackVsEta->Fill(eta, nLayers);
1240 
1241  double chi2prob = TMath::Prob(track.chi2(),(int)track.ndof());
1242  double chi2oNDF = track.normalizedChi2();
1243 
1244  if(doAllPlots_) {
1245 
1246  // general properties
1247  if (doThetaPlots_) {
1248  tkmes.Chi2oNDFVsTheta->Fill(theta, chi2oNDF);
1249  }
1250  tkmes.Chi2oNDFVsPhi->Fill(phi, chi2oNDF);
1251  tkmes.Chi2oNDFVsEta->Fill(eta, chi2oNDF);
1252  tkmes.Chi2ProbVsPhi->Fill(phi, chi2prob);
1253  tkmes.Chi2ProbVsEta->Fill(eta, chi2prob);
1254  }
1255 
1256  }
1257 
1258 }
1259 
1260 
1262 {
1263 
1264  // parameters from the configuration
1265  std::string QualName = conf_.getParameter<std::string>("Quality");
1267 
1268  // use the AlgoName and Quality Name
1269  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
1270 
1271  int PhiBin = conf_.getParameter<int>( "PhiBin");
1272  double PhiMin = conf_.getParameter<double>("PhiMin");
1273  double PhiMax = conf_.getParameter<double>("PhiMax");
1274 
1275  int EtaBin = conf_.getParameter<int>( "EtaBin");
1276  double EtaMin = conf_.getParameter<double>("EtaMin");
1277  double EtaMax = conf_.getParameter<double>("EtaMax");
1278 
1279  // book hit property histograms
1280  // ---------------------------------------------------------------------------------//
1281  ibooker.setCurrentFolder(TopFolder_+"/HitProperties");
1282 
1283 
1284 
1285  std::vector<std::string> subdetectors = conf_.getParameter<std::vector<std::string> >("subdetectors");
1286  int detBin = conf_.getParameter<int>("subdetectorBin");
1287 
1288  for ( auto det : subdetectors ) {
1289 
1290  // hits properties
1291  ibooker.setCurrentFolder(TopFolder_+"/HitProperties/"+det);
1292 
1293  TkRecHitsPerSubDetMEs recHitsPerSubDet_mes;
1294 
1295  recHitsPerSubDet_mes.detectorTag = det;
1296  int detID = -1;
1297  if ( det == "TIB" ) detID = StripSubdetector::TIB;
1298  if ( det == "TOB" ) detID = StripSubdetector::TOB;
1299  if ( det == "TID" ) detID = StripSubdetector::TID;
1300  if ( det == "TEC" ) detID = StripSubdetector::TEC;
1301  if ( det == "PixBarrel" ) detID = PixelSubdetector::PixelBarrel;
1302  if ( det == "PixEndcap" ) detID = PixelSubdetector::PixelEndcap;
1303  recHitsPerSubDet_mes.detectorId = detID;
1304 
1305  histname = "NumberOfRecHitsPerTrack_" + det + "_" + CategoryName;
1306  recHitsPerSubDet_mes.NumberOfRecHitsPerTrack = ibooker.book1D(histname, histname, detBin, -0.5, double(detBin)-0.5);
1307  recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of " + det + " valid RecHits in each Track",1);
1308  recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
1309 
1310  histname = "NumberOfRecHitsPerTrackVsPhi_" + det + "_" + CategoryName;
1311  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin)-0.5,"");
1312  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1);
1313  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of " + det + " valid RecHits in each Track",2);
1314 
1315  histname = "NumberOfRecHitsPerTrackVsEta_" + det + "_" + CategoryName;
1316  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin)-0.5,"");
1317  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1);
1318  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of " + det + " valid RecHits in each Track",2);
1319 
1320  histname = "NumberOfLayersPerTrack_" + det + "_" + CategoryName;
1321  recHitsPerSubDet_mes.NumberOfLayersPerTrack = ibooker.book1D(histname, histname, detBin, -0.5, double(detBin)-0.5);
1322  recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of " + det + " valid Layers in each Track",1);
1323  recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of Tracks", 2);
1324 
1325  histname = "NumberOfLayersPerTrackVsPhi_" + det + "_" + CategoryName;
1326  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin)-0.5,"");
1327  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi",1);
1328  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of " + det + " valid Layers in each Track",2);
1329 
1330  histname = "NumberOfLayersPerTrackVsEta_" + det + "_" + CategoryName;
1331  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin)-0.5,"");
1332  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta",1);
1333  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of " + det + " valid Layers in each Track",2);
1334 
1335  TkRecHitsPerSubDetMEMap.insert(std::pair<std::string,TkRecHitsPerSubDetMEs>(det,recHitsPerSubDet_mes));
1336 
1337 
1338  }
1339 
1340 
1341 }
1342 
1343 
1345 {
1346 
1347  double phi = track.phi();
1348  double eta = track.eta();
1349 
1350  for ( std::map<std::string,TkRecHitsPerSubDetMEs>::iterator it = TkRecHitsPerSubDetMEMap.begin();
1351  it != TkRecHitsPerSubDetMEMap.end(); it++ ) {
1352 
1353  int nValidLayers = 0;
1354  int nValidRecHits = 0;
1355  int substr = it->second.detectorId;
1356  switch(substr) {
1357  case StripSubdetector::TIB :
1358  nValidLayers = track.hitPattern().stripTIBLayersWithMeasurement(); // case 0: strip TIB
1359  nValidRecHits = track.hitPattern().numberOfValidStripTIBHits(); // case 0: strip TIB
1360  break;
1361  case StripSubdetector::TID :
1362  nValidLayers = track.hitPattern().stripTIDLayersWithMeasurement(); // case 0: strip TID
1363  nValidRecHits = track.hitPattern().numberOfValidStripTIDHits(); // case 0: strip TID
1364  break;
1365  case StripSubdetector::TOB :
1366  nValidLayers = track.hitPattern().stripTOBLayersWithMeasurement(); // case 0: strip TOB
1367  nValidRecHits = track.hitPattern().numberOfValidStripTOBHits(); // case 0: strip TOB
1368  break;
1369  case StripSubdetector::TEC :
1370  nValidLayers = track.hitPattern().stripTECLayersWithMeasurement(); // case 0: strip TEC
1371  nValidRecHits = track.hitPattern().numberOfValidStripTECHits(); // case 0: strip TEC
1372  break;
1374  nValidLayers = track.hitPattern().pixelBarrelLayersWithMeasurement(); // case 0: pixel PXB
1375  nValidRecHits = track.hitPattern().numberOfValidPixelBarrelHits(); // case 0: pixel PXB
1376  break;
1378  nValidLayers = track.hitPattern().pixelEndcapLayersWithMeasurement(); // case 0: pixel PXF
1379  nValidRecHits = track.hitPattern().numberOfValidPixelEndcapHits(); // case 0: pixel PXF
1380  break;
1381  default :
1382  break;
1383  }
1384 
1385  //Fill Layers and RecHits
1386  it->second.NumberOfRecHitsPerTrack -> Fill(nValidRecHits);
1387  it->second.NumberOfRecHitsPerTrackVsPhi -> Fill(phi, nValidRecHits);
1388  it->second.NumberOfRecHitsPerTrackVsEta -> Fill(eta, nValidRecHits);
1389 
1390  it->second.NumberOfLayersPerTrack -> Fill(nValidLayers);
1391  it->second.NumberOfLayersPerTrackVsPhi -> Fill(phi, nValidLayers);
1392  it->second.NumberOfLayersPerTrackVsEta -> Fill(eta, nValidLayers);
1393  }
1394 
1395 }
1396 //
1397 // -- Set Lumi Flag
1398 //
1400 
1401  TkParameterMEs tkmes;
1404 }
1405 //
1406 // -- Apply SoftReset
1407 //
1409  TkParameterMEs tkmes;
1410  dqmStore_->softReset(Chi2oNDF);
1411  dqmStore_->softReset(NumberOfRecHitsPerTrack);
1412 }
1413 //
1414 // -- Apply Reset
1415 //
1417  TkParameterMEs tkmes;
1420 }
1421 //
1422 // -- Remove SoftReset
1423 //
1425  TkParameterMEs tkmes;
1426  dqmStore_->disableSoftReset(Chi2oNDF);
1428 }
1429 
1430 
MonitorElement * NumberOfRecHitsPerTrackVsPhi
MonitorElement * NumberOfValidRecHitsPerTrackVsPhi
MonitorElement * Chi2ProbVsPhi
double p() const
momentum vector magnitude
Definition: TrackBase.h:568
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
MonitorElement * NumberOfLayersPerTrackVsPhi
int stripTOBLayersWithMeasurement() const
Definition: HitPattern.cc:563
T getParameter(std::string const &) const
MonitorElement * DistanceOfClosestApproachToPVVsPhi
const Point & referencePoint() const
Reference point on the track.
Definition: TrackBase.h:634
MonitorElement * NumberOfRecHitVsPhiVsEtaPerTrack
bool doTrackerSpecific_
Definition: TrackAnalyzer.h:66
double d0Error() const
error on d0
Definition: TrackBase.h:755
void fillHistosForTrackerSpecific(const reco::Track &track)
MonitorElement * NumberOfRecHitsPerTrackVsEta
void bookHistosForLScertification(DQMStore::IBooker &ibooker)
T perp() const
Definition: PV3DBase.h:72
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
Definition: TrackBase.h:550
MonitorElement * NumberOfValidRecHitsPerTrack
int stripTIBLayersWithMeasurement() const
Definition: HitPattern.cc:541
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:514
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
double zError() const
error on z
Definition: Vertex.h:118
MonitorElement * Chi2oNDF_lumiFlag
double theta() const
polar angle
Definition: TrackBase.h:532
double dxyError() const
error on dxy
Definition: TrackBase.h:749
MonitorElement * xPointOfClosestApproachToPV
const CurvilinearTrajectoryError & curvilinearError() const
MonitorElement * sip3dToPV
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::pair< bool, Measurement1D > signedTransverseImpactParameter(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:50
MonitorElement * NumberOfLostRecHitsPerTrack
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
edm::ParameterSet conf_
Definition: TrackAnalyzer.h:64
const CartesianTrajectoryError cartesianError() const
Geom::Theta< T > theta() const
bool doGeneralPropertiesPlots_
Definition: TrackAnalyzer.h:71
T y() const
Definition: PV3DBase.h:63
double etaError() const
error on eta
Definition: TrackBase.h:737
MonitorElement * Chi2oNDFVsPhi
MonitorElement * Chi2ProbVsPhi
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::pair< bool, Measurement1D > signedImpactParameter3D(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:71
MonitorElement * DistanceOfClosestApproachVsPhi
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:598
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
Definition: TrackBase.h:779
#define NULL
Definition: scimark2.h:8
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
MonitorElement * sipDzToBS
std::map< std::string, TkParameterMEs > TkParameterMEMap
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * algorithm
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:580
T eta() const
bool doHitPropertiesPlots_
Definition: TrackAnalyzer.h:73
MonitorElement * DistanceOfClosestApproach
bool doRecHitVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:74
MonitorElement * NumberOfLayersPerTrackVsTheta
MonitorElement * NumberOfRecHitsPerTrack_lumiFlag
std::map< std::string, TkRecHitsPerSubDetMEs > TkRecHitsPerSubDetMEMap
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:477
const Point & position() const
position
Definition: Vertex.h:106
int pixelEndcapLayersWithMeasurement() const
Definition: HitPattern.cc:529
int numberOfValidStripTOBHits() const
Definition: HitPattern.h:779
bool doMeasurementStatePlots_
Definition: TrackAnalyzer.h:72
TrajectoryStateOnSurface innermostMeasurementState() const
MonitorElement * NumberOfRecHitsPerTrack
void Fill(long long x)
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
TrackAlgorithm algo() const
Definition: TrackBase.h:450
void disableSoftReset(MonitorElement *me)
Definition: DQMStore.cc:3382
MonitorElement * TESTDistanceOfClosestApproachToBSVsPhi
MonitorElement * NumberOfValidRecHitsPerTrackVsEta
MonitorElement * Chi2oNDFVsEta
MonitorElement * TransDCASig
int iEvent
Definition: GenABIO.cc:230
MonitorElement * NumberOfRecHitsPerTrackVsPhi
MonitorElement * xPointOfClosestApproachVsZ0wrt000
T mag() const
Definition: PV3DBase.h:67
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:604
int numberOfValidPixelBarrelHits() const
Definition: HitPattern.h:754
bool doDCAwrt000Plots_
Definition: TrackAnalyzer.h:88
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * xPointOfClosestApproach
MonitorElement * Chi2oNDFVsTheta
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:502
MonitorElement * bookProfile2D(Args &&...args)
Definition: DQMStore.h:163
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:508
int stripTIDLayersWithMeasurement() const
Definition: HitPattern.cc:552
MonitorElement * NumberOfValidRecHitsPerTrackVsEta
T sqrt(T t)
Definition: SSEVec.h:48
MonitorElement * NumberOfRecHitsPerTrackVsPhi
double pt() const
track transverse momentum
Definition: TrackBase.h:574
T z() const
Definition: PV3DBase.h:64
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:716
std::string TopFolder_
Definition: TrackAnalyzer.h:59
MonitorElement * xPointOfClosestApproachVsZ0wrtBS
double phiError() const
error on phi
Definition: TrackBase.h:743
MonitorElement * NumberOfValidRecHitsPerTrackVsPhi
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
int numberOfValidStripTIDHits() const
Definition: HitPattern.h:774
TH1 * getTH1(void) const
MonitorElement * yPointOfClosestApproachToPV
const double EtaMin[kNumberCalorimeter]
MonitorElement * NumberOfRecHitsPerTrackVsEta
unsigned short numberOfValidHits() const
number of valid hits found
Definition: TrackBase.h:773
int numberOfValidStripTECHits() const
Definition: HitPattern.h:784
MonitorElement * sip2dToPV
void softReset(MonitorElement *me)
Definition: DQMStore.cc:3374
MonitorElement * Chi2oNDFVsTheta
TrajectoryStateOnSurface outermostMeasurementState() const
MonitorElement * sipDzToPV
MonitorElement * sipDxyToBS
void bookHistosForHitProperties(DQMStore::IBooker &ibooker)
MonitorElement * DistanceOfClosestApproachVsEta
MonitorElement * zPointOfClosestApproachVsPhi
const AlgebraicSymMatrix66 & matrix() const
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:592
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:562
MonitorElement * NumberOfLayersPerTrackVsEta
double dzError() const
error on dz
Definition: TrackBase.h:767
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:622
void bookHistosForTrackerSpecific(DQMStore::IBooker &ibooker)
void fillHistosForState(const edm::EventSetup &iSetup, const reco::Track &track, std::string sname)
TrajectoryStateOnSurface TSOS
Definition: TestHits.cc:19
virtual ~TrackAnalyzer()
bool doLumiAnalysis_
Definition: TrackAnalyzer.h:90
double xError() const
error on x
Definition: Vertex.h:114
MonitorElement * NumberOfLayersPerTrackVsEta
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: TrackAnalyzer.h:61
MonitorElement * sipDxyToPV
virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::Track &track)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:411
MonitorElement * xPointOfClosestApproachVsZ0wrtPV
MonitorElement * yPointOfClosestApproachVsZ0wrtBS
MonitorElement * NumberOfLayersPerTrack
const T & get() const
Definition: EventSetup.h:55
int pixelBarrelLayersWithMeasurement() const
Definition: HitPattern.cc:517
MonitorElement * DistanceOfClosestApproachVsTheta
void bookHistosForBeamSpot(DQMStore::IBooker &ibooker)
virtual void initHisto(DQMStore::IBooker &ibooker)
MonitorElement * Chi2ProbVsEta
int numberOfValidStripTIBHits() const
Definition: HitPattern.h:769
static const std::string algoNames[]
Definition: TrackBase.h:136
int numberOfValidPixelEndcapHits() const
Definition: HitPattern.h:759
MonitorElement * zPointOfClosestApproachToPV
T eta() const
Definition: PV3DBase.h:76
MonitorElement * DistanceOfClosestApproachToPV
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:616
const AlgebraicSymMatrix55 & matrix() const
bool doTrackPxPyPlots_
Definition: TrackAnalyzer.h:84
GlobalVector globalMomentum() const
MonitorElement * DistanceOfClosestApproachToBSVsPhi
bool doLayersVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:76
void doSoftReset(DQMStore *dqmStore_)
int stripTECLayersWithMeasurement() const
Definition: HitPattern.cc:574
MonitorElement * yPointOfClosestApproachVsZ0wrt000
MonitorElement * TrackPtErrVsEta
MonitorElement * TESTDistanceOfClosestApproachToBS
MonitorElement * NumberOfRecHitsPerTrackVsEta
int charge() const
track electric charge
Definition: TrackBase.h:520
const Point & position() const
position
Definition: BeamSpot.h:62
TrajectoryStateOnSurface impactPointState() const
void bookHistosForState(std::string sname, DQMStore::IBooker &ibooker)
MonitorElement * yPointOfClosestApproach
void Reset(std::vector< TH2F > &depth)
MonitorElement * NumberOfLayersVsPhiVsEtaPerTrack
dbl *** dir
Definition: mlp_gen.cc:35
Definition: DDAxes.h:10
MonitorElement * Chi2Prob
Definition: Chi2.h:17
MonitorElement * yPointOfClosestApproachVsZ0wrtPV
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:544
MonitorElement * zPointOfClosestApproach
TrackAnalyzer(const edm::ParameterSet &)
T x() const
Definition: PV3DBase.h:62
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * Chi2ProbVsEta
MonitorElement * DistanceOfClosestApproachToBS
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
MonitorElement * Chi2oNDF
double yError() const
error on y
Definition: Vertex.h:116
std::string histname
MonitorElement * Chi2oNDFVsEta
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:586
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:610
void undoSoftReset(DQMStore *dqmStore_)
int numberOfHits(HitCategory category) const
Definition: HitPattern.h:718
MonitorElement * NumberOfLayersPerTrackVsPhi
MonitorElement * LongDCASig
edm::EDGetTokenT< reco::VertexCollection > pvToken_
Definition: TrackAnalyzer.h:62
Definition: DDAxes.h:10
MonitorElement * Chi2oNDFVsPhi