def configureProfile(profile,i,minY,maxY,drawOption,data,log,textSize=25): profile.SetMarkerColor(MarkerColors[i]) profile.SetMarkerStyle(MarkerStyles[i]) profile.SetMarkerSize(MarkerSizes[i]) profile.SetLineColor(MarkerColors[i]) if drawOption!='P': profile.SetMarkerSize(0.0) if drawOption=='E3': #profile.SetFillStyle(3001) profile.SetFillColor(MarkerColors[i]) if not i: profile.GetXaxis().SetLabelSize(textSize) profile.GetXaxis().SetTitleSize(textSize) profile.GetYaxis().SetLabelSize(textSize) profile.GetYaxis().SetTitleSize(textSize) profile.SetMinimum(minY) profile.SetMaximum(maxY) profile.GetXaxis().SetTitle(data['plotConfig']['xLabel']) profile.GetYaxis().SetTitle(data['plotConfig']['yLabel']) if data['xUnit'] == 'time': profile.GetXaxis().SetTimeDisplay(1) profile.GetXaxis().SetTimeFormat(data['plotConfig']['xFormat']) dh = TDatime() dh.Set(int(data['plotConfig']['xOffset']), False) profile.GetXaxis().SetTimeOffset(dh.Convert(False)) profile.GetXaxis().SetNdivisions(507) else: profile.GetXaxis().SetTimeDisplay(0) return profile
time.timezone))) if ipoint == 0: ## print local time da_first.Print() ## print gmt time print("GMT = " + str( time.strftime( '%Y-%m-%d %H:%M:%S', time.gmtime(first - time.timezone)))) reftime = first ptm = time.localtime(reftime) da = TDatime( time.strftime('%Y-%m-%d %H:%M:%S', ptm)) if time.daylight and ptm.tm_isdst: offset_daylight = time.timezone - time.altzone ROOT.gStyle.SetTimeOffset(da.Convert(1) - 3600) datax = (float(last) - float(first)) / 2 + float( first) - da.Convert() + 3600 ## Comment out this block if running on Mac ## if time.daylight and ptm.tm_isdst: datax += offset_daylight ################################## dataxerr = (float(last) - float(first)) / 2 graphlist[ig].SetPoint(ipoint, float(datax), float(datay)) graphlist[ig].SetPointError(ipoint, float(dataxerr), float(datayerr)) else: graphlist[ig].GetXaxis().SetBinLabel(ipoint + 1, str(datax)) graphlist[ig].SetBinContent(ipoint + 1, float(datay))
first = time.mktime( time.strptime(atime.split()[0] + " " + atime.split()[1] + " " + atime.split()[2],"%Y.%m.%d %H:%M:%S %Z") ) atime = ibeam.IOVEndTime last = time.mktime( time.strptime(atime.split()[0] + " " + atime.split()[1] + " " + atime.split()[2],"%Y.%m.%d %H:%M:%S %Z") ) da_first = TDatime(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(first - time.timezone))) da_last = TDatime(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(last - time.timezone))) if ipoint == 0: ## print local time da_first.Print() ## print gmt time print("GMT = " + str(time.strftime('%Y-%m-%d %H:%M:%S',time.gmtime(first - time.timezone)))) reftime = first ptm = time.localtime(reftime) da = TDatime(time.strftime('%Y-%m-%d %H:%M:%S',ptm)) if time.daylight and ptm.tm_isdst: offset_daylight = time.timezone - time.altzone ROOT.gStyle.SetTimeOffset(da.Convert(1) - 3600) datax = (float(last) - float(first))/2 + float(first) - da.Convert() + 3600 ## Comment out this block if running on Mac ## if time.daylight and ptm.tm_isdst: datax += offset_daylight ################################## dataxerr = (float(last) - float(first))/2 graphlist[ig].SetPoint(ipoint, float(datax), float(datay) ) graphlist[ig].SetPointError(ipoint, float(dataxerr), float(datayerr) ) else: graphlist[ig].GetXaxis().SetBinLabel(ipoint +1 , str(datax) ) graphlist[ig].SetBinContent(ipoint +1, float(datay) ) graphlist[ig].SetBinError(ipoint +1, float(datayerr) )
print y if y.find("_c0") == len(y)-3 or y.find(".c0") == len(y)-3 or y.find(".c1") == len(y)-3: calibdir = resultdir+i+"/"+subdir+"/"+x+"/"+y #print "calibdir: ", calibdir summary_filename = find_first_file(calibdir, "BadStripsSummaryFile") if path.isfile(summary_filename): read_file(summary_filename) noisy_strips_measured[0] = True else: numberOfDefects.fill(0) numberOfNewDefects.fill(0) numberOfRefDefects.fill(0) noisy_strips_measured[0] = False run[0] = int(x) start[0] = start_time.Convert() end[0] = end_time.Convert() if int(x) in runs_good: good[0] = 1 else: good[0] = 0 if path.isdir(resultdir+i+"/"+subdir_express+"/"+x): for y in listdir(resultdir+i+"/"+subdir_express+"/"+x): # Open BSErrorSummaryFile if y.find("BSErrorDB") >-1 and y.find("_c0") == len(y)-3: calibdir_express = resultdir+i+"/"+subdir_express+"/"+x+"/"+y #print "calibdir_express: ", calibdir_express summary_express_filename = find_first_file(calibdir_express, "BSErrorSummaryFile") if path.isfile(summary_express_filename):
self.__canvas.SetFrameBorderMode(0) self.__outfile=outputfilename def draw(self,rootobj): rootobj.Draw() self.__canvas.Modified() self.__canvas.cd() self.__canvas.SetSelected(rootobj) self.__canvas.SaveAs(self.__outfile) if __name__=='__main__': da = TDatime(2010,3,30,13,10,00) h1f = TH1F("Luminposity","",1000,0.,1000) h1f.GetXaxis().SetNdivisions(-503) h1f.GetXaxis().SetTimeDisplay(1) h1f.GetXaxis().SetTimeFormat("%d\/%m %H:%M") h1f.GetXaxis().SetTimeOffset(da.Convert()) h1f.GetXaxis().SetLabelFont(32); h1f.GetXaxis().SetLabelSize(0.03); h1f.GetXaxis().SetTitleFont(32); h1f.GetXaxis().SetTitle("Date"); h1f.GetYaxis().SetLabelFont(32); h1f.GetYaxis().SetLabelSize(0.03); h1f.GetYaxis().SetTitleFont(32); h1f.GetYaxis().SetTitle("L (#mub^{-1})"); for i in range(0,1000): #h1f.GetXaxis().FindBin() ## Ricordati di calcolare il bin corretto per il tuo tempo h1f.SetBinContent(i,20.2+i) #m=interactiveRender()
def __init__(self): tk.Frame.__init__(self, master=master) ROOT.gROOT.SetBatch(ROOT.kFALSE) #ROOT.gROOT.SetBatch(ROOT.kTRUE) ROOT.gStyle.SetOptStat(0) da = TDatime(2010, 3, 30, 13, 10, 00) c = TCanvas("Luminosity", "", 1) c.SetHighLightColor(2) c.Range(-125.6732, -0.1364721, 1123.878, 1.178117) c.SetFillColor(0) c.SetBorderMode(0) c.SetBorderSize(2) c.SetGridx() c.SetGridy() c.SetFrameFillColor(19) c.SetFrameBorderMode(0) c.SetFrameBorderMode(0) h1f = TH1F("Luminposity", "", 1000, 0., 1000) h1f.GetXaxis().SetNdivisions(-503) h1f.GetXaxis().SetTimeDisplay(1) h1f.GetXaxis().SetTimeFormat("%d\/%m %H:%M") h1f.GetXaxis().SetTimeOffset(da.Convert()) h1f.GetXaxis().SetLabelFont(32) h1f.GetXaxis().SetLabelSize(0.03) h1f.GetXaxis().SetTitleFont(32) h1f.GetXaxis().SetTitle("Date") h1f.GetYaxis().SetLabelFont(32) h1f.GetYaxis().SetLabelSize(0.03) h1f.GetYaxis().SetTitleFont(32) h1f.GetYaxis().SetTitle("L (#mub^{-1})") for i in range(0, 1000): #h1f.GetXaxis().FindBin() ## Ricordati di calcolare il bin corretto per il tuo tempo h1f.SetBinContent(i, 20.2 + i) h1f.Draw() h1f2 = TH1F("Luminposity 2", "", 1000, 0., 1000) h1f2.GetXaxis().SetNdivisions(-503) h1f2.GetXaxis().SetTimeDisplay(1) h1f2.GetXaxis().SetTimeFormat("%d\/%m %H:%M") h1f2.GetXaxis().SetTimeOffset(da.Convert()) h1f2.GetXaxis().SetLabelSize(0.03) for i in range(0, 1000): h1f2.SetBinContent(i, 20.2 - i) h1f2.SetLineColor(ROOT.kRed) h1f2.Draw("same") leg = TLegend(0.1537356, 0.6631356, 0.5344828, 0.875) leg.SetTextFont(32) leg.SetFillColor(0) leg.SetFillStyle(1001) leg.AddEntry(h1f, "Delibvered 1.54 nb^{-1}", "l") leg.AddEntry(h1f2, "Delibvered 1.59 nb^{-1}", "l") leg.Draw() #c.Modified(); #c.cd(); #c.SetSelected(h1f); #c.SaveAs("Zhen.jpg") self.pack() button = tk.Button(master=master, text='Quit', command=sys.exit) button.pack(side=tk.BOTTOM) tk.mainloop()