CMS 3D CMS Logo

PFJetDQMAnalyzer.cc
Go to the documentation of this file.
2 
4 
9 
15 
19 
20 //
21 // -- Constructor
22 //
24 
25 {
27  inputLabel_ = pSet_.getParameter<edm::InputTag>("InputCollection");
28  matchLabel_ = pSet_.getParameter<edm::InputTag>("MatchCollection");
29  benchmarkLabel_ = pSet_.getParameter<std::string>("BenchmarkLabel");
30 
31  pfJetMonitor_.setParameters(parameterSet); // set parameters for booking histograms and validating jet
32 
33  myJet_ = consumes<edm::View<reco::Jet>>(inputLabel_);
34  myMatchedJet_ = consumes<edm::View<reco::Jet>>(matchLabel_);
35 
37 
38  subsystemname_ = "ParticleFlow";
40 
41  nBadEvents_ = 0;
42 }
43 
44 //
45 // -- BookHistograms
46 //
48  edm::Run const & /* iRun */,
49  edm::EventSetup const & /* iSetup */) {
51 
52  edm::LogInfo("PFJetDQMAnalyzer") << " PFJetDQMAnalyzer::bookHistograms "
53  << "Histogram Folder path set to " << eventInfoFolder_;
54 
55  pfJetMonitor_.setup(ibooker, pSet_);
56 }
57 
58 //
59 // -- Analyze
60 //
62  edm::Handle<edm::View<reco::Jet>> jetCollection;
63  iEvent.getByToken(myJet_, jetCollection);
64 
65  edm::Handle<edm::View<reco::Jet>> matchedJetCollection;
66  iEvent.getByToken(myMatchedJet_, matchedJetCollection);
67 
68  float maxRes = 0.0;
69  float minRes = 99.99;
70  float jetpT = 0.0;
71  if (jetCollection.isValid() && matchedJetCollection.isValid()) {
72  pfJetMonitor_.fill(*jetCollection,
73  *matchedJetCollection,
74  minRes,
75  maxRes,
76  jetpT,
77  pSet_); // match collections and fill pt eta phi and charge histos for
78  // candidate jet, fill delta_x_VS_y histos for matched couples,
79  // book and fill delta_frac_VS_frac histos for matched couples
80  }
81 }
82 
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::InputTag inputLabel_
PFJetMonitor pfJetMonitor_
void fill(const T &jetCollection, const C &matchedJetCollection, float &minVal, float &maxVal)
fill histograms with all particle
Definition: PFJetMonitor.h:89
edm::EDGetTokenT< edm::View< reco::Jet > > myJet_
void analyze(edm::Event const &, edm::EventSetup const &) override
void setup(DQMStore::IBooker &b)
book histograms
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
void setParameters(float dRMax, bool matchCharge, Benchmark::Mode mode, float ptmin, float ptmax, float etamin, float etamax, float phimin, float phimax, bool fracHistoFlag=true)
set the parameters locally
Definition: PFJetMonitor.cc:60
std::string benchmarkLabel_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< edm::View< reco::Jet > > myMatchedJet_
edm::ParameterSet pSet_
edm::InputTag matchLabel_
std::string eventInfoFolder_
std::string subsystemname_
PFJetDQMAnalyzer(const edm::ParameterSet &parameterSet)
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
Definition: Run.h:45