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):LeptonAnalyzer(producersNames),useMC_(false),doPrimaryVertex_(false) |
8 |
|
{ |
9 |
< |
dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown"); |
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):LeptonAnalyzer(producersNames, verbosity) |
14 |
|
{ |
15 |
< |
dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown"); |
15 |
> |
//dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown"); |
16 |
|
muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer"); |
17 |
+ |
useMC_ = myConfig.getUntrackedParameter<bool>("doMuonMC"); |
18 |
+ |
doPrimaryVertex_ = myConfig.getUntrackedParameter<bool>("doPrimaryVertex"); |
19 |
|
} |
20 |
|
|
21 |
|
MuonAnalyzer::~MuonAnalyzer() |
58 |
|
,muon->vx() |
59 |
|
,muon->vy() |
60 |
|
,muon->vz() |
61 |
< |
,13 |
61 |
> |
,muon->pdgId() |
62 |
|
,muon->charge() |
63 |
|
); |
64 |
|
|
65 |
+ |
// Variables from reco::Muon |
66 |
|
sintheta = sin( localMuon.Theta() ); |
67 |
|
|
68 |
|
localMuon.setCaloEnergy( |
111 |
|
,int(muon->isGood(reco::Muon::TM2DCompatibilityTight)) |
112 |
|
); |
113 |
|
|
114 |
+ |
// Variables from reco::Track |
115 |
+ |
reco::TrackRef track = muon->innerTrack(); |
116 |
+ |
if ( track.isNonnull() ) |
117 |
+ |
{ |
118 |
+ |
const reco::HitPattern& hit = track->hitPattern(); |
119 |
+ |
localMuon.setPixelLayersWithMeasurement(hit.pixelLayersWithMeasurement()); |
120 |
+ |
localMuon.setStripLayersWithMeasurement(hit.stripLayersWithMeasurement()); |
121 |
+ |
// FIXME - replace with double dxy(const Point& myBeamSpot) method ? |
122 |
+ |
localMuon.setD0(track->d0()); |
123 |
+ |
localMuon.setD0Error(track->d0Error()); |
124 |
+ |
// FIXME - replace with double dsz(const Point& myBeamSpot) method ? |
125 |
+ |
localMuon.setDsz(track->dsz()); |
126 |
+ |
localMuon.setDszError(track->dszError()); |
127 |
+ |
localMuon.setNormalizedChi2(track->normalizedChi2()); |
128 |
+ |
localMuon.setPtError(track->ptError()); |
129 |
+ |
localMuon.setEtaError(track->etaError()); |
130 |
+ |
localMuon.setPhiError(track->phiError()); |
131 |
+ |
|
132 |
+ |
if(doPrimaryVertex_) |
133 |
+ |
{ |
134 |
+ |
const reco::TransientTrack transtrack = trackBuilder_->build( track ) ; |
135 |
+ |
float sig3d = IP3DSignificance(transtrack); |
136 |
+ |
localMuon.setIP3DSignificance(sig3d); |
137 |
+ |
} |
138 |
+ |
} |
139 |
+ |
|
140 |
+ |
|
141 |
|
if( dataType_=="RECO" || dataType_=="AOD" ) |
142 |
|
{ |
143 |
|
// Some specific methods requiring RECO / AOD format |
154 |
|
// |
155 |
|
// leptonID apparently not initialised in PAT... |
156 |
|
// cout << "Valeur pourrie du leptonID=" << patMuon->leptonID() << endl; |
157 |
+ |
|
158 |
+ |
if(useMC_) |
159 |
+ |
{ |
160 |
+ |
// MC truth associator index |
161 |
+ |
if ((patMuon->genParticleRef()).isNonnull()) { |
162 |
+ |
localMuon.setGenParticleIndex((patMuon->genParticleRef()).index()); |
163 |
+ |
} else { |
164 |
+ |
localMuon.setGenParticleIndex(-1); |
165 |
+ |
} |
166 |
+ |
} |
167 |
|
} |
168 |
|
|
169 |
|
new( (*rootMuons)[j] ) TRootMuon(localMuon); |