19 " Simple example to illustrate the usage of aida2root converter "
20 from __future__
import print_function
22 __author__ =
"Vanya BELYAEV ibelyaev@phys.syr.edu"
29 ROOT.gROOT.SetBatch(
True)
34 paths = (
'HistoEx/ 1D histo ',
'HistoEx/ 2D histo ',
'HistoEx/ 3D histo ',
35 'HistoEx1/ 1D histo ',
'HistoEx1/ 2D histo ',
'HistoEx1/ 3D histo ',
36 'HistoEx2/ x vs y ',
'HistoEx2/ x vs y+3x ',
37 'HistoEx2/ x vs y-3x ',
'HistoEx2/ x vs y (profile)',
38 'HistoEx2/ x vs y+3x (profile)',
'HistoEx2/ x vs y-3x (profile)')
50 """ Standard Constructor """
51 HistoAlgo.__init__(self, name)
55 " The main execution method "
59 self.Print(
"AIDA object: '%s'" % path)
61 aida = self.histoSvc(path)
63 return self.Error(
"Invalid AIDA at '%s'" % path)
67 return self.Error(
"Invalid conversion to ROOT '%s'" % path)
86 """ Standard Constructor """
87 HistoAlgo.__init__(self, name)
91 " The main execution method "
97 self.Print(
"AIDA object: '%s'" % path)
98 root = s.getAsROOT(path)
100 return self.Error(
"Invalid conversion to ROOT '%s'" % path)
115 """ the main configuration method """
129 gaudi.addAlgorithm(alg1)
130 gaudi.addAlgorithm(alg2)
140 " the third way to convert AIDA histograms into ROOT "
149 root = hsvc.getAsROOT(histo)
151 print(
"ERROR in access the histogram '%s' " % histo)
153 canvas = ROOT.TCanvas(
'canvas_%d' % i, histo, 250, 250)
155 name = histo.replace(
'/',
'_')
156 name = name.replace(
'\\',
'_')
157 name = name.replace(
'"',
'_')
158 name = name.replace(
"'",
'_')
159 name = name.replace(
"'",
'_')
160 name = name.replace(
" ",
'_')
161 name = name.replace(os.sep,
'_') +
'.png'
162 if os.path.exists(name):
166 print(
"The file name is '%s'" % name)
175 if '__main__' == __name__:
176 print(__doc__, __author__)