CMS 3D CMS Logo

PFCandidateDQMAnalyzer.cc
Go to the documentation of this file.
2 
4 
9 
12 
16 
17 
18 //
19 // -- Constructor
20 //
22 
23 {
25  inputLabel_ = pSet_.getParameter<edm::InputTag>("InputCollection");
26  matchLabel_ = pSet_.getParameter<edm::InputTag>("MatchCollection");
27  benchmarkLabel_ = pSet_.getParameter<std::string>("BenchmarkLabel");
28  createEfficiencyHistos_ = pSet_.getParameter<bool>( "CreateEfficiencyHistos" );
29 
30  pfCandidateMonitor_.setParameters(parameterSet);
31 
32  myCand_ = consumes< edm::View<reco::Candidate> >(inputLabel_);
33  myMatchedCand_ = consumes< edm::View<reco::Candidate> >(matchLabel_);
34 
35 
37 
38  subsystemname_ = "ParticleFlow" ;
40 
41  nBadEvents_ = 0;
42 
43 }
44 
45 
46 //
47 // -- BookHistograms
48 //
50  edm::Run const & /* iRun */,
51  edm::EventSetup const & /* iSetup */ )
52 {
54 
55  edm::LogInfo("PFCandidateDQMAnalyzer") << " PFCandidateDQMAnalyzer::bookHistograms " << "Histogram Folder path set to " << eventInfoFolder_;
56 
58 }
59 
60 
61 //
62 // -- Analyze
63 //
65  edm::EventSetup const& iSetup) {
66 
68  edm::Handle< edm::View<reco::Candidate> > matchedCandCollection;
69  if ( !createEfficiencyHistos_ ) {
70  iEvent.getByToken( myCand_, candCollection);
71  iEvent.getByToken( myMatchedCand_, matchedCandCollection);
72  } else {
73  iEvent.getByToken( myMatchedCand_, candCollection);
74  iEvent.getByToken( myCand_, matchedCandCollection);
75  }
76 
77  float maxRes = 0.0;
78  float minRes = 99.99;
79  if (candCollection.isValid() && matchedCandCollection.isValid()) {
80  pfCandidateMonitor_.fill( *candCollection, *matchedCandCollection, minRes, maxRes, pSet_);
81 
82  }
83 }
84 
85 
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Candidate > > myMatchedCand_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
PFCandidateDQMAnalyzer(const edm::ParameterSet &parameterSet)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
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:230
edm::EDGetTokenT< edm::View< reco::Candidate > > myCand_
bool isValid() const
Definition: HandleBase.h:74
PFCandidateMonitor pfCandidateMonitor_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
Definition: Run.h:43