-
Notifications
You must be signed in to change notification settings - Fork 0
/
OperationPlots.py
389 lines (348 loc) · 16.1 KB
/
OperationPlots.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
__author__ = 'mmateja'
__version__ = '0.3'
from PLOT.PLOT import PLOT, dateformat
from RetrieveData.RetrieveDataForPlot import RetrieveDataForPlot
from RetrieveData.Retriever import Retriever
basic_path = "/group/online/tfc/ROOT/"
startfillnumber = 3819
endfillnumber = 5000
# Start by retrieving data for LPC/lumi_LHCb files in the range of fillnumbers
print 'Retrieving data from lumi_LHCb between fill# ' + str(startfillnumber) + ' and fill# ' + str(endfillnumber)
d = Retriever( basic_path, "lumi_LHCb", startfillnumber, endfillnumber)
lumi = d.retrieve("LPC") #LPC, CONDITION
r = RetrieveDataForPlot(lumi)
xaxis = "fillnumber"
yaxis = "max_lumi_lumi"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot=PLOT()
plot.setTitle("LHCb Peak Instantaneous Lumi at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("Peak Inst Luminosity (Hz/ub)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015PeakLumiFill.png")
xaxis = "time_date"
yaxis = "max_lumi_lumi"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
value1 = dateformat(value1)
plot=PLOT()
plot.setDate()
plot.setTitle("LHCb Peak Instantaneous Lumi at p-p 6.5 TeV in 2015")
plot.setxlabel("Date")
plot.setylabel("Peak Inst Luminosity (Hz/ub)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015PeakLumiTime.png")
xaxis = "fillnumber"
yaxis = "average_lumi_lumi"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot = PLOT()
plot.setTitle("LHCb Average Instantaneous Lumi at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("Average Inst Luminosity (Hz/ub)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015AvgLumiFill.png")
xaxis = "time_date"
yaxis = "average_lumi_lumi"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
value1 = dateformat(value1)
plot=PLOT()
plot.setDate()
plot.setTitle("LHCb Peak Instantaneous Lumi at p-p 6.5 TeV in 2015")
plot.setxlabel("Date")
plot.setylabel("Average Inst Luminosity (Hz/ub)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015AvgLumiTime.png")
xaxis = "fillnumber"
yaxis = "max_lumi_lumispec"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot=PLOT()
plot.setTitle("LHCb Peak Specific Lumi at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("Peak Inst Luminosity (10^-23 Hz/ub)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015PeakSpecLumiFill.png")
xaxis = "time_date"
yaxis = "max_lumi_lumispec"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
value1 = dateformat(value1)
plot=PLOT()
plot.setDate()
plot.setTitle("LHCb Peak Specific Lumi at p-p 6.5 TeV in 2015")
plot.setxlabel("Date")
plot.setylabel("Peak Inst Luminosity (10^-23 Hz/ub)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015PeakSpecLumiTime.png")
xaxis = "time_sec"
yaxis = "value_lumi_lumi"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot=PLOT()
plot.setTitle("LHCb Inst Lumi at p-p 6.5 TeV in fill " + str((int(key1))))
plot.setxlabel("Time [s]")
plot.setylabel("Inst Luminosity (Hz/ub)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015InstLumiFill"+str(int(key1))+".png")
print 'Retrieving data from Mu between fill# ' + str(startfillnumber) + ' and fill# ' + str(endfillnumber)
d = Retriever( basic_path, "Mu", startfillnumber, endfillnumber)
mu = d.retrieve("Condition") #LPC, CONDITION
r = RetrieveDataForPlot(mu)
xaxis = "fillnumber"
yaxis = "max_condition"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot = PLOT()
plot.setTitle("LHCb Peak Mu at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("Peak Mu")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015PeakMuFill.png")
xaxis = "time_date"
yaxis = "max_condition"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
value1 = dateformat(value1)
plot = PLOT()
plot.setDate()
plot.setTitle("LHCb Peak Mu at p-p 6.5 TeV in 2015")
plot.setxlabel("Date")
plot.setylabel("Peak Mu")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015PeakMuTime.png")
xaxis = "fillnumber"
yaxis = "average_condition"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot = PLOT()
plot.setTitle("LHCb Average Mu at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("Average Mu")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015AverageMuFill.png")
xaxis = "time_date"
yaxis = "average_condition"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
value1 = dateformat(value1)
plot = PLOT()
plot.setDate()
plot.setTitle("LHCb Average Mu at p-p 6.5 TeV in 2015")
plot.setxlabel("Date")
plot.setylabel("Average Mu")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015AverageMuTime.png")
print 'Retrieving data from Pileup between fill# ' + str(startfillnumber) + ' and fill# ' + str(endfillnumber)
d = Retriever( basic_path, "Pileup", startfillnumber, endfillnumber)
pileup = d.retrieve("Condition") #LPC, CONDITION
r = RetrieveDataForPlot(pileup)
xaxis = "fillnumber"
yaxis = "max_condition"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot = PLOT()
plot.setTitle("LHCb Peak Pileup at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("Peak Pileup")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015PeakPileupFill.png")
xaxis = "time_date"
yaxis = "max_condition"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
value1 = dateformat(value1)
plot = PLOT()
plot.setDate()
plot.setTitle("LHCb Peak Pileup at p-p 6.5 TeV in 2015")
plot.setxlabel("Date")
plot.setylabel("Peak Pileup")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015PeakPileupTime.png")
xaxis = "fillnumber"
yaxis = "average_condition"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot = PLOT()
plot.setTitle("LHCb Average Pileup at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("Average Pileup")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015AveragePileupFill.png")
xaxis = "time_date"
yaxis = "average_condition"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
value1 = dateformat(value1)
plot = PLOT()
plot.setDate()
plot.setTitle("LHCb Average Pileup at p-p 6.5 TeV in 2015")
plot.setxlabel("Date")
plot.setylabel("Average Pileup")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015AveragePileupTime.png")
print 'Retrieving data from lumireg_LHCb between fill# ' + str(startfillnumber) + ' and fill# ' + str(endfillnumber)
d = Retriever( basic_path, "lumireg_LHCb", startfillnumber, endfillnumber)
lumireg = d.retrieve("LPC") #LPC, CONDITION
r = RetrieveDataForPlot(lumireg)
xaxis = "fillnumber"
yaxis = "average_lumireg_zmean"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot = PLOT()
plot.setTitle("LHCb Luminous Region Average Centroid in z at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("LumiRegion z avg centroid (mm)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015LumiRegionzFill.png")
xaxis = "fillnumber"
yaxis = "average_lumireg_xmean"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot = PLOT()
plot.setTitle("LHCb Luminous Region Average Centroid in x at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("LumiRegion x centroid (um)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015LumiRegionxFill.png")
xaxis = "fillnumber"
yaxis = "average_lumireg_ymean"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot = PLOT()
plot.setTitle("LHCb Luminous Region Average Centroid in y at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("LumiRegion y avg centroid (um)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015LumiRegionyFill.png")
print 'Retrieving data from beam1_LHCb between fill# ' + str(startfillnumber) + ' and fill# ' + str(endfillnumber)
d = Retriever( basic_path, "beam1_LHCb", startfillnumber, endfillnumber)
beam1shape = d.retrieve("LPC") #LPC, CONDITION
r = RetrieveDataForPlot(beam1shape)
xaxis = "fillnumber"
yaxis = "average_beam_xmean"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot = PLOT()
plot.setTitle("LHCb Beam1 Average Centroid in x at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("Beam1 x avg centroid (um)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015Beam1xFill.png")
xaxis = "fillnumber"
yaxis = "average_beam_ymean"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot = PLOT()
plot.setTitle("LHCb Beam1 Average Centroid in y at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("Beam1 y avg centroid (um)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015Beam1yFill.png")
print 'Retrieving data from beam2_LHCb between fill# ' + str(startfillnumber) + ' and fill# ' + str(endfillnumber)
d = Retriever( basic_path, "beam2_LHCb", startfillnumber, endfillnumber)
beam2shape = d.retrieve("LPC") #LPC, CONDITION
r = RetrieveDataForPlot(beam2shape)
xaxis = "fillnumber"
yaxis = "average_beam_xmean"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot = PLOT()
plot.setTitle("LHCb Beam2 Average Centroid in x at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("Beam2 x avg centroid (um)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015Beam2xFill.png")
xaxis = "fillnumber"
yaxis = "average_beam_ymean"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plot = PLOT()
plot.setTitle("LHCb Beam2 Average Centroid in y at p-p 6.5 TeV in 2015")
plot.setxlabel("LHC Fillnumber")
plot.setylabel("Beam2 y avg centroid (um)")
plot.draw(value1, value2, 'b', 6)
plot.savefig("OUTPUTPLOTS/2015Beam2yFill.png")
#Intensities, superimpose of two plots
print 'Retrieving data from IntensityPerFill_beam1 between fill# ' + str(startfillnumber) + ' and fill# ' + str(endfillnumber)
d = Retriever( basic_path, "IntensityPerFill_beam1", startfillnumber, endfillnumber)
beam1intensities = d.retrieve("Condition") #LPC, CONDITION
r1 = RetrieveDataForPlot(beam1intensities)
print 'Retrieving data from IntensityPerFill_beam2 between fill# ' + str(startfillnumber) + ' and fill# ' + str(endfillnumber)
d = Retriever( basic_path, "IntensityPerFill_beam2", startfillnumber, endfillnumber)
beam2intensities = d.retrieve("Condition") #LPC, CONDITION
r2 = RetrieveDataForPlot(beam2intensities)
xaxis = "fillnumber"
yaxis = "max_condition"
print 'Doing ' + yaxis + ' vs ' + xaxis
datax,datay = r1.retrieveData(xaxis,yaxis)
#Define plot outside loop to be able to plot many graphs together
plotm = PLOT()
plotm.setTitle("LHC Peak Beams Intensities in 2015")
plotm.setxlabel("LHC Fillnumber")
plotm.setylabel("Peak Beams Intensities (10^8 p)")
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plotm.draw(value1, value2, 'b', 5)
datax,datay = r2.retrieveData(xaxis,yaxis)
for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
plotm.draw(value1, value2, 'r', 5)
plotm.savefig("OUTPUTPLOTS/2015PeakBeamsIntensitiesFill.png")
#plot.show()
#raw_input("Press enter to continue")
##################################################TEMPLATE PLOTTING################################################
#Here is shown the template plotting with example values of variables for Condition data structure
#basic_path = "/group/online/tfc/ROOT/"
#namefileend = "Mu"
#startfillnumber = 3819 #number of fillnumber from which starts retrieving data
#endfillnumber = 5000 #number of fillnumber to which ends retrieving data
#print 'Retrieving data from Mu between fill# ' + str(startfillnumber) + ' and fill# ' + str(endfillnumber)
#d = Retriever( basic_path, namefileend, startfillnumber, endfillnumber)
#mu = d.retrieve("Condition") #LPC, CONDITION
#r = RetrieveDataForPlot(mu)
#xaxis = "fillnumber" #options: TIME_DATE, FILLNUMBER
#yaxis = "max_condition" #options: MAX_CONDITION, AVERAGE_CONDITION
#print 'Doing ' + yaxis + ' vs ' + xaxis
#datax,datay = r.retrieveData(xaxis,yaxis)
#for (key1, value1),(key2, value2) in zip(datax.iteritems(), datay.iteritems()):
# if "time_date" in xaxis and yaxis:
# value1 = dateformat(value1)
# plot = PLOT()
# plot.setDate()
# plot.setTitle("LHCb Peak Mu at p-p 6.5 TeV in 2015")
# plot.setxlabel("Date")
# plot.setylabel("Peak Mu")
# plot.draw(value1, value2, 'b', 6)
# plot.savefig("OUTPUTPLOTS/2015PeakMuTime.png")
# else:
# plot = PLOT()
# plot.setTitle("LHCb Peak Mu at p-p 6.5 TeV in 2015")
# plot.setxlabel("LHC Fillnumber")
# plot.setylabel("Peak Mu")
# plot.draw(value1, value2, 'b', 6)
# plot.savefig("OUTPUTPLOTS/2015PeakMuFill.png")
#
###################################################################################################################