RecoJets
JetAnalyzers
src
CaloTowersExample.cc
Go to the documentation of this file.
1
// CaloTowersExample.cc
2
// Description: Example of simple EDAnalyzer for CaloTowers.
3
// Author: Robert M. Harris
4
// Date: 8 - September - 2006
5
//
6
#include "
RecoJets/JetAnalyzers/interface/CaloTowersExample.h
"
7
#include "
DataFormats/CaloTowers/interface/CaloTowerCollection.h
"
8
#include "
FWCore/Framework/interface/Event.h
"
9
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
10
#include <TROOT.h>
11
#include <TSystem.h>
12
#include <TFile.h>
13
#include <TCanvas.h>
14
#include <cmath>
15
using namespace
edm
;
16
using namespace
std
;
17
18
// Get the algorithm of the jet collections we will read from the .cfg file
19
// which defines the value of the strings CaloJetAlgorithm and GenJetAlgorithm.
20
CaloTowersExample::CaloTowersExample
(
const
ParameterSet
&
cfg
)
21
: CaloTowersAlgorithm(
cfg
.getParameter<
string
>(
"CaloTowersAlgorithm"
)) {}
22
23
void
CaloTowersExample::beginJob
() {
24
// Open the histogram file and book some associated histograms
25
m_file
=
new
TFile(
"histo.root"
,
"RECREATE"
);
26
h_et
= TH1F(
"et"
,
"E_{T} of leading CaloTowers"
, 50, 0, 25);
27
}
28
29
void
CaloTowersExample::analyze
(
const
Event
& evt,
const
EventSetup
& es) {
30
//Get the CaloTower collection
31
Handle<CaloTowerCollection>
caloTowers
;
32
evt.
getByLabel
(
CaloTowersAlgorithm
,
caloTowers
);
33
34
//Loop over the two leading CaloJets and fill some histograms
35
for
(
CaloTowerCollection::const_iterator
cal =
caloTowers
->begin(); cal !=
caloTowers
->end(); ++cal) {
36
h_et
.Fill(cal->et());
37
}
38
}
39
40
void
CaloTowersExample::endJob
() {
41
//Write out the histogram file.
42
m_file
->Write();
43
}
44
#include "
FWCore/Framework/interface/MakerMacros.h
"
45
DEFINE_FWK_MODULE
(
CaloTowersExample
);
CaloTowersExample::CaloTowersExample
CaloTowersExample(const edm::ParameterSet &)
Definition:
CaloTowersExample.cc:20
edm::SortedCollection< CaloTower >::const_iterator
std::vector< CaloTower >::const_iterator const_iterator
Definition:
SortedCollection.h:80
edm
HLT enums.
Definition:
AlignableModifier.h:19
CaloTowersExample::beginJob
void beginJob() override
Definition:
CaloTowersExample.cc:23
CaloTowersExample
Definition:
CaloTowersExample.h:15
edm::Handle
Definition:
AssociativeIterator.h:50
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
CaloTowersExample::h_et
TH1F h_et
Definition:
CaloTowersExample.h:24
CaloTowersExample::endJob
void endJob() override
Definition:
CaloTowersExample.cc:40
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:492
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
eleHcalExtractorBlocks_cff.caloTowers
caloTowers
Definition:
eleHcalExtractorBlocks_cff.py:15
CaloTowersExample::m_file
TFile * m_file
Definition:
CaloTowersExample.h:25
edm::EventSetup
Definition:
EventSetup.h:57
CaloTowersExample::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
CaloTowersExample.cc:29
looper.cfg
cfg
Definition:
looper.py:297
CaloTowerCollection.h
std
Definition:
JetResolutionObject.h:76
CaloTowersExample.h
ParameterSet.h
edm::Event
Definition:
Event.h:73
CaloTowersExample::CaloTowersAlgorithm
std::string CaloTowersAlgorithm
Definition:
CaloTowersExample.h:23
Generated for CMSSW Reference Manual by
1.8.16