Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions | Variables
PlotRamps Namespace Reference

Functions

def passesSelection (gain, offset)
 
def getCrate (coolId)
 
def getModule (coolId)
 
def getMcm (coolId)
 
def getChannel (coolId)
 
def getLogicalChannel (mcm, chn)
 
def getCoolId (crt, mod, mcm, chn)
 
def getCoolIdLog (crt, mod, logchn)
 
def PlotRamps (input_file_name=None)
 

Variables

 parser
 
 action
 
 type
 
 dest
 
 help
 
 options
 
 args
 

Function Documentation

◆ getChannel()

def PlotRamps.getChannel (   coolId)

Definition at line 24 of file PlotRamps.py.

24 def getChannel( coolId ):
25  return (coolId & 0x000000f) >> 0
26 

◆ getCoolId()

def PlotRamps.getCoolId (   crt,
  mod,
  mcm,
  chn 
)

Definition at line 30 of file PlotRamps.py.

30 def getCoolId(crt,mod,mcm,chn):
31  id = 0 | (crt<<24) | (1<<20) | (mod<<16) | (mcm<<8) | (chn<<0)
32  return id
33 

◆ getCoolIdLog()

def PlotRamps.getCoolIdLog (   crt,
  mod,
  logchn 
)

Definition at line 34 of file PlotRamps.py.

34 def getCoolIdLog(crt,mod,logchn):
35  mcm = int( logchn/4 )
36  chn = logchn % 4
37  return getCoolId(crt,mod,mcm,chn)
38 

◆ getCrate()

def PlotRamps.getCrate (   coolId)

Definition at line 15 of file PlotRamps.py.

15 def getCrate( coolId ):
16  return (coolId & 0xf000000) >> 24
17 

◆ getLogicalChannel()

def PlotRamps.getLogicalChannel (   mcm,
  chn 
)

Definition at line 27 of file PlotRamps.py.

27 def getLogicalChannel(mcm, chn):
28  return mcm*4+chn
29 

◆ getMcm()

def PlotRamps.getMcm (   coolId)

Definition at line 21 of file PlotRamps.py.

21 def getMcm( coolId ):
22  return (coolId & 0x0000f00) >> 8
23 

◆ getModule()

def PlotRamps.getModule (   coolId)

Definition at line 18 of file PlotRamps.py.

18 def getModule( coolId ):
19  return (coolId & 0x00f0000) >> 16
20 

◆ passesSelection()

def PlotRamps.passesSelection (   gain,
  offset 
)

Definition at line 9 of file PlotRamps.py.

9 def passesSelection(gain,offset):
10  if ((gain > 0.5 and gain <1.6) and (offset > -10 and offset < 10)):
11  return True
12  else:
13  return False
14 

◆ PlotRamps()

def PlotRamps.PlotRamps (   input_file_name = None)

Definition at line 39 of file PlotRamps.py.

39 def PlotRamps(input_file_name=None):
40 
41  if input_file_name is None:
42  print ("No input file name, assuming graphs.root")
43  input_file_name = "graphs.root"
44 
45  gROOT.SetBatch( True )
46  gStyle.SetPalette(1)
47  gStyle.SetOptStat(111111)
48  gStyle.SetOptFit(11)
49  gStyle.SetCanvasColor(10)
50  gStyle.SetFrameFillColor(10)
51  gStyle.SetTitleFillColor(0)
52  gStyle.SetTitleBorderSize(1)
53  gStyle.SetStatBorderSize(1)
54  gStyle.SetStatFontSize(0.075)
55  gStyle.SetStatY(0.9)
56  gStyle.SetStatX(0.5)
57 
58  gStyle.SetTitleFontSize(0.075)
59  gStyle.SetPaperSize(gStyle.kA4)
60 
61  gStyle.SetPadTopMargin(0.10)
62  gStyle.SetPadBottomMargin(0.12)
63  gStyle.SetPadRightMargin(0.12)
64  gStyle.SetPadLeftMargin(0.12)
65  gStyle.SetHatchesSpacing(4.0)
66 
67  canvas = TCanvas('canvas','Ramps',200,10,1000,750)
68  canvas.SetBatch( True )
69 
70  graphs = TFile(input_file_name)
71  key_list = graphs.GetListOfKeys()
72 
73  pdfFileName = 'rampPlots.pdf'
74  canvas.Print( pdfFileName + '[' )
75 
76  # Book and style a template histogram to later draw the graph into
77  histo = TH1F("foo","foo",300,0.,300.)
78  histo.SetMinimum(0.)
79  histo.SetMaximum(300.)
80  histo.GetXaxis().SetTitle("L1Calo energy")
81  histo.GetYaxis().SetTitle("Calo energy")
82  histo.GetXaxis().SetTitleSize(0.04)
83  histo.GetYaxis().SetTitleSize(0.04)
84 
85  # Initialise a 2D map to indicate present modules
86  modPresent = [ [ False for module in range(16) ] for crate in range(8) ]
87 
88  # creates sorted list of numerical coolIds
89  list_of_histos=[]
90  for key in key_list:
91  keyStr = key.GetName()
92  keyInt = int(keyStr, base = 16)
93  list_of_histos.append( keyInt )
94  # Update list of present modules
95  modPresent[getCrate(keyInt)][getModule(keyInt)] = True
96 
97  # loop over crates, modules, and channels
98  for ppCrt in range(8):
99  for ppMod in range(16):
100  # Check that this module is present
101  if not modPresent[ppCrt][ppMod]: continue
102 
103  # Loop over 64 channels per module
104  for logChn in range(64):
105  coolId = getCoolIdLog( ppCrt, ppMod,logChn)
106  my_graph = gDirectory.Get(hex(coolId))
107 
108  if ( logChn % 64 ) == 0: # new page
109  canvas.Clear()
110  canvas.cd()
111  gStyle.SetOptTitle(0)
112  gStyle.SetOptStat(0)
113  gPad.SetRightMargin(0.1)
114  gPad.SetLeftMargin(0.1)
115  gPad.SetTopMargin(0.0)
116  gPad.SetBottomMargin(0.1)
117 
118  canvas.Divide(8,9,-1,-1)
119 
120  title = "Crate %d PPM %d: L1Calo (x) vs Calo (y) Energies" % ( ppCrt, ppMod )
121  ltit = TPaveLabel(0.35,0.90,0.65,1.0,title)
122  ltit.SetTextAlign(22)
123  ltit.SetTextSize(0.40)
124  ltit.SetFillStyle(0)
125  ltit.SetBorderSize(0)
126  ltit.Draw()
127 
128  canvas.cd( logChn + 9 )
129 
130  # Draw template histogram and graph, if it exists
131  histo.Draw()
132 
133  if ( my_graph ):
134  # Fetch function results
135  function_list = my_graph.GetListOfFunctions()
136  my_fit = function_list[0]
137  offset = my_fit.GetParameter(0)
138  slope = my_fit.GetParameter(1)
139  if not passesSelection(slope,offset):
140  gPad.SetFrameFillColor(kYellow-9)
141  #Style and draw graph
142  my_graph.SetMarkerStyle(34)
143  my_graph.SetMarkerSize(0.8)
144  my_fit.SetLineWidth(1)
145  my_fit.SetLineStyle(1)
146  my_graph.Draw("P")
147  else:
148  gPad.SetFrameFillColor(kGray)
149 
150  # End of page, so print it
151  if ( logChn == 63 ):
152  canvas.Print( pdfFileName )
153 
154  # closing file
155  canvas.Print( pdfFileName + ']' )
156  print ("Finished!")
157 

Variable Documentation

◆ action

PlotRamps.action

Definition at line 163 of file PlotRamps.py.

◆ args

PlotRamps.args

Definition at line 165 of file PlotRamps.py.

◆ dest

PlotRamps.dest

Definition at line 164 of file PlotRamps.py.

◆ help

PlotRamps.help

Definition at line 164 of file PlotRamps.py.

◆ options

PlotRamps.options

Definition at line 165 of file PlotRamps.py.

◆ parser

PlotRamps.parser

Definition at line 162 of file PlotRamps.py.

◆ type

PlotRamps.type

Definition at line 163 of file PlotRamps.py.

PlotRamps.getLogicalChannel
def getLogicalChannel(mcm, chn)
Definition: PlotRamps.py:27
PlotRamps.getCrate
def getCrate(coolId)
Definition: PlotRamps.py:15
PlotRamps.PlotRamps
def PlotRamps(input_file_name=None)
Definition: PlotRamps.py:39
PlotRamps.getModule
def getModule(coolId)
Definition: PlotRamps.py:18
python.LArMinBiasAlgConfig.int
int
Definition: LArMinBiasAlgConfig.py:59
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
PlotRamps.passesSelection
def passesSelection(gain, offset)
Definition: PlotRamps.py:9
PlotRamps.getCoolIdLog
def getCoolIdLog(crt, mod, logchn)
Definition: PlotRamps.py:34
PlotRamps.getChannel
def getChannel(coolId)
Definition: PlotRamps.py:24
PlotRamps.getMcm
def getMcm(coolId)
Definition: PlotRamps.py:21
PlotRamps.getCoolId
def getCoolId(crt, mod, mcm, chn)
Definition: PlotRamps.py:30
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24