CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PFCandidateDQMAnalyzer Class Reference

#include <PFCandidateDQMAnalyzer.h>

Inheritance diagram for PFCandidateDQMAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

 PFCandidateDQMAnalyzer (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_
PFCandidateMonitor pfCandidateMonitor_
edm::ParameterSet pSet_

Detailed Description

Definition at line 13 of file PFCandidateDQMAnalyzer.h.


Constructor & Destructor Documentation

PFCandidateDQMAnalyzer::PFCandidateDQMAnalyzer ( const edm::ParameterSet parameterSet)

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 46 of file PFCandidateDQMAnalyzer.cc.

References PFCandidateMonitor::fill(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), inputLabel_, edm::HandleBase::isValid(), matchLabel_, nBadEvents_, pfCandidateMonitor_, pSet_, and storeBadEvents().

                                                                   {
  edm::Handle< edm::View<reco::Candidate> > candCollection;
  iEvent.getByLabel( inputLabel_, candCollection);

  edm::Handle< edm::View<reco::Candidate> > matchedCandCollection;
  iEvent.getByLabel( matchLabel_, matchedCandCollection);

  float maxRes = 0.0;
  float minRes = 99.99;
  if (candCollection.isValid() && matchedCandCollection.isValid()) {
    pfCandidateMonitor_.fill( *candCollection, *matchedCandCollection, 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")) {
        nBadEvents_++; 
        storeBadEvents(iEvent,minRes);
      } else if (maxRes > skimPS.getParameter<double>("upperCutOffOnResolution")) {
        nBadEvents_++;
        storeBadEvents(iEvent,maxRes);
      }
    }
  }
}
void PFCandidateDQMAnalyzer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 33 of file PFCandidateDQMAnalyzer.cc.

References benchmarkLabel_, Benchmark::DQM_, nBadEvents_, cmsCodeRules::cppFunctionSkipper::operator, path(), pfCandidateMonitor_, pSet_, DQMStore::setCurrentFolder(), and PFCandidateMonitor::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("PFCandidateDQMAnalyzer") << " PFCandidateDQMAnalyzer::beginJob " << "Histogram Folder path set to "<< path;
  pfCandidateMonitor_.setup(pSet_);  
  nBadEvents_ = 0;
}
void PFCandidateDQMAnalyzer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 88 of file PFCandidateDQMAnalyzer.cc.

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

Definition at line 71 of file PFCandidateDQMAnalyzer.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

Definition at line 27 of file PFCandidateDQMAnalyzer.h.

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

Definition at line 26 of file PFCandidateDQMAnalyzer.h.

Referenced by analyze(), and PFCandidateDQMAnalyzer().

Definition at line 25 of file PFCandidateDQMAnalyzer.h.

Referenced by analyze(), and PFCandidateDQMAnalyzer().

Definition at line 33 of file PFCandidateDQMAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 29 of file PFCandidateDQMAnalyzer.h.

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

Definition at line 31 of file PFCandidateDQMAnalyzer.h.

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