6
# This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
8
# MAUS is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
13
# MAUS is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with MAUS. If not, see <http://www.gnu.org/licenses/>.
21
#pylint: disable=W0611
25
from geometry.GDMLtoCDB import Downloader
26
from geometry.GDMLtoMAUSModule import GDMLtomaus
27
from geometry.ConfigReader import Configreader
28
from geometry.GDMLFormatter import Formatter
29
from geometry.GDMLPacker import Unpacker
36
This is the code for the executable file which downloads the current valid
37
geometry. It takes the arguments of the download directory. It will download
38
the geometry from the database and translates the geometry into MAUS Module
41
# Read Config Arguments
42
configuration = Configreader()
43
dl_dir = configuration.geometry_download_directory
44
# Set up target location for download
45
gdml_cache = os.path.join(dl_dir, GDML_CACHE)
51
#geometry_downloader = Downloader()
52
#if configuration.geometry_download_by == "run_number":
53
# geometry_downloader.download_geometry_by_run \
54
# (configuration.geometry_download_run_number, gdml_cache)
55
#elif configuration.geometry_download_by == "current":
56
# geometry_downloader.download_current(gdml_cache)
57
#elif configuration.geometry_download_by == "id":
58
# geometry_downloader.download_geometry_by_id \
59
# (configuration.geometry_download_id, gdml_cache)
61
# raise KeyError("Didn't recognise 'geometry_download_by' option '"+\
62
# configuration.geometry_download_by+"'. Should be on of\n"+\
63
# "run_number\ncurrent\nid\n")
65
#zip_filename = os.path.join
66
# (gdml_cache, geometry.GDMLtoCDB.GEOMETRY_ZIPFILE)
67
#zipped_geom = Unpacker(zip_filename, gdml_cache)
68
# zipped_geom.unzip_file()
70
gdmls = Formatter(gdml_cache, dl_dir)
72
# convert to MAUS Modules
73
maus_modules = GDMLtomaus(dl_dir)
74
maus_modules.convert_to_maus(dl_dir)
75
# clean up if required
76
if configuration.geometry_download_cleanup:
77
shutil.rmtree(gdml_cache)
78
print "Download Complete"
80
if __name__ == "__main__":