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
nx=histo.GetNbinsX()
18
ny=histo.GetNbinsY()
19
for
i
in
range(1,nx+1):
20
for
j
in
range(1,ny+1):
21
value=histo.GetBinContent(i,j)
22
if
value>0:
23
nrocs += 1
24
25
nrocs=0
26
fname=sys.argv[1]
27
28
runNumber=
"0"
29
getRunNumber
(fname)
30
31
path=
"DQMData/Run "
+ runNumber +
"/Pixel/Run summary/Clusters/OnTrack/"
32
33
labels=[
"BPix L1: "
,
"BPix L2: "
,
"BPix L3: "
,
"FPix tot: "
]
34
35
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"
]
36
37
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
38
39
DeadROCs=[0,0,0,0]
40
41
fin= TFile(fname)
42
43
#print type(fname)
44
45
outname=
"PixZeroOccROCs_run"
+ runNumber +
".txt"
46
out_file = open(outname,
"w"
)
47
48
out_file.write(
"Pixel Zero Occupancy ROCs \n\n"
)
49
bpixtot=0
50
51
for
k
in
range(0,4):
52
GetNonZeroOccNumber
(histonames[k])
53
if
k==3: nrocs=nrocs/2
#in FPix the histo is filled twice to have it symmetric
54
DeadROCs[k]=TotROCs[k]-nrocs
55
if
k<3: bpixtot+=DeadROCs[k]
56
tmpstr=labels[k] +
str
(DeadROCs[k])
57
if
k==3: out_file.write(
"\nBPix tot: %i \n"
%bpixtot)
58
out_file.write(
"%s \n"
% tmpstr)
59
60
#count entries to avoid low stat runs
61
clusstr=path+
"charge_siPixelClusters"
62
nclust=fin.Get(clusstr)
63
nent=nclust.GetEntries()
64
65
out_file.write(
"\nNumber of clusters= %i \n"
% nent)
66
67
out_file.close()
68
DeadROCCounter.getRunNumber
def getRunNumber(filename)
Definition:
DeadROCCounter.py:6
DeadROCCounter.GetNonZeroOccNumber
def GetNonZeroOccNumber(histoname)
Definition:
DeadROCCounter.py:12
harvestTrackValidationPlots.str
str
Definition:
harvestTrackValidationPlots.py:10
Generated for CMSSW Reference Manual by
1.8.11