CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTJetMETDQMSource.cc
Go to the documentation of this file.
1 
2 #include "TMath.h"
8 
11 
18 
20 
23 #include <cmath>
24 #include "TH1F.h"
25 #include "TProfile.h"
26 #include "TH2F.h"
27 #include "TPRegexp.h"
28 
29 using namespace edm;
30 using namespace std;
31 
32 
34  resetMe_(true),
35  currentRun_(-99) {
36  LogDebug("HLTJetMETDQMSource") << "constructor....";
37 
39  if ( ! dbe_ ) {
40  LogDebug("HLTJetMETDQMSource") << "unabel to get DQMStore service?";
41  }
42  if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
43  dbe_->setVerbose(0);
44  }
45 
46  dirname_ = iConfig.getUntrackedParameter("dirname",
47  std::string("HLT/JetMET/"));
48  //dirname_ += iConfig.getParameter<std::string>("@module_label");
49 
50  if (dbe_ != 0 ) {
52  }
53  //hltconfigchanged=false;
54 
55  processname_ = iConfig.getParameter<std::string>("processname");
56  //HLTPathNamesConfigPreVal_= iConfig.getParameter<std::vector<std::string > >("HLTPaths"),
57  verbose_ = iConfig.getUntrackedParameter< bool >("verbose", false);
58  // plotting paramters
59  ptMin_ = iConfig.getUntrackedParameter<double>("ptMin",0.);
60  ptMax_ = iConfig.getUntrackedParameter<double>("ptMax",1000.);
61  nBins_ = iConfig.getUntrackedParameter<unsigned int>("Nbins",50);
62 
63  plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", false);
64  plotwrtMu_ = iConfig.getUntrackedParameter<bool>("plotwrtMu", false);
65  plotEff_ = iConfig.getUntrackedParameter<bool>("plotEff", false);
66  // this is the list of paths to look at.
67  std::vector<edm::ParameterSet> paths = iConfig.getParameter<std::vector<edm::ParameterSet> >("paths");
68 
69 
70  for(std::vector<edm::ParameterSet>::iterator pathconf = paths.begin() ; pathconf != paths.end(); pathconf++) {
71  std::pair<std::string, std::string> custompathnamepair;
72  int prescaleused;
73  custompathnamepair.first =pathconf->getParameter<std::string>("pathname");
74  custompathnamepair.second = pathconf->getParameter<std::string>("denompathname");
75  custompathnamepairs_.push_back(custompathnamepair);
76  //prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
77  prescaleused = pathconf->getParameter<int>("prescaleused");
78  prescUsed_.push_back(prescaleused);
79  // customdenompathnames_.push_back(pathconf->getParameter<std::string>("denompathname"));
80  // custompathnames_.push_back(pathconf->getParameter<std::string>("pathname"));
81  }
82 
83  custompathnamemu_ = iConfig.getUntrackedParameter("pathnameMuon",
84  std::string("HLT_L1Mu"));
85 
86  triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
87  triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
88 
89  muonEtaMax_ = iConfig.getUntrackedParameter<double>("muonEtaMax",2.5);
90  muonEtMin_ = iConfig.getUntrackedParameter<double>("muonEtMin",0.0);
91  muonDRMatch_ =iConfig.getUntrackedParameter<double>("muonDRMatch",0.3);
92 
93  jetEtaMax_ = iConfig.getUntrackedParameter<double>("jetEtaMax",5.0);
94  jetEtMin_ = iConfig.getUntrackedParameter<double>("jetEtMin",0.0);
95  jetDRMatch_ =iConfig.getUntrackedParameter<double>("jetDRMatch",0.3);
96 
97  metMin_ = iConfig.getUntrackedParameter<double>("metMin",0.0);
98  htMin_ = iConfig.getUntrackedParameter<double>("htMin",0.0);
99  sumEtMin_ = iConfig.getUntrackedParameter<double>("sumEtMin",0.0);
100 
101  //set Token(-s)
102  triggerResultsToken_ = consumes<edm::TriggerResults>(iConfig.getParameter<edm::InputTag>("triggerResultsLabel"));
103  edm::InputTag triggerResultsLabelFU(triggerResultsLabel_.label(),triggerResultsLabel_.instance(), "FU");
104  triggerResultsTokenFU_ = consumes<edm::TriggerResults>(triggerResultsLabelFU);
105  triggerSummaryToken_ = consumes<trigger::TriggerEvent>(iConfig.getParameter<edm::InputTag>("triggerSummaryLabel"));
106  edm::InputTag triggerSummaryLabelFU(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(), "FU");
107  triggerSummaryTokenFU_ = consumes<trigger::TriggerEvent>(triggerSummaryLabelFU);
108 }
109 
110 
112 
113 
114  //
115  // do anything here that needs to be done at desctruction time
116  // (e.g. close files, deallocate resources etc.)
117 
118 }
119 
120 
121 void
123  using namespace edm;
124  using namespace trigger;
125 
126  ++nev_;
127  if (verbose_) std::cout << " --------------- N Event ------------" << nev_ << std::endl; // LogDebug("HLTJetMETDQMSource")<< "HLTJetMETDQMSource: analyze...." ;
128 
129 
130 
131 
132  //currun=iEvent.id().run();
133  //if ( nev_==1) runno = iEvent.id().run();
134  /*
135  bool changed(true);
136  if (hltConfig_.init(iEvent,processname_,changed)) {
137  if (changed) {
138  hltconfigchanged=true;
139  //if(verbose_)
140  //hltConfig_.dump("Triggers");
141  LogWarning("HLTJetMETDQMSource") << "HLTJetMETDQMSource:analyze: The number of valid triggers has changed since beginning of job." << std::endl;
142  // << "Processing of events halted for summary histograms" << std::endl;
143  //<< "Summary histograms do not support changing configurations." << std::endl
144 
145  }
146  }
147 
148  if ( hltConfig_.size() <= 0 ) {
149  LogError("HLTJetMETDQMSource") << "HLT config size error" << std::endl;
150  return;
151  }
152  // if ( currun != runno) runchanged=true;
153  */
154 
155 
158  if(!triggerResults.isValid()) {
160  if(!triggerResults.isValid()) {
161  LogWarning("HLTJetMETDQMSource") << "TriggerResults not found, skipping event" << std::endl;
162  return;
163  }
164  }
165  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
166  unsigned int npath = triggerResults->size();
167 
168  edm::Handle<TriggerEvent> triggerObj;
169  iEvent.getByToken(triggerSummaryToken_, triggerObj);
170  if(!triggerObj.isValid()) {
171  iEvent.getByToken(triggerSummaryTokenFU_, triggerObj);
172  if(!triggerObj.isValid()) {
173  LogWarning("HLTJetMETDQMSource") << "TriggerEvent not found, skipping event" << std::endl;
174  return;
175  }
176  }
177  //----plot all the ditributions for JET and MET -----------------------
178 
179 
180  const trigger::TriggerObjectCollection & toc(triggerObj->getObjects());
181 
182 
183  int testint=0;
184  if (plotAll_) testint=1;
185  if (verbose_) std::cout << " plots all " << testint << std::endl;
186  if (plotAll_) {
187  if (verbose_) std::cout << " Look at basic distributions " << std::endl;
188 
189  int N =-1;
190  int NL1=-1;
191 
192 
193  for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
194  NL1++;
195  N++;
196 
197  int triggertype = 0;
198  triggertype = v->getObjectType();
199 
200  bool l1accept = false;
201  edm::InputTag l1testTag(v->getl1Path(),"",processname_);
202  const int l1index = triggerObj->filterIndex(l1testTag);
203  if ( l1index >= triggerObj->sizeFilters() ) {
204  if (verbose_) std::cout<< "no index "<< l1index << " of that name "
205  << v->getl1Path() << "\t" << "\t" << l1testTag << std::endl;
206  continue;
207  }
208 
209  const trigger::Vids & idtype = triggerObj->filterIds(l1index);
210  const trigger::Keys & l1k = triggerObj->filterKeys(l1index);
211  //if (verbose_) std::cout << "filterID "<< idtype << " keys " << l1k << std::endl;
212  //if (verbose_) std::cout << " keys " << l1k << std::endl;
213  l1accept = l1k.size() > 0;
214  //if (l1accept)
215  //l1accept = true ;
216 
217  //
218  //-----------------------------------------------------
219 
220  bool passed = false;
221  for(unsigned int i = 0; i < npath; ++i) {
222  if ( triggerNames.triggerName(i).find(v->getPath()) != std::string::npos
223  && triggerResults->accept(i)){
224  passed = true;
225  if (verbose_) std::cout << " i " << i << " trigger name " << v->getPath() << std::endl;
226  break;
227  }
228  }
229  if(passed){
230 
231  //if(!hltconfigchanged)
232  //fill later//rate_All->Fill(N);
233 
234  if (verbose_) std::cout << " N " << N << " trigger name " << v->getPath() << std::endl;
235 
236  if (!l1accept) {
237  edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "
238  << v->getPath() << "\t" << v->getl1Path();
239  }
240  edm::InputTag filterTag = v->getTag();
241 
242  //const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
243 
244  if (v->getLabel() == "dummy"){
245  const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
246  //loop over labels
247 
248  for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin();
249  labelIter!=filterLabels.end(); labelIter++) {
250  edm::InputTag testTag(*labelIter,"",processname_);
251  if (verbose_) std::cout << v->getPath() << "\t" << testTag.label() << "\t"
252  << testTag.process() << std::endl;
253  int testindex = triggerObj->filterIndex(testTag);
254 
255  if ( !(testindex >= triggerObj->sizeFilters()) ) {
256  if (verbose_) std::cout << "found one! " << v->getPath() << "\t"
257  << testTag.label() << std::endl;
258  filterTag = testTag;
259  v->setLabel(*labelIter);
260  }
261  }
262  }
263  const int index = triggerObj->filterIndex(filterTag);
264  if (verbose_) std::cout << "filter index "<< index << " of that name "
265  << filterTag << std::endl;
266  if ( index >= triggerObj->sizeFilters() ) {
267  if (verbose_) std::cout << "WTF no index "<< index << " of that name "
268  << filterTag << std::endl;
269  continue; //
270  }
271  const trigger::Keys & k = triggerObj->filterKeys(index);
272 
273  for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
274  if (verbose_) cout << " filling HLT " << v->getPath() << "\t" << toc[*ki].pt()
275  << "\t" << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
276  if ( triggertype == trigger::TriggerJet
277  || triggertype == trigger::TriggerL1TauJet
278  || triggertype == trigger::TriggerL1CenJet
279  || triggertype == trigger::TriggerL1ForJet)
280  {
281  if (verbose_) cout << " filling HLT " << v->getPath() << "\t"
282  << " *ki " << *ki << " Nki "<< N<< " "
283  << toc[*ki].pt() << "\t" << toc[*ki].eta() << "\t"
284  << toc[*ki].phi() << std::endl;
285 
286  v->getEtHisto()->Fill(toc[*ki].pt());
287  v->getEtaHisto()->Fill(toc[*ki].eta());
288  v->getPhiHisto()->Fill(toc[*ki].phi());
289  v->getEtaPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
290 
291  //---L1 Histograms
292  trigger::Vids::const_iterator idtypeiter = idtype.begin();
293  for (trigger::Keys::const_iterator l1ki = l1k.begin();
294  l1ki !=l1k.end(); ++l1ki ) {
295  if (*idtypeiter == trigger::TriggerL1TauJet
296  || *idtypeiter == trigger::TriggerL1ForJet
297  || *idtypeiter == trigger::TriggerL1CenJet)
298  {
299  if (verbose_) cout << " filling L1 HLT " << v->getPath()
300  << "\t" << " *l1ki " << *l1ki << " NL1 "
301  << NL1<< " " << toc[*l1ki].pt() << "\t"
302  << toc[*l1ki].eta() << "\t" << toc[*l1ki].phi()
303  << std::endl;
304  if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3){
305  //if(!hltconfigchanged)
306  //fill later//rate_All_L1->Fill(NL1);
307 
308  v->getL1EtHisto()->Fill(toc[*l1ki].pt());
309  v->getL1PhiHisto()->Fill(toc[*l1ki].phi());
310  v->getL1EtaHisto()->Fill(toc[*l1ki].eta());
311  v->getL1EtaPhiHisto()->Fill(toc[*l1ki].eta(),toc[*l1ki].phi());
312  }
313 
314 
315  }
316  ++idtypeiter;
317  }//end L1
318 
319  }
320 
321  //----------------------------
322  else if (triggertype == trigger::TriggerMuon
323  ||triggertype == trigger::TriggerL1Mu )
324  {
325  if (verbose_) cout << " filling HLT " << v->getPath() << "\t" << " *ki "
326  << *ki << " Nki "<< N << " " << toc[*ki].pt()
327  << "\t" << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
328 
329  v->getEtHisto()->Fill(toc[*ki].pt());
330  //v->getEtaHisto()->Fill(toc[*ki].eta());
331  //v->getPhiHisto()->Fill(toc[*ki].phi());
332  v->getEtaPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
333 
334  //---L1 Histograms
335  trigger::Vids::const_iterator idtypeiter = idtype.begin();
336  for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
337  if (*idtypeiter == trigger::TriggerL1Mu)
338  {
339  if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3) {
340 
341  //if(!hltconfigchanged)
342  //fill later//rate_All_L1->Fill(NL1);
343 
344  v->getL1EtHisto()->Fill(toc[*l1ki].pt());
345  //v->getL1PhiHisto()->Fill(toc[*l1ki].phi()());
346  //v->getL1EtaHisto()->Fill(toc[*l1ki].eta()());
347  v->getL1EtaPhiHisto()->Fill(toc[*l1ki].eta(),toc[*l1ki].phi());
348  }
349  }
350  ++idtypeiter;
351  }//end L1
352 
353 
354  }
355  //--------------------------------------
356  else if ( triggertype == trigger::TriggerMET
357  || triggertype == trigger::TriggerL1ETM
358  || triggertype == trigger::TriggerTET){
359 
360  v->getEtHisto()->Fill(toc[*ki].pt());
361  v->getPhiHisto()->Fill(toc[*ki].phi());
362 
363  //---L1 Histograms
364  trigger::Vids::const_iterator idtypeiter = idtype.begin();
365  for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
366  if (*idtypeiter == trigger::TriggerL1ETM)
367  {
368  if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3) {
369  //NL1[npth]++;
370  //if(!hltconfigchanged)
371  //fill later//rate_All_L1->Fill(NL1);
372  v->getL1EtHisto()->Fill(toc[*l1ki].pt());
373  v->getL1PhiHisto()->Fill(toc[*l1ki].phi());
374  }
375  }
376  ++idtypeiter;
377  }//end L1
378 
379  }
380  //-------------------------------------------
381  else if ( triggertype == trigger::TriggerTET
382  || triggertype == trigger::TriggerL1ETT){
383 
384  v->getEtHisto()->Fill(toc[*ki].pt());
385  v->getPhiHisto()->Fill(toc[*ki].phi());
386  //---L1 Histograms
387  trigger::Vids::const_iterator idtypeiter = idtype.begin();
388  for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
389  if (*idtypeiter == TriggerL1ETT)
390  {
391 
392  if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3) {
393  //NL1[npth]++;
394  //if(!hltconfigchanged)
395  //fill later//rate_All_L1->Fill(NL1);
396  v->getL1EtHisto()->Fill(toc[*l1ki].pt());
397  v->getL1PhiHisto()->Fill(toc[*l1ki].phi());
398  }
399  }
400  ++idtypeiter;
401  }//end L1
402  }
403  }
404 
405  }//ifpassed
406  }
407  }//----------------- end if plotAll
408 
409  //----plot all the ditributions for JET and MET with respect to a muon trigger --------------
410  if (plotwrtMu_) {
411 
412  // if (verbose_) std::cout << " Look at basic distributions with respect to muon " << std::endl;
413  int N =-1;
414  int NL1=-1;
415  for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ){
416  NL1++;
417  N++;
418  int triggertype = 0;
419  triggertype = v->getObjectType();
420 
421  bool l1accept = false;
422  edm::InputTag l1testTag(v->getl1Path(),"",processname_);
423  const int l1index = triggerObj->filterIndex(l1testTag);
424  if ( l1index >= triggerObj->sizeFilters() ) {
425  if (verbose_) std::cout<< "no index "<< l1index << " of that name (wrtMu)" << v->getl1Path() << "\t" << "\t" << l1testTag << std::endl;
426  continue;
427  }
428 
429  //const trigger::Vids & idtype = triggerObj->filterIds(l1index);
430  const trigger::Keys & l1k = triggerObj->filterKeys(l1index);
431  //if (verbose_) std::cout << "filterID "<< idtype << " keys " << l1k << std::endl;
432  //if (verbose_) std::cout << " keys " << l1k << std::endl;
433  l1accept = l1k.size() > 0;
434  //if (l1accept) rate_All_L1->Fill(NL1);
435  //l1accept = true ;
436  //
437  //-----------------------------------------------------
438  bool denompassed = false;
439  bool passed = false;
440  for(unsigned int i = 0; i < npath; ++i) {
441  if ( triggerNames.triggerName(i).find(v->getPath()) != std::string::npos && triggerResults->accept(i)){
442  passed = true; break ;
443  }
444  }
445  for(unsigned int i = 0; i < npath; ++i) {
446  if ( triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos && triggerResults->accept(i)){
447  denompassed = true; break ;
448  }
449  }
450  if(denompassed){
451 
452  if (verbose_) std::cout << " N " << N << " trigger wrt mu demom name "
453  << v->getDenomPath() << std::endl;
454  if(passed){
455 
456  //if(!hltconfigchanged)
457  //fill later//rate_wrtMu->Fill(N);
458 
459  if (verbose_) std::cout << " N " << N << " trigger name "
460  << v->getPath() << std::endl;
461 
462  if (!l1accept) {
463  edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "
464  << v->getPath() << "\t" << v->getl1Path();
465  }
466  edm::InputTag filterTag = v->getTag();
467  //const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
468  if (v->getLabel() == "dummy"){
469  const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
470  //loop over labels
471 
472  for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
473  edm::InputTag testTag(*labelIter,"",processname_);
474  if (verbose_) std::cout << v->getPath() << "\t" << testTag.label() << "\t" << testTag.process() << std::endl;
475 
476  int testindex = triggerObj->filterIndex(testTag);
477 
478  if ( !(testindex >= triggerObj->sizeFilters()) ) {
479  if (verbose_) std::cout << "found one! " << v->getPath() << "\t" << testTag.label() << std::endl;
480  filterTag = testTag;
481  v->setLabel(*labelIter);
482  }
483  }
484  }
485  const int index = triggerObj->filterIndex(filterTag);
486  if (verbose_) std::cout << "filter index "<< index << " of that name (wrtMu)"
487  << filterTag << std::endl;
488  if ( index >= triggerObj->sizeFilters() ) {
489  if (verbose_) std::cout << "WTF no index "<< index << " of that name (wrtMu)"
490  << filterTag << std::endl;
491  continue; //
492  }
493  const trigger::Keys & k = triggerObj->filterKeys(index);
494 
495  for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
496 
497  if (verbose_) cout << " filling HLT (wrtMu)" << v->getPath()
498  << "\t" << toc[*ki].pt() << "\t" << toc[*ki].eta()
499  << "\t" << toc[*ki].phi() << std::endl;
500  if ( triggertype == trigger::TriggerJet
501  || triggertype == trigger::TriggerL1TauJet
502  || triggertype == trigger::TriggerL1CenJet
503  || triggertype == trigger::TriggerL1ForJet)
504  {
505  if (verbose_) cout << " filling HLT (wrtMu)" << v->getPath()
506  << "\t" << " *ki " << *ki << " Nki "<< N
507  << " " << toc[*ki].pt() << "\t" << toc[*ki].eta()
508  << "\t" << toc[*ki].phi() << std::endl;
509  v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
510  //v->getEtawrtMuHisto()->Fill(toc[*ki].eta());
511  //v->getPhiwrtMuHisto()->Fill(toc[*ki].phi());
512  v->getEtaPhiwrtMuHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
513  }
514 
515  //----------------------------
516  else if (triggertype == trigger::TriggerMuon
517  ||triggertype == trigger::TriggerL1Mu )
518  {
519  if (verbose_) cout << " filling HLT (wrtMu)" << v->getPath() << "\t" << " *ki " << *ki << " Nki "<< N << " " << toc[*ki].pt() << "\t" << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
520  v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
521  //v->getEtaHisto()->Fill(toc[*ki].eta());
522  //v->getPhiHisto()->Fill(toc[*ki].phi());
523  v->getEtaPhiwrtMuHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
524  }
525  //--------------------------------------
526  else if ( triggertype == trigger::TriggerMET
527  || triggertype == trigger::TriggerL1ETM)
528  {
529  v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
530  v->getPhiwrtMuHisto()->Fill(toc[*ki].phi());
531  }
532  //-------------------------------------------
533  else if ( triggertype == trigger::TriggerTET
534  || triggertype == trigger::TriggerL1ETT)
535  {
536  v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
537  }
538  }
539 
540  }//ifpassed
541  }//if denom passed
542  }
543  }//----------------- end if plowrtMu
544  //----------plot efficiency---------------
545 
546  if (plotEff_) {
547  if (verbose_) std::cout << " Look at basic distributions for Eff " << std::endl;
548 
549  int N =-1;
550  int Ndenom =-1;
551  int Nnum =-1;
552  for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ){
553  Ndenom++;
554  Nnum++;
555  N++;
556  int triggertype = 0;
557  triggertype = v->getObjectType();
558 
559  bool l1accept = false;
560  edm::InputTag l1testTag(v->getl1Path(),"",processname_);
561  const int l1index = triggerObj->filterIndex(l1testTag);
562  if ( l1index >= triggerObj->sizeFilters() ) {
563  if (verbose_) std::cout<< "no index "<< l1index << " of that name "
564  << v->getl1Path() << "\t" << "\t" << l1testTag << std::endl;
565  continue;
566  }
567  //const trigger::Vids & idtype = triggerObj->filterIds(l1index);
568  const trigger::Keys & l1k = triggerObj->filterKeys(l1index);
569  //if (verbose_) std::cout << "filterID "<< idtype << " keys " << l1k << std::endl;
570  //if (verbose_) std::cout << " keys " << l1k << std::endl;
571  l1accept = l1k.size() > 0;
572  bool passed = false;
573  for(unsigned int i = 0; i < npath; ++i) {
574  if ( triggerNames.triggerName(i).find(v->getPath()) != std::string::npos
575  && triggerResults->accept(i)){
576  passed = true;
577  if (verbose_) std::cout << " i " << i << " trigger name " << v->getPath() << std::endl;
578  break;
579  }
580  }
581  bool denompassed = false;
582  for(unsigned int i = 0; i < npath; ++i) {
583  if ( triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos
584  && triggerResults->accept(i)){
585  denompassed = true;
586  if (verbose_) std::cout << " i " << i << " trigger name " << v->getDenomPath() << std::endl;
587  break;
588  }
589  }
590  if (denompassed){
591  //if(!hltconfigchanged)
592  //fill later//rate_Denom->Fill(Ndenom);
593  if (verbose_) std::cout << " N " << N << " trigger name " << v->getDenomPath() << std::endl;
594 
595  if (!l1accept) {
596  edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "
597  << v->getPath() << "\t" << v->getl1Path();
598  }
599  edm::InputTag filterTag = v->getDenomTag();
600  //const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
601  if (verbose_) std::cout << v->getDenomPath() << "\t" << v->getDenomLabel() << "\t" << std::endl;
602  if (v->getDenomLabel() == "denomdummy"){
603  const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getDenomPath());
604  //loop over labels
605  for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
606  edm::InputTag testTag(*labelIter,"",processname_);
607  if (verbose_) std::cout << v->getDenomPath() << "\t" << testTag.label() << "\t"
608  << testTag.process() << std::endl;
609  int testindex = triggerObj->filterIndex(testTag);
610  if ( !(testindex >= triggerObj->sizeFilters()) ) {
611  if (verbose_) std::cout << "found one! " << v->getDenomPath() << "\t"
612  << testTag.label() << std::endl;
613  filterTag = testTag;
614  v->setDenomLabel(*labelIter);
615  }
616  }
617  }
618  const int index = triggerObj->filterIndex(filterTag);
619  if (verbose_) std::cout << "filter index "<< index << " of that name "
620  << filterTag << std::endl;
621  if ( index >= triggerObj->sizeFilters() ) {
622  if (verbose_) std::cout << "WTF no index "<< index << " of that name "
623  << filterTag << std::endl;
624  continue; //
625  }
626  const trigger::Keys & k = triggerObj->filterKeys(index);
627  int numobj=-1;
628  for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
629  if (verbose_) cout << " filling HLT Denom " << v->getDenomPath() << "\t"
630  << toc[*ki].pt() << "\t" << toc[*ki].eta() << "\t"
631  << toc[*ki].phi() << std::endl;
632  if ( triggertype == trigger::TriggerJet
633  || triggertype == trigger::TriggerL1TauJet
634  || triggertype == trigger::TriggerL1CenJet
635  || triggertype == trigger::TriggerL1ForJet)
636  {
637  if (verbose_) cout << " filling HLT Denom" << v->getDenomPath()
638  << "\t" << " *kiDeno " << *ki << " NkiDenom "
639  << Ndenom<< " " << toc[*ki].pt() << "\t"
640  << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
641 
642  numobj=*ki;
643  v->getEtDenomHisto()->Fill(toc[*ki].pt());
644  v->getEtaDenomHisto()->Fill(toc[*ki].eta());
645  v->getPhiDenomHisto()->Fill(toc[*ki].phi());
646  }
647  //--------------------------------------
648  else if ( triggertype == trigger::TriggerMET
649  || triggertype == trigger::TriggerL1ETM
650  || triggertype == trigger::TriggerTET){
651  v->getEtDenomHisto()->Fill(toc[*ki].pt());
652  v->getPhiDenomHisto()->Fill(toc[*ki].phi());
653  }
654  //-------------------------------------------
655  else if ( triggertype == trigger::TriggerTET
656  || triggertype == trigger::TriggerL1ETT){
657  v->getEtDenomHisto()->Fill(toc[*ki].pt());
658  v->getPhiDenomHisto()->Fill(toc[*ki].phi());
659  }
660  if ( numobj != -1) break;
661  }
662 
663  }//if denom passed
664  if(denompassed){
665  if (passed){
666  //if(!hltconfigchanged)
667  //fill later//rate_Num->Fill(Nnum);
668  if (verbose_) std::cout << " N " << N << " trigger name " << v->getPath() << std::endl;
669  if (!l1accept) {
670  edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "<< v->getPath() << "\t" << v->getl1Path();
671  }
672  edm::InputTag filterTag = v->getTag();
673  //const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
674  if (verbose_) std::cout << v->getPath() << "\t" << v->getLabel() << std::endl;
675  if (v->getLabel() == "dummy"){
676  const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
677  //loop over labels
678  for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
679  edm::InputTag testTag(*labelIter,"",processname_);
680  if (verbose_) std::cout << v->getPath() << "\t" << testTag.label() << "\t"
681  << testTag.process() << std::endl;
682  int testindex = triggerObj->filterIndex(testTag);
683  if ( !(testindex >= triggerObj->sizeFilters()) ) {
684  if (verbose_) std::cout << "found one! " << v->getPath() << "\t"
685  << testTag.label() << std::endl;
686  filterTag = testTag;
687  v->setLabel(*labelIter);
688  }
689  }
690  }
691  const int index = triggerObj->filterIndex(filterTag);
692  if (verbose_) std::cout << "filter index "<< index << " of that name "
693  << filterTag << std::endl;
694  if ( index >= triggerObj->sizeFilters() ) {
695  if (verbose_) std::cout << "WTF no index "<< index << " of that name "
696  << filterTag << std::endl;
697  continue; //
698  }
699  const trigger::Keys & k = triggerObj->filterKeys(index);
700  int numobj = -1;
701  for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
702 
703  if (verbose_) cout << " filling HLT " << v->getPath() << "\t"
704  << toc[*ki].pt() << "\t" << toc[*ki].eta()
705  << "\t" << toc[*ki].phi() << std::endl;
706  if ( triggertype == trigger::TriggerJet
707  || triggertype == trigger::TriggerL1TauJet
708  || triggertype == trigger::TriggerL1CenJet
709  || triggertype == trigger::TriggerL1ForJet)
710  {
711  if (verbose_) cout << " filling HLT " << v->getPath() << "\t"
712  << " *ki " << *ki << " Nki "<< N<< " "
713  << toc[*ki].pt() << "\t" << toc[*ki].eta()
714  << "\t" << toc[*ki].phi() << std::endl;
715  numobj=*ki;
716  v->getEtNumHisto()->Fill(toc[*ki].pt());
717  v->getEtaNumHisto()->Fill(toc[*ki].eta());
718  v->getPhiNumHisto()->Fill(toc[*ki].phi());
719  }
720  //--------------------------------------
721  else if ( triggertype == trigger::TriggerMET
722  || triggertype == trigger::TriggerL1ETM
723  || triggertype == trigger::TriggerTET){
724  v->getEtNumHisto()->Fill(toc[*ki].pt());
725  v->getPhiNumHisto()->Fill(toc[*ki].phi());
726  }
727  //-------------------------------------------
728  else if ( triggertype == trigger::TriggerTET
729  || triggertype == trigger::TriggerL1ETT){
730  v->getEtNumHisto()->Fill(toc[*ki].pt());
731  v->getPhiNumHisto()->Fill(toc[*ki].phi());
732  }
733  if ( numobj != -1) break;
734  }
735  }//end if passed
736  } //if denompassed
737  }
738  //----------plot efficiency---------------
739  if ( (nev_ % 1000) == 0 ){
740  if (verbose_) std::cout << " Calculating Eff.... " << nev_ << std::endl;
741 
742  //if (nev_ % 1000)
743  //if (verbose_) std::cout << "starting the luminosity block -----" << std::endl;
744 
745  TH1F *rate_denom=NULL;
746  TH1F *rate_num=NULL;
747  rate_denom = rate_Denom->getTH1F();
748  rate_num = rate_Num->getTH1F();
749  //rate_denom->Sumw2();rate_num->Sumw2();
750  if ((rate_denom->Integral() != 0.) && (rate_num->Integral() != 0.) ) {
751  if (verbose_) std::cout << " Nonzero rate summary -----" << std::endl;
752  for(int j=1; j <= rate_denom->GetXaxis()->GetNbins();j++ ){
753  double y1 = rate_num->GetBinContent(j);
754  double y2 = rate_denom->GetBinContent(j);
755  double eff = y2 > 0. ? y1/y2 : 0.;
756  rate_Eff->setBinContent(j, eff);
757  double y1err = rate_num->GetBinError(j);
758  double y2err = rate_denom->GetBinError(j);
759  double efferr = 0.0;
760 
761  if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
762  + (y2err/y2)*(y2err/y2)) ;
763  rate_Eff->setBinError(j, efferr);
764  }
765  }
766  for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ) {
767  int triggertype = 0;
768  triggertype = v->getObjectType();
769  if (verbose_) std::cout << " triggertype ----- " << triggertype << std::endl;
770  if ( triggertype == trigger::TriggerJet
771  || triggertype == trigger::TriggerL1TauJet
772  || triggertype == trigger::TriggerL1CenJet
773  || triggertype == trigger::TriggerL1ForJet
774  || triggertype == trigger::TriggerL1Mu
775  || triggertype == trigger::TriggerMuon ){
776  TH1F *EtNum=NULL;
777  TH1F *EtaNum=NULL;
778  TH1F *PhiNum=NULL;
779  TH1F *EtDenom=NULL;
780  TH1F *EtaDenom=NULL;
781  TH1F *PhiDenom=NULL;
782 
783  EtNum= ( v->getEtNumHisto())->getTH1F() ;
784  EtaNum= ( v->getEtaNumHisto())->getTH1F() ;
785  PhiNum= ( v->getPhiNumHisto())->getTH1F() ;
786  EtDenom= ( v->getEtDenomHisto())->getTH1F() ;
787  EtaDenom= ( v->getEtaDenomHisto())->getTH1F() ;
788  PhiDenom= ( v->getPhiDenomHisto())->getTH1F() ;
789 
790  if ((EtNum->Integral() != 0.) && (EtDenom->Integral() != 0.) ) {
791  if (verbose_) std::cout << " Nonzero Jet Et -----" << std::endl;
792  for(int j=1; j <= EtNum->GetXaxis()->GetNbins();j++ ){
793  double y1 = EtNum->GetBinContent(j);
794  double y2 = EtDenom->GetBinContent(j);
795  double eff = y2 > 0. ? y1/y2 : 0.;
796 
797  v->getEtEffHisto()->setBinContent(j, eff);
798  double y1err = EtNum->GetBinError(j);
799  double y2err = EtDenom->GetBinError(j);
800  double efferr = 0.0;
801 
802  if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
803  + (y2err/y2)*(y2err/y2)) ;
804  v->getEtEffHisto()->setBinError(j, efferr);
805 
806  if(verbose_) std::cout << eff << " "<< efferr << " "
807  << y1 << " " << y2 << " "<< y1err << " " << y2err << std::endl;
808  }
809  }
810 
811  if (EtaNum->Integral() != 0. && EtaDenom->Integral() != 0. ) {
812  for(int j=1; j <= EtaNum->GetXaxis()->GetNbins();j++ ){
813  double y1 = EtaNum->GetBinContent(j);
814  double y2 = EtaDenom->GetBinContent(j);
815  double eff = y2 > 0. ? y1/y2 : 0.;
816  v->getEtaEffHisto()->setBinContent(j, eff);
817  double y1err = EtaNum->GetBinError(j);
818  double y2err = EtaDenom->GetBinError(j);
819  double efferr = 0.0;
820 
821  if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
822  + (y2err/y2)*(y2err/y2)) ;
823  v->getEtaEffHisto()->setBinError(j, efferr);
824  //
825  }
826  }
827  if (PhiNum->Integral() != 0. && PhiDenom->Integral() != 0. ) {
828  for(int j=1; j <= PhiNum->GetXaxis()->GetNbins();j++ ){
829  double y1 = PhiNum->GetBinContent(j);
830  double y2 = PhiDenom->GetBinContent(j);
831  double eff = y2 > 0. ? y1/y2 : 0.;
832  v->getPhiEffHisto()->setBinContent(j, eff);
833  double y1err = PhiNum->GetBinError(j);
834  double y2err = PhiDenom->GetBinError(j);
835  double efferr = 0.0;
836  if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
837  + (y2err/y2)*(y2err/y2)) ;
838  v->getPhiEffHisto()->setBinError(j, efferr);
839  //
840  }
841  }
842  }
843  if ( triggertype == trigger::TriggerMET
844  || triggertype == trigger::TriggerTET ){
845  TH1F *EtNum=NULL;
846  TH1F *PhiNum=NULL;
847  TH1F *EtDenom=NULL;
848  TH1F *PhiDenom=NULL;
849  EtNum= ( v->getEtNumHisto())->getTH1F() ;
850  PhiNum= ( v->getPhiNumHisto())->getTH1F() ;
851  EtDenom= ( v->getEtDenomHisto())->getTH1F() ;
852  PhiDenom= ( v->getPhiDenomHisto())->getTH1F() ;
853 
854  if (EtNum->Integral() != 0. && EtDenom->Integral() != 0. ) {
855  if (verbose_) std::cout << " Nonzero Met Et -----" << std::endl;
856  for(int j=1; j <= EtNum->GetXaxis()->GetNbins();j++ ){
857  double y1 = EtNum->GetBinContent(j);
858  double y2 = EtDenom->GetBinContent(j);
859  double eff = y2 > 0. ? y1/y2 : 0.;
860  v->getEtEffHisto()->setBinContent(j, eff);
861  double y1err = EtNum->GetBinError(j);
862  double y2err = EtDenom->GetBinError(j);
863  double efferr = 0.0;
864 
865  if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
866  + (y2err/y2)*(y2err/y2)) ;
867  v->getEtEffHisto()->setBinError(j, efferr);
868  }
869  }
870  if (PhiNum->Integral() != 0. && PhiDenom->Integral() != 0. ) {
871 
872  for(int j=1; j <= PhiNum->GetXaxis()->GetNbins();j++ ){
873  double y1 = PhiNum->GetBinContent(j);
874  double y2 = PhiDenom->GetBinContent(j);
875  double eff = y2 > 0. ? y1/y2 : 0.;
876  v->getPhiEffHisto()->setBinContent(j, eff);
877  double y1err = PhiNum->GetBinError(j);
878  double y2err = PhiDenom->GetBinError(j);
879  double efferr = 0.0;
880 
881  if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
882  + (y2err/y2)*(y2err/y2)) ;
883  v->getPhiEffHisto()->setBinError(j, efferr);
884  }
885  }
886  }// met triggers
887  }
888  }
889  }
890 }
891 
892 // -- method called once each job just before starting event loop --------
893 
894 void
896  nev_ = 0;
897  DQMStore *dbe = 0;
898  dbe = Service<DQMStore>().operator->();
899  if (dbe) {
901  dbe->rmdir(dirname_);
902  }
903  if (dbe) {
905  }
906  /*
907  hltconfigchanged=false;
908  //if (!hltConfig_.init(processname_)) {
909  if (!hltConfig_.init(run, c, processname_, hltconfigchanged)) {
910  processname_ = "FU";
911  // if (!hltConfig_.init(processname_)){
912  if (!hltConfig_.init(run, c, processname_, hltconfigchanged))
913  LogError("HLTJetMETDQMSource") << "HLTConfigProvider failed to initialize." << std::endl;
914  }
915  // hltConfig_.dump("Triggers");
916  }
917  const unsigned int n(hltConfig_.size());
918  if (verbose_) std::cout << " hltConfig_.size() " << n << std::endl;
919  //-------------if plot all jetmet trigger pt,eta, phi-------------------
920  if (plotAll_){
921  if (verbose_) std::cout << " booking histos All " << std::endl;
922  std::string foldernm = "/All/";
923 
924  if (dbe) {
925 
926  dbe->setCurrentFolder(dirname_ + foldernm);
927  }
928  for (unsigned int j=0; j!=n; ++j) {
929  std::string pathname = hltConfig_.triggerName(j);
930  std::string l1pathname = "dummy";
931  //for (unsigned int i=0; i!=n; ++i) {
932  // std::cout << hltConfig_.triggerName(i) << std::endl;
933 
934  //std::string denompathname = hltConfig_.triggerName(i);
935  std::string denompathname = "";
936  unsigned int usedPresscale = 1;
937  unsigned int objectType = 0;
938  //int denomobjectType = 0;
939  //parse pathname to guess object type
940 
941  if ( pathname.find("Mu") && (pathname=="HLT_L1MuOpen"))
942  objectType = trigger::TriggerMuon;
943  else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;
944  else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;
945  else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;
946  else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;
947  //if (pathname.find("HLT_Jet30") != std::string::npos) objectType = trigger::TriggerJet;
948  //if (pathname.find("HLT_Jet50") != std::string::npos) objectType = trigger::TriggerJet;
949  //if ((pathname.find("HLT_Mu3") != std::string::npos) || (pathname.find("HLT_L2Mu9") != std::string::npos) ) objectType = trigger::TriggerMuon;
950 
951  else continue;
952  //std::cout << "objecttye " << objectType << std::endl;
953  // find L1 condition for numpath with numpath objecttype
954 
955  // find PSet for L1 global seed for numpath,
956  // list module labels for numpath
957  std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
958 
959  for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
960  numpathmodule!= numpathmodules.end();
961  ++numpathmodule ) {
962 
963  // std::cout << pathname << "\t" << *numpathmodule << "\t"
964  //<< hltConfig_.moduleType(*numpathmodule) << std::endl;
965  if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
966  edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
967  //std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
968  // l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
969  l1pathname = *numpathmodule;
970  break;
971  }
972  }
973  std::string filtername("dummy");
974  std::string Denomfiltername("denomdummy");
975  float ptMin = 0.0;
976  float ptMax = 300.0;
977  if (objectType != 0 )
978  hltPathsAll_.push_back(PathInfo(usedPresscale, denompathname,
979  pathname, l1pathname, filtername,
980  Denomfiltername, processname_,
981  objectType, ptMin, ptMax));
982  }
983  std::string histonm="JetMET_rate_All";
984  std::string histonmL1="JetMET_rate_All_L1";
985  std::string histot="JetMET Rate Summary";
986  std::string histoL1t="JetMET L1 Rate Summary";
987  //fill later//rate_All = dbe->book1D(histonm.c_str(),histot.c_str(),
988  hltPathsAll_.size()+1,-0.5,hltPathsAll_.size()+1-0.5);
989 
990  //fill later//rate_All_L1 = dbe->book1D(histonmL1.c_str(),histoL1t.c_str(),
991  hltPathsAll_.size()+1,-0.5,hltPathsAll_.size()+1-0.5);
992 
993  //rate_All->setBinLabel(hltPathsAll_.size()+1,"Rate",1);
994  unsigned int nname=0;
995  unsigned int nnameL1=0;
996  for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
997  std::string labelnm("dummy");
998  labelnm = v->getPath();
999  rate_All->setBinLabel(nname+1,labelnm);
1000  nname++;
1001 
1002  std::string labelnml1("dummyl1");
1003  labelnml1 = v->getl1Path();
1004  rate_All_L1->setBinLabel(nnameL1+1,labelnml1);
1005  nnameL1++;
1006  }
1007  // now set up all of the histos for each path
1008  for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ) {
1009  MonitorElement *N = 0;
1010  MonitorElement *Et = 0;
1011  MonitorElement *EtaPhi = 0;
1012  MonitorElement *Eta = 0;
1013  MonitorElement *Phi = 0;
1014  MonitorElement *NL1 = 0;
1015  MonitorElement *l1Et = 0;
1016  MonitorElement *l1EtaPhi = 0;
1017  MonitorElement *l1Eta = 0;
1018  MonitorElement *l1Phi = 0;
1019 
1020  std::string labelname("dummy");
1021  labelname = v->getPath();
1022  std::string histoname(labelname+"");
1023  std::string title(labelname+"");
1024 
1025  double histEtaMax = 2.5;
1026  if (v->getObjectType() == trigger::TriggerMuon
1027  || v->getObjectType() == trigger::TriggerL1Mu) {
1028  histEtaMax = muonEtaMax_;
1029  nBins_ = 25 ;
1030  }
1031 
1032  else if (v->getObjectType() == trigger::TriggerJet
1033  || v->getObjectType() == trigger::TriggerL1CenJet
1034  || v->getObjectType() == trigger::TriggerL1ForJet ) {
1035  histEtaMax = jetEtaMax_;
1036  nBins_ = 60 ;
1037  }
1038 
1039  else if (v->getObjectType() == trigger::TriggerMET
1040  || v->getObjectType() == trigger::TriggerL1ETM ) {
1041  histEtaMax = 5.0;
1042  nBins_ = 60 ;
1043  }
1044 
1045  TString pathfolder = dirname_ + foldernm + v->getPath();
1046  dbe_->setCurrentFolder(pathfolder.Data());
1047  if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
1048  int nBins2D = 10;
1049 
1050 
1051  histoname = labelname+"_Et";
1052  title = labelname+" E_t";
1053  Et = dbe->book1D(histoname.c_str(),
1054  title.c_str(),nBins_,
1055  v->getPtMin(),
1056  v->getPtMax());
1057 
1058  histoname = labelname+"_l1Et";
1059  title = labelname+" L1 E_t";
1060  l1Et = dbe->book1D(histoname.c_str(),
1061  title.c_str(),nBins_,
1062  v->getPtMin(),
1063  v->getPtMax());
1064 
1065  if (labelname.find("Jet") != std::string::npos
1066  || labelname.find("Mu") != std::string::npos) {
1067 
1068  histoname = labelname+"_EtaPhi";
1069  title = labelname+" #eta vs #phi";
1070  EtaPhi = dbe->book2D(histoname.c_str(),
1071  title.c_str(),
1072  nBins2D,-histEtaMax,histEtaMax,
1073  nBins2D,-TMath::Pi(), TMath::Pi());
1074 
1075  histoname = labelname+"_l1EtaPhi";
1076  title = labelname+"L1 #eta vs L1 #phi";
1077  l1EtaPhi = dbe->book2D(histoname.c_str(),
1078  title.c_str(),
1079  nBins2D,-histEtaMax,histEtaMax,
1080  nBins2D,-TMath::Pi(), TMath::Pi());
1081 
1082  histoname = labelname+"_Phi";
1083  title = labelname+" #phi";
1084  Phi = dbe->book1D(histoname.c_str(),
1085  title.c_str(),
1086  nBins_,-TMath::Pi(), TMath::Pi());
1087 
1088  histoname = labelname+"_l1Phi";
1089  title = labelname+"L1 #phi";
1090  l1Phi = dbe->book1D(histoname.c_str(),
1091  title.c_str(),
1092  nBins_,-TMath::Pi(), TMath::Pi());
1093  histoname = labelname+"_Eta";
1094  title = labelname+" #eta";
1095  Eta = dbe->book1D(histoname.c_str(),
1096  title.c_str(),
1097  nBins_,-histEtaMax,histEtaMax
1098  );
1099 
1100  histoname = labelname+"_l1Eta";
1101  title = labelname+"L1 #eta";
1102  l1Eta = dbe->book1D(histoname.c_str(),
1103  title.c_str(),
1104  nBins_,-histEtaMax,histEtaMax);
1105  }
1106  else if( (labelname.find("MET") != std::string::npos)
1107  || (labelname.find("SumET") != std::string::npos) ){
1108  histoname = labelname+"_phi";
1109  title = labelname+" #phi";
1110  Phi = dbe->book1D(histoname.c_str(),
1111  title.c_str(),
1112  nBins_,-TMath::Pi(), TMath::Pi());
1113 
1114  histoname = labelname+"_l1Phi";
1115  title = labelname+"L1 #phi";
1116  l1Phi = dbe->book1D(histoname.c_str(),
1117  title.c_str(),
1118  nBins_,-TMath::Pi(), TMath::Pi());
1119 
1120  }
1121  v->setHistos( N, Et, EtaPhi, Eta, Phi, NL1, l1Et, l1EtaPhi,l1Eta, l1Phi);
1122  }
1123  if (verbose_) std::cout << "Done booking histos All " << std::endl;
1124  }
1125  //----------------plot all jetmet trigger wrt some muon trigger-----
1126  if (plotwrtMu_){
1127  if (verbose_) std::cout << " booking histos wrt Muon " << std::endl;
1128  std::string foldernm = "/wrtMuon/";
1129  if (dbe) {
1130  dbe->setCurrentFolder(dirname_ + foldernm);
1131  }
1132 
1133  for (unsigned int j=0; j!=n; ++j) {
1134  std::string pathname = hltConfig_.triggerName(j);
1135  std::string l1pathname = "dummy";
1136  //for (unsigned int i=0; i!=n; ++i)
1137  //{
1138  if (verbose_) std::cout << hltConfig_.triggerName(j) << std::endl;
1139  std::string denompathname = custompathnamemu_ ;
1140  int objectType = 0;
1141  int usedPresscale = 1;
1142  //int denomobjectType = 0;
1143  //parse pathname to guess object type
1144 
1145  if ( pathname.find("Mu") && (pathname=="HLT_L1MuOpen"))
1146  objectType = trigger::TriggerMuon;
1147  else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;
1148  else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;
1149  else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;
1150  else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;
1151  //if (pathname.find("HLT_Jet30") != std::string::npos) objectType = trigger::TriggerJet;
1152  //if (pathname.find("HLT_Jet50") != std::string::npos) objectType = trigger::TriggerJet;
1153  //if ((pathname.find("HLT_Mu3") != std::string::npos) || (pathname.find("HLT_L2Mu9") != std::string::npos) ) objectType = trigger::TriggerMuon;
1154  else continue;
1155 
1156  // find L1 condition for numpath with numpath objecttype
1157  // find PSet for L1 global seed for numpath,
1158  // list module labels for numpath
1159  std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
1160 
1161  for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
1162  numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
1163  // std::cout << pathname << "\t" << *numpathmodule << "\t" << hltConfig_.moduleType(*numpathmodule) << std::endl;
1164  if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
1165  edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
1166  //std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
1167  // l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
1168  l1pathname = *numpathmodule;
1169  break;
1170  }
1171  }
1172 
1173  std::string filtername("dummy");
1174  std::string Denomfiltername("denomdummy");
1175  float ptMin = 0.0;
1176  float ptMax = 300.0;
1177  if ( objectType != 0){
1178  // if (verbose_) std::cout << " wrt muon PathInfo(denompathname, pathname, l1pathname, filtername, denomfiltername, processname_, objectType, ptMin, ptMax " << denompathname << " "<< pathname << " "<< l1pathname << " " << filtername << " " << Denomfiltername << " " << processname_ << " " << objectType << " " << ptMin << " " << ptMax<< std::endl;
1179 
1180  hltPathswrtMu_.push_back(PathInfo(usedPresscale, denompathname, pathname, l1pathname,
1181  filtername, Denomfiltername, processname_,
1182  objectType, ptMin, ptMax));
1183  }
1184  }
1185 
1186  std::string histonm="JetMET_rate_wrt_" + custompathnamemu_ + "_Summary";
1187  std::string histt="JetMET Rate wrt " + custompathnamemu_ + "Summary";
1188  rate_wrtMu = dbe->book1D(histonm.c_str(),histt.c_str(),
1189  hltPathswrtMu_.size()+1,-0.5,hltPathswrtMu_.size()+1.0-0.5);
1190 
1191 
1192  int nname=0;
1193  for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ){
1194  std::string labelnm("dummy");
1195  labelnm = v->getPath();
1196 
1197  rate_wrtMu->setBinLabel(nname+1,labelnm);
1198 
1199  nname++;
1200  }
1201  // now set up all of the histos for each path
1202  for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ) {
1203  MonitorElement *NwrtMu = 0;
1204  MonitorElement *EtwrtMu = 0;
1205  MonitorElement *EtaPhiwrtMu = 0;
1206  MonitorElement *PhiwrtMu = 0;
1207 
1208  std::string labelname("dummy");
1209  labelname = v->getPath() + "_wrt_" + v->getDenomPath();
1210  std::string histoname(labelname+"");
1211  std::string title(labelname+"");
1212 
1213  double histEtaMax = 2.5;
1214  if (v->getObjectType() == trigger::TriggerMuon
1215  || v->getObjectType() == trigger::TriggerL1Mu) {
1216  histEtaMax = muonEtaMax_;nBins_ = 20 ;
1217  }
1218 
1219  else if (v->getObjectType() == trigger::TriggerJet
1220  || v->getObjectType() == trigger::TriggerL1CenJet
1221  || v->getObjectType() == trigger::TriggerL1ForJet ){
1222  histEtaMax = jetEtaMax_; nBins_ = 60 ;
1223  }
1224 
1225  else if (v->getObjectType() == trigger::TriggerMET
1226  || v->getObjectType() == trigger::TriggerL1ETM ) {
1227  histEtaMax = 5.0; nBins_ = 60 ;
1228  }
1229 
1230  TString pathfolder = dirname_ + foldernm + v->getPath();
1231  dbe_->setCurrentFolder(pathfolder.Data());
1232  if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
1233  int nBins2D = 10;
1234 
1235  //pathfolder = dirname_ + TString("/wrtMuon/") + v->getPath();
1236 
1237 
1238  histoname = labelname+"_Et_wrtMu";
1239  title = labelname+" E_t";
1240  EtwrtMu = dbe->book1D(histoname.c_str(),
1241  title.c_str(),nBins_,
1242  v->getPtMin(),
1243  v->getPtMax());
1244 
1245  if ((v->getPath()).find("Jet") != std::string::npos
1246  || (v->getPath()).find("Mu") != std::string::npos) {
1247  histoname = labelname+"_EtaPhi_wrtMu";
1248  title = labelname+" #eta vs #phi";
1249  EtaPhiwrtMu = dbe->book2D(histoname.c_str(),
1250  title.c_str(),
1251  nBins2D,-histEtaMax,histEtaMax,
1252  nBins2D,-TMath::Pi(), TMath::Pi());
1253 
1254 
1255  }
1256  else if( ((v->getPath()).find("MET") != std::string::npos)
1257  || ((v->getPath()).find("SumET") != std::string::npos) ){
1258  histoname = labelname+"_phi_wrtMu";
1259  title = labelname+" #phi";
1260  PhiwrtMu = dbe->book1D(histoname.c_str(),
1261  title.c_str(),
1262  nBins_,-TMath::Pi(), TMath::Pi());
1263  }
1264 
1265  v->setHistoswrtMu( NwrtMu, EtwrtMu, EtaPhiwrtMu, PhiwrtMu);
1266  }
1267  if (verbose_) std::cout << "Done booking histos wrt Muon " << std::endl;
1268  }
1270 
1271  if (plotEff_) {
1272  // plot efficiency for specified HLT path pairs
1273  if (verbose_) std::cout << " booking histos for Efficiency " << std::endl;
1274 
1275  std::string foldernm = "/Efficiency/";
1276  if (dbe) {
1277 
1278  dbe->setCurrentFolder(dirname_ + foldernm);
1279  }
1280  // now loop over denom/num path pairs specified in cfg,
1281  int countN = 0;
1282  for (std::vector<std::pair<std::string, std::string> >::iterator
1283  custompathnamepair = custompathnamepairs_.begin();
1284  custompathnamepair != custompathnamepairs_.end();
1285  ++custompathnamepair) {
1286 
1287  std::string denompathname = custompathnamepair->second;
1288  std::string pathname = custompathnamepair->first;
1289  int usedPrescale = prescUsed_[countN];
1290  if (verbose_) std::cout << " ------prescale used -----" << usedPrescale << std::endl;
1291  // check that these exist
1292  bool foundfirst = false;
1293  bool foundsecond = false;
1294  for (unsigned int i=0; i!=n; ++i) {
1295  if (hltConfig_.triggerName(i) == denompathname) foundsecond = true;
1296  if (hltConfig_.triggerName(i) == pathname) foundfirst = true;
1297  }
1298  if (!foundfirst) {
1299  edm::LogInfo("HLTJetMETDQMSource")
1300  << "pathname not found, ignoring "
1301  << pathname;
1302  continue;
1303  }
1304  if (!foundsecond) {
1305  edm::LogInfo("HLTJetMETDQMSource")
1306  << "denompathname not found, ignoring "
1307  << pathname;
1308  continue;
1309  }
1310  //if (verbose_) std::cout << pathname << "\t" << denompathname << std::endl;
1311  std::string l1pathname = "dummy";
1312  int objectType = 0;
1313  //int denomobjectType = 0;
1314  //parse pathname to guess object type
1315  if ( pathname.find("Mu") && (pathname=="HLT_L1MuOpen"))
1316  objectType = trigger::TriggerMuon;
1317  else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;
1318  else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;
1319  else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;
1320  else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;
1321  //if (pathname.find("HLT_Jet30") != std::string::npos) objectType = trigger::TriggerJet;
1322  //if (pathname.find("HLT_Jet50") != std::string::npos) objectType = trigger::TriggerJet;
1323  //if ((pathname.find("HLT_Mu3") != std::string::npos) || (pathname.find("HLT_L2Mu9") != std::string::npos) ) objectType = trigger::TriggerMuon;
1324  else continue;
1325 
1326  // find L1 condition for numpath with numpath objecttype
1327  // find PSet for L1 global seed for numpath,
1328  // list module labels for numpath
1329 
1330  std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
1331 
1332  for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
1333  numpathmodule!= numpathmodules.end();
1334  ++numpathmodule ) {
1335  // if (verbose_) std::cout << pathname << "\t" << *numpathmodule << "\t" << hltConfig_.moduleType(*numpathmodule) << std::endl;
1336  if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed"){
1337  edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
1338  // if (verbose_) std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
1339  // l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
1340  l1pathname = *numpathmodule;
1341  //if (verbose_) std::cout << *numpathmodule << std::endl;
1342  break;
1343  }
1344  }
1345 
1346  std::string filtername("dummy");
1347  std::string Denomfiltername("denomdummy");
1348  float ptMin = 0.0;
1349  float ptMax = 300.0;
1350  if (objectType == trigger::TriggerMuon) ptMax = 300.0;
1351  if (objectType == trigger::TriggerJet) ptMax = 300.0;
1352  if (objectType == trigger::TriggerMET) ptMax = 300.0;
1353  if (objectType == trigger::TriggerTET) ptMax = 300.0;
1354 
1355 
1356  if (objectType != 0){
1357  if (verbose_) std::cout << " PathInfo(denompathname, pathname, l1pathname, filtername, Denomfiltername, processname_, objectType, ptMin, ptMax " << denompathname << " "<< pathname << " "<< l1pathname << " " << filtername << " " << Denomfiltername << " " << processname_ << " " << objectType << " " << ptMin << " " << ptMax<< std::endl;
1358 
1359 
1360  hltPathsEff_.push_back(PathInfo(usedPrescale, denompathname, pathname, l1pathname, filtername, Denomfiltername, processname_, objectType, ptMin, ptMax));
1361  }
1362 
1363  countN++;
1364  }
1365 
1366  std::string histonm="JetMET_Efficiency_Summary";
1367  std::string histonmDenom="Denom_passed_Summary";
1368  std::string histonmNum="Num_passed_Summary";
1369  rate_Denom = dbe->book1D(histonmDenom.c_str(),histonmDenom.c_str(),
1370  hltPathsEff_.size(),0,hltPathsEff_.size());
1371  rate_Num = dbe->book1D(histonmNum.c_str(),histonmNum.c_str(),
1372  hltPathsEff_.size(),-0.5,hltPathsEff_.size()+1-0.5);
1373  rate_Eff = dbe->book1D(histonm.c_str(),histonm.c_str(),
1374  hltPathsEff_.size(),-0.5,hltPathsEff_.size()+1-0.5);
1375 
1376  //rate_Eff = dbe_->bookProfile("Efficiency_Summary","Efficiency_Summary", hltPathsEff_.size(), -0.5, hltPathsEff_.size()-0.5, 1000, 0.0, 1.0);
1377  int nname=0;
1378  for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ){
1379  std::string labelnm("dummy");
1380  std::string labeldenom("dummy");
1381  labelnm = v->getPath();
1382  labeldenom = v->getDenomPath();
1383  //rate_Eff->getTProfile()->GetXaxis()->SetBinLabel(nname+1,labelnm.c_str());
1384 
1385  rate_Eff->setBinLabel(nname+1,labelnm);
1386  rate_Denom->setBinLabel(nname+1,labeldenom);
1387  rate_Num->setBinLabel(nname+1,labelnm);
1388  nname++;
1389  }
1390  for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ) {
1391  MonitorElement *NEff=0;
1392  MonitorElement *EtEff=0;
1393  MonitorElement *EtaEff=0;
1394  MonitorElement *PhiEff=0;
1395  MonitorElement *NNum =0;
1396  MonitorElement *EtNum =0;
1397  MonitorElement *EtaNum =0;
1398  MonitorElement *PhiNum =0;
1399  MonitorElement *NDenom=0;
1400  MonitorElement *EtDenom=0;
1401  MonitorElement *EtaDenom=0;
1402  MonitorElement *PhiDenom=0;
1403  std::string labelname("dummy");
1404  labelname = "Eff_" + v->getPath() + "_wrt_" + v->getDenomPath();
1405  std::string histoname(labelname+"");
1406  std::string title(labelname+"");
1407 
1408  double histEtaMax = 5.0;
1409  if (v->getObjectType() == trigger::TriggerMuon
1410  || v->getObjectType() == trigger::TriggerL1Mu) {
1411  histEtaMax = muonEtaMax_; nBins_ = 20 ;
1412  }
1413 
1414  else if (v->getObjectType() == trigger::TriggerJet
1415  || v->getObjectType() == trigger::TriggerL1CenJet
1416  || v->getObjectType() == trigger::TriggerL1ForJet ){
1417  histEtaMax = jetEtaMax_; nBins_ = 60 ;
1418  }
1419 
1420  else if (v->getObjectType() == trigger::TriggerMET
1421  || v->getObjectType() == trigger::TriggerL1ETM ) {
1422  histEtaMax = 5.0; nBins_ = 60 ;
1423  }
1424 
1425  TString pathfolder = dirname_ + foldernm + v->getPath();
1426  dbe_->setCurrentFolder(pathfolder.Data());
1427  if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
1428 
1429  //pathfolder = dirname_ + TString("/Eff/") + v->getPath();
1430  //int nBins2D = 10;
1431  histoname = labelname+"_Et_Eff";
1432  title = labelname+" E_t Eff";
1433  EtEff = dbe->book1D(histoname.c_str(),
1434  title.c_str(),nBins_,
1435  v->getPtMin(),
1436  v->getPtMax());
1437 
1438  histoname = labelname+"_Et_Num";
1439  title = labelname+" E_t Num";
1440  EtNum = dbe->book1D(histoname.c_str(),
1441  title.c_str(),nBins_,
1442  v->getPtMin(),
1443  v->getPtMax());
1444 
1445 
1446  histoname = labelname+"_Et_Denom";
1447  title = labelname+" E_t Denom";
1448  EtDenom = dbe->book1D(histoname.c_str(),
1449  title.c_str(),nBins_,
1450  v->getPtMin(),
1451  v->getPtMax());
1452 
1453  if ((v->getPath()).find("Jet") != std::string::npos
1454  || (v->getPath()).find("Mu") != std::string::npos) {
1455  histoname = labelname+"_Eta_Eff";
1456  title = labelname+" #eta Eff";
1457  EtaEff = dbe->book1D(histoname.c_str(),
1458  title.c_str(),
1459  nBins_,-histEtaMax,histEtaMax);
1460  histoname = labelname+"_Phi_Eff";
1461  title = labelname+" #phi Eff";
1462  PhiEff = dbe->book1D(histoname.c_str(),
1463  title.c_str(),
1464  nBins_,-TMath::Pi(), TMath::Pi());
1465 
1466  histoname = labelname+"_Eta_Num";
1467  title = labelname+" #eta Num";
1468  EtaNum = dbe->book1D(histoname.c_str(),
1469  title.c_str(),
1470  nBins_,-histEtaMax,histEtaMax);
1471  histoname = labelname+"_Phi_Num";
1472  title = labelname+" #phi Num";
1473  PhiNum = dbe->book1D(histoname.c_str(),
1474  title.c_str(),
1475  nBins_,-TMath::Pi(), TMath::Pi());
1476 
1477  histoname = labelname+"_Eta_Denom";
1478  title = labelname+" #eta Denom";
1479  EtaDenom = dbe->book1D(histoname.c_str(),
1480  title.c_str(),
1481  nBins_,-histEtaMax,histEtaMax);
1482  histoname = labelname+"_Phi_Denom";
1483  title = labelname+" #phi Denom";
1484  PhiDenom = dbe->book1D(histoname.c_str(),
1485  title.c_str(),
1486  nBins_,-TMath::Pi(), TMath::Pi());
1487  }
1488 
1489 
1490  else if( ((v->getPath()).find("MET") != std::string::npos)
1491  || ((v->getPath()).find("SumET") != std::string::npos) ){
1492 
1493  histoname = labelname+"_Phi_Eff";
1494  title = labelname+" #phi Eff";
1495  PhiEff = dbe->book1D(histoname.c_str(),
1496  title.c_str(),
1497  nBins_,-TMath::Pi(), TMath::Pi());
1498 
1499  histoname = labelname+"_Phi_Num";
1500  title = labelname+" #phi Num";
1501  PhiNum = dbe->book1D(histoname.c_str(),
1502  title.c_str(),
1503  nBins_,-TMath::Pi(), TMath::Pi());
1504 
1505  histoname = labelname+"_Phi_Denom";
1506  title = labelname+" #phi Denom";
1507  PhiDenom = dbe->book1D(histoname.c_str(),
1508  title.c_str(),
1509  nBins_,-TMath::Pi(), TMath::Pi());
1510 
1511  }
1512 
1513  v->setHistosEff( NEff, EtEff, EtaEff, PhiEff, NNum, EtNum, EtaNum, PhiNum, NDenom, EtDenom, EtaDenom, PhiDenom);
1514 
1515  }
1516  if (verbose_) std::cout << "Done booking histos for Efficiency " << std::endl;
1517  }
1518 
1519 
1520  */
1521 }
1522 
1523 // BeginRun
1525 
1526  if (verbose_) std::cout << "beginRun, run " << run.id() << std::endl;
1527 
1528  /*
1529  // HLT config does not change within runs!
1530  bool changed(true);
1531 
1532 
1533  //if (hltConfig_.init(iEvent,processname_,changed)) {
1534  if (hltConfig_.init(run,c,processname_,changed)) {
1535  if (changed) {
1536  hltconfigchanged=true;
1537  //if(verbose_)
1538  //hltConfig_.dump("Triggers");
1539  LogWarning("HLTJetMETDQMSource") << "HLTJetMETDQMSource:analyze: The number of valid triggers has changed since beginning of job." << std::endl;
1540  // << "Processing of events halted for summary histograms" << std::endl;
1541  //<< "Summary histograms do not support changing configurations." << std::endl
1542 
1543  }
1544  }
1545  else {
1546  LogError("HLTJetMETDQMSource") << "HLT config init error" << std::endl;
1547  return;
1548  }
1549  if ( hltConfig_.size() <= 0 ) {
1550  LogError("HLTJetMETDQMSource") << "HLT config size error" << std::endl;
1551  return;
1552  }
1553  // if ( currun != runno) runchanged=true;
1554 
1555 */
1557 
1558  hltconfigchanged=false;
1559  //if (!hltConfig_.init(processname_)) {
1560  if (!hltConfig_.init(run, c, processname_, hltconfigchanged)) {
1561  processname_ = "FU";
1562  // if (!hltConfig_.init(processname_)){
1563  if (!hltConfig_.init(run, c, processname_, hltconfigchanged)) {
1564  LogError("HLTJetMETDQMSource") << "HLTConfigProvider failed to initialize." << std::endl;
1565  }
1566  // hltConfig_.dump("Triggers");
1567  }
1568 
1569  DQMStore *dbe = 0;
1570  dbe = Service<DQMStore>().operator->();
1571 
1572  if (dbe) {
1573  dbe->setCurrentFolder(dirname_);
1574  }
1575 
1576  const unsigned int n(hltConfig_.size());
1577  if (verbose_) std::cout << " hltConfig_.size() " << n << std::endl;
1578  //-------------if plot all jetmet trigger pt,eta, phi-------------------
1579 
1580 
1581  if (plotAll_){
1582  if (verbose_) std::cout << " booking histos All " << std::endl;
1583  std::string foldernm = "/All/";
1584 
1585  if (dbe) {
1586 
1587  dbe->setCurrentFolder(dirname_ + foldernm);
1588  }
1589  for (unsigned int j=0; j!=n; ++j) {
1591  std::string l1pathname = "dummy";
1592  //for (unsigned int i=0; i!=n; ++i) {
1593  // std::cout << hltConfig_.triggerName(i) << std::endl;
1594 
1595  //std::string denompathname = hltConfig_.triggerName(i);
1596  std::string denompathname = "";
1597  std::string denompathnamemu = custompathnamemu_;
1598  unsigned int usedPresscale = 1;
1599  unsigned int objectType = 0;
1600  //int denomobjectType = 0;
1601  //parse pathname to guess object type
1602 
1603  if ( pathname.find("Mu") && (pathname==denompathnamemu))
1604  objectType = trigger::TriggerMuon;
1605  else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;
1606  else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;
1607  else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;
1608  else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;
1609  //if (pathname.find("HLT_Jet30") != std::string::npos) objectType = trigger::TriggerJet;
1610  //if (pathname.find("HLT_Jet50") != std::string::npos) objectType = trigger::TriggerJet;
1611  //if ((pathname.find("HLT_Mu3") != std::string::npos) || (pathname.find("HLT_L2Mu9") != std::string::npos) ) objectType = trigger::TriggerMuon;
1612 
1613  else continue;
1614  //std::cout << "objecttye " << objectType << std::endl;
1615  // find L1 condition for numpath with numpath objecttype
1616 
1617  // find PSet for L1 global seed for numpath,
1618  // list module labels for numpath
1619  std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
1620 
1621  for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
1622  numpathmodule!= numpathmodules.end();
1623  ++numpathmodule ) {
1624 
1625  // std::cout << pathname << "\t" << *numpathmodule << "\t"
1626  //<< hltConfig_.moduleType(*numpathmodule) << std::endl;
1627  if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
1628  edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
1629  //std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
1630  // l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
1631  l1pathname = *numpathmodule;
1632  break;
1633  }
1634  }
1635  std::string filtername("dummy");
1636  std::string Denomfiltername("denomdummy");
1637  float ptMin = 0.0;
1638  float ptMax = 300.0;
1639  if (objectType != 0 )
1640  hltPathsAll_.push_back(PathInfo(usedPresscale, denompathname,
1641  pathname, l1pathname, filtername,
1642  Denomfiltername, processname_,
1643  objectType, ptMin, ptMax));
1644  }
1645  std::string histonm="JetMET_rate_All";
1646  std::string histonmL1="JetMET_rate_All_L1";
1647  std::string histot="JetMET Rate Summary";
1648  std::string histoL1t="JetMET L1 Rate Summary";
1649  //fill later//rate_All = dbe->book1D(histonm.c_str(),histot.c_str(),
1650  //fill later// hltPathsAll_.size()+1,-0.5,hltPathsAll_.size()+1-0.5);
1651 
1652  //fill later//rate_All_L1 = dbe->book1D(histonmL1.c_str(),histoL1t.c_str(),
1653  //fill later// hltPathsAll_.size()+1,-0.5,hltPathsAll_.size()+1-0.5);
1654 
1655  //rate_All->setBinLabel(hltPathsAll_.size()+1,"Rate",1);
1656  unsigned int nname=0;
1657  unsigned int nnameL1=0;
1658  for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
1659  std::string labelnm("dummy");
1660  labelnm = v->getPath();
1661  //fill later//rate_All->setBinLabel(nname+1,labelnm);
1662  nname++;
1663 
1664  std::string labelnml1("dummyl1");
1665  labelnml1 = v->getl1Path();
1666  //fill later//rate_All_L1->setBinLabel(nnameL1+1,labelnml1);
1667  nnameL1++;
1668  }
1669  // now set up all of the histos for each path
1670  for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ) {
1671  MonitorElement *N = 0;
1672  MonitorElement *Et = 0;
1673  MonitorElement *EtaPhi = 0;
1674  MonitorElement *Eta = 0;
1675  MonitorElement *Phi = 0;
1676  MonitorElement *NL1 = 0;
1677  MonitorElement *l1Et = 0;
1678  MonitorElement *l1EtaPhi = 0;
1679  MonitorElement *l1Eta = 0;
1680  MonitorElement *l1Phi = 0;
1681 
1682  std::string labelname("dummy");
1683  labelname = v->getPath();
1684  std::string histoname(labelname+"");
1685  std::string title(labelname+"");
1686 
1687  double histEtaMax = 2.5;
1688  if (v->getObjectType() == trigger::TriggerMuon
1689  || v->getObjectType() == trigger::TriggerL1Mu) {
1690  histEtaMax = muonEtaMax_;
1691  nBins_ = 25 ;
1692  }
1693 
1694  else if (v->getObjectType() == trigger::TriggerJet
1695  || v->getObjectType() == trigger::TriggerL1CenJet
1696  || v->getObjectType() == trigger::TriggerL1ForJet ) {
1697  histEtaMax = jetEtaMax_;
1698  nBins_ = 60 ;
1699  }
1700 
1701  else if (v->getObjectType() == trigger::TriggerMET
1702  || v->getObjectType() == trigger::TriggerL1ETM ) {
1703  histEtaMax = 5.0;
1704  nBins_ = 60 ;
1705  }
1706 
1707  TString pathfolder = dirname_ + foldernm + v->getPath();
1708  dbe_->setCurrentFolder(pathfolder.Data());
1709  if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
1710  int nBins2D = 10;
1711 
1712 
1713  histoname = labelname+"_Et";
1714  title = labelname+" E_t";
1715  Et = dbe->book1D(histoname.c_str(),
1716  title.c_str(),nBins_,
1717  v->getPtMin(),
1718  v->getPtMax());
1719 
1720  histoname = labelname+"_l1Et";
1721  title = labelname+" L1 E_t";
1722  l1Et = dbe->book1D(histoname.c_str(),
1723  title.c_str(),nBins_,
1724  v->getPtMin(),
1725  v->getPtMax());
1726 
1727  if (labelname.find("Jet") != std::string::npos
1728  || labelname.find("Mu") != std::string::npos) {
1729 
1730  histoname = labelname+"_EtaPhi";
1731  title = labelname+" #eta vs #phi";
1732  EtaPhi = dbe->book2D(histoname.c_str(),
1733  title.c_str(),
1734  nBins2D,-histEtaMax,histEtaMax,
1735  nBins2D,-TMath::Pi(), TMath::Pi());
1736 
1737  histoname = labelname+"_l1EtaPhi";
1738  title = labelname+"L1 #eta vs L1 #phi";
1739  l1EtaPhi = dbe->book2D(histoname.c_str(),
1740  title.c_str(),
1741  nBins2D,-histEtaMax,histEtaMax,
1742  nBins2D,-TMath::Pi(), TMath::Pi());
1743 
1744  histoname = labelname+"_Phi";
1745  title = labelname+" #phi";
1746  Phi = dbe->book1D(histoname.c_str(),
1747  title.c_str(),
1748  nBins_,-TMath::Pi(), TMath::Pi());
1749 
1750  histoname = labelname+"_l1Phi";
1751  title = labelname+"L1 #phi";
1752  l1Phi = dbe->book1D(histoname.c_str(),
1753  title.c_str(),
1754  nBins_,-TMath::Pi(), TMath::Pi());
1755  histoname = labelname+"_Eta";
1756  title = labelname+" #eta";
1757  Eta = dbe->book1D(histoname.c_str(),
1758  title.c_str(),
1759  nBins_,-histEtaMax,histEtaMax
1760  );
1761 
1762  histoname = labelname+"_l1Eta";
1763  title = labelname+"L1 #eta";
1764  l1Eta = dbe->book1D(histoname.c_str(),
1765  title.c_str(),
1766  nBins_,-histEtaMax,histEtaMax);
1767  }
1768  else if( (labelname.find("MET") != std::string::npos)
1769  || (labelname.find("SumET") != std::string::npos) ){
1770  histoname = labelname+"_phi";
1771  title = labelname+" #phi";
1772  Phi = dbe->book1D(histoname.c_str(),
1773  title.c_str(),
1774  nBins_,-TMath::Pi(), TMath::Pi());
1775 
1776  histoname = labelname+"_l1Phi";
1777  title = labelname+"L1 #phi";
1778  l1Phi = dbe->book1D(histoname.c_str(),
1779  title.c_str(),
1780  nBins_,-TMath::Pi(), TMath::Pi());
1781 
1782  }
1783  v->setHistos( N, Et, EtaPhi, Eta, Phi, NL1, l1Et, l1EtaPhi,l1Eta, l1Phi);
1784  }
1785  if (verbose_) std::cout << "Done booking histos All " << std::endl;
1786  }
1787  //----------------plot all jetmet trigger wrt some muon trigger-----
1788  if (plotwrtMu_){
1789  if (verbose_) std::cout << " booking histos wrt Muon " << std::endl;
1790  std::string foldernm = "/wrtMuon/";
1791  if (dbe) {
1792  dbe->setCurrentFolder(dirname_ + foldernm);
1793  }
1794 
1795  for (unsigned int j=0; j!=n; ++j) {
1797  std::string l1pathname = "dummy";
1798  //for (unsigned int i=0; i!=n; ++i)
1799  //{
1800  if (verbose_) std::cout << hltConfig_.triggerName(j) << std::endl;
1801  std::string denompathname = custompathnamemu_ ;
1802  int objectType = 0;
1803  int usedPresscale = 1;
1804  //int denomobjectType = 0;
1805  //parse pathname to guess object type
1806 
1807  if ( pathname.find("Mu") && (pathname==denompathname))
1808  objectType = trigger::TriggerMuon;
1809  else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;
1810  else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;
1811  else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;
1812  else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;
1813  //if (pathname.find("HLT_Jet30") != std::string::npos) objectType = trigger::TriggerJet;
1814  //if (pathname.find("HLT_Jet50") != std::string::npos) objectType = trigger::TriggerJet;
1815  //if ((pathname.find("HLT_Mu3") != std::string::npos) || (pathname.find("HLT_L2Mu9") != std::string::npos) ) objectType = trigger::TriggerMuon;
1816  else continue;
1817 
1818  // find L1 condition for numpath with numpath objecttype
1819  // find PSet for L1 global seed for numpath,
1820  // list module labels for numpath
1821  std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
1822 
1823  for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
1824  numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
1825  // std::cout << pathname << "\t" << *numpathmodule << "\t" << hltConfig_.moduleType(*numpathmodule) << std::endl;
1826  if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
1827  edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
1828  //std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
1829  // l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
1830  l1pathname = *numpathmodule;
1831  break;
1832  }
1833  }
1834 
1835  std::string filtername("dummy");
1836  std::string Denomfiltername("denomdummy");
1837  float ptMin = 0.0;
1838  float ptMax = 300.0;
1839  if ( objectType != 0){
1840  // if (verbose_) std::cout << " wrt muon PathInfo(denompathname, pathname, l1pathname, filtername, denomfiltername, processname_, objectType, ptMin, ptMax " << denompathname << " "<< pathname << " "<< l1pathname << " " << filtername << " " << Denomfiltername << " " << processname_ << " " << objectType << " " << ptMin << " " << ptMax<< std::endl;
1841 
1842  hltPathswrtMu_.push_back(PathInfo(usedPresscale, denompathname, pathname, l1pathname,
1843  filtername, Denomfiltername, processname_,
1844  objectType, ptMin, ptMax));
1845  }
1846  }
1847 
1848  std::string histonm="JetMET_rate_wrt_" + custompathnamemu_ + "_Summary";
1849  std::string histt="JetMET Rate wrt " + custompathnamemu_ + "Summary";
1850  //fill later//rate_wrtMu = dbe->book1D(histonm.c_str(),histt.c_str(),
1851  //fill later// hltPathswrtMu_.size()+1,-0.5,hltPathswrtMu_.size()+1.0-0.5);
1852 
1853 
1854  int nname=0;
1855  for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ){
1856  std::string labelnm("dummy");
1857  labelnm = v->getPath();
1858 
1859  //fill later//rate_wrtMu->setBinLabel(nname+1,labelnm);
1860 
1861  nname++;
1862  }
1863  // now set up all of the histos for each path
1864  for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ) {
1865  MonitorElement *NwrtMu = 0;
1866  MonitorElement *EtwrtMu = 0;
1867  MonitorElement *EtaPhiwrtMu = 0;
1868  MonitorElement *PhiwrtMu = 0;
1869 
1870  std::string labelname("dummy");
1871  labelname = v->getPath() + "_wrt_" + v->getDenomPath();
1872  std::string histoname(labelname+"");
1873  std::string title(labelname+"");
1874 
1875  double histEtaMax = 2.5;
1876  if (v->getObjectType() == trigger::TriggerMuon
1877  || v->getObjectType() == trigger::TriggerL1Mu) {
1878  histEtaMax = muonEtaMax_;nBins_ = 20 ;
1879  }
1880 
1881  else if (v->getObjectType() == trigger::TriggerJet
1882  || v->getObjectType() == trigger::TriggerL1CenJet
1883  || v->getObjectType() == trigger::TriggerL1ForJet ){
1884  histEtaMax = jetEtaMax_; nBins_ = 60 ;
1885  }
1886 
1887  else if (v->getObjectType() == trigger::TriggerMET
1888  || v->getObjectType() == trigger::TriggerL1ETM ) {
1889  histEtaMax = 5.0; nBins_ = 60 ;
1890  }
1891 
1892  TString pathfolder = dirname_ + foldernm + v->getPath();
1893  dbe_->setCurrentFolder(pathfolder.Data());
1894  if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
1895  int nBins2D = 10;
1896 
1897  //pathfolder = dirname_ + TString("/wrtMuon/") + v->getPath();
1898 
1899 
1900  histoname = labelname+"_Et_wrtMu";
1901  title = labelname+" E_t";
1902  EtwrtMu = dbe->book1D(histoname.c_str(),
1903  title.c_str(),nBins_,
1904  v->getPtMin(),
1905  v->getPtMax());
1906 
1907  if ((v->getPath()).find("Jet") != std::string::npos
1908  || (v->getPath()).find("Mu") != std::string::npos) {
1909  histoname = labelname+"_EtaPhi_wrtMu";
1910  title = labelname+" #eta vs #phi";
1911  EtaPhiwrtMu = dbe->book2D(histoname.c_str(),
1912  title.c_str(),
1913  nBins2D,-histEtaMax,histEtaMax,
1914  nBins2D,-TMath::Pi(), TMath::Pi());
1915 
1916 
1917  }
1918  else if( ((v->getPath()).find("MET") != std::string::npos)
1919  || ((v->getPath()).find("SumET") != std::string::npos) ){
1920  histoname = labelname+"_phi_wrtMu";
1921  title = labelname+" #phi";
1922  PhiwrtMu = dbe->book1D(histoname.c_str(),
1923  title.c_str(),
1924  nBins_,-TMath::Pi(), TMath::Pi());
1925  }
1926 
1927  v->setHistoswrtMu( NwrtMu, EtwrtMu, EtaPhiwrtMu, PhiwrtMu);
1928  }
1929  if (verbose_) std::cout << "Done booking histos wrt Muon " << std::endl;
1930  }
1932 
1933  if (plotEff_) {
1934  // plot efficiency for specified HLT path pairs
1935  if (verbose_) std::cout << " booking histos for Efficiency " << std::endl;
1936 
1937  std::string foldernm = "/Efficiency/";
1938  if (dbe) {
1939 
1940  dbe->setCurrentFolder(dirname_ + foldernm);
1941  }
1942  // now loop over denom/num path pairs specified in cfg,
1943  int countN = 0;
1944  for (std::vector<std::pair<std::string, std::string> >::iterator
1945  custompathnamepair = custompathnamepairs_.begin();
1946  custompathnamepair != custompathnamepairs_.end();
1947  ++custompathnamepair) {
1948 
1949  std::string denompathname = custompathnamepair->second;
1950  std::string denompathnamemu = custompathnamemu_;
1951  std::string pathname = custompathnamepair->first;
1952  int usedPrescale = prescUsed_[countN];
1953  if (verbose_) std::cout << " ------prescale used -----" << usedPrescale << std::endl;
1954  // check that these exist
1955  bool foundfirst = false;
1956  bool foundsecond = false;
1957  for (unsigned int i=0; i!=n; ++i) {
1958  if (hltConfig_.triggerName(i) == denompathname) foundsecond = true;
1959  if (hltConfig_.triggerName(i) == pathname) foundfirst = true;
1960  }
1961  if (!foundfirst) {
1962  edm::LogInfo("HLTJetMETDQMSource")
1963  << "pathname not found, ignoring "
1964  << pathname;
1965  continue;
1966  }
1967  if (!foundsecond) {
1968  edm::LogInfo("HLTJetMETDQMSource")
1969  << "denompathname not found, ignoring "
1970  << pathname;
1971  continue;
1972  }
1973  //if (verbose_) std::cout << pathname << "\t" << denompathname << std::endl;
1974  std::string l1pathname = "dummy";
1975  int objectType = 0;
1976  //int denomobjectType = 0;
1977  //parse pathname to guess object type
1978  if ( pathname.find("Mu") && (pathname==denompathnamemu))
1979  objectType = trigger::TriggerMuon;
1980  else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;
1981  else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;
1982  else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;
1983  else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;
1984  //if (pathname.find("HLT_Jet30") != std::string::npos) objectType = trigger::TriggerJet;
1985  //if (pathname.find("HLT_Jet50") != std::string::npos) objectType = trigger::TriggerJet;
1986  //if ((pathname.find("HLT_Mu3") != std::string::npos) || (pathname.find("HLT_L2Mu9") != std::string::npos) ) objectType = trigger::TriggerMuon;
1987  else continue;
1988 
1989  // find L1 condition for numpath with numpath objecttype
1990  // find PSet for L1 global seed for numpath,
1991  // list module labels for numpath
1992 
1993  std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
1994 
1995  for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
1996  numpathmodule!= numpathmodules.end();
1997  ++numpathmodule ) {
1998  // if (verbose_) std::cout << pathname << "\t" << *numpathmodule << "\t" << hltConfig_.moduleType(*numpathmodule) << std::endl;
1999  if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed"){
2000  edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
2001  // if (verbose_) std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
2002  // l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
2003  l1pathname = *numpathmodule;
2004  //if (verbose_) std::cout << *numpathmodule << std::endl;
2005  break;
2006  }
2007  }
2008 
2009  std::string filtername("dummy");
2010  std::string Denomfiltername("denomdummy");
2011  float ptMin = 0.0;
2012  float ptMax = 300.0;
2013  if (objectType == trigger::TriggerMuon) ptMax = 300.0;
2014  if (objectType == trigger::TriggerJet) ptMax = 300.0;
2015  if (objectType == trigger::TriggerMET) ptMax = 300.0;
2016  if (objectType == trigger::TriggerTET) ptMax = 300.0;
2017 
2018 
2019  if (objectType != 0){
2020  if (verbose_) std::cout << " PathInfo(denompathname, pathname, l1pathname, filtername, Denomfiltername, processname_, objectType, ptMin, ptMax " << denompathname << " "<< pathname << " "<< l1pathname << " " << filtername << " " << Denomfiltername << " " << processname_ << " " << objectType << " " << ptMin << " " << ptMax<< std::endl;
2021 
2022 
2023  hltPathsEff_.push_back(PathInfo(usedPrescale, denompathname, pathname, l1pathname, filtername, Denomfiltername, processname_, objectType, ptMin, ptMax));
2024  }
2025 
2026  countN++;
2027  }
2028 
2029  std::string histonm="JetMET_Efficiency_Summary";
2030  std::string histonmDenom="Denom_passed_Summary";
2031  std::string histonmNum="Num_passed_Summary";
2032  rate_Denom = dbe->book1D(histonmDenom.c_str(),histonmDenom.c_str(),
2033  hltPathsEff_.size(),0,hltPathsEff_.size());
2034  rate_Num = dbe->book1D(histonmNum.c_str(),histonmNum.c_str(),
2035  hltPathsEff_.size(),-0.5,hltPathsEff_.size()+1-0.5);
2036  rate_Eff = dbe->book1D(histonm.c_str(),histonm.c_str(),
2037  hltPathsEff_.size(),-0.5,hltPathsEff_.size()+1-0.5);
2038 
2039  //rate_Eff = dbe_->bookProfile("Efficiency_Summary","Efficiency_Summary", hltPathsEff_.size(), -0.5, hltPathsEff_.size()-0.5, 1000, 0.0, 1.0);
2040  int nname=0;
2041  for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ){
2042  std::string labelnm("dummy");
2043  std::string labeldenom("dummy");
2044  labelnm = v->getPath();
2045  labeldenom = v->getDenomPath();
2046  //rate_Eff->getTProfile()->GetXaxis()->SetBinLabel(nname+1,labelnm.c_str());
2047 
2048  rate_Eff->setBinLabel(nname+1,labelnm);
2049  rate_Denom->setBinLabel(nname+1,labeldenom);
2050  rate_Num->setBinLabel(nname+1,labelnm);
2051  nname++;
2052  }
2053  for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ) {
2054  MonitorElement *NEff=0;
2055  MonitorElement *EtEff=0;
2056  MonitorElement *EtaEff=0;
2057  MonitorElement *PhiEff=0;
2058  MonitorElement *NNum =0;
2059  MonitorElement *EtNum =0;
2060  MonitorElement *EtaNum =0;
2061  MonitorElement *PhiNum =0;
2062  MonitorElement *NDenom=0;
2063  MonitorElement *EtDenom=0;
2064  MonitorElement *EtaDenom=0;
2065  MonitorElement *PhiDenom=0;
2066  std::string labelname("dummy");
2067  labelname = "Eff_" + v->getPath() + "_wrt_" + v->getDenomPath();
2068  std::string histoname(labelname+"");
2069  std::string title(labelname+"");
2070 
2071  double histEtaMax = 5.0;
2072  if (v->getObjectType() == trigger::TriggerMuon
2073  || v->getObjectType() == trigger::TriggerL1Mu) {
2074  histEtaMax = muonEtaMax_; nBins_ = 20 ;
2075  }
2076 
2077  else if (v->getObjectType() == trigger::TriggerJet
2078  || v->getObjectType() == trigger::TriggerL1CenJet
2079  || v->getObjectType() == trigger::TriggerL1ForJet ){
2080  histEtaMax = jetEtaMax_; nBins_ = 60 ;
2081  }
2082 
2083  else if (v->getObjectType() == trigger::TriggerMET
2084  || v->getObjectType() == trigger::TriggerL1ETM ) {
2085  histEtaMax = 5.0; nBins_ = 60 ;
2086  }
2087 
2088  TString pathfolder = dirname_ + foldernm + v->getPath();
2089  dbe_->setCurrentFolder(pathfolder.Data());
2090  if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
2091 
2092  //pathfolder = dirname_ + TString("/Eff/") + v->getPath();
2093  //int nBins2D = 10;
2094  histoname = labelname+"_Et_Eff";
2095  title = labelname+" E_t Eff";
2096  EtEff = dbe->book1D(histoname.c_str(),
2097  title.c_str(),nBins_,
2098  v->getPtMin(),
2099  v->getPtMax());
2100 
2101  histoname = labelname+"_Et_Num";
2102  title = labelname+" E_t Num";
2103  EtNum = dbe->book1D(histoname.c_str(),
2104  title.c_str(),nBins_,
2105  v->getPtMin(),
2106  v->getPtMax());
2107 
2108 
2109  histoname = labelname+"_Et_Denom";
2110  title = labelname+" E_t Denom";
2111  EtDenom = dbe->book1D(histoname.c_str(),
2112  title.c_str(),nBins_,
2113  v->getPtMin(),
2114  v->getPtMax());
2115 
2116  if ((v->getPath()).find("Jet") != std::string::npos
2117  || (v->getPath()).find("Mu") != std::string::npos) {
2118  histoname = labelname+"_Eta_Eff";
2119  title = labelname+" #eta Eff";
2120  EtaEff = dbe->book1D(histoname.c_str(),
2121  title.c_str(),
2122  nBins_,-histEtaMax,histEtaMax);
2123  histoname = labelname+"_Phi_Eff";
2124  title = labelname+" #phi Eff";
2125  PhiEff = dbe->book1D(histoname.c_str(),
2126  title.c_str(),
2127  nBins_,-TMath::Pi(), TMath::Pi());
2128 
2129  histoname = labelname+"_Eta_Num";
2130  title = labelname+" #eta Num";
2131  EtaNum = dbe->book1D(histoname.c_str(),
2132  title.c_str(),
2133  nBins_,-histEtaMax,histEtaMax);
2134  histoname = labelname+"_Phi_Num";
2135  title = labelname+" #phi Num";
2136  PhiNum = dbe->book1D(histoname.c_str(),
2137  title.c_str(),
2138  nBins_,-TMath::Pi(), TMath::Pi());
2139 
2140  histoname = labelname+"_Eta_Denom";
2141  title = labelname+" #eta Denom";
2142  EtaDenom = dbe->book1D(histoname.c_str(),
2143  title.c_str(),
2144  nBins_,-histEtaMax,histEtaMax);
2145  histoname = labelname+"_Phi_Denom";
2146  title = labelname+" #phi Denom";
2147  PhiDenom = dbe->book1D(histoname.c_str(),
2148  title.c_str(),
2149  nBins_,-TMath::Pi(), TMath::Pi());
2150  }
2151 
2152 
2153  else if( ((v->getPath()).find("MET") != std::string::npos)
2154  || ((v->getPath()).find("SumET") != std::string::npos) ){
2155 
2156  histoname = labelname+"_Phi_Eff";
2157  title = labelname+" #phi Eff";
2158  PhiEff = dbe->book1D(histoname.c_str(),
2159  title.c_str(),
2160  nBins_,-TMath::Pi(), TMath::Pi());
2161 
2162  histoname = labelname+"_Phi_Num";
2163  title = labelname+" #phi Num";
2164  PhiNum = dbe->book1D(histoname.c_str(),
2165  title.c_str(),
2166  nBins_,-TMath::Pi(), TMath::Pi());
2167 
2168  histoname = labelname+"_Phi_Denom";
2169  title = labelname+" #phi Denom";
2170  PhiDenom = dbe->book1D(histoname.c_str(),
2171  title.c_str(),
2172  nBins_,-TMath::Pi(), TMath::Pi());
2173 
2174  }
2175 
2176  v->setHistosEff( NEff, EtEff, EtaEff, PhiEff, NNum, EtNum, EtaNum, PhiNum, NDenom, EtDenom, EtaDenom, PhiDenom);
2177 
2178  }
2179  if (verbose_) std::cout << "Done booking histos for Efficiency " << std::endl;
2180  }
2181 //end from begin job
2182 
2183 
2184  if (verbose_) std::cout << "End BeginRun ---------------- " << std::endl;
2185 
2186 }
2187 
2188 //--------------------------------------------------------
2190  const EventSetup& context) {
2191 }
2192 //--------------------------------------------------------
2194  const EventSetup& context) {
2195 }
2196 // - method called once each job just after ending the event loop ------------
2197 void
2199  LogInfo("HLTJetMETDQMSource") << "analyzed " << nev_ << " events";
2200  return;
2201 }
2202 
2205  if (verbose_) std::cout << "endRun, run " << run.id() << std::endl;
2206 }
#define LogDebug(id)
unsigned int size() const
number of trigger paths in trigger table
const double Pi
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:204
void setBinContent(int binx, double content)
set content of bin (1-D)
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryToken_
RunID const & id() const
Definition: RunBase.h:41
const std::string moduleType(const std::string &module) const
C++ class name of module.
const std::string & triggerName(unsigned int triggerIndex) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2730
edm::EDGetTokenT< edm::TriggerResults > triggerResultsTokenFU_
edm::InputTag triggerSummaryLabel_
edm::InputTag triggerResultsLabel_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
enum start value shifted to 81 so as to avoid clashes with PDG codes
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)
PathInfoCollection hltPathsAll_
#define NULL
Definition: scimark2.h:8
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
const edm::ParameterSet & modulePSet(const std::string &module) const
ParameterSet of module.
T eta() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
void beginRun(const edm::Run &run, const edm::EventSetup &c)
int iEvent
Definition: GenABIO.cc:243
T sqrt(T t)
Definition: SSEVec.h:48
HLTConfigProvider hltConfig_
MonitorElement * rate_Denom
int j
Definition: DBlmapReader.cc:9
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
TH1F * getTH1F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
void setVerbose(unsigned level)
Definition: DQMStore.cc:548
static std::string const triggerResults
Definition: EdmProvDump.cc:41
HLTJetMETDQMSource(const edm::ParameterSet &)
PathInfoCollection hltPathswrtMu_
int k[5][pyjets_maxn]
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
DQM Client Diagnostic.
std::string custompathnamemu_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::vector< int > prescUsed_
#define N
Definition: blowfish.cc:9
std::vector< size_type > Keys
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryTokenFU_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
TH1F * getTH1F(void) const
void endRun(const edm::Run &run, const edm::EventSetup &c)
EndRun.
MonitorElement * rate_Eff
MonitorElement * rate_Num
std::string const & label() const
Definition: InputTag.h:42
std::string const & process() const
Definition: InputTag.h:46
PathInfoCollection hltPathsEff_
tuple cout
Definition: gather_cfg.py:121
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
std::string const & instance() const
Definition: InputTag.h:43
std::vector< int > Vids
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
Definition: Run.h:41
std::vector< std::pair< std::string, std::string > > custompathnamepairs_
Definition: DDAxes.h:10