CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFCandidateDQMAnalyzer Class Reference

#include <PFCandidateDQMAnalyzer.h>

Inheritance diagram for PFCandidateDQMAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 PFCandidateDQMAnalyzer (const edm::ParameterSet &parameterSet)
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 13 of file PFCandidateDQMAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 19 of file PFCandidateDQMAnalyzer.cc.

References benchmarkLabel_, edm::ParameterSet::getParameter(), inputLabel_, matchLabel_, pfCandidateMonitor_, pSet_, PFCandidateMonitor::setParameters(), and AlCaHLTBitMon_QueryRunRegistry::string.

21 {
22  pSet_ = parameterSet;
23  inputLabel_ = pSet_.getParameter<edm::InputTag>("InputCollection");
24  matchLabel_ = pSet_.getParameter<edm::InputTag>("MatchCollection");
25  benchmarkLabel_ = pSet_.getParameter<std::string>("BenchmarkLabel");
26 
27  pfCandidateMonitor_.setParameters(parameterSet);
28 
29 }
T getParameter(std::string const &) const
void setParameters(float dRMax, bool matchCharge, Benchmark::Mode mode, float ptmin, float ptmax, float etamin, float etamax, float phimin, float phimax, bool refHistoFlag)
set the parameters locally
PFCandidateMonitor pfCandidateMonitor_

Member Function Documentation

void PFCandidateDQMAnalyzer::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
privatevirtual

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

47  {
49  iEvent.getByLabel( inputLabel_, candCollection);
50 
51  edm::Handle< edm::View<reco::Candidate> > matchedCandCollection;
52  iEvent.getByLabel( matchLabel_, matchedCandCollection);
53 
54  float maxRes = 0.0;
55  float minRes = 99.99;
56  if (candCollection.isValid() && matchedCandCollection.isValid()) {
57  pfCandidateMonitor_.fill( *candCollection, *matchedCandCollection, minRes, maxRes);
58  edm::ParameterSet skimPS = pSet_.getParameter<edm::ParameterSet>("SkimParameter");
59  if ( (skimPS.getParameter<bool>("switchOn")) &&
60  (nBadEvents_ <= skimPS.getParameter<int32_t>("maximumNumberToBeStored")) ) {
61  if ( minRes < skimPS.getParameter<double>("lowerCutOffOnResolution")) {
62  nBadEvents_++;
63  storeBadEvents(iEvent,minRes);
64  } else if (maxRes > skimPS.getParameter<double>("upperCutOffOnResolution")) {
65  nBadEvents_++;
66  storeBadEvents(iEvent,maxRes);
67  }
68  }
69  }
70 }
T getParameter(std::string const &) const
int iEvent
Definition: GenABIO.cc:243
bool isValid() const
Definition: HandleBase.h:76
void fill(const T &candidateCollection, const C &matchedCandCollection, float &minVal, float &maxVal)
fill histograms with all particle
PFCandidateMonitor pfCandidateMonitor_
void storeBadEvents(edm::Event const &, float &val)
void PFCandidateDQMAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 33 of file PFCandidateDQMAnalyzer.cc.

References benchmarkLabel_, Benchmark::DQM_, nBadEvents_, cppFunctionSkipper::operator, getHLTPrescaleColumns::path, pfCandidateMonitor_, pSet_, DQMStore::setCurrentFolder(), PFCandidateMonitor::setup(), and AlCaHLTBitMon_QueryRunRegistry::string.

33  {
34 
36  // part of the following could be put in the base class
37  std::string path = "ParticleFlow/" + benchmarkLabel_;
39  edm::LogInfo("PFCandidateDQMAnalyzer") << " PFCandidateDQMAnalyzer::beginJob " << "Histogram Folder path set to "<< path;
41  nBadEvents_ = 0;
42 }
void setup()
book histograms
static DQMStore * DQM_
Definition: Benchmark.h:39
PFCandidateMonitor pfCandidateMonitor_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void PFCandidateDQMAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 88 of file PFCandidateDQMAnalyzer.cc.

88  {
89 }
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(), getHLTPrescaleColumns::path, MonitorElement::Reset(), edm::EventID::run(), DQMStore::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

71  {
72  unsigned int runNb = iEvent.id().run();
73  unsigned int evtNb = iEvent.id().event();
74  unsigned int lumiNb = iEvent.id().luminosityBlock();
75 
76  std::string path = "ParticleFlow/" + benchmarkLabel_ + "/BadEvents";
77  Benchmark::DQM_->setCurrentFolder(path.c_str());
78  std::ostringstream eventid_str;
79  eventid_str << runNb << "_"<< evtNb << "_" << lumiNb;
80  MonitorElement* me = Benchmark::DQM_->get(path + "/" + eventid_str.str());
81  if (me) me->Reset();
82  else me = Benchmark::DQM_->bookFloat(eventid_str.str());
83  me->Fill(val);
84 }
static DQMStore * DQM_
Definition: Benchmark.h:39
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:659
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:243
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
void Reset(void)
reset ME (ie. contents, errors, etc)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434

Member Data Documentation

std::string PFCandidateDQMAnalyzer::benchmarkLabel_
private

Definition at line 27 of file PFCandidateDQMAnalyzer.h.

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

edm::InputTag PFCandidateDQMAnalyzer::inputLabel_
private

Definition at line 26 of file PFCandidateDQMAnalyzer.h.

Referenced by analyze(), and PFCandidateDQMAnalyzer().

edm::InputTag PFCandidateDQMAnalyzer::matchLabel_
private

Definition at line 25 of file PFCandidateDQMAnalyzer.h.

Referenced by analyze(), and PFCandidateDQMAnalyzer().

int PFCandidateDQMAnalyzer::nBadEvents_
private

Definition at line 33 of file PFCandidateDQMAnalyzer.h.

Referenced by analyze(), and beginJob().

PFCandidateMonitor PFCandidateDQMAnalyzer::pfCandidateMonitor_
private

Definition at line 29 of file PFCandidateDQMAnalyzer.h.

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

edm::ParameterSet PFCandidateDQMAnalyzer::pSet_
private

Definition at line 31 of file PFCandidateDQMAnalyzer.h.

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