CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/DQM/HLTEvF/plugins/HLTJetMETDQMSource.cc

Go to the documentation of this file.
00001 
00002 #include "TMath.h"
00003 #include "FWCore/Framework/interface/EDAnalyzer.h"
00004 #include "DataFormats/Common/interface/Handle.h"
00005 #include "FWCore/Framework/interface/Run.h"
00006 #include "FWCore/Framework/interface/MakerMacros.h"
00007 #include "FWCore/Framework/interface/ESHandle.h"
00008 
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010 #include "DQM/HLTEvF/interface/HLTJetMETDQMSource.h"
00011 
00012 #include "DataFormats/HLTReco/interface/TriggerObject.h"
00013 #include "FWCore/Common/interface/TriggerNames.h"
00014 #include "DataFormats/Common/interface/TriggerResults.h"
00015 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00016 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
00017 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00018 
00019 #include "DataFormats/Math/interface/deltaR.h"
00020 
00021 #include "DQMServices/Core/interface/MonitorElement.h"
00022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00023 #include "math.h"
00024 #include "TH1F.h"
00025 #include "TProfile.h"
00026 #include "TH2F.h"
00027 #include "TPRegexp.h"
00028 
00029 using namespace edm;
00030 using namespace std;
00031 
00032   
00033 HLTJetMETDQMSource::HLTJetMETDQMSource(const edm::ParameterSet& iConfig):
00034   resetMe_(true),
00035   currentRun_(-99) {
00036   LogDebug("HLTJetMETDQMSource") << "constructor....";
00037 
00038   dbe_ = Service < DQMStore > ().operator->();
00039   if ( ! dbe_ ) {
00040     LogDebug("HLTJetMETDQMSource") << "unabel to get DQMStore service?";
00041   }
00042   if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
00043     dbe_->setVerbose(0);
00044   }
00045   
00046   dirname_ = iConfig.getUntrackedParameter("dirname",
00047                                            std::string("HLT/JetMET/"));
00048   //dirname_ +=  iConfig.getParameter<std::string>("@module_label");
00049   
00050   if (dbe_ != 0 ) {
00051     dbe_->setCurrentFolder(dirname_);
00052   }
00053   //hltconfigchanged=false;
00054   
00055   processname_ = iConfig.getParameter<std::string>("processname");
00056   //HLTPathNamesConfigPreVal_= iConfig.getParameter<std::vector<std::string > >("HLTPaths"),
00057   verbose_     = iConfig.getUntrackedParameter< bool >("verbose", false);
00058   // plotting paramters
00059   ptMin_ = iConfig.getUntrackedParameter<double>("ptMin",0.);
00060   ptMax_ = iConfig.getUntrackedParameter<double>("ptMax",1000.);
00061   nBins_ = iConfig.getUntrackedParameter<unsigned int>("Nbins",50);
00062   
00063   plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", false);
00064   plotwrtMu_ = iConfig.getUntrackedParameter<bool>("plotwrtMu", false);
00065   plotEff_ = iConfig.getUntrackedParameter<bool>("plotEff", false);
00066   // this is the list of paths to look at.
00067   std::vector<edm::ParameterSet> paths =  iConfig.getParameter<std::vector<edm::ParameterSet> >("paths");
00068 
00069  
00070   for(std::vector<edm::ParameterSet>::iterator pathconf = paths.begin() ; pathconf != paths.end();  pathconf++) {
00071     std::pair<std::string, std::string> custompathnamepair;
00072     int prescaleused;
00073     custompathnamepair.first =pathconf->getParameter<std::string>("pathname"); 
00074     custompathnamepair.second = pathconf->getParameter<std::string>("denompathname");   
00075     custompathnamepairs_.push_back(custompathnamepair);
00076     //prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
00077     prescaleused = pathconf->getParameter<int>("prescaleused");  
00078     prescUsed_.push_back(prescaleused);
00079     //    customdenompathnames_.push_back(pathconf->getParameter<std::string>("denompathname"));  
00080     // custompathnames_.push_back(pathconf->getParameter<std::string>("pathname"));  
00081   }
00082 
00083   custompathnamemu_ = iConfig.getUntrackedParameter("pathnameMuon",
00084                                                     std::string("HLT_L1Mu"));
00085   
00086   triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
00087   triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
00088 
00089   muonEtaMax_ = iConfig.getUntrackedParameter<double>("muonEtaMax",2.5);
00090   muonEtMin_ = iConfig.getUntrackedParameter<double>("muonEtMin",0.0);
00091   muonDRMatch_  =iConfig.getUntrackedParameter<double>("muonDRMatch",0.3); 
00092 
00093   jetEtaMax_ = iConfig.getUntrackedParameter<double>("jetEtaMax",5.0);
00094   jetEtMin_ = iConfig.getUntrackedParameter<double>("jetEtMin",0.0);
00095   jetDRMatch_  =iConfig.getUntrackedParameter<double>("jetDRMatch",0.3); 
00096 
00097   metMin_ = iConfig.getUntrackedParameter<double>("metMin",0.0);
00098   htMin_ = iConfig.getUntrackedParameter<double>("htMin",0.0);
00099   sumEtMin_ = iConfig.getUntrackedParameter<double>("sumEtMin",0.0);    
00100   
00101 
00102 
00103 }
00104 
00105 
00106 HLTJetMETDQMSource::~HLTJetMETDQMSource() {
00107  
00108  
00109   //
00110   // do anything here that needs to be done at desctruction time
00111   // (e.g. close files, deallocate resources etc.)
00112 
00113 }
00114 
00115 
00116 void
00117 HLTJetMETDQMSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup){
00118   using namespace edm;
00119   using namespace trigger;
00120    
00121   ++nev_;
00122   if (verbose_) std::cout << " --------------- N Event ------------" << nev_ << std::endl; // LogDebug("HLTJetMETDQMSource")<< "HLTJetMETDQMSource: analyze...." ;
00123 
00124 
00125   
00126   
00127   //currun=iEvent.id().run();
00128   //if ( nev_==1) runno = iEvent.id().run();
00129   /*
00130   bool changed(true);
00131   if (hltConfig_.init(iEvent,processname_,changed)) {
00132     if (changed) {
00133       hltconfigchanged=true;
00134       //if(verbose_) 
00135       //hltConfig_.dump("Triggers");
00136       LogWarning("HLTJetMETDQMSource")  << "HLTJetMETDQMSource:analyze: The number of valid triggers has changed since beginning of job." << std::endl;
00137       //        << "Processing of events halted for summary histograms"  << std::endl;
00138       //<< "Summary histograms do not support changing configurations." << std::endl
00139      
00140     }
00141   }
00142    
00143   if ( hltConfig_.size() <= 0 ) {
00144     LogError("HLTJetMETDQMSource") << "HLT config size error" << std::endl;
00145     return;
00146   }
00147   // if ( currun != runno) runchanged=true;
00148   */
00149 
00150   
00151   edm::Handle<TriggerResults> triggerResults;
00152   iEvent.getByLabel(triggerResultsLabel_,triggerResults);
00153   if(!triggerResults.isValid()) {
00154     edm::InputTag triggerResultsLabelFU(triggerResultsLabel_.label(),triggerResultsLabel_.instance(), "FU");
00155     iEvent.getByLabel(triggerResultsLabelFU,triggerResults);
00156     if(!triggerResults.isValid()) {
00157       LogWarning("HLTJetMETDQMSource")  << "TriggerResults not found, skipping event" << std::endl; 
00158       return;
00159     }
00160   }
00161   const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
00162   unsigned int npath = triggerResults->size();
00163 
00164   edm::Handle<TriggerEvent> triggerObj;
00165   iEvent.getByLabel(triggerSummaryLabel_,triggerObj); 
00166   if(!triggerObj.isValid()) {
00167     edm::InputTag triggerSummaryLabelFU(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(), "FU");
00168     iEvent.getByLabel(triggerSummaryLabelFU,triggerObj);
00169     if(!triggerObj.isValid()) {
00170       LogWarning("HLTJetMETDQMSource")  << "TriggerEvent not found, skipping event" << std::endl; 
00171       return;
00172     }
00173   }
00174   //----plot all the ditributions for JET and MET -----------------------
00175 
00176 
00177   const trigger::TriggerObjectCollection & toc(triggerObj->getObjects());
00178 
00179 
00180   int testint=0;
00181   if (plotAll_) testint=1;
00182   if (verbose_) std::cout << " plots all  " <<  testint  << std::endl; 
00183   if (plotAll_) {
00184     if (verbose_) std::cout << " Look at basic distributions " << std::endl; 
00185     
00186     int N =-1;
00187     int NL1=-1;
00188    
00189   
00190     for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){ 
00191       NL1++;
00192       N++;
00193          
00194       int triggertype = 0;     
00195       triggertype = v->getObjectType();
00196       
00197       bool l1accept = false;
00198       edm::InputTag l1testTag(v->getl1Path(),"",processname_);
00199       const int l1index = triggerObj->filterIndex(l1testTag);
00200       if ( l1index >= triggerObj->sizeFilters() ) {
00201         if (verbose_) std::cout<< "no index "<< l1index << " of that name "
00202                                << v->getl1Path() << "\t" << "\t" << l1testTag << std::endl;
00203         continue;
00204       }
00205 
00206       const trigger::Vids & idtype = triggerObj->filterIds(l1index);
00207       const trigger::Keys & l1k = triggerObj->filterKeys(l1index);
00208       //if (verbose_) std::cout << "filterID "<< idtype << " keys " << l1k << std::endl;
00209       //if (verbose_) std::cout << " keys " << l1k << std::endl;
00210       l1accept = l1k.size() > 0;
00211       //if (l1accept) 
00212       //l1accept = true ;
00213      
00214       //
00215       //-----------------------------------------------------
00216 
00217       bool passed = false;
00218       for(unsigned int i = 0; i < npath; ++i) {
00219         if ( triggerNames.triggerName(i).find(v->getPath()) != std::string::npos  
00220              && triggerResults->accept(i)){
00221           passed = true;
00222           if (verbose_) std::cout << " i " << i << "  trigger name " << v->getPath() << std::endl;
00223           break;
00224         }
00225       }
00226       if(passed){
00227         
00228         //if(!hltconfigchanged) 
00229         //fill later//rate_All->Fill(N);
00230         
00231         if (verbose_) std::cout <<  "  N " << N << "  trigger name " << v->getPath() << std::endl;
00232                 
00233         if (!l1accept) {
00234           edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "
00235                                              << v->getPath() << "\t" << v->getl1Path();
00236         }
00237         edm::InputTag filterTag = v->getTag();
00238         
00239         //const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00240         
00241         if (v->getLabel() == "dummy"){
00242           const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00243           //loop over labels
00244           
00245           for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); 
00246                labelIter!=filterLabels.end(); labelIter++)  {           
00247             edm::InputTag testTag(*labelIter,"",processname_);
00248             if (verbose_) std::cout << v->getPath() << "\t" << testTag.label() << "\t" 
00249                                << testTag.process() << std::endl;
00250             int testindex = triggerObj->filterIndex(testTag);
00251           
00252             if ( !(testindex >= triggerObj->sizeFilters()) ) {
00253               if (verbose_) std::cout << "found one! " << v->getPath() << "\t" 
00254                                  << testTag.label() << std::endl; 
00255               filterTag = testTag; 
00256               v->setLabel(*labelIter);
00257             }
00258           }
00259         }
00260         const int index = triggerObj->filterIndex(filterTag);
00261         if (verbose_)      std::cout << "filter index "<< index << " of that name " 
00262                                 << filterTag << std::endl;
00263         if ( index >= triggerObj->sizeFilters() ) {
00264           if (verbose_)      std::cout << "WTF no index "<< index << " of that name " 
00265                                   << filterTag << std::endl;
00266           continue; // 
00267         }
00268         const trigger::Keys & k = triggerObj->filterKeys(index);
00269         
00270         for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00271           if (verbose_) cout << " filling HLT " <<  v->getPath() << "\t" << toc[*ki].pt() 
00272                              << "\t" << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
00273           if ( triggertype == trigger::TriggerJet 
00274                || triggertype == trigger::TriggerL1TauJet 
00275                || triggertype == trigger::TriggerL1CenJet 
00276                || triggertype == trigger::TriggerL1ForJet)
00277             {
00278               if (verbose_)     cout << " filling HLT " <<  v->getPath() << "\t" 
00279                                      << "  *ki  " << *ki << " Nki   "<< N<< " " 
00280                                      << toc[*ki].pt() << "\t" << toc[*ki].eta() << "\t"
00281                                      << toc[*ki].phi() << std::endl;
00282                       
00283               v->getEtHisto()->Fill(toc[*ki].pt());
00284               v->getEtaHisto()->Fill(toc[*ki].eta());
00285               v->getPhiHisto()->Fill(toc[*ki].phi());
00286               v->getEtaPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00287               
00288               //---L1 Histograms
00289               trigger::Vids::const_iterator idtypeiter = idtype.begin(); 
00290               for (trigger::Keys::const_iterator l1ki = l1k.begin(); 
00291                    l1ki !=l1k.end(); ++l1ki ) {
00292                 if (*idtypeiter == trigger::TriggerL1TauJet 
00293                     || *idtypeiter == trigger::TriggerL1ForJet 
00294                     || *idtypeiter == trigger::TriggerL1CenJet)
00295                   {
00296                     if (verbose_)       cout << " filling L1 HLT " <<  v->getPath() 
00297                                              << "\t" << "  *l1ki  " << *l1ki << " NL1   "
00298                                              << NL1<< " " << toc[*l1ki].pt() << "\t" 
00299                                              << toc[*l1ki].eta() << "\t" << toc[*l1ki].phi() 
00300                                              << std::endl;
00301                     if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3){
00302                       //if(!hltconfigchanged)
00303                       //fill later//rate_All_L1->Fill(NL1);
00304                    
00305                     v->getL1EtHisto()->Fill(toc[*l1ki].pt());
00306                     v->getL1PhiHisto()->Fill(toc[*l1ki].phi());
00307                     v->getL1EtaHisto()->Fill(toc[*l1ki].eta());
00308                     v->getL1EtaPhiHisto()->Fill(toc[*l1ki].eta(),toc[*l1ki].phi());
00309                     }
00310                    
00311 
00312                   }
00313                 ++idtypeiter;
00314               }//end L1
00315               
00316             }
00317           
00318           //----------------------------
00319           else if (triggertype == trigger::TriggerMuon 
00320                    ||triggertype == trigger::TriggerL1Mu  )
00321             {
00322               if (verbose_)     cout << " filling HLT " <<  v->getPath() << "\t" << "  *ki  " 
00323                                      << *ki << " Nki   "<< N << " " << toc[*ki].pt() 
00324                                      << "\t" << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
00325           
00326               v->getEtHisto()->Fill(toc[*ki].pt());
00327               //v->getEtaHisto()->Fill(toc[*ki].eta());
00328               //v->getPhiHisto()->Fill(toc[*ki].phi());
00329               v->getEtaPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00330          
00331               //---L1 Histograms
00332               trigger::Vids::const_iterator idtypeiter = idtype.begin(); 
00333               for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
00334                 if (*idtypeiter == trigger::TriggerL1Mu)
00335                   {
00336                     if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3) {
00337 
00338                       //if(!hltconfigchanged)
00339                       //fill later//rate_All_L1->Fill(NL1);
00340                    
00341                   v->getL1EtHisto()->Fill(toc[*l1ki].pt());
00342                     //v->getL1PhiHisto()->Fill(toc[*l1ki].phi()());
00343                     //v->getL1EtaHisto()->Fill(toc[*l1ki].eta()());
00344                     v->getL1EtaPhiHisto()->Fill(toc[*l1ki].eta(),toc[*l1ki].phi());
00345                     }
00346                   }
00347                 ++idtypeiter;
00348               }//end L1
00349             
00350             
00351             }
00352           //--------------------------------------
00353           else if ( triggertype == trigger::TriggerMET 
00354                     || triggertype == trigger::TriggerL1ETM
00355                     || triggertype == trigger::TriggerTET){
00356             
00357             v->getEtHisto()->Fill(toc[*ki].pt());
00358             v->getPhiHisto()->Fill(toc[*ki].phi());
00359            
00360             //---L1 Histograms
00361             trigger::Vids::const_iterator idtypeiter = idtype.begin(); 
00362             for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
00363               if (*idtypeiter == trigger::TriggerL1ETM)
00364                 {
00365                   if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3) {
00366                   //NL1[npth]++;
00367                   //if(!hltconfigchanged) 
00368                     //fill later//rate_All_L1->Fill(NL1);
00369                   v->getL1EtHisto()->Fill(toc[*l1ki].pt());
00370                   v->getL1PhiHisto()->Fill(toc[*l1ki].phi());
00371                   }
00372                 }
00373               ++idtypeiter;
00374             }//end L1
00375            
00376           }
00377           //-------------------------------------------
00378           else if ( triggertype == trigger::TriggerTET 
00379                     || triggertype == trigger::TriggerL1ETT){
00380             
00381             v->getEtHisto()->Fill(toc[*ki].pt());
00382             v->getPhiHisto()->Fill(toc[*ki].phi());
00383             //---L1 Histograms
00384             trigger::Vids::const_iterator idtypeiter = idtype.begin(); 
00385             for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
00386               if (*idtypeiter == TriggerL1ETT)
00387                 {
00388                  
00389                   if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3) {
00390                   //NL1[npth]++;
00391                   //if(!hltconfigchanged) 
00392                     //fill later//rate_All_L1->Fill(NL1);
00393                   v->getL1EtHisto()->Fill(toc[*l1ki].pt());
00394                   v->getL1PhiHisto()->Fill(toc[*l1ki].phi());
00395                   }
00396                 }
00397               ++idtypeiter;
00398             }//end L1
00399           }
00400         }
00401         
00402       }//ifpassed 
00403     } 
00404   }//----------------- end if plotAll
00405             
00406   //----plot all the ditributions for JET and MET with respect to a muon trigger --------------
00407   if (plotwrtMu_) {
00408 
00409     // if (verbose_) std::cout  << " Look at basic distributions with respect to muon " << std::endl; 
00410     int N =-1;
00411     int NL1=-1;
00412     for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ){ 
00413       NL1++;
00414       N++;
00415       int triggertype = 0;     
00416       triggertype = v->getObjectType();
00417       
00418       bool l1accept = false;
00419       edm::InputTag l1testTag(v->getl1Path(),"",processname_);
00420       const int l1index = triggerObj->filterIndex(l1testTag);
00421       if ( l1index >= triggerObj->sizeFilters() ) {
00422         if (verbose_) std::cout<< "no index "<< l1index << " of that name (wrtMu)" << v->getl1Path() << "\t" << "\t" << l1testTag << std::endl;
00423         continue;
00424       }
00425 
00426       //const trigger::Vids & idtype = triggerObj->filterIds(l1index);
00427       const trigger::Keys & l1k = triggerObj->filterKeys(l1index);
00428       //if (verbose_) std::cout << "filterID "<< idtype << " keys " << l1k << std::endl;
00429       //if (verbose_) std::cout << " keys " << l1k << std::endl;
00430       l1accept = l1k.size() > 0;
00431       //if (l1accept) rate_All_L1->Fill(NL1);
00432       //l1accept = true ;
00433       //
00434       //-----------------------------------------------------
00435       bool denompassed = false;
00436       bool passed = false;
00437       for(unsigned int i = 0; i < npath; ++i) {
00438         if ( triggerNames.triggerName(i).find(v->getPath()) != std::string::npos  && triggerResults->accept(i)){
00439           passed = true; break ;
00440         }
00441       }
00442       for(unsigned int i = 0; i < npath; ++i) {
00443         if ( triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos  && triggerResults->accept(i)){
00444           denompassed = true; break ;
00445         }
00446       }
00447       if(denompassed){
00448 
00449         if (verbose_) std::cout <<  "  N " << N << "  trigger wrt mu demom name " 
00450                            << v->getDenomPath() << std::endl;
00451         if(passed){
00452 
00453           //if(!hltconfigchanged)
00454           //fill later//rate_wrtMu->Fill(N);
00455         
00456           if (verbose_) std::cout <<  "  N " << N << "  trigger name " 
00457                              << v->getPath() << std::endl;
00458                 
00459           if (!l1accept) {
00460             edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "
00461                                                << v->getPath() << "\t" << v->getl1Path();
00462           }
00463           edm::InputTag filterTag = v->getTag();
00464           //const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00465           if (v->getLabel() == "dummy"){
00466             const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00467             //loop over labels
00468 
00469             for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++)  {               
00470               edm::InputTag testTag(*labelIter,"",processname_);
00471               if (verbose_) std::cout << v->getPath() << "\t" << testTag.label() << "\t" << testTag.process() << std::endl;
00472           
00473               int testindex = triggerObj->filterIndex(testTag);
00474           
00475               if ( !(testindex >= triggerObj->sizeFilters()) ) {
00476                 if (verbose_) std::cout << "found one! " << v->getPath() << "\t" << testTag.label() << std::endl; 
00477                 filterTag = testTag; 
00478                 v->setLabel(*labelIter);
00479               }
00480             }
00481           }
00482           const int index = triggerObj->filterIndex(filterTag);
00483           if (verbose_)      std::cout << "filter index "<< index << " of that name (wrtMu)" 
00484                                   << filterTag << std::endl;
00485           if ( index >= triggerObj->sizeFilters() ) {
00486             if (verbose_)      std::cout << "WTF no index "<< index << " of that name (wrtMu)" 
00487                                     << filterTag << std::endl;
00488             continue; // 
00489           }
00490           const trigger::Keys & k = triggerObj->filterKeys(index);
00491         
00492           for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00493                           
00494             if (verbose_)       cout << " filling HLT (wrtMu)" <<  v->getPath() 
00495                                      << "\t" << toc[*ki].pt() << "\t" << toc[*ki].eta()
00496                                      << "\t" << toc[*ki].phi() << std::endl;
00497             if ( triggertype == trigger::TriggerJet 
00498                  || triggertype == trigger::TriggerL1TauJet 
00499                  || triggertype == trigger::TriggerL1CenJet 
00500                  || triggertype == trigger::TriggerL1ForJet)
00501               {
00502                 if (verbose_)   cout << " filling HLT (wrtMu)" <<  v->getPath() 
00503                                      << "\t" << "  *ki  " << *ki << " Nki   "<< N
00504                                      << " " << toc[*ki].pt() << "\t" << toc[*ki].eta() 
00505                                      << "\t" << toc[*ki].phi() << std::endl;
00506                 v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
00507                 //v->getEtawrtMuHisto()->Fill(toc[*ki].eta());
00508                 //v->getPhiwrtMuHisto()->Fill(toc[*ki].phi());
00509                 v->getEtaPhiwrtMuHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00510               }
00511           
00512             //----------------------------
00513             else if (triggertype == trigger::TriggerMuon 
00514                      ||triggertype == trigger::TriggerL1Mu  )
00515               {
00516                 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;
00517                 v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
00518                 //v->getEtaHisto()->Fill(toc[*ki].eta());
00519                 //v->getPhiHisto()->Fill(toc[*ki].phi());
00520                 v->getEtaPhiwrtMuHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00521               }
00522             //--------------------------------------
00523             else if ( triggertype == trigger::TriggerMET 
00524                       || triggertype == trigger::TriggerL1ETM)
00525               {
00526               v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
00527               v->getPhiwrtMuHisto()->Fill(toc[*ki].phi());
00528             }
00529             //-------------------------------------------
00530             else if ( triggertype == trigger::TriggerTET 
00531                       || triggertype == trigger::TriggerL1ETT)
00532               {
00533               v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
00534               }
00535           }
00536         
00537         }//ifpassed 
00538       }//if denom passed
00539     } 
00540   }//----------------- end if plowrtMu
00541   //----------plot efficiency---------------
00542   
00543   if (plotEff_) {
00544     if (verbose_) std::cout << " Look at basic distributions for Eff " << std::endl; 
00545     
00546     int N =-1;
00547     int Ndenom =-1;
00548     int Nnum =-1;
00549     for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ){ 
00550       Ndenom++;
00551       Nnum++;
00552       N++;
00553       int triggertype = 0;     
00554       triggertype = v->getObjectType();
00555       
00556       bool l1accept = false;
00557       edm::InputTag l1testTag(v->getl1Path(),"",processname_);
00558       const int l1index = triggerObj->filterIndex(l1testTag);
00559       if ( l1index >= triggerObj->sizeFilters() ) {
00560         if (verbose_) std::cout<< "no index "<< l1index << " of that name " 
00561                                << v->getl1Path() << "\t" << "\t" << l1testTag << std::endl;
00562         continue;
00563       }
00564       //const trigger::Vids & idtype = triggerObj->filterIds(l1index);
00565       const trigger::Keys & l1k = triggerObj->filterKeys(l1index);
00566       //if (verbose_) std::cout << "filterID "<< idtype << " keys " << l1k << std::endl;
00567       //if (verbose_) std::cout << " keys " << l1k << std::endl;
00568       l1accept = l1k.size() > 0;
00569       bool passed = false;
00570       for(unsigned int i = 0; i < npath; ++i) {
00571         if ( triggerNames.triggerName(i).find(v->getPath()) != std::string::npos  
00572              && triggerResults->accept(i)){
00573           passed = true;
00574           if (verbose_) std::cout << " i " << i << "  trigger name " << v->getPath() << std::endl;
00575           break;
00576         }
00577       }
00578       bool denompassed = false;
00579       for(unsigned int i = 0; i < npath; ++i) {
00580         if ( triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos  
00581              && triggerResults->accept(i)){
00582           denompassed = true;
00583           if (verbose_) std::cout << " i " << i << "  trigger name " << v->getDenomPath() << std::endl;
00584           break;
00585         }
00586       }
00587       if (denompassed){
00588         //if(!hltconfigchanged)
00589         //fill later//rate_Denom->Fill(Ndenom);
00590         if (verbose_) std::cout <<  "  N " << N << "  trigger name " << v->getDenomPath() << std::endl;
00591         
00592         if (!l1accept) {
00593           edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "
00594                                              << v->getPath() << "\t" << v->getl1Path();
00595         }
00596         edm::InputTag filterTag = v->getDenomTag();
00597         //const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00598         if (verbose_) std::cout << v->getDenomPath() << "\t" << v->getDenomLabel() << "\t"  << std::endl;
00599         if (v->getDenomLabel() == "denomdummy"){
00600           const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getDenomPath());
00601           //loop over labels
00602           for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++)  {         
00603             edm::InputTag testTag(*labelIter,"",processname_);
00604             if (verbose_) std::cout << v->getDenomPath() << "\t" << testTag.label() << "\t" 
00605                                << testTag.process() << std::endl;
00606             int testindex = triggerObj->filterIndex(testTag);
00607             if ( !(testindex >= triggerObj->sizeFilters()) ) {
00608               if (verbose_) std::cout << "found one! " << v->getDenomPath() << "\t" 
00609                                  << testTag.label() << std::endl; 
00610               filterTag = testTag; 
00611               v->setDenomLabel(*labelIter);
00612             }
00613           }
00614         }
00615         const int index = triggerObj->filterIndex(filterTag);
00616         if (verbose_)      std::cout << "filter index "<< index << " of that name " 
00617                                 << filterTag << std::endl;
00618         if ( index >= triggerObj->sizeFilters() ) {
00619           if (verbose_)      std::cout << "WTF no index "<< index << " of that name " 
00620                                   << filterTag << std::endl;
00621           continue; // 
00622         }
00623         const trigger::Keys & k = triggerObj->filterKeys(index);
00624         int numobj=-1;
00625         for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00626           if (verbose_) cout << " filling HLT Denom " <<  v->getDenomPath() << "\t" 
00627                              << toc[*ki].pt() << "\t" << toc[*ki].eta() << "\t" 
00628                              << toc[*ki].phi() << std::endl;
00629           if ( triggertype == trigger::TriggerJet 
00630                || triggertype == trigger::TriggerL1TauJet 
00631                || triggertype == trigger::TriggerL1CenJet 
00632                || triggertype == trigger::TriggerL1ForJet)
00633             {
00634               if (verbose_)     cout << " filling HLT Denom" <<  v->getDenomPath() 
00635                                      << "\t" << "  *kiDeno  " << *ki << " NkiDenom   "
00636                                      << Ndenom<< " " << toc[*ki].pt() << "\t" 
00637                                      << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
00638                       
00639               numobj=*ki;
00640               v->getEtDenomHisto()->Fill(toc[*ki].pt());
00641               v->getEtaDenomHisto()->Fill(toc[*ki].eta());
00642               v->getPhiDenomHisto()->Fill(toc[*ki].phi());
00643             }
00644           //--------------------------------------
00645           else if ( triggertype == trigger::TriggerMET 
00646                     || triggertype == trigger::TriggerL1ETM
00647                     || triggertype == trigger::TriggerTET){
00648             v->getEtDenomHisto()->Fill(toc[*ki].pt());
00649             v->getPhiDenomHisto()->Fill(toc[*ki].phi());
00650           }
00651           //-------------------------------------------
00652           else if ( triggertype == trigger::TriggerTET 
00653                     || triggertype == trigger::TriggerL1ETT){
00654             v->getEtDenomHisto()->Fill(toc[*ki].pt());
00655             v->getPhiDenomHisto()->Fill(toc[*ki].phi());
00656           }
00657           if ( numobj != -1) break;
00658         }
00659                 
00660       }//if denom passed
00661       if(denompassed){
00662         if (passed){
00663           //if(!hltconfigchanged) 
00664           //fill later//rate_Num->Fill(Nnum);
00665           if (verbose_) std::cout <<  "  N " << N << "  trigger name " << v->getPath() << std::endl;
00666           if (!l1accept) {
00667             edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "<< v->getPath() << "\t" << v->getl1Path();
00668           }
00669           edm::InputTag filterTag = v->getTag();
00670           //const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00671           if (verbose_) std::cout << v->getPath() << "\t" << v->getLabel()  << std::endl;
00672           if (v->getLabel() == "dummy"){
00673             const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00674             //loop over labels
00675             for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++)  {               
00676               edm::InputTag testTag(*labelIter,"",processname_);
00677               if (verbose_) std::cout << v->getPath() << "\t" << testTag.label() << "\t" 
00678                                  << testTag.process() << std::endl;
00679               int testindex = triggerObj->filterIndex(testTag);
00680               if ( !(testindex >= triggerObj->sizeFilters()) ) {
00681                 if (verbose_) std::cout << "found one! " << v->getPath() << "\t" 
00682                                    << testTag.label() << std::endl;         
00683                 filterTag = testTag; 
00684                 v->setLabel(*labelIter);
00685               }
00686             }
00687           }
00688           const int index = triggerObj->filterIndex(filterTag);
00689           if (verbose_)      std::cout << "filter index "<< index << " of that name " 
00690                                   << filterTag << std::endl;
00691           if ( index >= triggerObj->sizeFilters() ) {
00692             if (verbose_)      std::cout << "WTF no index "<< index << " of that name " 
00693                                     << filterTag << std::endl;
00694             continue; // 
00695           }
00696           const trigger::Keys & k = triggerObj->filterKeys(index);
00697           int numobj = -1;
00698           for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00699                   
00700             if (verbose_)       cout << " filling HLT  " <<  v->getPath() << "\t"
00701                                      << toc[*ki].pt() << "\t" << toc[*ki].eta() 
00702                                      << "\t" << toc[*ki].phi() << std::endl;
00703             if ( triggertype == trigger::TriggerJet 
00704                  || triggertype == trigger::TriggerL1TauJet 
00705                  || triggertype == trigger::TriggerL1CenJet 
00706                  || triggertype == trigger::TriggerL1ForJet)
00707               {
00708                 if (verbose_)   cout << " filling HLT " <<  v->getPath() << "\t"
00709                                      << "  *ki  " << *ki << " Nki   "<< N<< " " 
00710                                      << toc[*ki].pt() << "\t" << toc[*ki].eta() 
00711                                      << "\t" << toc[*ki].phi() << std::endl;
00712                 numobj=*ki;
00713                 v->getEtNumHisto()->Fill(toc[*ki].pt());
00714                 v->getEtaNumHisto()->Fill(toc[*ki].eta());
00715                 v->getPhiNumHisto()->Fill(toc[*ki].phi());
00716               }
00717             //--------------------------------------
00718             else if ( triggertype == trigger::TriggerMET 
00719                       || triggertype == trigger::TriggerL1ETM
00720                       || triggertype == trigger::TriggerTET){
00721               v->getEtNumHisto()->Fill(toc[*ki].pt());
00722               v->getPhiNumHisto()->Fill(toc[*ki].phi());
00723             }
00724             //-------------------------------------------
00725             else if ( triggertype == trigger::TriggerTET 
00726                       || triggertype == trigger::TriggerL1ETT){
00727               v->getEtNumHisto()->Fill(toc[*ki].pt());
00728               v->getPhiNumHisto()->Fill(toc[*ki].phi());
00729             }
00730             if ( numobj != -1) break;
00731           }
00732         }//end if passed
00733       } //if denompassed
00734     }
00735     //----------plot efficiency---------------
00736     if ( (nev_ % 1000) == 0 ){
00737       if (verbose_) std::cout << " Calculating Eff.... " << nev_ << std::endl;   
00738 
00739       //if (nev_ % 1000)
00740       //if (verbose_) std::cout << "starting the luminosity block -----" << std::endl;
00741    
00742       TH1F *rate_denom=NULL;
00743       TH1F *rate_num=NULL;
00744       rate_denom = rate_Denom->getTH1F(); 
00745       rate_num   = rate_Num->getTH1F(); 
00746       //rate_denom->Sumw2();rate_num->Sumw2();
00747       if ((rate_denom->Integral() != 0.)  && (rate_num->Integral() != 0.) ) {
00748         if (verbose_) std::cout << " Nonzero rate summary  -----" << std::endl;
00749         for(int j=1; j <= rate_denom->GetXaxis()->GetNbins();j++ ){
00750           double y1 = rate_num->GetBinContent(j);
00751           double y2 = rate_denom->GetBinContent(j);
00752           double eff = y2 > 0. ? y1/y2 : 0.;
00753           rate_Eff->setBinContent(j, eff);
00754           double y1err = rate_num->GetBinError(j);
00755           double y2err = rate_denom->GetBinError(j);
00756           double efferr = 0.0;
00757               
00758           if (y2 && y1  > 0.) efferr =  (y1/y2)* sqrt ((y1err/y1)*(y1err/y1) 
00759                                                        + (y2err/y2)*(y2err/y2)) ;
00760           rate_Eff->setBinError(j, efferr);
00761         }
00762       }
00763       for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ) { 
00764         int triggertype = 0;     
00765         triggertype = v->getObjectType();
00766         if (verbose_) std::cout << " triggertype -----  " << triggertype << std::endl;
00767         if ( triggertype == trigger::TriggerJet 
00768              || triggertype == trigger::TriggerL1TauJet
00769              || triggertype == trigger::TriggerL1CenJet
00770              || triggertype == trigger::TriggerL1ForJet
00771              || triggertype == trigger::TriggerL1Mu
00772              || triggertype == trigger::TriggerMuon ){  
00773           TH1F *EtNum=NULL;
00774           TH1F *EtaNum=NULL;
00775           TH1F *PhiNum=NULL;
00776           TH1F *EtDenom=NULL;
00777           TH1F *EtaDenom=NULL;
00778           TH1F *PhiDenom=NULL;
00779         
00780           EtNum= ( v->getEtNumHisto())->getTH1F() ;
00781           EtaNum= ( v->getEtaNumHisto())->getTH1F() ;
00782           PhiNum= ( v->getPhiNumHisto())->getTH1F() ;
00783           EtDenom= ( v->getEtDenomHisto())->getTH1F() ;
00784           EtaDenom= ( v->getEtaDenomHisto())->getTH1F() ;
00785           PhiDenom= ( v->getPhiDenomHisto())->getTH1F() ;
00786                   
00787           if ((EtNum->Integral() != 0.)  && (EtDenom->Integral() != 0.) ) {
00788             if (verbose_) std::cout << " Nonzero Jet Et  -----" << std::endl;
00789             for(int j=1; j <= EtNum->GetXaxis()->GetNbins();j++ ){
00790               double y1 = EtNum->GetBinContent(j);
00791               double y2 = EtDenom->GetBinContent(j);
00792               double eff = y2 > 0. ? y1/y2 : 0.;
00793               
00794               v->getEtEffHisto()->setBinContent(j, eff);
00795               double y1err = EtNum->GetBinError(j);
00796               double y2err = EtDenom->GetBinError(j);
00797               double efferr = 0.0;
00798               
00799               if (y2 && y1  > 0.) efferr =  (y1/y2)* sqrt ((y1err/y1)*(y1err/y1) 
00800                                                            + (y2err/y2)*(y2err/y2)) ;
00801               v->getEtEffHisto()->setBinError(j, efferr);
00802 
00803               if(verbose_) std::cout << eff << " "<<  efferr << " " 
00804                                 << y1 << " " << y2 << " "<< y1err << " " << y2err << std::endl;
00805             }
00806           }
00807 
00808           if (EtaNum->Integral() != 0.  && EtaDenom->Integral() != 0. ) {
00809             for(int j=1; j <= EtaNum->GetXaxis()->GetNbins();j++ ){
00810               double y1 = EtaNum->GetBinContent(j);
00811               double y2 = EtaDenom->GetBinContent(j);
00812               double eff = y2 > 0. ? y1/y2 : 0.;
00813               v->getEtaEffHisto()->setBinContent(j, eff);
00814               double y1err = EtaNum->GetBinError(j);
00815               double y2err = EtaDenom->GetBinError(j);
00816               double efferr = 0.0;
00817               
00818               if (y2 && y1  > 0.) efferr =  (y1/y2)* sqrt ((y1err/y1)*(y1err/y1) 
00819                                                            + (y2err/y2)*(y2err/y2)) ;
00820               v->getEtaEffHisto()->setBinError(j, efferr);
00821               //            
00822             }
00823           }
00824           if (PhiNum->Integral() != 0.  && PhiDenom->Integral() != 0. ) {
00825             for(int j=1; j <= PhiNum->GetXaxis()->GetNbins();j++ ){
00826               double y1 = PhiNum->GetBinContent(j);
00827               double y2 = PhiDenom->GetBinContent(j);
00828               double eff = y2 > 0. ? y1/y2 : 0.;
00829               v->getPhiEffHisto()->setBinContent(j, eff);
00830               double y1err = PhiNum->GetBinError(j);
00831               double y2err = PhiDenom->GetBinError(j);
00832               double efferr = 0.0;
00833               if (y2 && y1  > 0.) efferr =  (y1/y2)* sqrt ((y1err/y1)*(y1err/y1) 
00834                                                            + (y2err/y2)*(y2err/y2)) ;
00835               v->getPhiEffHisto()->setBinError(j, efferr);
00836               //            
00837             }
00838           }
00839         }
00840         if ( triggertype == trigger::TriggerMET
00841              || triggertype == trigger::TriggerTET ){
00842           TH1F *EtNum=NULL;
00843           TH1F *PhiNum=NULL;
00844           TH1F *EtDenom=NULL;
00845           TH1F *PhiDenom=NULL;
00846           EtNum= ( v->getEtNumHisto())->getTH1F() ;
00847           PhiNum= ( v->getPhiNumHisto())->getTH1F() ;
00848           EtDenom= ( v->getEtDenomHisto())->getTH1F() ;
00849           PhiDenom= ( v->getPhiDenomHisto())->getTH1F() ;
00850           
00851           if (EtNum->Integral() != 0.  && EtDenom->Integral() != 0. ) {
00852             if (verbose_) std::cout << " Nonzero Met Et  -----" << std::endl;
00853             for(int j=1; j <= EtNum->GetXaxis()->GetNbins();j++ ){
00854               double y1 = EtNum->GetBinContent(j);
00855               double y2 = EtDenom->GetBinContent(j);
00856               double eff = y2 > 0. ? y1/y2 : 0.;
00857               v->getEtEffHisto()->setBinContent(j, eff);
00858               double y1err = EtNum->GetBinError(j);
00859               double y2err = EtDenom->GetBinError(j);
00860               double efferr = 0.0;
00861               
00862               if (y2 && y1  > 0.) efferr =  (y1/y2)* sqrt ((y1err/y1)*(y1err/y1) 
00863                                                            + (y2err/y2)*(y2err/y2)) ;
00864               v->getEtEffHisto()->setBinError(j, efferr);
00865             }
00866           }
00867           if (PhiNum->Integral() != 0.  && PhiDenom->Integral() != 0. ) {
00868 
00869             for(int j=1; j <= PhiNum->GetXaxis()->GetNbins();j++ ){
00870               double y1 = PhiNum->GetBinContent(j);
00871               double y2 = PhiDenom->GetBinContent(j);
00872               double eff = y2 > 0. ? y1/y2 : 0.;
00873               v->getPhiEffHisto()->setBinContent(j, eff);
00874               double y1err = PhiNum->GetBinError(j);
00875               double y2err = PhiDenom->GetBinError(j);
00876               double efferr = 0.0;
00877               
00878               if (y2 && y1  > 0.) efferr =  (y1/y2)* sqrt ((y1err/y1)*(y1err/y1) 
00879                                                            + (y2err/y2)*(y2err/y2)) ;
00880               v->getPhiEffHisto()->setBinError(j, efferr);
00881             }
00882           }
00883         }// met triggers
00884       }
00885     }
00886   }
00887 }
00888 
00889 // -- method called once each job just before starting event loop  --------
00890 
00891 void 
00892 HLTJetMETDQMSource::beginJob(){
00893   nev_ = 0;
00894   DQMStore *dbe = 0;
00895   dbe = Service<DQMStore>().operator->();
00896   if (dbe) {
00897     dbe->setCurrentFolder(dirname_);
00898     dbe->rmdir(dirname_);
00899   }
00900   if (dbe) {
00901     dbe->setCurrentFolder(dirname_);
00902   }
00903   /*
00904  hltconfigchanged=false;
00905   //if (!hltConfig_.init(processname_)) {
00906   if (!hltConfig_.init(run, c, processname_, hltconfigchanged)) {
00907     processname_ = "FU";
00908     // if (!hltConfig_.init(processname_)){
00909     if (!hltConfig_.init(run, c, processname_, hltconfigchanged)) 
00910       LogError("HLTJetMETDQMSource") << "HLTConfigProvider failed to initialize." << std::endl;
00911     }
00912     //  hltConfig_.dump("Triggers");
00913   }
00914   const unsigned int n(hltConfig_.size());
00915   if (verbose_) std::cout << " hltConfig_.size()  " << n << std::endl;
00916   //-------------if plot all jetmet trigger pt,eta, phi-------------------
00917   if (plotAll_){
00918     if (verbose_) std::cout << " booking histos All " << std::endl;
00919     std::string foldernm = "/All/";
00920     
00921     if (dbe) {
00922     
00923       dbe->setCurrentFolder(dirname_ + foldernm);
00924     }
00925     for (unsigned int j=0; j!=n; ++j) {
00926       std::string pathname = hltConfig_.triggerName(j);  
00927       std::string l1pathname = "dummy";
00928       //for (unsigned int i=0; i!=n; ++i) {
00929       // std::cout << hltConfig_.triggerName(i) << std::endl;
00930     
00931       //std::string denompathname = hltConfig_.triggerName(i);  
00932       std::string denompathname = "";  
00933       unsigned int usedPresscale = 1;  
00934       unsigned int objectType = 0;
00935       //int denomobjectType = 0;
00936       //parse pathname to guess object type
00937       
00938       if ( pathname.find("Mu") && (pathname=="HLT_L1MuOpen")) 
00939         objectType = trigger::TriggerMuon; 
00940       else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;    
00941       else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;    
00942       else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;    
00943       else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;    
00944       //if (pathname.find("HLT_Jet30") != std::string::npos) objectType = trigger::TriggerJet;    
00945       //if (pathname.find("HLT_Jet50") != std::string::npos) objectType = trigger::TriggerJet;    
00946       //if ((pathname.find("HLT_Mu3") != std::string::npos) || (pathname.find("HLT_L2Mu9") != std::string::npos)  ) objectType = trigger::TriggerMuon;    
00947       
00948       else continue;
00949       //std::cout << "objecttye " << objectType << std::endl;
00950       // find L1 condition for numpath with numpath objecttype 
00951 
00952       // find PSet for L1 global seed for numpath, 
00953       // list module labels for numpath
00954       std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
00955     
00956       for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
00957           numpathmodule!= numpathmodules.end(); 
00958           ++numpathmodule ) {
00959      
00960         //  std::cout << pathname << "\t" << *numpathmodule << "\t" 
00961         //<< hltConfig_.moduleType(*numpathmodule) << std::endl;
00962         if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
00963           edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
00964           //std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
00965           //  l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
00966           l1pathname = *numpathmodule; 
00967           break; 
00968         }
00969       } 
00970       std::string filtername("dummy");
00971       std::string Denomfiltername("denomdummy");
00972       float ptMin = 0.0;
00973       float ptMax = 300.0;
00974       if (objectType != 0 )
00975         hltPathsAll_.push_back(PathInfo(usedPresscale, denompathname,
00976                                         pathname, l1pathname, filtername,
00977                                         Denomfiltername, processname_, 
00978                                         objectType, ptMin, ptMax));
00979     }
00980     std::string histonm="JetMET_rate_All";
00981     std::string histonmL1="JetMET_rate_All_L1";
00982     std::string histot="JetMET Rate Summary";
00983     std::string histoL1t="JetMET L1 Rate Summary";
00984     //fill later//rate_All = dbe->book1D(histonm.c_str(),histot.c_str(),
00985                            hltPathsAll_.size()+1,-0.5,hltPathsAll_.size()+1-0.5);
00986 
00987     //fill later//rate_All_L1 = dbe->book1D(histonmL1.c_str(),histoL1t.c_str(),
00988                               hltPathsAll_.size()+1,-0.5,hltPathsAll_.size()+1-0.5);
00989     
00990     //rate_All->setBinLabel(hltPathsAll_.size()+1,"Rate",1);
00991     unsigned int nname=0;
00992     unsigned int nnameL1=0;
00993     for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
00994       std::string labelnm("dummy");
00995       labelnm = v->getPath();
00996       rate_All->setBinLabel(nname+1,labelnm); 
00997       nname++;
00998 
00999       std::string labelnml1("dummyl1");
01000       labelnml1 = v->getl1Path();
01001       rate_All_L1->setBinLabel(nnameL1+1,labelnml1); 
01002       nnameL1++;
01003     }
01004     // now set up all of the histos for each path
01005     for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ) {
01006       MonitorElement *N = 0;
01007       MonitorElement *Et = 0;
01008       MonitorElement *EtaPhi = 0;
01009       MonitorElement *Eta = 0;
01010       MonitorElement *Phi = 0;
01011       MonitorElement *NL1 = 0;
01012       MonitorElement *l1Et = 0;
01013       MonitorElement *l1EtaPhi = 0;
01014       MonitorElement *l1Eta = 0;
01015       MonitorElement *l1Phi = 0;
01016         
01017       std::string labelname("dummy");
01018       labelname = v->getPath();
01019       std::string histoname(labelname+"");
01020       std::string title(labelname+"");
01021 
01022       double histEtaMax = 2.5;
01023       if (v->getObjectType() == trigger::TriggerMuon  
01024           || v->getObjectType() == trigger::TriggerL1Mu)  {
01025         histEtaMax = muonEtaMax_;
01026         nBins_ = 25 ;
01027       }
01028         
01029       else if (v->getObjectType() == trigger::TriggerJet 
01030                || v->getObjectType() == trigger::TriggerL1CenJet 
01031                || v->getObjectType() == trigger::TriggerL1ForJet ) {
01032         histEtaMax = jetEtaMax_; 
01033         nBins_ = 60 ;
01034       }
01035         
01036       else if (v->getObjectType() == trigger::TriggerMET 
01037                || v->getObjectType() == trigger::TriggerL1ETM ) {
01038         histEtaMax = 5.0; 
01039         nBins_ = 60 ;
01040       }
01041         
01042       TString pathfolder = dirname_ + foldernm + v->getPath();
01043       dbe_->setCurrentFolder(pathfolder.Data());
01044       if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
01045       int nBins2D = 10;
01046       
01047 
01048       histoname = labelname+"_Et";
01049       title = labelname+" E_t";
01050       Et =  dbe->book1D(histoname.c_str(),
01051                         title.c_str(),nBins_, 
01052                         v->getPtMin(),
01053                         v->getPtMax());
01054 
01055       histoname = labelname+"_l1Et";
01056       title = labelname+" L1 E_t";
01057       l1Et =  dbe->book1D(histoname.c_str(),
01058                           title.c_str(),nBins_, 
01059                           v->getPtMin(),
01060                           v->getPtMax());
01061  
01062       if (labelname.find("Jet") != std::string::npos
01063           || labelname.find("Mu") != std::string::npos) {
01064       
01065         histoname = labelname+"_EtaPhi";
01066         title = labelname+" #eta vs #phi";
01067         EtaPhi =  dbe->book2D(histoname.c_str(),
01068                               title.c_str(),
01069                               nBins2D,-histEtaMax,histEtaMax,
01070                               nBins2D,-TMath::Pi(), TMath::Pi());
01071         
01072         histoname = labelname+"_l1EtaPhi";
01073         title = labelname+"L1 #eta vs L1 #phi";
01074         l1EtaPhi =  dbe->book2D(histoname.c_str(),
01075                                 title.c_str(),
01076                                 nBins2D,-histEtaMax,histEtaMax,
01077                                 nBins2D,-TMath::Pi(), TMath::Pi());
01078 
01079         histoname = labelname+"_Phi";
01080         title = labelname+" #phi";
01081         Phi =  dbe->book1D(histoname.c_str(),
01082                            title.c_str(),
01083                            nBins_,-TMath::Pi(), TMath::Pi());
01084         
01085         histoname = labelname+"_l1Phi";
01086         title = labelname+"L1 #phi";
01087         l1Phi =  dbe->book1D(histoname.c_str(),
01088                              title.c_str(),
01089                              nBins_,-TMath::Pi(), TMath::Pi());
01090         histoname = labelname+"_Eta";
01091         title = labelname+" #eta";
01092         Eta =  dbe->book1D(histoname.c_str(),
01093                            title.c_str(),
01094                            nBins_,-histEtaMax,histEtaMax
01095                            );
01096         
01097         histoname = labelname+"_l1Eta";
01098         title = labelname+"L1 #eta";
01099         l1Eta =  dbe->book1D(histoname.c_str(),
01100                              title.c_str(),
01101                              nBins_,-histEtaMax,histEtaMax);
01102       } 
01103       else if( (labelname.find("MET") != std::string::npos)
01104                || (labelname.find("SumET") != std::string::npos)    ){
01105         histoname = labelname+"_phi";
01106         title = labelname+" #phi";
01107         Phi =  dbe->book1D(histoname.c_str(),
01108                            title.c_str(),
01109                            nBins_,-TMath::Pi(), TMath::Pi());
01110         
01111         histoname = labelname+"_l1Phi";
01112         title = labelname+"L1 #phi";
01113         l1Phi =  dbe->book1D(histoname.c_str(),
01114                              title.c_str(),
01115                              nBins_,-TMath::Pi(), TMath::Pi());
01116         
01117       }
01118       v->setHistos( N, Et, EtaPhi, Eta, Phi, NL1, l1Et, l1EtaPhi,l1Eta, l1Phi);
01119     }
01120     if (verbose_) std::cout << "Done  booking histos All  " << std::endl;
01121   }
01122   //----------------plot all jetmet trigger wrt some muon trigger-----
01123   if  (plotwrtMu_){
01124     if (verbose_) std::cout << " booking histos wrt Muon " << std::endl;
01125     std::string foldernm = "/wrtMuon/";
01126     if (dbe)   {
01127       dbe->setCurrentFolder(dirname_ + foldernm);
01128     }
01129  
01130     for (unsigned int j=0; j!=n; ++j)  {
01131       std::string pathname = hltConfig_.triggerName(j);  
01132       std::string l1pathname = "dummy";
01133       //for (unsigned int i=0; i!=n; ++i) 
01134       //{
01135       if (verbose_) std::cout << hltConfig_.triggerName(j) << std::endl;
01136       std::string denompathname = custompathnamemu_ ;  
01137       int objectType = 0;
01138       int usedPresscale = 1;
01139       //int denomobjectType = 0;
01140       //parse pathname to guess object type
01141             
01142       if ( pathname.find("Mu") && (pathname=="HLT_L1MuOpen")) 
01143         objectType = trigger::TriggerMuon; 
01144       else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;    
01145       else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;    
01146       else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;    
01147       else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;    
01148       //if (pathname.find("HLT_Jet30") != std::string::npos) objectType = trigger::TriggerJet;    
01149       //if (pathname.find("HLT_Jet50") != std::string::npos) objectType = trigger::TriggerJet;    
01150       //if ((pathname.find("HLT_Mu3") != std::string::npos) || (pathname.find("HLT_L2Mu9") != std::string::npos)  ) objectType = trigger::TriggerMuon;    
01151       else continue;
01152       
01153       // find L1 condition for numpath with numpath objecttype 
01154       // find PSet for L1 global seed for numpath, 
01155       // list module labels for numpath
01156       std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
01157 
01158       for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
01159           numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
01160         //  std::cout << pathname << "\t" << *numpathmodule << "\t" << hltConfig_.moduleType(*numpathmodule) << std::endl;
01161         if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
01162           edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
01163           //std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
01164           //  l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
01165           l1pathname = *numpathmodule; 
01166           break; 
01167         }
01168       } 
01169               
01170       std::string filtername("dummy");
01171       std::string Denomfiltername("denomdummy");
01172       float ptMin = 0.0;
01173       float ptMax = 300.0;
01174       if ( objectType != 0){
01175         //      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;
01176         
01177         hltPathswrtMu_.push_back(PathInfo(usedPresscale, denompathname, pathname, l1pathname, 
01178                                           filtername,  Denomfiltername, processname_, 
01179                                           objectType, ptMin, ptMax));
01180       }
01181     }
01182 
01183     std::string histonm="JetMET_rate_wrt_" + custompathnamemu_ + "_Summary";
01184     std::string histt="JetMET Rate wrt " + custompathnamemu_ + "Summary";
01185     rate_wrtMu = dbe->book1D(histonm.c_str(),histt.c_str(),
01186                              hltPathswrtMu_.size()+1,-0.5,hltPathswrtMu_.size()+1.0-0.5);
01187 
01188     
01189     int nname=0;
01190     for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ){
01191       std::string labelnm("dummy");
01192       labelnm = v->getPath();
01193       
01194       rate_wrtMu->setBinLabel(nname+1,labelnm);
01195             
01196       nname++;
01197     }
01198      // now set up all of the histos for each path
01199     for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v )  {
01200       MonitorElement *NwrtMu = 0;
01201       MonitorElement *EtwrtMu = 0;
01202       MonitorElement *EtaPhiwrtMu = 0;
01203       MonitorElement *PhiwrtMu = 0;
01204       
01205       std::string labelname("dummy");
01206       labelname = v->getPath() + "_wrt_" + v->getDenomPath();
01207       std::string histoname(labelname+"");
01208       std::string title(labelname+"");
01209 
01210       double histEtaMax = 2.5;
01211       if (v->getObjectType() == trigger::TriggerMuon 
01212           || v->getObjectType() == trigger::TriggerL1Mu)  {
01213         histEtaMax = muonEtaMax_;nBins_ = 20 ;
01214       }
01215         
01216       else if (v->getObjectType() == trigger::TriggerJet 
01217                || v->getObjectType() == trigger::TriggerL1CenJet 
01218                || v->getObjectType() == trigger::TriggerL1ForJet ){
01219         histEtaMax = jetEtaMax_; nBins_ = 60 ;
01220       }
01221         
01222       else if (v->getObjectType() == trigger::TriggerMET 
01223                || v->getObjectType() == trigger::TriggerL1ETM )  {
01224         histEtaMax = 5.0; nBins_ = 60 ;
01225       }
01226         
01227       TString pathfolder = dirname_ + foldernm + v->getPath();
01228       dbe_->setCurrentFolder(pathfolder.Data());
01229       if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
01230       int nBins2D = 10;
01231          
01232       //pathfolder = dirname_ + TString("/wrtMuon/") + v->getPath();
01233       
01234 
01235       histoname = labelname+"_Et_wrtMu";
01236       title = labelname+" E_t";
01237       EtwrtMu =  dbe->book1D(histoname.c_str(),
01238                              title.c_str(),nBins_, 
01239                              v->getPtMin(),
01240                              v->getPtMax());
01241 
01242       if ((v->getPath()).find("Jet") != std::string::npos
01243           || (v->getPath()).find("Mu") != std::string::npos) {
01244         histoname = labelname+"_EtaPhi_wrtMu";
01245         title = labelname+" #eta vs #phi";
01246         EtaPhiwrtMu =  dbe->book2D(histoname.c_str(),
01247                                    title.c_str(),
01248                                    nBins2D,-histEtaMax,histEtaMax,
01249                                    nBins2D,-TMath::Pi(), TMath::Pi());
01250         
01251 
01252       }
01253       else if( ((v->getPath()).find("MET") != std::string::npos) 
01254                || ((v->getPath()).find("SumET") != std::string::npos)    ){
01255         histoname = labelname+"_phi_wrtMu";
01256         title = labelname+" #phi";
01257         PhiwrtMu =  dbe->book1D(histoname.c_str(),
01258                                 title.c_str(),
01259                                 nBins_,-TMath::Pi(), TMath::Pi());
01260       }
01261 
01262       v->setHistoswrtMu( NwrtMu, EtwrtMu, EtaPhiwrtMu, PhiwrtMu);
01263     }
01264     if (verbose_) std::cout << "Done  booking histos wrt Muon " << std::endl;
01265   }
01267 
01268   if (plotEff_) {
01269     // plot efficiency for specified HLT path pairs
01270     if (verbose_) std::cout << " booking histos for Efficiency " << std::endl;
01271 
01272     std::string foldernm = "/Efficiency/";
01273     if (dbe) {
01274         
01275       dbe->setCurrentFolder(dirname_ + foldernm);
01276     }
01277     // now loop over denom/num path pairs specified in cfg, 
01278     int countN = 0;  
01279     for (std::vector<std::pair<std::string, std::string> >::iterator
01280            custompathnamepair = custompathnamepairs_.begin(); 
01281          custompathnamepair != custompathnamepairs_.end(); 
01282          ++custompathnamepair) {
01283              
01284       std::string denompathname = custompathnamepair->second;  
01285       std::string pathname = custompathnamepair->first;  
01286       int usedPrescale = prescUsed_[countN];
01287       if (verbose_) std::cout << " ------prescale used -----" << usedPrescale << std::endl; 
01288       // check that these exist
01289       bool foundfirst = false;
01290       bool foundsecond = false;
01291       for (unsigned int i=0; i!=n; ++i) {
01292         if (hltConfig_.triggerName(i) == denompathname) foundsecond = true;
01293         if (hltConfig_.triggerName(i) == pathname) foundfirst = true;
01294       } 
01295       if (!foundfirst) {
01296         edm::LogInfo("HLTJetMETDQMSource") 
01297           << "pathname not found, ignoring "
01298           << pathname;
01299         continue;
01300       }
01301       if (!foundsecond) {
01302         edm::LogInfo("HLTJetMETDQMSource") 
01303           << "denompathname not found, ignoring "
01304           << pathname;
01305         continue;
01306       }
01307       //if (verbose_) std::cout << pathname << "\t" << denompathname << std::endl;
01308       std::string l1pathname = "dummy";
01309       int objectType = 0;
01310       //int denomobjectType = 0;
01311       //parse pathname to guess object type
01312       if ( pathname.find("Mu") && (pathname=="HLT_L1MuOpen")) 
01313         objectType = trigger::TriggerMuon; 
01314       else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;    
01315       else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;    
01316       else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;    
01317       else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;    
01318       //if (pathname.find("HLT_Jet30") != std::string::npos) objectType = trigger::TriggerJet;    
01319       //if (pathname.find("HLT_Jet50") != std::string::npos) objectType = trigger::TriggerJet;    
01320       //if ((pathname.find("HLT_Mu3") != std::string::npos) || (pathname.find("HLT_L2Mu9") != std::string::npos)  ) objectType = trigger::TriggerMuon;    
01321       else continue;
01322    
01323       // find L1 condition for numpath with numpath objecttype 
01324       // find PSet for L1 global seed for numpath, 
01325       // list module labels for numpath
01326   
01327       std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
01328     
01329       for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
01330           numpathmodule!= numpathmodules.end(); 
01331           ++numpathmodule ) {
01332         //  if (verbose_) std::cout << pathname << "\t" << *numpathmodule << "\t" << hltConfig_.moduleType(*numpathmodule) << std::endl;
01333         if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed"){
01334           edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
01335           //                if (verbose_)   std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
01336           // l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
01337           l1pathname = *numpathmodule;
01338           //if (verbose_) std::cout << *numpathmodule << std::endl; 
01339           break; 
01340         }
01341       }
01342     
01343       std::string filtername("dummy");
01344       std::string Denomfiltername("denomdummy");
01345       float ptMin = 0.0;
01346       float ptMax = 300.0;
01347       if (objectType == trigger::TriggerMuon) ptMax = 300.0;
01348       if (objectType == trigger::TriggerJet) ptMax = 300.0;
01349       if (objectType == trigger::TriggerMET) ptMax = 300.0;
01350       if (objectType == trigger::TriggerTET) ptMax = 300.0;
01351                  
01352       
01353       if (objectType != 0){
01354         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;
01355         
01356         
01357         hltPathsEff_.push_back(PathInfo(usedPrescale, denompathname, pathname, l1pathname, filtername, Denomfiltername, processname_, objectType, ptMin, ptMax));
01358       }
01359 
01360       countN++;
01361     }
01362     
01363     std::string histonm="JetMET_Efficiency_Summary";
01364     std::string histonmDenom="Denom_passed_Summary";
01365     std::string histonmNum="Num_passed_Summary";
01366     rate_Denom = dbe->book1D(histonmDenom.c_str(),histonmDenom.c_str(),
01367                              hltPathsEff_.size(),0,hltPathsEff_.size());
01368     rate_Num = dbe->book1D(histonmNum.c_str(),histonmNum.c_str(),
01369                            hltPathsEff_.size(),-0.5,hltPathsEff_.size()+1-0.5);
01370     rate_Eff = dbe->book1D(histonm.c_str(),histonm.c_str(),
01371                            hltPathsEff_.size(),-0.5,hltPathsEff_.size()+1-0.5);
01372 
01373     //rate_Eff = dbe_->bookProfile("Efficiency_Summary","Efficiency_Summary", hltPathsEff_.size(), -0.5, hltPathsEff_.size()-0.5, 1000, 0.0, 1.0);
01374     int nname=0;
01375     for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ){
01376       std::string labelnm("dummy");
01377       std::string labeldenom("dummy");
01378       labelnm = v->getPath();
01379       labeldenom = v->getDenomPath();
01380       //rate_Eff->getTProfile()->GetXaxis()->SetBinLabel(nname+1,labelnm.c_str());
01381  
01382       rate_Eff->setBinLabel(nname+1,labelnm);
01383       rate_Denom->setBinLabel(nname+1,labeldenom);
01384       rate_Num->setBinLabel(nname+1,labelnm);
01385       nname++;
01386     }
01387     for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ) {
01388       MonitorElement *NEff=0;
01389       MonitorElement *EtEff=0;
01390       MonitorElement *EtaEff=0;
01391       MonitorElement *PhiEff=0;
01392       MonitorElement *NNum =0;
01393       MonitorElement *EtNum =0;
01394       MonitorElement *EtaNum =0;
01395       MonitorElement *PhiNum =0; 
01396       MonitorElement *NDenom=0;
01397       MonitorElement *EtDenom=0;
01398       MonitorElement *EtaDenom=0;
01399       MonitorElement *PhiDenom=0;
01400       std::string labelname("dummy");
01401       labelname = "Eff_" + v->getPath() + "_wrt_" + v->getDenomPath();
01402       std::string histoname(labelname+"");
01403       std::string title(labelname+"");
01404       
01405       double histEtaMax = 5.0;
01406       if (v->getObjectType() == trigger::TriggerMuon 
01407           || v->getObjectType() == trigger::TriggerL1Mu) {
01408         histEtaMax = muonEtaMax_; nBins_ = 20 ;
01409       }
01410         
01411       else if (v->getObjectType() == trigger::TriggerJet 
01412                || v->getObjectType() == trigger::TriggerL1CenJet 
01413                || v->getObjectType() == trigger::TriggerL1ForJet ){
01414         histEtaMax = jetEtaMax_; nBins_ = 60 ;
01415       }
01416         
01417       else if (v->getObjectType() == trigger::TriggerMET 
01418                || v->getObjectType() == trigger::TriggerL1ETM ) {
01419         histEtaMax = 5.0; nBins_ = 60 ;
01420       }
01421         
01422       TString pathfolder = dirname_ + foldernm + v->getPath();
01423       dbe_->setCurrentFolder(pathfolder.Data());
01424       if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
01425             
01426       //pathfolder = dirname_ + TString("/Eff/") + v->getPath(); 
01427       //int nBins2D = 10;
01428       histoname = labelname+"_Et_Eff";
01429       title = labelname+" E_t Eff";
01430       EtEff =  dbe->book1D(histoname.c_str(),
01431                            title.c_str(),nBins_, 
01432                            v->getPtMin(),
01433                            v->getPtMax());
01434 
01435       histoname = labelname+"_Et_Num";
01436       title = labelname+" E_t Num";
01437       EtNum =  dbe->book1D(histoname.c_str(),
01438                            title.c_str(),nBins_, 
01439                            v->getPtMin(),
01440                            v->getPtMax());
01441 
01442 
01443       histoname = labelname+"_Et_Denom";
01444       title = labelname+" E_t Denom";
01445       EtDenom =  dbe->book1D(histoname.c_str(),
01446                              title.c_str(),nBins_, 
01447                              v->getPtMin(),
01448                              v->getPtMax());
01449       
01450       if ((v->getPath()).find("Jet") != std::string::npos
01451           || (v->getPath()).find("Mu") != std::string::npos) {
01452         histoname = labelname+"_Eta_Eff";
01453         title = labelname+" #eta  Eff";
01454         EtaEff =  dbe->book1D(histoname.c_str(),
01455                               title.c_str(),
01456                               nBins_,-histEtaMax,histEtaMax);
01457         histoname = labelname+"_Phi_Eff";
01458         title = labelname+" #phi Eff";
01459         PhiEff =  dbe->book1D(histoname.c_str(),
01460                               title.c_str(),
01461                               nBins_,-TMath::Pi(), TMath::Pi());
01462 
01463         histoname = labelname+"_Eta_Num";
01464         title = labelname+" #eta  Num";
01465         EtaNum =  dbe->book1D(histoname.c_str(),
01466                               title.c_str(),
01467                               nBins_,-histEtaMax,histEtaMax);
01468         histoname = labelname+"_Phi_Num";
01469         title = labelname+" #phi Num";
01470         PhiNum =  dbe->book1D(histoname.c_str(),
01471                               title.c_str(),
01472                               nBins_,-TMath::Pi(), TMath::Pi());
01473 
01474         histoname = labelname+"_Eta_Denom";
01475         title = labelname+" #eta  Denom";
01476         EtaDenom =  dbe->book1D(histoname.c_str(),
01477                                 title.c_str(),
01478                                 nBins_,-histEtaMax,histEtaMax);
01479         histoname = labelname+"_Phi_Denom";
01480         title = labelname+" #phi Denom";
01481         PhiDenom =  dbe->book1D(histoname.c_str(),
01482                                 title.c_str(),
01483                                 nBins_,-TMath::Pi(), TMath::Pi());
01484       }
01485 
01486 
01487       else if( ((v->getPath()).find("MET") != std::string::npos) 
01488                || ((v->getPath()).find("SumET") != std::string::npos)    ){
01489         
01490         histoname = labelname+"_Phi_Eff";
01491         title = labelname+" #phi Eff";
01492         PhiEff =  dbe->book1D(histoname.c_str(),
01493                               title.c_str(),
01494                               nBins_,-TMath::Pi(), TMath::Pi());
01495 
01496         histoname = labelname+"_Phi_Num";
01497         title = labelname+" #phi Num";
01498         PhiNum =  dbe->book1D(histoname.c_str(),
01499                               title.c_str(),
01500                               nBins_,-TMath::Pi(), TMath::Pi());
01501         
01502         histoname = labelname+"_Phi_Denom";
01503         title = labelname+" #phi Denom";
01504         PhiDenom =  dbe->book1D(histoname.c_str(),
01505                                 title.c_str(),
01506                                 nBins_,-TMath::Pi(), TMath::Pi());
01507         
01508       }
01509      
01510       v->setHistosEff( NEff, EtEff, EtaEff, PhiEff, NNum, EtNum, EtaNum, PhiNum, NDenom, EtDenom, EtaDenom, PhiDenom);
01511       
01512     }
01513     if (verbose_) std::cout << "Done  booking histos for Efficiency " << std::endl;
01514   }
01515  
01516 
01517   */
01518 }
01519 
01520 // BeginRun
01521 void HLTJetMETDQMSource::beginRun(const edm::Run& run, const edm::EventSetup& c){
01522 
01523   if (verbose_) std::cout << "beginRun, run " << run.id() << std::endl;
01524 
01525   /*
01526   // HLT config does not change within runs!
01527    bool changed(true);
01528  
01529 
01530  //if (hltConfig_.init(iEvent,processname_,changed)) {
01531   if (hltConfig_.init(run,c,processname_,changed)) {
01532     if (changed) {
01533       hltconfigchanged=true;
01534       //if(verbose_) 
01535       //hltConfig_.dump("Triggers");
01536       LogWarning("HLTJetMETDQMSource")  << "HLTJetMETDQMSource:analyze: The number of valid triggers has changed since beginning of job." << std::endl;
01537       //        << "Processing of events halted for summary histograms"  << std::endl;
01538       //<< "Summary histograms do not support changing configurations." << std::endl
01539      
01540     }
01541   }
01542   else {   
01543     LogError("HLTJetMETDQMSource") << "HLT config init error" << std::endl;
01544     return;
01545   }
01546   if ( hltConfig_.size() <= 0 ) {
01547     LogError("HLTJetMETDQMSource") << "HLT config size error" << std::endl;
01548     return;
01549   }
01550   // if ( currun != runno) runchanged=true;
01551  
01552 */
01554 
01555  hltconfigchanged=false;
01556   //if (!hltConfig_.init(processname_)) {
01557   if (!hltConfig_.init(run, c, processname_, hltconfigchanged)) {
01558     processname_ = "FU";
01559     // if (!hltConfig_.init(processname_)){
01560     if (!hltConfig_.init(run, c, processname_, hltconfigchanged)) {
01561       LogError("HLTJetMETDQMSource") << "HLTConfigProvider failed to initialize." << std::endl;
01562     }
01563     //  hltConfig_.dump("Triggers");
01564   }
01565  
01566  DQMStore *dbe = 0;
01567     dbe = Service<DQMStore>().operator->();
01568   
01569     if (dbe) {
01570       dbe->setCurrentFolder(dirname_);
01571     }
01572 
01573  const unsigned int n(hltConfig_.size());
01574   if (verbose_) std::cout << " hltConfig_.size()  " << n << std::endl;
01575   //-------------if plot all jetmet trigger pt,eta, phi-------------------
01576 
01577 
01578  if (plotAll_){
01579     if (verbose_) std::cout << " booking histos All " << std::endl;
01580     std::string foldernm = "/All/";
01581     
01582     if (dbe) {
01583     
01584       dbe->setCurrentFolder(dirname_ + foldernm);
01585     }
01586     for (unsigned int j=0; j!=n; ++j) {
01587       std::string pathname = hltConfig_.triggerName(j);  
01588       std::string l1pathname = "dummy";
01589       //for (unsigned int i=0; i!=n; ++i) {
01590       // std::cout << hltConfig_.triggerName(i) << std::endl;
01591     
01592       //std::string denompathname = hltConfig_.triggerName(i);  
01593       std::string denompathname = ""; 
01594       std::string denompathnamemu = custompathnamemu_;
01595       unsigned int usedPresscale = 1;  
01596       unsigned int objectType = 0;
01597       //int denomobjectType = 0;
01598       //parse pathname to guess object type
01599       
01600       if ( pathname.find("Mu") && (pathname==denompathnamemu)) 
01601         objectType = trigger::TriggerMuon; 
01602       else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;    
01603       else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;    
01604       else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;    
01605       else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;    
01606       //if (pathname.find("HLT_Jet30") != std::string::npos) objectType = trigger::TriggerJet;    
01607       //if (pathname.find("HLT_Jet50") != std::string::npos) objectType = trigger::TriggerJet;    
01608       //if ((pathname.find("HLT_Mu3") != std::string::npos) || (pathname.find("HLT_L2Mu9") != std::string::npos)  ) objectType = trigger::TriggerMuon;    
01609       
01610       else continue;
01611       //std::cout << "objecttye " << objectType << std::endl;
01612       // find L1 condition for numpath with numpath objecttype 
01613 
01614       // find PSet for L1 global seed for numpath, 
01615       // list module labels for numpath
01616       std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
01617     
01618       for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
01619           numpathmodule!= numpathmodules.end(); 
01620           ++numpathmodule ) {
01621      
01622         //  std::cout << pathname << "\t" << *numpathmodule << "\t" 
01623         //<< hltConfig_.moduleType(*numpathmodule) << std::endl;
01624         if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
01625           edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
01626           //std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
01627           //  l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
01628           l1pathname = *numpathmodule; 
01629           break; 
01630         }
01631       } 
01632       std::string filtername("dummy");
01633       std::string Denomfiltername("denomdummy");
01634       float ptMin = 0.0;
01635       float ptMax = 300.0;
01636       if (objectType != 0 )
01637         hltPathsAll_.push_back(PathInfo(usedPresscale, denompathname,
01638                                         pathname, l1pathname, filtername,
01639                                         Denomfiltername, processname_, 
01640                                         objectType, ptMin, ptMax));
01641     }
01642     std::string histonm="JetMET_rate_All";
01643     std::string histonmL1="JetMET_rate_All_L1";
01644     std::string histot="JetMET Rate Summary";
01645     std::string histoL1t="JetMET L1 Rate Summary";
01646     //fill later//rate_All = dbe->book1D(histonm.c_str(),histot.c_str(),
01647     //fill later//                         hltPathsAll_.size()+1,-0.5,hltPathsAll_.size()+1-0.5);
01648 
01649     //fill later//rate_All_L1 = dbe->book1D(histonmL1.c_str(),histoL1t.c_str(),
01650     //fill later//                            hltPathsAll_.size()+1,-0.5,hltPathsAll_.size()+1-0.5);
01651     
01652     //rate_All->setBinLabel(hltPathsAll_.size()+1,"Rate",1);
01653     unsigned int nname=0;
01654     unsigned int nnameL1=0;
01655     for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
01656       std::string labelnm("dummy");
01657       labelnm = v->getPath();
01658       //fill later//rate_All->setBinLabel(nname+1,labelnm); 
01659       nname++;
01660 
01661       std::string labelnml1("dummyl1");
01662       labelnml1 = v->getl1Path();
01663       //fill later//rate_All_L1->setBinLabel(nnameL1+1,labelnml1); 
01664       nnameL1++;
01665     }
01666     // now set up all of the histos for each path
01667     for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ) {
01668       MonitorElement *N = 0;
01669       MonitorElement *Et = 0;
01670       MonitorElement *EtaPhi = 0;
01671       MonitorElement *Eta = 0;
01672       MonitorElement *Phi = 0;
01673       MonitorElement *NL1 = 0;
01674       MonitorElement *l1Et = 0;
01675       MonitorElement *l1EtaPhi = 0;
01676       MonitorElement *l1Eta = 0;
01677       MonitorElement *l1Phi = 0;
01678         
01679       std::string labelname("dummy");
01680       labelname = v->getPath();
01681       std::string histoname(labelname+"");
01682       std::string title(labelname+"");
01683 
01684       double histEtaMax = 2.5;
01685       if (v->getObjectType() == trigger::TriggerMuon  
01686           || v->getObjectType() == trigger::TriggerL1Mu)  {
01687         histEtaMax = muonEtaMax_;
01688         nBins_ = 25 ;
01689       }
01690         
01691       else if (v->getObjectType() == trigger::TriggerJet 
01692                || v->getObjectType() == trigger::TriggerL1CenJet 
01693                || v->getObjectType() == trigger::TriggerL1ForJet ) {
01694         histEtaMax = jetEtaMax_; 
01695         nBins_ = 60 ;
01696       }
01697         
01698       else if (v->getObjectType() == trigger::TriggerMET 
01699                || v->getObjectType() == trigger::TriggerL1ETM ) {
01700         histEtaMax = 5.0; 
01701         nBins_ = 60 ;
01702       }
01703         
01704       TString pathfolder = dirname_ + foldernm + v->getPath();
01705       dbe_->setCurrentFolder(pathfolder.Data());
01706       if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
01707       int nBins2D = 10;
01708       
01709 
01710       histoname = labelname+"_Et";
01711       title = labelname+" E_t";
01712       Et =  dbe->book1D(histoname.c_str(),
01713                         title.c_str(),nBins_, 
01714                         v->getPtMin(),
01715                         v->getPtMax());
01716 
01717       histoname = labelname+"_l1Et";
01718       title = labelname+" L1 E_t";
01719       l1Et =  dbe->book1D(histoname.c_str(),
01720                           title.c_str(),nBins_, 
01721                           v->getPtMin(),
01722                           v->getPtMax());
01723  
01724       if (labelname.find("Jet") != std::string::npos
01725           || labelname.find("Mu") != std::string::npos) {
01726       
01727         histoname = labelname+"_EtaPhi";
01728         title = labelname+" #eta vs #phi";
01729         EtaPhi =  dbe->book2D(histoname.c_str(),
01730                               title.c_str(),
01731                               nBins2D,-histEtaMax,histEtaMax,
01732                               nBins2D,-TMath::Pi(), TMath::Pi());
01733         
01734         histoname = labelname+"_l1EtaPhi";
01735         title = labelname+"L1 #eta vs L1 #phi";
01736         l1EtaPhi =  dbe->book2D(histoname.c_str(),
01737                                 title.c_str(),
01738                                 nBins2D,-histEtaMax,histEtaMax,
01739                                 nBins2D,-TMath::Pi(), TMath::Pi());
01740 
01741         histoname = labelname+"_Phi";
01742         title = labelname+" #phi";
01743         Phi =  dbe->book1D(histoname.c_str(),
01744                            title.c_str(),
01745                            nBins_,-TMath::Pi(), TMath::Pi());
01746         
01747         histoname = labelname+"_l1Phi";
01748         title = labelname+"L1 #phi";
01749         l1Phi =  dbe->book1D(histoname.c_str(),
01750                              title.c_str(),
01751                              nBins_,-TMath::Pi(), TMath::Pi());
01752         histoname = labelname+"_Eta";
01753         title = labelname+" #eta";
01754         Eta =  dbe->book1D(histoname.c_str(),
01755                            title.c_str(),
01756                            nBins_,-histEtaMax,histEtaMax
01757                            );
01758         
01759         histoname = labelname+"_l1Eta";
01760         title = labelname+"L1 #eta";
01761         l1Eta =  dbe->book1D(histoname.c_str(),
01762                              title.c_str(),
01763                              nBins_,-histEtaMax,histEtaMax);
01764       } 
01765       else if( (labelname.find("MET") != std::string::npos)
01766                || (labelname.find("SumET") != std::string::npos)    ){
01767         histoname = labelname+"_phi";
01768         title = labelname+" #phi";
01769         Phi =  dbe->book1D(histoname.c_str(),
01770                            title.c_str(),
01771                            nBins_,-TMath::Pi(), TMath::Pi());
01772         
01773         histoname = labelname+"_l1Phi";
01774         title = labelname+"L1 #phi";
01775         l1Phi =  dbe->book1D(histoname.c_str(),
01776                              title.c_str(),
01777                              nBins_,-TMath::Pi(), TMath::Pi());
01778         
01779       }
01780       v->setHistos( N, Et, EtaPhi, Eta, Phi, NL1, l1Et, l1EtaPhi,l1Eta, l1Phi);
01781     }
01782     if (verbose_) std::cout << "Done  booking histos All  " << std::endl;
01783   }
01784   //----------------plot all jetmet trigger wrt some muon trigger-----
01785   if  (plotwrtMu_){
01786     if (verbose_) std::cout << " booking histos wrt Muon " << std::endl;
01787     std::string foldernm = "/wrtMuon/";
01788     if (dbe)   {
01789       dbe->setCurrentFolder(dirname_ + foldernm);
01790     }
01791  
01792     for (unsigned int j=0; j!=n; ++j)  {
01793       std::string pathname = hltConfig_.triggerName(j);  
01794       std::string l1pathname = "dummy";
01795       //for (unsigned int i=0; i!=n; ++i) 
01796       //{
01797       if (verbose_) std::cout << hltConfig_.triggerName(j) << std::endl;
01798       std::string denompathname = custompathnamemu_ ;  
01799       int objectType = 0;
01800       int usedPresscale = 1;
01801       //int denomobjectType = 0;
01802       //parse pathname to guess object type
01803             
01804       if ( pathname.find("Mu") && (pathname==denompathname)) 
01805         objectType = trigger::TriggerMuon; 
01806       else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;    
01807       else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;    
01808       else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;    
01809       else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;    
01810       //if (pathname.find("HLT_Jet30") != std::string::npos) objectType = trigger::TriggerJet;    
01811       //if (pathname.find("HLT_Jet50") != std::string::npos) objectType = trigger::TriggerJet;    
01812       //if ((pathname.find("HLT_Mu3") != std::string::npos) || (pathname.find("HLT_L2Mu9") != std::string::npos)  ) objectType = trigger::TriggerMuon;    
01813       else continue;
01814       
01815       // find L1 condition for numpath with numpath objecttype 
01816       // find PSet for L1 global seed for numpath, 
01817       // list module labels for numpath
01818       std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
01819 
01820       for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
01821           numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
01822         //  std::cout << pathname << "\t" << *numpathmodule << "\t" << hltConfig_.moduleType(*numpathmodule) << std::endl;
01823         if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
01824           edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
01825           //std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
01826           //  l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
01827           l1pathname = *numpathmodule; 
01828           break; 
01829         }
01830       } 
01831               
01832       std::string filtername("dummy");
01833       std::string Denomfiltername("denomdummy");
01834       float ptMin = 0.0;
01835       float ptMax = 300.0;
01836       if ( objectType != 0){
01837         //      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;
01838         
01839         hltPathswrtMu_.push_back(PathInfo(usedPresscale, denompathname, pathname, l1pathname, 
01840                                           filtername,  Denomfiltername, processname_, 
01841                                           objectType, ptMin, ptMax));
01842       }
01843     }
01844 
01845     std::string histonm="JetMET_rate_wrt_" + custompathnamemu_ + "_Summary";
01846     std::string histt="JetMET Rate wrt " + custompathnamemu_ + "Summary";
01847     //fill later//rate_wrtMu = dbe->book1D(histonm.c_str(),histt.c_str(),
01848     //fill later//                           hltPathswrtMu_.size()+1,-0.5,hltPathswrtMu_.size()+1.0-0.5);
01849 
01850     
01851     int nname=0;
01852     for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ){
01853       std::string labelnm("dummy");
01854       labelnm = v->getPath();
01855       
01856       //fill later//rate_wrtMu->setBinLabel(nname+1,labelnm);
01857             
01858       nname++;
01859     }
01860      // now set up all of the histos for each path
01861     for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v )  {
01862       MonitorElement *NwrtMu = 0;
01863       MonitorElement *EtwrtMu = 0;
01864       MonitorElement *EtaPhiwrtMu = 0;
01865       MonitorElement *PhiwrtMu = 0;
01866       
01867       std::string labelname("dummy");
01868       labelname = v->getPath() + "_wrt_" + v->getDenomPath();
01869       std::string histoname(labelname+"");
01870       std::string title(labelname+"");
01871 
01872       double histEtaMax = 2.5;
01873       if (v->getObjectType() == trigger::TriggerMuon 
01874           || v->getObjectType() == trigger::TriggerL1Mu)  {
01875         histEtaMax = muonEtaMax_;nBins_ = 20 ;
01876       }
01877         
01878       else if (v->getObjectType() == trigger::TriggerJet 
01879                || v->getObjectType() == trigger::TriggerL1CenJet 
01880                || v->getObjectType() == trigger::TriggerL1ForJet ){
01881         histEtaMax = jetEtaMax_; nBins_ = 60 ;
01882       }
01883         
01884       else if (v->getObjectType() == trigger::TriggerMET 
01885                || v->getObjectType() == trigger::TriggerL1ETM )  {
01886         histEtaMax = 5.0; nBins_ = 60 ;
01887       }
01888         
01889       TString pathfolder = dirname_ + foldernm + v->getPath();
01890       dbe_->setCurrentFolder(pathfolder.Data());
01891       if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
01892       int nBins2D = 10;
01893          
01894       //pathfolder = dirname_ + TString("/wrtMuon/") + v->getPath();
01895       
01896 
01897       histoname = labelname+"_Et_wrtMu";
01898       title = labelname+" E_t";
01899       EtwrtMu =  dbe->book1D(histoname.c_str(),
01900                              title.c_str(),nBins_, 
01901                              v->getPtMin(),
01902                              v->getPtMax());
01903 
01904       if ((v->getPath()).find("Jet") != std::string::npos
01905           || (v->getPath()).find("Mu") != std::string::npos) {
01906         histoname = labelname+"_EtaPhi_wrtMu";
01907         title = labelname+" #eta vs #phi";
01908         EtaPhiwrtMu =  dbe->book2D(histoname.c_str(),
01909                                    title.c_str(),
01910                                    nBins2D,-histEtaMax,histEtaMax,
01911                                    nBins2D,-TMath::Pi(), TMath::Pi());
01912         
01913 
01914       }
01915       else if( ((v->getPath()).find("MET") != std::string::npos) 
01916                || ((v->getPath()).find("SumET") != std::string::npos)    ){
01917         histoname = labelname+"_phi_wrtMu";
01918         title = labelname+" #phi";
01919         PhiwrtMu =  dbe->book1D(histoname.c_str(),
01920                                 title.c_str(),
01921                                 nBins_,-TMath::Pi(), TMath::Pi());
01922       }
01923 
01924       v->setHistoswrtMu( NwrtMu, EtwrtMu, EtaPhiwrtMu, PhiwrtMu);
01925     }
01926     if (verbose_) std::cout << "Done  booking histos wrt Muon " << std::endl;
01927   }
01929 
01930   if (plotEff_) {
01931     // plot efficiency for specified HLT path pairs
01932     if (verbose_) std::cout << " booking histos for Efficiency " << std::endl;
01933 
01934     std::string foldernm = "/Efficiency/";
01935     if (dbe) {
01936         
01937       dbe->setCurrentFolder(dirname_ + foldernm);
01938     }
01939     // now loop over denom/num path pairs specified in cfg, 
01940     int countN = 0;  
01941     for (std::vector<std::pair<std::string, std::string> >::iterator
01942            custompathnamepair = custompathnamepairs_.begin(); 
01943          custompathnamepair != custompathnamepairs_.end(); 
01944          ++custompathnamepair) {
01945              
01946       std::string denompathname = custompathnamepair->second;  
01947       std::string denompathnamemu = custompathnamemu_;  
01948       std::string pathname = custompathnamepair->first;  
01949       int usedPrescale = prescUsed_[countN];
01950       if (verbose_) std::cout << " ------prescale used -----" << usedPrescale << std::endl; 
01951       // check that these exist
01952       bool foundfirst = false;
01953       bool foundsecond = false;
01954       for (unsigned int i=0; i!=n; ++i) {
01955         if (hltConfig_.triggerName(i) == denompathname) foundsecond = true;
01956         if (hltConfig_.triggerName(i) == pathname) foundfirst = true;
01957       } 
01958       if (!foundfirst) {
01959         edm::LogInfo("HLTJetMETDQMSource") 
01960           << "pathname not found, ignoring "
01961           << pathname;
01962         continue;
01963       }
01964       if (!foundsecond) {
01965         edm::LogInfo("HLTJetMETDQMSource") 
01966           << "denompathname not found, ignoring "
01967           << pathname;
01968         continue;
01969       }
01970       //if (verbose_) std::cout << pathname << "\t" << denompathname << std::endl;
01971       std::string l1pathname = "dummy";
01972       int objectType = 0;
01973       //int denomobjectType = 0;
01974       //parse pathname to guess object type
01975       if ( pathname.find("Mu") && (pathname==denompathnamemu)) 
01976         objectType = trigger::TriggerMuon; 
01977       else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;    
01978       else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;    
01979       else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;    
01980       else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;    
01981       //if (pathname.find("HLT_Jet30") != std::string::npos) objectType = trigger::TriggerJet;    
01982       //if (pathname.find("HLT_Jet50") != std::string::npos) objectType = trigger::TriggerJet;    
01983       //if ((pathname.find("HLT_Mu3") != std::string::npos) || (pathname.find("HLT_L2Mu9") != std::string::npos)  ) objectType = trigger::TriggerMuon;    
01984       else continue;
01985    
01986       // find L1 condition for numpath with numpath objecttype 
01987       // find PSet for L1 global seed for numpath, 
01988       // list module labels for numpath
01989   
01990       std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
01991     
01992       for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
01993           numpathmodule!= numpathmodules.end(); 
01994           ++numpathmodule ) {
01995         //  if (verbose_) std::cout << pathname << "\t" << *numpathmodule << "\t" << hltConfig_.moduleType(*numpathmodule) << std::endl;
01996         if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed"){
01997           edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
01998           //                if (verbose_)   std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
01999           // l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
02000           l1pathname = *numpathmodule;
02001           //if (verbose_) std::cout << *numpathmodule << std::endl; 
02002           break; 
02003         }
02004       }
02005     
02006       std::string filtername("dummy");
02007       std::string Denomfiltername("denomdummy");
02008       float ptMin = 0.0;
02009       float ptMax = 300.0;
02010       if (objectType == trigger::TriggerMuon) ptMax = 300.0;
02011       if (objectType == trigger::TriggerJet) ptMax = 300.0;
02012       if (objectType == trigger::TriggerMET) ptMax = 300.0;
02013       if (objectType == trigger::TriggerTET) ptMax = 300.0;
02014                  
02015       
02016       if (objectType != 0){
02017         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;
02018         
02019         
02020         hltPathsEff_.push_back(PathInfo(usedPrescale, denompathname, pathname, l1pathname, filtername, Denomfiltername, processname_, objectType, ptMin, ptMax));
02021       }
02022 
02023       countN++;
02024     }
02025     
02026     std::string histonm="JetMET_Efficiency_Summary";
02027     std::string histonmDenom="Denom_passed_Summary";
02028     std::string histonmNum="Num_passed_Summary";
02029     rate_Denom = dbe->book1D(histonmDenom.c_str(),histonmDenom.c_str(),
02030                              hltPathsEff_.size(),0,hltPathsEff_.size());
02031     rate_Num = dbe->book1D(histonmNum.c_str(),histonmNum.c_str(),
02032                            hltPathsEff_.size(),-0.5,hltPathsEff_.size()+1-0.5);
02033     rate_Eff = dbe->book1D(histonm.c_str(),histonm.c_str(),
02034                            hltPathsEff_.size(),-0.5,hltPathsEff_.size()+1-0.5);
02035 
02036     //rate_Eff = dbe_->bookProfile("Efficiency_Summary","Efficiency_Summary", hltPathsEff_.size(), -0.5, hltPathsEff_.size()-0.5, 1000, 0.0, 1.0);
02037     int nname=0;
02038     for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ){
02039       std::string labelnm("dummy");
02040       std::string labeldenom("dummy");
02041       labelnm = v->getPath();
02042       labeldenom = v->getDenomPath();
02043       //rate_Eff->getTProfile()->GetXaxis()->SetBinLabel(nname+1,labelnm.c_str());
02044  
02045       rate_Eff->setBinLabel(nname+1,labelnm);
02046       rate_Denom->setBinLabel(nname+1,labeldenom);
02047       rate_Num->setBinLabel(nname+1,labelnm);
02048       nname++;
02049     }
02050     for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ) {
02051       MonitorElement *NEff=0;
02052       MonitorElement *EtEff=0;
02053       MonitorElement *EtaEff=0;
02054       MonitorElement *PhiEff=0;
02055       MonitorElement *NNum =0;
02056       MonitorElement *EtNum =0;
02057       MonitorElement *EtaNum =0;
02058       MonitorElement *PhiNum =0; 
02059       MonitorElement *NDenom=0;
02060       MonitorElement *EtDenom=0;
02061       MonitorElement *EtaDenom=0;
02062       MonitorElement *PhiDenom=0;
02063       std::string labelname("dummy");
02064       labelname = "Eff_" + v->getPath() + "_wrt_" + v->getDenomPath();
02065       std::string histoname(labelname+"");
02066       std::string title(labelname+"");
02067       
02068       double histEtaMax = 5.0;
02069       if (v->getObjectType() == trigger::TriggerMuon 
02070           || v->getObjectType() == trigger::TriggerL1Mu) {
02071         histEtaMax = muonEtaMax_; nBins_ = 20 ;
02072       }
02073         
02074       else if (v->getObjectType() == trigger::TriggerJet 
02075                || v->getObjectType() == trigger::TriggerL1CenJet 
02076                || v->getObjectType() == trigger::TriggerL1ForJet ){
02077         histEtaMax = jetEtaMax_; nBins_ = 60 ;
02078       }
02079         
02080       else if (v->getObjectType() == trigger::TriggerMET 
02081                || v->getObjectType() == trigger::TriggerL1ETM ) {
02082         histEtaMax = 5.0; nBins_ = 60 ;
02083       }
02084         
02085       TString pathfolder = dirname_ + foldernm + v->getPath();
02086       dbe_->setCurrentFolder(pathfolder.Data());
02087       if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
02088             
02089       //pathfolder = dirname_ + TString("/Eff/") + v->getPath(); 
02090       //int nBins2D = 10;
02091       histoname = labelname+"_Et_Eff";
02092       title = labelname+" E_t Eff";
02093       EtEff =  dbe->book1D(histoname.c_str(),
02094                            title.c_str(),nBins_, 
02095                            v->getPtMin(),
02096                            v->getPtMax());
02097 
02098       histoname = labelname+"_Et_Num";
02099       title = labelname+" E_t Num";
02100       EtNum =  dbe->book1D(histoname.c_str(),
02101                            title.c_str(),nBins_, 
02102                            v->getPtMin(),
02103                            v->getPtMax());
02104 
02105 
02106       histoname = labelname+"_Et_Denom";
02107       title = labelname+" E_t Denom";
02108       EtDenom =  dbe->book1D(histoname.c_str(),
02109                              title.c_str(),nBins_, 
02110                              v->getPtMin(),
02111                              v->getPtMax());
02112       
02113       if ((v->getPath()).find("Jet") != std::string::npos
02114           || (v->getPath()).find("Mu") != std::string::npos) {
02115         histoname = labelname+"_Eta_Eff";
02116         title = labelname+" #eta  Eff";
02117         EtaEff =  dbe->book1D(histoname.c_str(),
02118                               title.c_str(),
02119                               nBins_,-histEtaMax,histEtaMax);
02120         histoname = labelname+"_Phi_Eff";
02121         title = labelname+" #phi Eff";
02122         PhiEff =  dbe->book1D(histoname.c_str(),
02123                               title.c_str(),
02124                               nBins_,-TMath::Pi(), TMath::Pi());
02125 
02126         histoname = labelname+"_Eta_Num";
02127         title = labelname+" #eta  Num";
02128         EtaNum =  dbe->book1D(histoname.c_str(),
02129                               title.c_str(),
02130                               nBins_,-histEtaMax,histEtaMax);
02131         histoname = labelname+"_Phi_Num";
02132         title = labelname+" #phi Num";
02133         PhiNum =  dbe->book1D(histoname.c_str(),
02134                               title.c_str(),
02135                               nBins_,-TMath::Pi(), TMath::Pi());
02136 
02137         histoname = labelname+"_Eta_Denom";
02138         title = labelname+" #eta  Denom";
02139         EtaDenom =  dbe->book1D(histoname.c_str(),
02140                                 title.c_str(),
02141                                 nBins_,-histEtaMax,histEtaMax);
02142         histoname = labelname+"_Phi_Denom";
02143         title = labelname+" #phi Denom";
02144         PhiDenom =  dbe->book1D(histoname.c_str(),
02145                                 title.c_str(),
02146                                 nBins_,-TMath::Pi(), TMath::Pi());
02147       }
02148 
02149 
02150       else if( ((v->getPath()).find("MET") != std::string::npos) 
02151                || ((v->getPath()).find("SumET") != std::string::npos)    ){
02152         
02153         histoname = labelname+"_Phi_Eff";
02154         title = labelname+" #phi Eff";
02155         PhiEff =  dbe->book1D(histoname.c_str(),
02156                               title.c_str(),
02157                               nBins_,-TMath::Pi(), TMath::Pi());
02158 
02159         histoname = labelname+"_Phi_Num";
02160         title = labelname+" #phi Num";
02161         PhiNum =  dbe->book1D(histoname.c_str(),
02162                               title.c_str(),
02163                               nBins_,-TMath::Pi(), TMath::Pi());
02164         
02165         histoname = labelname+"_Phi_Denom";
02166         title = labelname+" #phi Denom";
02167         PhiDenom =  dbe->book1D(histoname.c_str(),
02168                                 title.c_str(),
02169                                 nBins_,-TMath::Pi(), TMath::Pi());
02170         
02171       }
02172      
02173       v->setHistosEff( NEff, EtEff, EtaEff, PhiEff, NNum, EtNum, EtaNum, PhiNum, NDenom, EtDenom, EtaDenom, PhiDenom);
02174       
02175     }
02176     if (verbose_) std::cout << "Done  booking histos for Efficiency " << std::endl;
02177   }
02178 //end from begin job
02179 
02180 
02181   if (verbose_) std::cout << "End BeginRun ---------------- " << std::endl;
02182  
02183 }
02184 
02185 //--------------------------------------------------------
02186 void HLTJetMETDQMSource::beginLuminosityBlock(const LuminosityBlock& lumiSeg, 
02187                                               const EventSetup& context) {
02188 }
02189 //--------------------------------------------------------
02190 void HLTJetMETDQMSource::endLuminosityBlock(const LuminosityBlock& lumiSeg, 
02191                                             const EventSetup& context) {
02192 }
02193 // - method called once each job just after ending the event loop  ------------
02194 void 
02195 HLTJetMETDQMSource::endJob() {
02196   LogInfo("HLTJetMETDQMSource") << "analyzed " << nev_ << " events";
02197   return;
02198 }
02199 
02201 void HLTJetMETDQMSource::endRun(const edm::Run& run, const edm::EventSetup& c){
02202   if (verbose_) std::cout << "endRun, run " << run.id() << std::endl;
02203 }