17
18
<xsl:output method="text"/>
18
19
<xsl:template match="gdml">
21
24
<title>Configuration <xsl:value-of select="structure/volume/@name"/>
23
26
Dimensions <xsl:if test="solids/sphere/@name = 'WorldSphereRef'">15000.0 10000.0 50000.0 mm</xsl:if>
24
PropertyString Material <xsl:if test="structure/volume/materialref/@ref = 'Vacuum'">AIR</xsl:if>
27
PropertyString Material AIR <!--<xsl:if test="structure/volume/materialref/@ref = 'Vacuum'">AIR</xsl:if>-->
25
28
PropertyDouble G4StepMax <xsl:value-of select="MICE_Information/Other_Information/G4StepMax/@Value"/> mm
35
<xsl:variable name="run_number" select="MICE_Information/Configuration_Information/run/@runNumber"/>
30
36
<xsl:choose><xsl:when test="contains(MICE_Information/Configuration_Information/run/@beamStop, 'false') or contains(MICE_Information/Configuration_Information/run/@beamStop, 'true')">
31
37
Substitution $beamStop <xsl:value-of select="MICE_Information/Configuration_Information/run/@beamStop"/>
33
39
Substitution $diffuserThickness <xsl:value-of select="MICE_Information/Configuration_Information/run/@protonAbsorberThickness"/>
34
Substitution $protonAbsroberThickness <xsl:value-of select="MICE_Information/Configuration_Information/run/@beamStop"/><xsl:text>
40
Substitution $protonAbsorberThickness <xsl:value-of select="MICE_Information/Configuration_Information/run/@beamStop"/><xsl:text>
37
44
<xsl:for-each select="MICE_Information/Configuration_Information/run/magnet"><xsl:choose>
38
<xsl:when test="contains(@name, 'D1')">Substitution $D1Current <xsl:value-of select="@setCurrent"/><xsl:text>
40
</xsl:text></xsl:when>
41
<xsl:when test="contains(@name, 'D2')">Substitution $D2Current <xsl:value-of select="@setCurrent"/><xsl:text>
43
</xsl:text></xsl:when>
44
<xsl:when test="contains(@name, 'DS')">Substitution $DSCurrent <xsl:value-of select="@setCurrent"/><xsl:text>
46
</xsl:text></xsl:when>
47
<xsl:when test="contains(@name, 'Q1')">Substitution $Q1Current <xsl:value-of select="@setCurrent"/><xsl:text>
49
</xsl:text></xsl:when>
50
<xsl:when test="contains(@name, 'Q2')">Substitution $Q2Current <xsl:value-of select="@setCurrent"/><xsl:text>
52
</xsl:text></xsl:when>
53
<xsl:when test="contains(@name, 'Q3')">Substitution $Q3Current <xsl:value-of select="@setCurrent"/><xsl:text>
55
</xsl:text></xsl:when>
56
<xsl:when test="contains(@name, 'Q4')">Substitution $Q4Current <xsl:value-of select="@setCurrent"/><xsl:text>
58
</xsl:text></xsl:when>
59
<xsl:when test="contains(@name, 'Q5')">Substitution $Q5Current <xsl:value-of select="@setCurrent"/><xsl:text>
61
</xsl:text></xsl:when>
62
<xsl:when test="contains(@name, 'Q6')">Substitution $Q6Current <xsl:value-of select="@setCurrent"/><xsl:text>
64
</xsl:text></xsl:when>
65
<xsl:when test="contains(@name, 'Q7')">Substitution $Q7Current <xsl:value-of select="@setCurrent"/><xsl:text>
67
</xsl:text></xsl:when>
68
<xsl:when test="contains(@name, 'Q8')">Substitution $Q8Current <xsl:value-of select="@setCurrent"/><xsl:text>
70
</xsl:text></xsl:when>
71
<xsl:when test="contains(@name, 'Q9')">Substitution $Q9Current <xsl:value-of select="@setCurrent"/><xsl:text>
46
<xsl:when test="contains(@name, 'D1')">Substitution $D1Current <xsl:value-of select="@setCurrent"/>
47
Substitution $D1Polarity <xsl:value-of select="@polarity"/><xsl:text>
49
</xsl:text></xsl:when>
50
<xsl:when test="contains(@name, 'D2')">Substitution $D2Current <xsl:value-of select="@setCurrent"/>
51
Substitution $D2Polarity <xsl:value-of select="@polarity"/><xsl:text>
53
</xsl:text></xsl:when>
54
<xsl:when test="contains(@name, 'DS')">Substitution $DSCurrent <xsl:value-of select="@setCurrent"/>
55
Substitution $DSPolarity <xsl:value-of select="@polarity"/><xsl:text>
57
</xsl:text></xsl:when>
58
<xsl:when test="contains(@name, 'Q1')">Substitution $Q1Current <xsl:value-of select="@setCurrent"/>
59
Substitution $Q1Polarity <xsl:value-of select="@polarity"/><xsl:text>
61
</xsl:text></xsl:when>
62
<xsl:when test="contains(@name, 'Q2')">Substitution $Q2Current <xsl:value-of select="@setCurrent"/>
63
Substitution $Q2Polarity <xsl:value-of select="@polarity"/><xsl:text>
65
</xsl:text></xsl:when>
66
<xsl:when test="contains(@name, 'Q3')">Substitution $Q3Current <xsl:value-of select="@setCurrent"/>
67
Substitution $Q3Polarity <xsl:value-of select="@polarity"/><xsl:text>
69
</xsl:text></xsl:when>
70
<xsl:when test="contains(@name, 'Q4')">Substitution $Q4Current <xsl:value-of select="@setCurrent"/>
71
Substitution $Q4Polarity <xsl:value-of select="@polarity"/><xsl:text>
74
</xsl:text></xsl:when>
75
<xsl:when test="contains(@name, 'Q5')">Substitution $Q5Current <xsl:value-of select="@setCurrent"/>
76
Substitution $Q5Polarity <xsl:value-of select="@polarity"/><xsl:text>
78
</xsl:text></xsl:when>
79
<xsl:when test="contains(@name, 'Q6')">Substitution $Q6Current <xsl:value-of select="@setCurrent"/>
80
Substitution $Q6Polarity <xsl:value-of select="@polarity"/><xsl:text>
82
</xsl:text></xsl:when>
83
<xsl:when test="contains(@name, 'Q7')">Substitution $Q7Current <xsl:value-of select="@setCurrent"/>
84
Substitution $Q7Polarity <xsl:value-of select="@polarity"/><xsl:text>
86
</xsl:text></xsl:when>
87
<xsl:when test="contains(@name, 'Q8')">Substitution $Q8Current <xsl:value-of select="@setCurrent"/>
88
Substitution $Q8Polarity <xsl:value-of select="@polarity"/><xsl:text>
90
</xsl:text></xsl:when>
91
<xsl:when test="contains(@name, 'Q9')">Substitution $Q9Current <xsl:value-of select="@setCurrent"/>
92
Substitution $Q9Polarity <xsl:value-of select="@polarity"/><xsl:text>
73
94
</xsl:text></xsl:when></xsl:choose>
74
95
</xsl:for-each></xsl:when><xsl:otherwise> </xsl:otherwise></xsl:choose>
76
Module <xsl:value-of select="MICE_Information/Other_Information/GDML_Files/@location"/>RotatedGeometryFile.dat
78
Position 0.0 0.0 0.0 mm
79
Rotation 0.0 90.0 0.0 deg
97
//Module <xsl:value-of select="MICE_Information/Other_Information/GDML_Files/@location"/>RotatedGeometryFile.dat
99
// Position 0.0 0.0 0.0 mm
100
// Rotation 0.0 90.0 0.0 deg
105
<xsl:variable name="tof_0_file_number" select="MICE_Information/Other_Information/FileNumbers/Tof0FileNumber/@number"/>
106
<xsl:variable name="tof_1_file_number" select="MICE_Information/Other_Information/FileNumbers/Tof1FileNumber/@number"/>
107
<xsl:variable name="tof_2_file_number" select="MICE_Information/Other_Information/FileNumbers/Tof2FileNumber/@number"/>
108
<xsl:variable name="kl_file_number" select="MICE_Information/Other_Information/FileNumbers/KLFileNumber/@number"/>
109
<xsl:variable name="ckov_file_number" select="MICE_Information/Other_Information/FileNumbers/CkovFileNumber/@number"/>
110
<xsl:variable name="acc1_file_number" select="MICE_Information/Other_Information/FileNumbers/Acc1FileNumber/@number"/>
111
<xsl:variable name="acc2_file_number" select="MICE_Information/Other_Information/FileNumbers/Acc2FileNumber/@number"/>
112
<xsl:variable name="emr_file_number" select="MICE_Information/Other_Information/FileNumbers/EMRFileNumber/@number"/>
113
<xsl:variable name="tracker0_file_number" select="MICE_Information/Other_Information/FileNumbers/Tracker0FileNumber/@number"/>
114
<xsl:variable name="tracker1_file_number" select="MICE_Information/Other_Information/FileNumbers/Tracker1FileNumber/@number"/>
115
<xsl:variable name="absorber0_file_number" select="MICE_Information/Other_Information/FileNumbers/Absorber0FileNumber/@number"/>
116
<xsl:variable name="absorber1_file_number" select="MICE_Information/Other_Information/FileNumbers/Absorber1FileNumber/@number"/>
117
<xsl:variable name="absorber2_file_number" select="MICE_Information/Other_Information/FileNumbers/Absorber2FileNumber/@number"/>
120
<xsl:for-each select="structure/volume/physvol">
121
Module <xsl:choose><xsl:when test="contains(file/@name, $tof_0_file_number)">TOF/TOF0.dat</xsl:when><xsl:when test="contains(file/@name, $tof_1_file_number)">TOF/TOF1.dat</xsl:when><xsl:when test="contains(file/@name, $tof_2_file_number)">TOF/TOF2.dat</xsl:when><xsl:when test="contains(file/@name, $kl_file_number)">KL/KL.dat</xsl:when><xsl:when test="contains(file/@name, $ckov_file_number)">Ckov/Cherenkov.dat</xsl:when><xsl:when test="contains(file/@name, $emr_file_number)">EMR/Calorimeter.dat</xsl:when><xsl:when test="contains(file/@name, $acc1_file_number)">Ckov/Acc1.dat</xsl:when><xsl:when test="contains(file/@name, $acc2_file_number)">Ckov/Acc2.dat</xsl:when><xsl:when test="contains(file/@name, $tracker0_file_number)">Tracker/Tracker0.dat</xsl:when><xsl:when test="contains(file/@name, $tracker1_file_number)">Tracker/Tracker1.dat</xsl:when><xsl:when test="contains(file/@name, $absorber1_file_number)">Absorbers/LH2.dat</xsl:when><xsl:otherwise><xsl:value-of select="ancestor::gdml/MICE_Information/Other_Information/GDML_Files/@location"/><xsl:value-of select="substring-before(file/@name, '.')"/>.dat</xsl:otherwise></xsl:choose>
123
Position <xsl:value-of select="position/@x"/><xsl:text> </xsl:text><xsl:value-of select="position/@y"/><xsl:text> </xsl:text><xsl:value-of select="position/@z"/> mm
124
Rotation <xsl:choose><xsl:when test="rotationref/@ref = 'RotateY90'"> 0.0 90.0 0.0 deg</xsl:when><xsl:when test="rotationref/@ref = 'RotateX90'"> 90.0 0.0 0.0 deg</xsl:when><xsl:when test="rotationref/@ref = 'RotateX270'"> 270.0 0.0 0.0 deg</xsl:when><xsl:when test="rotationref/@ref = 'RotateX180'"> 180.0 0.0 0.0 deg</xsl:when><xsl:otherwise> 0.0 0.0 0.0 deg</xsl:otherwise></xsl:choose>
128
//Module Tracker/TrackerSolenoid0.dat
130
// Position 0. 0. 15016.24 mm
131
// Rotation 0. 0. 0. degree
134
//Module AFC/AbsorberFocusCoil.dat
136
// Position 0. 0. 16955.74 mm
137
// Rotation 0. 0. 0. degree
140
//Module RFCC/RFCouplingCoilUp.dat
142
// Position 0. 0. 18895.24 mm
143
// Rotation 0. 0. 0. degree
83
147
<xsl:choose><xsl:when test="contains(MICE_Information/Configuration_Information/run, @diffuserThickness)">
84
148
//Diffuser thickness is <xsl:value-of select="MICE_Information/Configuration_Information/run/@diffuserThickness"/>
85
149
//Go and select the diffuser model
108
176
<xsl:for-each select="MICE_Information/G4Field_Information/Quadrupole">
109
Module <xsl:value-of select="FieldName/@name"/>
177
<xsl:variable name="QuadName" select="FieldName/@name"/>
178
Module <xsl:value-of select="$QuadName"/>
111
180
Position <xsl:value-of select="Position/@x"/><xsl:text> </xsl:text><xsl:value-of select="Position/@y"/><xsl:text> </xsl:text><xsl:value-of select="Position/@z"/><xsl:text> </xsl:text><xsl:value-of select="Position/@units"/>
112
Rotation <xsl:value-of select="Rotation/@x"/><xsl:text> </xsl:text><xsl:value-of select="Rotation/@y"/><xsl:text> </xsl:text><xsl:value-of select="Rotation/@z"/><xsl:text> </xsl:text><xsl:value-of select="Position/@units"/>
181
Rotation <xsl:value-of select="Rotation/@x"/><xsl:text> </xsl:text><xsl:value-of select="Rotation/@y"/><xsl:text> </xsl:text><xsl:value-of select="Rotation/@z"/><xsl:text> </xsl:text><xsl:value-of select="Rotation/@units"/>
113
182
ScaleFactor <xsl:value-of select="ScaleFactor/@value"/>
114
183
Volume <xsl:value-of select="Volume/@name"/>
115
184
PropertyString FieldType <xsl:value-of select="FieldType/@name"/>
116
185
PropertyDouble Height <xsl:value-of select="Dimensions/@height"/><xsl:text> </xsl:text><xsl:value-of select="Dimensions/@units"/>
117
186
PropertyDouble Width <xsl:value-of select="Dimensions/@width"/><xsl:text> </xsl:text><xsl:value-of select="Dimensions/@units"/>
118
PropertyDouble Length <xsl:value-of select="Dimensions/@length"/><xsl:text> </xsl:text><xsl:value-of select="Dimensions/@units"/>
119
PropertyDouble FieldStrength <xsl:value-of select="FieldStrength/@Value"/><xsl:text> </xsl:text><xsl:value-of select="FieldStrength/@units"/>
120
PropertyInt Pole <xsl:value-of select="Pole/@Value"/>
121
PropertyInt MaxEndPole <xsl:value-of select="MaxEndPole/@Value"/>
187
PropertyDouble Length <xsl:value-of select="Dimensions/@length"/><xsl:text> </xsl:text><xsl:value-of select="Dimensions/@units"/>
188
PropertyDouble FieldStrength <xsl:choose>
189
<xsl:when test="contains($QuadName, 'Q1') and boolean($run_number)">$Q1Polarity*$Q1Current/96.0</xsl:when>
190
<xsl:when test="contains($QuadName, 'Q2') and boolean($run_number)">$Q2Polarity*$Q2Current/96.0</xsl:when>
191
<xsl:when test="contains($QuadName, 'Q3') and boolean($run_number)">$Q3Polarity*$Q3Current/96.0</xsl:when>
192
<xsl:when test="contains($QuadName, 'Q4') and boolean($run_number)">$Q4Polarity*$Q4Current/174.0</xsl:when>
193
<xsl:when test="contains($QuadName, 'Q5') and boolean($run_number)">$Q5Polarity*$Q5Current/174.0</xsl:when>
194
<xsl:when test="contains($QuadName, 'Q6') and boolean($run_number)">$Q6Polarity*$Q6Current/174.0</xsl:when>
195
<xsl:when test="contains($QuadName, 'Q7') and boolean($run_number)">$Q7Polarity*$Q7Current/174.0</xsl:when>
196
<xsl:when test="contains($QuadName, 'Q8') and boolean($run_number)">$Q8Polarity*$Q8Current/174.0</xsl:when>
197
<xsl:when test="contains($QuadName, 'Q9') and boolean($run_number)">$Q9Polarity*$Q9Current/174.0</xsl:when>
198
<xsl:otherwise><xsl:value-of select="FieldStrength/@value"/></xsl:otherwise>
199
</xsl:choose><xsl:text> </xsl:text><xsl:value-of select="FieldStrength/@units"/>
200
PropertyInt Pole <xsl:value-of select="Pole/@value"/>
201
PropertyInt MaxEndPole <xsl:value-of select="MaxEndPole/@value"/>
122
202
PropertyString EndFieldType <xsl:value-of select="EndFieldType/@name"/>
123
PropertyDouble EndLength <xsl:value-of select="EndLength/@Value"/><xsl:text> </xsl:text><xsl:value-of select="Dimensions/@units"/>
124
PropertyDouble CentreLength <xsl:value-of select="CentreLength/@Value"/><xsl:text> </xsl:text><xsl:value-of select="Dimensions/@units"/>
203
PropertyDouble EndLength <xsl:value-of select="EndLength/@value"/><xsl:text> </xsl:text><xsl:value-of select="Dimensions/@units"/>
204
PropertyDouble CentreLength <xsl:value-of select="CentreLength/@value"/><xsl:text> </xsl:text><xsl:value-of select="Dimensions/@units"/>
127
207
<xsl:for-each select="MICE_Information/G4Field_Information/Solenoid">
128
208
Module <xsl:value-of select="FieldName/@name"/>
130
210
Position <xsl:value-of select="Position/@x"/><xsl:text> </xsl:text><xsl:value-of select="Position/@y"/><xsl:text> </xsl:text><xsl:value-of select="Position/@z"/><xsl:text> </xsl:text><xsl:value-of select="Position/@units"/>
131
Rotation <xsl:value-of select="Rotation/@x"/><xsl:text> </xsl:text><xsl:value-of select="Rotation/@y"/><xsl:text> </xsl:text><xsl:value-of select="Rotation/@z"/><xsl:text> </xsl:text><xsl:value-of select="Position/@units"/>
211
Rotation <xsl:value-of select="Rotation/@x"/><xsl:text> </xsl:text><xsl:value-of select="Rotation/@y"/><xsl:text> </xsl:text><xsl:value-of select="Rotation/@z"/><xsl:text> </xsl:text><xsl:value-of select="Rotation/@units"/>
132
212
Volume <xsl:value-of select="Volume/@name"/>
133
213
PropertyString FieldType <xsl:value-of select="FieldType/@name"/>
134
214
PropertyString FileName <xsl:value-of select="FileName/@name"/>
135
PropertyDouble CurrentDensity <xsl:value-of select="CurrentDensity/@Value"/>
136
PropertyDouble Length <xsl:value-of select="Length/@Value"/>
137
PropertyDouble Thickness <xsl:value-of select="Thickness/@Value"/>
138
PropertyDouble InnerRadius <xsl:value-of select="InnerRadius/@Value"/>
215
PropertyDouble CurrentDensity <xsl:value-of select="CurrentDensity/@value"/>
216
PropertyDouble Length <xsl:value-of select="Length/@value"/>
217
PropertyDouble Thickness <xsl:value-of select="Thickness/@value"/>
218
PropertyDouble InnerRadius <xsl:value-of select="InnerRadius/@value"/>
139
219
ScaleFactor <xsl:value-of select="ScaleFactor/@name"/>