00001
00002
00003
00004
00005
00006
00007 from DybPython.DybPythonAlg import DybPythonAlg
00008 from GaudiPython import SUCCESS, FAILURE
00009 from GaudiPython import gbl
00010
00011
00012 TCanvas = gbl.TCanvas
00013 gbl.gStyle.SetPalette(1)
00014 gbl.gStyle.SetOptFit(1)
00015
00016
00017 class DrawReadoutDetectorAlg(DybPythonAlg):
00018 def __init__(self,name):
00019 DybPythonAlg.__init__(self,name)
00020 return
00021
00022 def initialize(self):
00023 status = DybPythonAlg.initialize(self)
00024 if status.isFailure(): return status
00025 self.info("initializing")
00026
00027 return SUCCESS
00028
00029 def execute(self):
00030 self.info("executing")
00031
00032 return SUCCESS
00033
00034 def finalize(self):
00035 self.info("finalizing")
00036
00037
00038 canvas = TCanvas()
00039 hist = self.stats["/file0/readout/DetectorName"]
00040 hist.Draw()
00041 canvas.SaveAs("ReadoutDetector.png")
00042
00043
00044 status = DybPythonAlg.finalize(self)
00045 return status
00046
00047
00048
00049
00050 def configure():
00051 from StatisticsSvc.StatisticsSvcConf import StatisticsSvc
00052 statsSvc = StatisticsSvc()
00053 statsSvc.Input ={"file0":"ReadoutDetector.root"}
00054 return
00055
00056 def run(app):
00057 '''
00058 Configure and add an algorithm to job
00059 '''
00060 app.ExtSvc += ["StatisticsSvc"]
00061 readoutDetectorAlg = DrawReadoutDetectorAlg("MyReadoutDetector")
00062 app.addAlgorithm(readoutDetectorAlg)
00063 pass
00064