CMS 3D CMS Logo

PFCandidateDQMAnalyzer.cc
Go to the documentation of this file.
2 
4 
9 
12 
14 
15 //
16 // -- Constructor
17 //
19 
20 {
22  inputLabel_ = pSet_.getParameter<edm::InputTag>("InputCollection");
23  matchLabel_ = pSet_.getParameter<edm::InputTag>("MatchCollection");
24  benchmarkLabel_ = pSet_.getParameter<std::string>("BenchmarkLabel");
25  createEfficiencyHistos_ = pSet_.getParameter<bool>("CreateEfficiencyHistos");
26 
28 
29  myCand_ = consumes<edm::View<reco::Candidate>>(inputLabel_);
30  myMatchedCand_ = consumes<edm::View<reco::Candidate>>(matchLabel_);
31 
33 
34  subsystemname_ = "ParticleFlow";
36 
37  nBadEvents_ = 0;
38 }
39 
40 //
41 // -- BookHistograms
42 //
44  edm::Run const & /* iRun */,
45  edm::EventSetup const & /* iSetup */) {
47 
48  edm::LogInfo("PFCandidateDQMAnalyzer") << " PFCandidateDQMAnalyzer::bookHistograms "
49  << "Histogram Folder path set to " << eventInfoFolder_;
50 
52 }
53 
54 //
55 // -- Analyze
56 //
59  edm::Handle<edm::View<reco::Candidate>> matchedCandCollection;
61  iEvent.getByToken(myCand_, candCollection);
62  iEvent.getByToken(myMatchedCand_, matchedCandCollection);
63  } else {
64  iEvent.getByToken(myMatchedCand_, candCollection);
65  iEvent.getByToken(myCand_, matchedCandCollection);
66  }
67 
68  float maxRes = 0.0;
69  float minRes = 99.99;
70  if (candCollection.isValid() && matchedCandCollection.isValid()) {
71  pfCandidateMonitor_.fill(*candCollection, *matchedCandCollection, minRes, maxRes, pSet_);
72  }
73 }
74 
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
edm::EDGetTokenT< edm::View< reco::Candidate > > myCand_
PFCandidateDQMAnalyzer(const edm::ParameterSet &parameterSet)
edm::EDGetTokenT< edm::View< reco::Candidate > > myMatchedCand_
void setup(DQMStore::IBooker &b)
book histograms
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
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
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void analyze(edm::Event const &, edm::EventSetup const &) override
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:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Log< level::Info, false > LogInfo
PFCandidateMonitor pfCandidateMonitor_
bool isValid() const
Definition: HandleBase.h:70
Definition: Run.h:45