test
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
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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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_
 
bool createEfficiencyHistos_
 
edm::InputTag inputLabel_
 
edm::InputTag matchLabel_
 
edm::EDGetTokenT< edm::View
< reco::Candidate > > 
myCand_
 
edm::EDGetTokenT< edm::View
< reco::Candidate > > 
myMatchedCand_
 
int nBadEvents_
 
PFCandidateMonitor pfCandidateMonitor_
 
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 PFCandidateDQMAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 19 of file PFCandidateDQMAnalyzer.cc.

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

21 {
23  inputLabel_ = pSet_.getParameter<edm::InputTag>("InputCollection");
24  matchLabel_ = pSet_.getParameter<edm::InputTag>("MatchCollection");
25  benchmarkLabel_ = pSet_.getParameter<std::string>("BenchmarkLabel");
26  createEfficiencyHistos_ = pSet_.getParameter<bool>( "CreateEfficiencyHistos" );
27 
28  pfCandidateMonitor_.setParameters(parameterSet);
29 
30  myCand_ = consumes< edm::View<reco::Candidate> >(inputLabel_);
31  myMatchedCand_ = consumes< edm::View<reco::Candidate> >(matchLabel_);
32 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Candidate > > myMatchedCand_
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
edm::EDGetTokenT< edm::View< reco::Candidate > > myCand_
PFCandidateMonitor pfCandidateMonitor_
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 49 of file PFCandidateDQMAnalyzer.cc.

References createEfficiencyHistos_, PFCandidateMonitor::fill(), edm::Event::getByToken(), edm::ParameterSet::getParameter(), edm::HandleBase::isValid(), myCand_, myMatchedCand_, nBadEvents_, pfCandidateMonitor_, pSet_, and storeBadEvents().

50  {
51 
53  edm::Handle< edm::View<reco::Candidate> > matchedCandCollection;
54  if ( !createEfficiencyHistos_ ) {
55  iEvent.getByToken( myCand_, candCollection);
56  iEvent.getByToken( myMatchedCand_, matchedCandCollection);
57  } else {
58  iEvent.getByToken( myMatchedCand_, candCollection);
59  iEvent.getByToken( myCand_, matchedCandCollection);
60  }
61 
62  float maxRes = 0.0;
63  float minRes = 99.99;
64  if (candCollection.isValid() && matchedCandCollection.isValid()) {
65  //pfCandidateMonitor_.fill( *candCollection, *matchedCandCollection, minRes, maxRes);
66  pfCandidateMonitor_.fill( *candCollection, *matchedCandCollection, minRes, maxRes, pSet_);
67 
68  edm::ParameterSet skimPS = pSet_.getParameter<edm::ParameterSet>("SkimParameter");
69  if ( (skimPS.getParameter<bool>("switchOn")) &&
70  (nBadEvents_ <= skimPS.getParameter<int32_t>("maximumNumberToBeStored")) ) {
71  if ( minRes < skimPS.getParameter<double>("lowerCutOffOnResolution")) {
72  nBadEvents_++;
73  storeBadEvents(iEvent,minRes);
74  } else if (maxRes > skimPS.getParameter<double>("upperCutOffOnResolution")) {
75  nBadEvents_++;
76  storeBadEvents(iEvent,maxRes);
77  }
78  }
79 
80  }
81 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Candidate > > myMatchedCand_
void fill(const T &candidateCollection, const C &matchedCandCollection, float &minVal, float &maxVal, const edm::ParameterSet &parameterSet)
fill histograms with all particle
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< edm::View< reco::Candidate > > myCand_
bool isValid() const
Definition: HandleBase.h:76
PFCandidateMonitor pfCandidateMonitor_
void storeBadEvents(edm::Event const &, float &val)
void PFCandidateDQMAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 36 of file PFCandidateDQMAnalyzer.cc.

References benchmarkLabel_, Benchmark::DQM_, nBadEvents_, cppFunctionSkipper::operator, cmsHarvester::path, pfCandidateMonitor_, pSet_, DQMStore::setCurrentFolder(), PFCandidateMonitor::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("PFCandidateDQMAnalyzer") << " PFCandidateDQMAnalyzer::beginJob " << "Histogram Folder path set to "<< path;
44  nBadEvents_ = 0;
45 }
void setup()
book histograms
static DQMStore * DQM_
Definition: Benchmark.h:40
tuple path
else: Piece not in the list, fine.
PFCandidateMonitor pfCandidateMonitor_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
void PFCandidateDQMAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 99 of file PFCandidateDQMAnalyzer.cc.

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

Definition at line 82 of file PFCandidateDQMAnalyzer.cc.

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

Referenced by analyze().

82  {
83  unsigned int runNb = iEvent.id().run();
84  unsigned int evtNb = iEvent.id().event();
85  unsigned int lumiNb = iEvent.id().luminosityBlock();
86 
87  std::string path = "ParticleFlow/" + benchmarkLabel_ + "/BadEvents";
88  Benchmark::DQM_->setCurrentFolder(path.c_str());
89  std::ostringstream eventid_str;
90  eventid_str << runNb << "_"<< evtNb << "_" << lumiNb;
91  MonitorElement* me = Benchmark::DQM_->get(path + "/" + eventid_str.str());
92  if (me) me->Reset();
93  else me = Benchmark::DQM_->bookFloat(eventid_str.str());
94  me->Fill(val);
95 }
static DQMStore * DQM_
Definition: Benchmark.h:40
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:891
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:230
tuple path
else: Piece not in the list, fine.
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
void Reset(void)
reset ME (ie. contents, errors, etc)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667

Member Data Documentation

std::string PFCandidateDQMAnalyzer::benchmarkLabel_
private

Definition at line 30 of file PFCandidateDQMAnalyzer.h.

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

bool PFCandidateDQMAnalyzer::createEfficiencyHistos_
private

Definition at line 31 of file PFCandidateDQMAnalyzer.h.

Referenced by analyze(), and PFCandidateDQMAnalyzer().

edm::InputTag PFCandidateDQMAnalyzer::inputLabel_
private

Definition at line 29 of file PFCandidateDQMAnalyzer.h.

Referenced by PFCandidateDQMAnalyzer().

edm::InputTag PFCandidateDQMAnalyzer::matchLabel_
private

Definition at line 28 of file PFCandidateDQMAnalyzer.h.

Referenced by PFCandidateDQMAnalyzer().

edm::EDGetTokenT< edm::View<reco::Candidate> > PFCandidateDQMAnalyzer::myCand_
private

Definition at line 26 of file PFCandidateDQMAnalyzer.h.

Referenced by analyze(), and PFCandidateDQMAnalyzer().

edm::EDGetTokenT< edm::View<reco::Candidate> > PFCandidateDQMAnalyzer::myMatchedCand_
private

Definition at line 27 of file PFCandidateDQMAnalyzer.h.

Referenced by analyze(), and PFCandidateDQMAnalyzer().

int PFCandidateDQMAnalyzer::nBadEvents_
private

Definition at line 37 of file PFCandidateDQMAnalyzer.h.

Referenced by analyze(), and beginJob().

PFCandidateMonitor PFCandidateDQMAnalyzer::pfCandidateMonitor_
private

Definition at line 33 of file PFCandidateDQMAnalyzer.h.

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

edm::ParameterSet PFCandidateDQMAnalyzer::pSet_
private

Definition at line 35 of file PFCandidateDQMAnalyzer.h.

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