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 };
70 
71 // neuhaus - comment
78 //
79 // constants, enums and typedefs
80 //
81 
82 //
83 // static data member definitions
84 //
85 
86 //
87 // constructors and destructor
88 //
90 
91 {
92  // now do what ever initialization is needed
93  sInputTruthLabel_tok_ = consumes<reco::GenParticleCollection>(iConfig.getParameter<InputTag>("InputTruthLabel"));
94  sInputRecoLabel_tok_ = consumes<reco::PFMETCollection>(iConfig.getParameter<InputTag>("InputRecoLabel"));
95  sInputCaloLabel_tok_ = consumes<reco::CaloMETCollection>(iConfig.getParameter<InputTag>("InputCaloLabel"));
96  sInputTCLabel_tok_ = consumes<reco::METCollection>(iConfig.getParameter<InputTag>("InputTCLabel"));
97  OutputFileName = iConfig.getUntrackedParameter<string>("OutputFile");
98  pfmBenchmarkDebug = iConfig.getParameter<bool>("pfjBenchmarkDebug");
99  xplotAgainstReco = iConfig.getParameter<bool>("PlotAgainstRecoQuantities");
100  xbenchmarkLabel_ = iConfig.getParameter<string>("BenchmarkLabel");
101  xdbe_ = edm::Service<DQMStore>().operator->();
102 
104 }
105 
107  // do anything here that needs to be done at desctruction time
108  // (e.g. close files, deallocate resources etc.)
109 }
110 
111 //
112 // member functions
113 //
114 
115 // ------------ method called to for each event ------------
117  // get gen jet collection
119  bool isGen = iEvent.getByToken(sInputTruthLabel_tok_, genparticles);
120  if (!isGen) {
121  std::cout << "Warning : no Gen Particles in input !" << std::endl;
122  return;
123  }
124 
125  // get rec PFMet collection
127  bool isReco = iEvent.getByToken(sInputRecoLabel_tok_, pfmets);
128  if (!isReco) {
129  std::cout << "Warning : no PF MET in input !" << std::endl;
130  return;
131  }
132 
133  // get rec TCMet collection
134  Handle<METCollection> tcmets;
135  bool isTC = iEvent.getByToken(sInputTCLabel_tok_, tcmets);
136  if (!isTC) {
137  std::cout << "Warning : no TC MET in input !" << std::endl;
138  return;
139  }
140 
141  Handle<CaloMETCollection> calomets;
142  bool isCalo = iEvent.getByToken(sInputCaloLabel_tok_, calomets);
143  if (!isCalo) {
144  std::cout << "Warning : no Calo MET in input !" << std::endl;
145  return;
146  }
147 
148  // Analyse (no "z" in "analyse" : we are in Europe, dammit!)
149  PFMETBenchmark_.process(*pfmets, *genparticles, *calomets, *tcmets);
150 }
151 
152 // ------------ method called once each job just before starting event loop
153 // ------------
155 
156 // ------------ method called once each job just after ending the event loop
157 // ------------
159  // PFMETBenchmark_.save();
162 }
163 
164 // define this as a plug-in
bk::beginJob
void beginJob()
Definition: Breakpoints.cc:14
PFMETBenchmarkAnalyzer::sInputTruthLabel_tok_
edm::EDGetTokenT< reco::GenParticleCollection > sInputTruthLabel_tok_
Definition: PFMETBenchmarkAnalyzer.cc:64
edm::EDGetTokenT< reco::GenParticleCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
PFMETBenchmark
Definition: PFMETBenchmark.h:30
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
PFMETBenchmark.h
edm::Handle
Definition: AssociativeIterator.h:50
OutputFileName
string OutputFileName
Definition: PFMETBenchmarkAnalyzer.cc:73
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
PFMETBenchmarkAnalyzer::endJob
void endJob() override
Definition: PFMETBenchmarkAnalyzer.cc:158
CaloMETCollection.h
GenParticle.h
CandidateFwd.h
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::legacy::DQMStore
Definition: DQMStore.h:728
PFMETBenchmark::process
void process(const reco::PFMETCollection &, const reco::GenParticleCollection &, const reco::CaloMETCollection &, const reco::METCollection &)
Definition: PFMETBenchmark.cc:187
CaloMET.h
Service.h
PFMETBenchmarkAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: PFMETBenchmarkAnalyzer.cc:116
GenParticleFwd.h
PFMETBenchmark::analyse
void analyse()
Definition: PFMETBenchmark.cc:427
PFMETBenchmark::setup
void setup(std::string Filename, bool debug, bool plotAgainstReco=false, std::string benchmarkLabel_="ParticleFlow", DQMStore *dbe_store=nullptr)
Definition: PFMETBenchmark.cc:50
GenMET.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
PFMETBenchmarkAnalyzer::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: PFMETBenchmarkAnalyzer.cc:53
PFMETBenchmark_
PFMETBenchmark PFMETBenchmark_
PFJet Benchmark.
Definition: PFMETBenchmarkAnalyzer.cc:72
PFMETBenchmarkAnalyzer::PFMETBenchmarkAnalyzer
PFMETBenchmarkAnalyzer(const edm::ParameterSet &)
Definition: PFMETBenchmarkAnalyzer.cc:89
PFMET.h
edm::Service
Definition: Service.h:30
PFMETBenchmarkAnalyzer
Definition: PFMETBenchmarkAnalyzer.cc:51
iEvent
int iEvent
Definition: GenABIO.cc:224
xbenchmarkLabel_
string xbenchmarkLabel_
Definition: PFMETBenchmarkAnalyzer.cc:76
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EventSetup
Definition: EventSetup.h:58
PFMETBenchmarkAnalyzer::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: PFMETBenchmarkAnalyzer.cc:54
InputTag.h
MET.h
std
Definition: JetResolutionObject.h:76
PFMETBenchmarkAnalyzer::~PFMETBenchmarkAnalyzer
~PFMETBenchmarkAnalyzer() override
Definition: PFMETBenchmarkAnalyzer.cc:106
Frameworkfwd.h
xplotAgainstReco
bool xplotAgainstReco
Definition: PFMETBenchmarkAnalyzer.cc:75
pfmBenchmarkDebug
bool pfmBenchmarkDebug
Definition: PFMETBenchmarkAnalyzer.cc:74
PFMETBenchmarkAnalyzer::sInputRecoLabel_tok_
edm::EDGetTokenT< reco::PFMETCollection > sInputRecoLabel_tok_
Definition: PFMETBenchmarkAnalyzer.cc:65
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
xdbe_
dqm::legacy::DQMStore * xdbe_
Definition: PFMETBenchmarkAnalyzer.cc:77
PFMETBenchmark::write
void write()
Definition: PFMETBenchmark.cc:35
PFMETBenchmarkAnalyzer::sInputTCLabel_tok_
edm::EDGetTokenT< reco::METCollection > sInputTCLabel_tok_
Definition: PFMETBenchmarkAnalyzer.cc:67
Candidate.h
TauSpinner_cfi.isReco
isReco
Definition: TauSpinner_cfi.py:4
ParameterSet.h
edm::Event
Definition: Event.h:73
electrons_cff.genparticles
genparticles
Definition: electrons_cff.py:522
PFMETBenchmarkAnalyzer::beginJob
void beginJob() override
Definition: PFMETBenchmarkAnalyzer.cc:154
edm::InputTag
Definition: InputTag.h:15
PFMETBenchmarkAnalyzer::sInputCaloLabel_tok_
edm::EDGetTokenT< reco::CaloMETCollection > sInputCaloLabel_tok_
Definition: PFMETBenchmarkAnalyzer.cc:66