CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QcdUeDQM.cc
Go to the documentation of this file.
1 /*
2  This is the DQM code for UE physics plots
3  11/12/2009 Sunil Bansal
4 */
33 #include <TString.h>
34 #include <TMath.h>
35 #include <TH1F.h>
36 #include <TH2F.h>
37 #include <TH3F.h>
38 #include <TProfile.h>
39 using namespace std;
40 using namespace edm;
41 
42 #define CP(level) if (level >= verbose_)
43 
44 struct deleter {
45  void operator()(TH3F *&h) {
46  delete h;
47  h = nullptr;
48  }
49 };
50 
52  : hltResName_(parameters.getUntrackedParameter<string>("hltTrgResults")),
53  verbose_(parameters.getUntrackedParameter<int>("verbose", 3)),
54  tgeo_(nullptr),
55  repSumMap_(nullptr),
56  repSummary_(nullptr),
57  h2TrigCorr_(nullptr),
58  ptMin_(parameters.getParameter<double>("ptMin")),
59  minRapidity_(parameters.getParameter<double>("minRapidity")),
60  maxRapidity_(parameters.getParameter<double>("maxRapidity")),
61  tip_(parameters.getParameter<double>("tip")),
62  lip_(parameters.getParameter<double>("lip")),
63  diffvtxbs_(parameters.getParameter<double>("diffvtxbs")),
64  ptErr_pt_(parameters.getParameter<double>("ptErr_pt")),
65  vtxntk_(parameters.getParameter<double>("vtxntk")),
66  minHit_(parameters.getParameter<int>("minHit")),
67  pxlLayerMinCut_(parameters.getParameter<double>("pxlLayerMinCut")),
68  requirePIX1_(parameters.getParameter<bool>("requirePIX1")),
69  min3DHit_(parameters.getParameter<int>("min3DHit")),
70  maxChi2_(parameters.getParameter<double>("maxChi2")),
71  bsuse_(parameters.getParameter<bool>("bsuse")),
72  allowTriplets_(parameters.getParameter<bool>("allowTriplets")),
73  bsPos_(parameters.getParameter<double>("bsPos")),
74  caloJetLabel_(consumes<reco::CaloJetCollection>(parameters.getUntrackedParameter<edm::InputTag>("caloJetTag"))),
75  chargedJetLabel_(
76  consumes<reco::TrackJetCollection>(parameters.getUntrackedParameter<edm::InputTag>("chargedJetTag"))),
77  trackLabel_(consumes<reco::TrackCollection>(parameters.getUntrackedParameter<edm::InputTag>("trackTag"))),
78  vtxLabel_(consumes<reco::VertexCollection>(parameters.getUntrackedParameter<edm::InputTag>("vtxTag"))),
79  bsLabel_(consumes<reco::BeamSpot>(parameters.getParameter<edm::InputTag>("beamSpotTag"))) {
80  // Constructor.
81  std::vector<std::string> quality = parameters.getParameter<std::vector<std::string> >("quality");
82  for (unsigned int j = 0; j < quality.size(); j++)
83  quality_.push_back(reco::TrackBase::qualityByName(quality[j]));
84  std::vector<std::string> algorithm = parameters.getParameter<std::vector<std::string> >("algorithm");
85  for (unsigned int j = 0; j < algorithm.size(); j++)
86  algorithm_.push_back(reco::TrackBase::algoByName(algorithm[j]));
87 
88  if (parameters.exists("hltTrgNames"))
89  hltTrgNames_ = parameters.getUntrackedParameter<vector<string> >("hltTrgNames");
90 
91  if (parameters.exists("hltProcNames"))
92  hltProcNames_ = parameters.getUntrackedParameter<vector<string> >("hltProcNames");
93  else {
94  // hltProcNames_.push_back("FU");
95  hltProcNames_.push_back("HLT");
96  }
97 
98  isHltConfigSuccessful_ = false; // init
99 }
100 
102  // Destructor.
103 }
104 
105 void QcdUeDQM::dqmBeginRun(const Run &run, const EventSetup &iSetup) {
106  // indicating change of HLT cfg at run boundries
107  // for HLTConfigProvider::init()
108  bool isHltCfgChange = false;
109  isHltConfigSuccessful_ = false; // init
110 
111  string teststr;
112  for (size_t i = 0; i < hltProcNames_.size(); ++i) {
113  if (i > 0)
114  teststr += ", ";
115  teststr += hltProcNames_.at(i);
116  if (hltConfig.init(run, iSetup, hltProcNames_.at(i), isHltCfgChange)) {
117  isHltConfigSuccessful_ = true;
119  if (hltResName_.find(':') == string::npos)
120  hltUsedResName_ += "::";
121  else
122  hltUsedResName_ += ":";
124  break;
125  }
126  }
127 
129  return;
130 
131  // setup "Any" bit
132  hltTrgBits_.clear();
133  hltTrgBits_.push_back(-1);
134  hltTrgDeci_.clear();
135  hltTrgDeci_.push_back(true);
136  hltTrgUsedNames_.clear();
137  hltTrgUsedNames_.push_back("Any");
138 
139  // figure out relation of trigger name to trigger bit and store used trigger
140  // names/bits
141  for (size_t i = 0; i < hltTrgNames_.size(); ++i) {
142  const string &n1(hltTrgNames_.at(i));
143  // unsigned int hlt_prescale = hltConfig.prescaleValue(iSetup, n1);
144  // cout<<"trigger=="<<n1<<"presc=="<<hlt_prescale<<endl;
145  bool found = false;
146  for (size_t j = 0; j < hltConfig.size(); ++j) {
147  const string &n2(hltConfig.triggerName(j));
148  if (n2 == n1) {
149  hltTrgBits_.push_back(j);
150  hltTrgUsedNames_.push_back(n1);
151  hltTrgDeci_.push_back(false);
152  found = true;
153  break;
154  }
155  }
156  if (!found) {
157  CP(2) cout << "Could not find trigger bit" << endl;
158  }
159  }
160  isHltConfigSuccessful_ = true;
161 }
162 
164  // Book histograms if needed.
165  iBooker.setCurrentFolder("Physics/QcdUe");
166 
167  if (true) {
168  const int Nx = hltTrgUsedNames_.size();
169  const double x1 = -0.5;
170  const double x2 = Nx - 0.5;
171  h2TrigCorr_ = iBooker.book2D("h2TriCorr", "Trigger bit x vs y;y&&!x;x&&y", Nx, x1, x2, Nx, x1, x2);
172  for (size_t i = 1; i <= hltTrgUsedNames_.size(); ++i) {
175  }
176  TH1 *h = h2TrigCorr_->getTH1();
177  if (h)
178  h->SetStats(false);
179  }
180  book1D(iBooker, hNevts_, "hNevts", "number of events", 2, 0, 2);
181  book1D(iBooker, hNtrackerLayer_, "hNtrackerLayer", "number of tracker layers;multiplicity", 20, -0.5, 19.5);
182  book1D(iBooker, hNtrackerPixelLayer_, "hNtrackerPixelLayer", "number of pixel layers;multiplicity", 10, -0.5, 9.5);
183  book1D(iBooker,
185  "hNtrackerStripPixelLayer",
186  "number of strip + pixel layers;multiplicity",
187  30,
188  -0.5,
189  39.5);
190  book1D(iBooker, hRatioPtErrorPt_, "hRatioPtErrorPt", "ratio of pT error and track pT", 25, 0., 5.);
191  book1D(iBooker, hTrkPt_, "hTrkPt", "pT of all tracks", 50, 0., 50.);
192  book1D(iBooker, hTrkEta_, "hTrkEta", "eta of all tracks", 40, -4., 4.);
193  book1D(iBooker, hTrkPhi_, "hTrkPhi", "phi of all tracks", 40, -4., 4.);
194  book1D(iBooker,
196  "hRatioDxySigmaDxyBS",
197  "ratio of transverse impact parameter and its significance wrt beam spot",
198  60,
199  -10.,
200  10);
201  book1D(iBooker,
203  "hRatioDxySigmaDxyPV",
204  "ratio of transverse impact parameter and its significance wrt PV",
205  60,
206  -10.,
207  10);
208  book1D(iBooker,
210  "hRatioDzSigmaDzBS",
211  "ratio of longitudinal impact parameter and its significance wrt beam "
212  "spot",
213  80,
214  -20.,
215  20);
216  book1D(iBooker,
218  "hRatioDzSigmaDzPV",
219  "ratio of longitudinal impact parameter and its significance wrt PV",
220  80,
221  -20.,
222  20);
223  book1D(iBooker, hTrkChi2_, "hTrkChi2", "track chi2", 30, 0., 30);
224  book1D(iBooker, hTrkNdof_, "hTrkNdof", "track NDOF", 100, 0, 100);
225 
226  book1D(iBooker, hNgoodTrk_, "hNgoodTrk", "number of good tracks", 50, -0.5, 49.5);
227 
228  book1D(iBooker, hGoodTrkPt500_, "hGoodTrkPt500", "pT of all good tracks with pT > 500 MeV", 50, 0., 50.);
229  book1D(iBooker, hGoodTrkEta500_, "hGoodTrkEta500", "eta of all good tracks pT > 500 MeV", 40, -4., 4.);
230  book1D(iBooker, hGoodTrkPhi500_, "hGoodTrkPhi500", "phi of all good tracks pT > 500 MeV", 40, -4., 4.);
231 
232  book1D(iBooker, hGoodTrkPt900_, "hGoodTrkPt900", "pT of all good tracks with pT > 900 MeV", 50, 0., 50.);
233  book1D(iBooker, hGoodTrkEta900_, "hGoodTrkEta900", "eta of all good tracks pT > 900 MeV", 40, -4., 4.);
234  book1D(iBooker, hGoodTrkPhi900_, "hGoodTrkPhi900", "phi of all good tracks pT > 900 MeV", 40, -4., 4.);
235 
236  book1D(iBooker, hNvertices_, "hNvertices", "number of vertices", 5, -0.5, 4.5);
237  book1D(iBooker, hVertex_z_, "hVertex_z", "z position of vertex; z[cm]", 200, -50, 50);
238  book1D(iBooker, hVertex_y_, "hVertex_y", "y position of vertex; y[cm]", 100, -5, 5);
239  book1D(iBooker, hVertex_x_, "hVertex_x", "x position of vertex; x[cm]", 100, -5, 5);
240  book1D(iBooker, hVertex_ndof_, "hVertex_ndof", "ndof of vertex", 100, 0, 100);
241  book1D(iBooker, hVertex_rho_, "hVertex_rho", "rho of vertex", 100, 0, 5);
242  book1D(iBooker, hVertex_z_bs_, "hVertex_z_bs", "z position of vertex from beamspot; z[cm]", 200, -50, 50);
243 
244  book1D(iBooker, hBeamSpot_z_, "hBeamSpot_z", "z position of beamspot; z[cm]", 100, -20, 20);
245  book1D(iBooker, hBeamSpot_y_, "hBeamSpot_y", "y position of beamspot; y[cm]", 50, -10, 10);
246  book1D(iBooker, hBeamSpot_x_, "hBeamSpot_x", "x position of beamspot; x[cm]", 50, -10, 10);
247 
248  if (true) {
249  const int Nx = 25;
250  const double x1 = 0.0;
251  const double x2 = 50.0;
252  book1D(iBooker,
254  "hLeadingTrack_pTSpectrum",
255  "pT spectrum of leading track;pT(GeV/c)",
256  Nx,
257  x1,
258  x2);
259  book1D(iBooker,
261  "hLeadingChargedJet_pTSpectrum",
262  "pT spectrum of leading track jet;pT(GeV/c)",
263  Nx,
264  x1,
265  x2);
266  }
267 
268  if (true) {
269  const int Nx = 24;
270  const double x1 = -4.;
271  const double x2 = 4.;
272  book1D(iBooker,
274  "hLeadingTrack_phiSpectrum",
275  "#phi spectrum of leading track;#phi",
276  Nx,
277  x1,
278  x2);
279  book1D(iBooker,
281  "hLeadingChargedJet_phiSpectrum",
282  "#phi spectrum of leading track jet;#phi",
283  Nx,
284  x1,
285  x2);
286  }
287 
288  if (true) {
289  const int Nx = 24;
290  const double x1 = -4.;
291  const double x2 = 4.;
292  book1D(iBooker,
294  "hLeadingTrack_etaSpectrum",
295  "#eta spectrum of leading track;#eta",
296  Nx,
297  x1,
298  x2);
299  book1D(iBooker,
301  "hLeadingChargedJet_etaSpectrum",
302  "#eta spectrum of leading track jet;#eta",
303  Nx,
304  x1,
305  x2);
306  }
307 
308  if (true) {
309  const int Nx = 75;
310  const double x1 = 0.0;
311  const double x2 = 75.0;
312  const double y1 = 0.;
313  const double y2 = 10.;
314  bookProfile(iBooker,
316  "hdNdEtadPhi_pTMax_Toward500",
317  "Average number of tracks (pT > 500 MeV) in toward region vs "
318  "leading track pT;pT(GeV/c);dN/d#eta d#phi",
319  Nx,
320  x1,
321  x2,
322  y1,
323  y2,
324  false,
325  false);
326  bookProfile(iBooker,
328  "hdNdEtadPhi_pTMax_Transverse500",
329  "Average number of tracks (pT > 500 MeV) in transverse region "
330  "vs leading track pT;pT(GeV/c);dN/d#eta d#phi",
331  Nx,
332  x1,
333  x2,
334  y1,
335  y2,
336  false,
337  false);
338  bookProfile(iBooker,
340  "hdNdEtadPhi_pTMax_Away500",
341  "Average number of tracks (pT > 500 MeV) in away region vs "
342  "leading track pT;pT(GeV/c);dN/d#eta d#phi",
343  Nx,
344  x1,
345  x2,
346  y1,
347  y2,
348  false,
349  false);
350  bookProfile(iBooker,
352  "hdNdEtadPhi_trackJet_Toward500",
353  "Average number of tracks (pT > 500 MeV) in toward region vs "
354  "leading track jet pT;pT(GeV/c);dN/d#eta d#phi",
355  Nx,
356  x1,
357  x2,
358  y1,
359  y2);
360  bookProfile(iBooker,
362  "hdNdEtadPhi_trackJet_Transverse500",
363  "Average number of tracks (pT > 500 MeV) in transverse region "
364  "vs leading track jet pT;pT(GeV/c);dN/d#eta d#phi",
365  Nx,
366  x1,
367  x2,
368  y1,
369  y2,
370  false,
371  false);
372  bookProfile(iBooker,
374  "hdNdEtadPhi_trackJet_Away500",
375  "Average number of tracks (pT > 500 MeV) in away region vs "
376  "leading track jet pT;pT(GeV/c);dN/d#eta d#phi",
377  Nx,
378  x1,
379  x2,
380  y1,
381  y2,
382  false,
383  false);
384 
385  bookProfile(iBooker,
387  "hpTSumdEtadPhi_pTMax_Toward500",
388  "Average number of tracks (pT > 500 MeV) in toward region vs "
389  "leading track pT;pT(GeV/c);dpTSum/d#eta d#phi",
390  Nx,
391  x1,
392  x2,
393  y1,
394  y2,
395  false,
396  false);
397  bookProfile(iBooker,
399  "hpTSumdEtadPhi_pTMax_Transverse500",
400  "Average number of tracks (pT > 500 MeV) in transverse region "
401  "vs leading track pT;pT(GeV/c);dpTSum/d#eta d#phi",
402  Nx,
403  x1,
404  x2,
405  y1,
406  y2,
407  false,
408  false);
409  bookProfile(iBooker,
411  "hpTSumdEtadPhi_pTMax_Away500",
412  "Average number of tracks (pT > 500 MeV) in away region vs "
413  "leading track pT;pT(GeV/c);dpTSum/d#eta d#phi",
414  Nx,
415  x1,
416  x2,
417  y1,
418  y2,
419  false,
420  false);
421  bookProfile(iBooker,
423  "hpTSumdEtadPhi_trackJet_Toward500",
424  "Average number of tracks (pT > 500 MeV) in toward region vs "
425  "leading track jet pT;pT(GeV/c);dpTSum/d#eta d#phi",
426  Nx,
427  x1,
428  x2,
429  y1,
430  y2,
431  false,
432  false);
433  bookProfile(iBooker,
435  "hpTSumdEtadPhi_trackJet_Transverse500",
436  "Average number of tracks (pT > 500 MeV) in transverse region "
437  "vs leading track jet pT;pT(GeV/c);dpTSum/d#eta d#phi",
438  Nx,
439  x1,
440  x2,
441  y1,
442  y2,
443  false,
444  false);
445  bookProfile(iBooker,
447  "hpTSumdEtadPhi_trackJet_Away500",
448  "Average number of tracks (pT > 500 MeV) in away region vs "
449  "leading track jet pT;pT(GeV/c);dpTSum/d#eta d#phi",
450  Nx,
451  x1,
452  x2,
453  y1,
454  y2,
455  false,
456  false);
457 
458  bookProfile(iBooker,
460  "hdNdEtadPhi_pTMax_Toward900",
461  "Average number of tracks (pT > 900 MeV) in toward region vs "
462  "leading track pT;pT(GeV/c);dN/d#eta d#phi",
463  Nx,
464  x1,
465  x2,
466  y1,
467  y2,
468  false,
469  false);
470  bookProfile(iBooker,
472  "hdNdEtadPhi_pTMax_Transverse900",
473  "Average number of tracks (pT > 900 MeV) in transverse region "
474  "vs leading track pT;pT(GeV/c);dN/d#eta d#phi",
475  Nx,
476  x1,
477  x2,
478  y1,
479  y2,
480  false,
481  false);
482  bookProfile(iBooker,
484  "hdNdEtadPhi_pTMax_Away900",
485  "Average number of tracks (pT > 900 MeV) in away region vs "
486  "leading track pT;pT(GeV/c);dN/d#eta d#phi",
487  Nx,
488  x1,
489  x2,
490  y1,
491  y2,
492  false,
493  false);
494  bookProfile(iBooker,
496  "hdNdEtadPhi_trackJet_Toward900",
497  "Average number of tracks (pT > 900 MeV) in toward region vs "
498  "leading track jet pT;pT(GeV/c);dN/d#eta d#phi",
499  Nx,
500  x1,
501  x2,
502  y1,
503  y2);
504  bookProfile(iBooker,
506  "hdNdEtadPhi_trackJet_Transverse900",
507  "Average number of tracks (pT > 900 MeV) in transverse region "
508  "vs leading track jet pT;pT(GeV/c);dN/d#eta d#phi",
509  Nx,
510  x1,
511  x2,
512  y1,
513  y2,
514  false,
515  false);
516  bookProfile(iBooker,
518  "hdNdEtadPhi_trackJet_Away900",
519  "Average number of tracks (pT > 900 MeV) in away region vs "
520  "leading track jet pT;pT(GeV/c);dN/d#eta d#phi",
521  Nx,
522  x1,
523  x2,
524  y1,
525  y2,
526  false,
527  false);
528 
529  bookProfile(iBooker,
531  "hpTSumdEtadPhi_pTMax_Toward900",
532  "Average number of tracks (pT > 900 MeV) in toward region vs "
533  "leading track pT;pT(GeV/c);dpTSum/d#eta d#phi",
534  Nx,
535  x1,
536  x2,
537  y1,
538  y2,
539  false,
540  false);
541  bookProfile(iBooker,
543  "hpTSumdEtadPhi_pTMax_Transverse900",
544  "Average number of tracks (pT > 900 MeV) in transverse region "
545  "vs leading track pT;pT(GeV/c);dpTSum/d#eta d#phi",
546  Nx,
547  x1,
548  x2,
549  y1,
550  y2,
551  false,
552  false);
553  bookProfile(iBooker,
555  "hpTSumdEtadPhi_pTMax_Away900",
556  "Average number of tracks (pT > 900 MeV) in away region vs "
557  "leading track pT;pT(GeV/c);dpTSum/d#eta d#phi",
558  Nx,
559  x1,
560  x2,
561  y1,
562  y2,
563  false,
564  false);
565  bookProfile(iBooker,
567  "hpTSumdEtadPhi_trackJet_Toward900",
568  "Average number of tracks (pT > 900 MeV) in toward region vs "
569  "leading track jet pT;pT(GeV/c);dpTSum/d#eta d#phi",
570  Nx,
571  x1,
572  x2,
573  y1,
574  y2,
575  false,
576  false);
577  bookProfile(iBooker,
579  "hpTSumdEtadPhi_trackJet_Transverse900",
580  "Average number of tracks (pT > 900 MeV) in transverse region "
581  "vs leading track jet pT;pT(GeV/c);dpTSum/d#eta d#phi",
582  Nx,
583  x1,
584  x2,
585  y1,
586  y2,
587  false,
588  false);
589  bookProfile(iBooker,
591  "hpTSumdEtadPhi_trackJet_Away900",
592  "Average number of tracks (pT > 900 MeV) in away region vs "
593  "leading track jet pT;pT(GeV/c);dpTSum/d#eta d#phi",
594  Nx,
595  x1,
596  x2,
597  y1,
598  y2,
599  false,
600  false);
601  }
602 
603  if (true) {
604  const int Nx = 20;
605  const double x1 = 0.0;
606  const double x2 = 20.0;
607 
608  book1D(iBooker, hChargedJetMulti_, "hChargedJetMulti", "Charged jet multiplicity;multiplicities", Nx, x1, x2);
609  }
610 
611  if (true) {
612  const int Nx = 60;
613  const double x1 = -180.0;
614  const double x2 = 180.0;
615 
616  book1D(iBooker,
618  "hdPhi_maxpTTrack_tracks",
619  "delta phi between leading tracks and other "
620  "tracks;#Delta#phi(leading track-track)",
621  Nx,
622  x1,
623  x2);
624  book1D(iBooker,
626  "hdPhi_chargedJet_tracks",
627  "delta phi between leading charged jet and "
628  "tracks;#Delta#phi(leading charged jet-track)",
629  Nx,
630  x1,
631  x2);
632  }
633 }
634 
635 void QcdUeDQM::analyze(const Event &iEvent, const EventSetup &iSetup) {
637  return;
638 
639  // Analyze the given event.
640 
642  bool ValidBS_ = iEvent.getByToken(bsLabel_, beamSpot);
643  if (!ValidBS_)
644  return;
645 
647  bool ValidTrack_ = iEvent.getByToken(trackLabel_, tracks);
648  if (!ValidTrack_)
649  return;
650 
652  bool ValidTrackJet_ = iEvent.getByToken(chargedJetLabel_, trkJets);
653  if (!ValidTrackJet_)
654  return;
655 
657  bool ValidCaloJet_ = iEvent.getByToken(caloJetLabel_, calJets);
658  if (!ValidCaloJet_)
659  return;
660 
662  bool ValidVtxColl_ = iEvent.getByToken(vtxLabel_, vertexColl);
663  if (!ValidVtxColl_)
664  return;
665 
666  reco::TrackCollection tracks_sort = *tracks;
667  std::sort(tracks_sort.begin(), tracks_sort.end(), PtSorter());
668 
669  // get tracker geometry
670  /* ESHandle<TrackerGeometry> trackerHandle;
671  iSetup.get<TrackerDigiGeometryRecord>().get(trackerHandle);
672  tgeo_ = trackerHandle.product();
673  if (!tgeo_)return;
674  */
675  selected_.clear();
676  fillHltBits(iEvent, iSetup);
677  // select good tracks
678  if (fillVtxPlots(beamSpot.product(), vertexColl)) {
679  fill1D(hNevts_, 1);
680  for (reco::TrackCollection::const_iterator Trk = tracks_sort.begin(); Trk != tracks_sort.end(); ++Trk) {
681  if (trackSelection(*Trk, beamSpot.product(), vtx1, vertexColl->size()))
682  selected_.push_back(&*Trk);
683  }
684 
686  fillChargedJetSpectra(trkJets);
687  // fillCaloJetSpectra(calJets);
689  if (!trkJets->empty())
691  // if(calJets->size()>0)fillUE_with_CaloJets(selected_,calJets);
692  }
693 }
694 
696  std::vector<MonitorElement *> &mes,
697  const std::string &name,
698  const std::string &title,
699  int nx,
700  double x1,
701  double x2,
702  bool sumw2,
703  bool sbox) {
704  // Book 1D histos.
705  for (size_t i = 0; i < hltTrgUsedNames_.size(); ++i) {
706  std::string folderName = "Physics/QcdUe/" + hltTrgUsedNames_.at(i);
707  iBooker.setCurrentFolder(folderName);
708  MonitorElement *e = iBooker.book1D(Form("%s_%s", name.c_str(), hltTrgUsedNames_.at(i).c_str()),
709  Form("%s: %s", hltTrgUsedNames_.at(i).c_str(), title.c_str()),
710  nx,
711  x1,
712  x2);
713  TH1 *h1 = e->getTH1();
714  if (sumw2) {
715  if (0 == h1->GetSumw2N()) { // protect against re-summing (would cause
716  // exception)
717  h1->Sumw2();
718  }
719  }
720  h1->SetStats(sbox);
721  mes.push_back(e);
722  }
723 }
724 
726  std::vector<MonitorElement *> &mes,
727  const std::string &name,
728  const std::string &title,
729  int nx,
730  double x1,
731  double x2,
732  double y1,
733  double y2,
734  bool sumw2,
735  bool sbox) {
736  // Book Profile histos.
737 
738  for (size_t i = 0; i < hltTrgUsedNames_.size(); ++i) {
739  std::string folderName = "Physics/QcdUe/" + hltTrgUsedNames_.at(i);
740  iBooker.setCurrentFolder(folderName);
741  MonitorElement *e = iBooker.bookProfile(Form("%s_%s", name.c_str(), hltTrgUsedNames_.at(i).c_str()),
742  Form("%s: %s", hltTrgUsedNames_.at(i).c_str(), title.c_str()),
743  nx,
744  x1,
745  x2,
746  y1,
747  y2,
748  " ");
749  mes.push_back(e);
750  }
751 }
752 
753 void QcdUeDQM::fill1D(std::vector<TH1F *> &hs, double val, double w) {
754  // Loop over histograms and fill if trigger has fired.
755 
756  for (size_t i = 0; i < hs.size(); ++i) {
757  if (!hltTrgDeci_.at(i))
758  continue;
759  hs.at(i)->Fill(val, w);
760  }
761 }
762 
763 //--------------------------------------------------------------------------------------------------
764 void QcdUeDQM::fill1D(std::vector<MonitorElement *> &mes, double val, double w) {
765  // Loop over histograms and fill if trigger has fired.
766 
767  for (size_t i = 0; i < mes.size(); ++i) {
768  if (!hltTrgDeci_.at(i))
769  continue;
770  mes.at(i)->Fill(val, w);
771  }
772 }
773 
774 //--------------------------------------------------------------------------------------------------
775 void QcdUeDQM::setLabel1D(std::vector<MonitorElement *> &mes) {
776  // Loop over histograms and fill if trigger has fired.
777  string cut[5] = {"Nevt", "vtx!=bmspt", "Zvtx<10cm", "pT>1GeV", "trackFromVtx"};
778  for (size_t i = 0; i < mes.size(); ++i) {
779  if (!hltTrgDeci_.at(i))
780  continue;
781  for (size_t j = 1; j < 6; j++)
782  mes.at(i)->setBinLabel(j, cut[j - 1], 1);
783  }
784 }
785 
786 //--------------------------------------------------------------------------------------------------
787 void QcdUeDQM::fill2D(std::vector<TH2F *> &hs, double valx, double valy, double w) {
788  // Loop over histograms and fill if trigger has fired.
789 
790  for (size_t i = 0; i < hs.size(); ++i) {
791  if (!hltTrgDeci_.at(i))
792  continue;
793  hs.at(i)->Fill(valx, valy, w);
794  }
795 }
796 
797 //--------------------------------------------------------------------------------------------------
798 void QcdUeDQM::fill2D(std::vector<MonitorElement *> &mes, double valx, double valy, double w) {
799  // Loop over histograms and fill if trigger has fired.
800 
801  for (size_t i = 0; i < mes.size(); ++i) {
802  if (!hltTrgDeci_.at(i))
803  continue;
804  mes.at(i)->Fill(valx, valy, w);
805  }
806 }
807 //--------------------------------------------------------------------------------------------------
808 void QcdUeDQM::fillProfile(std::vector<TProfile *> &hs, double valx, double valy, double w) {
809  // Loop over histograms and fill if trigger has fired.
810 
811  for (size_t i = 0; i < hs.size(); ++i) {
812  if (!hltTrgDeci_.at(i))
813  continue;
814  hs.at(i)->Fill(valx, valy, w);
815  }
816 }
817 
818 //--------------------------------------------------------------------------------------------------
819 void QcdUeDQM::fillProfile(std::vector<MonitorElement *> &mes, double valx, double valy, double w) {
820  // Loop over histograms and fill if trigger has fired.
821 
822  for (size_t i = 0; i < mes.size(); ++i) {
823  if (!hltTrgDeci_.at(i))
824  continue;
825  const double y = valy * w;
826  mes.at(i)->Fill(valx, y);
827  }
828 }
829 
830 //--------------------------------------------------------------------------------------------------
831 bool QcdUeDQM::trackSelection(const reco::Track &trk, const reco::BeamSpot *bs, const reco::Vertex &vtx, int sizevtx) {
832  bool goodTrk = false;
833 
834  if (sizevtx != 1)
835  return false; // selection events with only a vertex
836 
837  // Fill basic information of all the tracks
840 
841  fill1D(
844 
845  fill1D(hRatioPtErrorPt_, (trk.ptError() / trk.pt()));
846  fill1D(hTrkPt_, trk.pt());
847  fill1D(hTrkEta_, trk.eta());
848  fill1D(hTrkPhi_, trk.phi());
849  fill1D(hRatioDxySigmaDxyBS_, (trk.dxy(bs->position()) / trk.dxyError()));
850  fill1D(hRatioDxySigmaDxyPV_, (trk.dxy(vtx.position()) / trk.dxyError()));
851  fill1D(hRatioDzSigmaDzBS_, (trk.dz(bs->position()) / trk.dzError()));
852  fill1D(hRatioDzSigmaDzPV_, (trk.dz(vtx.position()) / trk.dzError()));
854  fill1D(hTrkNdof_, trk.ndof());
855 
856  fill1D(hBeamSpot_x_, bs->x0());
857  fill1D(hBeamSpot_y_, bs->y0());
858  fill1D(hBeamSpot_z_, bs->z0());
859 
860  // number of layers
861  bool layerMinCutbool = (trk.hitPattern().trackerLayersWithMeasurement() >= minHit_ ||
864 
865  // number of pixel layers
866  bool pxlLayerMinCutbool = (trk.hitPattern().pixelLayersWithMeasurement() >= pxlLayerMinCut_);
867 
868  // cut on the hits in pixel layers
869  bool hasPIX1 = false;
870  if (requirePIX1_) {
871  const reco::HitPattern &p = trk.hitPattern();
872  for (int i = 0; i < p.numberOfAllHits(reco::HitPattern::TRACK_HITS); i++) {
875  reco::HitPattern::getLayer(hit) == 1) {
876  hasPIX1 = true;
877  break;
878  }
879  }
880  } else {
881  hasPIX1 = true;
882  }
883 
884  // cut on the pT error
885  bool ptErrorbool =
886  (trk.ptError() / trk.pt() < ptErr_pt_ || (trk.hitPattern().trackerLayersWithMeasurement() == 3 &&
888 
889  // quality cut
890  bool quality_ok = true;
891  if (!quality_.empty()) {
892  quality_ok = false;
893  for (unsigned int i = 0; i < quality_.size(); ++i) {
894  if (trk.quality(quality_[i])) {
895  quality_ok = true;
896  break;
897  }
898  }
899  }
900  //-----
901  bool algo_ok = true;
902  if (!algorithm_.empty()) {
903  if (std::find(algorithm_.begin(), algorithm_.end(), trk.algo()) == algorithm_.end())
904  algo_ok = false;
905  }
906 
907  if (bsuse_ == 1) {
908  if (hasPIX1 && pxlLayerMinCutbool && layerMinCutbool &&
911  ptErrorbool && fabs(trk.pt()) >= ptMin_ && trk.eta() >= minRapidity_ && trk.eta() <= maxRapidity_ &&
912  fabs(trk.dxy(bs->position()) / trk.dxyError()) < tip_ && fabs(trk.dz(bs->position()) / trk.dzError()) < lip_ &&
913  trk.normalizedChi2() <= maxChi2_ && quality_ok && algo_ok) {
914  goodTrk = true;
915  }
916  }
917 
918  if (bsuse_ == 0) {
919  if (hasPIX1 && pxlLayerMinCutbool && layerMinCutbool &&
922  ptErrorbool && fabs(trk.pt()) >= ptMin_ && trk.eta() >= minRapidity_ && trk.eta() <= maxRapidity_ &&
923  fabs(trk.dxy(vtx.position()) / trk.dxyError()) < tip_ && fabs(trk.dz(vtx.position()) / trk.dzError()) < lip_ &&
924  trk.normalizedChi2() <= maxChi2_ && quality_ok && algo_ok) {
925  goodTrk = true;
926  }
927  }
928 
929  return goodTrk;
930 }
931 
932 //--------------------------------------------------------------------------------------------------
934  const reco::VertexCollection theVertices = *(vtxColl.product());
935  bool goodVtx = false;
936  fill1D(hNvertices_, theVertices.size());
937  for (reco::VertexCollection::const_iterator vertexIt = theVertices.begin(); vertexIt != theVertices.end();
938  ++vertexIt) {
939  fill1D(hVertex_z_, vertexIt->z());
940  fill1D(hVertex_y_, vertexIt->y());
941  fill1D(hVertex_x_, vertexIt->x());
942  fill1D(hVertex_ndof_, vertexIt->ndof());
943  fill1D(hVertex_rho_, vertexIt->position().rho());
944  fill1D(hVertex_z_bs_, (vertexIt->z() - bs->z0()));
945 
946  if (fabs(vertexIt->z() - bs->z0()) < diffvtxbs_ && vertexIt->ndof() >= 4 && vertexIt->position().rho() <= 2.0) {
947  goodVtx = true;
948  vtx1 = (*vertexIt);
949 
950  break;
951  }
952  } // Loop over vertcies
953  return goodVtx;
954 }
955 //--------------------------------------------------------------------------------------------------
956 void QcdUeDQM::fillpTMaxRelated(const std::vector<const reco::Track *> &track) {
957  fill1D(hNgoodTrk_, track.size());
958  if (!track.empty()) {
959  fill1D(hLeadingTrack_pTSpectrum_, track[0]->pt());
960  fill1D(hLeadingTrack_phiSpectrum_, track[0]->phi());
961  fill1D(hLeadingTrack_etaSpectrum_, track[0]->eta());
962  }
963  for (size_t i = 0; i < track.size(); i++) {
964  fill1D(hGoodTrkPt500_, track[i]->pt());
965  fill1D(hGoodTrkEta500_, track[i]->eta());
966  fill1D(hGoodTrkPhi500_, track[i]->phi());
967  if (track[i]->pt() > 0.9) {
968  fill1D(hGoodTrkPt900_, track[i]->pt());
969  fill1D(hGoodTrkEta900_, track[i]->eta());
970  fill1D(hGoodTrkPhi900_, track[i]->phi());
971  }
972  }
973 }
974 
976  fill1D(hChargedJetMulti_, trackJets->size());
977  for (reco::TrackJetCollection::const_iterator f = trackJets->begin(); f != trackJets->end(); f++) {
978  if (f != trackJets->begin())
979  continue;
983  }
984 }
985 
986 /*
987 void QcdUeDQM::fillCaloJetSpectra(const edm::Handle<reco::CaloJetCollection>
988 caloJets)
989 {
990  fill1D(hCaloJetMulti_,caloJets->size());
991  for( reco::CaloJetCollection::const_iterator f = caloJets->begin(); f !=
992 caloJets->end(); f++)
993  {
994  if(f != caloJets->begin())continue;
995  fill1D(hLeadingCaloJet_pTSpectrum_,f->pt());
996  fill1D(hLeadingCaloJet_etaSpectrum_,f->eta());
997  fill1D(hLeadingCaloJet_phiSpectrum_,f->phi());
998  }
999 
1000 }
1001 
1002 
1003 */
1004 
1005 /*
1006  weight for transverse/toward/away region = 0.12
1007 
1008 
1009 */
1010 
1011 void QcdUeDQM::fillUE_with_MaxpTtrack(const std::vector<const reco::Track *> &track) {
1012  double w = 0.119;
1013  // double w = 1.;
1014  double nTrk500_TransReg = 0;
1015  double nTrk500_AwayReg = 0;
1016  double nTrk500_TowardReg = 0;
1017 
1018  double pTSum500_TransReg = 0;
1019  double pTSum500_AwayReg = 0;
1020  double pTSum500_TowardReg = 0;
1021 
1022  double nTrk900_TransReg = 0;
1023  double nTrk900_AwayReg = 0;
1024  double nTrk900_TowardReg = 0;
1025 
1026  double pTSum900_TransReg = 0;
1027  double pTSum900_AwayReg = 0;
1028  double pTSum900_TowardReg = 0;
1029  if (!track.empty()) {
1030  if (track[0]->pt() > 1.) {
1031  for (size_t i = 1; i < track.size(); i++) {
1032  double dphi = (180. / PI) * (deltaPhi(track[0]->phi(), track[i]->phi()));
1034  if (fabs(dphi) > 60. && fabs(dphi) < 120.) {
1035  pTSum500_TransReg = pTSum500_TransReg + track[i]->pt();
1036  nTrk500_TransReg++;
1037  if (track[i]->pt() > 0.9) {
1038  pTSum900_TransReg = pTSum900_TransReg + track[i]->pt();
1039  nTrk900_TransReg++;
1040  }
1041  }
1042 
1043  if (fabs(dphi) > 120. && fabs(dphi) < 180.) {
1044  pTSum500_AwayReg = pTSum500_AwayReg + track[i]->pt();
1045  nTrk500_AwayReg++;
1046  if (track[i]->pt() > 0.9) {
1047  pTSum900_AwayReg = pTSum900_AwayReg + track[i]->pt();
1048  nTrk900_AwayReg++;
1049  }
1050  }
1051 
1052  if (fabs(dphi) < 60.) {
1053  pTSum500_TowardReg = pTSum500_TowardReg + track[i]->pt();
1054  nTrk500_TowardReg++;
1055  if (track[i]->pt() > 0.9) {
1056  pTSum900_TowardReg = pTSum900_TowardReg + track[i]->pt();
1057  nTrk900_TowardReg++;
1058  }
1059  }
1060  } // track loop
1061  } // leading track
1062  // non empty collection
1063  fillProfile(hdNdEtadPhi_pTMax_Toward500_, track[0]->pt(), nTrk500_TowardReg, w);
1064  fillProfile(hdNdEtadPhi_pTMax_Transverse500_, track[0]->pt(), nTrk500_TransReg, w);
1065  fillProfile(hdNdEtadPhi_pTMax_Away500_, track[0]->pt(), nTrk500_AwayReg, w);
1066 
1067  fillProfile(hpTSumdEtadPhi_pTMax_Toward500_, track[0]->pt(), pTSum500_TowardReg, w);
1068  fillProfile(hpTSumdEtadPhi_pTMax_Transverse500_, track[0]->pt(), pTSum500_TransReg, w);
1069  fillProfile(hpTSumdEtadPhi_pTMax_Away500_, track[0]->pt(), pTSum500_AwayReg, w);
1070 
1071  fillProfile(hdNdEtadPhi_pTMax_Toward900_, track[0]->pt(), nTrk900_TowardReg, w);
1072  fillProfile(hdNdEtadPhi_pTMax_Transverse900_, track[0]->pt(), nTrk900_TransReg, w);
1073  fillProfile(hdNdEtadPhi_pTMax_Away900_, track[0]->pt(), nTrk900_AwayReg, w);
1074 
1075  fillProfile(hpTSumdEtadPhi_pTMax_Toward900_, track[0]->pt(), pTSum900_TowardReg, w);
1076  fillProfile(hpTSumdEtadPhi_pTMax_Transverse900_, track[0]->pt(), pTSum900_TransReg, w);
1077  fillProfile(hpTSumdEtadPhi_pTMax_Away900_, track[0]->pt(), pTSum900_AwayReg, w);
1078  }
1079 }
1080 
1081 void QcdUeDQM::fillUE_with_ChargedJets(const std::vector<const reco::Track *> &track,
1082  const edm::Handle<reco::TrackJetCollection> &trackJets) {
1083  double w = 0.119;
1084  double nTrk500_TransReg = 0;
1085  double nTrk500_AwayReg = 0;
1086  double nTrk500_TowardReg = 0;
1087 
1088  double pTSum500_TransReg = 0;
1089  double pTSum500_AwayReg = 0;
1090  double pTSum500_TowardReg = 0;
1091 
1092  double nTrk900_TransReg = 0;
1093  double nTrk900_AwayReg = 0;
1094  double nTrk900_TowardReg = 0;
1095 
1096  double pTSum900_TransReg = 0;
1097  double pTSum900_AwayReg = 0;
1098  double pTSum900_TowardReg = 0;
1099 
1100  if (!(trackJets->empty()) && (trackJets->begin())->pt() > 1.) {
1101  double jetPhi = (trackJets->begin())->phi();
1102  for (size_t i = 0; i < track.size(); i++) {
1103  double dphi = (180. / PI) * (deltaPhi(jetPhi, track[i]->phi()));
1105  if (fabs(dphi) > 60. && fabs(dphi) < 120.) {
1106  pTSum500_TransReg = pTSum500_TransReg + track[i]->pt();
1107  nTrk500_TransReg++;
1108  if (track[i]->pt() > 0.9) {
1109  pTSum900_TransReg = pTSum900_TransReg + track[i]->pt();
1110  nTrk900_TransReg++;
1111  }
1112  }
1113 
1114  if (fabs(dphi) > 120. && fabs(dphi) < 180.) {
1115  pTSum500_AwayReg = pTSum500_AwayReg + track[i]->pt();
1116  nTrk500_AwayReg++;
1117  if (track[i]->pt() > 0.9) {
1118  pTSum900_AwayReg = pTSum900_AwayReg + track[i]->pt();
1119  nTrk900_AwayReg++;
1120  }
1121  }
1122  if (fabs(dphi) < 60.) {
1123  pTSum500_TowardReg = pTSum500_TowardReg + track[i]->pt();
1124  nTrk500_TowardReg++;
1125  if (track[i]->pt() > 0.9) {
1126  pTSum900_TowardReg = pTSum900_TowardReg + track[i]->pt();
1127  nTrk900_TowardReg++;
1128  }
1129  }
1130  } // tracks loop
1131 
1132  } // leading track jet
1133 
1134  fillProfile(hdNdEtadPhi_trackJet_Toward500_, (trackJets->begin())->pt(), nTrk500_TowardReg, w);
1135  fillProfile(hdNdEtadPhi_trackJet_Transverse500_, (trackJets->begin())->pt(), nTrk500_TransReg, w);
1136  fillProfile(hdNdEtadPhi_trackJet_Away500_, (trackJets->begin())->pt(), nTrk500_AwayReg, w);
1137 
1138  fillProfile(hpTSumdEtadPhi_trackJet_Toward500_, (trackJets->begin())->pt(), pTSum500_TowardReg, w);
1139  fillProfile(hpTSumdEtadPhi_trackJet_Transverse500_, (trackJets->begin())->pt(), pTSum500_TransReg, w);
1140  fillProfile(hpTSumdEtadPhi_trackJet_Away500_, (trackJets->begin())->pt(), pTSum500_AwayReg, w);
1141 
1142  fillProfile(hdNdEtadPhi_trackJet_Toward900_, (trackJets->begin())->pt(), nTrk900_TowardReg, w);
1143  fillProfile(hdNdEtadPhi_trackJet_Transverse900_, (trackJets->begin())->pt(), nTrk900_TransReg, w);
1144  fillProfile(hdNdEtadPhi_trackJet_Away900_, (trackJets->begin())->pt(), nTrk900_AwayReg, w);
1145 
1146  fillProfile(hpTSumdEtadPhi_trackJet_Toward900_, (trackJets->begin())->pt(), pTSum900_TowardReg, w);
1147  fillProfile(hpTSumdEtadPhi_trackJet_Transverse900_, (trackJets->begin())->pt(), pTSum900_TransReg, w);
1148  fillProfile(hpTSumdEtadPhi_trackJet_Away900_, (trackJets->begin())->pt(), pTSum900_AwayReg, w);
1149 }
1150 
1151 /*
1152 void QcdUeDQM:: fillUE_with_CaloJets(const std::vector<const reco::Track *>
1153 &track, const edm::Handle<reco::CaloJetCollection> &caloJets)
1154 {
1155 double w = 0.119;
1156 double nTrk500_TransReg = 0;
1157 double nTrk500_AwayReg = 0;
1158 double nTrk500_TowardReg = 0;
1159 
1160 double pTSum500_TransReg = 0;
1161 double pTSum500_AwayReg = 0;
1162 double pTSum500_TowardReg = 0;
1163 
1164 double nTrk900_TransReg = 0;
1165 double nTrk900_AwayReg = 0;
1166 double nTrk900_TowardReg = 0;
1167 
1168 double pTSum900_TransReg = 0;
1169 double pTSum900_AwayReg = 0;
1170 double pTSum900_TowardReg = 0;
1171  if(!(caloJets->empty()) && (caloJets->begin())->pt() > 1.)
1172  {
1173  double jetPhi = (caloJets->begin())->phi();
1174  for(size_t i = 0; i < track.size();i++)
1175  {
1176  double dphi =
1177 (180./PI)*(deltaPhi(jetPhi,track[i]->phi()));
1178  fill1D(hdPhi_caloJet_tracks_,dphi);
1179  if(fabs(dphi)>60. && fabs(dphi)<120.)
1180  {
1181  pTSum500_TransReg = pTSum500_TransReg +
1182 track[i]->pt();
1183  nTrk500_TransReg++;
1184  if(track[i]->pt() > 0.9)
1185  {
1186  pTSum900_TransReg = pTSum900_TransReg +
1187 track[i]->pt();
1188  nTrk900_TransReg++;
1189  }
1190  }
1191  if(fabs(dphi)>120. && fabs(dphi)<180.)
1192  {
1193  pTSum500_AwayReg = pTSum500_AwayReg +
1194 track[i]->pt();
1195  nTrk500_AwayReg++;
1196  if(track[i]->pt() > 0.9)
1197  {
1198  pTSum900_AwayReg = pTSum900_AwayReg +
1199 track[i]->pt();
1200  nTrk900_AwayReg++;
1201  }
1202  }
1203  if(fabs(dphi)<60.)
1204  {
1205  pTSum500_TowardReg = pTSum500_TowardReg +
1206 track[i]->pt();
1207  nTrk500_TowardReg++;
1208  if(track[i]->pt() > 0.9)
1209  {
1210  pTSum900_TowardReg = pTSum900_TowardReg +
1211 track[i]->pt();
1212  nTrk900_TowardReg++;
1213  }
1214  }
1215  }// tracks loop
1216 
1217  }// leading calo jet
1218  fillProfile(hdNdEtadPhi_caloJet_Toward500_,
1219 (caloJets->begin())->pt(),nTrk500_TowardReg,w);
1220  fillProfile(hdNdEtadPhi_caloJet_Transverse500_,
1221 (caloJets->begin())->pt(),nTrk500_TransReg,w);
1222  fillProfile(hdNdEtadPhi_caloJet_Away500_,
1223 (caloJets->begin())->pt(),nTrk500_AwayReg,w);
1224 
1225  fillProfile(hpTSumdEtadPhi_caloJet_Toward500_,
1226 (caloJets->begin())->pt(),pTSum500_TowardReg,w);
1227  fillProfile(hpTSumdEtadPhi_caloJet_Transverse500_,
1228 (caloJets->begin())->pt(),pTSum500_TransReg,w);
1229  fillProfile(hpTSumdEtadPhi_caloJet_Away500_,
1230 (caloJets->begin())->pt(),pTSum500_AwayReg,w);
1231 
1232  fillProfile(hdNdEtadPhi_caloJet_Toward900_,
1233 (caloJets->begin())->pt(),nTrk900_TowardReg,w);
1234  fillProfile(hdNdEtadPhi_caloJet_Transverse900_,
1235 (caloJets->begin())->pt(),nTrk900_TransReg,w);
1236  fillProfile(hdNdEtadPhi_caloJet_Away900_,
1237 (caloJets->begin())->pt(),nTrk900_AwayReg,w);
1238 
1239  fillProfile(hpTSumdEtadPhi_caloJet_Toward900_,
1240 (caloJets->begin())->pt(),pTSum900_TowardReg,w);
1241  fillProfile(hpTSumdEtadPhi_caloJet_Transverse900_,
1242 (caloJets->begin())->pt(),pTSum900_TransReg,w);
1243  fillProfile(hpTSumdEtadPhi_caloJet_Away900_,
1244 (caloJets->begin())->pt(),pTSum900_AwayReg,w);
1245 
1246 
1247 }
1248 
1249 */
1250 void QcdUeDQM::fillHltBits(const Event &iEvent, const EventSetup &iSetup) {
1251  // Fill HLT trigger bits.
1252 
1253  Handle<TriggerResults> triggerResultsHLT;
1254  getProduct(hltUsedResName_, triggerResultsHLT, iEvent);
1255 
1256  /* const unsigned int ntrigs(triggerResultsHLT.product()->size());
1257  if( ntrigs != 0 ) {
1258  const edm::TriggerNames & triggerNames =
1259  iEvent.triggerNames(*triggerResultsHLT);
1260  for (unsigned int j=0; j!=ntrigs; j++) {
1261  // if(triggerResultsHLT->accept(j)){
1262  // unsigned int hlt_prescale = hltConfig_.prescaleValue(iEvent, iSetup,
1263  triggerName);
1264  cout<<"trigger fired"<<triggerNames.triggerName(j)<<endl;
1265  for(unsigned int itrigName = 0; itrigName < hltTrgNames_.size();
1266  itrigName++ ) {
1267  unsigned int hlt_prescale = hltConfig.prescaleValue(iEvent, iSetup,
1268  hltTrgNames_[itrigName]);
1269 
1270  if(triggerNames.triggerIndex(hltTrgNames_[itrigName]) >= (unsigned
1271  int)ntrigs ) continue;
1272  // if(
1273  triggerResultsHLT->accept(triggerNames.triggerIndex(hltTrgNames_[itrigName]))
1274  )cout<<hltTrgNames_[itrigName]<<endl;
1275 
1276  }
1277  }
1278  }
1279  // }
1280  */
1281  for (size_t i = 0; i < hltTrgBits_.size(); ++i) {
1282  if (hltTrgBits_.at(i) < 0)
1283  continue; // ignore unknown trigger
1284  size_t tbit = hltTrgBits_.at(i);
1285  if (tbit < triggerResultsHLT->size()) {
1286  hltTrgDeci_[i] = triggerResultsHLT->accept(tbit);
1287  }
1288  }
1289  // fill correlation histogram
1290  for (size_t i = 0; i < hltTrgBits_.size(); ++i) {
1291  if (hltTrgDeci_.at(i))
1292  h2TrigCorr_->Fill(i, i);
1293  for (size_t j = i + 1; j < hltTrgBits_.size(); ++j) {
1294  if (hltTrgDeci_.at(i) && hltTrgDeci_.at(j))
1295  h2TrigCorr_->Fill(i, j);
1296  if (hltTrgDeci_.at(i) && !hltTrgDeci_.at(j))
1297  h2TrigCorr_->Fill(j, i);
1298  }
1299  }
1300 }
unsigned int size() const
number of trigger paths in trigger table
bool bsuse_
Definition: QcdUeDQM.h:388
std::vector< MonitorElement * > hdNdEtadPhi_trackJet_Toward900_
Definition: QcdUeDQM.h:312
double z0() const
z coordinate
Definition: BeamSpot.h:65
T getUntrackedParameter(std::string const &, T const &) const
static uint32_t getLayer(uint16_t pattern)
Definition: HitPattern.h:721
void getProduct(const std::string name, edm::Handle< TYPE > &prod, const edm::Event &event) const
Definition: QcdUeDQM.h:405
static bool pixelHitFilter(uint16_t pattern)
Definition: HitPattern.h:581
std::vector< MonitorElement * > hpTSumdEtadPhi_trackJet_Transverse900_
Definition: QcdUeDQM.h:363
void fillHltBits(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Definition: QcdUeDQM.cc:1250
const std::string & triggerName(unsigned int triggerIndex) const
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
void fill1D(std::vector< TH1F * > &hs, double val, double w=1.)
Definition: QcdUeDQM.cc:753
bool trackSelection(const reco::Track &trk, const reco::BeamSpot *bs, const reco::Vertex &vtx, int sizevtx)
Definition: QcdUeDQM.cc:831
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:593
std::vector< MonitorElement * > hTrkNdof_
Definition: QcdUeDQM.h:143
std::vector< MonitorElement * > hGoodTrkPhi500_
Definition: QcdUeDQM.h:134
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::vector< MonitorElement * > hdNdEtadPhi_pTMax_Transverse500_
Definition: QcdUeDQM.h:207
std::vector< MonitorElement * > hpTSumdEtadPhi_pTMax_Away900_
Definition: QcdUeDQM.h:339
std::vector< MonitorElement * > hLeadingChargedJet_phiSpectrum_
Definition: QcdUeDQM.h:196
double dxyError() const
error on dxy
Definition: TrackBase.h:769
std::vector< MonitorElement * > hTrkChi2_
Definition: QcdUeDQM.h:142
std::vector< MonitorElement * > hVertex_z_bs_
Definition: QcdUeDQM.h:151
std::vector< MonitorElement * > hGoodTrkEta900_
Definition: QcdUeDQM.h:136
std::vector< MonitorElement * > hGoodTrkPt900_
Definition: QcdUeDQM.h:135
std::string hltUsedResName_
Definition: QcdUeDQM.h:116
std::vector< MonitorElement * > hpTSumdEtadPhi_trackJet_Away500_
Definition: QcdUeDQM.h:279
std::vector< MonitorElement * > hpTSumdEtadPhi_trackJet_Away900_
Definition: QcdUeDQM.h:366
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
bool exists(std::string const &parameterName) const
checks if a parameter exists
void bookProfile(DQMStore::IBooker &, std::vector< MonitorElement * > &mes, const std::string &name, const std::string &title, int nx, double x1, double x2, double y1, double y2, bool sumw2=true, bool sbox=true)
Definition: QcdUeDQM.cc:725
std::vector< std::string > hltTrgUsedNames_
Definition: QcdUeDQM.h:115
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
std::vector< MonitorElement * > hTrkEta_
Definition: QcdUeDQM.h:129
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< MonitorElement * > hdNdEtadPhi_trackJet_Away500_
Definition: QcdUeDQM.h:235
edm::EDGetTokenT< reco::TrackCollection > trackLabel_
Definition: QcdUeDQM.h:393
std::vector< MonitorElement * > hpTSumdEtadPhi_pTMax_Transverse500_
Definition: QcdUeDQM.h:249
bool fillVtxPlots(const reco::BeamSpot *bs, const edm::Handle< reco::VertexCollection > vtxColl)
Definition: QcdUeDQM.cc:933
auto const & tracks
cannot be loose
edm::EDGetTokenT< reco::CaloJetCollection > caloJetLabel_
Definition: QcdUeDQM.h:391
void fillProfile(std::vector< TProfile * > &hs, double valx, double valy, double w=1.)
Definition: QcdUeDQM.cc:808
string quality
void fillUE_with_ChargedJets(const std::vector< const reco::Track * > &track, const edm::Handle< reco::TrackJetCollection > &trackJets)
Definition: QcdUeDQM.cc:1081
double ptErr_pt_
Definition: QcdUeDQM.h:381
std::vector< MonitorElement * > hLeadingChargedJet_etaSpectrum_
Definition: QcdUeDQM.h:192
std::vector< MonitorElement * > hdNdEtadPhi_pTMax_Away900_
Definition: QcdUeDQM.h:301
void setLabel1D(std::vector< MonitorElement * > &mes)
Definition: QcdUeDQM.cc:775
std::vector< MonitorElement * > hLeadingTrack_etaSpectrum_
Definition: QcdUeDQM.h:159
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:513
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< Vertex > VertexCollection
Definition: Vertex.h:12
void operator()(TH3F *&h)
Definition: QcdUeDQM.cc:45
bool requirePIX1_
Definition: QcdUeDQM.h:385
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:534
const Point & position() const
position
Definition: Vertex.h:127
std::vector< MonitorElement * > hLeadingChargedJet_pTSpectrum_
Definition: QcdUeDQM.h:168
std::vector< MonitorElement * > hGoodTrkPhi900_
Definition: QcdUeDQM.h:137
bool isHltConfigSuccessful_
Definition: QcdUeDQM.h:62
void fillUE_with_MaxpTtrack(const std::vector< const reco::Track * > &track)
Definition: QcdUeDQM.cc:1011
std::vector< std::string > hltTrgNames_
Definition: QcdUeDQM.h:111
edm::EDGetTokenT< reco::TrackJetCollection > chargedJetLabel_
Definition: QcdUeDQM.h:392
std::vector< MonitorElement * > hpTSumdEtadPhi_trackJet_Toward500_
Definition: QcdUeDQM.h:265
static bool validHitFilter(uint16_t pattern)
Definition: HitPattern.h:796
TrackAlgorithm algo() const
Definition: TrackBase.h:547
void Fill(long long x)
std::vector< MonitorElement * > hVertex_ndof_
Definition: QcdUeDQM.h:149
ptMin_(conf.getParameter< double >("ptMin"))
std::vector< MonitorElement * > hVertex_rho_
Definition: QcdUeDQM.h:150
int iEvent
Definition: GenABIO.cc:224
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
Definition: HitPattern.cc:369
std::vector< MonitorElement * > hNtrackerLayer_
Definition: QcdUeDQM.h:124
std::vector< MonitorElement * > hRatioDzSigmaDzBS_
Definition: QcdUeDQM.h:140
std::vector< std::string > hltProcNames_
Definition: QcdUeDQM.h:110
std::string hltResName_
Definition: QcdUeDQM.h:109
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
MonitorElement * h2TrigCorr_
Definition: QcdUeDQM.h:121
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:590
std::vector< MonitorElement * > hVertex_y_
Definition: QcdUeDQM.h:147
double pt() const
track transverse momentum
Definition: TrackBase.h:637
std::vector< MonitorElement * > hpTSumdEtadPhi_pTMax_Toward500_
Definition: QcdUeDQM.h:242
double maxChi2_
Definition: QcdUeDQM.h:387
std::vector< int > hltTrgBits_
Definition: QcdUeDQM.h:113
std::vector< MonitorElement * > hpTSumdEtadPhi_trackJet_Toward900_
Definition: QcdUeDQM.h:352
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:754
int numberOfAllHits(HitCategory category) const
Definition: HitPattern.h:804
HLTConfigProvider hltConfig
Definition: QcdUeDQM.h:107
std::vector< MonitorElement * > hdNdEtadPhi_trackJet_Away900_
Definition: QcdUeDQM.h:322
double lip_
Definition: QcdUeDQM.h:379
reco::Vertex vtx1
Definition: QcdUeDQM.h:400
std::vector< MonitorElement * > hVertex_x_
Definition: QcdUeDQM.h:148
std::vector< MonitorElement * > hLeadingTrack_phiSpectrum_
Definition: QcdUeDQM.h:161
std::vector< MonitorElement * > hChargedJetMulti_
Definition: QcdUeDQM.h:164
std::vector< reco::TrackBase::TrackAlgorithm > algorithm_
Definition: QcdUeDQM.h:397
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)
std::vector< MonitorElement * > hpTSumdEtadPhi_pTMax_Toward900_
Definition: QcdUeDQM.h:329
#define PI
Definition: QcdUeDQM.h:37
std::vector< MonitorElement * > hdNdEtadPhi_trackJet_Transverse900_
Definition: QcdUeDQM.h:319
std::vector< MonitorElement * > hdNdEtadPhi_pTMax_Transverse900_
Definition: QcdUeDQM.h:294
std::vector< MonitorElement * > hGoodTrkPt500_
Definition: QcdUeDQM.h:132
std::vector< MonitorElement * > hdNdEtadPhi_pTMax_Toward500_
Definition: QcdUeDQM.h:201
std::vector< MonitorElement * > hTrkPhi_
Definition: QcdUeDQM.h:130
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:622
double dzError() const
error on dz
Definition: TrackBase.h:778
std::vector< MonitorElement * > hdNdEtadPhi_pTMax_Toward900_
Definition: QcdUeDQM.h:288
std::vector< MonitorElement * > hdPhi_maxpTTrack_tracks_
Definition: QcdUeDQM.h:183
edm::EDGetTokenT< reco::BeamSpot > bsLabel_
Definition: QcdUeDQM.h:395
std::vector< MonitorElement * > hdNdEtadPhi_trackJet_Toward500_
Definition: QcdUeDQM.h:225
edm::EDGetTokenT< reco::VertexCollection > vtxLabel_
Definition: QcdUeDQM.h:394
std::vector< MonitorElement * > hNvertices_
Definition: QcdUeDQM.h:145
std::vector< MonitorElement * > hdNdEtadPhi_pTMax_Away500_
Definition: QcdUeDQM.h:214
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
std::vector< MonitorElement * > hpTSumdEtadPhi_trackJet_Transverse500_
Definition: QcdUeDQM.h:276
bool allowTriplets_
Definition: QcdUeDQM.h:389
std::vector< MonitorElement * > hNgoodTrk_
Definition: QcdUeDQM.h:131
double ptMin_
Definition: QcdUeDQM.h:375
T const * product() const
Definition: Handle.h:70
std::vector< MonitorElement * > hpTSumdEtadPhi_pTMax_Away500_
Definition: QcdUeDQM.h:252
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:504
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::vector< MonitorElement * > hBeamSpot_y_
Definition: QcdUeDQM.h:154
double diffvtxbs_
Definition: QcdUeDQM.h:380
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
double minRapidity_
Definition: QcdUeDQM.h:376
std::vector< MonitorElement * > hLeadingTrack_pTSpectrum_
Definition: QcdUeDQM.h:157
int min3DHit_
Definition: QcdUeDQM.h:386
std::vector< MonitorElement * > hRatioDxySigmaDxyBS_
Definition: QcdUeDQM.h:138
container selected_
Definition: QcdUeDQM.h:399
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:552
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: QcdUeDQM.cc:163
std::vector< MonitorElement * > hRatioDxySigmaDxyPV_
Definition: QcdUeDQM.h:139
std::vector< MonitorElement * > hdPhi_chargedJet_tracks_
Definition: QcdUeDQM.h:188
std::vector< MonitorElement * > hNtrackerStripPixelLayer_
Definition: QcdUeDQM.h:126
double pxlLayerMinCut_
Definition: QcdUeDQM.h:384
std::vector< MonitorElement * > hNevts_
Definition: QcdUeDQM.h:123
std::vector< TrackJet > TrackJetCollection
collection of TrackJet objects
QcdUeDQM(const edm::ParameterSet &parameters)
Definition: QcdUeDQM.cc:51
~QcdUeDQM() override
Definition: QcdUeDQM.cc:101
std::vector< MonitorElement * > hBeamSpot_x_
Definition: QcdUeDQM.h:155
static TrackAlgorithm algoByName(const std::string &name)
Definition: TrackBase.cc:137
double y0() const
y coordinate
Definition: BeamSpot.h:63
void book1D(DQMStore::IBooker &, std::vector< MonitorElement * > &mes, const std::string &name, const std::string &title, int nx, double x1, double x2, bool sumw2=true, bool sbox=true)
Definition: QcdUeDQM.cc:695
tuple cout
Definition: gather_cfg.py:144
const Point & position() const
position
Definition: BeamSpot.h:59
std::vector< MonitorElement * > hTrkPt_
Definition: QcdUeDQM.h:128
std::vector< MonitorElement * > hGoodTrkEta500_
Definition: QcdUeDQM.h:133
void fillChargedJetSpectra(const edm::Handle< reco::TrackJetCollection > trackJets)
Definition: QcdUeDQM.cc:975
T w() const
std::vector< reco::TrackBase::TrackQuality > quality_
Definition: QcdUeDQM.h:396
std::vector< MonitorElement * > hdNdEtadPhi_trackJet_Transverse500_
Definition: QcdUeDQM.h:232
void fillpTMaxRelated(const std::vector< const reco::Track * > &track)
Definition: QcdUeDQM.cc:956
double maxRapidity_
Definition: QcdUeDQM.h:377
void fill2D(std::vector< TH2F * > &hs, double valx, double valy, double w=1.)
Definition: QcdUeDQM.cc:787
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:537
std::vector< MonitorElement * > hVertex_z_
Definition: QcdUeDQM.h:146
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::vector< MonitorElement * > hRatioDzSigmaDzPV_
Definition: QcdUeDQM.h:141
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:608
#define CP(level)
Definition: QcdUeDQM.cc:42
int minHit_
Definition: QcdUeDQM.h:383
std::vector< MonitorElement * > hRatioPtErrorPt_
Definition: QcdUeDQM.h:127
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: QcdUeDQM.cc:635
tuple size
Write out results.
std::vector< MonitorElement * > hNtrackerPixelLayer_
Definition: QcdUeDQM.h:125
std::vector< MonitorElement * > hBeamSpot_z_
Definition: QcdUeDQM.h:153
Definition: Run.h:45
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: QcdUeDQM.cc:105
double tip_
Definition: QcdUeDQM.h:378
std::vector< MonitorElement * > hpTSumdEtadPhi_pTMax_Transverse900_
Definition: QcdUeDQM.h:336
double x0() const
x coordinate
Definition: BeamSpot.h:61
std::vector< bool > hltTrgDeci_
Definition: QcdUeDQM.h:114