22
22
CONFIGXSL = os.environ["MAUS_ROOT_DIR"] + \
23
23
"/src/common_py/geometry/xsltScripts/ParentFileTranlsation.xsl"
24
ROTATEDXSL = os.environ["MAUS_ROOT_DIR"] + \
25
"/src/common_py/geometry/xsltScripts/RotatedGeometryFileTranslation.xsl"
24
TRACKERXSL = os.environ["MAUS_ROOT_DIR"] + \
25
"/src/common_py/geometry/xsltScripts/TrackerTranslation.xsl"
26
26
MM_XSL = os.environ["MAUS_ROOT_DIR"] + \
27
27
"/src/common_py/geometry/xsltScripts/MMTranslation.xsl"
60
61
gdmls = os.listdir(self.path)
61
62
for fname in gdmls:
62
63
if fname.find('materials') >= 0:
63
found_file = self.path + '/' + fname
64
found_file = os.path.join(self.path, fname)
64
65
self.material_file = found_file
65
66
self.material_file_path = os.path.abspath(self.material_file)
66
if fname == 'fastradModel.gdml' or fname == 'FastradModel.gdml':
67
found_file = self.path + '/' + fname
67
if fname == 'fastradModel.gdml' or \
68
fname == 'FastradModel.gdml' or \
69
fname == 'Step_IV.gdml':
70
found_file = os.path.join(self.path, fname)
68
71
self.config_file = found_file
69
72
if fname.find('Maus_Information') >= 0:
70
found_file = self.path + '/' + fname
73
found_file = os.path.join(self.path, fname)
71
74
self.maus_information_file = found_file
75
if fname == 'Tracker.gdml':
76
found_file = os.path.join(self.path, fname)
77
self.tracker_file = found_file
72
78
if fname.find('materials') < 0 \
73
79
and fname.find('fastrad') < 0 \
74
80
and fname.find('Fastrad') < 0 \
75
81
and fname.find('Maus_Information') < 0 \
76
82
and fname.find('Beamline') < 0 \
77
and fname[-5:] == '.gdml':
78
stepfile = self.path + '/' + fname
83
and fname[-5:] == '.gdml' \
84
and fname.find('Step_IV') < 0\
85
and fname.find('Tracker') < 0:
87
stepfile = os.path.join(self.path, fname)
79
88
self.step_files.append(stepfile)
81
91
def convert_to_maus(self, output):
94
104
raise IOError('Output path doesnt exist '+str(output))
96
106
outputfile1 = os.path.join(output, "ParentGeometryFile.dat")
97
outputfile2 = os.path.join(output, "RotatedGeometryFile.dat")
107
outputfile2 = os.path.join(output, "TrackerGeometryFile.dat")
108
# outputfile3 = os.path.join(output, "RotatedGeometryFile.dat")
98
109
config_file = CADImport(xmlin1 = str(self.config_file), \
99
110
xsl = str(CONFIGXSL), output = str(outputfile1))
100
111
config_file.parse_xslt()
101
rotated_file = CADImport(xmlin1 = str(self.config_file), \
102
xsl = str(ROTATEDXSL), output = str(outputfile2))
103
rotated_file.parse_xslt()
112
tracker_file = CADImport(xmlin1 = str(self.config_file), \
113
xsl = str(TRACKERXSL), output = str(outputfile2))
114
tracker_file.parse_xslt()
115
# rotated_file = CADImport(xmlin1 = str(self.config_file), \
116
# xsl = str(ROTATEDXSL), output = str(outputfile3))
117
# rotated_file.parse_xslt()
104
118
print "Configuration File Converted"
105
119
length = len(self.step_files)
106
120
for num in range(0, length):