test
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 // Extensions by Joanna Weng
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
27 
30 
46 using namespace edm;
47 using namespace reco;
48 using namespace std;
49 
50 //
51 // class decleration
52 
53 
55 public:
58 
59 
60 private:
61  virtual void beginJob() override ;
62  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
63  virtual void endJob() override ;
64  // ----------member data ---------------------------
69 
70 };
72 
73 //neuhaus - comment
80 //
81 // constants, enums and typedefs
82 //
83 
84 //
85 // static data member definitions
86 //
87 
88 //
89 // constructors and destructor
90 //
92 
93 {
94  //now do what ever initialization is needed
95  sInputTruthLabel_tok_ = consumes<reco::GenParticleCollection>(iConfig.getParameter<InputTag>("InputTruthLabel"));
96  sInputRecoLabel_tok_ = consumes<reco::PFMETCollection>(iConfig.getParameter<InputTag>("InputRecoLabel"));
97  sInputCaloLabel_tok_ = consumes<reco::CaloMETCollection>(iConfig.getParameter<InputTag>("InputCaloLabel"));
98  sInputTCLabel_tok_ = consumes<reco::METCollection>(iConfig.getParameter<InputTag>("InputTCLabel"));
99  OutputFileName = iConfig.getUntrackedParameter<string>("OutputFile");
100  pfmBenchmarkDebug = iConfig.getParameter<bool>("pfjBenchmarkDebug");
101  xplotAgainstReco = iConfig.getParameter<bool>("PlotAgainstRecoQuantities");
102  xbenchmarkLabel_ = iConfig.getParameter<string>("BenchmarkLabel");
104 
107  pfmBenchmarkDebug,
108  xplotAgainstReco,
109  xbenchmarkLabel_,
110  xdbe_);
111 }
112 
113 
115 {
116  // do anything here that needs to be done at desctruction time
117  // (e.g. close files, deallocate resources etc.)
118 }
119 
120 
121 //
122 // member functions
123 //
124 
125 // ------------ method called to for each event ------------
126 void
128 {
129  // get gen jet collection
130  Handle<GenParticleCollection> genparticles;
131  bool isGen = iEvent.getByToken(sInputTruthLabel_tok_, genparticles);
132  if (!isGen) {
133  std::cout << "Warning : no Gen Particles in input !" << std::endl;
134  return;
135  }
136 
137  // get rec PFMet collection
139  bool isReco = iEvent.getByToken(sInputRecoLabel_tok_, pfmets);
140  if (!isReco) {
141  std::cout << "Warning : no PF MET in input !" << std::endl;
142  return;
143  }
144 
145  // get rec TCMet collection
146  Handle<METCollection> tcmets;
147  bool isTC = iEvent.getByToken(sInputTCLabel_tok_, tcmets);
148  if (!isTC) {
149  std::cout << "Warning : no TC MET in input !" << std::endl;
150  return;
151  }
152 
153  Handle<CaloMETCollection> calomets;
154  bool isCalo = iEvent.getByToken(sInputCaloLabel_tok_, calomets);
155  if (!isCalo) {
156  std::cout << "Warning : no Calo MET in input !" << std::endl;
157  return;
158  }
159 
160  // Analyse (no "z" in "analyse" : we are in Europe, dammit!)
161  PFMETBenchmark_.process(*pfmets, *genparticles, *calomets, *tcmets);
162 }
163 
164 
165 // ------------ method called once each job just before starting event loop ------------
166 void
168 {
169 
170 }
171 
172 // ------------ method called once each job just after ending the event loop ------------
173 void
175 // PFMETBenchmark_.save();
178 }
179 
180 //define this as a plug-in
string OutputFileName
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void beginJob() override
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:230
edm::EDGetTokenT< reco::METCollection > sInputTCLabel_tok_
DQMStore * xdbe_
edm::EDGetTokenT< reco::PFMETCollection > sInputRecoLabel_tok_
edm::EDGetTokenT< reco::CaloMETCollection > sInputCaloLabel_tok_
edm::EDGetTokenT< reco::GenParticleCollection > sInputTruthLabel_tok_
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 &)
virtual void endJob() override