-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdumpClusters.py
40 lines (31 loc) · 1.08 KB
/
dumpClusters.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
30
31
32
33
34
35
36
37
38
39
40
from DataFormats.FWLite import Handle, Events
from ROOT import gROOT, gStyle, TCanvas, TF1, TFile, TTree, gRandom, TH1F, TH2F
import os
eventsRef = Events("run258425_reco.root")
# "run259721_reco.root")
#"step3.root")
clusRef = Handle("edmNew::DetSetVector<SiStripCluster>")
label = "siStripClusters"
vRef = Handle("vector<reco::Vertex>")
vl = "offlinePrimaryVertices"
clusHIP = [0,0,0,0,0,0,0,0,0]
nv=0
for i in range(0, eventsRef.size()):
#for i in range(0, 20):
if (i%100 == 0) : print i
a= eventsRef.to(i)
# print "Event", i
a=eventsRef.getByLabel(label, clusRef)
a=eventsRef.getByLabel(vl,vRef)
nvtx = vRef.product().size()
if (nvtx<2) : continue;
nv+=nvtx
clusters = clusRef.product().data()
for ids in clusRef.product().ids() :
for k in range(0,ids.size):
clus = clusters[ids.offset+k]
if (clus.amplitudes().size()>6 and clus.charge()/clus.amplitudes().size()>250) :
clusHIP[(ids.id >>25)&0x7]+=1
# print (ids.id >>25)&0x7
print 'nev, nvtx, nvtx/nev ',eventsRef.size(), nv, float(nv)/float(eventsRef.size())
print clusHIP