CMS 3D CMS Logo

FourVectorHLT 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/FourVectorHLT/src/FourVectorHLT.cc>

Inheritance diagram for FourVectorHLT:

edm::EDAnalyzer

List of all members.

Public Member Functions

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

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 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.

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

Definition at line 50 of file FourVectorHLT.h.


Constructor & Destructor Documentation

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

Definition at line 19 of file FourVectorHLT.cc.

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

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

FourVectorHLT::~FourVectorHLT (  ) 

Definition at line 71 of file FourVectorHLT.cc.

00072 {
00073  
00074    // do anything here that needs to be done at desctruction time
00075    // (e.g. close files, deallocate resources etc.)
00076 
00077 }


Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 86 of file FourVectorHLT.cc.

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

00087 {
00088   using namespace edm;
00089   using namespace trigger;
00090   ++nev_;
00091   LogDebug("Status")<< "analyze" ;
00092   
00093   edm::Handle<TriggerEvent> triggerObj;
00094   iEvent.getByLabel(triggerSummaryLabel_,triggerObj); 
00095   if(!triggerObj.isValid()) { 
00096     edm::LogInfo("Status") << "Summary HLT object (TriggerEvent) not found, "
00097       "skipping event"; 
00098     return;
00099   }
00100   
00101   const trigger::TriggerObjectCollection & toc(triggerObj->getObjects());
00102 
00103   if ( plotAll_ ) {
00104     for ( size_t ia = 0; ia < triggerObj->sizeFilters(); ++ ia) {
00105       std::string fullname = triggerObj->filterTag(ia).encode();
00106       // the name can have in it the module label as well as the process and
00107       // other labels - strip 'em
00108       std::string name;
00109       size_t p = fullname.find_first_of(':');
00110       if ( p != std::string::npos) {
00111         name = fullname.substr(0, p);
00112       }
00113       else {
00114         name = fullname;
00115       }
00116 
00117       LogDebug("Parameter") << "filter " << ia << ", full name = " << fullname
00118                             << ", p = " << p 
00119                             << ", abbreviated = " << name ;
00120       
00121       PathInfoCollection::iterator pic =  hltPaths_.find(name);
00122       if ( pic == hltPaths_.end() ) {
00123         // doesn't exist - add it
00124         MonitorElement *et(0), *eta(0), *phi(0), *etavsphi(0);
00125         
00126         std::string histoname(name+"_et");
00127         LogDebug("Status") << "new histo with name "<<  histoname ;
00128         dbe_->setCurrentFolder(dirname_);
00129         std::string title(name+" E_{T}");
00130         et =  dbe_->book1D(histoname.c_str(),
00131                           title.c_str(),nBins_, 0, 100);
00132       
00133         histoname = name+"_eta";
00134         title = name+" #eta";
00135         eta =  dbe_->book1D(histoname.c_str(),
00136                            title.c_str(),nBins_,-2.7,2.7);
00137       
00138         histoname = name+"_phi";
00139         title = name+" #phi";
00140         phi =  dbe_->book1D(histoname.c_str(),
00141                            title.c_str(),nBins_,-3.14,3.14);
00142       
00143       
00144         histoname = name+"_etaphi";
00145         title = name+" #eta vs #phi";
00146         etavsphi =  dbe_->book2D(histoname.c_str(),
00147                                 title.c_str(),
00148                                 nBins_,-2.7,2.7,
00149                                 nBins_,-3.14, 3.14);
00150       
00151         // no idea how to get the bin boundries in this mode
00152         PathInfo e(name,0, et, eta, phi, etavsphi, ptMin_,ptMax_);
00153         hltPaths_.push_back(e);  
00154         pic = hltPaths_.begin() + hltPaths_.size()-1;
00155       }
00156       const trigger::Keys & k = triggerObj->filterKeys(ia);
00157       for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00158         LogDebug("Parameters") << "pt, eta, phi = " 
00159                                << toc[*ki].pt() << ", "
00160                                << toc[*ki].eta() << ", "
00161                                << toc[*ki].phi() ;
00162         pic->getEtHisto()->Fill(toc[*ki].pt());
00163         pic->getEtaHisto()->Fill(toc[*ki].eta());
00164         pic->getPhiHisto()->Fill(toc[*ki].phi());
00165         pic->getEtaVsPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00166       }  
00167 
00168     }
00169 
00170   }
00171   else { // not plotAll_
00172     for(PathInfoCollection::iterator v = hltPaths_.begin();
00173         v!= hltPaths_.end(); ++v ) {
00174       const int index = triggerObj->filterIndex(v->getName());
00175       if ( index >= triggerObj->sizeFilters() ) {
00176         continue; // not in this event
00177       }
00178       LogDebug("Status") << "filling ... " ;
00179       const trigger::Keys & k = triggerObj->filterKeys(index);
00180       for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00181         v->getEtHisto()->Fill(toc[*ki].pt());
00182         v->getEtaHisto()->Fill(toc[*ki].eta());
00183         v->getPhiHisto()->Fill(toc[*ki].phi());
00184         v->getEtaVsPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00185       }  
00186     }
00187   }
00188 }

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

Reimplemented from edm::EDAnalyzer.

Definition at line 193 of file FourVectorHLT.cc.

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

00194 {
00195   nev_ = 0;
00196   DQMStore *dbe = 0;
00197   dbe = Service<DQMStore>().operator->();
00198   
00199   if (dbe) {
00200     dbe->setCurrentFolder(dirname_);
00201     dbe->rmdir(dirname_);
00202   }
00203   
00204   
00205   if (dbe) {
00206     dbe->setCurrentFolder(dirname_);
00207 
00208     if ( ! plotAll_ ) {
00209       for(PathInfoCollection::iterator v = hltPaths_.begin();
00210           v!= hltPaths_.end(); ++v ) {
00211         MonitorElement *et, *eta, *phi, *etavsphi=0;
00212         std::string histoname(v->getName()+"_et");
00213         std::string title(v->getName()+" E_t");
00214         et =  dbe->book1D(histoname.c_str(),
00215                           title.c_str(),nBins_,
00216                           v->getPtMin(),
00217                           v->getPtMax());
00218       
00219         histoname = v->getName()+"_eta";
00220         title = v->getName()+" #eta";
00221         eta =  dbe->book1D(histoname.c_str(),
00222                            title.c_str(),nBins_,-2.7,2.7);
00223 
00224         histoname = v->getName()+"_phi";
00225         title = v->getName()+" #phi";
00226         phi =  dbe->book1D(histoname.c_str(),
00227                            histoname.c_str(),nBins_,-3.14,3.14);
00228  
00229 
00230         histoname = v->getName()+"_etaphi";
00231         title = v->getName()+" #eta vs #phi";
00232         etavsphi =  dbe->book2D(histoname.c_str(),
00233                                 title.c_str(),
00234                                 nBins_,-2.7,2.7,
00235                                 nBins_,-3.14, 3.14);
00236       
00237         v->setHistos( et, eta, phi, etavsphi);
00238       } 
00239     } // ! plotAll_ - for plotAll we discover it during the event
00240   }
00241 }

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

Reimplemented from edm::EDAnalyzer.

Definition at line 253 of file FourVectorHLT.cc.

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

00254 {
00255   LogDebug("Status") << "beginRun, run " << run.id();
00256 }

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

Reimplemented from edm::EDAnalyzer.

Definition at line 245 of file FourVectorHLT.cc.

References nev_.

00246 {
00247    LogInfo("Status") << "endJob: analyzed " << nev_ << " events";
00248    return;
00249 }

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 259 of file FourVectorHLT.cc.

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

00260 {
00261   LogDebug("Status") << "endRun, run " << run.id();
00262 }


Member Data Documentation

int FourVectorHLT::currentRun_ [private]

Definition at line 76 of file FourVectorHLT.h.

DQMStore* FourVectorHLT::dbe_ [private]

Definition at line 70 of file FourVectorHLT.h.

Referenced by analyze(), and FourVectorHLT().

std::string FourVectorHLT::dirname_ [private]

Definition at line 82 of file FourVectorHLT.h.

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

PathInfoCollection FourVectorHLT::hltPaths_ [private]

Definition at line 170 of file FourVectorHLT.h.

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

bool FourVectorHLT::monitorDaemon_ [private]

Definition at line 83 of file FourVectorHLT.h.

unsigned int FourVectorHLT::nBins_ [private]

Definition at line 78 of file FourVectorHLT.h.

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

int FourVectorHLT::nev_ [private]

Definition at line 69 of file FourVectorHLT.h.

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

bool FourVectorHLT::plotAll_ [private]

Definition at line 74 of file FourVectorHLT.h.

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

double FourVectorHLT::ptMax_ [private]

Definition at line 80 of file FourVectorHLT.h.

Referenced by analyze(), and FourVectorHLT().

double FourVectorHLT::ptMin_ [private]

Definition at line 79 of file FourVectorHLT.h.

Referenced by analyze(), and FourVectorHLT().

bool FourVectorHLT::resetMe_ [private]

Definition at line 75 of file FourVectorHLT.h.

int FourVectorHLT::theHLTOutputType [private]

Definition at line 84 of file FourVectorHLT.h.

MonitorElement* FourVectorHLT::total_ [private]

Definition at line 72 of file FourVectorHLT.h.

edm::InputTag FourVectorHLT::triggerResultLabel_ [private]

Definition at line 86 of file FourVectorHLT.h.

edm::InputTag FourVectorHLT::triggerSummaryLabel_ [private]

Definition at line 85 of file FourVectorHLT.h.

Referenced by analyze(), and FourVectorHLT().


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