ATLAS Offline Software
Loading...
Searching...
No Matches
PlotRamps Namespace Reference

Functions

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

Variables

 parser = OptionParser()
 action
 type
 dest
 help
 options
 args

Function Documentation

◆ getChannel()

PlotRamps.getChannel ( coolId)

Definition at line 23 of file PlotRamps.py.

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

◆ getCoolId()

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

Definition at line 29 of file PlotRamps.py.

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

◆ getCoolIdLog()

PlotRamps.getCoolIdLog ( crt,
mod,
logchn )

Definition at line 33 of file PlotRamps.py.

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

◆ getCrate()

PlotRamps.getCrate ( coolId)

Definition at line 14 of file PlotRamps.py.

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

◆ getLogicalChannel()

PlotRamps.getLogicalChannel ( mcm,
chn )

Definition at line 26 of file PlotRamps.py.

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

◆ getMcm()

PlotRamps.getMcm ( coolId)

Definition at line 20 of file PlotRamps.py.

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

◆ getModule()

PlotRamps.getModule ( coolId)

Definition at line 17 of file PlotRamps.py.

17def getModule( coolId ):
18 return (coolId & 0x00f0000) >> 16
19
bool getModule(std::istream &s, RegSelModule &m)

◆ passesSelection()

PlotRamps.passesSelection ( gain,
offset )

Definition at line 8 of file PlotRamps.py.

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

◆ PlotRamps()

PlotRamps.PlotRamps ( input_file_name = None)

Definition at line 38 of file PlotRamps.py.

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

Variable Documentation

◆ action

PlotRamps.action

Definition at line 162 of file PlotRamps.py.

◆ args

PlotRamps.args

Definition at line 164 of file PlotRamps.py.

◆ dest

PlotRamps.dest

Definition at line 163 of file PlotRamps.py.

◆ help

PlotRamps.help

Definition at line 163 of file PlotRamps.py.

◆ options

PlotRamps.options

Definition at line 164 of file PlotRamps.py.

◆ parser

PlotRamps.parser = OptionParser()

Definition at line 161 of file PlotRamps.py.

◆ type

PlotRamps.type

Definition at line 162 of file PlotRamps.py.