CMS 3D CMS Logo

StandaloneTrackMonitor.cc
Go to the documentation of this file.
1 // system includes
2 #include <map>
3 #include <set>
4 #include <string>
5 #include <vector>
6 
7 // user includes
43 
44 // ROOT includes
45 #include "TFile.h"
46 #include "TH1.h"
47 #include "TLorentzVector.h"
48 #include "TMath.h"
49 #include "TPRegexp.h"
50 
51 using MVACollection = std::vector<float>;
52 using QualityMaskCollection = std::vector<unsigned char>;
53 
55 public:
57  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
58 
59 protected:
60  void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) override;
61  void addClusterToMap(uint32_t detid, const SiStripCluster* cluster);
62  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
63  void dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) override;
64  void processClusters(edm::Event const& iEvent,
65  edm::EventSetup const& iSetup,
66  const TrackerGeometry& tkGeom,
67  double wfac = 1);
68  void processHit(const TrackingRecHit& recHit,
69  edm::EventSetup const& iSetup,
70  const TrackerGeometry& tkGeom,
71  double wfac = 1);
72 
73 private:
75  const; //same as in /DQMOffline/Alignment/src/DiMuonVertexSelector.cc
78 
79  const bool isRECO_;
80 
82 
95  // track MVA
97  const bool doPUCorrection_;
98  const bool doTrackCorrection_;
99  const bool isMC_;
100  const bool haveAllHistograms_;
103  const std::vector<std::string> mvaProducers_;
108 
109  int nevt = 0;
110  int chi2it = 0, chi2itGt = 0, chi2itLt = 0;
111  const bool verbose_;
112  std::vector<std::tuple<edm::EDGetTokenT<MVACollection>, edm::EDGetTokenT<QualityMaskCollection> > > mvaQualityTokens_;
118  const TrackerGeometry* tkGeom_ = nullptr;
119 
144 
151 
154 
160 
163 
173 
180 
183 
193 
203 
208 
218 
222 
227 
233 
241 
242  // MC only
246 
247  // Exclusive Quantities
256 
262 
268 
274 
283 
292 
301 
310 
319 
324 
327 
329 
332 
335 
340 
345 
346  std::vector<MonitorElement*> trackMVAs;
347  std::vector<MonitorElement*> trackMVAsHP;
348  std::vector<MonitorElement*> trackMVAsVsPtProfile;
349  std::vector<MonitorElement*> trackMVAsHPVsPtProfile;
350  std::vector<MonitorElement*> trackMVAsVsEtaProfile;
351  std::vector<MonitorElement*> trackMVAsHPVsEtaProfile;
352 
358 
361 
363 
364  std::vector<int> lumivec1;
365  std::vector<int> lumivec2;
366  std::vector<float> vpu_;
367  std::vector<float> vtrack_;
368  std::map<uint32_t, std::set<const SiStripCluster*> > clusterMap_;
369 };
370 
373  desc.addUntracked<std::string>("moduleName", "StandaloneTrackMonitor");
374  desc.addUntracked<std::string>("folderName", "highPurityTracks");
375  desc.addUntracked<bool>("isRECO", false);
376  desc.addUntracked<edm::InputTag>("trackInputTag", edm::InputTag("generalTracks"));
377  desc.addUntracked<edm::InputTag>("offlineBeamSpot", edm::InputTag("offlineBeamSpot"));
378  desc.addUntracked<edm::InputTag>("vertexTag", edm::InputTag("offlinePrimaryVertices"));
379  desc.addUntracked<edm::InputTag>("puTag", edm::InputTag("addPileupInfo"));
380  desc.addUntracked<edm::InputTag>("clusterTag", edm::InputTag("siStripClusters"));
381  desc.addUntracked<edm::InputTag>("PFJetsCollection", edm::InputTag("ak4PFJetsCHS"));
382 
383  desc.addUntracked<std::string>("trackQuality", "highPurity");
384  desc.addUntracked<bool>("doPUCorrection", false);
385  desc.addUntracked<bool>("doTrackCorrection", false);
386  desc.addUntracked<bool>("isMC", false);
387  desc.addUntracked<bool>("haveAllHistograms", false);
388  desc.addUntracked<std::string>("puScaleFactorFile", "PileupScaleFactor.root");
389  desc.addUntracked<std::string>("trackScaleFactorFile", "PileupScaleFactor.root");
390  desc.addUntracked<std::vector<std::string> >("MVAProducers");
391  desc.addUntracked<edm::InputTag>("TrackProducerForMVA");
392 
393  desc.addUntracked<edm::InputTag>("TCProducer");
394  desc.addUntracked<std::string>("AlgoName");
395  desc.addUntracked<bool>("verbose", false);
396 
397  {
398  edm::ParameterSetDescription TrackEtaHistoPar;
399  TrackEtaHistoPar.add<int>("Xbins", 60);
400  TrackEtaHistoPar.add<double>("Xmin", -3.0);
401  TrackEtaHistoPar.add<double>("Xmax", 3.0);
402  desc.add<edm::ParameterSetDescription>("trackEtaH", TrackEtaHistoPar);
403  }
404 
405  {
406  edm::ParameterSetDescription TrackPtHistoPar;
407  TrackPtHistoPar.add<int>("Xbins", 60);
408  TrackPtHistoPar.add<double>("Xmin", 0.0);
409  TrackPtHistoPar.add<double>("Xmax", 100.0);
410  desc.add<edm::ParameterSetDescription>("trackPtH", TrackPtHistoPar);
411  }
412 
413  {
414  edm::ParameterSetDescription TrackPhiHistoPar;
415  TrackPhiHistoPar.add<int>("Xbins", 100);
416  TrackPhiHistoPar.add<double>("Xmin", -M_PI);
417  TrackPhiHistoPar.add<double>("Xmax", M_PI);
418  desc.add<edm::ParameterSetDescription>("trackPhiH", TrackPhiHistoPar);
419  }
420 
421  descriptions.add("standaloneTrackMonitorDefault", desc);
422 }
423 
424 // -----------------------------
425 // constructors and destructor
426 // -----------------------------
428  : moduleName_(ps.getUntrackedParameter<std::string>("moduleName", "StandaloneTrackMonitor")),
429  folderName_(ps.getUntrackedParameter<std::string>("folderName", "highPurityTracks")),
430  isRECO_(ps.getUntrackedParameter<bool>("isRECO", false)),
431  siStripClusterInfo_(consumesCollector()),
432  trackTag_(ps.getUntrackedParameter<edm::InputTag>("trackInputTag", edm::InputTag("generalTracks"))),
433  bsTag_(ps.getUntrackedParameter<edm::InputTag>("offlineBeamSpot", edm::InputTag("offlineBeamSpot"))),
434  vertexTag_(ps.getUntrackedParameter<edm::InputTag>("vertexTag", edm::InputTag("offlinePrimaryVertices"))),
435  puSummaryTag_(ps.getUntrackedParameter<edm::InputTag>("puTag", edm::InputTag("addPileupInfo"))),
436  clusterTag_(ps.getUntrackedParameter<edm::InputTag>("clusterTag", edm::InputTag("siStripClusters"))),
437  jetsTag_(ps.getUntrackedParameter<edm::InputTag>("PFJetsCollection", edm::InputTag("ak4PFJetsCHS"))),
438  trackToken_(consumes<reco::TrackCollection>(trackTag_)),
439  bsToken_(consumes<reco::BeamSpot>(bsTag_)),
440  vertexToken_(consumes<reco::VertexCollection>(vertexTag_)),
441  puSummaryToken_(consumes<std::vector<PileupSummaryInfo> >(puSummaryTag_)),
442  clusterToken_(consumes<edmNew::DetSetVector<SiStripCluster> >(clusterTag_)),
443  jetsToken_(consumes<std::vector<reco::PFJet> >(jetsTag_)),
444  trackQuality_(ps.getUntrackedParameter<std::string>("trackQuality", "highPurity")),
445  doPUCorrection_(ps.getUntrackedParameter<bool>("doPUCorrection", false)),
446  doTrackCorrection_(ps.getUntrackedParameter<bool>("doTrackCorrection", false)),
447  isMC_(ps.getUntrackedParameter<bool>("isMC", false)),
448  haveAllHistograms_(ps.getUntrackedParameter<bool>("haveAllHistograms", false)),
449  puScaleFactorFile_(ps.getUntrackedParameter<std::string>("puScaleFactorFile", "PileupScaleFactor.root")),
450  trackScaleFactorFile_(ps.getUntrackedParameter<std::string>("trackScaleFactorFile", "PileupScaleFactor.root")),
451  mvaProducers_(ps.getUntrackedParameter<std::vector<std::string> >("MVAProducers")),
452  mvaTrackTag_(ps.getUntrackedParameter<edm::InputTag>("TrackProducerForMVA")),
453  mvaTrackToken_(consumes<edm::View<reco::Track> >(mvaTrackTag_)),
454  tcProducer_(ps.getUntrackedParameter<edm::InputTag>("TCProducer")),
455  algoName_(ps.getUntrackedParameter<std::string>("AlgoName")),
456  verbose_(ps.getUntrackedParameter<bool>("verbose", false)),
459  edm::ESInputTag{"", "TransientTrackBuilder"})),
460  TrackEtaHistoPar_(ps.getParameter<edm::ParameterSet>("trackEtaH")),
461  TrackPhiHistoPar_(ps.getParameter<edm::ParameterSet>("trackPhiH")),
462  TrackPtHistoPar_(ps.getParameter<edm::ParameterSet>("trackPtH")) {
463  for (const auto& v : mvaProducers_) {
464  mvaQualityTokens_.push_back(std::make_tuple(consumes<MVACollection>(edm::InputTag(v, "MVAValues")),
465  consumes<QualityMaskCollection>(edm::InputTag(v, "QualityMasks"))));
466  }
467 
468  trackEtaH_ = nullptr;
469  trackEtaerrH_ = nullptr;
470  trackCosThetaH_ = nullptr;
471  trackThetaerrH_ = nullptr;
472  trackPhiH_ = nullptr;
473  trackPhierrH_ = nullptr;
474  trackPH_ = nullptr;
475  trackPtH_ = nullptr;
476  trackPtUpto2GeVH_ = nullptr;
477  trackPtOver10GeVH_ = nullptr;
478  trackPterrH_ = nullptr;
479  trackqOverpH_ = nullptr;
480  trackqOverperrH_ = nullptr;
481  trackChargeH_ = nullptr;
482  nlostHitsH_ = nullptr;
483  nvalidTrackerHitsH_ = nullptr;
484  nvalidPixelHitsH_ = nullptr;
485  nvalidStripHitsH_ = nullptr;
486  trkLayerwithMeasurementH_ = nullptr;
487  pixelLayerwithMeasurementH_ = nullptr;
488  stripLayerwithMeasurementH_ = nullptr;
489  beamSpotXYposH_ = nullptr;
490  beamSpotXYposerrH_ = nullptr;
491  beamSpotZposH_ = nullptr;
492  beamSpotZposerrH_ = nullptr;
493  trackChi2H_ = nullptr;
494  tracknDOFH_ = nullptr;
495  trackd0H_ = nullptr;
496  trackChi2bynDOFH_ = nullptr;
497  vertexXposH_ = nullptr;
498  vertexYposH_ = nullptr;
499  vertexZposH_ = nullptr;
500 
501  nPixBarrelH_ = nullptr;
502  nPixEndcapH_ = nullptr;
503  nStripTIBH_ = nullptr;
504  nStripTOBH_ = nullptr;
505  nStripTECH_ = nullptr;
506  nStripTIDH_ = nullptr;
507 
508  // for MC only
509  nVtxH_ = nullptr;
510  nVertexH_ = nullptr;
511  bunchCrossingH_ = nullptr;
512  nPUH_ = nullptr;
513  trueNIntH_ = nullptr;
514 
515  nLostHitsVspTH_ = nullptr;
516  nLostHitsVsEtaH_ = nullptr;
517  nLostHitsVsCosThetaH_ = nullptr;
518  nLostHitsVsPhiH_ = nullptr;
519  nLostHitsVsIterationH_ = nullptr;
520 
521  nHitsTIBSVsEtaH_ = nullptr;
522  nHitsTOBSVsEtaH_ = nullptr;
523  nHitsTECSVsEtaH_ = nullptr;
524  nHitsTIDSVsEtaH_ = nullptr;
525  nHitsStripSVsEtaH_ = nullptr;
526 
527  nHitsTIBDVsEtaH_ = nullptr;
528  nHitsTOBDVsEtaH_ = nullptr;
529  nHitsTECDVsEtaH_ = nullptr;
530  nHitsTIDDVsEtaH_ = nullptr;
531  nHitsStripDVsEtaH_ = nullptr;
532 
533  nValidHitsVspTH_ = nullptr;
534  nValidHitsVsEtaH_ = nullptr;
535  nValidHitsVsCosThetaH_ = nullptr;
536  nValidHitsVsPhiH_ = nullptr;
537  nValidHitsVsnVtxH_ = nullptr;
538 
539  nValidHitsPixVsEtaH_ = nullptr;
540  nValidHitsPixBVsEtaH_ = nullptr;
541  nValidHitsPixEVsEtaH_ = nullptr;
542  nValidHitsStripVsEtaH_ = nullptr;
543  nValidHitsTIBVsEtaH_ = nullptr;
544  nValidHitsTOBVsEtaH_ = nullptr;
545  nValidHitsTECVsEtaH_ = nullptr;
546  nValidHitsTIDVsEtaH_ = nullptr;
547 
548  nValidHitsPixVsPhiH_ = nullptr;
549  nValidHitsPixBVsPhiH_ = nullptr;
550  nValidHitsPixEVsPhiH_ = nullptr;
551  nValidHitsStripVsPhiH_ = nullptr;
552  nValidHitsTIBVsPhiH_ = nullptr;
553  nValidHitsTOBVsPhiH_ = nullptr;
554  nValidHitsTECVsPhiH_ = nullptr;
555  nValidHitsTIDVsPhiH_ = nullptr;
556 
557  nLostHitsPixVsEtaH_ = nullptr;
558  nLostHitsPixBVsEtaH_ = nullptr;
559  nLostHitsPixEVsEtaH_ = nullptr;
560  nLostHitsStripVsEtaH_ = nullptr;
561  nLostHitsTIBVsEtaH_ = nullptr;
562  nLostHitsTOBVsEtaH_ = nullptr;
563  nLostHitsTECVsEtaH_ = nullptr;
564  nLostHitsTIDVsEtaH_ = nullptr;
565 
566  nLostHitsPixVsPhiH_ = nullptr;
567  nLostHitsPixBVsPhiH_ = nullptr;
568  nLostHitsPixEVsPhiH_ = nullptr;
569  nLostHitsStripVsPhiH_ = nullptr;
570  nLostHitsTIBVsPhiH_ = nullptr;
571  nLostHitsTOBVsPhiH_ = nullptr;
572  nLostHitsTECVsPhiH_ = nullptr;
573  nLostHitsTIDVsPhiH_ = nullptr;
574 
575  nLostHitsPixVsIterationH_ = nullptr;
576  nLostHitsPixBVsIterationH_ = nullptr;
577  nLostHitsPixEVsIterationH_ = nullptr;
578  nLostHitsStripVsIterationH_ = nullptr;
579  nLostHitsTIBVsIterationH_ = nullptr;
580  nLostHitsTOBVsIterationH_ = nullptr;
581  nLostHitsTECVsIterationH_ = nullptr;
582  nLostHitsTIDVsIterationH_ = nullptr;
583 
584  hOnTrkClusChargeThinH_ = nullptr;
585  hOnTrkClusWidthThinH_ = nullptr;
586  hOnTrkClusChargeThickH_ = nullptr;
587  hOnTrkClusWidthThickH_ = nullptr;
588 
589  hOffTrkClusChargeThinH_ = nullptr;
590  hOffTrkClusWidthThinH_ = nullptr;
591  hOffTrkClusChargeThickH_ = nullptr;
592  hOffTrkClusWidthThickH_ = nullptr;
593 
594  cosPhi3DdileptonH_ = nullptr;
595  ip3dToPV2validpixelhitsH_ = nullptr;
596  ip3dToBS2validpixelhitsH_ = nullptr;
597  iperr3dToPV2validpixelhitsH_ = nullptr;
598  iperr3dToBS2validpixelhitsH_ = nullptr;
599  sip3dToPV2validpixelhitsH_ = nullptr;
600  sip3dToBS2validpixelhitsH_ = nullptr;
601 
602  // Read pileup weight factors
603 
604  if (isMC_ && doPUCorrection_ && doTrackCorrection_) {
605  throw std::runtime_error("if isMC is true, only one of doPUCorrection and doTrackCorrection can be true");
606  }
607 
608  if (isMC_ && doPUCorrection_) {
609  vpu_.clear();
610  TFile* f1 = TFile::Open(puScaleFactorFile_.c_str());
611  TH1F* h1 = dynamic_cast<TH1F*>(f1->Get("pileupweight"));
612  for (int i = 1; i <= h1->GetNbinsX(); ++i)
613  vpu_.push_back(h1->GetBinContent(i));
614  f1->Close();
615  }
616 
617  if (isMC_ && doTrackCorrection_) {
618  vtrack_.clear();
619  TFile* f1 = TFile::Open(trackScaleFactorFile_.c_str());
620  TH1F* h1 = dynamic_cast<TH1F*>(f1->Get("trackweight"));
621  for (int i = 1; i <= h1->GetNbinsX(); ++i)
622  vtrack_.push_back(h1->GetBinContent(i));
623  f1->Close();
624  }
625 }
626 
628  tkGeom_ = &(iSetup.getData(geomToken_));
629 }
630 
632  edm::Run const& iRun,
633  edm::EventSetup const& iSetup) {
634  std::string currentFolder = moduleName_ + "/" + folderName_;
635  ibook.setCurrentFolder(currentFolder);
636 
637  // The following are common with the official tool
638  if (haveAllHistograms_) {
639  trackEtaH_ = ibook.book1D("trackEta",
640  "Track Eta",
641  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
642  TrackEtaHistoPar_.getParameter<double>("Xmin"),
643  TrackEtaHistoPar_.getParameter<double>("Xmax"));
644 
645  trackEtaerrH_ = ibook.book1D("trackEtaerr", "Track Eta Error", 50, 0.0, 1.0);
646  trackCosThetaH_ = ibook.book1D("trackCosTheta", "Track Cos(Theta)", 50, -1.0, 1.0);
647  trackThetaerrH_ = ibook.book1D("trackThetaerr", "Track Theta Error", 50, 0.0, 1.0);
648  trackPhiH_ = ibook.book1D("trackPhi", "Track Phi", 70, -3.5, 3.5);
649  trackPhierrH_ = ibook.book1D("trackPhierr", "Track Phi Error", 50, 0.0, 1.0);
650 
651  trackPH_ = ibook.book1D("trackP", "Track 4-momentum", 50, 0.0, 10.0);
652  trackPtH_ = ibook.book1D("trackPt",
653  "Track Pt",
654  TrackPtHistoPar_.getParameter<int32_t>("Xbins"),
655  TrackPtHistoPar_.getParameter<double>("Xmin"),
656  TrackPtHistoPar_.getParameter<double>("Xmax"));
657  trackPt_ZoomH_ = ibook.book1D("trackPt_Zoom", "Track Pt", 100, 60, 70);
658  trackPterrH_ = ibook.book1D("trackPterr", "Track Pt Error", 100, 0.0, 100.0);
659  trackqOverpH_ = ibook.book1D("trackqOverp", "q Over p", 100, -0.5, 0.5);
660  trackqOverperrH_ = ibook.book1D("trackqOverperr", "q Over p Error", 50, 0.0, 0.5);
661  trackChargeH_ = ibook.book1D("trackCharge", "Track Charge", 3, -1.5, 1.5);
662  trackChi2H_ = ibook.book1D("trackChi2", "Chi2", 100, 0.0, 100.0);
663  tracknDOFH_ = ibook.book1D("tracknDOF", "nDOF", 100, 0.0, 100.0);
664  trackChi2ProbH_ = ibook.book1D("trackChi2Prob", "Chi2prob", 50, 0.0, 1.0);
665  trackChi2oNDFH_ = ibook.book1D("trackChi2oNDF", "Chi2oNDF", 100, 0.0, 100.0);
666  trackd0H_ = ibook.book1D("trackd0", "Track d0", 100, -1, 1);
667  trackChi2bynDOFH_ = ibook.book1D("trackChi2bynDOF", "Chi2 Over nDOF", 100, 0.0, 10.0);
668  trackalgoH_ = ibook.book1D("trackalgo", "Track Algo", 46, 0.0, 46.0);
669  trackorigalgoH_ = ibook.book1D("trackorigalgo", "Track Original Algo", 46, 0.0, 46.0);
670 
671  for (size_t ibin = 0; ibin < reco::TrackBase::algoSize - 1; ibin++) {
674  }
675 
676  trackStoppingSourceH_ = ibook.book1D("trackstoppingsource", "Track Stopping Source", 12, 0.0, 12.0);
677 
678  // DataFormats/TrackCandidate/interface/TrajectoryStopReasons.h
679  size_t StopReasonNameSize = static_cast<size_t>(StopReason::SIZE);
680  for (unsigned int i = 0; i < StopReasonNameSize; ++i) {
682  }
683 
685  ibook.book1D("DistanceOfClosestApproachToPV", "DistanceOfClosestApproachToPV", 1000, -1.0, 1.0);
687  ibook.book1D("DistanceOfClosestApproachToPVZoomed", "DistanceOfClosestApproachToPV", 1000, -0.1, 0.1);
689  "DistanceOfClosestApproachToPVVsPhi", "DistanceOfClosestApproachToPVVsPhi", 100, -3.5, 3.5, 0.0, 0.0, "g");
691  "xPointOfClosestApproachVsZ0wrtPV", "xPointOfClosestApproachVsZ0wrtPV", 120, -60, 60, 0.0, 0.0, "g");
693  "yPointOfClosestApproachVsZ0wrtPV", "yPointOfClosestApproachVsZ0wrtPV", 120, -60, 60, 0.0, 0.0, "g");
695  ibook.book1D("trackDeltaRwrtClosestTrack", "min#DeltaR(considered track,other tracks)", 500, 0, 10);
696 
697  ip2dToPVH_ = ibook.book1D("ip2dToPV", "IP in 2d To PV", 1000, -1.0, 1.0);
698  unsigned int niperrbins = 100;
699  float iperrbinning[niperrbins + 1];
700  float miniperr = 0.0001, maxiperr = 5;
701  iperrbinning[0] = miniperr;
702  for (unsigned int i = 1; i != niperrbins + 1; i++) {
703  iperrbinning[i] = iperrbinning[i - 1] * pow(maxiperr / miniperr, 1. / niperrbins);
704  }
705  iperr2dToPVH_ = ibook.book1D("iperr2dToPV", "IP error in 2d To PV", niperrbins, iperrbinning);
706  iperr2dToPVWtH_ = ibook.book1D("iperr2dToPVWt", "IP error in 2d To PV", niperrbins, iperrbinning);
707 
708  ip3dToPVH_ = ibook.book1D("ip3dToPV", "IP in 3d To PV", 200, -20, 20);
709  ip3dToBSH_ = ibook.book1D("ip3dToBS", "IP in 3d To BS", 200, -20, 20);
710  iperr3dToPVH_ = ibook.book1D("iperr3dToPV", "IP error in 3d To PV", niperrbins, iperrbinning);
711  iperr3dToBSH_ = ibook.book1D("iperr3dToBS", "IP error in 3d To BS", niperrbins, iperrbinning);
712  sip3dToPVH_ = ibook.book1D("sip3dToPV", "IP significance in 3d To PV", 200, -10, 10);
713  sip3dToBSH_ = ibook.book1D("sip3dToBS", "IP significance in 3d To BS", 200, -10, 10);
714 
716  ibook.book1D("ip3dToPV2validpixelhits", "IP in 3d To PV (nValidPixelHits>2)", 200, -0.20, 0.20);
718  ibook.book1D("ip3dToBS2validpixelhits", "IP in 3d To BS (nValidPixelHits>2)", 200, -0.20, 0.20);
720  "iperr3dToPV2validpixelhits", "IP error in 3d To PV (nValidPixelHits>2)", niperrbins, iperrbinning);
722  "iperr3dToBS2validpixelhits", "IP error in 3d To BS (nValidPixelHits>2)", niperrbins, iperrbinning);
724  ibook.book1D("sip3dToPV2validpixelhits", "IP significance in 3d To PV (nValidPixelHits>2)", 200, -10, 10);
726  ibook.book1D("sip3dToBS2validpixelhits", "IP significance in 3d To BS (nValidPixelHits>2)", 200, -10, 10);
727 
728  ip2dToBSH_ = ibook.book1D("ip2dToBS", "IP in 2d To BS", 1000, -1., 1.); //Beamspot
729  iperr2dToBSH_ = ibook.book1D("iperr2dToBS", "IP error in 2d To BS", niperrbins, iperrbinning);
730  sip2dToBSH_ = ibook.book1D("sip2dToBS", "IP significance in 2d To BS", 200, -10, 10);
731 
732  iperr3dToPVWtH_ = ibook.book1D("iperr3dToPVWt", "IP error in 3d To PV", niperrbins, iperrbinning);
733  sip2dToPVH_ = ibook.book1D("sip2dToPV", "IP significance in 2d To PV", 200, -10, 10);
734 
735  sip2dToPVWtH_ = ibook.book1D("sip2dToPVWt", "IP significance in 2d To PV", 200, -10, 10);
736  sipDxyToPVH_ = ibook.book1D("sipDxyToPV", "IP significance in dxy To PV", 100, -10, 10);
737  sipDzToPVH_ = ibook.book1D("sipDzToPV", "IP significance in dz To PV", 100, -10, 10);
738 
739  nallHitsH_ = ibook.book1D("nallHits", "No. of All Hits", 60, -0.5, 59.5);
740  ntrackerHitsH_ = ibook.book1D("ntrackerHits", "No. of Tracker Hits", 60, -0.5, 59.5);
741 
742  nvalidTrackerHitsH_ = ibook.book1D("nvalidTrackerhits", "No. of Valid Tracker Hits", 47, -0.5, 46.5);
743  nvalidPixelHitsH_ = ibook.book1D("nvalidPixelHits", "No. of Valid Hits in Pixel", 8, -0.5, 7.5);
744  nvalidPixelBHitsH_ = ibook.book1D("nvalidPixelBarrelHits", "No. of Valid Hits in Pixel Barrel", 6, -0.5, 5.5);
745  nvalidPixelEHitsH_ = ibook.book1D("nvalidPixelEndcapHits", "No. of Valid Hits in Pixel Endcap", 6, -0.5, 6.5);
746  nvalidStripHitsH_ = ibook.book1D("nvalidStripHits", "No. of Valid Hits in Strip", 36, -0.5, 35.5);
747  nvalidTIBHitsH_ = ibook.book1D("nvalidTIBHits", "No. of Valid Hits in Strip TIB", 6, -0.5, 5.5);
748  nvalidTOBHitsH_ = ibook.book1D("nvalidTOBHits", "No. of Valid Hits in Strip TOB", 11, -0.5, 10.5);
749  nvalidTIDHitsH_ = ibook.book1D("nvalidTIDHits", "No. of Valid Hits in Strip TID", 6, -0.5, 5.5);
750  nvalidTECHitsH_ = ibook.book1D("nvalidTECHits", "No. of Valid Hits in Strip TEC", 11, -0.5, 10.5);
751 
752  nlostTrackerHitsH_ = ibook.book1D("nlostTrackerhits", "No. of Lost Tracker Hits", 15, -0.5, 14.5);
753  nlostPixelHitsH_ = ibook.book1D("nlostPixelHits", "No. of Lost Hits in Pixel", 8, -0.5, 7.5);
754  nlostPixelBHitsH_ = ibook.book1D("nlostPixelBarrelHits", "No. of Lost Hits in Pixel Barrel", 5, -0.5, 4.5);
755  nlostPixelEHitsH_ = ibook.book1D("nlostPixelEndcapHits", "No. of Lost Hits in Pixel Endcap", 4, -0.5, 3.5);
756  nlostStripHitsH_ = ibook.book1D("nlostStripHits", "No. of Lost Hits in Strip", 10, -0.5, 9.5);
757  nlostTIBHitsH_ = ibook.book1D("nlostTIBHits", "No. of Lost Hits in Strip TIB", 5, -0.5, 4.5);
758  nlostTOBHitsH_ = ibook.book1D("nlostTOBHits", "No. of Lost Hits in Strip TOB", 10, -0.5, 9.5);
759  nlostTIDHitsH_ = ibook.book1D("nlostTIDHits", "No. of Lost Hits in Strip TID", 5, -0.5, 4.5);
760  nlostTECHitsH_ = ibook.book1D("nlostTECHits", "No. of Lost Hits in Strip TEC", 10, -0.5, 9.5);
761 
762  trkLayerwithMeasurementH_ = ibook.book1D("trkLayerwithMeasurement", "No. of Layers per Track", 20, 0.0, 20.0);
764  ibook.book1D("pixelLayerwithMeasurement", "No. of Pixel Layers per Track", 10, 0.0, 10.0);
766  ibook.book1D("pixelBLayerwithMeasurement", "No. of Pixel Barrel Layers per Track", 5, 0.0, 5.0);
768  ibook.book1D("pixelELayerwithMeasurement", "No. of Pixel Endcap Layers per Track", 5, 0.0, 5.0);
770  ibook.book1D("stripLayerwithMeasurement", "No. of Strip Layers per Track", 20, 0.0, 20.0);
772  ibook.book1D("stripTIBLayerwithMeasurement", "No. of Strip TIB Layers per Track", 10, 0.0, 10.0);
774  ibook.book1D("stripTOBLayerwithMeasurement", "No. of Strip TOB Layers per Track", 10, 0.0, 10.0);
776  ibook.book1D("stripTIDLayerwithMeasurement", "No. of Strip TID Layers per Track", 5, 0.0, 5.0);
778  ibook.book1D("stripTECLayerwithMeasurement", "No. of Strip TEC Layers per Track", 15, 0.0, 15.0);
779 
780  nlostHitsH_ = ibook.book1D("nlostHits", "No. of Lost Hits", 10, -0.5, 9.5);
782  ibook.book1D("nMissingExpectedInnerHits", "No. of Missing Expected Inner Hits", 10, -0.5, 9.5);
784  ibook.book1D("nMissingExpectedOuterHits", "No. of Missing Expected Outer Hits", 10, -0.5, 9.5);
785 
786  beamSpotXYposH_ = ibook.book1D("beamSpotXYpos", "d_{xy} w.r.t beam spot", 100, -1.0, 1.0);
787  beamSpotXYposerrH_ = ibook.book1D("beamSpotXYposerr", "error on d_{xy} w.r.t beam spot", 50, 0.0, 0.25);
788  beamSpotZposH_ = ibook.book1D("beamSpotZpos", "d_{z} w.r.t beam spot", 100, -20.0, 20.0);
789  beamSpotZposerrH_ = ibook.book1D("beamSpotZposerr", "error on d_{z} w.r.t. beam spot", 50, 0.0, 0.25);
790 
791  vertexXposH_ = ibook.book1D("vertexXpos", "Vertex X position", 100, -0.1, 0.1);
792  vertexYposH_ = ibook.book1D("vertexYpos", "Vertex Y position", 200, -0.1, 0.1);
793  vertexZposH_ = ibook.book1D("vertexZpos", "Vertex Z position", 100, -20.0, 20.0);
794  nVertexH_ = ibook.book1D("nVertex", "# of vertices", 120, -0.5, 119.5);
795  nVtxH_ = ibook.book1D("nVtx", "# of vtxs", 120, -0.5, 119.5);
796 
797  nMissingInnerHitBH_ = ibook.book1D("nMissingInnerHitB", "No. missing inner hit per Track in Barrel", 6, -0.5, 5.5);
798  nMissingInnerHitEH_ = ibook.book1D("nMissingInnerHitE", "No. missing inner hit per Track in Endcap", 6, -0.5, 5.5);
800  ibook.book1D("nMissingOuterHitB", "No. missing outer hit per Track in Barrel", 11, -0.5, 10.5);
802  ibook.book1D("nMissingOuterHitE", "No. missing outer hit per Track in Endcap", 11, -0.5, 10.5);
803  nPixBarrelH_ = ibook.book1D("nHitPixelBarrel", "No. of hits in Pixel Barrel per Track", 20, 0, 20.0);
804  nPixEndcapH_ = ibook.book1D("nHitPixelEndcap", "No. of hits in Pixel Endcap per Track", 20, 0, 20.0);
805  nStripTIBH_ = ibook.book1D("nHitStripTIB", "No. of hits in Strip TIB per Track", 30, 0, 30.0);
806  nStripTOBH_ = ibook.book1D("nHitStripTOB", "No. of hits in Strip TOB per Track", 30, 0, 30.0);
807  nStripTECH_ = ibook.book1D("nHitStripTEC", "No. of hits in Strip TEC per Track", 30, 0, 30.0);
808  nStripTIDH_ = ibook.book1D("nHitStripTID", "No. of hits in Strip TID per Tracks", 30, 0, 30.0);
809  nTracksH_ = ibook.book1D("nTracks", "No. of Tracks", 1200, -0.5, 1199.5);
810  nJet_ = ibook.book1D("nJet", "Number of Jets", 101, -0.5, 100.5);
811  Jet_pt_ = ibook.book1D("Jet_pt", "Jet p_{T}", 200, 0., 200.);
812  Jet_eta_ = ibook.book1D("Jet_eta", "Jet #eta", 100, -5.2, 5.2);
813  Jet_energy_ = ibook.book1D("Jet_energy", "Jet Energy", 200, 0., 200.);
815  ibook.book1D("Jet_chargedMultiplicity", "Jet charged Hadron Multiplicity", 201, -0.5, 200.5);
816  Zpt_ = ibook.book1D("Zpt", "Z-boson transverse momentum", 100, 0, 100);
817  ZInvMass_ = ibook.book1D("ZInvMass", "m_{ll}", 120, 75, 105);
818  cosPhi3DdileptonH_ = ibook.book1D("cosPhi3Ddilepton", "cos#Phi_{3D,ll}", 202, -1.01, 1.01);
819  }
820  if (isMC_) {
821  bunchCrossingH_ = ibook.book1D("bunchCrossing", "Bunch Crossing", 60, 0, 60.0);
822  nPUH_ = ibook.book1D("nPU", "No of Pileup", 100, 0, 100.0);
823  trueNIntH_ = ibook.book1D("trueNInt", "True no of Interactions", 100, 0, 100.0);
824  }
825  // Exclusive histograms
826 
827  nLostHitByLayerH_ = ibook.book1D("nLostHitByLayer", "No. of Lost Hit per Layer", 29, 0.5, 29.5);
828 
830  ibook.book1D("nLostHitByLayerPix", "No. of Lost Hit per Layer for Pixel detector", 7, 0.5, 7.5);
831 
833  ibook.book1D("nLostHitByLayerStrip", "No. of Lost Hit per Layer for SiStrip detector", 22, 0.5, 22.5);
834 
835  nLostHitsVspTH_ = ibook.bookProfile("nLostHitsVspT",
836  "Number of Lost Hits Vs pT",
837  TrackPtHistoPar_.getParameter<int32_t>("Xbins"),
838  TrackPtHistoPar_.getParameter<double>("Xmin"),
839  TrackPtHistoPar_.getParameter<double>("Xmax"),
840  0.0,
841  0.0,
842  "g");
843  nLostHitsVsEtaH_ = ibook.bookProfile("nLostHitsVsEta",
844  "Number of Lost Hits Vs Eta",
845  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
846  TrackEtaHistoPar_.getParameter<double>("Xmin"),
847  TrackEtaHistoPar_.getParameter<double>("Xmax"),
848  0.0,
849  0.0,
850  "g");
852  ibook.bookProfile("nLostHitsVsCosTheta", "Number of Lost Hits Vs Cos(Theta)", 50, -1.0, 1.0, 0.0, 0.0, "g");
853  nLostHitsVsPhiH_ = ibook.bookProfile("nLostHitsVsPhi", "Number of Lost Hits Vs Phi", 100, -3.5, 3.5, 0.0, 0.0, "g");
855  ibook.bookProfile("nLostHitsVsIteration", "Number of Lost Hits Vs Iteration", 47, -0.5, 46.5, 0.0, 0.0, "g");
856 
857  nHitsTIBSVsEtaH_ = ibook.bookProfile("nHitsTIBSVsEta",
858  "Number of Hits in TIB Vs Eta (Single-sided)",
859  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
860  TrackEtaHistoPar_.getParameter<double>("Xmin"),
861  TrackEtaHistoPar_.getParameter<double>("Xmax"),
862  0.0,
863  0.0,
864  "g");
865  nHitsTOBSVsEtaH_ = ibook.bookProfile("nHitsTOBSVsEta",
866  "Number of Hits in TOB Vs Eta (Single-sided)",
867  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
868  TrackEtaHistoPar_.getParameter<double>("Xmin"),
869  TrackEtaHistoPar_.getParameter<double>("Xmax"),
870  0.0,
871  0.0,
872  "g");
873  nHitsTECSVsEtaH_ = ibook.bookProfile("nHitsTECSVsEta",
874  "Number of Hits in TEC Vs Eta (Single-sided)",
875  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
876  TrackEtaHistoPar_.getParameter<double>("Xmin"),
877  TrackEtaHistoPar_.getParameter<double>("Xmax"),
878  0.0,
879  0.0,
880  "g");
881  nHitsTIDSVsEtaH_ = ibook.bookProfile("nHitsTIDSVsEta",
882  "Number of Hits in TID Vs Eta (Single-sided)",
883  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
884  TrackEtaHistoPar_.getParameter<double>("Xmin"),
885  TrackEtaHistoPar_.getParameter<double>("Xmax"),
886  0.0,
887  0.0,
888  "g");
889 
890  nHitsStripSVsEtaH_ = ibook.bookProfile("nHitsStripSVsEta",
891  "Number of Strip Hits Vs Eta (Single-sided)",
892  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
893  TrackEtaHistoPar_.getParameter<double>("Xmin"),
894  TrackEtaHistoPar_.getParameter<double>("Xmax"),
895  0.0,
896  0.0,
897  "g");
898 
899  nHitsTIBDVsEtaH_ = ibook.bookProfile("nHitsTIBDVsEta",
900  "Number of Hits in TIB Vs Eta (Double-sided)",
901  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
902  TrackEtaHistoPar_.getParameter<double>("Xmin"),
903  TrackEtaHistoPar_.getParameter<double>("Xmax"),
904  0.0,
905  0.0,
906  "g");
907  nHitsTOBDVsEtaH_ = ibook.bookProfile("nHitsTOBDVsEta",
908  "Number of Hits in TOB Vs Eta (Double-sided)",
909  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
910  TrackEtaHistoPar_.getParameter<double>("Xmin"),
911  TrackEtaHistoPar_.getParameter<double>("Xmax"),
912  0.0,
913  0.0,
914  "g");
915  nHitsTECDVsEtaH_ = ibook.bookProfile("nHitsTECDVsEta",
916  "Number of Hits in TEC Vs Eta (Double-sided)",
917  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
918  TrackEtaHistoPar_.getParameter<double>("Xmin"),
919  TrackEtaHistoPar_.getParameter<double>("Xmax"),
920  0.0,
921  0.0,
922  "g");
923  nHitsTIDDVsEtaH_ = ibook.bookProfile("nHitsTIDDVsEta",
924  "Number of Hits in TID Vs Eta (Double-sided)",
925  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
926  TrackEtaHistoPar_.getParameter<double>("Xmin"),
927  TrackEtaHistoPar_.getParameter<double>("Xmax"),
928  0.0,
929  0.0,
930  "g");
931  nHitsStripDVsEtaH_ = ibook.bookProfile("nHitsStripDVsEta",
932  "Number of Strip Hits Vs Eta (Double-sided)",
933  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
934  TrackEtaHistoPar_.getParameter<double>("Xmin"),
935  TrackEtaHistoPar_.getParameter<double>("Xmax"),
936  0.0,
937  0.0,
938  "g");
939 
940  nValidHitsVspTH_ = ibook.bookProfile("nValidHitsVspT",
941  "Number of Valid Hits Vs pT",
942  TrackPtHistoPar_.getParameter<int32_t>("Xbins"),
943  TrackPtHistoPar_.getParameter<double>("Xmin"),
944  TrackPtHistoPar_.getParameter<double>("Xmax"),
945  0.0,
946  0.0,
947  "g");
949  ibook.bookProfile("nValidHitsVsnVtx", "Number of Valid Hits Vs Number of Vertex", 100, 0., 100., 0.0, 0.0, "g");
950  nValidHitsVsEtaH_ = ibook.bookProfile("nValidHitsVsEta",
951  "Number of Hits Vs Eta",
952  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
953  TrackEtaHistoPar_.getParameter<double>("Xmin"),
954  TrackEtaHistoPar_.getParameter<double>("Xmax"),
955  0.0,
956  0.0,
957  "g");
958 
960  ibook.bookProfile("nValidHitsVsCosTheta", "Number of Valid Hits Vs Cos(Theta)", 50, -1.0, 1.0, 0.0, 0.0, "g");
962  ibook.bookProfile("nValidHitsVsPhi", "Number of Valid Hits Vs Phi", 100, -3.5, 3.5, 0.0, 0.0, "g");
963 
964  nValidHitsPixVsEtaH_ = ibook.bookProfile("nValidHitsPixVsEta",
965  "Number of Valid Hits in Pixel Vs Eta",
966  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
967  TrackEtaHistoPar_.getParameter<double>("Xmin"),
968  TrackEtaHistoPar_.getParameter<double>("Xmax"),
969  0.0,
970  0.0,
971  "g");
972  nValidHitsPixBVsEtaH_ = ibook.bookProfile("nValidHitsPixBVsEta",
973  "Number of Valid Hits in Pixel Barrel Vs Eta",
974  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
975  TrackEtaHistoPar_.getParameter<double>("Xmin"),
976  TrackEtaHistoPar_.getParameter<double>("Xmax"),
977  0.0,
978  0.0,
979  "g");
980  nValidHitsPixEVsEtaH_ = ibook.bookProfile("nValidHitsPixEVsEta",
981  "Number of Valid Hits in Pixel Endcap Vs Eta",
982  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
983  TrackEtaHistoPar_.getParameter<double>("Xmin"),
984  TrackEtaHistoPar_.getParameter<double>("Xmax"),
985  0.0,
986  0.0,
987  "g");
988  nValidHitsStripVsEtaH_ = ibook.bookProfile("nValidHitsStripVsEta",
989  "Number of Valid Hits in SiStrip Vs Eta",
990  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
991  TrackEtaHistoPar_.getParameter<double>("Xmin"),
992  TrackEtaHistoPar_.getParameter<double>("Xmax"),
993  0.0,
994  0.0,
995  "g");
996  nValidHitsTIBVsEtaH_ = ibook.bookProfile("nValidHitsTIBVsEta",
997  "Number of Valid Hits in TIB Vs Eta",
998  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
999  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1000  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1001  0.0,
1002  0.0,
1003  "g");
1004  nValidHitsTOBVsEtaH_ = ibook.bookProfile("nValidHitsTOBVsEta",
1005  "Number of Valid Hits in TOB Vs Eta",
1006  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1007  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1008  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1009  0.0,
1010  0.0,
1011  "g");
1012  nValidHitsTECVsEtaH_ = ibook.bookProfile("nValidHitsTECVsEta",
1013  "Number of Valid Hits in TEC Vs Eta",
1014  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1015  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1016  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1017  0.0,
1018  0.0,
1019  "g");
1020  nValidHitsTIDVsEtaH_ = ibook.bookProfile("nValidHitsTIDVsEta",
1021  "Number of Valid Hits in TID Vs Eta",
1022  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1023  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1024  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1025  0.0,
1026  0.0,
1027  "g");
1028 
1029  nValidHitsPixVsPhiH_ = ibook.bookProfile("nValidHitsPixVsPhi",
1030  "Number of Valid Hits in Pixel Vs Phi",
1031  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1032  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1033  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1034  0.0,
1035  0.0,
1036  "g");
1037  nValidHitsPixBVsPhiH_ = ibook.bookProfile("nValidHitsPixBVsPhi",
1038  "Number of Valid Hits in Pixel Barrel Vs Phi",
1039  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1040  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1041  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1042  0.0,
1043  0.0,
1044  "g");
1045  nValidHitsPixEVsPhiH_ = ibook.bookProfile("nValidHitsPixEVsPhi",
1046  "Number of Valid Hits in Pixel Endcap Vs Phi",
1047  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1048  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1049  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1050  0.0,
1051  0.0,
1052  "g");
1053  nValidHitsStripVsPhiH_ = ibook.bookProfile("nValidHitsStripVsPhi",
1054  "Number of Valid Hits in SiStrip Vs Phi",
1055  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1056  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1057  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1058  0.0,
1059  0.0,
1060  "g");
1061  nValidHitsTIBVsPhiH_ = ibook.bookProfile("nValidHitsTIBVsPhi",
1062  "Number of Valid Hits in TIB Vs Phi",
1063  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1064  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1065  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1066  0.0,
1067  0.0,
1068  "g");
1069  nValidHitsTOBVsPhiH_ = ibook.bookProfile("nValidHitsTOBVsPhi",
1070  "Number of Valid Hits in TOB Vs Phi",
1071  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1072  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1073  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1074  0.0,
1075  0.0,
1076  "g");
1077  nValidHitsTECVsPhiH_ = ibook.bookProfile("nValidHitsTECVsPhi",
1078  "Number of Valid Hits in TEC Vs Phi",
1079  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1080  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1081  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1082  0.0,
1083  0.0,
1084  "g");
1085  nValidHitsTIDVsPhiH_ = ibook.bookProfile("nValidHitsTIDVsPhi",
1086  "Number of Valid Hits in TID Vs Phi",
1087  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1088  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1089  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1090  0.0,
1091  0.0,
1092  "g");
1093 
1094  nLostHitsPixVsEtaH_ = ibook.bookProfile("nLostHitsPixVsEta",
1095  "Number of Lost Hits in Pixel Vs Eta",
1096  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1097  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1098  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1099  0.0,
1100  0.0,
1101  "g");
1102  nLostHitsPixBVsEtaH_ = ibook.bookProfile("nLostHitsPixBVsEta",
1103  "Number of Lost Hits in Pixel Barrel Vs Eta",
1104  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1105  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1106  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1107  0.0,
1108  0.0,
1109  "g");
1110  nLostHitsPixEVsEtaH_ = ibook.bookProfile("nLostHitsPixEVsEta",
1111  "Number of Lost Hits in Pixel Endcap Vs Eta",
1112  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1113  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1114  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1115  0.0,
1116  0.0,
1117  "g");
1118  nLostHitsStripVsEtaH_ = ibook.bookProfile("nLostHitsStripVsEta",
1119  "Number of Lost Hits in SiStrip Vs Eta",
1120  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1121  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1122  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1123  0.0,
1124  0.0,
1125  "g");
1126  nLostHitsTIBVsEtaH_ = ibook.bookProfile("nLostHitsTIBVsEta",
1127  "Number of Lost Hits in TIB Vs Eta",
1128  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1129  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1130  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1131  0.0,
1132  0.0,
1133  "g");
1134  nLostHitsTOBVsEtaH_ = ibook.bookProfile("nLostHitsTOBVsEta",
1135  "Number of Lost Hits in TOB Vs Eta",
1136  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1137  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1138  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1139  0.0,
1140  0.0,
1141  "g");
1142  nLostHitsTECVsEtaH_ = ibook.bookProfile("nLostHitsTECVsEta",
1143  "Number of Lost Hits in TEC Vs Eta",
1144  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1145  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1146  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1147  0.0,
1148  0.0,
1149  "g");
1150  nLostHitsTIDVsEtaH_ = ibook.bookProfile("nLostHitsTIDVsEta",
1151  "Number of Lost Hits in TID Vs Eta",
1152  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1153  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1154  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1155  0.0,
1156  0.0,
1157  "g");
1158 
1159  nLostHitsPixVsPhiH_ = ibook.bookProfile("nLostHitsPixVsPhi",
1160  "Number of Lost Hits in Pixel Vs Phi",
1161  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1162  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1163  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1164  0.0,
1165  0.0,
1166  "g");
1167  nLostHitsPixBVsPhiH_ = ibook.bookProfile("nLostHitsPixBVsPhi",
1168  "Number of Lost Hits in Pixel Barrel Vs Phi",
1169  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1170  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1171  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1172  0.0,
1173  0.0,
1174  "g");
1175  nLostHitsPixEVsPhiH_ = ibook.bookProfile("nLostHitsPixEVsPhi",
1176  "Number of Lost Hits in Pixel Endcap Vs Phi",
1177  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1178  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1179  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1180  0.0,
1181  0.0,
1182  "g");
1183  nLostHitsStripVsPhiH_ = ibook.bookProfile("nLostHitsStripVsPhi",
1184  "Number of Lost Hits in SiStrip Vs Phi",
1185  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1186  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1187  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1188  0.0,
1189  0.0,
1190  "g");
1191  nLostHitsTIBVsPhiH_ = ibook.bookProfile("nLostHitsTIBVsPhi",
1192  "Number of Lost Hits in TIB Vs Phi",
1193  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1194  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1195  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1196  0.0,
1197  0.0,
1198  "g");
1199  nLostHitsTOBVsPhiH_ = ibook.bookProfile("nLostHitsTOBVsPhi",
1200  "Number of Lost Hits in TOB Vs Phi",
1201  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1202  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1203  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1204  0.0,
1205  0.0,
1206  "g");
1207  nLostHitsTECVsPhiH_ = ibook.bookProfile("nLostHitsTECVsPhi",
1208  "Number of Lost Hits in TEC Vs Phi",
1209  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1210  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1211  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1212  0.0,
1213  0.0,
1214  "g");
1215  nLostHitsTIDVsPhiH_ = ibook.bookProfile("nLostHitsTIDVsPhi",
1216  "Number of Lost Hits in TID Vs Phi",
1217  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1218  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1219  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1220  0.0,
1221  0.0,
1222  "g");
1223 
1225  "nLostHitsPixVsIteration", "Number of Lost Hits in Pixel Vs Iteration", 47, -0.5, 46.5, 0.0, 0.0, "g");
1227  "nLostHitsPixBVsIteration", "Number of Lost Hits in Pixel Barrel Vs Iteration", 47, -0.5, 46.5, 0.0, 0.0, "g");
1229  "nLostHitsPixEVsIteration", "Number of Lost Hits in Pixel Endcap Vs Iteration", 47, -0.5, 46.5, 0.0, 0.0, "g");
1231  "nLostHitsStripVsIteration", "Number of Lost Hits in SiStrip Vs Iteration", 47, -0.5, 46.5, 0.0, 0.0, "g");
1233  "nLostHitsTIBVsIteration", "Number of Lost Hits in TIB Vs Iteration", 47, -0.5, 46.5, 0.0, 0.0, "g");
1235  "nLostHitsTOBVsIteration", "Number of Lost Hits in TOB Vs Iteration", 47, -0.5, 46.5, 0.0, 0.0, "g");
1237  "nLostHitsTECVsIteration", "Number of Lost Hits in TEC Vs Iteration", 47, -0.5, 46.5, 0.0, 0.0, "g");
1239  "nLostHitsTIDVsIteration", "Number of Lost Hits in TID Vs Iteration", 47, -0.5, 46.5, 0.0, 0.0, "g");
1240 
1241  trackChi2oNDFVsEtaH_ = ibook.bookProfile("trackChi2oNDFVsEta",
1242  "chi2/ndof of Tracks Vs Eta",
1243  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1244  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1245  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1246  0.0,
1247  10.0,
1248  "g");
1249  trackChi2oNDFVsPhiH_ = ibook.bookProfile("trackChi2oNDFVsPhi",
1250  "chi2/ndof of Tracks Vs Phi",
1251  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1252  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1253  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1254  0.0,
1255  10.0,
1256  "g");
1257 
1258  trackChi2probVsEtaH_ = ibook.bookProfile("trackChi2probVsEta",
1259  "chi2 probability of Tracks Vs Eta",
1260  TrackEtaHistoPar_.getParameter<int32_t>("Xbins"),
1261  TrackEtaHistoPar_.getParameter<double>("Xmin"),
1262  TrackEtaHistoPar_.getParameter<double>("Xmax"),
1263  0.0,
1264  1.0,
1265  "g");
1266  trackChi2probVsPhiH_ = ibook.bookProfile("trackChi2probVsPhi",
1267  "chi2 probability of Tracks Vs Phi",
1268  TrackPhiHistoPar_.getParameter<int32_t>("Xbins"),
1269  TrackPhiHistoPar_.getParameter<double>("Xmin"),
1270  TrackPhiHistoPar_.getParameter<double>("Xmax"),
1271  0.0,
1272  1.0,
1273  "g");
1274 
1276  ibook.bookProfile("trackIperr3dVsEta", "ip3d error of Tracks Vs Eta", 80, -4., 4., 0.0, 0.0, "g");
1277 
1278  trackSip2dVsEtaH_ = ibook.bookProfile("trackSip2dVsEta", "sip2d of Tracks Vs Eta", 80, -4., 4., 0.0, 0.0, "g");
1279 
1281  ibook.book2D("trackIperr3dVsEta2D", "ip3d error of Tracks Vs Eta 2d", 80, -4., 4., 100, 0., 5.);
1283  ibook.book2D("trackIperr3dVsChi2prob2D", "ip3d error of Tracks Vs chi2prob 2d", 50, 0., 1., 100, 0., 5.);
1284  trackSip2dVsEta2DH_ = ibook.book2D("trackSip2dVsEta2D", "sip2d of Tracks Vs Eta 2d", 80, -4., 4., 200, -10., 10.);
1286  ibook.book2D("trackSip2dVsChi2prob2D", "sip2d of Tracks Vs chi2prob 2d", 50, 0., 1., 200, -10., 10.);
1287 
1288  // On and off-track cluster properties
1289  hOnTrkClusChargeThinH_ = ibook.book1D("hOnTrkClusChargeThin", "On-track Cluster Charge (Thin Sensor)", 100, 0, 1000);
1290  hOnTrkClusWidthThinH_ = ibook.book1D("hOnTrkClusWidthThin", "On-track Cluster Width (Thin Sensor)", 20, -0.5, 19.5);
1292  ibook.book1D("hOnTrkClusChargeThick", "On-track Cluster Charge (Thick Sensor)", 100, 0, 1000);
1294  ibook.book1D("hOnTrkClusWidthThick", "On-track Cluster Width (Thick Sensor)", 20, -0.5, 19.5);
1295 
1297  ibook.book1D("hOffTrkClusChargeThin", "Off-track Cluster Charge (Thin Sensor)", 100, 0, 1000);
1299  ibook.book1D("hOffTrkClusWidthThin", "Off-track Cluster Width (Thin Sensor)", 20, -0.5, 19.5);
1301  ibook.book1D("hOffTrkClusChargeThick", "Off-track Cluster Charge (Thick Sensor)", 100, 0, 1000);
1303  ibook.book1D("hOffTrkClusWidthThick", "Off-track Cluster Width (Thick Sensor)", 20, -0.5, 19.5);
1304 }
1306  if (verbose_)
1307  edm::LogInfo("StandaloneTrackMonitor") << "Begin StandaloneTrackMonitor" << std::endl;
1308 
1309  nevt++;
1310 
1311  // Get event setup (to get global transformation)
1312  const TrackerGeometry& tkGeom = (*tkGeom_);
1313 
1314  // Primary vertex collection
1316  iEvent.getByToken(vertexToken_, vertexColl);
1317  if (!vertexColl.isValid()) {
1318  edm::LogError("DqmTrackStudy") << "Error! Failed to get reco::Vertex Collection, " << vertexTag_;
1319  }
1320  if (vertexColl->empty()) {
1321  edm::LogError("StandalonaTrackMonitor") << "No good vertex in the event!!" << std::endl;
1322  return;
1323  }
1324  const reco::Vertex& pv = (*vertexColl)[0];
1325 
1326  // Beam spot
1328  iEvent.getByToken(bsToken_, beamSpot);
1329  if (!beamSpot.isValid())
1330  edm::LogError("StandalonaTrackMonitor") << "Beamspot for input tag: " << bsTag_ << " not found!!";
1331 
1332  // Track collection
1334  iEvent.getByToken(trackToken_, tracks);
1335  if (!tracks.isValid())
1336  edm::LogError("StandalonaTrackMonitor") << "TrackCollection for input tag: " << trackTag_ << " not found!!";
1337 
1338  // Access PU information
1339  double wfac = 1.0; // for data
1340  if (!iEvent.isRealData()) {
1342  iEvent.getByToken(puSummaryToken_, PupInfo);
1343 
1344  if (verbose_)
1345  edm::LogInfo("StandaloneTrackMonitor") << "nPUColl = " << PupInfo->size();
1346  if (PupInfo.isValid()) {
1347  for (auto const& v : *PupInfo) {
1348  int bx = v.getBunchCrossing();
1349  if (bunchCrossingH_)
1351  if (bx == 0) {
1352  if (nPUH_)
1353  nPUH_->Fill(v.getPU_NumInteractions());
1354  int ntrueInt = v.getTrueNumInteractions();
1355  int nVertex = (vertexColl.isValid() ? vertexColl->size() : 0);
1356  if (trueNIntH_)
1357  trueNIntH_->Fill(ntrueInt);
1358  if (doPUCorrection_) {
1359  if (nVertex > -1 && nVertex < int(vpu_.size()))
1360  wfac = vpu_.at(nVertex);
1361  else
1362  wfac = 0.0;
1363  }
1364  }
1365  }
1366  } else
1367  edm::LogError("StandalonaTrackMonitor") << "PUSummary for input tag: " << puSummaryTag_ << " not found!!";
1368  if (doTrackCorrection_) {
1369  int ntrack = 0;
1370  for (auto const& track : *tracks) {
1372  continue;
1373  ++ntrack;
1374  }
1375  if (ntrack > -1 && ntrack < int(vtrack_.size()))
1376  wfac = vtrack_.at(ntrack);
1377  else
1378  wfac = 0.0;
1379  }
1380  }
1381  if (verbose_)
1382  edm::LogInfo("StandaloneTrackMonitor") << "PU reweight factor = " << wfac;
1383 
1384  if (haveAllHistograms_) {
1385  int nvtx = (vertexColl.isValid() ? vertexColl->size() : 0);
1386  nVertexH_->Fill(nvtx, wfac);
1387  nVtxH_->Fill(nvtx);
1388  }
1389 
1390  // Get MVA and quality mask collections
1391  int ntracks = 0;
1392  std::vector<TLorentzVector> list;
1393 
1394  const TransientTrackBuilder* theB = &iSetup.getData(transTrackToken_);
1395  TransientVertex mumuTransientVtx;
1396  std::vector<reco::TransientTrack> tks;
1397 
1398  if (tracks.isValid()) {
1399  if (verbose_)
1400  edm::LogInfo("StandaloneTrackMonitor") << "Total # of Tracks: " << tracks->size();
1402 
1403  for (auto const& track : *tracks) {
1404  if (!track.quality(quality))
1405  continue;
1406  ++ntracks;
1407 
1408  reco::TransientTrack trajectory = theB->build(track);
1409  tks.push_back(trajectory);
1410 
1411  double eta = track.eta();
1412  double theta = track.theta();
1413  double phi = track.phi();
1414  double pt = track.pt();
1415 
1416  const reco::HitPattern& hitp = track.hitPattern();
1417  double nAllHits = hitp.numberOfAllHits(reco::HitPattern::TRACK_HITS);
1418  double nAllTrackerHits = hitp.numberOfAllTrackerHits(reco::HitPattern::TRACK_HITS);
1419 
1420  double trackdeltaR = std::numeric_limits<double>::max();
1421  double muonmass = 0.1056583745;
1422  TLorentzVector trackpmu;
1423  trackpmu.SetPtEtaPhiM(track.pt(), track.eta(), track.phi(), muonmass);
1424  for (auto const& TRACK : *tracks) {
1425  if (&track == &TRACK)
1426  continue;
1427  double tmpdr = reco::deltaR(track.eta(), track.phi(), TRACK.eta(), TRACK.phi());
1428  if (tmpdr < trackdeltaR)
1429  trackdeltaR = tmpdr;
1430  }
1431 
1432  list.push_back(trackpmu);
1433 
1434  double nValidTrackerHits = hitp.numberOfValidTrackerHits();
1435  double nValidPixelHits = hitp.numberOfValidPixelHits();
1436  double nValidPixelBHits = hitp.numberOfValidPixelBarrelHits();
1437  double nValidPixelEHits = hitp.numberOfValidPixelEndcapHits();
1438  double nValidStripHits = hitp.numberOfValidStripHits();
1439  double nValidTIBHits = hitp.numberOfValidStripTIBHits();
1440  double nValidTOBHits = hitp.numberOfValidStripTOBHits();
1441  double nValidTIDHits = hitp.numberOfValidStripTIDHits();
1442  double nValidTECHits = hitp.numberOfValidStripTECHits();
1443 
1444  int missingInnerHit = hitp.numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS);
1445  int missingOuterHit = hitp.numberOfAllHits(reco::HitPattern::MISSING_OUTER_HITS);
1446 
1447  nValidHitsVspTH_->Fill(pt, nValidTrackerHits);
1448  nValidHitsVsEtaH_->Fill(eta, nValidTrackerHits);
1449  nValidHitsVsCosThetaH_->Fill(std::cos(theta), nValidTrackerHits);
1450  nValidHitsVsPhiH_->Fill(phi, nValidTrackerHits);
1451  nValidHitsVsnVtxH_->Fill(vertexColl->size(), nValidTrackerHits);
1452 
1454  nValidHitsPixBVsEtaH_->Fill(eta, nValidPixelBHits);
1455  nValidHitsPixEVsEtaH_->Fill(eta, nValidPixelEHits);
1457  nValidHitsTIBVsEtaH_->Fill(eta, nValidTIBHits);
1458  nValidHitsTOBVsEtaH_->Fill(eta, nValidTOBHits);
1459  nValidHitsTECVsEtaH_->Fill(eta, nValidTECHits);
1460  nValidHitsTIDVsEtaH_->Fill(eta, nValidTIDHits);
1461 
1463  nValidHitsPixBVsPhiH_->Fill(phi, nValidPixelBHits);
1464  nValidHitsPixEVsPhiH_->Fill(phi, nValidPixelEHits);
1466  nValidHitsTIBVsPhiH_->Fill(phi, nValidTIBHits);
1467  nValidHitsTOBVsPhiH_->Fill(phi, nValidTOBHits);
1468  nValidHitsTECVsPhiH_->Fill(phi, nValidTECHits);
1469  nValidHitsTIDVsPhiH_->Fill(phi, nValidTIDHits);
1470 
1471  int nLostHits = track.numberOfLostHits();
1472  int nMissingExpectedInnerHits = hitp.numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS);
1473  int nMissingExpectedOuterHits = hitp.numberOfLostHits(reco::HitPattern::MISSING_OUTER_HITS);
1474  int nLostTrackerHits = hitp.numberOfLostTrackerHits(reco::HitPattern::TRACK_HITS);
1475  int nLostPixHits = hitp.numberOfLostPixelHits(reco::HitPattern::TRACK_HITS);
1478  int nLostStripHits = hitp.numberOfLostStripHits(reco::HitPattern::TRACK_HITS);
1479  int nLostStripTIBHits = hitp.numberOfLostStripTIBHits(reco::HitPattern::TRACK_HITS);
1480  int nLostStripTIDHits = hitp.numberOfLostStripTIDHits(reco::HitPattern::TRACK_HITS);
1481  int nLostStripTOBHits = hitp.numberOfLostStripTOBHits(reco::HitPattern::TRACK_HITS);
1482  int nLostStripTECHits = hitp.numberOfLostStripTECHits(reco::HitPattern::TRACK_HITS);
1483  int nIteration = track.originalAlgo();
1484 
1485  nLostHitsVspTH_->Fill(pt, nLostTrackerHits);
1486  nLostHitsVsEtaH_->Fill(eta, nLostTrackerHits);
1487  nLostHitsVsCosThetaH_->Fill(std::cos(theta), nLostTrackerHits);
1488  nLostHitsVsPhiH_->Fill(phi, nLostTrackerHits);
1489  nLostHitsVsIterationH_->Fill(nIteration, nLostTrackerHits);
1490 
1491  nLostHitsPixVsEtaH_->Fill(eta, nLostPixHits);
1492  nLostHitsPixBVsEtaH_->Fill(eta, nLostPixBHits);
1493  nLostHitsPixEVsEtaH_->Fill(eta, nLostPixEHits);
1494  nLostHitsStripVsEtaH_->Fill(eta, nLostStripHits);
1495  nLostHitsTIBVsEtaH_->Fill(eta, nLostStripTIBHits);
1496  nLostHitsTOBVsEtaH_->Fill(eta, nLostStripTOBHits);
1497  nLostHitsTECVsEtaH_->Fill(eta, nLostStripTECHits);
1498  nLostHitsTIDVsEtaH_->Fill(eta, nLostStripTIDHits);
1499 
1500  nLostHitsPixVsPhiH_->Fill(phi, nLostPixHits);
1501  nLostHitsPixBVsPhiH_->Fill(phi, nLostPixBHits);
1502  nLostHitsPixEVsPhiH_->Fill(phi, nLostPixEHits);
1503  nLostHitsStripVsPhiH_->Fill(phi, nLostStripHits);
1504  nLostHitsTIBVsPhiH_->Fill(phi, nLostStripTIBHits);
1505  nLostHitsTOBVsPhiH_->Fill(phi, nLostStripTOBHits);
1506  nLostHitsTECVsPhiH_->Fill(phi, nLostStripTECHits);
1507  nLostHitsTIDVsPhiH_->Fill(phi, nLostStripTIDHits);
1508 
1509  nLostHitsPixVsIterationH_->Fill(nIteration, nLostPixHits);
1510  nLostHitsPixBVsIterationH_->Fill(nIteration, nLostPixBHits);
1511  nLostHitsPixEVsIterationH_->Fill(nIteration, nLostPixEHits);
1512  nLostHitsStripVsIterationH_->Fill(nIteration, nLostStripHits);
1513  nLostHitsTIBVsIterationH_->Fill(nIteration, nLostStripTIBHits);
1514  nLostHitsTOBVsIterationH_->Fill(nIteration, nLostStripTOBHits);
1515  nLostHitsTECVsIterationH_->Fill(nIteration, nLostStripTECHits);
1516  nLostHitsTIDVsIterationH_->Fill(nIteration, nLostStripTIDHits);
1517 
1518  if (abs(eta) <= 1.4) {
1519  nMissingInnerHitBH_->Fill(missingInnerHit, wfac);
1520  nMissingOuterHitBH_->Fill(missingOuterHit, wfac);
1521  } else {
1522  nMissingInnerHitEH_->Fill(missingInnerHit, wfac);
1523  nMissingOuterHitEH_->Fill(missingOuterHit, wfac);
1524  }
1525 
1526  for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::TRACK_HITS); i++) {
1527  uint32_t hit = hitp.getHitPattern(reco::HitPattern::TRACK_HITS, i);
1528  if (hitp.missingHitFilter(hit)) {
1529  double losthitBylayer = -1.0;
1530  double losthitBylayerPix = -1.0;
1531  double losthitBylayerStrip = -1.0;
1532  int layer = hitp.getLayer(hit);
1533  if (hitp.pixelBarrelHitFilter(hit)) {
1534  losthitBylayer = layer;
1535  losthitBylayerPix = layer;
1536  } else if (hitp.pixelEndcapHitFilter(hit)) {
1537  losthitBylayer = layer + 4;
1538  losthitBylayerPix = layer + 4;
1539  } else if (hitp.stripTIBHitFilter(hit)) {
1540  losthitBylayer = layer + 7;
1541  losthitBylayerStrip = layer;
1542  } else if (hitp.stripTIDHitFilter(hit)) {
1543  losthitBylayer = layer + 11;
1544  losthitBylayerStrip = layer + 4;
1545  } else if (hitp.stripTOBHitFilter(hit)) {
1546  losthitBylayer = layer + 14;
1547  losthitBylayerStrip = layer + 7;
1548  } else if (hitp.stripTECHitFilter(hit)) {
1549  losthitBylayer = layer + 20;
1550  losthitBylayerStrip = layer + 13;
1551  }
1552  if (losthitBylayer > -1)
1553  nLostHitByLayerH_->Fill(losthitBylayer, wfac);
1554  if (losthitBylayerPix > -1)
1555  nLostHitByLayerPixH_->Fill(losthitBylayerPix, wfac);
1556  if (losthitBylayerStrip > -1)
1557  nLostHitByLayerStripH_->Fill(losthitBylayerStrip, wfac);
1558  }
1559  }
1560 
1561  if (haveAllHistograms_) {
1562  double etaError = track.etaError();
1563  double thetaError = track.thetaError();
1564  double phiError = track.phiError();
1565  double p = track.p();
1566  double ptError = track.ptError();
1567  double qoverp = track.qoverp();
1568  double qoverpError = track.qoverpError();
1569  double charge = track.charge();
1570 
1571  double dxy = track.dxy(beamSpot->position());
1572  double dxyError = track.dxyError();
1573  double dz = track.dz(beamSpot->position());
1574  double dzError = track.dzError();
1575 
1576  double trkd0 = track.d0();
1577  double chi2 = track.chi2();
1578  double ndof = track.ndof();
1579  double chi2prob = TMath::Prob(track.chi2(), (int)track.ndof());
1580  double chi2oNDF = track.normalizedChi2();
1581  double vx = track.vx();
1582  double vy = track.vy();
1583  double vz = track.vz();
1585  unsigned int track_algo = track.algo();
1586  unsigned int track_origalgo = track.originalAlgo();
1587  // stopping source
1588  int ssmax = trackStoppingSourceH_->getNbinsX();
1589  double stop = track.stopReason() > ssmax ? double(ssmax - 1) : static_cast<double>(track.stopReason());
1590  double distanceOfClosestApproachToPV = track.dxy(pv.position());
1591  double xPointOfClosestApproachwrtPV = track.vx() - pv.position().x();
1592  double yPointOfClosestApproachwrtPV = track.vy() - pv.position().y();
1593  double positionZ0 = track.dz(pv.position());
1594 
1595  reco::TransientTrack transTrack = iSetup.get<TransientTrackRecord>().get(transTrackToken_).build(track);
1596 
1597  double ip3dToPV = 0, iperr3dToPV = 0, sip3dToPV = 0, sip2dToPV = 0;
1598  GlobalVector dir(track.px(), track.py(), track.pz());
1599  std::pair<bool, Measurement1D> ip3d = IPTools::signedImpactParameter3D(transTrack, dir, pv);
1600  std::pair<bool, Measurement1D> ip2d = IPTools::signedTransverseImpactParameter(transTrack, dir, pv);
1601  if (ip3d.first) {
1602  sip3dToPV = ip3d.second.value() / ip3d.second.error();
1603  ip3dToPV = ip3d.second.value();
1604  iperr3dToPV = ip3d.second.error();
1605  }
1606 
1607  double ip3dToBS = 0, iperr3dToBS = 0, sip3dToBS = 0, sip2dToBS = 0;
1608  reco::Vertex beamspotvertex((*beamSpot).position(), (*beamSpot).covariance3D());
1609  std::pair<bool, Measurement1D> ip3dbs = IPTools::signedImpactParameter3D(transTrack, dir, beamspotvertex);
1610  std::pair<bool, Measurement1D> ip2dbs =
1611  IPTools::signedTransverseImpactParameter(transTrack, dir, beamspotvertex);
1612  if (ip3dbs.first) {
1613  sip3dToBS = ip3dbs.second.value() / ip3dbs.second.error();
1614  ip3dToBS = ip3dbs.second.value();
1615  iperr3dToBS = ip3dbs.second.error();
1616  }
1617 
1618  double ip2dToPV = 0, iperr2dToPV = 0;
1619  if (ip2d.first) {
1620  ip2dToPV = ip2d.second.value();
1621  iperr2dToPV = ip2d.second.error();
1622  sip2dToPV = ip2d.second.value() / ip2d.second.error();
1623  }
1624 
1625  double ip2dToBS = 0, iperr2dToBS = 0;
1626  if (ip2dbs.first) {
1627  ip2dToBS = ip2dbs.second.value();
1628  iperr2dToBS = ip2dbs.second.error();
1629  sip2dToBS = ip2d.second.value() / ip2d.second.error();
1630  }
1631 
1632  if (ip2d.first)
1633  sip2dToPV = ip2d.second.value() / ip2d.second.error();
1634  double sipDxyToPV = track.dxy(pv.position()) / track.dxyError();
1635  double sipDzToPV = track.dz(pv.position()) / track.dzError();
1636 
1637  // Fill the histograms
1638  trackDeltaRwrtClosestTrack_->Fill(trackdeltaR, wfac);
1639  trackEtaH_->Fill(eta, wfac);
1640  trackEtaerrH_->Fill(etaError, wfac);
1642  trackThetaerrH_->Fill(thetaError, wfac);
1643  trackPhiH_->Fill(phi, wfac);
1644  trackPhierrH_->Fill(phiError, wfac);
1645  trackPH_->Fill(p, wfac);
1646  trackPtH_->Fill(pt, wfac);
1647  trackPt_ZoomH_->Fill(pt, wfac);
1648  trackPterrH_->Fill(ptError, wfac);
1649  trackqOverpH_->Fill(qoverp, wfac);
1651  trackChargeH_->Fill(charge, wfac);
1652  trackChi2H_->Fill(chi2, wfac);
1653  trackChi2ProbH_->Fill(chi2prob, wfac);
1654  trackChi2oNDFH_->Fill(chi2oNDF, wfac);
1655  trackd0H_->Fill(trkd0, wfac);
1656  tracknDOFH_->Fill(ndof, wfac);
1657  trackChi2bynDOFH_->Fill(chi2 / ndof, wfac);
1658  trackalgoH_->Fill(track_algo, wfac);
1659  trackorigalgoH_->Fill(track_origalgo, wfac);
1660  trackStoppingSourceH_->Fill(stop, wfac);
1661  trackChi2oNDFVsEtaH_->Fill(eta, chi2oNDF);
1662  trackChi2oNDFVsPhiH_->Fill(phi, chi2oNDF);
1663  trackChi2probVsEtaH_->Fill(eta, chi2prob);
1664  trackChi2probVsPhiH_->Fill(phi, chi2prob);
1665 
1666  nlostHitsH_->Fill(nLostHits, wfac);
1667  nMissingExpectedInnerHitsH_->Fill(nMissingExpectedInnerHits, wfac);
1668  nMissingExpectedOuterHitsH_->Fill(nMissingExpectedOuterHits, wfac);
1669  nlostTrackerHitsH_->Fill(nLostTrackerHits, wfac);
1670 
1671  beamSpotXYposH_->Fill(dxy, wfac);
1673  beamSpotZposH_->Fill(dz, wfac);
1674  beamSpotZposerrH_->Fill(dzError, wfac);
1675 
1676  vertexXposH_->Fill(vx, wfac);
1677  vertexYposH_->Fill(vy, wfac);
1678  vertexZposH_->Fill(vz, wfac);
1679 
1680  int nPixBarrel = 0, nPixEndcap = 0, nStripTIB = 0, nStripTOB = 0, nStripTEC = 0, nStripTID = 0;
1681  if (isRECO_) {
1682  for (auto it = track.recHitsBegin(); it != track.recHitsEnd(); ++it) {
1683  const TrackingRecHit& hit = (**it);
1684  if (hit.isValid()) {
1685  if (hit.geographicalId().det() == DetId::Tracker) {
1686  int subdetId = hit.geographicalId().subdetId();
1687  if (subdetId == PixelSubdetector::PixelBarrel)
1688  ++nPixBarrel;
1689  else if (subdetId == PixelSubdetector::PixelEndcap)
1690  ++nPixEndcap;
1691  else if (subdetId == StripSubdetector::TIB)
1692  ++nStripTIB;
1693  else if (subdetId == StripSubdetector::TOB)
1694  ++nStripTOB;
1695  else if (subdetId == StripSubdetector::TEC)
1696  ++nStripTEC;
1697  else if (subdetId == StripSubdetector::TID)
1698  ++nStripTID;
1699 
1700  // Find on-track clusters
1701  processHit(hit, iSetup, tkGeom, wfac);
1702  }
1703  }
1704  }
1705  }
1706  if (verbose_)
1707  edm::LogInfo("StandaloneTrackMonitor")
1708  << " >>> HITs: nPixBarrel: " << nPixBarrel << " nPixEndcap: " << nPixEndcap << " nStripTIB: " << nStripTIB
1709  << " nStripTOB: " << nStripTOB << " nStripTEC: " << nStripTEC << " nStripTID: " << nStripTID;
1710  if (haveAllHistograms_) {
1711  nPixBarrelH_->Fill(nPixBarrel, wfac);
1712  nPixEndcapH_->Fill(nPixEndcap, wfac);
1713  nStripTIBH_->Fill(nStripTIB, wfac);
1714  nStripTOBH_->Fill(nStripTOB, wfac);
1715  nStripTECH_->Fill(nStripTEC, wfac);
1716  nStripTIDH_->Fill(nStripTID, wfac);
1717  }
1718 
1719  DistanceOfClosestApproachToPVH_->Fill(distanceOfClosestApproachToPV, wfac);
1720  DistanceOfClosestApproachToPVZoomedH_->Fill(distanceOfClosestApproachToPV, wfac);
1721  DistanceOfClosestApproachToPVVsPhiH_->Fill(phi, distanceOfClosestApproachToPV);
1722  xPointOfClosestApproachVsZ0wrtPVH_->Fill(positionZ0, xPointOfClosestApproachwrtPV);
1723  yPointOfClosestApproachVsZ0wrtPVH_->Fill(positionZ0, yPointOfClosestApproachwrtPV);
1724 
1725  ip3dToPVH_->Fill(ip3dToPV, wfac);
1726  iperr3dToPVH_->Fill(iperr3dToPV, wfac);
1727  ip3dToBSH_->Fill(ip3dToBS, wfac);
1728  iperr3dToBSH_->Fill(iperr3dToBS, wfac);
1729  ip2dToPVH_->Fill(ip2dToPV, wfac);
1730  iperr2dToPVH_->Fill(iperr2dToPV, wfac);
1731  iperr2dToPVWtH_->Fill(iperr2dToPV, wfac);
1732  ip2dToBSH_->Fill(ip2dToBS, wfac);
1733  iperr2dToBSH_->Fill(iperr2dToBS, wfac);
1734 
1735  iperr3dToPVWtH_->Fill(iperr3dToPV, wfac);
1736  sip3dToPVH_->Fill(sip3dToPV, wfac);
1737  sip2dToPVH_->Fill(sip2dToPV, wfac);
1738  sip3dToBSH_->Fill(sip3dToBS, wfac);
1739  sip2dToBSH_->Fill(sip2dToBS, wfac);
1740  sip2dToPVWtH_->Fill(sip2dToPV, wfac);
1741  sipDxyToPVH_->Fill(sipDxyToPV, wfac);
1742  sipDzToPVH_->Fill(sipDzToPV, wfac);
1743 
1744  if (nValidPixelHits >= 2) {
1745  ip3dToPV2validpixelhitsH_->Fill(ip3dToPV, wfac);
1746  iperr3dToPV2validpixelhitsH_->Fill(iperr3dToPV, wfac);
1747  ip3dToBS2validpixelhitsH_->Fill(ip3dToBS, wfac);
1748  iperr3dToBS2validpixelhitsH_->Fill(iperr3dToBS, wfac);
1749  sip3dToPV2validpixelhitsH_->Fill(sip3dToPV, wfac);
1750  sip3dToBS2validpixelhitsH_->Fill(sip3dToBS, wfac);
1751  }
1752 
1753  trackIperr3dVsEta2DH_->Fill(eta, iperr3dToPV, wfac);
1754  trackSip2dVsEta2DH_->Fill(eta, sip2dToPV, wfac);
1755  trackIperr3dVsChi2prob2DH_->Fill(chi2prob, iperr3dToPV, wfac);
1756  trackSip2dVsChi2prob2DH_->Fill(chi2prob, sip2dToPV, wfac);
1757 
1758  trackIperr3dVsEtaH_->Fill(eta, iperr3dToPV);
1759  trackSip2dVsEtaH_->Fill(eta, sip2dToPV);
1760 
1761  double trackerLayersWithMeasurement = hitp.trackerLayersWithMeasurement();
1762  double pixelLayersWithMeasurement = hitp.pixelLayersWithMeasurement();
1763  double pixelBLayersWithMeasurement = hitp.pixelBarrelLayersWithMeasurement();
1764  double pixelELayersWithMeasurement = hitp.pixelEndcapLayersWithMeasurement();
1765  double stripLayersWithMeasurement = hitp.stripLayersWithMeasurement();
1766  double stripTIBLayersWithMeasurement = hitp.stripTIBLayersWithMeasurement();
1767  double stripTOBLayersWithMeasurement = hitp.stripTOBLayersWithMeasurement();
1768  double stripTIDLayersWithMeasurement = hitp.stripTIDLayersWithMeasurement();
1769  double stripTECLayersWithMeasurement = hitp.stripTECLayersWithMeasurement();
1770 
1771  trkLayerwithMeasurementH_->Fill(trackerLayersWithMeasurement, wfac);
1772  pixelLayerwithMeasurementH_->Fill(pixelLayersWithMeasurement, wfac);
1773  pixelBLayerwithMeasurementH_->Fill(pixelBLayersWithMeasurement, wfac);
1774  pixelELayerwithMeasurementH_->Fill(pixelELayersWithMeasurement, wfac);
1775  stripLayerwithMeasurementH_->Fill(stripLayersWithMeasurement, wfac);
1776  stripTIBLayerwithMeasurementH_->Fill(stripTIBLayersWithMeasurement, wfac);
1777  stripTOBLayerwithMeasurementH_->Fill(stripTOBLayersWithMeasurement, wfac);
1778  stripTIDLayerwithMeasurementH_->Fill(stripTIDLayersWithMeasurement, wfac);
1779  stripTECLayerwithMeasurementH_->Fill(stripTECLayersWithMeasurement, wfac);
1780 
1781  nallHitsH_->Fill(nAllHits, wfac);
1782  ntrackerHitsH_->Fill(nAllTrackerHits, wfac);
1783  nvalidTrackerHitsH_->Fill(nValidTrackerHits, wfac);
1785  nvalidPixelBHitsH_->Fill(nValidPixelBHits, wfac);
1786  nvalidPixelEHitsH_->Fill(nValidPixelEHits, wfac);
1788  nvalidTIBHitsH_->Fill(nValidTIBHits, wfac);
1789  nvalidTOBHitsH_->Fill(nValidTOBHits, wfac);
1790  nvalidTIDHitsH_->Fill(nValidTIDHits, wfac);
1791  nvalidTECHitsH_->Fill(nValidTECHits, wfac);
1792 
1793  nlostTrackerHitsH_->Fill(nLostTrackerHits, wfac);
1794  nlostPixelHitsH_->Fill(nLostPixHits, wfac);
1795  nlostPixelBHitsH_->Fill(nLostPixBHits, wfac);
1796  nlostPixelEHitsH_->Fill(nLostPixEHits, wfac);
1797  nlostStripHitsH_->Fill(nLostStripHits, wfac);
1798  nlostTIBHitsH_->Fill(nLostStripTIBHits, wfac);
1799  nlostTOBHitsH_->Fill(nLostStripTOBHits, wfac);
1800  nlostTIDHitsH_->Fill(nLostStripTIDHits, wfac);
1801  nlostTECHitsH_->Fill(nLostStripTECHits, wfac);
1802  }
1803  }
1804  } else {
1805  edm::LogError("StandaloneTrackMonitor") << "Error! Failed to get reco::Track collection, " << trackTag_;
1806  }
1807 
1808  if (haveAllHistograms_) {
1809  nTracksH_->Fill(ntracks, wfac);
1811  iEvent.getByToken(jetsToken_, jetsColl);
1812  nJet_->Fill(jetsColl->size());
1813 
1814  for (auto const& jet : *jetsColl) {
1815  Jet_pt_->Fill(jet.pt(), wfac);
1816  Jet_eta_->Fill(jet.eta(), wfac);
1817  Jet_energy_->Fill(jet.energy(), wfac);
1818  Jet_chargedMultiplicity_->Fill(jet.chargedHadronMultiplicity(), wfac);
1819  }
1820  if (list.size() >= 2) {
1821  TLorentzVector Zp = list[0] + list[1];
1822  Zpt_->Fill(Zp.Pt(), wfac);
1823  ZInvMass_->Fill(Zp.Mag(), wfac);
1824  KalmanVertexFitter kalman(true);
1825  mumuTransientVtx = kalman.vertex(tks);
1826  if (mumuTransientVtx.isValid()) {
1827  const reco::Vertex* theClosestVertex;
1828  edm::Handle<reco::VertexCollection> vertexHandle = iEvent.getHandle(vertexToken_);
1829  if (vertexHandle.isValid()) {
1830  const reco::VertexCollection* vertices = vertexHandle.product();
1831  theClosestVertex = this->findClosestVertex(mumuTransientVtx, vertices);
1832  reco::Vertex theMainVtx;
1833  if (theClosestVertex == nullptr) {
1834  theMainVtx = vertexHandle.product()->front();
1835  } else {
1836  theMainVtx = *theClosestVertex;
1837  }
1838  if (theMainVtx.isValid()) {
1839  const math::XYZPoint theMainVtxPos(
1840  theMainVtx.position().x(), theMainVtx.position().y(), theMainVtx.position().z());
1841  const math::XYZPoint myVertex(
1842  mumuTransientVtx.position().x(), mumuTransientVtx.position().y(), mumuTransientVtx.position().z());
1843  const math::XYZPoint deltaVtx(
1844  theMainVtxPos.x() - myVertex.x(), theMainVtxPos.y() - myVertex.y(), theMainVtxPos.z() - myVertex.z());
1845  double cosphi3D =
1846  (Zp.Px() * deltaVtx.x() + Zp.Py() * deltaVtx.y() + Zp.Pz() * deltaVtx.z()) /
1847  (sqrt(Zp.Px() * Zp.Px() + Zp.Py() * Zp.Py() + Zp.Pz() * Zp.Pz()) *
1848  sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y() + deltaVtx.z() * deltaVtx.z()));
1849  cosPhi3DdileptonH_->Fill(cosphi3D, wfac);
1850  }
1851  }
1852  }
1853  }
1854  }
1855 
1856  // off track cluster properties (only on RECO data-tier)
1857  if (isRECO_) {
1858  processClusters(iEvent, iSetup, tkGeom, wfac);
1859  }
1860 
1861  if (verbose_)
1862  edm::LogInfo("StandaloneTrackMonitor") << "Ends StandaloneTrackMonitor successfully";
1863 }
1865  edm::EventSetup const& iSetup,
1866  const TrackerGeometry& tkGeom,
1867  double wfac) {
1868  // SiStripClusters
1870  iEvent.getByToken(clusterToken_, clusterHandle);
1871 
1872  if (clusterHandle.isValid()) {
1873  // Loop on Dets
1874  for (edmNew::DetSetVector<SiStripCluster>::const_iterator dsvit = clusterHandle->begin();
1875  dsvit != clusterHandle->end();
1876  ++dsvit) {
1877  uint32_t detId = dsvit->id();
1878  std::map<uint32_t, std::set<const SiStripCluster*> >::iterator jt = clusterMap_.find(detId);
1879  bool detid_found = (jt != clusterMap_.end()) ? true : false;
1880 
1881  // Loop on Clusters
1882  for (edmNew::DetSet<SiStripCluster>::const_iterator clusit = dsvit->begin(); clusit != dsvit->end(); ++clusit) {
1883  if (detid_found) {
1884  std::set<const SiStripCluster*>& s = jt->second;
1885  if (s.find(&*clusit) != s.end())
1886  continue;
1887  }
1888 
1890  float charge = siStripClusterInfo_.charge();
1891  float width = siStripClusterInfo_.width();
1892 
1893  const GeomDetUnit* detUnit = tkGeom.idToDetUnit(detId);
1894  float thickness = detUnit->surface().bounds().thickness(); // unit cm
1895  if (thickness > 0.035) {
1898  } else {
1901  }
1902  }
1903  }
1904  } else {
1905  edm::LogError("StandaloneTrackMonitor") << "ClusterCollection " << clusterTag_ << " not valid!!" << std::endl;
1906  }
1907 }
1909  edm::EventSetup const& iSetup,
1910  const TrackerGeometry& tkGeom,
1911  double wfac) {
1912  uint32_t detid = recHit.geographicalId();
1913  const GeomDetUnit* detUnit = tkGeom.idToDetUnit(detid);
1914  float thickness = detUnit->surface().bounds().thickness(); // unit cm
1915 
1916  auto const& thit = static_cast<BaseTrackerRecHit const&>(recHit);
1917  if (!thit.isValid())
1918  return;
1919 
1920  auto const& clus = thit.firstClusterRef();
1921  if (!clus.isValid())
1922  return;
1923  if (!clus.isStrip())
1924  return;
1925 
1926  if (thit.isMatched()) {
1927  const SiStripMatchedRecHit2D& matchedHit = dynamic_cast<const SiStripMatchedRecHit2D&>(recHit);
1928 
1929  auto& clusterM = matchedHit.monoCluster();
1930  siStripClusterInfo_.setCluster(clusterM, detid);
1931 
1932  if (thickness > 0.035) {
1935  } else {
1938  }
1939  addClusterToMap(detid, &clusterM);
1940 
1941  auto& clusterS = matchedHit.stereoCluster();
1942 
1943  siStripClusterInfo_.setCluster(clusterS, detid);
1944  if (thickness > 0.035) {
1947  } else {
1950  }
1951  addClusterToMap(detid, &clusterS);
1952  } else {
1953  auto& cluster = clus.stripCluster();
1954  siStripClusterInfo_.setCluster(cluster, detid);
1955  if (thickness > 0.035) {
1958  } else {
1961  }
1962 
1963  addClusterToMap(detid, &cluster);
1964  }
1965 }
1966 void StandaloneTrackMonitor::addClusterToMap(uint32_t detid, const SiStripCluster* cluster) {
1967  std::map<uint32_t, std::set<const SiStripCluster*> >::iterator it = clusterMap_.find(detid);
1968  if (it == clusterMap_.end()) {
1969  std::set<const SiStripCluster*> s;
1970  s.insert(cluster);
1971  clusterMap_.insert(std::pair<uint32_t, std::set<const SiStripCluster*> >(detid, s));
1972  } else {
1973  std::set<const SiStripCluster*>& s = it->second;
1974  s.insert(cluster);
1975  }
1976 }
1977 
1979  const TransientVertex aTransVtx,
1980  const reco::VertexCollection* vertices) const { //same as in /DQMOffline/Alignment/src/DiMuonVertexSelector.cc
1981  reco::Vertex* defaultVtx = nullptr;
1982 
1983  if (!aTransVtx.isValid())
1984  return defaultVtx;
1985 
1986  // find the closest vertex to the secondary vertex in 3D
1987  VertexDistance3D vertTool3D;
1988  float minD = 9999.;
1989  int closestVtxIndex = 0;
1990  int counter = 0;
1991  for (const auto& vtx : *vertices) {
1992  double dist3D = vertTool3D.distance(aTransVtx, vtx).value();
1993  if (dist3D < minD) {
1994  minD = dist3D;
1995  closestVtxIndex = counter;
1996  }
1997  counter++;
1998  }
1999 
2000  if ((*vertices).at(closestVtxIndex).isValid()) {
2001  return &(vertices->at(closestVtxIndex));
2002  } else {
2003  return defaultVtx;
2004  }
2005 }
2006 
2007 // Define this as a plug-in
MonitorElement * nValidHitsPixEVsPhiH_
MonitorElement * pixelLayerwithMeasurementH_
int numberOfLostTrackerHits(HitCategory category) const
Definition: HitPattern.h:893
const TrackerGeometry * tkGeom_
MonitorElement * nLostHitByLayerPixH_
MonitorElement * nLostHitsPixBVsIterationH_
int numberOfValidPixelHits() const
Definition: HitPattern.h:831
MonitorElement * hOnTrkClusChargeThickH_
const edm::InputTag trackTag_
static constexpr auto TEC
MonitorElement * nValidHitsPixBVsPhiH_
static bool stripTECHitFilter(uint16_t pattern)
Definition: HitPattern.h:632
static uint32_t getLayer(uint16_t pattern)
Definition: HitPattern.h:721
MonitorElement * nLostHitsPixEVsIterationH_
MonitorElement * trackDeltaRwrtClosestTrack_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void analyze(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
int numberOfLostHits(HitCategory category) const
Definition: HitPattern.h:891
MonitorElement * hOnTrkClusChargeThinH_
MonitorElement * stripTOBLayerwithMeasurementH_
void setCluster(const SiStripCluster &cluster, int detId)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusterToken_
GlobalPoint position() const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
MonitorElement * trackStoppingSourceH_
MonitorElement * trackChi2oNDFVsEtaH_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
StandaloneTrackMonitor(const edm::ParameterSet &)
MonitorElement * trackChi2probVsPhiH_
T z() const
Definition: PV3DBase.h:61
TrackQuality
track quality
Definition: TrackBase.h:150
MonitorElement * hOffTrkClusWidthThickH_
const edm::EDGetTokenT< reco::TrackCollection > trackToken_
const Point & position() const
position
Definition: Vertex.h:128
MonitorElement * nMissingOuterHitEH_
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:534
MonitorElement * nLostHitsTIBVsIterationH_
int numberOfAllHits(HitCategory category) const
Definition: HitPattern.h:804
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > puSummaryToken_
std::pair< bool, Measurement1D > signedTransverseImpactParameter(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:57
T const * product() const
Definition: Handle.h:70
int stripLayersWithMeasurement() const
Definition: HitPattern.h:1005
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
MonitorElement * stripLayerwithMeasurementH_
int numberOfValidStripTIBHits() const
Definition: HitPattern.h:847
MonitorElement * sip3dToBS2validpixelhitsH_
std::pair< bool, Measurement1D > signedImpactParameter3D(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:81
int stripTIDLayersWithMeasurement() const
Definition: HitPattern.cc:608
int pixelEndcapLayersWithMeasurement() const
Definition: HitPattern.cc:587
int numberOfValidStripTECHits() const
Definition: HitPattern.h:859
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
MonitorElement * nValidHitsTOBVsPhiH_
int numberOfLostPixelBarrelHits(HitCategory category) const
Definition: HitPattern.h:917
MonitorElement * yPointOfClosestApproachVsZ0wrtPVH_
data_type const * const_iterator
Definition: DetSetNew.h:31
Log< level::Error, false > LogError
std::vector< Vertex > VertexCollection
Definition: Vertex.h:31
MonitorElement * hOnTrkClusWidthThinH_
static bool missingHitFilter(uint16_t pattern)
Definition: HitPattern.h:798
int numberOfAllTrackerHits(HitCategory category) const
Definition: HitPattern.h:809
MonitorElement * iperr3dToBS2validpixelhitsH_
MonitorElement * trackChi2probVsEtaH_
MonitorElement * Jet_chargedMultiplicity_
static bool pixelBarrelHitFilter(uint16_t pattern)
Definition: HitPattern.h:590
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transTrackToken_
MonitorElement * hOffTrkClusWidthThinH_
const std::string puScaleFactorFile_
MonitorElement * hOffTrkClusChargeThinH_
int stripTECLayersWithMeasurement() const
Definition: HitPattern.cc:628
SiStripClusterInfo siStripClusterInfo_
MonitorElement * nLostHitsTECVsIterationH_
const edm::InputTag mvaTrackTag_
static bool pixelEndcapHitFilter(uint16_t pattern)
Definition: HitPattern.h:599
int numberOfLostStripHits(HitCategory category) const
Definition: HitPattern.h:925
int numberOfValidStripHits() const
Definition: HitPattern.h:843
const edm::InputTag jetsTag_
MonitorElement * trackIperr3dVsEtaH_
MonitorElement * nMissingExpectedInnerHitsH_
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
MonitorElement * nLostHitsTOBVsIterationH_
const edm::InputTag vertexTag_
reco::TransientTrack build(const reco::Track *p) const
void Fill(long long x)
virtual float thickness() const =0
MonitorElement * nLostHitsTIDVsEtaH_
int numberOfLostStripTECHits(HitCategory category) const
Definition: HitPattern.h:941
string quality
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
const edm::ParameterSet TrackPtHistoPar_
MonitorElement * nLostHitsPixEVsEtaH_
MonitorElement * nMissingInnerHitEH_
int iEvent
Definition: GenABIO.cc:224
MonitorElement * nLostHitsTIBVsEtaH_
MonitorElement * nLostHitsTIDVsIterationH_
std::vector< float > MVACollection
MonitorElement * nValidHitsPixVsEtaH_
MonitorElement * hOnTrkClusWidthThickH_
MonitorElement * stripTIBLayerwithMeasurementH_
MonitorElement * nValidHitsTIDVsEtaH_
MonitorElement * nValidHitsStripVsPhiH_
SiStripCluster const & monoCluster() const
MonitorElement * nValidHitsTECVsEtaH_
bool isValid() const
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
std::vector< MonitorElement * > trackMVAs
T sqrt(T t)
Definition: SSEVec.h:19
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
int numberOfValidPixelEndcapHits() const
Definition: HitPattern.h:839
MonitorElement * trackSip2dVsChi2prob2DH_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
const std::string StopReasonName[]
int numberOfLostPixelEndcapHits(HitCategory category) const
Definition: HitPattern.h:921
const edm::InputTag puSummaryTag_
MonitorElement * nValidHitsPixVsPhiH_
MonitorElement * DistanceOfClosestApproachToPVH_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int stripTOBLayersWithMeasurement() const
Definition: HitPattern.cc:618
T get() const
Definition: EventSetup.h:79
Transition
Definition: Transition.h:12
MonitorElement * nMissingOuterHitBH_
int numberOfValidStripTIDHits() const
Definition: HitPattern.h:851
const edm::ParameterSet TrackPhiHistoPar_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MonitorElement * nValidHitsVsCosThetaH_
MonitorElement * nLostHitsTOBVsEtaH_
MonitorElement * pixelELayerwithMeasurementH_
static constexpr auto TOB
MonitorElement * ip3dToPV2validpixelhitsH_
int numberOfLostStripTIDHits(HitCategory category) const
Definition: HitPattern.h:933
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual 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)
MonitorElement * nLostHitsTIDVsPhiH_
std::vector< MonitorElement * > trackMVAsVsPtProfile
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:537
std::vector< MonitorElement * > trackMVAsHP
MonitorElement * trackIperr3dVsChi2prob2DH_
MonitorElement * stripTECLayerwithMeasurementH_
MonitorElement * trackIperr3dVsChi2probH_
std::vector< unsigned char > QualityMaskCollection
int numberOfLostStripTOBHits(HitCategory category) const
Definition: HitPattern.h:937
MonitorElement * nLostHitsVsCosThetaH_
#define M_PI
MonitorElement * nValidHitsTIBVsEtaH_
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
MonitorElement * hOffTrkClusChargeThickH_
Log< level::Info, false > LogInfo
const edm::InputTag tcProducer_
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
MonitorElement * nMissingExpectedOuterHitsH_
const edm::InputTag clusterTag_
MonitorElement * nvalidTrackerHitsH_
MonitorElement * nValidHitsPixBVsEtaH_
void addClusterToMap(uint32_t detid, const SiStripCluster *cluster)
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
MonitorElement * nLostHitsTECVsEtaH_
static constexpr auto TIB
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
MonitorElement * trackChi2oNDFVsPhiH_
MonitorElement * nLostHitsStripVsEtaH_
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
const edm::EDGetTokenT< edm::View< reco::Track > > mvaTrackToken_
MonitorElement * trkLayerwithMeasurementH_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * DistanceOfClosestApproachToPVZoomedH_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::map< uint32_t, std::set< const SiStripCluster * > > clusterMap_
uint16_t width() const
SiStripCluster const & stereoCluster() const
MonitorElement * trackSip2dVsEta2DH_
static const std::string algoNames[]
Definition: TrackBase.h:147
static bool stripTOBHitFilter(uint16_t pattern)
Definition: HitPattern.h:628
MonitorElement * xPointOfClosestApproachVsZ0wrtPVH_
bool isValid() const
Definition: HandleBase.h:70
double value() const
Definition: Measurement1D.h:25
MonitorElement * nLostHitByLayerStripH_
int numberOfLostPixelHits(HitCategory category) const
Definition: HitPattern.h:913
static bool stripTIBHitFilter(uint16_t pattern)
Definition: HitPattern.h:620
std::vector< float > vtrack_
fixed size matrix
void dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
MonitorElement * iperr3dToPV2validpixelhitsH_
HLT enums.
const edm::ParameterSet TrackEtaHistoPar_
const edm::EDGetTokenT< reco::VertexCollection > vertexToken_
static std::atomic< unsigned int > counter
MonitorElement * nLostHitsPixVsPhiH_
MonitorElement * sip3dToPV2validpixelhitsH_
void processClusters(edm::Event const &iEvent, edm::EventSetup const &iSetup, const TrackerGeometry &tkGeom, double wfac=1)
MonitorElement * nLostHitsVsIterationH_
MonitorElement * nValidHitsStripVsEtaH_
const edm::EDGetTokenT< std::vector< reco::PFJet > > jetsToken_
std::vector< MonitorElement * > trackMVAsHPVsEtaProfile
int numberOfValidPixelBarrelHits() const
Definition: HitPattern.h:835
MonitorElement * nValidHitsTOBVsEtaH_
MonitorElement * nLostHitsTIBVsPhiH_
int pixelBarrelLayersWithMeasurement() const
Definition: HitPattern.cc:576
MonitorElement * trackIperr3dVsEta2DH_
virtual int getNbinsX() const
get # of bins in X-axis
MonitorElement * nLostHitsPixBVsEtaH_
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:513
MonitorElement * nLostHitsStripVsIterationH_
uint16_t charge() const
#define ntrack
MonitorElement * pixelBLayerwithMeasurementH_
MonitorElement * ip3dToBS2validpixelhitsH_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * nLostHitsTOBVsPhiH_
MonitorElement * nLostHitsTECVsPhiH_
static bool stripTIDHitFilter(uint16_t pattern)
Definition: HitPattern.h:624
const reco::Vertex * findClosestVertex(const TransientVertex aTransVtx, const reco::VertexCollection *vertices) const
void processHit(const TrackingRecHit &recHit, edm::EventSetup const &iSetup, const TrackerGeometry &tkGeom, double wfac=1)
std::vector< std::tuple< edm::EDGetTokenT< MVACollection >, edm::EDGetTokenT< QualityMaskCollection > > > mvaQualityTokens_
std::vector< MonitorElement * > trackMVAsVsEtaProfile
MonitorElement * nLostHitsPixBVsPhiH_
MonitorElement * nValidHitsTIBVsPhiH_
const std::string trackScaleFactorFile_
static constexpr auto TID
MonitorElement * nLostHitsPixVsIterationH_
Geom::Theta< T > theta() const
int numberOfValidTrackerHits() const
Definition: HitPattern.h:819
MonitorElement * stripTIDLayerwithMeasurementH_
MonitorElement * nValidHitsPixEVsEtaH_
MonitorElement * nLostHitsPixVsEtaH_
MonitorElement * nLostHitsPixEVsPhiH_
int numberOfLostStripTIBHits(HitCategory category) const
Definition: HitPattern.h:929
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
MonitorElement * DistanceOfClosestApproachToPVVsPhiH_
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:73
MonitorElement * nValidHitsTIDVsPhiH_
Definition: Run.h:45
MonitorElement * nValidHitsTECVsPhiH_
std::vector< MonitorElement * > trackMVAsHPVsPtProfile
MonitorElement * nLostHitsStripVsPhiH_
const std::vector< std::string > mvaProducers_
int numberOfValidStripTOBHits() const
Definition: HitPattern.h:855
int stripTIBLayersWithMeasurement() const
Definition: HitPattern.cc:598
MonitorElement * nMissingInnerHitBH_
const Bounds & bounds() const
Definition: Surface.h:87