4 |
|
using namespace reco; |
5 |
|
using namespace edm; |
6 |
|
|
7 |
< |
MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames):verbosity_(0) |
7 |
> |
MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames):verbosity_(0),useMC_(false) |
8 |
|
{ |
9 |
|
dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown"); |
10 |
|
muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer"); |
11 |
|
} |
12 |
|
|
13 |
< |
MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames, int verbosity):verbosity_(verbosity) |
13 |
> |
MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames, const edm::ParameterSet& myConfig, int verbosity):verbosity_(verbosity) |
14 |
|
{ |
15 |
|
dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown"); |
16 |
|
muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer"); |
17 |
+ |
useMC_ = myConfig.getUntrackedParameter<bool>("doMuonMC"); |
18 |
|
} |
19 |
|
|
20 |
|
MuonAnalyzer::~MuonAnalyzer() |
61 |
|
,muon->charge() |
62 |
|
); |
63 |
|
|
64 |
+ |
// Variables from reco::Muon |
65 |
|
sintheta = sin( localMuon.Theta() ); |
66 |
|
|
67 |
|
localMuon.setCaloEnergy( |
126 |
|
// |
127 |
|
// leptonID apparently not initialised in PAT... |
128 |
|
// cout << "Valeur pourrie du leptonID=" << patMuon->leptonID() << endl; |
127 |
– |
} |
129 |
|
|
130 |
+ |
if(useMC_) |
131 |
+ |
{ |
132 |
+ |
// MC truth associator index |
133 |
+ |
if ((patMuon->genParticleRef()).isNonnull()) { |
134 |
+ |
localMuon.setMuonMCIndex((patMuon->genParticleRef()).index()); |
135 |
+ |
} else { |
136 |
+ |
localMuon.setMuonMCIndex(-1); |
137 |
+ |
} |
138 |
+ |
|
139 |
+ |
if ( patMuon->genLepton() != NULL ) { |
140 |
+ |
localMuon.setMomentumMCMuon(patMuon->genLepton()->px(),patMuon->genLepton()->py(),patMuon->genLepton()->pz(),patMuon->genLepton()->energy()); |
141 |
+ |
localMuon.setVertexMCMuon(TVector3(patMuon->genLepton()->vx(),patMuon->genLepton()->vy(),patMuon->genLepton()->vz())); |
142 |
+ |
localMuon.setPdgIdMCMuon(patMuon->genLepton()->pdgId()); |
143 |
+ |
} |
144 |
+ |
} |
145 |
+ |
} |
146 |
+ |
|
147 |
|
new( (*rootMuons)[j] ) TRootMuon(localMuon); |
148 |
|
if(verbosity_>2) cout << " ["<< setw(3) << j << "] " << localMuon << endl; |
149 |
|
} |