1 |
lethuill |
1.1 |
#include "UserCode/Morgan/interface/MuonAnalyzer.h"
|
2 |
|
|
|
3 |
|
|
using namespace std;
|
4 |
|
|
using namespace reco;
|
5 |
|
|
using namespace edm;
|
6 |
|
|
|
7 |
|
|
MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames):verbosity_(0)
|
8 |
|
|
{
|
9 |
|
|
muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer");
|
10 |
|
|
}
|
11 |
|
|
|
12 |
|
|
MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames, int verbosity):verbosity_(verbosity)
|
13 |
|
|
{
|
14 |
|
|
muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer");
|
15 |
|
|
}
|
16 |
|
|
|
17 |
|
|
MuonAnalyzer::~MuonAnalyzer()
|
18 |
|
|
{
|
19 |
|
|
}
|
20 |
|
|
|
21 |
|
|
void MuonAnalyzer::Process(const edm::Event& iEvent, TClonesArray* rootMuons)
|
22 |
|
|
{
|
23 |
|
|
|
24 |
|
|
Float_t sintheta = 0.;
|
25 |
|
|
edm::Handle < reco::MuonCollection > recoMuons;
|
26 |
|
|
iEvent.getByLabel(muonProducer_, recoMuons);
|
27 |
|
|
if(verbosity_>1) std::cout << " Number of muons = " << recoMuons->size() << " Label: " << muonProducer_.label() << " Instance: " << muonProducer_.instance() << std::endl;
|
28 |
|
|
for (unsigned int j=0; j<recoMuons->size(); j++)
|
29 |
|
|
{
|
30 |
|
|
TRootMuon localMuon(
|
31 |
|
|
(*recoMuons)[j].px()
|
32 |
|
|
,(*recoMuons)[j].py()
|
33 |
|
|
,(*recoMuons)[j].pz()
|
34 |
|
|
,(*recoMuons)[j].energy()
|
35 |
|
|
,(*recoMuons)[j].vx()
|
36 |
|
|
,(*recoMuons)[j].vy()
|
37 |
|
|
,(*recoMuons)[j].vz()
|
38 |
|
|
,13
|
39 |
|
|
,(*recoMuons)[j].charge()
|
40 |
|
|
);
|
41 |
|
|
|
42 |
|
|
sintheta = sin( localMuon.Theta() );
|
43 |
|
|
localMuon.setCaloEnergy(
|
44 |
|
|
(*recoMuons)[j].calEnergy().em * sintheta
|
45 |
|
|
,(*recoMuons)[j].calEnergy().emS9 * sintheta
|
46 |
|
|
,(*recoMuons)[j].calEnergy().had * sintheta
|
47 |
|
|
,(*recoMuons)[j].calEnergy().hadS9 * sintheta
|
48 |
|
|
,(*recoMuons)[j].calEnergy().ho * sintheta
|
49 |
|
|
,(*recoMuons)[j].calEnergy().hoS9 * sintheta
|
50 |
|
|
,(*recoMuons)[j].caloCompatibility()
|
51 |
|
|
);
|
52 |
|
|
|
53 |
|
|
localMuon.setIsoR03(
|
54 |
|
|
(*recoMuons)[j].isolationR03().emEt
|
55 |
|
|
,(*recoMuons)[j].isolationR03().hadEt
|
56 |
|
|
,(*recoMuons)[j].isolationR03().hoEt
|
57 |
|
|
,(*recoMuons)[j].isolationR03().sumPt
|
58 |
|
|
,(*recoMuons)[j].isolationR03().nTracks
|
59 |
|
|
,(*recoMuons)[j].isolationR03().nJets
|
60 |
|
|
);
|
61 |
|
|
|
62 |
|
|
localMuon.setIsoR05(
|
63 |
|
|
(*recoMuons)[j].isolationR05().emEt
|
64 |
|
|
,(*recoMuons)[j].isolationR05().hadEt
|
65 |
|
|
,(*recoMuons)[j].isolationR05().hoEt
|
66 |
|
|
,(*recoMuons)[j].isolationR05().sumPt
|
67 |
|
|
,(*recoMuons)[j].isolationR05().nTracks
|
68 |
|
|
,(*recoMuons)[j].isolationR05().nJets
|
69 |
|
|
);
|
70 |
|
|
|
71 |
|
|
new( (*rootMuons)[j] ) TRootMuon(localMuon);
|
72 |
|
|
if(verbosity_>2) cout << " ["<< setw(3) << j << "] " << localMuon << endl;
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
}
|