CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PFMETDQMAnalyzer Class Reference

#include <PFMETDQMAnalyzer.h>

Inheritance diagram for PFMETDQMAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

 PFMETDQMAnalyzer (const edm::ParameterSet &parameterSet)

Private Member Functions

void analyze (edm::Event const &, edm::EventSetup const &)
void beginJob ()
void endJob ()
void storeBadEvents (edm::Event const &, float &val)

Private Attributes

std::string benchmarkLabel_
edm::InputTag inputLabel_
edm::InputTag matchLabel_
int nBadEvents_
PFMETMonitor pfMETMonitor_
edm::ParameterSet pSet_

Detailed Description

Definition at line 13 of file PFMETDQMAnalyzer.h.


Constructor & Destructor Documentation

PFMETDQMAnalyzer::PFMETDQMAnalyzer ( const edm::ParameterSet parameterSet)

Definition at line 20 of file PFMETDQMAnalyzer.cc.

References benchmarkLabel_, edm::ParameterSet::getParameter(), inputLabel_, matchLabel_, pfMETMonitor_, pSet_, and PFMETMonitor::setParameters().

{
  pSet_                = parameterSet;
  inputLabel_          = pSet_.getParameter<edm::InputTag>("InputCollection");
  matchLabel_          = pSet_.getParameter<edm::InputTag>("MatchCollection");
  benchmarkLabel_      = pSet_.getParameter<std::string>("BenchmarkLabel"); 

  pfMETMonitor_.setParameters(parameterSet);  

}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 47 of file PFMETDQMAnalyzer.cc.

References PFMETMonitor::fillOne(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), inputLabel_, edm::HandleBase::isValid(), matchLabel_, nBadEvents_, pfMETMonitor_, pSet_, and storeBadEvents().

                                                                   {
  edm::Handle< edm::View<reco::MET> > metCollection;
  iEvent.getByLabel(inputLabel_, metCollection);   
  
  edm::Handle< edm::View<reco::MET> > matchedMetCollection; 
  iEvent.getByLabel( matchLabel_, matchedMetCollection);

  if (metCollection.isValid() && matchedMetCollection.isValid()) {
    float maxRes = 0.0;
    float minRes = 99.99;
    pfMETMonitor_.fillOne( (*metCollection)[0], (*matchedMetCollection)[0], minRes, maxRes);    
    edm::ParameterSet skimPS = pSet_.getParameter<edm::ParameterSet>("SkimParameter");
    if ( (skimPS.getParameter<bool>("switchOn")) && 
         (nBadEvents_ <= skimPS.getParameter<int32_t>("maximumNumberToBeStored")) ) {
      if ( minRes < skimPS.getParameter<double>("lowerCutOffOnResolution")) {
        storeBadEvents(iEvent,minRes);
        nBadEvents_++;
      } else if (maxRes > skimPS.getParameter<double>("upperCutOffOnResolution")) {
        nBadEvents_++;
        storeBadEvents(iEvent,maxRes);
      }
    }
  }
}
void PFMETDQMAnalyzer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 34 of file PFMETDQMAnalyzer.cc.

References benchmarkLabel_, Benchmark::DQM_, nBadEvents_, cmsCodeRules::cppFunctionSkipper::operator, path(), pfMETMonitor_, pSet_, DQMStore::setCurrentFolder(), and PFMETMonitor::setup().

                                {

  Benchmark::DQM_ = edm::Service<DQMStore>().operator->();
  // part of the following could be put in the base class
  std::string path = "ParticleFlow/" + benchmarkLabel_;
  Benchmark::DQM_->setCurrentFolder(path.c_str());
  edm::LogInfo("PFJMETDQMAnalyzer") << " PFMETDQMAnalyzer::beginJob " <<"Histogram Folder path set to "<< path;
  pfMETMonitor_.setup(pSet_);  
  nBadEvents_ = 0;
}
void PFMETDQMAnalyzer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 90 of file PFMETDQMAnalyzer.cc.

                              {
}
void PFMETDQMAnalyzer::storeBadEvents ( edm::Event const &  iEvent,
float &  val 
) [private]

Definition at line 72 of file PFMETDQMAnalyzer.cc.

References benchmarkLabel_, DQMStore::bookFloat(), Benchmark::DQM_, edm::EventID::event(), MonitorElement::Fill(), DQMStore::get(), edm::EventBase::id(), edm::EventID::luminosityBlock(), path(), MonitorElement::Reset(), edm::EventID::run(), and DQMStore::setCurrentFolder().

Referenced by analyze().

                                                                        {
  unsigned int runNb  = iEvent.id().run();
  unsigned int evtNb  = iEvent.id().event();
  unsigned int lumiNb = iEvent.id().luminosityBlock();
  
  std::string path = "ParticleFlow/" + benchmarkLabel_ + "/BadEvents";
  Benchmark::DQM_->setCurrentFolder(path.c_str());
  std::ostringstream eventid_str;
  eventid_str << runNb << "_"<< evtNb << "_" << lumiNb;
  MonitorElement* me = Benchmark::DQM_->get(path + "/" + eventid_str.str());
  if (me) me->Reset();
  else me = Benchmark::DQM_->bookFloat(eventid_str.str());
  me->Fill(val);  
}

Member Data Documentation

std::string PFMETDQMAnalyzer::benchmarkLabel_ [private]

Definition at line 27 of file PFMETDQMAnalyzer.h.

Referenced by beginJob(), PFMETDQMAnalyzer(), and storeBadEvents().

Definition at line 26 of file PFMETDQMAnalyzer.h.

Referenced by analyze(), and PFMETDQMAnalyzer().

Definition at line 25 of file PFMETDQMAnalyzer.h.

Referenced by analyze(), and PFMETDQMAnalyzer().

Definition at line 33 of file PFMETDQMAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 29 of file PFMETDQMAnalyzer.h.

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

Definition at line 31 of file PFMETDQMAnalyzer.h.

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