CMS 3D CMS Logo

PFCandidateDQMAnalyzer.cc
Go to the documentation of this file.
2 
4 
9 
12 
16 
17 //
18 // -- Constructor
19 //
21 
22 {
24  inputLabel_ = pSet_.getParameter<edm::InputTag>("InputCollection");
25  matchLabel_ = pSet_.getParameter<edm::InputTag>("MatchCollection");
26  benchmarkLabel_ = pSet_.getParameter<std::string>("BenchmarkLabel");
27  createEfficiencyHistos_ = pSet_.getParameter<bool>("CreateEfficiencyHistos");
28 
29  pfCandidateMonitor_.setParameters(parameterSet);
30 
31  myCand_ = consumes<edm::View<reco::Candidate>>(inputLabel_);
32  myMatchedCand_ = consumes<edm::View<reco::Candidate>>(matchLabel_);
33 
35 
36  subsystemname_ = "ParticleFlow";
38 
39  nBadEvents_ = 0;
40 }
41 
42 //
43 // -- BookHistograms
44 //
46  edm::Run const & /* iRun */,
47  edm::EventSetup const & /* iSetup */) {
49 
50  edm::LogInfo("PFCandidateDQMAnalyzer") << " PFCandidateDQMAnalyzer::bookHistograms "
51  << "Histogram Folder path set to " << eventInfoFolder_;
52 
54 }
55 
56 //
57 // -- Analyze
58 //
61  edm::Handle<edm::View<reco::Candidate>> matchedCandCollection;
63  iEvent.getByToken(myCand_, candCollection);
64  iEvent.getByToken(myMatchedCand_, matchedCandCollection);
65  } else {
66  iEvent.getByToken(myMatchedCand_, candCollection);
67  iEvent.getByToken(myCand_, matchedCandCollection);
68  }
69 
70  float maxRes = 0.0;
71  float minRes = 99.99;
72  if (candCollection.isValid() && matchedCandCollection.isValid()) {
73  pfCandidateMonitor_.fill(*candCollection, *matchedCandCollection, minRes, maxRes, pSet_);
74  }
75 }
76 
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Candidate > > myCand_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
PFCandidateDQMAnalyzer(const edm::ParameterSet &parameterSet)
edm::EDGetTokenT< edm::View< reco::Candidate > > myMatchedCand_
void setup(DQMStore::IBooker &b)
book histograms
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
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
bool isValid() const
Definition: HandleBase.h:74
PFCandidateMonitor pfCandidateMonitor_
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
Definition: Run.h:45