CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
plotVDriftFromHistos Namespace Reference

Functions

def binNumber (station, sector)
 
def compare (fileNames, sl)
 
def plot (fileName, sl, option="HISTOP", draw=True)
 

Function Documentation

def plotVDriftFromHistos.binNumber (   station,
  sector 
)

Definition at line 6 of file plotVDriftFromHistos.py.

Referenced by plot().

6 def binNumber(station,sector):
7  start = (station - 1)*12
8  return start + sector
9 
def binNumber(station, sector)
def plotVDriftFromHistos.compare (   fileNames,
  sl 
)

Definition at line 64 of file plotVDriftFromHistos.py.

References plot().

64 def compare(fileNames,sl):
65  option = "HISTOP"
66  colors = (2,4,12,44,55)
67  markers = (24,25,26,27)
68 
69  idx = 0
70  canvas = None
71  objects = None
72  histos = []
73  for fileName in fileNames:
74  draw = False
75  if not idx: draw = True
76 
77  objs = plot(fileName,sl,option,draw)
78  if not idx:
79  canvas = objs[0]
80  objects = objs[2]
81  histos.append(objs[1])
82 
83  canvas.cd()
84  if idx:
85  histos[-1].SetLineColor(colors[ (idx - 1) % len(colors) ])
86  histos[-1].SetMarkerColor(colors[ (idx - 1) % len(colors) ])
87  histos[-1].SetMarkerStyle(markers[ (idx - 1) % len(markers) ])
88 
89  histos[-1].Draw(option + "SAME")
90 
91  idx += 1
92 
93  return (canvas,histos,objects)
94 
def plot(fileName, sl, option="HISTOP", draw=True)
def compare(fileNames, sl)
def plotVDriftFromHistos.plot (   fileName,
  sl,
  option = "HISTOP",
  draw = True 
)

Definition at line 10 of file plotVDriftFromHistos.py.

References binNumber(), drawHistoAllChambers.drawHisto(), and edm.print().

Referenced by compare().

10 def plot(fileName,sl,option="HISTOP",draw=True):
11 
12  slType = sl
13  slStr = "SL%d" % slType
14  verbose = False
15 
16  ROOT.TH1.AddDirectory(False)
17 
18  file = ROOT.TFile(fileName,'read')
19 
20  wheels = (-2,-1,0,1,2)
21  stations = (1,2,3,4)
22 
23  histosWheel = {}
24  for wh in wheels:
25  histoName = 'Wheel%d_%s_VDrift' % (wh,slStr)
26  print("Accessing",histoName)
27  histosWheel[wh] = file.Get(histoName)
28 
29  # (Wh-2 MB1 Sec1 ... Wh-2 MB1 Sec12 ... Wh-1 MB1 Sec1 ... Wh-1 MB1 Sec12 ...)
30  # (Wh-2 MB2 Sec1 ... Wh-2 MB2 Sec12 ... Wh-1 MB2 Sec1 ... Wh-1 MB1 Sec12 ...) ...
31  nBins = 250
32  if slType == 2: nBins = 180
33  histo = ROOT.TH1F("h_VDriftAll","VDrift",nBins,0,nBins)
34  for st in stations:
35  nSectors = 12
36  if st == 4: nSectors = 14
37  if st == 4 and slType == 2: continue
38  if verbose: print("Station",st)
39  for wh in wheels:
40  if verbose: print("Wheel",wh)
41  for sec in range(1,nSectors+1):
42  if verbose: print("Sector",sec)
43  binHisto = binNumber(st,sec)
44  if verbose: print("Bin from histos:",binHisto)
45  value = histosWheel[wh].GetBinContent(binHisto)
46  # From cm/ns to micron/ns
47  value *= 10000.
48 
49  binHistoNew = (st - 1)*60 + (wh + 2)*nSectors + sec
50  if verbose: print("Bin final",binHistoNew)
51  histo.SetBinContent(binHistoNew,value)
52 
53  if sec == 1:
54  label = "Wheel %d" % wh
55  if wh == -2: label += " MB%d" % st
56  histo.GetXaxis().SetBinLabel(binHistoNew,label)
57 
58  objects = drawHisto(histo,
59  title="v_{drift} (#mum/ns)",
60  ymin=53,ymax=57,option=option,draw=draw)
61 
62  return objects
63 
def plot(fileName, sl, option="HISTOP", draw=True)
def binNumber(station, sector)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def drawHisto(histo, title, ymin, ymax, option="HISTOP", draw=True)