19 " Simple example to illustrate the usage of aida2root converter "
20 from __future__
import print_function
23 __author__ =
"Vanya BELYAEV ibelyaev@phys.syr.edu"
32 ROOT.gROOT.SetBatch(
True)
41 "HistoEx1/ 1D histo ",
42 "HistoEx1/ 2D histo ",
43 "HistoEx1/ 3D histo ",
45 "HistoEx2/ x vs y+3x ",
46 "HistoEx2/ x vs y-3x ",
47 "HistoEx2/ x vs y (profile)",
48 "HistoEx2/ x vs y+3x (profile)",
49 "HistoEx2/ x vs y-3x (profile)",
62 """Standard Constructor"""
63 HistoAlgo.__init__(self, name)
67 "The main execution method"
71 self.Print(
"AIDA object: '%s'" % path)
73 aida = self.histoSvc(path)
75 return self.Error(
"Invalid AIDA at '%s'" % path)
79 return self.Error(
"Invalid conversion to ROOT '%s'" % path)
98 """Standard Constructor"""
99 HistoAlgo.__init__(self, name)
103 "The main execution method"
109 self.Print(
"AIDA object: '%s'" % path)
110 root = s.getAsROOT(path)
112 return self.Error(
"Invalid conversion to ROOT '%s'" % path)
127 """the main configuration method"""
139 hsvc = gaudi.service(
"HistogramPersistencySvc")
140 hsvc.OutputFile =
"aida2rootex.root"
146 gaudi.addAlgorithm(alg1)
147 gaudi.addAlgorithm(alg2)
157 "the third way to convert AIDA histograms into ROOT"
167 root = hsvc.getAsROOT(histo)
169 print(
"ERROR in access the histogram '%s' " % histo)
171 canvas = ROOT.TCanvas(
"canvas_%d" % i, histo, 250, 250)
173 name = histo.replace(
"/",
"_")
174 name = name.replace(
"\\",
"_")
175 name = name.replace(
'"',
"_")
176 name = name.replace(
"'",
"_")
177 name = name.replace(
"'",
"_")
178 name = name.replace(
" ",
"_")
179 name = name.replace(os.sep,
"_") +
".png"
180 if os.path.exists(name):
184 print(
"The file name is '%s'" % name)
193 if "__main__" == __name__:
194 print(__doc__, __author__)