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