CMS 3D CMS Logo

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