TopQuarkAnalysis
Examples
plugins
TopMuonAnalyzer.cc
Go to the documentation of this file.
1
#include "
DataFormats/PatCandidates/interface/Muon.h
"
2
#include "
TopQuarkAnalysis/Examples/plugins/TopMuonAnalyzer.h
"
3
4
TopMuonAnalyzer::TopMuonAnalyzer
(
const
edm::ParameterSet
&
cfg
)
5
: inputToken_(consumes<
std
::
vector
<
pat
::
Muon
> >(
cfg
.getParameter<
edm
::
InputTag
>(
"input"
))),
6
verbose_(
cfg
.getParameter<
bool
>(
"verbose"
)) {
7
edm::Service<TFileService>
fs;
8
9
mult_
= fs->
make
<TH1F>(
"mult"
,
"multiplicity (muons)"
, 10, 0, 10);
10
en_
= fs->
make
<TH1F>(
"en"
,
"energy (muons)"
, 60, 0., 300.);
11
pt_
= fs->
make
<TH1F>(
"pt"
,
"pt (muons)"
, 60, 0., 300.);
12
eta_
= fs->
make
<TH1F>(
"eta"
,
"eta (muons)"
, 30, -3., 3.);
13
phi_
= fs->
make
<TH1F>(
"phi"
,
"phi (muons)"
, 40, -4., 4.);
14
}
15
16
TopMuonAnalyzer::~TopMuonAnalyzer
() {}
17
18
void
TopMuonAnalyzer::analyze
(
const
edm::Event
& evt,
const
edm::EventSetup
&
setup
) {
19
edm::Handle<std::vector<pat::Muon>
>
muons
;
20
evt.
getByToken
(
inputToken_
,
muons
);
21
22
// fill histograms
23
24
mult_
->Fill(
muons
->size());
25
for
(std::vector<pat::Muon>::const_iterator
muon
=
muons
->begin();
muon
!=
muons
->end(); ++
muon
) {
26
pt_
->Fill(
muon
->pt());
27
en_
->Fill(
muon
->energy());
28
eta_
->Fill(
muon
->eta());
29
phi_
->Fill(
muon
->phi());
30
}
31
32
// produce printout if desired
33
34
if
(
muons
->empty() || !
verbose_
)
35
return
;
36
37
unsigned
i
= 0;
38
39
std::cout
<<
"==================================================================="
<< std::endl;
40
std::cout
<< std::setw(5) <<
"mu :"
<< std::setw(13) <<
"pt :"
<< std::setw(13) <<
"eta :"
<< std::setw(13)
41
<<
"phi :"
<< std::setw(13) <<
"relIso :"
<< std::setw(6) <<
"GLB :"
<< std::setw(4) <<
"TRK"
<< std::endl;
42
std::cout
<<
"-------------------------------------------------------------------"
<< std::endl;
43
for
(std::vector<pat::Muon>::const_iterator
muon
=
muons
->begin();
muon
!=
muons
->end(); ++
muon
) {
44
std::cout
<< std::setw(3) <<
i
<<
" : "
<< std::setw(10) <<
muon
->pt() <<
" : "
<< std::setw(10) <<
muon
->eta()
45
<<
" : "
<< std::setw(10) <<
muon
->phi() <<
" : "
<< std::setw(10)
46
<< (
muon
->trackIso() +
muon
->caloIso()) /
muon
->pt() <<
" : "
<< std::setw(3) <<
muon
->isGlobalMuon()
47
<<
" : "
<< std::setw(3) <<
muon
->isTrackerMuon() << std::endl;
48
i
++;
49
}
50
std::cout
<<
"==================================================================="
<< std::endl;
51
}
52
53
void
TopMuonAnalyzer::beginJob
() {}
54
55
void
TopMuonAnalyzer::endJob
() {}
PDWG_BPHSkim_cff.muons
muons
Definition:
PDWG_BPHSkim_cff.py:47
electrons_cff.bool
bool
Definition:
electrons_cff.py:393
mps_fire.i
i
Definition:
mps_fire.py:428
muon
Definition:
MuonCocktails.h:17
TopMuonAnalyzer::endJob
void endJob() override
Definition:
TopMuonAnalyzer.cc:55
edm
HLT enums.
Definition:
AlignableModifier.h:19
Muon.h
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
TopMuonAnalyzer::eta_
TH1F * eta_
Definition:
TopMuonAnalyzer.h:31
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89287
edm::Handle
Definition:
AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition:
singleTopDQM_cfi.py:37
Muon
Definition:
Muon.py:1
HLT_FULL_cff.muon
muon
Definition:
HLT_FULL_cff.py:11710
TopMuonAnalyzer::mult_
TH1F * mult_
Definition:
TopMuonAnalyzer.h:28
TopMuonAnalyzer.h
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:531
TopMuonAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
TopMuonAnalyzer.cc:18
TopMuonAnalyzer::en_
TH1F * en_
Definition:
TopMuonAnalyzer.h:29
edm::ParameterSet
Definition:
ParameterSet.h:47
TopMuonAnalyzer::beginJob
void beginJob() override
Definition:
TopMuonAnalyzer.cc:53
edm::Service< TFileService >
TopMuonAnalyzer::TopMuonAnalyzer
TopMuonAnalyzer(const edm::ParameterSet &)
Definition:
TopMuonAnalyzer.cc:4
trackerHitRTTI::vector
Definition:
trackerHitRTTI.h:21
edm::EventSetup
Definition:
EventSetup.h:57
pat
Definition:
HeavyIon.h:7
looper.cfg
cfg
Definition:
looper.py:297
TopMuonAnalyzer::~TopMuonAnalyzer
~TopMuonAnalyzer() override
Definition:
TopMuonAnalyzer.cc:16
std
Definition:
JetResolutionObject.h:76
TopMuonAnalyzer::phi_
TH1F * phi_
Definition:
TopMuonAnalyzer.h:32
TopMuonAnalyzer::pt_
TH1F * pt_
Definition:
TopMuonAnalyzer.h:30
TopMuonAnalyzer::inputToken_
edm::EDGetTokenT< std::vector< pat::Muon > > inputToken_
Definition:
TopMuonAnalyzer.h:25
edm::Event
Definition:
Event.h:73
TopMuonAnalyzer::verbose_
bool verbose_
Definition:
TopMuonAnalyzer.h:26
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition:
TFileService.h:64
Generated for CMSSW Reference Manual by
1.8.16