4 |
|
using namespace reco; |
5 |
|
using namespace edm; |
6 |
|
|
7 |
< |
MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames):LeptonAnalyzer(producersNames),useMC_(false),doPrimaryVertex_(false) |
7 |
> |
MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames):LeptonAnalyzer(producersNames),useMC_(false) |
8 |
|
{ |
9 |
– |
//dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown"); |
9 |
|
muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer"); |
10 |
|
} |
11 |
|
|
12 |
< |
MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames, const edm::ParameterSet& myConfig, int verbosity):LeptonAnalyzer(producersNames, verbosity) |
12 |
> |
MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames, const edm::ParameterSet& myConfig, int verbosity):LeptonAnalyzer(producersNames, myConfig, verbosity) |
13 |
|
{ |
15 |
– |
//dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown"); |
16 |
– |
muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer"); |
14 |
|
useMC_ = myConfig.getUntrackedParameter<bool>("doMuonMC"); |
15 |
< |
doPrimaryVertex_ = myConfig.getUntrackedParameter<bool>("doPrimaryVertex"); |
15 |
> |
muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer"); |
16 |
|
} |
17 |
|
|
18 |
|
MuonAnalyzer::~MuonAnalyzer() |
19 |
|
{ |
20 |
|
} |
21 |
|
|
22 |
< |
void MuonAnalyzer::Process(const edm::Event& iEvent, TClonesArray* rootMuons) |
22 |
> |
void MuonAnalyzer::Process(const edm::Event& iEvent, TRootBeamSpot* rootBeamSpot, TClonesArray* rootMuons) |
23 |
|
{ |
24 |
|
|
25 |
|
Float_t sintheta = 0.; |
109 |
|
); |
110 |
|
|
111 |
|
// Variables from reco::Track |
112 |
+ |
|
113 |
+ |
// Track in muon detector only |
114 |
+ |
reco::TrackRef outerTK = muon->outerTrack(); |
115 |
+ |
if ( outerTK.isNonnull() ) |
116 |
+ |
{ |
117 |
+ |
//cout << "outerTK (px,py,pz)=" << outerTK->px() <<" , " << outerTK->py() <<" , " << outerTK->pz() <<" )" << endl; |
118 |
+ |
localMuon.setXYZTOuterTrack( outerTK->px(), outerTK->py(), outerTK->pz(), outerTK->p() ); |
119 |
+ |
} |
120 |
+ |
|
121 |
+ |
// Track in tracker + muon detector |
122 |
+ |
reco::TrackRef globalTK = muon->globalTrack(); |
123 |
+ |
if ( globalTK.isNonnull() ) |
124 |
+ |
{ |
125 |
+ |
//cout << "globalTK (px,py,pz)=" << globalTK->px() <<" , " << globalTK->py() <<" , " << globalTK->pz() <<" )" << endl; |
126 |
+ |
localMuon.setXYZTGlobalTrack( globalTK->px(), globalTK->py(), globalTK->pz(), globalTK->p() ); |
127 |
+ |
} |
128 |
+ |
|
129 |
+ |
// Track in tracker only |
130 |
|
reco::TrackRef track = muon->innerTrack(); |
131 |
|
if ( track.isNonnull() ) |
132 |
|
{ |
133 |
+ |
//cout << "innerTK (px,py,pz)=" << track->px() <<" , " << track->py() <<" , " << track->pz() <<" )" << endl; |
134 |
+ |
localMuon.setXYZTInnerTrack( track->px(), track->py(), track->pz(), track->p() ); |
135 |
|
const reco::HitPattern& hit = track->hitPattern(); |
136 |
+ |
localMuon.setNumberOfValidPixelHits(hit.numberOfValidPixelHits()); |
137 |
+ |
localMuon.setNumberOfValidTrackerHits(hit.numberOfValidTrackerHits()); |
138 |
|
localMuon.setPixelLayersWithMeasurement(hit.pixelLayersWithMeasurement()); |
139 |
|
localMuon.setStripLayersWithMeasurement(hit.stripLayersWithMeasurement()); |
140 |
< |
// FIXME - replace with double dxy(const Point& myBeamSpot) method ? |
141 |
< |
localMuon.setD0(track->d0()); |
140 |
> |
|
141 |
> |
if (doBeamSpot_) |
142 |
> |
{ |
143 |
> |
if ( rootBeamSpot->sigmaZ() > 0. ) // Check beam spot was correctly initialised |
144 |
> |
{ |
145 |
> |
const reco::TrackBase::Point point( rootBeamSpot->x(), rootBeamSpot->y(), rootBeamSpot->z() ); |
146 |
> |
localMuon.setD0( -1.*(track->dxy(point)) ); |
147 |
> |
localMuon.setDsz( track->dsz(point) ); |
148 |
> |
} |
149 |
> |
else |
150 |
> |
{ |
151 |
> |
localMuon.setD0( -1.*(track->dxy()) ); |
152 |
> |
localMuon.setDsz( track->dsz() ); |
153 |
> |
} |
154 |
> |
} |
155 |
> |
else |
156 |
> |
{ |
157 |
> |
localMuon.setD0( -1.*(track->dxy()) ); |
158 |
> |
localMuon.setDsz( track->dsz() ); |
159 |
> |
} |
160 |
> |
|
161 |
|
localMuon.setD0Error(track->d0Error()); |
124 |
– |
// FIXME - replace with double dsz(const Point& myBeamSpot) method ? |
125 |
– |
localMuon.setDsz(track->dsz()); |
162 |
|
localMuon.setDszError(track->dszError()); |
163 |
+ |
|
164 |
|
localMuon.setNormalizedChi2(track->normalizedChi2()); |
165 |
|
localMuon.setPtError(track->ptError()); |
166 |
|
localMuon.setEtaError(track->etaError()); |
168 |
|
|
169 |
|
if(doPrimaryVertex_) |
170 |
|
{ |
171 |
+ |
// FIXME - Should be Tracker track... what if STA muon ? |
172 |
|
const reco::TransientTrack transtrack = trackBuilder_->build( track ) ; |
173 |
|
float sig3d = IP3DSignificance(transtrack); |
174 |
|
localMuon.setIP3DSignificance(sig3d); |