Main Page
Namespaces
Classes
Package Documentation
DQM
SiStripMonitorClient
scripts
DeadROCCounter.py
Go to the documentation of this file.
1
#!/usr/bin/python
2
from
ROOT
import
TFile, gStyle,gPad ,TObject, TCanvas, TH1, TH1F, TH2F, TLegend, TPaletteAxis, TList, TLine, TAttLine, TF1,TAxis
3
import
re
4
import
sys, string
5
6
def
getRunNumber
(filename):
7
global
runNumber
8
pos=filename.find(
"__"
)
9
runNumber=filename[pos-6:pos]
10
#print runNumber
11
12
def
GetNonZeroOccNumber
(histoname):
13
global
nrocs
14
global
fin
15
nrocs=0
16
histo=fin.Get(histoname)
17
if
not
histo:
18
print
"null histo"
19
return
20
nx=histo.GetNbinsX()
21
ny=histo.GetNbinsY()
22
for
i
in
range(1,nx+1):
23
for
j
in
range(1,ny+1):
24
value=histo.GetBinContent(i,j)
25
if
value>0:
26
nrocs += 1
27
28
nrocs=0
29
fname=sys.argv[1]
30
31
runNumber=
"0"
32
getRunNumber
(fname)
33
34
path=
"DQMData/Run "
+ runNumber +
"/Pixel/Run summary/Clusters/OnTrack/"
35
36
labels=[
"BPix L1: "
,
"BPix L2: "
,
"BPix L3: "
,
"FPix tot: "
]
37
38
histonames=[path +
"pix_bar Occ_roc_ontracksiPixelDigis_layer_1"
,path +
"pix_bar Occ_roc_ontracksiPixelDigis_layer_2"
,path +
"pix_bar Occ_roc_ontracksiPixelDigis_layer_3"
,path +
"ROC_endcap_occupancy"
]
39
40
TotROCs=[2560-256,4096-256,5632-256,4320]
#total number of ROCs in the Pixel detector layers and the FPix, the factor 256 for BPix Layer derive by half modules, left there as a reminder
41
42
DeadROCs=[0,0,0,0]
43
44
fin= TFile(fname)
45
46
#print type(fname)
47
48
outname=
"PixZeroOccROCs_run"
+ runNumber +
".txt"
49
out_file = open(outname,
"w"
)
50
51
out_file.write(
"Pixel Zero Occupancy ROCs \n\n"
)
52
bpixtot=0
53
54
for
k
in
range(0,4):
55
GetNonZeroOccNumber
(histonames[k])
56
if
k==3: nrocs=nrocs/2
#in FPix the histo is filled twice to have it symmetric
57
DeadROCs[k]=TotROCs[k]-nrocs
58
if
k<3: bpixtot+=DeadROCs[k]
59
tmpstr=labels[k] +
str
(DeadROCs[k])
60
if
k==3: out_file.write(
"\nBPix tot: %i \n"
%bpixtot)
61
out_file.write(
"%s \n"
% tmpstr)
62
63
#count entries to avoid low stat runs
64
clusstr=path+
"charge_siPixelClusters"
65
nclust=fin.Get(clusstr)
66
nent=nclust.GetEntries()
67
68
out_file.write(
"\nNumber of clusters= %i \n"
% nent)
69
70
out_file.close()
71
DeadROCCounter.getRunNumber
def getRunNumber(filename)
Definition:
DeadROCCounter.py:6
DeadROCCounter.GetNonZeroOccNumber
def GetNonZeroOccNumber(histoname)
Definition:
DeadROCCounter.py:12
str
#define str(s)
Definition:
TestProcessor.cc:47
Generated for CMSSW Reference Manual by
1.8.11