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 = nullptr;
61  Chi2Prob = nullptr;
62  Chi2ProbVsPhi = nullptr;
63  Chi2ProbVsEta = nullptr;
64  Chi2oNDF = nullptr;
65  Chi2oNDFVsEta = nullptr;
66  Chi2oNDFVsPhi = nullptr;
67  Chi2oNDFVsTheta = nullptr;
68  Chi2oNDFVsTheta = nullptr;
69  Chi2oNDFVsPhi = nullptr;
70  Chi2oNDFVsEta = nullptr;
71 
72  NumberOfRecHitsPerTrack = nullptr;
75 
79 
81 
84 
85 
86  DistanceOfClosestApproach = nullptr;
92  xPointOfClosestApproach = nullptr;
95  yPointOfClosestApproach = nullptr;
98  zPointOfClosestApproach = nullptr;
100  algorithm = nullptr;
101  oriAlgo = nullptr;
102 
103  // TESTING
106 
107 // by Mia in order to deal w/ LS transitions
108  Chi2oNDF_lumiFlag = nullptr;
110 
112  //special Plots for HI DQM //SHOULD I ADD THE BOOL HERE??
114  LongDCASig = nullptr;
115  TransDCASig = nullptr;
116 
117 
118  // IP significance
119  sipDxyToBS = nullptr;
120  sipDzToBS = nullptr;
121  sip3dToPV = nullptr;
122  sip2dToPV = nullptr;
123  sipDxyToPV = nullptr;
124  sipDzToPV = nullptr;
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 = "NumberOfMissingInnerRecHitsPerTrack_";
237  NumberOfMIRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, 10, -0.5, 9.5);
238  NumberOfMIRecHitsPerTrack->setAxisTitle("Number of missing-inner RecHits for each Track");
239  NumberOfMIRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
240 
241  histname = "NumberOfMissingOuterRecHitsPerTrack_";
242  NumberOfMORecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, 10, -0.5, 9.5);
243  NumberOfMORecHitsPerTrack->setAxisTitle("Number of missing-outer RecHits for each Track");
244  NumberOfMORecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
245 
246 
248 
249  histname = "NumberOfValidRecHitVsPhiVsEtaPerTrack_";
250  NumberOfValidRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
251  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 40., "");
254 
255  histname = "NumberOfLostRecHitVsPhiVsEtaPerTrack_";
256  NumberOfLostRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
257  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 5., "");
260 
261 
262  histname = "NumberMIRecHitVsPhiVsEtaPerTrack_";
263  NumberOfMIRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
264  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 15., "");
267 
268  histname = "NumberMORecHitVsPhiVsEtaPerTrack_";
269  NumberOfMORecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
270  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 15., "");
273 
274 
275  }
276 
277  std::string layerTypeName[4] = {"","Off","3D","Missing"};
278  for (int i=0; i<4; ++i) {
279  histname = "NumberOf"+ layerTypeName[i] + "LayersPerTrack_";
280  NumberOfLayersPerTrack[i] = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKLayBin, TKLayMin, TKLayMax);
281  NumberOfLayersPerTrack[i]->setAxisTitle("Number of " + layerTypeName[i] + " Layers of each Track", 1);
282  NumberOfLayersPerTrack[i]->setAxisTitle("Number of Tracks", 2);
283  }
285  for (int i=0; i<4; ++i) {
286  histname = "NumberOf"+ layerTypeName[i] + "LayersVsPhiVsEtaPerTrack_";
287  NumberOfLayersVsPhiVsEtaPerTrack[i] = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
288  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 40., "");
289  NumberOfLayersVsPhiVsEtaPerTrack[i]->setAxisTitle("Track #eta ", 1);
290  NumberOfLayersVsPhiVsEtaPerTrack[i]->setAxisTitle("Track #phi ", 2);
291  }
292  }
293 
294  // book the General Property histograms
295  // ---------------------------------------------------------------------------------//
296 
298 
299  int Chi2Bin = conf_.getParameter<int>( "Chi2Bin");
300  double Chi2Min = conf_.getParameter<double>("Chi2Min");
301  double Chi2Max = conf_.getParameter<double>("Chi2Max");
302 
303  int Chi2NDFBin = conf_.getParameter<int>( "Chi2NDFBin");
304  double Chi2NDFMin = conf_.getParameter<double>("Chi2NDFMin");
305  double Chi2NDFMax = conf_.getParameter<double>("Chi2NDFMax");
306 
307  int Chi2ProbBin = conf_.getParameter<int>( "Chi2ProbBin");
308  double Chi2ProbMin = conf_.getParameter<double>("Chi2ProbMin");
309  double Chi2ProbMax = conf_.getParameter<double>("Chi2ProbMax");
310 
311 
312  //HI PLOTS////
313  int TransDCABins = conf_.getParameter<int>("TransDCABins");
314  double TransDCAMin = conf_.getParameter<double>("TransDCAMin");
315  double TransDCAMax = conf_.getParameter<double>("TransDCAMax");
316 
317  int LongDCABins = conf_.getParameter<int>("LongDCABins");
318  double LongDCAMin = conf_.getParameter<double>("LongDCAMin");
319  double LongDCAMax = conf_.getParameter<double>("LongDCAMax");
321 
322 
323  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
324 
325  histname = "Chi2_";
326  Chi2 = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2Bin, Chi2Min, Chi2Max);
327  Chi2->setAxisTitle("Track #chi^{2}" ,1);
328  Chi2->setAxisTitle("Number of Tracks",2);
329 
330  histname = "Chi2Prob_";
331  Chi2Prob = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2ProbBin, Chi2ProbMin, Chi2ProbMax);
332  Chi2Prob->setAxisTitle("Track #chi^{2} probability",1);
333  Chi2Prob->setAxisTitle("Number of Tracks" ,2);
334 
335  histname = "Chi2oNDF_";
336  Chi2oNDF = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax);
337  Chi2oNDF->setAxisTitle("Track #chi^{2}/ndf",1);
338  Chi2oNDF->setAxisTitle("Number of Tracks" ,2);
339 
340 
342  //HI PLOTS///
344  if (doHIPlots_)
345  {
346  histname = "LongDCASig_";
347  LongDCASig = ibooker.book1D(histname+CategoryName, histname+CategoryName,LongDCABins,LongDCAMin,LongDCAMax);
348  LongDCASig->setAxisTitle("dz/#sigma_{dz}",1);
349 
350  histname = "TransDCASig_";
351  TransDCASig = ibooker.book1D(histname+CategoryName,histname+CategoryName,TransDCABins,TransDCAMin,TransDCAMax);
352  TransDCASig->setAxisTitle("dxy/#sigma_{dxy}",1);
353  }
354 
355 
356 
358  histname = "xPointOfClosestApproach_";
359  xPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VXBin, VXMin, VXMax);
360  xPointOfClosestApproach->setAxisTitle("x component of Track PCA to beam line (cm)",1);
361  xPointOfClosestApproach->setAxisTitle("Number of Tracks",2);
362 
363  histname = "yPointOfClosestApproach_";
364  yPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VYBin, VYMin, VYMax);
365  yPointOfClosestApproach->setAxisTitle("y component of Track PCA to beam line (cm)",1);
366  yPointOfClosestApproach->setAxisTitle("Number of Tracks",2);
367 
368  histname = "zPointOfClosestApproach_";
369  zPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VZBin, VZMin, VZMax);
370  zPointOfClosestApproach->setAxisTitle("z component of Track PCA to beam line (cm)",1);
371  zPointOfClosestApproach->setAxisTitle("Number of Tracks",2);
372 
373  histname = "xPointOfClosestApproachToPV_";
374  xPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VXBin, VXMin, VXMax);
375  xPointOfClosestApproachToPV->setAxisTitle("x component of Track PCA to pv (cm)",1);
376  xPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2);
377 
378  histname = "yPointOfClosestApproachToPV_";
379  yPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VYBin, VYMin, VYMax);
380  yPointOfClosestApproachToPV->setAxisTitle("y component of Track PCA to pv line (cm)",1);
381  yPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2);
382 
383  histname = "zPointOfClosestApproachToPV_";
384  zPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VZBin, VZMin, VZMax);
385  zPointOfClosestApproachToPV->setAxisTitle("z component of Track PCA to pv line (cm)",1);
386  zPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2);
387  }
388 
389  // See DataFormats/TrackReco/interface/TrackBase.h for track algorithm enum definition
390  // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/DataFormats/TrackReco/interface/TrackBase.h?view=log
391  histname = "algorithm_";
392  algorithm = ibooker.book1D(histname+CategoryName, histname+CategoryName, reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize));
393  algorithm->setAxisTitle("Tracking algorithm",1);
394  algorithm->setAxisTitle("Number of Tracks",2);
395  histname = "originalAlgorithm_";
396  oriAlgo = ibooker.book1D(histname+CategoryName, histname+CategoryName, reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize));
397  oriAlgo->setAxisTitle("Tracking algorithm",1);
398  oriAlgo->setAxisTitle("Number of Tracks",2);
399 
400  for (size_t ibin=0; ibin<reco::TrackBase::algoSize-1; ibin++) {
403  }
404  }
405 
406 }
407 
409 
410  // parameters from the configuration
411  std::string QualName = conf_.getParameter<std::string>("Quality");
413 
414  // use the AlgoName and Quality Name
415  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
416 
417 
418  // book LS analysis related histograms
419  // -----------------------------------
420  if ( doLumiAnalysis_ ) {
421 
422  // get binning from the configuration
423  int TKHitBin = conf_.getParameter<int>( "RecHitBin");
424  double TKHitMin = conf_.getParameter<double>("RecHitMin");
425  double TKHitMax = conf_.getParameter<double>("RecHitMax");
426 
427  int Chi2NDFBin = conf_.getParameter<int>( "Chi2NDFBin");
428  double Chi2NDFMin = conf_.getParameter<double>("Chi2NDFMin");
429  double Chi2NDFMax = conf_.getParameter<double>("Chi2NDFMax");
430 
431  // add by Mia in order to deal w/ LS transitions
432  ibooker.setCurrentFolder(TopFolder_+"/LSanalysis");
433 
434  histname = "NumberOfRecHitsPerTrack_lumiFlag_";
435  NumberOfRecHitsPerTrack_lumiFlag = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax);
436  NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of all RecHits of each Track");
437  NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of Tracks", 2);
438 
439  histname = "Chi2oNDF_lumiFlag_";
440  Chi2oNDF_lumiFlag = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax);
441  Chi2oNDF_lumiFlag->setAxisTitle("Track #chi^{2}/ndf",1);
442  Chi2oNDF_lumiFlag->setAxisTitle("Number of Tracks" ,2);
443 
444  }
445 }
446 
448 
449  // parameters from the configuration
450  std::string QualName = conf_.getParameter<std::string>("Quality");
452 
453  // use the AlgoName and Quality Name
454  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
455 
456  // book the Beam Spot related histograms
457  // ---------------------------------------------------------------------------------//
458 
460 
461  int DxyBin = conf_.getParameter<int>( "DxyBin");
462  double DxyMin = conf_.getParameter<double>("DxyMin");
463  double DxyMax = conf_.getParameter<double>("DxyMax");
464 
465  int PhiBin = conf_.getParameter<int>( "PhiBin");
466  double PhiMin = conf_.getParameter<double>("PhiMin");
467  double PhiMax = conf_.getParameter<double>("PhiMax");
468 
469  int X0Bin = conf_.getParameter<int>( "X0Bin");
470  double X0Min = conf_.getParameter<double>("X0Min");
471  double X0Max = conf_.getParameter<double>("X0Max");
472 
473  int Y0Bin = conf_.getParameter<int>( "Y0Bin");
474  double Y0Min = conf_.getParameter<double>("Y0Min");
475  double Y0Max = conf_.getParameter<double>("Y0Max");
476 
477  int Z0Bin = conf_.getParameter<int>( "Z0Bin");
478  double Z0Min = conf_.getParameter<double>("Z0Min");
479  double Z0Max = conf_.getParameter<double>("Z0Max");
480 
481  int VZBinProf = conf_.getParameter<int>( "VZBinProf");
482  double VZMinProf = conf_.getParameter<double>("VZMinProf");
483  double VZMaxProf = conf_.getParameter<double>("VZMaxProf");
484 
485 
486  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
487 
488  histname = "DistanceOfClosestApproachToBS_";
489  DistanceOfClosestApproachToBS = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax);
490  DistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1);
491  DistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2);
492 
493  histname = "DistanceOfClosestApproachToBSVsPhi_";
494  DistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,"");
495  DistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes);
497  DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2);
498 
499  histname = "xPointOfClosestApproachVsZ0wrt000_";
500  xPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,"");
502  xPointOfClosestApproachVsZ0wrt000->setAxisTitle("x component of Track PCA to beam line (cm)",2);
503 
504  histname = "yPointOfClosestApproachVsZ0wrt000_";
505  yPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,"");
507  yPointOfClosestApproachVsZ0wrt000->setAxisTitle("y component of Track PCA to beam line (cm)",2);
508 
509  histname = "xPointOfClosestApproachVsZ0wrtBS_";
510  xPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,"");
511  xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1);
512  xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("x component of Track PCA to BS (cm)",2);
513 
514  histname = "yPointOfClosestApproachVsZ0wrtBS_";
515  yPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,"");
516  yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1);
517  yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("y component of Track PCA to BS (cm)",2);
518 
519  histname = "zPointOfClosestApproachVsPhi_";
520  zPointOfClosestApproachVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, VZBinProf, VZMinProf, VZMaxProf, "");
522  zPointOfClosestApproachVsPhi->setAxisTitle("y component of Track PCA to beam line (cm)",2);
523  }
524 
526 
527  int DxyBin = conf_.getParameter<int>( "DxyBin");
528  double DxyMin = conf_.getParameter<double>("DxyMin");
529  double DxyMax = conf_.getParameter<double>("DxyMax");
530 
531  int PhiBin = conf_.getParameter<int>( "PhiBin");
532  double PhiMin = conf_.getParameter<double>("PhiMin");
533  double PhiMax = conf_.getParameter<double>("PhiMax");
534 
535  int X0Bin = conf_.getParameter<int>( "X0Bin");
536  double X0Min = conf_.getParameter<double>("X0Min");
537  double X0Max = conf_.getParameter<double>("X0Max");
538 
539  int Y0Bin = conf_.getParameter<int>( "Y0Bin");
540  double Y0Min = conf_.getParameter<double>("Y0Min");
541  double Y0Max = conf_.getParameter<double>("Y0Max");
542 
543  int Z0Bin = conf_.getParameter<int>( "Z0Bin");
544  double Z0Min = conf_.getParameter<double>("Z0Min");
545  double Z0Max = conf_.getParameter<double>("Z0Max");
546 
547  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
548 
549  histname = "DistanceOfClosestApproachToPV_";
550  DistanceOfClosestApproachToPV = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax);
551  DistanceOfClosestApproachToPV->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1);
552  DistanceOfClosestApproachToPV->setAxisTitle("Number of Tracks",2);
553 
554  histname = "DistanceOfClosestApproachToPVVsPhi_";
555  DistanceOfClosestApproachToPVVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,"");
556  DistanceOfClosestApproachToPVVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes);
558  DistanceOfClosestApproachToPVVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2);
559 
560  histname = "xPointOfClosestApproachVsZ0wrtPV_";
561  xPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,"");
562  xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1);
563  xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("x component of Track PCA to PV (cm)",2);
564 
565  histname = "yPointOfClosestApproachVsZ0wrtPV_";
566  yPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,"");
567  yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1);
568  yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("y component of Track PCA to PV (cm)",2);
569 
570  }
571 
572  if (doBSPlots_ || doAllPlots_) {
573  if (doTestPlots_) {
574 
575  int DxyBin = conf_.getParameter<int>( "DxyBin");
576  double DxyMin = conf_.getParameter<double>("DxyMin");
577  double DxyMax = conf_.getParameter<double>("DxyMax");
578 
579  int PhiBin = conf_.getParameter<int>( "PhiBin");
580  double PhiMin = conf_.getParameter<double>("PhiMin");
581  double PhiMax = conf_.getParameter<double>("PhiMax");
582 
583  histname = "TESTDistanceOfClosestApproachToBS_";
584  TESTDistanceOfClosestApproachToBS = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax);
585  TESTDistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1);
586  TESTDistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2);
587 
588  histname = "TESTDistanceOfClosestApproachToBSVsPhi_";
589  TESTDistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,"");
590  TESTDistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes);
592  TESTDistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2);
593 
594  }
595 
596  }
597 
598  // book the Profile plots for DCA related histograms
599  // ---------------------------------------------------------------------------------//
600  if(doDCAPlots_ || doAllPlots_) {
601 
602  if (doDCAwrt000Plots_) {
603 
604  int EtaBin = conf_.getParameter<int>( "EtaBin");
605  double EtaMin = conf_.getParameter<double>("EtaMin");
606  double EtaMax = conf_.getParameter<double>("EtaMax");
607 
608  int PhiBin = conf_.getParameter<int>( "PhiBin");
609  double PhiMin = conf_.getParameter<double>("PhiMin");
610  double PhiMax = conf_.getParameter<double>("PhiMax");
611 
612  int DxyBin = conf_.getParameter<int>( "DxyBin");
613  double DxyMin = conf_.getParameter<double>("DxyMin");
614  double DxyMax = conf_.getParameter<double>("DxyMax");
615 
616  if (doThetaPlots_) {
617  int ThetaBin = conf_.getParameter<int>( "ThetaBin");
618  double ThetaMin = conf_.getParameter<double>("ThetaMin");
619  double ThetaMax = conf_.getParameter<double>("ThetaMax");
620 
621  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
622  histname = "DistanceOfClosestApproachVsTheta_";
623  DistanceOfClosestApproachVsTheta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, ThetaBin, ThetaMin, ThetaMax, DxyMin,DxyMax,"");
625  DistanceOfClosestApproachVsTheta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2);
626  }
627 
628  histname = "DistanceOfClosestApproachVsEta_";
629  DistanceOfClosestApproachVsEta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, EtaBin, EtaMin, EtaMax, DxyMin, DxyMax,"");
631  DistanceOfClosestApproachVsEta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2);
632  // temporary patch in order to put back those MEs in Muon Workspace
633 
634  histname = "DistanceOfClosestApproach_";
635  DistanceOfClosestApproach = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax);
636  DistanceOfClosestApproach->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",1);
637  DistanceOfClosestApproach->setAxisTitle("Number of Tracks",2);
638 
639  histname = "DistanceOfClosestApproachVsPhi_";
640  DistanceOfClosestApproachVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyMin,DxyMax,"");
641  DistanceOfClosestApproachVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes);
643  DistanceOfClosestApproachVsPhi->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2);
644  }
645  }
646 
647 
648  if (doSIPPlots_ || doAllPlots_) {
649  const double sipBins = 200;
650  const double sipMin = -20;
651  const double sipMax = 20;
652 
653  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
654 
655  // SIP wrt. beamspot
656  histname = "SIPDxyToBS_";
657  sipDxyToBS = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
658  sipDxyToBS->setAxisTitle("Track dxy significance wrt beam spot",1);
659  sipDxyToBS->setAxisTitle("Number of Tracks",2);
660 
661  histname = "SIPDzToBS_";
662  sipDzToBS = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
663  sipDzToBS->setAxisTitle("Track dz significance wrt beam spot",1);
664  sipDzToBS->setAxisTitle("Number of Tracks",2);
665 
666  // SIP wrt. vertex
667  histname = "SIP3DToPV_";
668  sip3dToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
669  sip3dToPV->setAxisTitle("3D IP significance wrt primary vertex",1);
670  sip3dToPV->setAxisTitle("Number of Tracks",2);
671 
672  histname = "SIP2DToPV_";
673  sip2dToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
674  sip2dToPV->setAxisTitle("2D IP significance wrt primary vertex",1);
675  sip2dToPV->setAxisTitle("Number of Tracks",2);
676 
677  histname = "SIPDxyToPV_";
678  sipDxyToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
679  sipDxyToPV->setAxisTitle("Track dxy significance wrt primary vertex",1);
680  sipDxyToPV->setAxisTitle("Number of Tracks",2);
681 
682  histname = "SIPDzToPV_";
683  sipDzToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
684  sipDzToPV->setAxisTitle("Track dz significance wrt primary vertex",1);
685  sipDzToPV->setAxisTitle("Number of Tracks",2);
686  }
687 }
688 
689 // -- Analyse
690 // ---------------------------------------------------------------------------------//
691 void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track)
692 {
693  double phi = track.phi();
694  // double eta = track.eta();
695  auto phiIn = track.innerPosition().phi();
696  auto etaIn = track.innerPosition().eta();
697  auto phiOut = track.outerPosition().phi();
698  auto etaOut = track.outerPosition().eta();
699 
700  int nRecHits = track.hitPattern().numberOfHits(reco::HitPattern::TRACK_HITS);
701  int nValidRecHits = track.numberOfValidHits();
702  int nLostRecHits = track.numberOfLostHits();
705 
706  double chi2 = track.chi2();
707  double chi2prob = TMath::Prob(track.chi2(),(int)track.ndof());
708  double chi2oNDF = track.normalizedChi2();
709 
711  // rec hits
712  NumberOfRecHitsPerTrack -> Fill(nRecHits);
713  NumberOfValidRecHitsPerTrack-> Fill(nValidRecHits);
714  NumberOfLostRecHitsPerTrack -> Fill(nLostRecHits);
715  NumberOfMIRecHitsPerTrack -> Fill(nLostIn);
716  NumberOfMORecHitsPerTrack -> Fill(nLostOut);
717 
718  // 2D plots
720  NumberOfValidRecHitVsPhiVsEtaPerTrack->Fill(etaIn,phiIn,nValidRecHits);
721  NumberOfLostRecHitVsPhiVsEtaPerTrack->Fill(etaIn,phiIn,nLostRecHits);
722  NumberOfMIRecHitVsPhiVsEtaPerTrack->Fill(etaIn,phiIn,nLostIn);
723  NumberOfMORecHitVsPhiVsEtaPerTrack->Fill(etaOut,phiOut,nLostOut);
724  }
725 
726  int nLayers[4] = { track.hitPattern().trackerLayersWithMeasurement(),
730  };
731 
732  // layers
733  for (int i=0;i<4;++i) NumberOfLayersPerTrack[i]->Fill(nLayers[i]);
734 
735  // 2D plots
737  for (int i=0;i<4;++i) NumberOfLayersVsPhiVsEtaPerTrack[i]->Fill(etaIn,phiIn,nLayers[i]);
738  }
739 
741  // fitting
742  Chi2 -> Fill(chi2);
743  Chi2Prob -> Fill(chi2prob);
744  Chi2oNDF -> Fill(chi2oNDF);
745 
746  // DCA
747  // temporary patch in order to put back those MEs in Muon Workspace
748  if (doDCAPlots_) {
749  if (doDCAwrt000Plots_) {
751  DistanceOfClosestApproachVsPhi->Fill(phi, track.dxy());
752  }
753 
754  // PCA
758  }
759 
760  // algorithm
761  algorithm->Fill(static_cast<double>(track.algo()));
762  oriAlgo->Fill(static_cast<double>(track.originalAlgo()));
763  }
764 
765  if ( doLumiAnalysis_ ) {
767  Chi2oNDF_lumiFlag -> Fill(chi2oNDF);
768  }
769 
771 
772  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
773  iEvent.getByToken(beamSpotToken_,recoBeamSpotHandle);
774  const reco::BeamSpot& bs = *recoBeamSpotHandle;
775 
777  DistanceOfClosestApproachToBSVsPhi -> Fill(track.phi(), track.dxy(bs.position()));
778  zPointOfClosestApproachVsPhi -> Fill(track.phi(), track.vz());
779  xPointOfClosestApproachVsZ0wrt000 -> Fill(track.dz(), track.vx());
780  yPointOfClosestApproachVsZ0wrt000 -> Fill(track.dz(), track.vy());
781  xPointOfClosestApproachVsZ0wrtBS -> Fill(track.dz(bs.position()),(track.vx()-bs.position(track.vz()).x()));
782  yPointOfClosestApproachVsZ0wrtBS -> Fill(track.dz(bs.position()),(track.vy()-bs.position(track.vz()).y()));
783  if (doTestPlots_) {
784  TESTDistanceOfClosestApproachToBS -> Fill(track.dxy(bs.position(track.vz())));
785  TESTDistanceOfClosestApproachToBSVsPhi -> Fill(track.phi(), track.dxy(bs.position(track.vz())));
786  }
787 
788  if(doSIPPlots_) {
789  sipDxyToBS->Fill(track.dxy(bs.position())/track.dxyError());
790  sipDzToBS->Fill(track.dz(bs.position())/track.dzError());
791  }
792  }
793 
795  edm::Handle<reco::VertexCollection> recoPrimaryVerticesHandle;
796  iEvent.getByToken(pvToken_,recoPrimaryVerticesHandle);
797  if (recoPrimaryVerticesHandle->size() > 0) {
798  const reco::Vertex& pv = (*recoPrimaryVerticesHandle)[0];
799 
800 
802  //HI PLOTS///////
804 
805  if(doHIPlots_)
806  {
807  double longDCAsig = 0, transDCAsig = 0;
808  double zerr2 = track.dzError()*track.dzError()+pv.zError()*pv.zError();
809  double xyerr2 = track.d0Error()*track.d0Error()+pv.xError()*pv.yError();
810  if(zerr2 > 0) longDCAsig = track.dz(pv.position())/zerr2;
811  if(xyerr2 > 0) transDCAsig = track.dxy(pv.position())/xyerr2;
812  LongDCASig->Fill(longDCAsig);
813  TransDCASig->Fill(transDCAsig);
814  }
815 
816 
817  xPointOfClosestApproachToPV->Fill(track.vx()-pv.position().x());
818  yPointOfClosestApproachToPV->Fill(track.vy()-pv.position().y());
821  DistanceOfClosestApproachToPVVsPhi -> Fill(track.phi(), track.dxy(pv.position()));
822  xPointOfClosestApproachVsZ0wrtPV -> Fill(track.dz(pv.position()),(track.vx()-pv.position().x()));
823  yPointOfClosestApproachVsZ0wrtPV -> Fill(track.dz(pv.position()),(track.vy()-pv.position().y()));
824 
825 
826  if(doSIPPlots_) {
828  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
829  reco::TransientTrack transTrack = theB->build(track);
830 
831  GlobalVector dir(track.px(), track.py(), track.pz());
832  std::pair<bool, Measurement1D> ip3d = IPTools::signedImpactParameter3D(transTrack, dir, pv);
833  std::pair<bool, Measurement1D> ip2d = IPTools::signedTransverseImpactParameter(transTrack, dir, pv);
834  if(ip3d.first) sip3dToPV->Fill(ip3d.second.value() / ip3d.second.error());
835  if(ip2d.first) sip2dToPV->Fill(ip2d.second.value() / ip2d.second.error());
836  sipDxyToPV->Fill(track.dxy(pv.position())/track.dxyError());
837  sipDzToPV->Fill(track.dz(pv.position())/track.dzError());
838  }
839  }
840  }
841 
842  if(doDCAPlots_ || doAllPlots_) {
843  if (doDCAwrt000Plots_) {
844  if (doThetaPlots_) {
845  DistanceOfClosestApproachVsTheta->Fill(track.theta(), track.d0());
846  }
847  DistanceOfClosestApproachVsEta->Fill(track.eta(), track.d0());
848  }
849 
850  }
851 
852  //Tracker Specific Histograms
855  }
856 
858  std::string StateName = conf_.getParameter<std::string>("MeasurementState");
859 
860  if (StateName == "All") {
861  fillHistosForState(iSetup, track, std::string("OuterSurface"));
862  fillHistosForState(iSetup, track, std::string("InnerSurface"));
863  fillHistosForState(iSetup, track, std::string("ImpactPoint"));
864  } else if (
865  StateName != "OuterSurface" &&
866  StateName != "InnerSurface" &&
867  StateName != "ImpactPoint" &&
868  StateName != "default"
869  ) {
870  fillHistosForState(iSetup, track, std::string("default"));
871  } else {
872  fillHistosForState(iSetup, track, StateName);
873  }
874  }
875 
876  if ( doAllPlots_ ) {
877  }
878 
879 }
880 
881 // book histograms at differnt measurement points
882 // ---------------------------------------------------------------------------------//
884 {
885 
886  // parameters from the configuration
887  std::string QualName = conf_.getParameter<std::string>("Quality");
889 
890  // use the AlgoName and Quality Name
891  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
892 
893  // get binning from the configuration
894  double Chi2NDFMin = conf_.getParameter<double>("Chi2NDFMin");
895  double Chi2NDFMax = conf_.getParameter<double>("Chi2NDFMax");
896 
897  int RecHitBin = conf_.getParameter<int>( "RecHitBin");
898  double RecHitMin = conf_.getParameter<double>("RecHitMin");
899  double RecHitMax = conf_.getParameter<double>("RecHitMax");
900 
901  int RecLayBin = conf_.getParameter<int>( "RecHitBin");
902  double RecLayMin = conf_.getParameter<double>("RecHitMin");
903  double RecLayMax = conf_.getParameter<double>("RecHitMax");
904 
905 
906  int PhiBin = conf_.getParameter<int>( "PhiBin");
907  double PhiMin = conf_.getParameter<double>("PhiMin");
908  double PhiMax = conf_.getParameter<double>("PhiMax");
909 
910  int EtaBin = conf_.getParameter<int>( "EtaBin");
911  double EtaMin = conf_.getParameter<double>("EtaMin");
912  double EtaMax = conf_.getParameter<double>("EtaMax");
913 
914  int ThetaBin = conf_.getParameter<int>( "ThetaBin");
915  double ThetaMin = conf_.getParameter<double>("ThetaMin");
916  double ThetaMax = conf_.getParameter<double>("ThetaMax");
917 
918  int TrackQBin = conf_.getParameter<int>( "TrackQBin");
919  double TrackQMin = conf_.getParameter<double>("TrackQMin");
920  double TrackQMax = conf_.getParameter<double>("TrackQMax");
921 
922  int TrackPtBin = conf_.getParameter<int>( "TrackPtBin");
923  double TrackPtMin = conf_.getParameter<double>("TrackPtMin");
924  double TrackPtMax = conf_.getParameter<double>("TrackPtMax");
925 
926  int TrackPBin = conf_.getParameter<int>( "TrackPBin");
927  double TrackPMin = conf_.getParameter<double>("TrackPMin");
928  double TrackPMax = conf_.getParameter<double>("TrackPMax");
929 
930  int TrackPxBin = conf_.getParameter<int>( "TrackPxBin");
931  double TrackPxMin = conf_.getParameter<double>("TrackPxMin");
932  double TrackPxMax = conf_.getParameter<double>("TrackPxMax");
933 
934  int TrackPyBin = conf_.getParameter<int>( "TrackPyBin");
935  double TrackPyMin = conf_.getParameter<double>("TrackPyMin");
936  double TrackPyMax = conf_.getParameter<double>("TrackPyMax");
937 
938  int TrackPzBin = conf_.getParameter<int>( "TrackPzBin");
939  double TrackPzMin = conf_.getParameter<double>("TrackPzMin");
940  double TrackPzMax = conf_.getParameter<double>("TrackPzMax");
941 
942  int ptErrBin = conf_.getParameter<int>( "ptErrBin");
943  double ptErrMin = conf_.getParameter<double>("ptErrMin");
944  double ptErrMax = conf_.getParameter<double>("ptErrMax");
945 
946  int pxErrBin = conf_.getParameter<int>( "pxErrBin");
947  double pxErrMin = conf_.getParameter<double>("pxErrMin");
948  double pxErrMax = conf_.getParameter<double>("pxErrMax");
949 
950  int pyErrBin = conf_.getParameter<int>( "pyErrBin");
951  double pyErrMin = conf_.getParameter<double>("pyErrMin");
952  double pyErrMax = conf_.getParameter<double>("pyErrMax");
953 
954  int pzErrBin = conf_.getParameter<int>( "pzErrBin");
955  double pzErrMin = conf_.getParameter<double>("pzErrMin");
956  double pzErrMax = conf_.getParameter<double>("pzErrMax");
957 
958  int pErrBin = conf_.getParameter<int>( "pErrBin");
959  double pErrMin = conf_.getParameter<double>("pErrMin");
960  double pErrMax = conf_.getParameter<double>("pErrMax");
961 
962  int phiErrBin = conf_.getParameter<int>( "phiErrBin");
963  double phiErrMin = conf_.getParameter<double>("phiErrMin");
964  double phiErrMax = conf_.getParameter<double>("phiErrMax");
965 
966  int etaErrBin = conf_.getParameter<int>( "etaErrBin");
967  double etaErrMin = conf_.getParameter<double>("etaErrMin");
968  double etaErrMax = conf_.getParameter<double>("etaErrMax");
969 
970 
971  double Chi2ProbMin = conf_.getParameter<double>("Chi2ProbMin");
972  double Chi2ProbMax = conf_.getParameter<double>("Chi2ProbMax");
973 
974  ibooker.setCurrentFolder(TopFolder_);
975 
976  TkParameterMEs tkmes;
977 
978  std::string histTag = (sname == "default") ? CategoryName : sname + "_" + CategoryName;
979 
980  if(doAllPlots_) {
981 
982  // general properties
983  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
984 
985  if (doThetaPlots_) {
986  histname = "Chi2oNDFVsTheta_" + histTag;
987  tkmes.Chi2oNDFVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax,"");
988  tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta",1);
989  tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf",2);
990  }
991  histname = "Chi2oNDFVsPhi_" + histTag;
992  tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax,"");
993  tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi",1);
994  tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf",2);
995 
996  histname = "Chi2oNDFVsEta_" + histTag;
997  tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax,"");
998  tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta",1);
999  tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf",2);
1000 
1001  histname = "Chi2ProbVsPhi_" + histTag;
1002  tkmes.Chi2ProbVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax);
1003  tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi" ,1);
1004  tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability",2);
1005 
1006  histname = "Chi2ProbVsEta_" + histTag;
1007  tkmes.Chi2ProbVsEta = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax);
1008  tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta" ,1);
1009  tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability",2);
1010 
1011  }
1012 
1013  // general properties
1014  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
1015 
1016  histname = "TrackP_" + histTag;
1017  tkmes.TrackP = ibooker.book1D(histname, histname, TrackPBin, TrackPMin, TrackPMax);
1018  tkmes.TrackP->setAxisTitle("Track |p| (GeV/c)", 1);
1019  tkmes.TrackP->setAxisTitle("Number of Tracks",2);
1020 
1021  histname = "TrackPt_" + histTag;
1022  tkmes.TrackPt = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax);
1023  tkmes.TrackPt->setAxisTitle("Track p_{T} (GeV/c)", 1);
1024  tkmes.TrackPt->setAxisTitle("Number of Tracks",2);
1025 
1026  if (doTrackPxPyPlots_) {
1027  histname = "TrackPx_" + histTag;
1028  tkmes.TrackPx = ibooker.book1D(histname, histname, TrackPxBin, TrackPxMin, TrackPxMax);
1029  tkmes.TrackPx->setAxisTitle("Track p_{x} (GeV/c)", 1);
1030  tkmes.TrackPx->setAxisTitle("Number of Tracks",2);
1031 
1032  histname = "TrackPy_" + histTag;
1033  tkmes.TrackPy = ibooker.book1D(histname, histname, TrackPyBin, TrackPyMin, TrackPyMax);
1034  tkmes.TrackPy->setAxisTitle("Track p_{y} (GeV/c)", 1);
1035  tkmes.TrackPy->setAxisTitle("Number of Tracks",2);
1036  }
1037  histname = "TrackPz_" + histTag;
1038  tkmes.TrackPz = ibooker.book1D(histname, histname, TrackPzBin, TrackPzMin, TrackPzMax);
1039  tkmes.TrackPz->setAxisTitle("Track p_{z} (GeV/c)", 1);
1040  tkmes.TrackPz->setAxisTitle("Number of Tracks",2);
1041 
1042  histname = "TrackPhi_" + histTag;
1043  tkmes.TrackPhi = ibooker.book1D(histname, histname, PhiBin, PhiMin, PhiMax);
1044  tkmes.TrackPhi->setAxisTitle("Track #phi", 1);
1045  tkmes.TrackPhi->setAxisTitle("Number of Tracks",2);
1046 
1047  histname = "TrackEta_" + histTag;
1048  tkmes.TrackEta = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax);
1049  tkmes.TrackEta->setAxisTitle("Track #eta", 1);
1050  tkmes.TrackEta->setAxisTitle("Number of Tracks",2);
1051 
1052  if (doThetaPlots_) {
1053  histname = "TrackTheta_" + histTag;
1054  tkmes.TrackTheta = ibooker.book1D(histname, histname, ThetaBin, ThetaMin, ThetaMax);
1055  tkmes.TrackTheta->setAxisTitle("Track #theta", 1);
1056  tkmes.TrackTheta->setAxisTitle("Number of Tracks",2);
1057  }
1058  histname = "TrackQ_" + histTag;
1059  tkmes.TrackQ = ibooker.book1D(histname, histname, TrackQBin, TrackQMin, TrackQMax);
1060  tkmes.TrackQ->setAxisTitle("Track Charge", 1);
1061  tkmes.TrackQ->setAxisTitle("Number of Tracks",2);
1062 
1063  histname = "TrackPErrOverP_" + histTag;
1064  tkmes.TrackPErr = ibooker.book1D(histname, histname, pErrBin, pErrMin, pErrMax);
1065  tkmes.TrackPErr->setAxisTitle("track error(p)/p", 1);
1066  tkmes.TrackPErr->setAxisTitle("Number of Tracks",2);
1067 
1068  histname = "TrackPtErrOverPt_" + histTag;
1069  tkmes.TrackPtErr = ibooker.book1D(histname, histname, ptErrBin, ptErrMin, ptErrMax);
1070  tkmes.TrackPtErr->setAxisTitle("track error(p_{T})/p_{T}", 1);
1071  tkmes.TrackPtErr->setAxisTitle("Number of Tracks",2);
1072 
1073  histname = "TrackPtErrOverPtVsEta_" + histTag;
1074  tkmes.TrackPtErrVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, ptErrMin, ptErrMax);
1075  tkmes.TrackPtErrVsEta->setAxisTitle("Track #eta",1);
1076  tkmes.TrackPtErrVsEta->setAxisTitle("track error(p_{T})/p_{T}", 2);
1077 
1078  if (doTrackPxPyPlots_) {
1079  histname = "TrackPxErrOverPx_" + histTag;
1080  tkmes.TrackPxErr = ibooker.book1D(histname, histname, pxErrBin, pxErrMin, pxErrMax);
1081  tkmes.TrackPxErr->setAxisTitle("track error(p_{x})/p_{x}", 1);
1082  tkmes.TrackPxErr->setAxisTitle("Number of Tracks",2);
1083 
1084  histname = "TrackPyErrOverPy_" + histTag;
1085  tkmes.TrackPyErr = ibooker.book1D(histname, histname, pyErrBin, pyErrMin, pyErrMax);
1086  tkmes.TrackPyErr->setAxisTitle("track error(p_{y})/p_{y}", 1);
1087  tkmes.TrackPyErr->setAxisTitle("Number of Tracks",2);
1088  }
1089  histname = "TrackPzErrOverPz_" + histTag;
1090  tkmes.TrackPzErr = ibooker.book1D(histname, histname, pzErrBin, pzErrMin, pzErrMax);
1091  tkmes.TrackPzErr->setAxisTitle("track error(p_{z})/p_{z}", 1);
1092  tkmes.TrackPzErr->setAxisTitle("Number of Tracks",2);
1093 
1094  histname = "TrackPhiErr_" + histTag;
1095  tkmes.TrackPhiErr = ibooker.book1D(histname, histname, phiErrBin, phiErrMin, phiErrMax);
1096  tkmes.TrackPhiErr->setAxisTitle("track error(#phi)");
1097  tkmes.TrackPhiErr->setAxisTitle("Number of Tracks",2);
1098 
1099  histname = "TrackEtaErr_" + histTag;
1100  tkmes.TrackEtaErr = ibooker.book1D(histname, histname, etaErrBin, etaErrMin, etaErrMax);
1101  tkmes.TrackEtaErr->setAxisTitle("track error(#eta)");
1102  tkmes.TrackEtaErr->setAxisTitle("Number of Tracks",2);
1103 
1104  // rec hit profiles
1105  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
1106  histname = "NumberOfRecHitsPerTrackVsPhi_" + histTag;
1107  tkmes.NumberOfRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitBin, RecHitMin, RecHitMax,"");
1108  tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1);
1109  tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of RecHits in each Track",2);
1110 
1111  if (doThetaPlots_) {
1112  histname = "NumberOfRecHitsPerTrackVsTheta_" + histTag;
1113  tkmes.NumberOfRecHitsPerTrackVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecHitBin, RecHitMin, RecHitMax,"");
1114  tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Track #phi",1);
1115  tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Number of RecHits in each Track",2);
1116  }
1117  histname = "NumberOfRecHitsPerTrackVsEta_" + histTag;
1118  tkmes.NumberOfRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitBin, RecHitMin, RecHitMax,"");
1119  tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1);
1120  tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of RecHits in each Track",2);
1121 
1122  histname = "NumberOfValidRecHitsPerTrackVsPhi_" + histTag;
1123  tkmes.NumberOfValidRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitMin, RecHitMax,"");
1124  tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1);
1125  tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Number of valid RecHits in each Track",2);
1126 
1127  // std::cout << "[TrackAnalyzer::bookHistosForState] histTag: " << histTag << std::endl;
1128  histname = "NumberOfValidRecHitsPerTrackVsEta_" + histTag;
1129  tkmes.NumberOfValidRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitMin, RecHitMax,"");
1130  tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1);
1131  tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Number of valid RecHits in each Track",2);
1132 
1134  histname = "NumberOfLayersPerTrackVsPhi_" + histTag;
1135  tkmes.NumberOfLayersPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecLayBin, RecLayMin, RecLayMax,"");
1136  tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi",1);
1137  tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of Layers in each Track",2);
1138 
1139  if (doThetaPlots_) {
1140  histname = "NumberOfLayersPerTrackVsTheta_" + histTag;
1141  tkmes.NumberOfLayersPerTrackVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecLayBin, RecLayMin, RecLayMax,"");
1142  tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Track #phi",1);
1143  tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Number of Layers in each Track",2);
1144  }
1145  histname = "NumberOfLayersPerTrackVsEta_" + histTag;
1146  tkmes.NumberOfLayersPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecLayBin, RecLayMin, RecLayMax,"");
1147  tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta",1);
1148  tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of Layers in each Track",2);
1149 
1150  if (doThetaPlots_) {
1151  histname = "Chi2oNDFVsTheta_" + histTag;
1152  tkmes.Chi2oNDFVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax,"");
1153  tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta",1);
1154  tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf",2);
1155  }
1156  if (doAllPlots_) {
1157  histname = "Chi2oNDFVsPhi_" + histTag;
1158  tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax,"");
1159  tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi",1);
1160  tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf",2);
1161 
1162  histname = "Chi2oNDFVsEta_" + histTag;
1163  tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax,"");
1164  tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta",1);
1165  tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf",2);
1166 
1167  histname = "Chi2ProbVsPhi_" + histTag;
1168  tkmes.Chi2ProbVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax);
1169  tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi" ,1);
1170  tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability",2);
1171 
1172  histname = "Chi2ProbVsEta_" + histTag;
1173  tkmes.Chi2ProbVsEta = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax);
1174  tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta" ,1);
1175  tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability",2);
1176  }
1177 
1178  // now put the MEs in the map
1179  TkParameterMEMap.insert( std::make_pair(sname, tkmes) );
1180 
1181 }
1182 
1183 
1184 // fill histograms at differnt measurement points
1185 // ---------------------------------------------------------------------------------//
1187 {
1188  //get the kinematic parameters
1189  double p, px, py, pz, pt, theta, phi, eta, q;
1190  double pxerror, pyerror, pzerror, pterror, perror, phierror, etaerror;
1191 
1192  if (sname == "default") {
1193 
1194  p = track.p();
1195  px = track.px();
1196  py = track.py();
1197  pz = track.pz();
1198  pt = track.pt();
1199  phi = track.phi();
1200  theta = track.theta();
1201  eta = track.eta();
1202  q = track.charge();
1203 
1204  pterror = (pt) ? track.ptError()/(pt*pt) : 0.0;
1205  pxerror = -1.0;
1206  pyerror = -1.0;
1207  pzerror = -1.0;
1208  perror = -1.0;
1209  phierror = track.phiError();
1210  etaerror = track.etaError();
1211 
1212  } else {
1213 
1215  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
1216  reco::TransientTrack TransTrack = theB->build(track);
1217 
1219 
1220  if (sname == "OuterSurface") TSOS = TransTrack.outermostMeasurementState();
1221  else if (sname == "InnerSurface") TSOS = TransTrack.innermostMeasurementState();
1222  else if (sname == "ImpactPoint") TSOS = TransTrack.impactPointState();
1223 
1224  p = TSOS.globalMomentum().mag();
1225  px = TSOS.globalMomentum().x();
1226  py = TSOS.globalMomentum().y();
1227  pz = TSOS.globalMomentum().z();
1228  pt = TSOS.globalMomentum().perp();
1229  phi = TSOS.globalMomentum().phi();
1230  theta = TSOS.globalMomentum().theta();
1231  eta = TSOS.globalMomentum().eta();
1232  q = TSOS.charge();
1233 
1234  //get the error of the kinimatic parameters
1236  double partialPterror = errors(3,3)*pow(TSOS.globalMomentum().x(),2) + errors(4,4)*pow(TSOS.globalMomentum().y(),2);
1237  pterror = sqrt(partialPterror)/TSOS.globalMomentum().perp();
1238  pxerror = sqrt(errors(3,3))/TSOS.globalMomentum().x();
1239  pyerror = sqrt(errors(4,4))/TSOS.globalMomentum().y();
1240  pzerror = sqrt(errors(5,5))/TSOS.globalMomentum().z();
1241  perror = sqrt(partialPterror+errors(5,5)*pow(TSOS.globalMomentum().z(),2))/TSOS.globalMomentum().mag();
1242  phierror = sqrt(TSOS.curvilinearError().matrix()(2,2));
1243  etaerror = sqrt(TSOS.curvilinearError().matrix()(1,1))*fabs(sin(TSOS.globalMomentum().theta()));
1244 
1245  }
1246 
1247  std::map<std::string, TkParameterMEs>::iterator iPos = TkParameterMEMap.find(sname);
1248  if (iPos != TkParameterMEMap.end()) {
1249 
1250  TkParameterMEs tkmes = iPos->second;
1251 
1252  // momentum
1253  tkmes.TrackP->Fill(p);
1254  if (doTrackPxPyPlots_) {
1255  tkmes.TrackPx->Fill(px);
1256  tkmes.TrackPy->Fill(py);
1257  }
1258  tkmes.TrackPz->Fill(pz);
1259  tkmes.TrackPt->Fill(pt);
1260 
1261  // angles
1262  tkmes.TrackPhi->Fill(phi);
1263  tkmes.TrackEta->Fill(eta);
1264  if (doThetaPlots_) {
1265  tkmes.TrackTheta->Fill(theta);
1266  }
1267  tkmes.TrackQ->Fill(q);
1268 
1269  // errors
1270  tkmes.TrackPtErr->Fill(pterror);
1271  tkmes.TrackPtErrVsEta->Fill(eta,pterror);
1272  if (doTrackPxPyPlots_) {
1273  tkmes.TrackPxErr->Fill(pxerror);
1274  tkmes.TrackPyErr->Fill(pyerror);
1275  }
1276  tkmes.TrackPzErr->Fill(pzerror);
1277  tkmes.TrackPErr->Fill(perror);
1278  tkmes.TrackPhiErr->Fill(phierror);
1279  tkmes.TrackEtaErr->Fill(etaerror);
1280 
1281  int nRecHits = track.hitPattern().numberOfHits(reco::HitPattern::TRACK_HITS);
1282  int nValidRecHits = track.numberOfValidHits();
1283  // rec hits
1284  tkmes.NumberOfRecHitsPerTrackVsPhi->Fill(phi, nRecHits);
1285  if (doThetaPlots_) {
1286  tkmes.NumberOfRecHitsPerTrackVsTheta->Fill(theta,nRecHits);
1287  }
1288  tkmes.NumberOfRecHitsPerTrackVsEta->Fill(eta, nRecHits);
1289 
1290  tkmes.NumberOfValidRecHitsPerTrackVsPhi->Fill(phi, nValidRecHits);
1291  tkmes.NumberOfValidRecHitsPerTrackVsEta->Fill(eta, nValidRecHits);
1292 
1293  int nLayers = track.hitPattern().trackerLayersWithMeasurement();
1294  // rec layers
1295  tkmes.NumberOfLayersPerTrackVsPhi->Fill(phi, nLayers);
1296  if (doThetaPlots_) {
1297  tkmes.NumberOfLayersPerTrackVsTheta->Fill(theta, nLayers);
1298  }
1299  tkmes.NumberOfLayersPerTrackVsEta->Fill(eta, nLayers);
1300 
1301  double chi2prob = TMath::Prob(track.chi2(),(int)track.ndof());
1302  double chi2oNDF = track.normalizedChi2();
1303 
1304  if(doAllPlots_) {
1305 
1306  // general properties
1307  if (doThetaPlots_) {
1308  tkmes.Chi2oNDFVsTheta->Fill(theta, chi2oNDF);
1309  }
1310  tkmes.Chi2oNDFVsPhi->Fill(phi, chi2oNDF);
1311  tkmes.Chi2oNDFVsEta->Fill(eta, chi2oNDF);
1312  tkmes.Chi2ProbVsPhi->Fill(phi, chi2prob);
1313  tkmes.Chi2ProbVsEta->Fill(eta, chi2prob);
1314  }
1315 
1316  }
1317 
1318 }
1319 
1320 
1322 {
1323 
1324  // parameters from the configuration
1325  std::string QualName = conf_.getParameter<std::string>("Quality");
1327 
1328  // use the AlgoName and Quality Name
1329  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
1330 
1331  int PhiBin = conf_.getParameter<int>( "PhiBin");
1332  double PhiMin = conf_.getParameter<double>("PhiMin");
1333  double PhiMax = conf_.getParameter<double>("PhiMax");
1334 
1335  int EtaBin = conf_.getParameter<int>( "EtaBin");
1336  double EtaMin = conf_.getParameter<double>("EtaMin");
1337  double EtaMax = conf_.getParameter<double>("EtaMax");
1338 
1339  // book hit property histograms
1340  // ---------------------------------------------------------------------------------//
1341  ibooker.setCurrentFolder(TopFolder_+"/HitProperties");
1342 
1343 
1344 
1345  std::vector<std::string> subdetectors = conf_.getParameter<std::vector<std::string> >("subdetectors");
1346  int detBin = conf_.getParameter<int>("subdetectorBin");
1347 
1348  for ( auto det : subdetectors ) {
1349 
1350  // hits properties
1351  ibooker.setCurrentFolder(TopFolder_+"/HitProperties/"+det);
1352 
1353  TkRecHitsPerSubDetMEs recHitsPerSubDet_mes;
1354 
1355  recHitsPerSubDet_mes.detectorTag = det;
1356  int detID = -1;
1357  if ( det == "TIB" ) detID = StripSubdetector::TIB;
1358  if ( det == "TOB" ) detID = StripSubdetector::TOB;
1359  if ( det == "TID" ) detID = StripSubdetector::TID;
1360  if ( det == "TEC" ) detID = StripSubdetector::TEC;
1361  if ( det == "PixBarrel" ) detID = PixelSubdetector::PixelBarrel;
1362  if ( det == "PixEndcap" ) detID = PixelSubdetector::PixelEndcap;
1363  recHitsPerSubDet_mes.detectorId = detID;
1364 
1365  histname = "NumberOfRecHitsPerTrack_" + det + "_" + CategoryName;
1366  recHitsPerSubDet_mes.NumberOfRecHitsPerTrack = ibooker.book1D(histname, histname, detBin, -0.5, double(detBin)-0.5);
1367  recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of " + det + " valid RecHits in each Track",1);
1368  recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
1369 
1370  histname = "NumberOfRecHitsPerTrackVsPhi_" + det + "_" + CategoryName;
1371  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin)-0.5,"");
1372  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1);
1373  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of " + det + " valid RecHits in each Track",2);
1374 
1375  histname = "NumberOfRecHitsPerTrackVsEta_" + det + "_" + CategoryName;
1376  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin)-0.5,"");
1377  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1);
1378  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of " + det + " valid RecHits in each Track",2);
1379 
1380  histname = "NumberOfLayersPerTrack_" + det + "_" + CategoryName;
1381  recHitsPerSubDet_mes.NumberOfLayersPerTrack = ibooker.book1D(histname, histname, detBin, -0.5, double(detBin)-0.5);
1382  recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of " + det + " valid Layers in each Track",1);
1383  recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of Tracks", 2);
1384 
1385  histname = "NumberOfLayersPerTrackVsPhi_" + det + "_" + CategoryName;
1386  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin)-0.5,"");
1387  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi",1);
1388  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of " + det + " valid Layers in each Track",2);
1389 
1390  histname = "NumberOfLayersPerTrackVsEta_" + det + "_" + CategoryName;
1391  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin)-0.5,"");
1392  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta",1);
1393  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of " + det + " valid Layers in each Track",2);
1394 
1395  TkRecHitsPerSubDetMEMap.insert(std::pair<std::string,TkRecHitsPerSubDetMEs>(det,recHitsPerSubDet_mes));
1396 
1397 
1398  }
1399 
1400 
1401 }
1402 
1403 
1405 {
1406 
1407  double phi = track.phi();
1408  double eta = track.eta();
1409 
1410  for ( std::map<std::string,TkRecHitsPerSubDetMEs>::iterator it = TkRecHitsPerSubDetMEMap.begin();
1411  it != TkRecHitsPerSubDetMEMap.end(); it++ ) {
1412 
1413  int nValidLayers = 0;
1414  int nValidRecHits = 0;
1415  int substr = it->second.detectorId;
1416  switch(substr) {
1417  case StripSubdetector::TIB :
1418  nValidLayers = track.hitPattern().stripTIBLayersWithMeasurement(); // case 0: strip TIB
1419  nValidRecHits = track.hitPattern().numberOfValidStripTIBHits(); // case 0: strip TIB
1420  break;
1421  case StripSubdetector::TID :
1422  nValidLayers = track.hitPattern().stripTIDLayersWithMeasurement(); // case 0: strip TID
1423  nValidRecHits = track.hitPattern().numberOfValidStripTIDHits(); // case 0: strip TID
1424  break;
1425  case StripSubdetector::TOB :
1426  nValidLayers = track.hitPattern().stripTOBLayersWithMeasurement(); // case 0: strip TOB
1427  nValidRecHits = track.hitPattern().numberOfValidStripTOBHits(); // case 0: strip TOB
1428  break;
1429  case StripSubdetector::TEC :
1430  nValidLayers = track.hitPattern().stripTECLayersWithMeasurement(); // case 0: strip TEC
1431  nValidRecHits = track.hitPattern().numberOfValidStripTECHits(); // case 0: strip TEC
1432  break;
1434  nValidLayers = track.hitPattern().pixelBarrelLayersWithMeasurement(); // case 0: pixel PXB
1435  nValidRecHits = track.hitPattern().numberOfValidPixelBarrelHits(); // case 0: pixel PXB
1436  break;
1438  nValidLayers = track.hitPattern().pixelEndcapLayersWithMeasurement(); // case 0: pixel PXF
1439  nValidRecHits = track.hitPattern().numberOfValidPixelEndcapHits(); // case 0: pixel PXF
1440  break;
1441  default :
1442  break;
1443  }
1444 
1445  //Fill Layers and RecHits
1446  it->second.NumberOfRecHitsPerTrack -> Fill(nValidRecHits);
1447  it->second.NumberOfRecHitsPerTrackVsPhi -> Fill(phi, nValidRecHits);
1448  it->second.NumberOfRecHitsPerTrackVsEta -> Fill(eta, nValidRecHits);
1449 
1450  it->second.NumberOfLayersPerTrack -> Fill(nValidLayers);
1451  it->second.NumberOfLayersPerTrackVsPhi -> Fill(phi, nValidLayers);
1452  it->second.NumberOfLayersPerTrackVsEta -> Fill(eta, nValidLayers);
1453  }
1454 
1455 }
1456 //
1457 // -- Set Lumi Flag
1458 //
1460 
1461  TkParameterMEs tkmes;
1464 }
1465 //
1466 // -- Apply SoftReset
1467 //
1469  TkParameterMEs tkmes;
1470  dqmStore_->softReset(Chi2oNDF);
1471  dqmStore_->softReset(NumberOfRecHitsPerTrack);
1472 }
1473 //
1474 // -- Apply Reset
1475 //
1477  TkParameterMEs tkmes;
1480 }
1481 //
1482 // -- Remove SoftReset
1483 //
1485  TkParameterMEs tkmes;
1486  dqmStore_->disableSoftReset(Chi2oNDF);
1488 }
1489 
1490 
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
int i
Definition: DBlmapReader.cc:9
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
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
MonitorElement * sipDzToBS
std::map< std::string, TkParameterMEs > TkParameterMEMap
MonitorElement * NumberOfLayersPerTrack[4]
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * algorithm
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:580
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:458
T eta() const
bool doHitPropertiesPlots_
Definition: TrackAnalyzer.h:73
MonitorElement * DistanceOfClosestApproach
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:65
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
MonitorElement * NumberOfValidRecHitVsPhiVsEtaPerTrack
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)
int numberOfLostTrackerHits(HitCategory category) const
Definition: HitPattern.h:809
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
MonitorElement * NumberOfLayersVsPhiVsEtaPerTrack[4]
TrackAlgorithm algo() const
Definition: TrackBase.h:450
void disableSoftReset(MonitorElement *me)
Definition: DQMStore.cc:3378
MonitorElement * TESTDistanceOfClosestApproachToBSVsPhi
MonitorElement * NumberOfValidRecHitsPerTrackVsEta
MonitorElement * Chi2oNDFVsEta
MonitorElement * TransDCASig
int iEvent
Definition: GenABIO.cc:230
MonitorElement * NumberOfMIRecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfRecHitsPerTrackVsPhi
MonitorElement * xPointOfClosestApproachVsZ0wrt000
T mag() const
Definition: PV3DBase.h:67
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:604
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
Definition: HitPattern.cc:300
int trackerLayersTotallyOffOrBad() const
Definition: HitPattern.h:945
int numberOfValidPixelBarrelHits() const
Definition: HitPattern.h:754
MonitorElement * oriAlgo
bool doDCAwrt000Plots_
Definition: TrackAnalyzer.h:88
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * NumberOfLostRecHitVsPhiVsEtaPerTrack
MonitorElement * xPointOfClosestApproach
MonitorElement * Chi2oNDFVsTheta
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:502
MonitorElement * NumberOfMIRecHitsPerTrack
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:3370
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)
TrackAlgorithm originalAlgo() const
Definition: TrackBase.h:454
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
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
int trackerLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:494
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)
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 * NumberOfMORecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfMORecHitsPerTrack
MonitorElement * NumberOfLayersPerTrackVsPhi
MonitorElement * LongDCASig
edm::EDGetTokenT< reco::VertexCollection > pvToken_
Definition: TrackAnalyzer.h:62
Definition: DDAxes.h:10
MonitorElement * Chi2oNDFVsPhi