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