-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmuonAnalyser.py
31 lines (22 loc) · 1017 Bytes
/
muonAnalyser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import ROOT
from DataFormats.FWLite import Events, Handle
muonsLable, muons = "muons", Handle("vector<reco::Muon>")
fdir = "../step3.root"
events = Events(fdir)
for iev, event in enumerate(events):
print "iev", iev
event.getByLabel(muonsLable, muons)
for mu in muons.product():
for chamber in mu.matches():
for seg in chamber.gemMatches:
if seg.gemSegmentRef.gemDetId().station() == 1:
dx = chamber.x - seg.gemSegmentRef.get().localPosition().x()
#print dx
muTrack = mu.standAloneMuon() # track built with only muon system
if muTrack.isNonnull():
for i in range(muTrack.recHitsSize()):
rh = muTrack.recHit(i)
if rh.geographicalId().det() != 2: continue # Muon detector
if rh.geographicalId().subdetId() != 4: continue # GEM detector
if rh.gemId().station() != 1: continue # GE1/1
print rh.localPosition().x()