CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: PFMETBenchmarkAnalyzer.cc,v 1.4 2010/02/20 21:02:45 wmtan Exp $
18 // Extensions by Joanna Weng
19 //
20 
21 
22 // system include files
23 #include <memory>
24 
25 // user include files
28 
31 
45 using namespace edm;
46 using namespace reco;
47 using namespace std;
48 
49 //
50 // class decleration
51 
52 
54 public:
57 
58 
59 private:
60  virtual void beginJob() ;
61  virtual void analyze(const edm::Event&, const edm::EventSetup&);
62  virtual void endJob() ;
63  // ----------member data ---------------------------
64 
65 };
67 
68 //neuhaus - comment
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
95  iConfig.getParameter<InputTag>("InputTruthLabel");
97  iConfig.getParameter<InputTag>("InputRecoLabel");
99  iConfig.getParameter<InputTag>("InputCaloLabel");
100  sInputTCLabel =
101  iConfig.getParameter<InputTag>("InputTCLabel");
102  OutputFileName =
103  iConfig.getUntrackedParameter<string>("OutputFile");
105  iConfig.getParameter<bool>("pfjBenchmarkDebug");
107  iConfig.getParameter<bool>("PlotAgainstRecoQuantities");
109  iConfig.getParameter<string>("BenchmarkLabel");
111 
113  OutputFileName,
114  pfmBenchmarkDebug,
115  xplotAgainstReco,
116  xbenchmarkLabel_,
117  xdbe_);
118 }
119 
120 
122 {
123  // do anything here that needs to be done at desctruction time
124  // (e.g. close files, deallocate resources etc.)
125 }
126 
127 
128 //
129 // member functions
130 //
131 
132 // ------------ method called to for each event ------------
133 void
135 {
136  // get gen jet collection
137  Handle<GenParticleCollection> genparticles;
138  bool isGen = iEvent.getByLabel(sInputTruthLabel, genparticles);
139  if (!isGen) {
140  std::cout << "Warning : no Gen Particles in input !" << std::endl;
141  return;
142  }
143 
144  // get rec PFMet collection
146  bool isReco = iEvent.getByLabel(sInputRecoLabel, pfmets);
147  if (!isReco) {
148  std::cout << "Warning : no PF MET in input !" << std::endl;
149  return;
150  }
151 
152  // get rec TCMet collection
153  Handle<METCollection> tcmets;
154  bool isTC = iEvent.getByLabel(sInputTCLabel, tcmets);
155  if (!isTC) {
156  std::cout << "Warning : no TC MET in input !" << std::endl;
157  return;
158  }
159 
160  Handle<CaloMETCollection> calomets;
161  bool isCalo = iEvent.getByLabel(sInputCaloLabel, calomets);
162  if (!isCalo) {
163  std::cout << "Warning : no Calo MET in input !" << std::endl;
164  return;
165  }
166 
167  // Analyse (no "z" in "analyse" : we are in Europe, dammit!)
168  PFMETBenchmark_.process(*pfmets, *genparticles, *calomets, *tcmets);
169 }
170 
171 
172 // ------------ method called once each job just before starting event loop ------------
173 void
175 {
176 
177 }
178 
179 // ------------ method called once each job just after ending the event loop ------------
180 void
182 // PFMETBenchmark_.save();
185 }
186 
187 //define this as a plug-in
string OutputFileName
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
InputTag sInputCaloLabel
DEFINE_FWK_MODULE(HiMixingModule)
InputTag sInputTruthLabel
void beginJob()
Definition: Breakpoints.cc:15
PFMETBenchmark PFMETBenchmark_
PFJet Benchmark.
void process(const reco::PFMETCollection &, const reco::GenParticleCollection &, const reco::CaloMETCollection &, const reco::METCollection &)
int iEvent
Definition: GenABIO.cc:243
DQMStore * xdbe_
InputTag sInputRecoLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual void analyze(const edm::Event &, const edm::EventSetup &)
InputTag sInputTCLabel
string xbenchmarkLabel_
void setup(std::string Filename, bool debug, bool plotAgainstReco=0, std::string benchmarkLabel_="ParticleFlow", DQMStore *dbe_store=NULL)
bool xplotAgainstReco
bool pfmBenchmarkDebug
tuple cout
Definition: gather_cfg.py:121
PFMETBenchmarkAnalyzer(const edm::ParameterSet &)