13from ROOT.Belle2
import ARICHDatabaseImporter
15from optparse
import OptionParser
16from fnmatch
import fnmatch
18parser = OptionParser()
19parser.add_option(
'-c',
'--class', dest=
'whatclass', default=
'none', help=
'')
20parser.add_option(
'-x',
'--i-e', dest=
'importexport', default=
'export', help=
'')
21parser.add_option(
'-t',
'--hvtest', dest=
'hvtest', default=
'no', help=
'')
22parser.add_option(
'-o',
'--aopRootF', dest=
'aopRootF', default=
'ARICH_AerogelOpticalProperties.root', help=
'')
23(options, args) = parser.parse_args()
24ie = options.importexport
25ieClass = options.whatclass
26hvtest = options.hvtest
27aopRootF = options.aopRootF
29home = os.environ[
'BELLE2_LOCAL_DIR']
33b2.use_local_database()
46eventinfo = b2.register_module(
'EventInfoSetter')
49main = b2.create_path()
50main.add_module(eventinfo)
58 paramloader = b2.register_module(
'Gearbox')
59 pathname =
'file://%s/data/AllData/' % (os.getcwd())
60 paramloader.param(
'backends', [pathname])
61 paramloader.param(
'fileName',
'ArichData.xml')
62 paramloader.initialize()
65 rootFilesHapdQA = ROOT.vector(
'string')()
67 xdirHapdQA =
'%s/hapdQA/' % (os.getcwd())
68 for path, subdirs, files
in os.walk(xdirHapdQA):
70 if fnmatch(name,
"*.root"):
71 rootFilesHapdQA.push_back(os.path.join(path, name))
74 rootFilesHapdQE = ROOT.vector(
'string')()
77 xdirHapdQE =
'%s/hapdQE/' % (os.getcwd())
78 for path, subdirs, files
in os.walk(xdirHapdQE):
80 if fnmatch(name,
"*.root"):
81 rootFilesHapdQE.push_back(os.path.join(path, name))
84 rootFilesAsics = ROOT.vector(
'string')()
85 txtFilesAsics = ROOT.vector(
'string')()
88 xdir = (
'%s/asicData' + number +
'/') % (os.getcwd())
90 for path, subdirs, files
in os.walk(xdir):
92 if fnmatch(name,
"*.root"):
93 rootFilesAsics.push_back(os.path.join(path, name))
94 if fnmatch(name,
"*.txt"):
95 txtFilesAsics.push_back(os.path.join(path, name))
98 rootFilesFebTest = ROOT.vector(
'string')()
100 xdirFebTest =
'%s/febTest/' % (os.getcwd())
101 for path, subdirs, files
in os.walk(xdirFebTest):
103 if fnmatch(name,
"*.root"):
104 rootFilesFebTest.push_back(os.path.join(path, name))
105 mypath =
'%s/moduleTest/modules/' % (os.getcwd())
107elif ie ==
'importAerogelInfoOnly':
108 paramloader = b2.register_module(
'Gearbox')
109 pathname =
'/home/b-lab050/KEK/xmlarichdata/data/aerogel_xml_ver3_R/'
110 paramloader.param(
'backends', [pathname])
111 paramloader.param(
'fileName',
'AerogelData.xml')
112 paramloader.initialize()
114elif ie ==
'importAerogelRayleighScatteringFit':
115 paramloader = b2.register_module(
'Gearbox')
116 pathname =
'/home/b-lab050/KEK/xmlarichdata/xmlData/aerogel_xml_ver3_L/'
117 paramloader.param(
'backends', [pathname])
118 paramloader.param(
'fileName',
'aerogel_xml_ver3_L_fit.xml')
119 paramloader.initialize()
123if ie ==
'importAerogelInfoOnly':
124 dbImporter = ARICHDatabaseImporter()
125 dbImporter.importAerogelInfo(
"Right")
127elif ie ==
'importAerogelRayleighScatteringFit':
128 dbImporter = ARICHDatabaseImporter()
129 dbImporter.importAeroRayleighScatteringFit(
"Left")
134 dbImporter = ARICHDatabaseImporter(rootFilesHapdQA, rootFilesAsics, txtFilesAsics, rootFilesHapdQE, rootFilesFebTest)
135 if ieClass ==
'aerogelInfo':
136 dbImporter.importAerogelInfo()
137 elif ieClass ==
'aerogelMap':
138 dbImporter.importAerogelMap()
139 elif ieClass ==
'aerogelTilesInfo':
140 dbImporter.importAeroTilesInfo()
141 elif ieClass ==
'hapdQA':
142 dbImporter.importHapdQA()
143 elif ieClass ==
'hapdQE':
144 dbImporter.importHapdQE()
145 elif ieClass ==
'hapdChipInfo':
146 dbImporter.importHapdChipInfo()
147 elif ieClass ==
'hapdInfo':
148 dbImporter.importHapdInfo()
149 elif ieClass ==
'hapd':
150 dbImporter.importHapdQA()
151 dbImporter.importHapdQE()
152 dbImporter.importHapdChipInfo()
153 dbImporter.importHapdInfo()
154 elif ieClass ==
'asicInfo':
155 dbImporter.importAsicInfo()
156 elif ieClass ==
'febTest':
157 dbImporter.importFebTest()
158 elif ieClass ==
'febInfo':
159 dbImporter.importFEBoardInfo()
160 elif ieClass ==
'moduleTest':
161 dbImporter.importModuleTest(mypath, hvtest)
162 elif ieClass ==
'sensorInfo':
163 dbImporter.importSensorModuleInfo()
164 elif ieClass ==
'sensorMap':
165 dbImporter.importSensorModuleMap()
167elif ie ==
'importAerogelTilesInfo':
168 dbImporter = ARICHDatabaseImporter()
169 if ieClass ==
'aerogelTilesInfo':
170 dbImporter.importAeroTilesInfo()
173 dbImporter = ARICHDatabaseImporter()
174 if ieClass ==
'aerogelInfo':
175 dbImporter.exportAerogelInfo()
176 elif ieClass ==
'aerogelMap':
177 dbImporter.exportAerogelMap()
178 elif ieClass ==
'aerogelTilesInfo':
179 dbImporter.printAeroTileInfo()
180 elif ieClass ==
'dumpAerogelOpticalProperties':
183 dbImporter.dumpAerogelOpticalProperties(aopRootF)
184 com =
'root -l ' + aopRootF +
' ' + home +
'/arich/utility/scripts/plotTestARICHAerogelHist.C'
186 elif ieClass ==
'hapdQA':
187 dbImporter.exportHapdQA()
188 elif ieClass ==
'hapdQE':
189 dbImporter.exportHapdQE()
190 elif ieClass ==
'hapdInfo':
191 dbImporter.exportHapdInfo()
192 elif ieClass ==
'hapdChipInfo':
193 dbImporter.exportHapdChipInfo()
194 elif ieClass ==
'hapd':
195 dbImporter.exportHapdQA()
196 dbImporter.exportHapdQE()
197 dbImporter.exportHapdInfo()
198 elif ieClass ==
'asicInfo':
199 dbImporter.exportAsicInfo()
200 elif ieClass ==
'febTest':
201 dbImporter.exportFebTest()
202 elif ieClass ==
'febInfo':
203 dbImporter.exportFEBoardInfo()
204 elif ieClass ==
'moduleTest':
205 dbImporter.exportModuleTest(hvtest)
206 elif ieClass ==
'sensorMap':
207 dbImporter.exportSensorModuleMap()
208 elif ieClass ==
'all':
209 dbImporter.exportAll()