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
PFMETDQMAnalyzer Class Reference

#include <PFMETDQMAnalyzer.h>

Inheritance diagram for PFMETDQMAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 PFMETDQMAnalyzer (const edm::ParameterSet &parameterSet)
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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_
 
edm::EDGetTokenT< edm::View
< reco::MET > > 
myMatchedMET_
 
edm::EDGetTokenT< edm::View
< reco::MET > > 
myMET_
 
int nBadEvents_
 
PFMETMonitor pfMETMonitor_
 
edm::ParameterSet pSet_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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::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 14 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_, myMatchedMET_, myMET_, edm::parameterSet(), pfMETMonitor_, pSet_, PFMETMonitor::setParameters(), and AlCaHLTBitMon_QueryRunRegistry::string.

22 {
24  inputLabel_ = pSet_.getParameter<edm::InputTag>("InputCollection");
25  matchLabel_ = pSet_.getParameter<edm::InputTag>("MatchCollection");
26  benchmarkLabel_ = pSet_.getParameter<std::string>("BenchmarkLabel");
27 
28  pfMETMonitor_.setParameters(parameterSet);
29 
30  myMET_ = consumes< edm::View<reco::MET> >(inputLabel_);
31  myMatchedMET_ = consumes< edm::View<reco::MET> >(matchLabel_);
32 }
T getParameter(std::string const &) const
void setParameters(Benchmark::Mode mode, float ptmin, float ptmax, float etamin, float etamax, float phimin, float phimax, bool metSpHistos)
set the parameters locally
Definition: PFMETMonitor.cc:67
edm::EDGetTokenT< edm::View< reco::MET > > myMET_
edm::EDGetTokenT< edm::View< reco::MET > > myMatchedMET_
edm::InputTag inputLabel_
edm::InputTag matchLabel_
PFMETMonitor pfMETMonitor_
std::string benchmarkLabel_
edm::ParameterSet pSet_
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 49 of file PFMETDQMAnalyzer.cc.

References PFMETMonitor::fillOne(), edm::Event::getByToken(), edm::ParameterSet::getParameter(), edm::HandleBase::isValid(), myMatchedMET_, myMET_, nBadEvents_, pfMETMonitor_, pSet_, and storeBadEvents().

50  {
51  edm::Handle< edm::View<reco::MET> > metCollection;
52  iEvent.getByToken(myMET_, metCollection);
53 
54  edm::Handle< edm::View<reco::MET> > matchedMetCollection;
55  iEvent.getByToken(myMatchedMET_, matchedMetCollection);
56 
57  if (metCollection.isValid() && matchedMetCollection.isValid()) {
58  float maxRes = 0.0;
59  float minRes = 99.99;
60  pfMETMonitor_.fillOne( (*metCollection)[0], (*matchedMetCollection)[0], minRes, maxRes);
61  //pfMETMonitor_.fillOne( (*metCollection)[0], (*matchedMetCollection)[0], minRes, maxRes, pSet_);
62  edm::ParameterSet skimPS = pSet_.getParameter<edm::ParameterSet>("SkimParameter");
63  if ( (skimPS.getParameter<bool>("switchOn")) &&
64  (nBadEvents_ <= skimPS.getParameter<int32_t>("maximumNumberToBeStored")) ) {
65  if ( minRes < skimPS.getParameter<double>("lowerCutOffOnResolution")) {
66  storeBadEvents(iEvent,minRes);
67  nBadEvents_++;
68  } else if (maxRes > skimPS.getParameter<double>("upperCutOffOnResolution")) {
69  nBadEvents_++;
70  storeBadEvents(iEvent,maxRes);
71  }
72  }
73  }
74 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::MET > > myMET_
edm::EDGetTokenT< edm::View< reco::MET > > myMatchedMET_
PFMETMonitor pfMETMonitor_
int iEvent
Definition: GenABIO.cc:243
bool isValid() const
Definition: HandleBase.h:76
void fillOne(const reco::MET &met, const reco::MET &matchedMet, float &minVal, float &maxVal)
void storeBadEvents(edm::Event const &, float &val)
edm::ParameterSet pSet_
void PFMETDQMAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 36 of file PFMETDQMAnalyzer.cc.

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

36  {
37 
39  // part of the following could be put in the base class
40  std::string path = "ParticleFlow/" + benchmarkLabel_;
42  edm::LogInfo("PFJMETDQMAnalyzer") << " PFMETDQMAnalyzer::beginJob " <<"Histogram Folder path set to "<< path;
44  nBadEvents_ = 0;
45 }
PFMETMonitor pfMETMonitor_
static DQMStore * DQM_
Definition: Benchmark.h:40
std::string benchmarkLabel_
edm::ParameterSet pSet_
void setup()
book histograms
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void PFMETDQMAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 93 of file PFMETDQMAnalyzer.cc.

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

Definition at line 75 of file PFMETDQMAnalyzer.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().

75  {
76  unsigned int runNb = iEvent.id().run();
77  unsigned int evtNb = iEvent.id().event();
78  unsigned int lumiNb = iEvent.id().luminosityBlock();
79 
80  std::string path = "ParticleFlow/" + benchmarkLabel_ + "/BadEvents";
81  Benchmark::DQM_->setCurrentFolder(path.c_str());
82  std::ostringstream eventid_str;
83  eventid_str << runNb << "_"<< evtNb << "_" << lumiNb;
84  MonitorElement* me = Benchmark::DQM_->get(path + "/" + eventid_str.str());
85  if (me) me->Reset();
86  else me = Benchmark::DQM_->bookFloat(eventid_str.str());
87  me->Fill(val);
88 }
static DQMStore * DQM_
Definition: Benchmark.h:40
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:809
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:1623
std::string benchmarkLabel_
void Reset(void)
reset ME (ie. contents, errors, etc)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584

Member Data Documentation

std::string PFMETDQMAnalyzer::benchmarkLabel_
private

Definition at line 30 of file PFMETDQMAnalyzer.h.

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

edm::InputTag PFMETDQMAnalyzer::inputLabel_
private

Definition at line 29 of file PFMETDQMAnalyzer.h.

Referenced by PFMETDQMAnalyzer().

edm::InputTag PFMETDQMAnalyzer::matchLabel_
private

Definition at line 28 of file PFMETDQMAnalyzer.h.

Referenced by PFMETDQMAnalyzer().

edm::EDGetTokenT< edm::View<reco::MET> > PFMETDQMAnalyzer::myMatchedMET_
private

Definition at line 27 of file PFMETDQMAnalyzer.h.

Referenced by analyze(), and PFMETDQMAnalyzer().

edm::EDGetTokenT< edm::View<reco::MET> > PFMETDQMAnalyzer::myMET_
private

Definition at line 26 of file PFMETDQMAnalyzer.h.

Referenced by analyze(), and PFMETDQMAnalyzer().

int PFMETDQMAnalyzer::nBadEvents_
private

Definition at line 36 of file PFMETDQMAnalyzer.h.

Referenced by analyze(), and beginJob().

PFMETMonitor PFMETDQMAnalyzer::pfMETMonitor_
private

Definition at line 32 of file PFMETDQMAnalyzer.h.

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

edm::ParameterSet PFMETDQMAnalyzer::pSet_
private

Definition at line 34 of file PFMETDQMAnalyzer.h.

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