CMS 3D CMS Logo

Functions
DeadROCCounter_Phase1 Namespace Reference

Functions

def countBadROCBarrel (fin, layerNo, os)
 barrel######################################################## More...
 
def countBadROCForward (fin, ringNo, os)
 endacp######################################### More...
 
def getRunNumber (filename)
 

Function Documentation

def DeadROCCounter_Phase1.countBadROCBarrel (   fin,
  layerNo,
  os 
)

barrel########################################################

Definition at line 13 of file DeadROCCounter_Phase1.py.

References objects.autophobj.float, and str.

Referenced by countBadROCForward().

13 def countBadROCBarrel(fin, layerNo, os):
14  global bpix_tot_deadROC
15  global bpix_tot_ineffROC
16  global bpix_tot_Nrocspopulated
17  global bpix_tot_totalentries
18 
19  barrelPath = commonPath + "PXBarrel/";
20  histoname = ["digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_1", "digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_2",
21  "digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_3", "digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_4"]
22  digi2D = fin.Get(barrelPath + histoname[layerNo-1])
23  #return status flag is histogram is empty!
24  if digi2D.GetEntries() == 0 :
25  return 1;
26  Nrocspopulated = 0
27  totalEntries = 0
28  NexpectedROC = [1536, 3584, 5632, 8192]
29  nLadders_bpx = [6, 14, 22, 32]
30  nx = digi2D.GetNbinsX()
31  ny = digi2D.GetNbinsY()
32  for xbin in range(1,nx+1):
33  if xbin >= 33 and xbin <= 40: continue;#region of cross on x-axis
34  for ybin in range(1,ny+1):
35  if (ybin == 2*nLadders_bpx[layerNo-1] + 1) or (ybin == 2*nLadders_bpx[layerNo-1] + 2): continue;#region of cross on y-axis
36  bentries = digi2D.GetBinContent(xbin,ybin)
37  if(bentries > 0):
38  Nrocspopulated+=1
39  totalEntries += bentries
40  meanEntries = float(totalEntries)/Nrocspopulated
41  NineffROC = 0
42  #Loop to chek inefficient ROC per layer
43  for xbin in range(1,nx+1):
44  if xbin >= 33 and xbin <= 40:
45  continue;#region of cross on x-axis
46  for ybin in range(1,ny+1):
47  if (ybin == 2*nLadders_bpx[layerNo-1] + 1) or (ybin == 2*nLadders_bpx[layerNo-1] + 2): continue;#region of cross on y-axis
48  bentries = digi2D.GetBinContent(xbin,ybin);
49  if(bentries > 0 and bentries < meanEntries/4. ):#Assume < 25% of MEAN = inefficient
50  NineffROC+=1;
51  ##Printing Layer no., #dead ROC, #inefficienct ROC, #mean occupancy of Non-zer roc
52  tmpstr = "BPix L" + str(layerNo)
53  print >> os, tmpstr, '{0:4d} {1:4d} {2:4.1f}'.format(NexpectedROC[layerNo-1] - Nrocspopulated, NineffROC, round(meanEntries,1))
54  bpix_tot_deadROC += NexpectedROC[layerNo-1] - Nrocspopulated
55  bpix_tot_ineffROC += NineffROC
56  bpix_tot_Nrocspopulated += Nrocspopulated
57  bpix_tot_totalentries += float(totalEntries)
58  return 0;
def countBadROCBarrel(fin, layerNo, os)
barrel########################################################
#define str(s)
def DeadROCCounter_Phase1.countBadROCForward (   fin,
  ringNo,
  os 
)

endacp#########################################

Definition at line 60 of file DeadROCCounter_Phase1.py.

References countBadROCBarrel(), objects.autophobj.float, getRunNumber(), createfilelist.int, and str.

60 def countBadROCForward(fin, ringNo, os):
61  global fpix_tot_deadROC
62  global fpix_tot_ineffROC
63  global fpix_tot_Nrocspopulated
64  global fpix_tot_totalentries
65 
66  forwardPath = commonPath + "PXForward/";
67  histoname = ["digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_1",
68 "digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_2"]
69  digi2D = fin.Get(forwardPath + histoname[ringNo-1])
70  #return status flag is histogram is empty!
71  if digi2D.GetEntries() == 0 :
72  return 1;
73  nblades_perRing_fpx = [22, 34]
74  NexpectedROC_perRing = [704, 1088]
75  Nrocspopulated = [0] * 6
76  totalEntries = [0] * 6
77  dcounter = 0
78  nx = digi2D.GetNbinsX()
79  ny = digi2D.GetNbinsY()
80  for xbin in range(1,nx+1):
81  if xbin >= 25 and xbin <= 32: continue;#region of cross on x-axis
82  if xbin > 1 and (xbin-1)%8 == 0: dcounter += 1;
83  for ybin in range(1,ny+1):
84  if (ybin >= 2*nblades_perRing_fpx[ringNo-1] + 1) and (ybin <= 2*nblades_perRing_fpx[ringNo-1] + 4):
85  continue;#region of cross on y-axis
86  bentries = digi2D.GetBinContent(xbin,ybin)
87  if(bentries > 0):
88  Nrocspopulated[dcounter] += 1
89  totalEntries[dcounter] += bentries
90  #Loop to find inefficient modules
91  meanEntries = [6] * 6
92  for d in range(0,6):
93  meanEntries[d] = float(totalEntries[d])/Nrocspopulated[d]
94  NineffROC = [6] * 6
95  #set disc counter to 0 since it is now 5
96  dcounter = 0;
97  for xbin in range(1,nx+1):
98  if xbin >= 25 and xbin <= 32: continue;#region of cross on x-axis
99  if xbin > 1 and (xbin-1)%8 == 0: dcounter += 1
100  for ybin in range(1,ny+1):
101  if (ybin >= 2*nblades_perRing_fpx[ringNo-1] + 1) and (ybin <= 2*nblades_perRing_fpx[ringNo-1] + 4):
102  continue;#region of cross on y-axis
103  bentries = digi2D.GetBinContent(xbin,ybin)
104  if(bentries > 0):#//Assume < 25% of MEAN = inefficient
105  if bentries > 0 and bentries < meanEntries[dcounter]/4.:
106  NineffROC[dcounter] += 1
107 
108  print >> os, "#Summary for FPix Ring", ringNo
109  for d in range(0,6):
110  disc = 0
111  if d < 3: disc = "M" + str(3 - d)
112  else: disc = "P" + str(d - 2)
113  ##Printing Disc no., #dead ROC, #inefficienct ROC, #mean occupancy of Non-zer roc
114  tmpstr = "FPix R" + str(ringNo) + "D" + str(disc)
115  print >> os, '{0:10s} {1:4d} {2:4d} {3:4.1f}'.format(tmpstr, NexpectedROC_perRing[ringNo-1] - Nrocspopulated[d], NineffROC[d], round(meanEntries[d],1))
116  fpix_tot_deadROC += NexpectedROC_perRing[ringNo-1] - Nrocspopulated[d]
117  fpix_tot_ineffROC += NineffROC[d]
118  fpix_tot_Nrocspopulated += Nrocspopulated[d]
119  fpix_tot_totalentries += float(totalEntries[d])
120 
121  return 0;
def countBadROCForward(fin, ringNo, os)
endacp#########################################
#define str(s)
def DeadROCCounter_Phase1.getRunNumber (   filename)

Definition at line 6 of file DeadROCCounter_Phase1.py.

References createfilelist.int.

Referenced by countBadROCForward().

6 def getRunNumber(filename):
7  global runNumber
8  pos=filename.find("__")
9  runNumber=int(filename[pos-6:pos])
10  #print runNumber
11