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
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
85 modPresent = [ [ False for module in range(16) ] for crate in range(8) ]
86
87
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
94 modPresent[getCrate(keyInt)][
getModule(keyInt)] =
True
95
96
97 for ppCrt in range(8):
98 for ppMod in range(16):
99
100 if not modPresent[ppCrt][ppMod]: continue
101
102
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:
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
130 histo.Draw()
131
132 if ( my_graph ):
133
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
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
150 if ( logChn == 63 ):
151 canvas.Print( pdfFileName )
152
153
154 canvas.Print( pdfFileName + ']' )
155 print ("Finished!")
156