test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFJetDQMAnalyzer.cc
Go to the documentation of this file.
2 
4 
9 
15 
19 
20 
21 //
22 // -- Constructor
23 //
25 
26 {
28  inputLabel_ = pSet_.getParameter<edm::InputTag>("InputCollection");
29  matchLabel_ = pSet_.getParameter<edm::InputTag>("MatchCollection");
30  benchmarkLabel_ = pSet_.getParameter<std::string>("BenchmarkLabel");
31 
32  pfJetMonitor_.setParameters(parameterSet); // set parameters for booking histograms and validating jet
33 
34  myJet_ = consumes< edm::View<reco::Jet> >(inputLabel_);
35  myMatchedJet_ = consumes< edm::View<reco::Jet> >(matchLabel_);
36 
37 
38  std::string folder = benchmarkLabel_ ;
39 
40  subsystemname_ = "ParticleFlow" ;
41  eventInfoFolder_ = subsystemname_ + "/" + folder ;
42 
43  nBadEvents_ = 0;
44 
45 }
46 
47 
48 //
49 // -- BookHistograms
50 //
52  edm::Run const & /* iRun */,
53  edm::EventSetup const & /* iSetup */ )
54 {
56 
57  edm::LogInfo("PFJetDQMAnalyzer") << " PFJetDQMAnalyzer::bookHistograms " << "Histogram Folder path set to " << eventInfoFolder_;
58 
59  pfJetMonitor_.setup(ibooker, pSet_);
60 }
61 
62 
63 //
64 // -- Analyze
65 //
67 
68  edm::Handle< edm::View<reco::Jet> > jetCollection;
69  iEvent.getByToken(myJet_, jetCollection);
70 
71  edm::Handle< edm::View<reco::Jet> > matchedJetCollection;
72  iEvent.getByToken(myMatchedJet_, matchedJetCollection);
73 
74  float maxRes = 0.0;
75  float minRes = 99.99;
76  float jetpT = 0.0;
77  if (jetCollection.isValid() && matchedJetCollection.isValid()) {
78  pfJetMonitor_.fill( *jetCollection, *matchedJetCollection, minRes, maxRes, jetpT, pSet_); // match collections and fill pt eta phi and charge histos for candidate jet, fill delta_x_VS_y histos for matched couples, book and fill delta_frac_VS_frac histos for matched couples
79 
80  }
81 }
82 
83 
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
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:78
void setup(DQMStore::IBooker &b)
book histograms
int iEvent
Definition: GenABIO.cc:230
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:70
std::string benchmarkLabel_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
bool isValid() const
Definition: HandleBase.h:75
edm::EDGetTokenT< edm::View< reco::Jet > > myMatchedJet_
edm::ParameterSet pSet_
edm::InputTag matchLabel_
std::string eventInfoFolder_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
edm::EDGetTokenT< edm::View< reco::Jet > > myJet_
std::string subsystemname_
void analyze(edm::Event const &, edm::EventSetup const &)
PFJetDQMAnalyzer(const edm::ParameterSet &parameterSet)
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
Definition: Run.h:43