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")
        plot.draw()



xaxis = "time_date"  #TIME_DATE, FILLNUMBER
yaxis = "average_lumi"
d=PlotLPC(xaxis, yaxis, basic_path, "lumi_LHCb", startfillnumber, endfillnumber)
for (key1, value1),(key2, value2) in zip(d.datax.iteritems(), d.datay.iteritems()): #-key2,0iteritems ze wzgledu na typy danych
        value1 = dateformat(value1)
        plot=PLOT(value1, value2)
        plot.setDate()
        plot.setTitle("LHCb Peak Instantaneous Lumi at p-p 6.5 TeV in 2015") #key1
        plot.setxlabel("Date")
        plot.setylabel("Average Inst Luminosity (10^24/cm^2*s^1)")
        plot.draw()
        plot.savefig("OUTPUTPLOTS/2015AvgLumiTime.png")


xaxis = "fillnumber"  #TIME_DATE, FILLNUMBER
yaxis = "max_condition"
d=PlotCondition(xaxis, yaxis, basic_path, "Mu", startfillnumber, endfillnumber)
for (key1, value1),(key2, value2) in zip(d.datax.iteritems(), d.datay.iteritems()): #-key2,0iteritems ze wzgledu na typy danych
        plot = PLOT(value1, value2)
        plot.setTitle("LHCb Peak Mu at p-p 6.5 TeV in 2015") #key1
        plot.setxlabel("LHC Fillnumber")
        plot.setylabel("Peak Mu")
        plot.draw()
        plot.savefig("OUTPUTPLOTS/2015PeakMuFill.png")

xaxis = "time_date"  #TIME_DATE, FILLNUMBER
yaxis = "max_condition"