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 
15 
20 #include <string>
21 #include "TMath.h"
22 
24  : conf_( iConfig )
25  , doTrackerSpecific_ ( conf_.getParameter<bool>("doTrackerSpecific") )
26  , doAllPlots_ ( conf_.getParameter<bool>("doAllPlots") )
27  , doBSPlots_ ( conf_.getParameter<bool>("doBeamSpotPlots") )
28  , doPVPlots_ ( conf_.getParameter<bool>("doPrimaryVertexPlots") )
29  , doDCAPlots_ ( conf_.getParameter<bool>("doDCAPlots") )
30  , doGeneralPropertiesPlots_ ( conf_.getParameter<bool>("doGeneralPropertiesPlots") )
31  , doMeasurementStatePlots_ ( conf_.getParameter<bool>("doMeasurementStatePlots") )
32  , doHitPropertiesPlots_ ( conf_.getParameter<bool>("doHitPropertiesPlots") )
33  , doRecHitVsPhiVsEtaPerTrack_ ( conf_.getParameter<bool>("doRecHitVsPhiVsEtaPerTrack") )
34  , doLayersVsPhiVsEtaPerTrack_ ( conf_.getParameter<bool>("doLayersVsPhiVsEtaPerTrack") )
35  , doRecHitsPerTrackProfile_ ( conf_.getParameter<bool>("doRecHitsPerTrackProfile") )
36  , doThetaPlots_ ( conf_.getParameter<bool>("doThetaPlots") )
37  , doTrackPxPyPlots_ ( conf_.getParameter<bool>("doTrackPxPyPlots") )
38  , doDCAwrtPVPlots_ ( conf_.getParameter<bool>("doDCAwrtPVPlots") )
39  , doDCAwrt000Plots_ ( conf_.getParameter<bool>("doDCAwrt000Plots") )
40  , doLumiAnalysis_ ( conf_.getParameter<bool>("doLumiAnalysis") )
41  , doTestPlots_ ( conf_.getParameter<bool>("doTestPlots") )
42  , doHIPlots_ ( conf_.getParameter<bool>("doHIPlots") )
43  , doSIPPlots_ ( conf_.getParameter<bool>("doSIPPlots") )
44  , doEffFromHitPatternVsPU_ ( conf_.getParameter<bool>("doEffFromHitPatternVsPU") )
45  , doEffFromHitPatternVsBX_ ( conf_.getParameter<bool>("doEffFromHitPatternVsBX") )
46  , pvNDOF_ ( conf_.getParameter<int> ("pvNDOF") )
47  , qualityString_ ( conf_.getParameter<std::string>("qualityString"))
48  , good_vertices_(0)
49  , bx_(0)
50 {
51  initHistos();
52  TopFolder_ = conf_.getParameter<std::string>("FolderName");
53 }
54 
56  : TrackAnalyzer(iConfig)
57 {
58  edm::InputTag bsSrc = conf_.getParameter<edm::InputTag>("beamSpot");
59  edm::InputTag primaryVertexInputTag = conf_.getParameter<edm::InputTag>("primaryVertex");
61  pvToken_ = iC.consumes<reco::VertexCollection>(primaryVertexInputTag);
62 }
63 
65 {
66  Chi2 = nullptr;
67  Chi2Prob = nullptr;
68  Chi2ProbVsPhi = nullptr;
69  Chi2ProbVsEta = nullptr;
70  Chi2oNDF = nullptr;
71  Chi2oNDFVsEta = nullptr;
72  Chi2oNDFVsPhi = nullptr;
73  Chi2oNDFVsTheta = nullptr;
74  Chi2oNDFVsTheta = nullptr;
75  Chi2oNDFVsPhi = nullptr;
76  Chi2oNDFVsEta = nullptr;
77 
78  NumberOfRecHitsPerTrack = nullptr;
81 
85 
87 
90 
91 
92  DistanceOfClosestApproach = nullptr;
98  xPointOfClosestApproach = nullptr;
101  yPointOfClosestApproach = nullptr;
104  zPointOfClosestApproach = nullptr;
106  algorithm = nullptr;
107  oriAlgo = nullptr;
108  stoppingSource = nullptr;
109  stoppingSourceVSeta = nullptr;
110  stoppingSourceVSphi = nullptr;
111  // TESTING
114 
115 // by Mia in order to deal w/ LS transitions
116  Chi2oNDF_lumiFlag = nullptr;
118 
120  //special Plots for HI DQM //SHOULD I ADD THE BOOL HERE??
122  LongDCASig = nullptr;
123  TransDCASig = nullptr;
124  dNdPhi_HighPurity = nullptr;
125  dNdEta_HighPurity = nullptr;
126  dNdPt_HighPurity = nullptr;
127  NhitVsEta_HighPurity = nullptr;
128  NhitVsPhi_HighPurity = nullptr;
129 
130  // IP significance
131  sipDxyToBS = nullptr;
132  sipDzToBS = nullptr;
133  sip3dToPV = nullptr;
134  sip2dToPV = nullptr;
135  sipDxyToPV = nullptr;
136  sipDzToPV = nullptr;
137 
138 }
139 
141 {
142 }
143 
145 {
146 
148  bookHistosForBeamSpot(ibooker);
152 
153  // book tracker specific related histograms
154  // ---------------------------------------------------------------------------------//
156 
157  // book state related histograms
158  // ---------------------------------------------------------------------------------//
160 
161  std::string StateName = conf_.getParameter<std::string>("MeasurementState");
162 
163  if (StateName == "All") {
164  bookHistosForState("OuterSurface", ibooker);
165  bookHistosForState("InnerSurface", ibooker);
166  bookHistosForState("ImpactPoint" , ibooker);
167  } else if (
168  StateName != "OuterSurface" &&
169  StateName != "InnerSurface" &&
170  StateName != "ImpactPoint" &&
171  StateName != "default"
172  ) {
173  bookHistosForState("default", ibooker);
174 
175  } else {
176  bookHistosForState(StateName, ibooker);
177  }
178 
179  }
180 }
181 
183  const edm::EventSetup & iSetup,
184  const std::string suffix)
185 {
187 
188  ibooker.setCurrentFolder(TopFolder_ + "/HitEffFromHitPattern" + suffix);
189 
190  int NBINS[] = { 50, 3564 };
191  float MAX[] = { 50.5, 3564.5 };
192 
193  int mon = -1;
194  int nbins = -1;
195  float max = -1.;
196  for (int i=0; i<monQuantity::END; i++) {
197  if (monName[i] == suffix) {
198  mon = i;
199  nbins = NBINS[i];
200  max = MAX[i];
201  }
202  }
203 
204  edm::ESHandle<TrackerGeometry> trackerGeometry;
205  iSetup.get<TrackerDigiGeometryRecord>().get(trackerGeometry);
206 
207  // Values are not ordered randomly, but the order is taken from
208  // http://cmslxr.fnal.gov/dxr/CMSSW/source/Geometry/CommonDetUnit/interface/GeomDetEnumerators.h#15
209  const char * dets[] = { "None", "PXB", "PXF", "TIB", "TID", "TOB", "TEC"};
210 
211  // Also in this case, ordering is not random but extracted from
212  // http://cmslxr.fnal.gov/dxr/CMSSW/source/DataFormats/TrackReco/interface/HitPattern.h
213  // The category "total" is an addition to ease the computation of
214  // the efficiencies and is not part of the original HitPattern.
215  const char * hit_category[] = { "valid", "missing", "inactive", "bad", "total"};
216 
217  // We set sub_det to be a 1-based index since to it is the sub-sub-structure in the HitPattern
218  char title[50];
219  for (unsigned int det = 1; det < sizeof(dets)/sizeof(char*); ++det ) {
220  for (unsigned int sub_det = 1;
221  sub_det <= trackerGeometry->numberOfLayers(det); ++sub_det) {
222  for (unsigned int cat = 0;
223  cat < sizeof(hit_category)/sizeof(char *); ++cat) {
224  memset(title, 0, sizeof(title));
225  snprintf(title, sizeof(title), "Hits%s_%s_%s_Subdet%d", suffix.c_str(), hit_category[cat], dets[det], sub_det);
226  switch(cat) {
227  case 0:
228  hits_valid_.insert(std::make_pair(
229  Key(det, sub_det, mon),
230  ibooker.book1D(title, title, nbins, 0.5, max)));
231  break;
232  case 1:
233  hits_missing_.insert(std::make_pair(
234  Key(det, sub_det, mon),
235  ibooker.book1D(title, title, nbins, 0.5, max)));
236  break;
237  case 2:
238  hits_inactive_.insert(std::make_pair(
239  Key(det, sub_det, mon),
240  ibooker.book1D(title, title, nbins, 0.5, max)));
241  break;
242  case 3:
243  hits_bad_.insert(std::make_pair(
244  Key(det, sub_det, mon),
245  ibooker.book1D(title, title, nbins, 0.5, max)));
246  break;
247  case 4:
248  hits_total_.insert(std::make_pair(
249  Key(det, sub_det, mon),
250  ibooker.book1D(title, title, nbins, 0.5, max)));
251  break;
252  default:
253  LogDebug("TrackAnalyzer") << "Invalid hit category used " << cat << " ignored\n";
254  }
255  }
256  }
257  }
258  }
259 }
260 
263 
264  // parameters from the configuration
265  std::string QualName = conf_.getParameter<std::string>("Quality");
267  std::string MEBSFolderName = conf_.getParameter<std::string>("BSFolderName");
268 
269  // use the AlgoName and Quality Name
270  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
271 
272  // get binning from the configuration
273  int TKHitBin = conf_.getParameter<int>( "RecHitBin");
274  double TKHitMin = conf_.getParameter<double>("RecHitMin");
275  double TKHitMax = conf_.getParameter<double>("RecHitMax");
276 
277  int TKLostBin = conf_.getParameter<int>( "RecLostBin");
278  double TKLostMin = conf_.getParameter<double>("RecLostMin");
279  double TKLostMax = conf_.getParameter<double>("RecLostMax");
280 
281  int TKLayBin = conf_.getParameter<int>( "RecLayBin");
282  double TKLayMin = conf_.getParameter<double>("RecLayMin");
283  double TKLayMax = conf_.getParameter<double>("RecLayMax");
284 
285  int PhiBin = conf_.getParameter<int>( "PhiBin");
286  double PhiMin = conf_.getParameter<double>("PhiMin");
287  double PhiMax = conf_.getParameter<double>("PhiMax");
288 
289  int EtaBin = conf_.getParameter<int>( "EtaBin");
290  double EtaMin = conf_.getParameter<double>("EtaMin");
291  double EtaMax = conf_.getParameter<double>("EtaMax");
292 
293  int VXBin = conf_.getParameter<int>( "VXBin");
294  double VXMin = conf_.getParameter<double>("VXMin");
295  double VXMax = conf_.getParameter<double>("VXMax");
296 
297  int VYBin = conf_.getParameter<int>( "VYBin");
298  double VYMin = conf_.getParameter<double>("VYMin");
299  double VYMax = conf_.getParameter<double>("VYMax");
300 
301  int VZBin = conf_.getParameter<int>( "VZBin");
302  double VZMin = conf_.getParameter<double>("VZMin");
303  double VZMax = conf_.getParameter<double>("VZMax");
304 
305  ibooker.setCurrentFolder(TopFolder_);
306 
307  // book the Hit Property histograms
308  // ---------------------------------------------------------------------------------//
309 
310  TkParameterMEs tkmes;
312 
313  ibooker.setCurrentFolder(TopFolder_+"/HitProperties");
314 
315  histname = "NumberOfRecHitsPerTrack_";
316  NumberOfRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax);
317  NumberOfRecHitsPerTrack->setAxisTitle("Number of all RecHits of each Track");
318  NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
319 
320  histname = "NumberOfValidRecHitsPerTrack_";
321  NumberOfValidRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax);
322  NumberOfValidRecHitsPerTrack->setAxisTitle("Number of valid RecHits for each Track");
323  NumberOfValidRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
324 
325  histname = "NumberOfLostRecHitsPerTrack_";
326  NumberOfLostRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKLostBin, TKLostMin, TKLostMax);
327  NumberOfLostRecHitsPerTrack->setAxisTitle("Number of lost RecHits for each Track");
328  NumberOfLostRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
329 
330  histname = "NumberOfMissingInnerRecHitsPerTrack_";
331  NumberOfMIRecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, 10, -0.5, 9.5);
332  NumberOfMIRecHitsPerTrack->setAxisTitle("Number of missing-inner RecHits for each Track");
333  NumberOfMIRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
334 
335  histname = "NumberOfMissingOuterRecHitsPerTrack_";
336  NumberOfMORecHitsPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, 10, -0.5, 9.5);
337  NumberOfMORecHitsPerTrack->setAxisTitle("Number of missing-outer RecHits for each Track");
338  NumberOfMORecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
339 
340  histname = "ValidFractionPerTrack_";
341  ValidFractionPerTrack = ibooker.book1D(histname+CategoryName, histname+CategoryName, 101, 0., 1.01);
342  ValidFractionPerTrack->setAxisTitle("ValidFraction of RecHits for each Track");
343  ValidFractionPerTrack->setAxisTitle("Number of Tracks", 2);
344 
345 
346 
348 
349  histname = "NumberOfValidRecHitVsPhiVsEtaPerTrack_";
350  NumberOfValidRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
351  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 40., "");
354 
355  histname = "NumberOfLostRecHitVsPhiVsEtaPerTrack_";
356  NumberOfLostRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
357  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 5., "");
360 
361 
362  histname = "NumberMIRecHitVsPhiVsEtaPerTrack_";
363  NumberOfMIRecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
364  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 15., "");
367 
368  histname = "NumberMORecHitVsPhiVsEtaPerTrack_";
369  NumberOfMORecHitVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
370  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 15., "");
373 
374  histname = "ValidFractionVsPhiVsEtaPerTrack_";
375  ValidFractionVsPhiVsEtaPerTrack = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
376  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 2., "");
379 
380 
381  }
382 
383  std::string layerTypeName[4] = {"","Off","3D","Missing"};
384  for (int i=0; i<4; ++i) {
385  histname = "NumberOf"+ layerTypeName[i] + "LayersPerTrack_";
386  NumberOfLayersPerTrack[i] = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKLayBin, TKLayMin, TKLayMax);
387  NumberOfLayersPerTrack[i]->setAxisTitle("Number of " + layerTypeName[i] + " Layers of each Track", 1);
388  NumberOfLayersPerTrack[i]->setAxisTitle("Number of Tracks", 2);
389  }
391  for (int i=0; i<4; ++i) {
392  histname = "NumberOf"+ layerTypeName[i] + "LayersVsPhiVsEtaPerTrack_";
393  NumberOfLayersVsPhiVsEtaPerTrack[i] = ibooker.bookProfile2D(histname+CategoryName, histname+CategoryName,
394  EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax, 0, 40., "");
395  NumberOfLayersVsPhiVsEtaPerTrack[i]->setAxisTitle("Track #eta ", 1);
396  NumberOfLayersVsPhiVsEtaPerTrack[i]->setAxisTitle("Track #phi ", 2);
397  }
398  }
399 
400  // book the General Property histograms
401  // ---------------------------------------------------------------------------------//
402 
404 
405  int Chi2Bin = conf_.getParameter<int>( "Chi2Bin");
406  double Chi2Min = conf_.getParameter<double>("Chi2Min");
407  double Chi2Max = conf_.getParameter<double>("Chi2Max");
408 
409  int Chi2NDFBin = conf_.getParameter<int>( "Chi2NDFBin");
410  double Chi2NDFMin = conf_.getParameter<double>("Chi2NDFMin");
411  double Chi2NDFMax = conf_.getParameter<double>("Chi2NDFMax");
412 
413  int Chi2ProbBin = conf_.getParameter<int>( "Chi2ProbBin");
414  double Chi2ProbMin = conf_.getParameter<double>("Chi2ProbMin");
415  double Chi2ProbMax = conf_.getParameter<double>("Chi2ProbMax");
416 
417 
418  //HI PLOTS////
419  int TransDCABins = conf_.getParameter<int>("TransDCABins");
420  double TransDCAMin = conf_.getParameter<double>("TransDCAMin");
421  double TransDCAMax = conf_.getParameter<double>("TransDCAMax");
422 
423  int LongDCABins = conf_.getParameter<int>("LongDCABins");
424  double LongDCAMin = conf_.getParameter<double>("LongDCAMin");
425  double LongDCAMax = conf_.getParameter<double>("LongDCAMax");
427 
428 
429  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
430 
431  histname = "Chi2_";
432  Chi2 = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2Bin, Chi2Min, Chi2Max);
433  Chi2->setAxisTitle("Track #chi^{2}" ,1);
434  Chi2->setAxisTitle("Number of Tracks",2);
435 
436  histname = "Chi2Prob_";
437  Chi2Prob = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2ProbBin, Chi2ProbMin, Chi2ProbMax);
438  Chi2Prob->setAxisTitle("Track #chi^{2} probability",1);
439  Chi2Prob->setAxisTitle("Number of Tracks" ,2);
440 
441  histname = "Chi2oNDF_";
442  Chi2oNDF = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax);
443  Chi2oNDF->setAxisTitle("Track #chi^{2}/ndf",1);
444  Chi2oNDF->setAxisTitle("Number of Tracks" ,2);
445 
446 
448  //HI PLOTS///
450  if (doHIPlots_)
451  {
452  histname = "LongDCASig_";
453  LongDCASig = ibooker.book1D(histname+CategoryName, histname+CategoryName,LongDCABins,LongDCAMin,LongDCAMax);
454  LongDCASig->setAxisTitle("dz/#sigma_{dz}",1);
455 
456  histname = "TransDCASig_";
457  TransDCASig = ibooker.book1D(histname+CategoryName,histname+CategoryName,TransDCABins,TransDCAMin,TransDCAMax);
458  TransDCASig->setAxisTitle("dxy/#sigma_{dxy}",1);
459 
460  histname = "dNdPhi_HighPurity_";
461  dNdPhi_HighPurity = ibooker.book1D(histname+CategoryName,histname+CategoryName,PhiBin,PhiMin,PhiMax);
462  dNdPhi_HighPurity->setAxisTitle("#phi",1);
463 
464  histname = "dNdEta_HighPurity_";
465  dNdEta_HighPurity = ibooker.book1D(histname+CategoryName,histname+CategoryName,EtaBin,EtaMin,EtaMax);
466  dNdEta_HighPurity->setAxisTitle("#eta",1);
467 
468  histname = "dNdPt_HighPurity_";
469  dNdPt_HighPurity = ibooker.book1D(histname+CategoryName,histname+CategoryName,150,0,0.3);
470  dNdPt_HighPurity->setAxisTitle("#sigma_{p_{T}}/p_{T}",1);
471 
472  histname = "NhitVsEta_HighPurity_";
473  NhitVsEta_HighPurity = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,EtaBin,EtaMin,EtaMax,-0.5,39.5,"");
474  NhitVsEta_HighPurity->setAxisTitle("Track #eta",1);
475  NhitVsEta_HighPurity->setAxisTitle("Number of Valid RecHits in each Track",2);
476 
477  histname = "NhitVsPhi_HighPurity_";
478  NhitVsPhi_HighPurity = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,PhiBin,PhiMin,PhiMax,-0.5,39.5,"");
479  NhitVsPhi_HighPurity->setAxisTitle("Track #phi",1);
480  NhitVsPhi_HighPurity->setAxisTitle("Number of Valid RecHits in each Track",2);
481 
482  histname = "Ptdist_HighPurity_";
483  Ptdist_HighPurity = ibooker.book1D(histname+CategoryName,histname+CategoryName,150,0,50.);
484  Ptdist_HighPurity->setAxisTitle("p_{T} (GeV/c)",1);
485  Ptdist_HighPurity->setAxisTitle("Number of Tracks",2);
486 
487  histname = "dNhitdPt_HighPurity_";
488  dNhitdPt_HighPurity = ibooker.bookProfile(histname+CategoryName,histname+CategoryName,150,0,25.,-0.5,39.5,"");
489  dNhitdPt_HighPurity->setAxisTitle("p_{T} (GeV/c)",1);
490  dNhitdPt_HighPurity->setAxisTitle("N_{hit}",2);
491 
492  }
493 
494 
495 
497  histname = "xPointOfClosestApproach_";
498  xPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VXBin, VXMin, VXMax);
499  xPointOfClosestApproach->setAxisTitle("x component of Track PCA to beam line (cm)",1);
500  xPointOfClosestApproach->setAxisTitle("Number of Tracks",2);
501 
502  histname = "yPointOfClosestApproach_";
503  yPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VYBin, VYMin, VYMax);
504  yPointOfClosestApproach->setAxisTitle("y component of Track PCA to beam line (cm)",1);
505  yPointOfClosestApproach->setAxisTitle("Number of Tracks",2);
506 
507  histname = "zPointOfClosestApproach_";
508  zPointOfClosestApproach = ibooker.book1D(histname+CategoryName, histname+CategoryName, VZBin, VZMin, VZMax);
509  zPointOfClosestApproach->setAxisTitle("z component of Track PCA to beam line (cm)",1);
510  zPointOfClosestApproach->setAxisTitle("Number of Tracks",2);
511 
512  histname = "xPointOfClosestApproachToPV_";
513  xPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VXBin, VXMin, VXMax);
514  xPointOfClosestApproachToPV->setAxisTitle("x component of Track PCA to pv (cm)",1);
515  xPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2);
516 
517  histname = "yPointOfClosestApproachToPV_";
518  yPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VYBin, VYMin, VYMax);
519  yPointOfClosestApproachToPV->setAxisTitle("y component of Track PCA to pv line (cm)",1);
520  yPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2);
521 
522  histname = "zPointOfClosestApproachToPV_";
523  zPointOfClosestApproachToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, VZBin, VZMin, VZMax);
524  zPointOfClosestApproachToPV->setAxisTitle("z component of Track PCA to pv line (cm)",1);
525  zPointOfClosestApproachToPV->setAxisTitle("Number of Tracks",2);
526  }
527 
528  // See DataFormats/TrackReco/interface/TrackBase.h for track algorithm enum definition
529  // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/DataFormats/TrackReco/interface/TrackBase.h?view=log
530  histname = "algorithm_";
531  algorithm = ibooker.book1D(histname+CategoryName, histname+CategoryName, reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize));
532  algorithm->setAxisTitle("Tracking algorithm",1);
533  algorithm->setAxisTitle("Number of Tracks",2);
534 
535  histname = "originalAlgorithm_";
536  oriAlgo = ibooker.book1D(histname+CategoryName, histname+CategoryName, reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize));
537  oriAlgo->setAxisTitle("Tracking algorithm",1);
538  oriAlgo->setAxisTitle("Number of Tracks",2);
539 
540  for (size_t ibin=0; ibin<reco::TrackBase::algoSize-1; ibin++) {
543  }
544 
545  // DataFormats/TrackReco/interface/TrajectoryStopReasons.h
546  std::vector<std::string> StopReasonName = { "UNINITIALIZED", "MAX_HITS", "MAX_LOST_HITS", "MAX_CONSECUTIVE_LOST_HITS", "LOST_HIT_FRACTION", "MIN_PT", "CHARGE_SIGNIFICANCE", "LOOPER", "MAX_CCC_LOST_HITS", "NO_SEGMENTS_FOR_VALID_LAYERS", "NOT_STOPPED" };
547 
548  histname = "stoppingSource_";
549  stoppingSource = ibooker.book1D(histname+CategoryName, histname+CategoryName, StopReasonName.size(), 0., double(StopReasonName.size()));
550  stoppingSource->setAxisTitle("stopping reason",1);
551  stoppingSource->setAxisTitle("Number of Tracks",2);
552 
553  histname = "stoppingSourceVSeta_";
554  stoppingSourceVSeta = ibooker.book2D(histname+CategoryName, histname+CategoryName, EtaBin, EtaMin, EtaMax, StopReasonName.size(), 0., double(StopReasonName.size()));
555  stoppingSourceVSeta->setAxisTitle("track #eta",1);
556  stoppingSourceVSeta->setAxisTitle("stopping reason",2);
557 
558  histname = "stoppingSourceVSphi_";
559  stoppingSourceVSphi = ibooker.book2D(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, StopReasonName.size(), 0., double(StopReasonName.size()));
560  stoppingSourceVSphi->setAxisTitle("track #phi",1);
561  stoppingSourceVSphi->setAxisTitle("stopping reason",2);
562 
563  for (size_t ibin=0; ibin<StopReasonName.size(); ibin++) {
564  stoppingSource->setBinLabel(ibin+1,StopReasonName[ibin],1);
565  stoppingSourceVSeta->setBinLabel(ibin+1,StopReasonName[ibin],2);
566  stoppingSourceVSphi->setBinLabel(ibin+1,StopReasonName[ibin],2);
567  }
568 
569  }
570 
571 }
572 
574 
575  // parameters from the configuration
576  std::string QualName = conf_.getParameter<std::string>("Quality");
578 
579  // use the AlgoName and Quality Name
580  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
581 
582 
583  // book LS analysis related histograms
584  // -----------------------------------
585  if ( doLumiAnalysis_ ) {
586 
587  // get binning from the configuration
588  int TKHitBin = conf_.getParameter<int>( "RecHitBin");
589  double TKHitMin = conf_.getParameter<double>("RecHitMin");
590  double TKHitMax = conf_.getParameter<double>("RecHitMax");
591 
592  int Chi2NDFBin = conf_.getParameter<int>( "Chi2NDFBin");
593  double Chi2NDFMin = conf_.getParameter<double>("Chi2NDFMin");
594  double Chi2NDFMax = conf_.getParameter<double>("Chi2NDFMax");
595 
596  // add by Mia in order to deal w/ LS transitions
597  ibooker.setCurrentFolder(TopFolder_+"/LSanalysis");
598 
599  histname = "NumberOfRecHitsPerTrack_lumiFlag_";
600  NumberOfRecHitsPerTrack_lumiFlag = ibooker.book1D(histname+CategoryName, histname+CategoryName, TKHitBin, TKHitMin, TKHitMax);
601  NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of all RecHits of each Track");
602  NumberOfRecHitsPerTrack_lumiFlag->setAxisTitle("Number of Tracks", 2);
603 
604  histname = "Chi2oNDF_lumiFlag_";
605  Chi2oNDF_lumiFlag = ibooker.book1D(histname+CategoryName, histname+CategoryName, Chi2NDFBin, Chi2NDFMin, Chi2NDFMax);
606  Chi2oNDF_lumiFlag->setAxisTitle("Track #chi^{2}/ndf",1);
607  Chi2oNDF_lumiFlag->setAxisTitle("Number of Tracks" ,2);
608 
609  }
610 }
611 
613 
614  // parameters from the configuration
615  std::string QualName = conf_.getParameter<std::string>("Quality");
617 
618  // use the AlgoName and Quality Name
619  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
620 
621  // book the Beam Spot related histograms
622  // ---------------------------------------------------------------------------------//
623 
625 
626  int DxyBin = conf_.getParameter<int>( "DxyBin");
627  double DxyMin = conf_.getParameter<double>("DxyMin");
628  double DxyMax = conf_.getParameter<double>("DxyMax");
629 
630  int PhiBin = conf_.getParameter<int>( "PhiBin");
631  double PhiMin = conf_.getParameter<double>("PhiMin");
632  double PhiMax = conf_.getParameter<double>("PhiMax");
633 
634  int X0Bin = conf_.getParameter<int>( "X0Bin");
635  double X0Min = conf_.getParameter<double>("X0Min");
636  double X0Max = conf_.getParameter<double>("X0Max");
637 
638  int Y0Bin = conf_.getParameter<int>( "Y0Bin");
639  double Y0Min = conf_.getParameter<double>("Y0Min");
640  double Y0Max = conf_.getParameter<double>("Y0Max");
641 
642  int Z0Bin = conf_.getParameter<int>( "Z0Bin");
643  double Z0Min = conf_.getParameter<double>("Z0Min");
644  double Z0Max = conf_.getParameter<double>("Z0Max");
645 
646  int VZBinProf = conf_.getParameter<int>( "VZBinProf");
647  double VZMinProf = conf_.getParameter<double>("VZMinProf");
648  double VZMaxProf = conf_.getParameter<double>("VZMaxProf");
649 
650 
651  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
652 
653  histname = "DistanceOfClosestApproachToBS_";
654  DistanceOfClosestApproachToBS = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax);
655  DistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1);
656  DistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2);
657 
658  histname = "DistanceOfClosestApproachToBSVsPhi_";
659  DistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,"");
660  DistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes);
662  DistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2);
663 
664  histname = "xPointOfClosestApproachVsZ0wrt000_";
665  xPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,"");
667  xPointOfClosestApproachVsZ0wrt000->setAxisTitle("x component of Track PCA to beam line (cm)",2);
668 
669  histname = "yPointOfClosestApproachVsZ0wrt000_";
670  yPointOfClosestApproachVsZ0wrt000 = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,"");
672  yPointOfClosestApproachVsZ0wrt000->setAxisTitle("y component of Track PCA to beam line (cm)",2);
673 
674  histname = "xPointOfClosestApproachVsZ0wrtBS_";
675  xPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,"");
676  xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1);
677  xPointOfClosestApproachVsZ0wrtBS->setAxisTitle("x component of Track PCA to BS (cm)",2);
678 
679  histname = "yPointOfClosestApproachVsZ0wrtBS_";
680  yPointOfClosestApproachVsZ0wrtBS = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,"");
681  yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1);
682  yPointOfClosestApproachVsZ0wrtBS->setAxisTitle("y component of Track PCA to BS (cm)",2);
683 
684  histname = "zPointOfClosestApproachVsPhi_";
685  zPointOfClosestApproachVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, VZBinProf, VZMinProf, VZMaxProf, "");
687  zPointOfClosestApproachVsPhi->setAxisTitle("z component of Track PCA to beam line (cm)",2);
688  }
689 
691 
692  int DxyBin = conf_.getParameter<int>( "DxyBin");
693  double DxyMin = conf_.getParameter<double>("DxyMin");
694  double DxyMax = conf_.getParameter<double>("DxyMax");
695 
696  int PhiBin = conf_.getParameter<int>( "PhiBin");
697  double PhiMin = conf_.getParameter<double>("PhiMin");
698  double PhiMax = conf_.getParameter<double>("PhiMax");
699 
700  int X0Bin = conf_.getParameter<int>( "X0Bin");
701  double X0Min = conf_.getParameter<double>("X0Min");
702  double X0Max = conf_.getParameter<double>("X0Max");
703 
704  int Y0Bin = conf_.getParameter<int>( "Y0Bin");
705  double Y0Min = conf_.getParameter<double>("Y0Min");
706  double Y0Max = conf_.getParameter<double>("Y0Max");
707 
708  int Z0Bin = conf_.getParameter<int>( "Z0Bin");
709  double Z0Min = conf_.getParameter<double>("Z0Min");
710  double Z0Max = conf_.getParameter<double>("Z0Max");
711 
712  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
713 
714  histname = "DistanceOfClosestApproachToPV_";
715  DistanceOfClosestApproachToPV = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax);
716  DistanceOfClosestApproachToPV->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1);
717  DistanceOfClosestApproachToPV->setAxisTitle("Number of Tracks",2);
718 
719  histname = "DistanceOfClosestApproachToPVVsPhi_";
720  DistanceOfClosestApproachToPVVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,"");
721  DistanceOfClosestApproachToPVVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes);
723  DistanceOfClosestApproachToPVVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2);
724 
725  histname = "xPointOfClosestApproachVsZ0wrtPV_";
726  xPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, X0Bin, X0Min, X0Max,"");
727  xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1);
728  xPointOfClosestApproachVsZ0wrtPV->setAxisTitle("x component of Track PCA to PV (cm)",2);
729 
730  histname = "yPointOfClosestApproachVsZ0wrtPV_";
731  yPointOfClosestApproachVsZ0wrtPV = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, Z0Bin, Z0Min, Z0Max, Y0Bin, Y0Min, Y0Max,"");
732  yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("d_{z} w.r.t. Beam Spot (cm)",1);
733  yPointOfClosestApproachVsZ0wrtPV->setAxisTitle("y component of Track PCA to PV (cm)",2);
734 
735  }
736 
737  if (doBSPlots_ || doAllPlots_) {
738  if (doTestPlots_) {
739 
740  int DxyBin = conf_.getParameter<int>( "DxyBin");
741  double DxyMin = conf_.getParameter<double>("DxyMin");
742  double DxyMax = conf_.getParameter<double>("DxyMax");
743 
744  int PhiBin = conf_.getParameter<int>( "PhiBin");
745  double PhiMin = conf_.getParameter<double>("PhiMin");
746  double PhiMax = conf_.getParameter<double>("PhiMax");
747 
748  histname = "TESTDistanceOfClosestApproachToBS_";
749  TESTDistanceOfClosestApproachToBS = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax);
750  TESTDistanceOfClosestApproachToBS->setAxisTitle("Track d_{xy} wrt beam spot (cm)",1);
751  TESTDistanceOfClosestApproachToBS->setAxisTitle("Number of Tracks",2);
752 
753  histname = "TESTDistanceOfClosestApproachToBSVsPhi_";
754  TESTDistanceOfClosestApproachToBSVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyBin, DxyMin, DxyMax,"");
755  TESTDistanceOfClosestApproachToBSVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes);
757  TESTDistanceOfClosestApproachToBSVsPhi->setAxisTitle("Track d_{xy} wrt beam spot (cm)",2);
758 
759  }
760 
761  }
762 
763  // book the Profile plots for DCA related histograms
764  // ---------------------------------------------------------------------------------//
765  if(doDCAPlots_ || doAllPlots_) {
766 
767  if (doDCAwrt000Plots_) {
768 
769  int EtaBin = conf_.getParameter<int>( "EtaBin");
770  double EtaMin = conf_.getParameter<double>("EtaMin");
771  double EtaMax = conf_.getParameter<double>("EtaMax");
772 
773  int PhiBin = conf_.getParameter<int>( "PhiBin");
774  double PhiMin = conf_.getParameter<double>("PhiMin");
775  double PhiMax = conf_.getParameter<double>("PhiMax");
776 
777  int DxyBin = conf_.getParameter<int>( "DxyBin");
778  double DxyMin = conf_.getParameter<double>("DxyMin");
779  double DxyMax = conf_.getParameter<double>("DxyMax");
780 
781  if (doThetaPlots_) {
782  int ThetaBin = conf_.getParameter<int>( "ThetaBin");
783  double ThetaMin = conf_.getParameter<double>("ThetaMin");
784  double ThetaMax = conf_.getParameter<double>("ThetaMax");
785 
786  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
787  histname = "DistanceOfClosestApproachVsTheta_";
788  DistanceOfClosestApproachVsTheta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, ThetaBin, ThetaMin, ThetaMax, DxyMin,DxyMax,"");
790  DistanceOfClosestApproachVsTheta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2);
791  }
792 
793  histname = "DistanceOfClosestApproachVsEta_";
794  DistanceOfClosestApproachVsEta = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, EtaBin, EtaMin, EtaMax, DxyMin, DxyMax,"");
796  DistanceOfClosestApproachVsEta->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2);
797  // temporary patch in order to put back those MEs in Muon Workspace
798 
799  histname = "DistanceOfClosestApproach_";
800  DistanceOfClosestApproach = ibooker.book1D(histname+CategoryName,histname+CategoryName,DxyBin,DxyMin,DxyMax);
801  DistanceOfClosestApproach->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",1);
802  DistanceOfClosestApproach->setAxisTitle("Number of Tracks",2);
803 
804  histname = "DistanceOfClosestApproachVsPhi_";
805  DistanceOfClosestApproachVsPhi = ibooker.bookProfile(histname+CategoryName,histname+CategoryName, PhiBin, PhiMin, PhiMax, DxyMin,DxyMax,"");
806  DistanceOfClosestApproachVsPhi->getTH1()->SetCanExtend(TH1::kAllAxes);
808  DistanceOfClosestApproachVsPhi->setAxisTitle("Track d_{xy} wrt (0,0,0) (cm)",2);
809  }
810  }
811 
812 
813  if (doSIPPlots_ || doAllPlots_) {
814  const double sipBins = 200;
815  const double sipMin = -20;
816  const double sipMax = 20;
817 
818  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
819 
820  // SIP wrt. beamspot
821  histname = "SIPDxyToBS_";
822  sipDxyToBS = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
823  sipDxyToBS->setAxisTitle("Track dxy significance wrt beam spot",1);
824  sipDxyToBS->setAxisTitle("Number of Tracks",2);
825 
826  histname = "SIPDzToBS_";
827  sipDzToBS = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
828  sipDzToBS->setAxisTitle("Track dz significance wrt beam spot",1);
829  sipDzToBS->setAxisTitle("Number of Tracks",2);
830 
831  // SIP wrt. vertex
832  histname = "SIP3DToPV_";
833  sip3dToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
834  sip3dToPV->setAxisTitle("3D IP significance wrt primary vertex",1);
835  sip3dToPV->setAxisTitle("Number of Tracks",2);
836 
837  histname = "SIP2DToPV_";
838  sip2dToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
839  sip2dToPV->setAxisTitle("2D IP significance wrt primary vertex",1);
840  sip2dToPV->setAxisTitle("Number of Tracks",2);
841 
842  histname = "SIPDxyToPV_";
843  sipDxyToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
844  sipDxyToPV->setAxisTitle("Track dxy significance wrt primary vertex",1);
845  sipDxyToPV->setAxisTitle("Number of Tracks",2);
846 
847  histname = "SIPDzToPV_";
848  sipDzToPV = ibooker.book1D(histname+CategoryName, histname+CategoryName, sipBins, sipMin, sipMax);
849  sipDzToPV->setAxisTitle("Track dz significance wrt primary vertex",1);
850  sipDzToPV->setAxisTitle("Number of Tracks",2);
851  }
852 }
853 
854 // -- Analyse
855 // ---------------------------------------------------------------------------------//
857 
858  good_vertices_ = 0;
859 
860  edm::Handle<reco::VertexCollection> recoPrimaryVerticesHandle;
861  iEvent.getByToken(pvToken_, recoPrimaryVerticesHandle);
862  if (recoPrimaryVerticesHandle.isValid())
863  if (recoPrimaryVerticesHandle->size() > 0)
864  for (auto v : *recoPrimaryVerticesHandle)
865  if (v.ndof() >= pvNDOF_ && !v.isFake())
866  ++good_vertices_;
867 }
868 
870  bx_ = iEvent.bunchCrossing();
871 }
872 
873 void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track)
874 {
875  double phi = track.phi();
876  // double eta = track.eta();
877  auto phiIn = track.innerPosition().phi();
878  auto etaIn = track.innerPosition().eta();
879  auto phiOut = track.outerPosition().phi();
880  auto etaOut = track.outerPosition().eta();
881 
882  int nRecHits = track.hitPattern().numberOfHits(reco::HitPattern::TRACK_HITS);
883  int nValidRecHits = track.numberOfValidHits();
884  int nLostRecHits = track.numberOfLostHits();
887 
888  double chi2 = track.chi2();
889  double chi2prob = TMath::Prob(track.chi2(),(int)track.ndof());
890  double chi2oNDF = track.normalizedChi2();
891 
893  // rec hits
894  NumberOfRecHitsPerTrack -> Fill(nRecHits);
895  NumberOfValidRecHitsPerTrack-> Fill(nValidRecHits);
896  NumberOfLostRecHitsPerTrack -> Fill(nLostRecHits);
897  NumberOfMIRecHitsPerTrack -> Fill(nLostIn);
898  NumberOfMORecHitsPerTrack -> Fill(nLostOut);
900 
901 
902  // 2D plots
904  NumberOfValidRecHitVsPhiVsEtaPerTrack->Fill(etaIn,phiIn,nValidRecHits);
905  NumberOfLostRecHitVsPhiVsEtaPerTrack->Fill(etaIn,phiIn,nLostRecHits);
906  NumberOfMIRecHitVsPhiVsEtaPerTrack->Fill(etaIn,phiIn,nLostIn);
907  NumberOfMORecHitVsPhiVsEtaPerTrack->Fill(etaOut,phiOut,nLostOut);
908  ValidFractionVsPhiVsEtaPerTrack -> Fill(etaIn,phiIn,track.validFraction());
909  }
910 
911  int nLayers[4] = { track.hitPattern().trackerLayersWithMeasurement(),
915  };
916 
917  // layers
918  for (int i=0;i<4;++i) NumberOfLayersPerTrack[i]->Fill(nLayers[i]);
919 
920  // 2D plots
922  for (int i=0;i<4;++i) NumberOfLayersVsPhiVsEtaPerTrack[i]->Fill(etaIn,phiIn,nLayers[i]);
923 
924  }
925 
928 
929 
931  // fitting
932  Chi2 -> Fill(chi2);
933  Chi2Prob -> Fill(chi2prob);
934  Chi2oNDF -> Fill(chi2oNDF);
935 
936  // DCA
937  // temporary patch in order to put back those MEs in Muon Workspace
938  if (doDCAPlots_) {
939  if (doDCAwrt000Plots_) {
941  DistanceOfClosestApproachVsPhi->Fill(phi, track.dxy());
942  }
943 
944  // PCA
948  }
949 
950  // algorithm
951  algorithm->Fill(static_cast<double>(track.algo()));
952  oriAlgo->Fill(static_cast<double>(track.originalAlgo()));
953 
954  // stopping source
955  int max = stoppingSource->getNbinsX();
956  double stop = track.stopReason() > max ? double(max-1) : static_cast<double>(track.stopReason());
957  stoppingSource->Fill(stop);
958  stoppingSourceVSeta->Fill(track.eta(),stop);
959  stoppingSourceVSphi->Fill(track.phi(),stop);
960  }
961 
962  if ( doLumiAnalysis_ ) {
964  Chi2oNDF_lumiFlag -> Fill(chi2oNDF);
965  }
966 
968 
969  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
970  iEvent.getByToken(beamSpotToken_,recoBeamSpotHandle);
971  const reco::BeamSpot& bs = *recoBeamSpotHandle;
972 
974  DistanceOfClosestApproachToBSVsPhi -> Fill(track.phi(), track.dxy(bs.position()));
975  zPointOfClosestApproachVsPhi -> Fill(track.phi(), track.vz());
976  xPointOfClosestApproachVsZ0wrt000 -> Fill(track.dz(), track.vx());
977  yPointOfClosestApproachVsZ0wrt000 -> Fill(track.dz(), track.vy());
978  xPointOfClosestApproachVsZ0wrtBS -> Fill(track.dz(bs.position()),(track.vx()-bs.position(track.vz()).x()));
979  yPointOfClosestApproachVsZ0wrtBS -> Fill(track.dz(bs.position()),(track.vy()-bs.position(track.vz()).y()));
980  if (doTestPlots_) {
981  TESTDistanceOfClosestApproachToBS -> Fill(track.dxy(bs.position(track.vz())));
982  TESTDistanceOfClosestApproachToBSVsPhi -> Fill(track.phi(), track.dxy(bs.position(track.vz())));
983  }
984 
985  if(doSIPPlots_) {
986  sipDxyToBS->Fill(track.dxy(bs.position())/track.dxyError());
987  sipDzToBS->Fill(track.dz(bs.position())/track.dzError());
988  }
989  }
990 
992  edm::Handle<reco::VertexCollection> recoPrimaryVerticesHandle;
993  iEvent.getByToken(pvToken_,recoPrimaryVerticesHandle);
994  if (recoPrimaryVerticesHandle.isValid() && recoPrimaryVerticesHandle->size() > 0) {
995  const reco::Vertex& pv = (*recoPrimaryVerticesHandle)[0];
996 
997 
999  //HI PLOTS///////
1001 
1002  if(doHIPlots_)
1003  {
1004  double longDCAsig = 0, transDCAsig = 0;
1005  double zerr2 = track.dzError()*track.dzError()+pv.zError()*pv.zError();
1006  double xyerr2 = track.d0Error()*track.d0Error()+pv.xError()*pv.yError();
1007  if(zerr2 > 0) longDCAsig = track.dz(pv.position())/zerr2;
1008  if(xyerr2 > 0) transDCAsig = track.dxy(pv.position())/xyerr2;
1009  LongDCASig->Fill(longDCAsig);
1010  TransDCASig->Fill(transDCAsig);
1011 
1012 
1013 
1014 
1016  {
1017  dNdEta_HighPurity->Fill(track.eta());
1018  dNdPhi_HighPurity->Fill(track.phi());
1019  dNdPt_HighPurity->Fill(track.ptError()/track.pt());
1020  NhitVsEta_HighPurity->Fill(track.eta(),track.numberOfValidHits());
1021  NhitVsPhi_HighPurity->Fill(track.phi(),track.numberOfValidHits());
1022  dNhitdPt_HighPurity->Fill(track.pt(),track.numberOfValidHits());
1023  Ptdist_HighPurity->Fill(track.pt());
1024  }//end of high quality tracks requirement
1025  }
1026 
1027 
1028  xPointOfClosestApproachToPV->Fill(track.vx()-pv.position().x());
1029  yPointOfClosestApproachToPV->Fill(track.vy()-pv.position().y());
1032  DistanceOfClosestApproachToPVVsPhi -> Fill(track.phi(), track.dxy(pv.position()));
1033  xPointOfClosestApproachVsZ0wrtPV -> Fill(track.dz(pv.position()),(track.vx()-pv.position().x()));
1034  yPointOfClosestApproachVsZ0wrtPV -> Fill(track.dz(pv.position()),(track.vy()-pv.position().y()));
1035 
1036 
1037  if(doSIPPlots_) {
1039  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
1040  reco::TransientTrack transTrack = theB->build(track);
1041 
1042  GlobalVector dir(track.px(), track.py(), track.pz());
1043  std::pair<bool, Measurement1D> ip3d = IPTools::signedImpactParameter3D(transTrack, dir, pv);
1044  std::pair<bool, Measurement1D> ip2d = IPTools::signedTransverseImpactParameter(transTrack, dir, pv);
1045  if(ip3d.first) sip3dToPV->Fill(ip3d.second.value() / ip3d.second.error());
1046  if(ip2d.first) sip2dToPV->Fill(ip2d.second.value() / ip2d.second.error());
1047  sipDxyToPV->Fill(track.dxy(pv.position())/track.dxyError());
1048  sipDzToPV->Fill(track.dz(pv.position())/track.dzError());
1049  }
1050  }
1051  }
1052 
1053  if(doDCAPlots_ || doAllPlots_) {
1054  if (doDCAwrt000Plots_) {
1055  if (doThetaPlots_) {
1056  DistanceOfClosestApproachVsTheta->Fill(track.theta(), track.d0());
1057  }
1058  DistanceOfClosestApproachVsEta->Fill(track.eta(), track.d0());
1059  }
1060 
1061  }
1062 
1063  //Tracker Specific Histograms
1066  }
1067 
1069  std::string StateName = conf_.getParameter<std::string>("MeasurementState");
1070 
1071  if (StateName == "All") {
1072  fillHistosForState(iSetup, track, std::string("OuterSurface"));
1073  fillHistosForState(iSetup, track, std::string("InnerSurface"));
1074  fillHistosForState(iSetup, track, std::string("ImpactPoint"));
1075  } else if (
1076  StateName != "OuterSurface" &&
1077  StateName != "InnerSurface" &&
1078  StateName != "ImpactPoint" &&
1079  StateName != "default"
1080  ) {
1081  fillHistosForState(iSetup, track, std::string("default"));
1082  } else {
1083  fillHistosForState(iSetup, track, StateName);
1084  }
1085  }
1086 
1087  if ( doAllPlots_ ) {
1088  }
1089 
1090 }
1091 
1092 void TrackAnalyzer::fillHistosForEfficiencyFromHitPatter(const reco::Track & track, const std::string suffix, const unsigned int monitoring) {
1093 
1095 
1096  int mon = -1;
1097  for (int i=0; i<monQuantity::END; i++) {
1098  if (monName[i] == suffix) mon = i;
1099  }
1100 
1101  if (track.pt() > 1.0 && track.dxy() < 0.1 and monitoring > 0) {
1102  auto hp = track.hitPattern();
1103  // Here hit_category is meant to iterate over
1104  // reco::HitPattern::HitCategory, defined here:
1105  // http://cmslxr.fnal.gov/dxr/CMSSW/source/DataFormats/TrackReco/interface/HitPattern.h
1106  for (unsigned int category = 0; category < 3; ++category) {
1107  for (int hit = 0; hit < hp.numberOfHits((reco::HitPattern::HitCategory)(category)); ++hit) {
1108  auto pattern = hp.getHitPattern((reco::HitPattern::HitCategory)(category), hit);
1109  // Boolean bad is missing simply because it is inferred and the only missing case.
1110  bool valid = hp.validHitFilter(pattern);
1111  bool missing = hp.missingHitFilter(pattern);
1112  bool inactive = hp.inactiveHitFilter(pattern);
1113  int hit_type = -1;
1114  hit_type = valid ? 0 :
1115  ( missing ? 1 :
1116  ( inactive ? 2 : 3));
1117  if (hits_valid_.find(Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)) == hits_valid_.end()) {
1118  LogDebug("TrackAnalyzer") << "Invalid combination of detector and subdetector: ("
1119  << hp.getSubStructure(pattern) << ", "
1120  << hp.getSubSubStructure(pattern)
1121  << "): ignoring it.\n";
1122  continue;
1123  }
1124  switch (hit_type) {
1125  case 0:
1126  hits_valid_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring);
1127  hits_total_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring);
1128  break;
1129  case 1:
1130  hits_missing_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring);
1131  hits_total_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring);
1132  break;
1133  case 2:
1134  hits_inactive_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring);
1135  break;
1136  case 3:
1137  hits_bad_[Key(hp.getSubStructure(pattern), hp.getSubSubStructure(pattern), mon)]->Fill(monitoring);
1138  break;
1139  default:
1140  LogDebug("TrackAnalyzer") << "Invalid hit category used " << hit_type << " ignored\n";
1141  }
1142  }
1143  }
1144  }
1145  }
1146 
1147 }
1148 
1149 // book histograms at differnt measurement points
1150 // ---------------------------------------------------------------------------------//
1152 {
1153 
1154  // parameters from the configuration
1155  std::string QualName = conf_.getParameter<std::string>("Quality");
1157 
1158  // use the AlgoName and Quality Name
1159  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
1160 
1161  // get binning from the configuration
1162  double Chi2NDFMin = conf_.getParameter<double>("Chi2NDFMin");
1163  double Chi2NDFMax = conf_.getParameter<double>("Chi2NDFMax");
1164 
1165  int RecHitBin = conf_.getParameter<int>( "RecHitBin");
1166  double RecHitMin = conf_.getParameter<double>("RecHitMin");
1167  double RecHitMax = conf_.getParameter<double>("RecHitMax");
1168 
1169  int RecLayBin = conf_.getParameter<int>( "RecHitBin");
1170  double RecLayMin = conf_.getParameter<double>("RecHitMin");
1171  double RecLayMax = conf_.getParameter<double>("RecHitMax");
1172 
1173 
1174  int PhiBin = conf_.getParameter<int>( "PhiBin");
1175  double PhiMin = conf_.getParameter<double>("PhiMin");
1176  double PhiMax = conf_.getParameter<double>("PhiMax");
1177 
1178  int EtaBin = conf_.getParameter<int>( "EtaBin");
1179  double EtaMin = conf_.getParameter<double>("EtaMin");
1180  double EtaMax = conf_.getParameter<double>("EtaMax");
1181 
1182  int ThetaBin = conf_.getParameter<int>( "ThetaBin");
1183  double ThetaMin = conf_.getParameter<double>("ThetaMin");
1184  double ThetaMax = conf_.getParameter<double>("ThetaMax");
1185 
1186  int TrackQBin = conf_.getParameter<int>( "TrackQBin");
1187  double TrackQMin = conf_.getParameter<double>("TrackQMin");
1188  double TrackQMax = conf_.getParameter<double>("TrackQMax");
1189 
1190  int TrackPtBin = conf_.getParameter<int>( "TrackPtBin");
1191  double TrackPtMin = conf_.getParameter<double>("TrackPtMin");
1192  double TrackPtMax = conf_.getParameter<double>("TrackPtMax");
1193 
1194  int TrackPBin = conf_.getParameter<int>( "TrackPBin");
1195  double TrackPMin = conf_.getParameter<double>("TrackPMin");
1196  double TrackPMax = conf_.getParameter<double>("TrackPMax");
1197 
1198  int TrackPxBin = conf_.getParameter<int>( "TrackPxBin");
1199  double TrackPxMin = conf_.getParameter<double>("TrackPxMin");
1200  double TrackPxMax = conf_.getParameter<double>("TrackPxMax");
1201 
1202  int TrackPyBin = conf_.getParameter<int>( "TrackPyBin");
1203  double TrackPyMin = conf_.getParameter<double>("TrackPyMin");
1204  double TrackPyMax = conf_.getParameter<double>("TrackPyMax");
1205 
1206  int TrackPzBin = conf_.getParameter<int>( "TrackPzBin");
1207  double TrackPzMin = conf_.getParameter<double>("TrackPzMin");
1208  double TrackPzMax = conf_.getParameter<double>("TrackPzMax");
1209 
1210  int ptErrBin = conf_.getParameter<int>( "ptErrBin");
1211  double ptErrMin = conf_.getParameter<double>("ptErrMin");
1212  double ptErrMax = conf_.getParameter<double>("ptErrMax");
1213 
1214  int pxErrBin = conf_.getParameter<int>( "pxErrBin");
1215  double pxErrMin = conf_.getParameter<double>("pxErrMin");
1216  double pxErrMax = conf_.getParameter<double>("pxErrMax");
1217 
1218  int pyErrBin = conf_.getParameter<int>( "pyErrBin");
1219  double pyErrMin = conf_.getParameter<double>("pyErrMin");
1220  double pyErrMax = conf_.getParameter<double>("pyErrMax");
1221 
1222  int pzErrBin = conf_.getParameter<int>( "pzErrBin");
1223  double pzErrMin = conf_.getParameter<double>("pzErrMin");
1224  double pzErrMax = conf_.getParameter<double>("pzErrMax");
1225 
1226  int pErrBin = conf_.getParameter<int>( "pErrBin");
1227  double pErrMin = conf_.getParameter<double>("pErrMin");
1228  double pErrMax = conf_.getParameter<double>("pErrMax");
1229 
1230  int phiErrBin = conf_.getParameter<int>( "phiErrBin");
1231  double phiErrMin = conf_.getParameter<double>("phiErrMin");
1232  double phiErrMax = conf_.getParameter<double>("phiErrMax");
1233 
1234  int etaErrBin = conf_.getParameter<int>( "etaErrBin");
1235  double etaErrMin = conf_.getParameter<double>("etaErrMin");
1236  double etaErrMax = conf_.getParameter<double>("etaErrMax");
1237 
1238 
1239  double Chi2ProbMin = conf_.getParameter<double>("Chi2ProbMin");
1240  double Chi2ProbMax = conf_.getParameter<double>("Chi2ProbMax");
1241 
1242  ibooker.setCurrentFolder(TopFolder_);
1243 
1244  TkParameterMEs tkmes;
1245 
1246  std::string histTag = (sname == "default") ? CategoryName : sname + "_" + CategoryName;
1247 
1248  if(doAllPlots_) {
1249 
1250  // general properties
1251  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
1252 
1253  if (doThetaPlots_) {
1254  histname = "Chi2oNDFVsTheta_" + histTag;
1255  tkmes.Chi2oNDFVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax,"");
1256  tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta",1);
1257  tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf",2);
1258  }
1259  histname = "Chi2oNDFVsPhi_" + histTag;
1260  tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax,"");
1261  tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi",1);
1262  tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf",2);
1263 
1264  histname = "Chi2oNDFVsEta_" + histTag;
1265  tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax,"");
1266  tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta",1);
1267  tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf",2);
1268 
1269  histname = "Chi2ProbVsPhi_" + histTag;
1270  tkmes.Chi2ProbVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax);
1271  tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi" ,1);
1272  tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability",2);
1273 
1274  histname = "Chi2ProbVsEta_" + histTag;
1275  tkmes.Chi2ProbVsEta = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax);
1276  tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta" ,1);
1277  tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability",2);
1278 
1279  }
1280 
1281  // general properties
1282  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
1283 
1284  histname = "TrackP_" + histTag;
1285  tkmes.TrackP = ibooker.book1D(histname, histname, TrackPBin, TrackPMin, TrackPMax);
1286  tkmes.TrackP->setAxisTitle("Track |p| (GeV/c)", 1);
1287  tkmes.TrackP->setAxisTitle("Number of Tracks",2);
1288 
1289  histname = "TrackPt_" + histTag;
1290  tkmes.TrackPt = ibooker.book1D(histname, histname, TrackPtBin, TrackPtMin, TrackPtMax);
1291  tkmes.TrackPt->setAxisTitle("Track p_{T} (GeV/c)", 1);
1292  tkmes.TrackPt->setAxisTitle("Number of Tracks",2);
1293 
1294  if (doTrackPxPyPlots_) {
1295  histname = "TrackPx_" + histTag;
1296  tkmes.TrackPx = ibooker.book1D(histname, histname, TrackPxBin, TrackPxMin, TrackPxMax);
1297  tkmes.TrackPx->setAxisTitle("Track p_{x} (GeV/c)", 1);
1298  tkmes.TrackPx->setAxisTitle("Number of Tracks",2);
1299 
1300  histname = "TrackPy_" + histTag;
1301  tkmes.TrackPy = ibooker.book1D(histname, histname, TrackPyBin, TrackPyMin, TrackPyMax);
1302  tkmes.TrackPy->setAxisTitle("Track p_{y} (GeV/c)", 1);
1303  tkmes.TrackPy->setAxisTitle("Number of Tracks",2);
1304  }
1305  histname = "TrackPz_" + histTag;
1306  tkmes.TrackPz = ibooker.book1D(histname, histname, TrackPzBin, TrackPzMin, TrackPzMax);
1307  tkmes.TrackPz->setAxisTitle("Track p_{z} (GeV/c)", 1);
1308  tkmes.TrackPz->setAxisTitle("Number of Tracks",2);
1309 
1310  histname = "TrackPhi_" + histTag;
1311  tkmes.TrackPhi = ibooker.book1D(histname, histname, PhiBin, PhiMin, PhiMax);
1312  tkmes.TrackPhi->setAxisTitle("Track #phi", 1);
1313  tkmes.TrackPhi->setAxisTitle("Number of Tracks",2);
1314 
1315  histname = "TrackEta_" + histTag;
1316  tkmes.TrackEta = ibooker.book1D(histname, histname, EtaBin, EtaMin, EtaMax);
1317  tkmes.TrackEta->setAxisTitle("Track #eta", 1);
1318  tkmes.TrackEta->setAxisTitle("Number of Tracks",2);
1319 
1320  histname = "TrackEtaPhi_" + histTag;
1321  tkmes.TrackEtaPhi = ibooker.book2D(histname, histname, EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax);
1322  tkmes.TrackEtaPhi->setAxisTitle("Track #eta", 1);
1323  tkmes.TrackEtaPhi->setAxisTitle("Track #phi", 2);
1324 
1325  histname = "TrackEtaPhiInner_" + histTag;
1326  tkmes.TrackEtaPhiInner = ibooker.book2D(histname, histname, EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax);
1327  tkmes.TrackEtaPhiInner->setAxisTitle("Track #eta", 1);
1328  tkmes.TrackEtaPhiInner->setAxisTitle("Track #phi", 2);
1329 
1330  histname = "TrackEtaPhiOuter_" + histTag;
1331  tkmes.TrackEtaPhiOuter = ibooker.book2D(histname, histname, EtaBin, EtaMin, EtaMax, PhiBin, PhiMin, PhiMax);
1332  tkmes.TrackEtaPhiOuter->setAxisTitle("Track #eta", 1);
1333  tkmes.TrackEtaPhiOuter->setAxisTitle("Track #phi", 2);
1334 
1335 
1336 
1337  if (doThetaPlots_) {
1338  histname = "TrackTheta_" + histTag;
1339  tkmes.TrackTheta = ibooker.book1D(histname, histname, ThetaBin, ThetaMin, ThetaMax);
1340  tkmes.TrackTheta->setAxisTitle("Track #theta", 1);
1341  tkmes.TrackTheta->setAxisTitle("Number of Tracks",2);
1342  }
1343  histname = "TrackQ_" + histTag;
1344  tkmes.TrackQ = ibooker.book1D(histname, histname, TrackQBin, TrackQMin, TrackQMax);
1345  tkmes.TrackQ->setAxisTitle("Track Charge", 1);
1346  tkmes.TrackQ->setAxisTitle("Number of Tracks",2);
1347 
1348  histname = "TrackPErrOverP_" + histTag;
1349  tkmes.TrackPErr = ibooker.book1D(histname, histname, pErrBin, pErrMin, pErrMax);
1350  tkmes.TrackPErr->setAxisTitle("track error(p)/p", 1);
1351  tkmes.TrackPErr->setAxisTitle("Number of Tracks",2);
1352 
1353  histname = "TrackPtErrOverPt_" + histTag;
1354  tkmes.TrackPtErr = ibooker.book1D(histname, histname, ptErrBin, ptErrMin, ptErrMax);
1355  tkmes.TrackPtErr->setAxisTitle("track error(p_{T})/p_{T}", 1);
1356  tkmes.TrackPtErr->setAxisTitle("Number of Tracks",2);
1357 
1358  histname = "TrackPtErrOverPtVsEta_" + histTag;
1359  tkmes.TrackPtErrVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, ptErrMin, ptErrMax);
1360  tkmes.TrackPtErrVsEta->setAxisTitle("Track #eta",1);
1361  tkmes.TrackPtErrVsEta->setAxisTitle("track error(p_{T})/p_{T}", 2);
1362 
1363  if (doTrackPxPyPlots_) {
1364  histname = "TrackPxErrOverPx_" + histTag;
1365  tkmes.TrackPxErr = ibooker.book1D(histname, histname, pxErrBin, pxErrMin, pxErrMax);
1366  tkmes.TrackPxErr->setAxisTitle("track error(p_{x})/p_{x}", 1);
1367  tkmes.TrackPxErr->setAxisTitle("Number of Tracks",2);
1368 
1369  histname = "TrackPyErrOverPy_" + histTag;
1370  tkmes.TrackPyErr = ibooker.book1D(histname, histname, pyErrBin, pyErrMin, pyErrMax);
1371  tkmes.TrackPyErr->setAxisTitle("track error(p_{y})/p_{y}", 1);
1372  tkmes.TrackPyErr->setAxisTitle("Number of Tracks",2);
1373  }
1374  histname = "TrackPzErrOverPz_" + histTag;
1375  tkmes.TrackPzErr = ibooker.book1D(histname, histname, pzErrBin, pzErrMin, pzErrMax);
1376  tkmes.TrackPzErr->setAxisTitle("track error(p_{z})/p_{z}", 1);
1377  tkmes.TrackPzErr->setAxisTitle("Number of Tracks",2);
1378 
1379  histname = "TrackPhiErr_" + histTag;
1380  tkmes.TrackPhiErr = ibooker.book1D(histname, histname, phiErrBin, phiErrMin, phiErrMax);
1381  tkmes.TrackPhiErr->setAxisTitle("track error(#phi)");
1382  tkmes.TrackPhiErr->setAxisTitle("Number of Tracks",2);
1383 
1384  histname = "TrackEtaErr_" + histTag;
1385  tkmes.TrackEtaErr = ibooker.book1D(histname, histname, etaErrBin, etaErrMin, etaErrMax);
1386  tkmes.TrackEtaErr->setAxisTitle("track error(#eta)");
1387  tkmes.TrackEtaErr->setAxisTitle("Number of Tracks",2);
1388 
1389  // rec hit profiles
1390  ibooker.setCurrentFolder(TopFolder_+"/GeneralProperties");
1391  histname = "NumberOfRecHitsPerTrackVsPhi_" + histTag;
1392  tkmes.NumberOfRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitBin, RecHitMin, RecHitMax,"");
1393  tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1);
1394  tkmes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of RecHits in each Track",2);
1395 
1396  if (doThetaPlots_) {
1397  histname = "NumberOfRecHitsPerTrackVsTheta_" + histTag;
1398  tkmes.NumberOfRecHitsPerTrackVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecHitBin, RecHitMin, RecHitMax,"");
1399  tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Track #phi",1);
1400  tkmes.NumberOfRecHitsPerTrackVsTheta->setAxisTitle("Number of RecHits in each Track",2);
1401  }
1402  histname = "NumberOfRecHitsPerTrackVsEta_" + histTag;
1403  tkmes.NumberOfRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitBin, RecHitMin, RecHitMax,"");
1404  tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1);
1405  tkmes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of RecHits in each Track",2);
1406 
1407  histname = "NumberOfValidRecHitsPerTrackVsPhi_" + histTag;
1408  tkmes.NumberOfValidRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecHitMin, RecHitMax,"");
1409  tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1);
1410  tkmes.NumberOfValidRecHitsPerTrackVsPhi->setAxisTitle("Number of valid RecHits in each Track",2);
1411 
1412  // std::cout << "[TrackAnalyzer::bookHistosForState] histTag: " << histTag << std::endl;
1413  histname = "NumberOfValidRecHitsPerTrackVsEta_" + histTag;
1414  tkmes.NumberOfValidRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecHitMin, RecHitMax,"");
1415  tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1);
1416  tkmes.NumberOfValidRecHitsPerTrackVsEta->setAxisTitle("Number of valid RecHits in each Track",2);
1417 
1419  histname = "NumberOfLayersPerTrackVsPhi_" + histTag;
1420  tkmes.NumberOfLayersPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, RecLayBin, RecLayMin, RecLayMax,"");
1421  tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi",1);
1422  tkmes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of Layers in each Track",2);
1423 
1424  if (doThetaPlots_) {
1425  histname = "NumberOfLayersPerTrackVsTheta_" + histTag;
1426  tkmes.NumberOfLayersPerTrackVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, RecLayBin, RecLayMin, RecLayMax,"");
1427  tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Track #phi",1);
1428  tkmes.NumberOfLayersPerTrackVsTheta->setAxisTitle("Number of Layers in each Track",2);
1429  }
1430  histname = "NumberOfLayersPerTrackVsEta_" + histTag;
1431  tkmes.NumberOfLayersPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, RecLayBin, RecLayMin, RecLayMax,"");
1432  tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta",1);
1433  tkmes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of Layers in each Track",2);
1434 
1435  if (doThetaPlots_) {
1436  histname = "Chi2oNDFVsTheta_" + histTag;
1437  tkmes.Chi2oNDFVsTheta = ibooker.bookProfile(histname, histname, ThetaBin, ThetaMin, ThetaMax, Chi2NDFMin, Chi2NDFMax,"");
1438  tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #theta",1);
1439  tkmes.Chi2oNDFVsTheta->setAxisTitle("Track #chi^{2}/ndf",2);
1440  }
1441  if (doAllPlots_) {
1442  histname = "Chi2oNDFVsPhi_" + histTag;
1443  tkmes.Chi2oNDFVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, Chi2NDFMin, Chi2NDFMax,"");
1444  tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #phi",1);
1445  tkmes.Chi2oNDFVsPhi->setAxisTitle("Track #chi^{2}/ndf",2);
1446 
1447  histname = "Chi2oNDFVsEta_" + histTag;
1448  tkmes.Chi2oNDFVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, Chi2NDFMin, Chi2NDFMax,"");
1449  tkmes.Chi2oNDFVsEta->setAxisTitle("Track #eta",1);
1450  tkmes.Chi2oNDFVsEta->setAxisTitle("Track #chi^{2}/ndf",2);
1451 
1452  histname = "Chi2ProbVsPhi_" + histTag;
1453  tkmes.Chi2ProbVsPhi = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, PhiBin, PhiMin, PhiMax, Chi2ProbMin, Chi2ProbMax);
1454  tkmes.Chi2ProbVsPhi->setAxisTitle("Tracks #phi" ,1);
1455  tkmes.Chi2ProbVsPhi->setAxisTitle("Track #chi^{2} probability",2);
1456 
1457  histname = "Chi2ProbVsEta_" + histTag;
1458  tkmes.Chi2ProbVsEta = ibooker.bookProfile(histname+CategoryName, histname+CategoryName, EtaBin, EtaMin, EtaMax, Chi2ProbMin, Chi2ProbMax);
1459  tkmes.Chi2ProbVsEta->setAxisTitle("Tracks #eta" ,1);
1460  tkmes.Chi2ProbVsEta->setAxisTitle("Track #chi^{2} probability",2);
1461  }
1462 
1463  // now put the MEs in the map
1464  TkParameterMEMap.insert( std::make_pair(sname, tkmes) );
1465 
1466 }
1467 
1468 
1469 // fill histograms at differnt measurement points
1470 // ---------------------------------------------------------------------------------//
1472 {
1473  //get the kinematic parameters
1474  double p, px, py, pz, pt, theta, phi, eta, q;
1475  double pxerror, pyerror, pzerror, pterror, perror, phierror, etaerror;
1476 
1477  auto phiIn = track.innerPosition().phi();
1478  auto etaIn = track.innerPosition().eta();
1479  auto phiOut = track.outerPosition().phi();
1480  auto etaOut = track.outerPosition().eta();
1481 
1482 
1483  if (sname == "default") {
1484 
1485  p = track.p();
1486  px = track.px();
1487  py = track.py();
1488  pz = track.pz();
1489  pt = track.pt();
1490  phi = track.phi();
1491  theta = track.theta();
1492  eta = track.eta();
1493  q = track.charge();
1494 
1495  pterror = (pt) ? track.ptError()/(pt*pt) : 0.0;
1496  pxerror = -1.0;
1497  pyerror = -1.0;
1498  pzerror = -1.0;
1499  perror = -1.0;
1500  phierror = track.phiError();
1501  etaerror = track.etaError();
1502 
1503  } else {
1504 
1506  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
1507  reco::TransientTrack TransTrack = theB->build(track);
1508 
1510 
1511  if (sname == "OuterSurface") TSOS = TransTrack.outermostMeasurementState();
1512  else if (sname == "InnerSurface") TSOS = TransTrack.innermostMeasurementState();
1513  else if (sname == "ImpactPoint") TSOS = TransTrack.impactPointState();
1514 
1515  p = TSOS.globalMomentum().mag();
1516  px = TSOS.globalMomentum().x();
1517  py = TSOS.globalMomentum().y();
1518  pz = TSOS.globalMomentum().z();
1519  pt = TSOS.globalMomentum().perp();
1520  phi = TSOS.globalMomentum().phi();
1521  theta = TSOS.globalMomentum().theta();
1522  eta = TSOS.globalMomentum().eta();
1523  q = TSOS.charge();
1524 
1525  //get the error of the kinimatic parameters
1527  double partialPterror = errors(3,3)*pow(TSOS.globalMomentum().x(),2) + errors(4,4)*pow(TSOS.globalMomentum().y(),2);
1528  pterror = sqrt(partialPterror)/TSOS.globalMomentum().perp();
1529  pxerror = sqrt(errors(3,3))/TSOS.globalMomentum().x();
1530  pyerror = sqrt(errors(4,4))/TSOS.globalMomentum().y();
1531  pzerror = sqrt(errors(5,5))/TSOS.globalMomentum().z();
1532  perror = sqrt(partialPterror+errors(5,5)*pow(TSOS.globalMomentum().z(),2))/TSOS.globalMomentum().mag();
1533  phierror = sqrt(TSOS.curvilinearError().matrix()(2,2));
1534  etaerror = sqrt(TSOS.curvilinearError().matrix()(1,1))*fabs(sin(TSOS.globalMomentum().theta()));
1535 
1536  }
1537 
1538  std::map<std::string, TkParameterMEs>::iterator iPos = TkParameterMEMap.find(sname);
1539  if (iPos != TkParameterMEMap.end()) {
1540 
1541  TkParameterMEs tkmes = iPos->second;
1542 
1543  // momentum
1544  tkmes.TrackP->Fill(p);
1545  if (doTrackPxPyPlots_) {
1546  tkmes.TrackPx->Fill(px);
1547  tkmes.TrackPy->Fill(py);
1548  }
1549  tkmes.TrackPz->Fill(pz);
1550  tkmes.TrackPt->Fill(pt);
1551 
1552  // angles
1553  tkmes.TrackPhi->Fill(phi);
1554  tkmes.TrackEta->Fill(eta);
1555  tkmes.TrackEtaPhi->Fill(eta,phi);
1556  tkmes.TrackEtaPhiInner->Fill(etaIn,phiIn);
1557  tkmes.TrackEtaPhiOuter->Fill(etaOut,phiOut);
1558 
1559  if (doThetaPlots_) {
1560  tkmes.TrackTheta->Fill(theta);
1561  }
1562  tkmes.TrackQ->Fill(q);
1563 
1564  // errors
1565  tkmes.TrackPtErr->Fill(pterror);
1566  tkmes.TrackPtErrVsEta->Fill(eta,pterror);
1567  if (doTrackPxPyPlots_) {
1568  tkmes.TrackPxErr->Fill(pxerror);
1569  tkmes.TrackPyErr->Fill(pyerror);
1570  }
1571  tkmes.TrackPzErr->Fill(pzerror);
1572  tkmes.TrackPErr->Fill(perror);
1573  tkmes.TrackPhiErr->Fill(phierror);
1574  tkmes.TrackEtaErr->Fill(etaerror);
1575 
1576  int nRecHits = track.hitPattern().numberOfHits(reco::HitPattern::TRACK_HITS);
1577  int nValidRecHits = track.numberOfValidHits();
1578  // rec hits
1579  tkmes.NumberOfRecHitsPerTrackVsPhi->Fill(phi, nRecHits);
1580  if (doThetaPlots_) {
1581  tkmes.NumberOfRecHitsPerTrackVsTheta->Fill(theta,nRecHits);
1582  }
1583  tkmes.NumberOfRecHitsPerTrackVsEta->Fill(eta, nRecHits);
1584 
1585  tkmes.NumberOfValidRecHitsPerTrackVsPhi->Fill(phi, nValidRecHits);
1586  tkmes.NumberOfValidRecHitsPerTrackVsEta->Fill(eta, nValidRecHits);
1587 
1588  int nLayers = track.hitPattern().trackerLayersWithMeasurement();
1589  // rec layers
1590  tkmes.NumberOfLayersPerTrackVsPhi->Fill(phi, nLayers);
1591  if (doThetaPlots_) {
1592  tkmes.NumberOfLayersPerTrackVsTheta->Fill(theta, nLayers);
1593  }
1594  tkmes.NumberOfLayersPerTrackVsEta->Fill(eta, nLayers);
1595 
1596  double chi2prob = TMath::Prob(track.chi2(),(int)track.ndof());
1597  double chi2oNDF = track.normalizedChi2();
1598 
1599  if(doAllPlots_) {
1600 
1601  // general properties
1602  if (doThetaPlots_) {
1603  tkmes.Chi2oNDFVsTheta->Fill(theta, chi2oNDF);
1604  }
1605  tkmes.Chi2oNDFVsPhi->Fill(phi, chi2oNDF);
1606  tkmes.Chi2oNDFVsEta->Fill(eta, chi2oNDF);
1607  tkmes.Chi2ProbVsPhi->Fill(phi, chi2prob);
1608  tkmes.Chi2ProbVsEta->Fill(eta, chi2prob);
1609  }
1610 
1611  }
1612 
1613 }
1614 
1615 
1617 {
1618 
1619  // parameters from the configuration
1620  std::string QualName = conf_.getParameter<std::string>("Quality");
1622 
1623  // use the AlgoName and Quality Name
1624  std::string CategoryName = QualName != "" ? AlgoName + "_" + QualName : AlgoName;
1625 
1626  int PhiBin = conf_.getParameter<int>( "PhiBin");
1627  double PhiMin = conf_.getParameter<double>("PhiMin");
1628  double PhiMax = conf_.getParameter<double>("PhiMax");
1629 
1630  int EtaBin = conf_.getParameter<int>( "EtaBin");
1631  double EtaMin = conf_.getParameter<double>("EtaMin");
1632  double EtaMax = conf_.getParameter<double>("EtaMax");
1633 
1634  // book hit property histograms
1635  // ---------------------------------------------------------------------------------//
1636  ibooker.setCurrentFolder(TopFolder_+"/HitProperties");
1637 
1638 
1639 
1640  std::vector<std::string> subdetectors = conf_.getParameter<std::vector<std::string> >("subdetectors");
1641  int detBin = conf_.getParameter<int>("subdetectorBin");
1642 
1643  for ( auto det : subdetectors ) {
1644 
1645  // hits properties
1646  ibooker.setCurrentFolder(TopFolder_+"/HitProperties/"+det);
1647 
1648  TkRecHitsPerSubDetMEs recHitsPerSubDet_mes;
1649 
1650  recHitsPerSubDet_mes.detectorTag = det;
1651  int detID = -1;
1652  if ( det == "TIB" ) detID = StripSubdetector::TIB;
1653  if ( det == "TOB" ) detID = StripSubdetector::TOB;
1654  if ( det == "TID" ) detID = StripSubdetector::TID;
1655  if ( det == "TEC" ) detID = StripSubdetector::TEC;
1656  if ( det == "PixBarrel" ) detID = PixelSubdetector::PixelBarrel;
1657  if ( det == "PixEndcap" ) detID = PixelSubdetector::PixelEndcap;
1658  recHitsPerSubDet_mes.detectorId = detID;
1659 
1660  histname = "NumberOfRecHitsPerTrack_" + det + "_" + CategoryName;
1661  recHitsPerSubDet_mes.NumberOfRecHitsPerTrack = ibooker.book1D(histname, histname, detBin, -0.5, double(detBin)-0.5);
1662  recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of " + det + " valid RecHits in each Track",1);
1663  recHitsPerSubDet_mes.NumberOfRecHitsPerTrack->setAxisTitle("Number of Tracks", 2);
1664 
1665  histname = "NumberOfRecHitsPerTrackVsPhi_" + det + "_" + CategoryName;
1666  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin)-0.5,"");
1667  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Track #phi",1);
1668  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsPhi->setAxisTitle("Number of " + det + " valid RecHits in each Track",2);
1669 
1670  histname = "NumberOfRecHitsPerTrackVsEta_" + det + "_" + CategoryName;
1671  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin)-0.5,"");
1672  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Track #eta",1);
1673  recHitsPerSubDet_mes.NumberOfRecHitsPerTrackVsEta->setAxisTitle("Number of " + det + " valid RecHits in each Track",2);
1674 
1675  histname = "NumberOfLayersPerTrack_" + det + "_" + CategoryName;
1676  recHitsPerSubDet_mes.NumberOfLayersPerTrack = ibooker.book1D(histname, histname, detBin, -0.5, double(detBin)-0.5);
1677  recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of " + det + " valid Layers in each Track",1);
1678  recHitsPerSubDet_mes.NumberOfLayersPerTrack->setAxisTitle("Number of Tracks", 2);
1679 
1680  histname = "NumberOfLayersPerTrackVsPhi_" + det + "_" + CategoryName;
1681  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi = ibooker.bookProfile(histname, histname, PhiBin, PhiMin, PhiMax, detBin, -0.5, double(detBin)-0.5,"");
1682  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Track #phi",1);
1683  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsPhi->setAxisTitle("Number of " + det + " valid Layers in each Track",2);
1684 
1685  histname = "NumberOfLayersPerTrackVsEta_" + det + "_" + CategoryName;
1686  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta = ibooker.bookProfile(histname, histname, EtaBin, EtaMin, EtaMax, detBin, -0.5, double(detBin)-0.5,"");
1687  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Track #eta",1);
1688  recHitsPerSubDet_mes.NumberOfLayersPerTrackVsEta->setAxisTitle("Number of " + det + " valid Layers in each Track",2);
1689 
1690  TkRecHitsPerSubDetMEMap.insert(std::pair<std::string,TkRecHitsPerSubDetMEs>(det,recHitsPerSubDet_mes));
1691 
1692 
1693  }
1694 
1695 
1696 }
1697 
1698 
1700 {
1701 
1702  double phi = track.phi();
1703  double eta = track.eta();
1704 
1705  for ( std::map<std::string,TkRecHitsPerSubDetMEs>::iterator it = TkRecHitsPerSubDetMEMap.begin();
1706  it != TkRecHitsPerSubDetMEMap.end(); it++ ) {
1707 
1708  int nValidLayers = 0;
1709  int nValidRecHits = 0;
1710  int substr = it->second.detectorId;
1711  switch(substr) {
1712  case StripSubdetector::TIB :
1713  nValidLayers = track.hitPattern().stripTIBLayersWithMeasurement(); // case 0: strip TIB
1714  nValidRecHits = track.hitPattern().numberOfValidStripTIBHits(); // case 0: strip TIB
1715  break;
1716  case StripSubdetector::TID :
1717  nValidLayers = track.hitPattern().stripTIDLayersWithMeasurement(); // case 0: strip TID
1718  nValidRecHits = track.hitPattern().numberOfValidStripTIDHits(); // case 0: strip TID
1719  break;
1720  case StripSubdetector::TOB :
1721  nValidLayers = track.hitPattern().stripTOBLayersWithMeasurement(); // case 0: strip TOB
1722  nValidRecHits = track.hitPattern().numberOfValidStripTOBHits(); // case 0: strip TOB
1723  break;
1724  case StripSubdetector::TEC :
1725  nValidLayers = track.hitPattern().stripTECLayersWithMeasurement(); // case 0: strip TEC
1726  nValidRecHits = track.hitPattern().numberOfValidStripTECHits(); // case 0: strip TEC
1727  break;
1729  nValidLayers = track.hitPattern().pixelBarrelLayersWithMeasurement(); // case 0: pixel PXB
1730  nValidRecHits = track.hitPattern().numberOfValidPixelBarrelHits(); // case 0: pixel PXB
1731  break;
1733  nValidLayers = track.hitPattern().pixelEndcapLayersWithMeasurement(); // case 0: pixel PXF
1734  nValidRecHits = track.hitPattern().numberOfValidPixelEndcapHits(); // case 0: pixel PXF
1735  break;
1736  default :
1737  break;
1738  }
1739 
1740  //Fill Layers and RecHits
1741  it->second.NumberOfRecHitsPerTrack -> Fill(nValidRecHits);
1742  it->second.NumberOfRecHitsPerTrackVsPhi -> Fill(phi, nValidRecHits);
1743  it->second.NumberOfRecHitsPerTrackVsEta -> Fill(eta, nValidRecHits);
1744 
1745  it->second.NumberOfLayersPerTrack -> Fill(nValidLayers);
1746  it->second.NumberOfLayersPerTrackVsPhi -> Fill(phi, nValidLayers);
1747  it->second.NumberOfLayersPerTrackVsEta -> Fill(eta, nValidLayers);
1748  }
1749 
1750 }
1751 //
1752 // -- Set Lumi Flag
1753 //
1755 
1756  TkParameterMEs tkmes;
1759 }
1760 //
1761 // -- Apply SoftReset
1762 //
1764  TkParameterMEs tkmes;
1765  dqmStore_->softReset(Chi2oNDF);
1766  dqmStore_->softReset(NumberOfRecHitsPerTrack);
1767 }
1768 //
1769 // -- Apply Reset
1770 //
1772  TkParameterMEs tkmes;
1775 }
1776 //
1777 // -- Remove SoftReset
1778 //
1780  TkParameterMEs tkmes;
1781  dqmStore_->disableSoftReset(Chi2oNDF);
1783 }
1784 
1785 
#define LogDebug(id)
MonitorElement * NumberOfRecHitsPerTrackVsPhi
MonitorElement * stoppingSourceVSphi
MonitorElement * NumberOfValidRecHitsPerTrackVsPhi
MonitorElement * Chi2ProbVsPhi
double p() const
momentum vector magnitude
Definition: TrackBase.h:610
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
MonitorElement * NumberOfLayersPerTrackVsPhi
int stripTOBLayersWithMeasurement() const
Definition: HitPattern.cc:613
T getParameter(std::string const &) const
dictionary missing
Definition: combine.py:4
MonitorElement * DistanceOfClosestApproachToPVVsPhi
const Point & referencePoint() const
Reference point on the track.
Definition: TrackBase.h:676
int i
Definition: DBlmapReader.cc:9
MonitorElement * NumberOfRecHitVsPhiVsEtaPerTrack
bool doTrackerSpecific_
Definition: TrackAnalyzer.h:77
MonitorElement * ValidFractionVsPhiVsEtaPerTrack
double d0Error() const
error on d0
Definition: TrackBase.h:797
MonitorElement * dNhitdPt_HighPurity
void fillHistosForTrackerSpecific(const reco::Track &track)
MonitorElement * NumberOfRecHitsPerTrackVsEta
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_valid_
void bookHistosForLScertification(DQMStore::IBooker &ibooker)
MonitorElement * stoppingSourceVSeta
T perp() const
Definition: PV3DBase.h:72
double validFraction() const
fraction of valid hits on the track
Definition: TrackBase.h:827
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
Definition: TrackBase.h:592
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_bad_
MonitorElement * NumberOfValidRecHitsPerTrack
int stripTIBLayersWithMeasurement() const
Definition: HitPattern.cc:591
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:556
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
double zError() const
error on z
Definition: Vertex.h:111
MonitorElement * Chi2oNDF_lumiFlag
double theta() const
polar angle
Definition: TrackBase.h:574
double dxyError() const
error on dxy
Definition: TrackBase.h:791
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
uint8_t stopReason() const
Definition: TrackBase.h:399
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:75
const CartesianTrajectoryError cartesianError() const
Geom::Theta< T > theta() const
bool doGeneralPropertiesPlots_
Definition: TrackAnalyzer.h:82
T y() const
Definition: PV3DBase.h:63
double etaError() const
error on eta
Definition: TrackBase.h:779
MonitorElement * Chi2oNDFVsPhi
int bunchCrossing() const
Definition: EventBase.h:65
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:640
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
Definition: TrackBase.h:821
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
bool doEffFromHitPatternVsBX_
MonitorElement * sipDzToBS
std::map< std::string, TkParameterMEs > TkParameterMEMap
MonitorElement * NumberOfLayersPerTrack[4]
MonitorElement * NhitVsPhi_HighPurity
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * algorithm
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:622
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:508
bool doHitPropertiesPlots_
Definition: TrackAnalyzer.h:84
MonitorElement * DistanceOfClosestApproach
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:65
bool doRecHitVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:85
MonitorElement * NumberOfLayersPerTrackVsTheta
MonitorElement * NumberOfRecHitsPerTrack_lumiFlag
std::map< std::string, TkRecHitsPerSubDetMEs > TkRecHitsPerSubDetMEMap
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:527
const Point & position() const
position
Definition: Vertex.h:99
MonitorElement * NumberOfValidRecHitVsPhiVsEtaPerTrack
int pixelEndcapLayersWithMeasurement() const
Definition: HitPattern.cc:579
int numberOfValidStripTOBHits() const
Definition: HitPattern.h:868
bool doMeasurementStatePlots_
Definition: TrackAnalyzer.h:83
TrajectoryStateOnSurface innermostMeasurementState() const
MonitorElement * NumberOfRecHitsPerTrack
MonitorElement * Ptdist_HighPurity
void Fill(long long x)
int numberOfLostTrackerHits(HitCategory category) const
Definition: HitPattern.h:907
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:492
void disableSoftReset(MonitorElement *me)
Definition: DQMStore.cc:3408
MonitorElement * TESTDistanceOfClosestApproachToBSVsPhi
MonitorElement * NumberOfValidRecHitsPerTrackVsEta
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_total_
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:646
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
Definition: HitPattern.cc:350
std::string qualityString_
int trackerLayersTotallyOffOrBad() const
Definition: HitPattern.h:1061
int numberOfValidPixelBarrelHits() const
Definition: HitPattern.h:843
MonitorElement * oriAlgo
bool doDCAwrt000Plots_
Definition: TrackAnalyzer.h:99
bool doEffFromHitPatternVsPU_
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * NumberOfLostRecHitVsPhiVsEtaPerTrack
MonitorElement * xPointOfClosestApproach
MonitorElement * Chi2oNDFVsTheta
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:544
MonitorElement * NumberOfMIRecHitsPerTrack
MonitorElement * bookProfile2D(Args &&...args)
Definition: DQMStore.h:163
def cat
Definition: eostools.py:400
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:550
int stripTIDLayersWithMeasurement() const
Definition: HitPattern.cc:602
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
MonitorElement * NumberOfValidRecHitsPerTrackVsEta
T sqrt(T t)
Definition: SSEVec.h:18
MonitorElement * NumberOfRecHitsPerTrackVsPhi
double pt() const
track transverse momentum
Definition: TrackBase.h:616
T z() const
Definition: PV3DBase.h:64
MonitorElement * dNdPt_HighPurity
void setBX(const edm::Event &)
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:758
std::string TopFolder_
Definition: TrackAnalyzer.h:70
MonitorElement * xPointOfClosestApproachVsZ0wrtBS
double phiError() const
error on phi
Definition: TrackBase.h:785
MonitorElement * NumberOfValidRecHitsPerTrackVsPhi
MonitorElement * dNdPhi_HighPurity
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
int numberOfValidStripTIDHits() const
Definition: HitPattern.h:863
TH1 * getTH1(void) const
MonitorElement * yPointOfClosestApproachToPV
const double EtaMin[kNumberCalorimeter]
MonitorElement * NumberOfRecHitsPerTrackVsEta
unsigned short numberOfValidHits() const
number of valid hits found
Definition: TrackBase.h:815
int numberOfValidStripTECHits() const
Definition: HitPattern.h:873
MonitorElement * sip2dToPV
void softReset(MonitorElement *me)
Definition: DQMStore.cc:3400
MonitorElement * Chi2oNDFVsTheta
TrajectoryStateOnSurface outermostMeasurementState() const
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_inactive_
MonitorElement * sipDzToPV
MonitorElement * sipDxyToBS
bool isValid() const
Definition: HandleBase.h:75
void bookHistosForHitProperties(DQMStore::IBooker &ibooker)
MonitorElement * DistanceOfClosestApproachVsEta
MonitorElement * zPointOfClosestApproachVsPhi
const AlgebraicSymMatrix66 & matrix() const
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:634
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:604
MonitorElement * NumberOfLayersPerTrackVsEta
double dzError() const
error on dz
Definition: TrackBase.h:809
MonitorElement * dNdEta_HighPurity
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:664
void bookHistosForTrackerSpecific(DQMStore::IBooker &ibooker)
MonitorElement * stoppingSource
void fillHistosForState(const edm::EventSetup &iSetup, const reco::Track &track, std::string sname)
TrackAlgorithm originalAlgo() const
Definition: TrackBase.h:496
TrajectoryStateOnSurface TSOS
Definition: TestHits.cc:19
virtual ~TrackAnalyzer()
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:125
double xError() const
error on x
Definition: Vertex.h:107
MonitorElement * NumberOfLayersPerTrackVsEta
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: TrackAnalyzer.h:72
MonitorElement * sipDxyToPV
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
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:445
MonitorElement * xPointOfClosestApproachVsZ0wrtPV
MonitorElement * yPointOfClosestApproachVsZ0wrtBS
void fillHistosForEfficiencyFromHitPatter(const reco::Track &track, const std::string suffix, const unsigned int monitoring)
const T & get() const
Definition: EventSetup.h:56
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_missing_
int pixelBarrelLayersWithMeasurement() const
Definition: HitPattern.cc:567
MonitorElement * DistanceOfClosestApproachVsTheta
void bookHistosForBeamSpot(DQMStore::IBooker &ibooker)
MonitorElement * Chi2ProbVsEta
int numberOfValidStripTIBHits() const
Definition: HitPattern.h:858
static const std::string algoNames[]
Definition: TrackBase.h:148
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:505
int numberOfValidPixelEndcapHits() const
Definition: HitPattern.h:848
MonitorElement * zPointOfClosestApproachToPV
T eta() const
Definition: PV3DBase.h:76
int trackerLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:544
MonitorElement * DistanceOfClosestApproachToPV
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:658
const AlgebraicSymMatrix55 & matrix() const
bool doTrackPxPyPlots_
Definition: TrackAnalyzer.h:95
GlobalVector globalMomentum() const
MonitorElement * DistanceOfClosestApproachToBSVsPhi
bool doLayersVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:87
unsigned int bx_
MonitorElement * ValidFractionPerTrack
MonitorElement * NhitVsEta_HighPurity
void doSoftReset(DQMStore *dqmStore_)
int getNbinsX(void) const
get # of bins in X-axis
int stripTECLayersWithMeasurement() const
Definition: HitPattern.cc:624
MonitorElement * yPointOfClosestApproachVsZ0wrt000
unsigned int good_vertices_
MonitorElement * TrackPtErrVsEta
MonitorElement * TESTDistanceOfClosestApproachToBS
virtual void initHisto(DQMStore::IBooker &ibooker, const edm::EventSetup &)
MonitorElement * NumberOfRecHitsPerTrackVsEta
int charge() const
track electric charge
Definition: TrackBase.h:562
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
MonitorElement * Chi2Prob
MonitorElement * TrackEtaPhiOuter
Definition: Chi2.h:17
MonitorElement * yPointOfClosestApproachVsZ0wrtPV
void setNumberOfGoodVertices(const edm::Event &)
void bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, const edm::EventSetup &iSetup, const std::string suffix)
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:586
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 * TrackEtaPhiInner
MonitorElement * DistanceOfClosestApproachToBS
std::string monName[monQuantity::END]
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:109
std::string histname
MonitorElement * Chi2oNDFVsEta
const int NBINS
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:628
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:652
void undoSoftReset(DQMStore *dqmStore_)
int numberOfHits(HitCategory category) const
Definition: HitPattern.h:807
MonitorElement * NumberOfMORecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfMORecHitsPerTrack
MonitorElement * NumberOfLayersPerTrackVsPhi
MonitorElement * LongDCASig
edm::EDGetTokenT< reco::VertexCollection > pvToken_
Definition: TrackAnalyzer.h:73
MonitorElement * Chi2oNDFVsPhi