CMS 3D CMS Logo

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