CMS 3D CMS Logo

HLTJetMETDQMSource Class Reference

Description: This is a DQM source meant to plot high-level HLT trigger quantities as stored in the HLT results object TriggerResults. More...

#include <DQM/HLTJetMETDQMSource/src/HLTJetMETDQMSource.cc>

Inheritance diagram for HLTJetMETDQMSource:

edm::EDAnalyzer

List of all members.

Public Member Functions

 HLTJetMETDQMSource (const edm::ParameterSet &)
 ~HLTJetMETDQMSource ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob (const edm::EventSetup &)
void beginRun (const edm::Run &run, const edm::EventSetup &c)
virtual void endJob ()
void endRun (const edm::Run &run, const edm::EventSetup &c)
 EndRun.

Private Attributes

int currentRun_
DQMStoredbe_
std::string dirname_
PathInfoCollection hltPaths_
bool isFirst
bool monitorDaemon_
unsigned int nBins_
int nev_
bool plotAll_
double ptMax_
double ptMin_
bool resetMe_
int theHLTOutputType
MonitorElementtotal_
edm::InputTag triggerResultLabel_
edm::InputTag triggerSummaryLabel_

Classes

class  PathInfo
class  PathInfoCollection


Detailed Description

Description: This is a DQM source meant to plot high-level HLT trigger quantities as stored in the HLT results object TriggerResults.

Jochen Cammin: added more 2D plots: eta vs et and phi vs et

Implementation: <Notes on="" implementation>="">

Definition at line 53 of file HLTJetMETDQMSource.h.


Constructor & Destructor Documentation

HLTJetMETDQMSource::HLTJetMETDQMSource ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 19 of file HLTJetMETDQMSource.cc.

References dbe_, dirname_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hltPaths_, isFirst, LogDebug, me, nBins_, plotAll_, ptMax_, RegionalCKFTracksForL3Isolation_cfi::ptMin, ptMin_, DQMStore::setCurrentFolder(), DQMStore::setVerbose(), and triggerSummaryLabel_.

00019                                                                     :
00020   resetMe_(true),  currentRun_(-99)
00021 {
00022 
00023   // printf("--- HLTJetMETDQMSource starts ---\n");
00024   isFirst = true;
00025   LogDebug("HLTJetMETDQMSource") << "constructor...." ;
00026 
00027   dbe_ = Service < DQMStore > ().operator->();
00028   if ( ! dbe_ ) {
00029     LogWarning("HLTJetMETDQMSource") << "unabel to get DQMStore service?";
00030   }
00031   if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
00032     dbe_->setVerbose(0);
00033   }
00034   
00035   
00036   dirname_="HLT/HLTJetMETDQMSource" + 
00037     iConfig.getParameter<std::string>("@module_label");
00038   
00039   if (dbe_ != 0 ) {
00040     dbe_->setCurrentFolder(dirname_);
00041   }
00042   
00043   
00044   // general configuration
00045 
00046   // plotting paramters
00047   ptMin_ = iConfig.getUntrackedParameter<double>("ptMin",0.);
00048   ptMax_ = iConfig.getUntrackedParameter<double>("ptMax",1000.);
00049   nBins_ = iConfig.getUntrackedParameter<unsigned int>("Nbins",40);
00050 
00051   plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", false);
00052 
00053   // this is the list of paths to look at.
00054   std::vector<edm::ParameterSet> filters = 
00055     iConfig.getParameter<std::vector<edm::ParameterSet> >("filters");
00056   for(std::vector<edm::ParameterSet>::iterator 
00057         filterconf = filters.begin() ; filterconf != filters.end(); 
00058       filterconf++) {
00059     std::string me  = filterconf->getParameter<std::string>("name");
00060     int objectType = filterconf->getParameter<unsigned int>("type");
00061     float ptMin = filterconf->getUntrackedParameter<double>("ptMin");
00062     float ptMax = filterconf->getUntrackedParameter<double>("ptMax");
00063     hltPaths_.push_back(PathInfo(me, objectType, ptMin, ptMax));
00064   }
00065   if ( hltPaths_.size() && plotAll_) {
00066     // these two ought to be mutually exclusive....
00067     LogWarning("HLTJetMETDQMSource") << "Using both plotAll and a list. "
00068       "list will be ignored." ;
00069     hltPaths_.clear();
00070   }
00071   triggerSummaryLabel_ = 
00072     iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
00073  
00074   
00075 }

HLTJetMETDQMSource::~HLTJetMETDQMSource (  ) 

Definition at line 78 of file HLTJetMETDQMSource.cc.

00079 {
00080  
00081    // do anything here that needs to be done at desctruction time
00082    // (e.g. close files, deallocate resources etc.)
00083 
00084 }


Member Function Documentation

void HLTJetMETDQMSource::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 93 of file HLTJetMETDQMSource.cc.

References DQMStore::book1D(), DQMStore::book2D(), dbe_, e, eta, HLTJetMETDQMSource::PathInfoCollection::find(), edm::Event::getByLabel(), hltPaths_, index, isFirst, edm::Handle< T >::isValid(), k, LogDebug, name, nBins_, nev_, phi, plotAll_, indexGen::title, toc, triggerSummaryLabel_, and v.

00094 {
00095   using namespace edm;
00096   using namespace trigger;
00097   ++nev_;
00098   LogDebug("HLTJetMETDQMSource")<< "HLTJetMETDQMSource: analyze...." ;
00099   
00100   edm::Handle<TriggerEvent> triggerObj;
00101   iEvent.getByLabel(triggerSummaryLabel_,triggerObj); 
00102   if(!triggerObj.isValid()) { 
00103     edm::LogWarning("HLTJetMETDQMSource") << "Summary HLT objects not found, "
00104       "skipping event"; 
00105     return;
00106   }
00107   
00108 
00109   const trigger::TriggerObjectCollection & toc(triggerObj->getObjects());
00110 
00111   if ( plotAll_ ) {
00112     for ( size_t ia = 0; ia < triggerObj->sizeFilters(); ++ ia) {
00113       std::string name = triggerObj->filterTag(ia).encode();
00114       if (isFirst) printf("JoCa: HLT path name: %s\n",name.c_str());
00115       PathInfoCollection::iterator pic =  hltPaths_.find(name);
00116       if ( pic == hltPaths_.end() ) {
00117         // doesn't exist - add it
00118         MonitorElement *et(0), *eta(0), *phi(0), *etavsphi(0), *etavset(0), *phivset(0);
00119         std::string histoname(name+"_et");
00120         std::string title(name+" E_t");
00121         et =  dbe_->book1D(histoname.c_str(),
00122                           title.c_str(),nBins_, 0, 100);
00123       
00124         histoname = name+"_eta";
00125         title = name+" #eta";
00126         eta =  dbe_->book1D(histoname.c_str(),
00127                            title.c_str(),nBins_,-2.7,2.7);
00128       
00129         histoname = name+"_phi";
00130         title = name+" #phi";
00131         phi =  dbe_->book1D(histoname.c_str(),
00132                            histoname.c_str(),nBins_,-3.14,3.14);
00133       
00134       
00135         histoname = name+"_etaphi";
00136         title = name+" #eta vs #phi";
00137         etavsphi =  dbe_->book2D(histoname.c_str(),
00138                                 title.c_str(),
00139                                 nBins_,-2.7,2.7,
00140                                 nBins_,-3.14, 3.14);
00141 
00142         histoname = name+"_etaet";
00143         title = name+" #eta vs E_t";
00144         etavset =  dbe_->book2D(histoname.c_str(),
00145                                 title.c_str(),
00146                                 nBins_,-2.7,2.7,
00147                                 nBins_,0, 100);
00148 
00149         histoname = name+"_phiet";
00150         title = name+" #phi vs E_t";
00151         phivset =  dbe_->book2D(histoname.c_str(),
00152                                 title.c_str(),
00153                                 nBins_,-3.14, 3.14,
00154                                 nBins_,0, 100);
00155       
00156         // no idea how to get the bin boundries in this mode
00157         PathInfo e(name,0, et, eta, phi, etavsphi, etavset, phivset, 0,100);
00158         hltPaths_.push_back(e);  
00159         pic = hltPaths_.begin() + hltPaths_.size()-1;
00160       }
00161       const trigger::Keys & k = triggerObj->filterKeys(ia);
00162       for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00163         pic->getEtHisto()->Fill(toc[*ki].pt());
00164         pic->getEtaHisto()->Fill(toc[*ki].eta());
00165         pic->getPhiHisto()->Fill(toc[*ki].phi());
00166         pic->getEtaVsPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00167         pic->getEtaVsEtHisto()->Fill(toc[*ki].eta(), toc[*ki].pt());
00168         pic->getPhiVsEtHisto()->Fill(toc[*ki].phi(), toc[*ki].pt());
00169       }  
00170 
00171     }
00172 
00173   }
00174   else { // not plotAll_
00175     for(PathInfoCollection::iterator v = hltPaths_.begin();
00176         v!= hltPaths_.end(); ++v ) {
00177       const int index = triggerObj->filterIndex(v->getName());
00178       if ( index >= triggerObj->sizeFilters() ) {
00179         continue; // not in this event
00180       }
00181       LogDebug("HLTJetMETDQMSource") << "filling ... " ;
00182       const trigger::Keys & k = triggerObj->filterKeys(index);
00183       for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00184         v->getEtHisto()->Fill(toc[*ki].pt());
00185         v->getEtaHisto()->Fill(toc[*ki].eta());
00186         v->getPhiHisto()->Fill(toc[*ki].phi());
00187         v->getEtaVsPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00188         v->getEtaVsEtHisto()->Fill(toc[*ki].eta(), toc[*ki].pt());
00189         v->getPhiVsEtHisto()->Fill(toc[*ki].phi(), toc[*ki].pt());
00190       }  
00191     }
00192   }
00193 
00194   if (isFirst) isFirst = false;
00195 
00196 }

void HLTJetMETDQMSource::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 201 of file HLTJetMETDQMSource.cc.

References DQMStore::book1D(), DQMStore::book2D(), dirname_, eta, hltPaths_, nBins_, nev_, phi, plotAll_, DQMStore::rmdir(), DQMStore::setCurrentFolder(), indexGen::title, and v.

00202 {
00203   nev_ = 0;
00204   DQMStore *dbe = 0;
00205   dbe = Service<DQMStore>().operator->();
00206   
00207   if (dbe) {
00208     dbe->setCurrentFolder(dirname_);
00209     dbe->rmdir(dirname_);
00210   }
00211   
00212   
00213   if (dbe) {
00214     dbe->setCurrentFolder(dirname_);
00215 
00216     if ( ! plotAll_ ) {
00217       for(PathInfoCollection::iterator v = hltPaths_.begin();
00218           v!= hltPaths_.end(); ++v ) {
00219         MonitorElement *et, *eta, *phi, *etavsphi=0, *etavset=0, *phivset=0;;
00220         std::string histoname(v->getName()+"_et");
00221         std::string title(v->getName()+" E_t");
00222         et =  dbe->book1D(histoname.c_str(),
00223                           title.c_str(),nBins_,
00224                           v->getPtMin(),
00225                           v->getPtMax());
00226       
00227         histoname = v->getName()+"_eta";
00228         title = v->getName()+" #eta";
00229         eta =  dbe->book1D(histoname.c_str(),
00230                            title.c_str(),nBins_,-2.7,2.7);
00231 
00232         histoname = v->getName()+"_phi";
00233         title = v->getName()+" #phi";
00234         phi =  dbe->book1D(histoname.c_str(),
00235                            histoname.c_str(),nBins_,-3.14,3.14);
00236  
00237 
00238         histoname = v->getName()+"_etaphi";
00239         title = v->getName()+" #eta vs #phi";
00240         etavsphi =  dbe->book2D(histoname.c_str(),
00241                                 title.c_str(),
00242                                 nBins_,-2.7,2.7,
00243                                 nBins_,-3.14, 3.14);
00244       
00245         histoname = v->getName()+"_etaet";
00246         title = v->getName()+" #eta vs E_t";
00247         etavset =  dbe->book2D(histoname.c_str(),
00248                                 title.c_str(),
00249                                 nBins_,-2.7,2.7,
00250                                 nBins_,v->getPtMin(), v->getPtMax());
00251       
00252         histoname = v->getName()+"_phiet";
00253         title = v->getName()+" #phi vs E_t";
00254         phivset =  dbe->book2D(histoname.c_str(),
00255                                 title.c_str(),
00256                                 nBins_,-3.14, 3.14,
00257                                 nBins_,v->getPtMin(), v->getPtMax());
00258       
00259         v->setHistos( et, eta, phi, etavsphi, etavset, phivset);
00260       } 
00261     } // ! plotAll_ - for plotAll we discover it during the event
00262   }
00263 }

void HLTJetMETDQMSource::beginRun ( const edm::Run run,
const edm::EventSetup c 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 275 of file HLTJetMETDQMSource.cc.

References edm::Run::id(), and LogDebug.

00276 {
00277   LogDebug("HLTJetMETDQMSource") << "beginRun, run " << run.id();
00278 }

void HLTJetMETDQMSource::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 267 of file HLTJetMETDQMSource.cc.

References nev_.

00268 {
00269    LogInfo("HLTJetMETDQMSource") << "analyzed " << nev_ << " events";
00270    return;
00271 }

void HLTJetMETDQMSource::endRun ( const edm::Run run,
const edm::EventSetup c 
) [private, virtual]

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 281 of file HLTJetMETDQMSource.cc.

References edm::Run::id(), and LogDebug.

00282 {
00283   LogDebug("HLTJetMETDQMSource") << "endRun, run " << run.id();
00284 }


Member Data Documentation

int HLTJetMETDQMSource::currentRun_ [private]

Definition at line 81 of file HLTJetMETDQMSource.h.

DQMStore* HLTJetMETDQMSource::dbe_ [private]

Definition at line 75 of file HLTJetMETDQMSource.h.

Referenced by analyze(), and HLTJetMETDQMSource().

std::string HLTJetMETDQMSource::dirname_ [private]

Definition at line 87 of file HLTJetMETDQMSource.h.

Referenced by beginJob(), and HLTJetMETDQMSource().

PathInfoCollection HLTJetMETDQMSource::hltPaths_ [private]

Definition at line 190 of file HLTJetMETDQMSource.h.

Referenced by analyze(), beginJob(), and HLTJetMETDQMSource().

bool HLTJetMETDQMSource::isFirst [private]

Definition at line 72 of file HLTJetMETDQMSource.h.

Referenced by analyze(), and HLTJetMETDQMSource().

bool HLTJetMETDQMSource::monitorDaemon_ [private]

Definition at line 88 of file HLTJetMETDQMSource.h.

unsigned int HLTJetMETDQMSource::nBins_ [private]

Definition at line 83 of file HLTJetMETDQMSource.h.

Referenced by analyze(), beginJob(), and HLTJetMETDQMSource().

int HLTJetMETDQMSource::nev_ [private]

Definition at line 74 of file HLTJetMETDQMSource.h.

Referenced by analyze(), beginJob(), and endJob().

bool HLTJetMETDQMSource::plotAll_ [private]

Definition at line 79 of file HLTJetMETDQMSource.h.

Referenced by analyze(), beginJob(), and HLTJetMETDQMSource().

double HLTJetMETDQMSource::ptMax_ [private]

Definition at line 85 of file HLTJetMETDQMSource.h.

Referenced by HLTJetMETDQMSource().

double HLTJetMETDQMSource::ptMin_ [private]

Definition at line 84 of file HLTJetMETDQMSource.h.

Referenced by HLTJetMETDQMSource().

bool HLTJetMETDQMSource::resetMe_ [private]

Definition at line 80 of file HLTJetMETDQMSource.h.

int HLTJetMETDQMSource::theHLTOutputType [private]

Definition at line 89 of file HLTJetMETDQMSource.h.

MonitorElement* HLTJetMETDQMSource::total_ [private]

Definition at line 77 of file HLTJetMETDQMSource.h.

edm::InputTag HLTJetMETDQMSource::triggerResultLabel_ [private]

Definition at line 91 of file HLTJetMETDQMSource.h.

edm::InputTag HLTJetMETDQMSource::triggerSummaryLabel_ [private]

Definition at line 90 of file HLTJetMETDQMSource.h.

Referenced by analyze(), and HLTJetMETDQMSource().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:31 2009 for CMSSW by  doxygen 1.5.4