CMS 3D CMS Logo

PFMETBenchmarkAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package:
4 // Class: PFMETBenchmarkAnalyzer.cc
5 //
14 //
15 // Original Author: Michel Della Negra
16 // Created: Wed Jan 23 10:11:13 CET 2008
17 // Extensions by Joanna Weng
18 //
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
29 
44 using namespace edm;
45 using namespace reco;
46 using namespace std;
47 
48 //
49 // class decleration
50 
52 public:
55 
56  explicit PFMETBenchmarkAnalyzer(const edm::ParameterSet &);
57  ~PFMETBenchmarkAnalyzer() override;
58 
59 private:
60  void beginJob() override;
61  void analyze(const edm::Event &, const edm::EventSetup &) override;
62  void endJob() override;
63  // ----------member data ---------------------------
68 
69  // neuhaus - comment
76 };
78 
79 //
80 // constants, enums and typedefs
81 //
82 
83 //
84 // static data member definitions
85 //
86 
87 //
88 // constructors and destructor
89 //
91 
92 {
93  // now do what ever initialization is needed
94  sInputTruthLabel_tok_ = consumes<reco::GenParticleCollection>(iConfig.getParameter<InputTag>("InputTruthLabel"));
95  sInputRecoLabel_tok_ = consumes<reco::PFMETCollection>(iConfig.getParameter<InputTag>("InputRecoLabel"));
96  sInputCaloLabel_tok_ = consumes<reco::CaloMETCollection>(iConfig.getParameter<InputTag>("InputCaloLabel"));
97  sInputTCLabel_tok_ = consumes<reco::METCollection>(iConfig.getParameter<InputTag>("InputTCLabel"));
98  OutputFileName = iConfig.getUntrackedParameter<string>("OutputFile");
99  pfmBenchmarkDebug = iConfig.getParameter<bool>("pfjBenchmarkDebug");
100  xplotAgainstReco = iConfig.getParameter<bool>("PlotAgainstRecoQuantities");
101  xbenchmarkLabel_ = iConfig.getParameter<string>("BenchmarkLabel");
102  xdbe_ = edm::Service<DQMStore>().operator->();
103 
104  PFMETBenchmark_.setup(OutputFileName, pfmBenchmarkDebug, xplotAgainstReco, xbenchmarkLabel_, xdbe_);
105 }
106 
108  // do anything here that needs to be done at desctruction time
109  // (e.g. close files, deallocate resources etc.)
110 }
111 
112 //
113 // member functions
114 //
115 
116 // ------------ method called to for each event ------------
118  // get gen jet collection
120  bool isGen = iEvent.getByToken(sInputTruthLabel_tok_, genparticles);
121  if (!isGen) {
122  std::cout << "Warning : no Gen Particles in input !" << std::endl;
123  return;
124  }
125 
126  // get rec PFMet collection
128  bool isReco = iEvent.getByToken(sInputRecoLabel_tok_, pfmets);
129  if (!isReco) {
130  std::cout << "Warning : no PF MET in input !" << std::endl;
131  return;
132  }
133 
134  // get rec TCMet collection
135  Handle<METCollection> tcmets;
136  bool isTC = iEvent.getByToken(sInputTCLabel_tok_, tcmets);
137  if (!isTC) {
138  std::cout << "Warning : no TC MET in input !" << std::endl;
139  return;
140  }
141 
142  Handle<CaloMETCollection> calomets;
143  bool isCalo = iEvent.getByToken(sInputCaloLabel_tok_, calomets);
144  if (!isCalo) {
145  std::cout << "Warning : no Calo MET in input !" << std::endl;
146  return;
147  }
148 
149  // Analyse (no "z" in "analyse" : we are in Europe, dammit!)
150  PFMETBenchmark_.process(*pfmets, *genparticles, *calomets, *tcmets);
151 }
152 
153 // ------------ method called once each job just before starting event loop
154 // ------------
156 
157 // ------------ method called once each job just after ending the event loop
158 // ------------
160  // PFMETBenchmark_.save();
161  PFMETBenchmark_.analyse();
162  PFMETBenchmark_.write();
163 }
164 
165 // define this as a plug-in
void analyze(const edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::legacy::DQMStore DQMStore
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
void beginJob()
Definition: Breakpoints.cc:14
dqm::legacy::MonitorElement MonitorElement
T getUntrackedParameter(std::string const &, T const &) const
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< reco::METCollection > sInputTCLabel_tok_
edm::EDGetTokenT< reco::PFMETCollection > sInputRecoLabel_tok_
edm::EDGetTokenT< reco::CaloMETCollection > sInputCaloLabel_tok_
edm::EDGetTokenT< reco::GenParticleCollection > sInputTruthLabel_tok_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
fixed size matrix
HLT enums.
PFMETBenchmarkAnalyzer(const edm::ParameterSet &)
PFJet Benchmark.
dqm::legacy::DQMStore * xdbe_