generate_lbne34kt.pl
Go to the documentation of this file.
1 #!/usr/bin/perl
2 
3 # contact tylerdalion@gmail.com for any GDML/generate questions
4 # I would love to help!
5 
6 # This is essentially the same script as the one that generates 10kt,
7 # just with a different set of parameters/dimensions. Eventually these
8 # differing parameters will be handled by passing different xml inputs
9 # to a single script, thereby setting the parameters.
10 
11 # For now, the differences are:
12 #--------------------- 34kt ------------------ 10kt -----------------
13 # MaxDrift 385 228
14 # nAPALong 18 10
15 
16 # The only structural differnce in this script is that 10kt places
17 # cryostats side by side, whereas 34kt is end to end.
18 
19 
20 # Each subroutine generates a fragment GDML file, and the last subroutine
21 # creates an XML file that make_gdml.pl will use to appropriately arrange
22 # the fragment GDML files to create the final desired DUNE GDML file,
23 # to be named by make_gdml output command
24 
25 # If you are playing with different geometries, you can use the
26 # suffix command to help organize your work.
27 
28 use Math::Trig;
29 use Getopt::Long;
30 use Math::BigFloat;
31 Math::BigFloat->precision(-16);
32 
33 GetOptions( "help|h" => \$help,
34  "suffix|s:s" => \$suffix,
35  "output|o:s" => \$output,
36  "wires|w:s" => \$wires,
37  "helpcube|c" => \$helpcube);
38 
39 if ( defined $help )
40 {
41  # If the user requested help, print the usage notes and exit.
42  usage();
43  exit;
44 }
45 
46 if ( ! defined $suffix )
47 {
48  # The user didn't supply a suffix, so append nothing to the file
49  # names.
50  $suffix = "";
51 }
52 else
53 {
54  # Otherwise, stick a "-" before the suffix, so that a suffix of
55  # "test" applied to filename.gdml becomes "filename-test.gdml".
56  $suffix = "-" . $suffix;
57 }
58 
59 
60 #++++++++++++++++++++++++ Begin defining variables +++++++++++++++++++++++++
61 
62 # Define detector geometry variables - later to be put in a parameters
63 # XML file to be parsed as an input?
64 
65 # set wires on to be the default, unless given an input by the user
66 $wires_on = 1; # 1=on, 0=off
67 if (defined $wires)
68 {
69 $wires_on = $wires
70 }
71 
72 $tpc_on=1;
73 $inch = 2.54;
74 
75 
76 ###### ALL PARAMETERS FROM DocDb-3383 #######
77 
78 
79 ##################################################################
80 ##################### wire plane parameters ######################
81 
82 $UWirePitch = 0.49;
83 $VWirePitch = 0.5;
84 $XWirePitch = 0.45;
85 
86 $UAngle = 45.7;
87 $VAngle = 44.3;
88 #$UAngle = 35;
89 #$VAngle = 35;
90 
91 $SinUAngle = sin( deg2rad($UAngle) );
92 $CosUAngle = cos( deg2rad($UAngle) );
93 $TanUAngle = tan( deg2rad($UAngle) );
94 
95 $SinVAngle = sin( deg2rad($VAngle) );
96 $CosVAngle = cos( deg2rad($VAngle) );
97 $TanVAngle = tan( deg2rad($VAngle) );
98 
99 $UWire_yint = $UWirePitch/$SinUAngle;
100 $UWire_zint = $UWirePitch/$CosUAngle;
101 
102 $VWire_yint = $VWirePitch/$SinVAngle;
103 $VWire_zint = $VWirePitch/$CosVAngle;
104 
105 $TPCWireThickness = 0.015;
106 
107 $TPCWirePlaneThickness = $TPCWireThickness;
108 #height and length defined lower
109 
110 
111 
112 
113 
114 ###########################################################################
115 ############## modular APA dimension and spacing parameters ###############
116 
117 $nCryos = 2;
118 $nAPAWide = 3;
119 $nAPAHigh = 2;
120 $nAPALong = 18;
121 
122 $CPAThickness = 5.1;
123 $APAFrame_x = 2*$inch; # this does not include the wire spacing
124 $APAWirePlaneSpacing = 0.476; # spacing between all of the wire planes (u, v, and x)
125 $MaxDrift = 385;
126  #MaxDrift is the distance form the edge of the CPA to the edge of the first wire plane
127  #TODO: the implementation and value of MaxDrift will have to be re-evaluated if adding the grid plane.
128 
129 $APALongGap = 1.5; # separation between APAs along the incident beam axis
130 $APAVerticalGap = 2.5; # separation between APAs along the vertical axis
131 
132 #Cryostat space with LAr outside of entire fiducial volume
133 $SpaceCPAtoCryoWall = 85;
134 $SpaceAPAToFloor = 50;
135 $SpaceAPAToTopLAr = 50;
136 $UpstreamLArPadding = 250;
137 $DownstreamLArPadding = 50;
138 
139 
140 $APAWidth = 2*$MaxDrift
141  + 4*$APAWirePlaneSpacing
142  + 2*$TPCWirePlaneThickness
143  + $APAFrame_x;
144  # This is the distance edge of CPA to edge of CPA.
145  # MaxDrift covers the spacing involving the grid plane.
146  # Unlike the other dimensions, this does not describe
147  # a physical dimension of an APA, but rather is used
148  # to position the "module" one would think of as having
149  # the APA and the corresponding drift distances.
150 
151 $APAHeight = 700; # doesn't include front-end boards or hanger posts
152 $APALength = 252; # doesn't include the dead space on the sides of APA frame for wrapping wires
153 
154 
155 
156 
157 
158 
159 ####################################################################
160 ################# APA Frame and Paddle Dimensions ##################
161 
162 $APAFrameZSide_x = $APAFrame_x;
163 $APAFrameZSide_y = 4*$inch;
164 $APAFrameZSide_z = $APALength;
165 
166 
167 $LightPaddleWidth = 0.476;
168 $LightPaddleHeight = 4*$inch;
169 $LightPaddleLength = 225-0.001;
170 $nLightPaddlesPerAPA = 10; # 10, or 20 for double coverage (for now)
171 $PaddleYInterval = (2*$APAHeight+$APAVerticalGap-$LightPaddleHeight-2*$APAFrameZSide_y)
172  /(2*$nLightPaddlesPerAPA-1);
173 $FrameToPaddleSpace = ($PaddleYInterval-$APAVerticalGap)/2;
174 
175 $SiPM_z = 0;
176 
177 # $PaddleYInterval is defined so that the center-to-center distance in the
178 # y direction between paddles is uniform between vertically stacked APAs.
179 # $FrameToPaddleSpace is from the BOTTOM of the APA frame (4" in y direction)
180 # to the CENTER of a paddle, including the 4" part of the frame. This variable's
181 # primary purpose is to position the lowest paddle in each APA.
182 
183 
184 $APAFrameZSide_x = $APAFrame_x;
185 $APAFrameZSide_y = 4*$inch;
186 $APAFrameZSide_z = $APALength;
187 
188 $APAFrameYSide_x = $APAFrame_x;
189 $APAFrameYSide_y = $APAHeight-2*$APAFrameZSide_y;
190 $APAFrameYSide_z = 4*$inch;
191 
192 # Two outer Y supports will sandwich the inner Y supports and light paddles
193 $APAFrameYOuterSupport_x = ($APAFrame_x-$LightPaddleWidth)/2;
194 $APAFrameYOuterSupport_y = $APAHeight-2*$APAFrameZSide_y;
195 $APAFrameYOuterSupport_z = 4*$inch;
196 
197 $APAFrameYInnerSupport_x = $LightPaddleWidth;
198 $APAFrameYInnerSupport_y = $PaddleYInterval-$LightPaddleHeight;
199 $APAFrameYInnerSupport_z = 4*$inch;
200 
201 $APAFrameZHalfSupport_x = $APAFrame_x;
202 $APAFrameZHalfSupport_y = 2*$inch;
203 $APAFrameZHalfSupport_z = $APAFrameZSide_z
204  - 2*$APAFrameYSide_z
205  - $APAFrameYSupport_z;
206 
207 
208 $EdgeFrameSteelThickness = 0.12*$inch;
209 $InnerFrameSteelThickness = 0.062*$inch;
210 
211 
212 
213 
214 
215 
216 
217 ##############################################################
218 ############## Cryo and TPC relevant dimensions #############
219 
220  # TODO: These fiducial parameters were useful in placement within the Cryostat,
221  # but now that it is only symmetric in the x direction, the only placement where
222  # these parameters are useful is in the x direction. possibly deprecate so as
223  # not to be misleading or overly complicated here.
224 $FiducialWidth = $APAWidth*$nAPAWide + $CPAThickness*($nAPAWide+1);
225 $FiducialHeight = $APAHeight*$nAPAHigh + ($nAPAHigh - 1)*$APAVerticalGap;
226 $FiducialLength = $APALength*$nAPALong + ($nAPALong - 1)*$APALongGap;
227 
228 $SteelThickness = 0.5*$inch; #half inch
229 $HeightGaseousAr = 50;
230 
231 
232 $ArgonWidth = $FiducialWidth
233  + 2*$SpaceCPAToCryoWall;
234 $ArgonHeight = $FiducialHeight
235  + $SpaceAPAToFloor + $SpaceAPAToTopLAr
236  + $HeightGaseousAr;
237  # both liquid AND gaseous argon
238 
239 $ArgonLength = $FiducialLength
240  + $UpstreamLArPadding + $DownstreamLArPadding;
241 
242 $CryostatWidth = $ArgonWidth + 2*$SteelThickness;
243 $CryostatHeight = $ArgonHeight + 2*$SteelThickness;
244 $CryostatLength = $ArgonLength + 2*$SteelThickness;
245 
246 $TPCWidth = ($APAWidth-$APAFrame_x)/2;
247  # this distance is the distance from edge of
248  # the APA frame to the edge of the CPA
249 $TPCHeight = $APAHeight + $APAVerticalGap;
250 $TPCLength = $APALength + $APALongGap;
251 
252 
253  # $TPCWirePlaneThickness now defined higher up
254 $TPCWirePlaneHeight = $APAHeight;
255  # the wire plane region is the full height of the APA since
256  # the previous number doesn't have the front-end boards, etc.
257 $TPCWirePlaneLength = $APALength;
258  # the APA Length doesn't have the spacing on between the two
259  # APAs so the Wire Plane Length is the full length
260 
261 
262 ### TODO: MAY NEED ADJUSTMENT:
263 #TPC Active Variables -- apply cuts here
264 
265 $TPCActiveWidth = $TPCWidth-(3*$APAWirePlaneSpacing);
266 $TPCActiveHeight = $TPCWirePlaneHeight;
267 $TPCActiveLength = $TPCWirePlaneLength;
268 
269 $posTPCActive_X = $TPCWidth/2-$TPCActiveWidth/2;
270 $posTPCActive_Y = 0;
271 $posTPCActive_Z = 0;
272 
273 
274 
275 
276 
277 
278 
279 
280 ##################################################################
281 ############## DetEnc and World relevant parameters #############
282 
283 $ArToAr = 300;
284  # x distance between the LAr in each side by side cryo
285 $ConcretePadding = 50;
286 $FoamPadding = 80;
287 $TotalPadding = $ConcretePadding+$FoamPadding;
288 
289 # 34kt difference: Lengtho holds 2 cryostats instead of width
290 # TODO: ArToAr same for now. not in 3833, need design diagrams or AutoCAD
291 $DetEncLength = 2*$CryostatLength+2*$TotalPadding+2*$FoamPadding + $ArToAr;
292 $DetEncWidth = $CryostatWidth+2*$TotalPadding;
293 $DetEncHeight = $CryostatHeight+$ConcretePadding;
294  # no foam on bottom or top, no concrete on top
295 
296 
297 
298  # We want the world origin to be at the very front of the fiducial volume.
299  # move it to the front of the enclosure, then back it up through the concrete/foam,
300  # then through the Cryostat shell, then through the upstream dead LAr (including the
301  # dead LAr on the edge of the TPC, but this is covered in $UpstreamLArPadding).
302  # This is to be added to the z position of every volume in volWorld
303 
304 $OriginZSet = $DetEncLength/2
305  - $TotalPadding
306  - $SteelThickness
307  - $UpstreamLArPadding;
308 
309  # We want the world origin to be vertically centered between the stacked APAs.
310  # the cryostat sits on top of concrete padding, move the detector enclosure back
311  # This is to be added to the y position of every volume in volWorld
312 
313 $OriginYSet = $HeightGaseousAr/2
314  - $ConcretePadding/2;
315 
316  # similar X set variable may be set if needed later
317 
318 
319 # TODO: Needs work from here on... wait until design stabilizes
320 
321 # Since we want the z center to be at the fron face of the first fiducial volume,
322 # nearly all of the first cryostat, and comletely all of the second, ar on the
323 # positive z side of the world volume. In other words, most of the very long
324 # volDetEnclosue is on the positive z side, so the world must be long enough to
325 # contain that
326 
327 $RockThickness = 5000;
328 
329 $WorldWidth = $DetEncWidth+2*$RockThickness;
330 $WorldHeight = $DetEncHeight+2*$RockThickness;
331 $WorldLength = $DetEncLength+2*$RockThickness;
332 
333 
334 # 34kt difference: The Highbay and service building portions of
335 # the code have been entirely removed, since 34kt underground
336 # will be much different.
337 
338 
339 
340 
341 #################### Help get your bearings when drawing a symmetric detector. only in world.
342 
343 $PosDirCubeSide = 0;
344 if (defined $helpcube)
345 {
346 $PosDirCubeSide = $ArToAr; #seems to be a good proportion
347 }
348 
349 
350 
351 
352 
353 #+++++++++++++++++++++++++ End defining variables ++++++++++++++++++++++++++
354 
355 # run the sub routines that generate the fragments
356 
357 gen_Define(); # generates definitions at beginning of GDML
358 gen_Materials(); # generates materials to be used
359 
360 gen_TPC(); # generates wires, wire planes, and puts them in volTPC
361  # This is the bulk of the code, and has zero wires option
362 gen_Cryostat(); # places (2*nAPAWide x nAPAHigh x nAPALong) volTPC,
363  # half rotated 180 about Y
364 gen_Enclosure(); # places two cryostats and concrete volumes
365 
366 gen_World(); # places the enclosure among DUSEL Rock
367 
368 
369 write_fragments(); # writes the XML input for make_gdml.pl
370  # which zips together the final GDML
371 exit;
372 
373 
374 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
375 #+++++++++++++++++++++++++++++++++++++++++ usage +++++++++++++++++++++++++++++++++++++++++
376 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
377 
378 sub usage()
379 {
380  print "Usage: $0 [-h|--help] [-o|--output <fragments-file>] [-s|--suffix <string>]\n";
381  print " if -o is omitted, output goes to STDOUT; <fragments-file> is input to make_gdml.pl\n";
382  print " -s <string> appends the string to the file names; useful for multiple detector versions\n";
383  print " -h prints this message, then quits\n";
384 }
385 
386 
387 
388 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
389 #++++++++++++++++++++++++++++++++++++++ gen_Define +++++++++++++++++++++++++++++++++++++++
390 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
391 
392 sub gen_Define()
393 {
394 
395 # Create the <define> fragment file name,
396 # add file to list of fragments,
397 # and open it
398  $DEF = "dune_10kT_Def" . $suffix . ".gdml";
399  push (@gdmlFiles, $DEF);
400  $DEF = ">" . $DEF;
401  open(DEF) or die("Could not open file $DEF for writing");
402 
403 
404 print DEF <<EOF;
405 <?xml version='1.0'?>
406 <gdml>
407 <define>
408  <position name="posTPCActive" unit="cm" x="$posTPCActive_X" y="$posTPCActive_Y" z="$posTPCActive_Z"/>
409  <position name="posCenter" unit="cm" x="0" y="0" z="0"/>
410  <rotation name="rPlus90AboutX" unit="deg" x="90" y="0" z="0"/>
411  <rotation name="rMinus90AboutY" unit="deg" x="0" y="270" z="0"/>
412  <rotation name="rMinus90AboutYMinus90AboutX" unit="deg" x="270" y="270" z="0"/>
413  <rotation name="rPlusUAngleAboutX" unit="deg" x="90-$UAngle" y="0" z="0"/>
414  <rotation name="rPlusVAngleAboutX" unit="deg" x="90+$VAngle" y="0" z="0"/>
415  <rotation name="rPlus180AboutY" unit="deg" x="0" y="180" z="0"/>
416  <rotation name="rIdentity" unit="deg" x="0" y="0" z="0"/>
417 </define>
418 </gdml>
419 EOF
420  close (DEF);
421 }
422 
423 
424 
425 
426 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
427 #+++++++++++++++++++++++++++++++++++++ gen_Materials +++++++++++++++++++++++++++++++++++++
428 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
429 
430 sub gen_Materials()
431 {
432 
433 # Create the <materials> fragment file name,
434 # add file to list of output GDML fragments,
435 # and open it
436  $MAT = "dune_10kT_Materials" . $suffix . ".gdml";
437  push (@gdmlFiles, $MAT);
438  $MAT = ">" . $MAT;
439  open(MAT) or die("Could not open file $MAT for writing");
440 
441 
442  print MAT <<EOF;
443 <materials>
444  <element name="videRef" formula="VACUUM" Z="1"> <atom value="1"/> </element>
445  <element name="bromine" formula="Br" Z="35"> <atom value="79.904"/> </element>
446  <element name="hydrogen" formula="H" Z="1"> <atom value="1.0079"/> </element>
447  <element name="nitrogen" formula="N" Z="7"> <atom value="14.0067"/> </element>
448  <element name="oxygen" formula="O" Z="8"> <atom value="15.999"/> </element>
449  <element name="aluminum" formula="Al" Z="13"> <atom value="26.9815"/> </element>
450  <element name="silicon" formula="Si" Z="14"> <atom value="28.0855"/> </element>
451  <element name="carbon" formula="C" Z="6"> <atom value="12.0107"/> </element>
452  <element name="potassium" formula="K" Z="19"> <atom value="39.0983"/> </element>
453  <element name="chromium" formula="Cr" Z="24"> <atom value="51.9961"/> </element>
454  <element name="iron" formula="Fe" Z="26"> <atom value="55.8450"/> </element>
455  <element name="nickel" formula="Ni" Z="28"> <atom value="58.6934"/> </element>
456  <element name="calcium" formula="Ca" Z="20"> <atom value="40.078"/> </element>
457  <element name="magnesium" formula="Mg" Z="12"> <atom value="24.305"/> </element>
458  <element name="sodium" formula="Na" Z="11"> <atom value="22.99"/> </element>
459  <element name="titanium" formula="Ti" Z="22"> <atom value="47.867"/> </element>
460  <element name="argon" formula="Ar" Z="18"> <atom value="39.9480"/> </element>
461  <element name="sulphur" formula="S" Z="16"> <atom value="32.065"/> </element>
462  <element name="phosphorus" formula="P" Z="15"> <atom value="30.973"/> </element>
463 
464  <material name="Vacuum" formula="Vacuum">
465  <D value="1.e-25" unit="g/cm3"/>
466  <fraction n="1.0" ref="videRef"/>
467  </material>
468 
469  <material name="ALUMINUM_Al" formula="ALUMINUM_Al">
470  <D value="2.6990" unit="g/cm3"/>
471  <fraction n="1.0000" ref="aluminum"/>
472  </material>
473 
474  <material name="SILICON_Si" formula="SILICON_Si">
475  <D value="2.3300" unit="g/cm3"/>
476  <fraction n="1.0000" ref="silicon"/>
477  </material>
478 
479  <material name="epoxy_resin" formula="C38H40O6Br4">
480  <D value="1.1250" unit="g/cm3"/>
481  <composite n="38" ref="carbon"/>
482  <composite n="40" ref="hydrogen"/>
483  <composite n="6" ref="oxygen"/>
484  <composite n="4" ref="bromine"/>
485  </material>
486 
487  <material name="SiO2" formula="SiO2">
488  <D value="2.2" unit="g/cm3"/>
489  <composite n="1" ref="silicon"/>
490  <composite n="2" ref="oxygen"/>
491  </material>
492 
493  <material name="Al2O3" formula="Al2O3">
494  <D value="3.97" unit="g/cm3"/>
495  <composite n="2" ref="aluminum"/>
496  <composite n="3" ref="oxygen"/>
497  </material>
498 
499  <material name="Fe2O3" formula="Fe2O3">
500  <D value="5.24" unit="g/cm3"/>
501  <composite n="2" ref="iron"/>
502  <composite n="3" ref="oxygen"/>
503  </material>
504 
505  <material name="CaO" formula="CaO">
506  <D value="3.35" unit="g/cm3"/>
507  <composite n="1" ref="calcium"/>
508  <composite n="1" ref="oxygen"/>
509  </material>
510 
511  <material name="MgO" formula="MgO">
512  <D value="3.58" unit="g/cm3"/>
513  <composite n="1" ref="magnesium"/>
514  <composite n="1" ref="oxygen"/>
515  </material>
516 
517  <material name="Na2O" formula="Na2O">
518  <D value="2.27" unit="g/cm3"/>
519  <composite n="2" ref="sodium"/>
520  <composite n="1" ref="oxygen"/>
521  </material>
522 
523  <material name="TiO2" formula="TiO2">
524  <D value="4.23" unit="g/cm3"/>
525  <composite n="1" ref="titanium"/>
526  <composite n="2" ref="oxygen"/>
527  </material>
528 
529  <material name="FeO" formula="FeO">
530  <D value="5.745" unit="g/cm3"/>
531  <composite n="1" ref="iron"/>
532  <composite n="1" ref="oxygen"/>
533  </material>
534 
535  <material name="CO2" formula="CO2">
536  <D value="1.562" unit="g/cm3"/>
537  <composite n="1" ref="iron"/>
538  <composite n="2" ref="oxygen"/>
539  </material>
540 
541  <material name="P2O5" formula="P2O5">
542  <D value="1.562" unit="g/cm3"/>
543  <composite n="2" ref="phosphorus"/>
544  <composite n="5" ref="oxygen"/>
545  </material>
546 
547  <material formula=" " name="DUSEL_Rock">
548  <D value="2.82" unit="g/cm3"/>
549  <fraction n="0.5267" ref="SiO2"/>
550  <fraction n="0.1174" ref="FeO"/>
551  <fraction n="0.1025" ref="Al2O3"/>
552  <fraction n="0.0473" ref="MgO"/>
553  <fraction n="0.0422" ref="CO2"/>
554  <fraction n="0.0382" ref="CaO"/>
555  <fraction n="0.0240" ref="carbon"/>
556  <fraction n="0.0186" ref="sulphur"/>
557  <fraction n="0.0053" ref="Na2O"/>
558  <fraction n="0.00070" ref="P2O5"/>
559  <fraction n="0.0771" ref="oxygen"/>
560  </material>
561 
562  <material name="fibrous_glass">
563  <D value="2.74351" unit="g/cm3"/>
564  <fraction n="0.600" ref="SiO2"/>
565  <fraction n="0.118" ref="Al2O3"/>
566  <fraction n="0.001" ref="Fe2O3"/>
567  <fraction n="0.224" ref="CaO"/>
568  <fraction n="0.034" ref="MgO"/>
569  <fraction n="0.010" ref="Na2O"/>
570  <fraction n="0.013" ref="TiO2"/>
571  </material>
572 
573  <material name="FR4">
574  <D value="1.98281" unit="g/cm3"/>
575  <fraction n="0.47" ref="epoxy_resin"/>
576  <fraction n="0.53" ref="fibrous_glass"/>
577  </material>
578 
579  <material name="STEEL_STAINLESS_Fe7Cr2Ni" formula="STEEL_STAINLESS_Fe7Cr2Ni">
580  <D value="7.9300" unit="g/cm3"/>
581  <fraction n="0.0010" ref="carbon"/>
582  <fraction n="0.1792" ref="chromium"/>
583  <fraction n="0.7298" ref="iron"/>
584  <fraction n="0.0900" ref="nickel"/>
585  </material>
586 
587  <material name="LAr" formula="LAr">
588  <D value="1.40" unit="g/cm3"/>
589  <fraction n="1.0000" ref="argon"/>
590  </material>
591 
592  <material name="ArGas" formula="ArGas">
593  <D value="0.00166" unit="g/cm3"/>
594  <fraction n="1.0" ref="argon"/>
595  </material>
596 
597  <material formula=" " name="Air">
598  <D value="0.001205" unit="g/cm3"/>
599  <fraction n="0.781154" ref="nitrogen"/>
600  <fraction n="0.209476" ref="oxygen"/>
601  <fraction n="0.00934" ref="argon"/>
602  </material>
603 
604  <material formula=" " name="G10">
605  <D value="1.7" unit="g/cm3"/>
606  <fraction n="0.2805" ref="silicon"/>
607  <fraction n="0.3954" ref="oxygen"/>
608  <fraction n="0.2990" ref="carbon"/>
609  <fraction n="0.0251" ref="hydrogen"/>
610  </material>
611 
612  <material formula=" " name="Granite">
613  <D value="2.7" unit="g/cm3"/>
614  <fraction n="0.438" ref="oxygen"/>
615  <fraction n="0.257" ref="silicon"/>
616  <fraction n="0.222" ref="sodium"/>
617  <fraction n="0.049" ref="aluminum"/>
618  <fraction n="0.019" ref="iron"/>
619  <fraction n="0.015" ref="potassium"/>
620  </material>
621 
622  <material formula=" " name="ShotRock">
623  <D value="2.7*0.6" unit="g/cm3"/>
624  <fraction n="0.438" ref="oxygen"/>
625  <fraction n="0.257" ref="silicon"/>
626  <fraction n="0.222" ref="sodium"/>
627  <fraction n="0.049" ref="aluminum"/>
628  <fraction n="0.019" ref="iron"/>
629  <fraction n="0.015" ref="potassium"/>
630  </material>
631 
632  <material formula=" " name="Dirt">
633  <D value="1.7" unit="g/cm3"/>
634  <fraction n="0.438" ref="oxygen"/>
635  <fraction n="0.257" ref="silicon"/>
636  <fraction n="0.222" ref="sodium"/>
637  <fraction n="0.049" ref="aluminum"/>
638  <fraction n="0.019" ref="iron"/>
639  <fraction n="0.015" ref="potassium"/>
640  </material>
641 
642  <material formula=" " name="Concrete">
643  <D value="2.3" unit="g/cm3"/>
644  <fraction n="0.530" ref="oxygen"/>
645  <fraction n="0.335" ref="silicon"/>
646  <fraction n="0.060" ref="calcium"/>
647  <fraction n="0.015" ref="sodium"/>
648  <fraction n="0.020" ref="iron"/>
649  <fraction n="0.040" ref="aluminum"/>
650  </material>
651 
652  <material formula="H2O" name="Water">
653  <D value="1.0" unit="g/cm3"/>
654  <fraction n="0.1119" ref="hydrogen"/>
655  <fraction n="0.8881" ref="oxygen"/>
656  </material>
657 
658  <material formula="Ti" name="Titanium">
659  <D value="4.506" unit="g/cm3"/>
660  <fraction n="1." ref="titanium"/>
661  </material>
662 
663  <material name="TPB" formula="TPB">
664  <D value="1.40" unit="g/cm3"/>
665  <fraction n="1.0000" ref="argon"/>
666  </material>
667 
668  <material name="Glass">
669  <D value="2.74351" unit="g/cm3"/>
670  <fraction n="0.600" ref="SiO2"/>
671  <fraction n="0.118" ref="Al2O3"/>
672  <fraction n="0.001" ref="Fe2O3"/>
673  <fraction n="0.224" ref="CaO"/>
674  <fraction n="0.034" ref="MgO"/>
675  <fraction n="0.010" ref="Na2O"/>
676  <fraction n="0.013" ref="TiO2"/>
677  </material>
678 
679  <material name="Acrylic">
680  <D value="1.19" unit="g/cm3"/>
681  <fraction n="0.600" ref="carbon"/>
682  <fraction n="0.320" ref="oxygen"/>
683  <fraction n="0.080" ref="hydrogen"/>
684  </material>
685 
686 </materials>
687 EOF
688 
689 close(MAT);
690 }
691 
692 
693 
694 
695 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
696 #++++++++++++++++++++++++++++++++++++++++ gen_TPC ++++++++++++++++++++++++++++++++++++++++
697 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
698 
699 
700 sub gen_TPC()
701 {
702 
703 #constructs everything inside volTPC, namely
704 # (moving from left to right, or from +x to -x)
705 # -volTPCPlaneU: with wires angled from vertical slightly different than in V
706 # -volTPCPlaneV: with wires angled from vertical slightly differently than in U
707 # -volTPCPlaneX: with vertical wires
708 
709 
710 # Create the TPC fragment file name,
711 # add file to list of output GDML fragments,
712 # and open it
713  $TPC = "dune_10kT_TPC" . $suffix . ".gdml";
714  push (@gdmlFiles, $TPC);
715  $TPC = ">" . $TPC;
716  open(TPC) or die("Could not open file $TPC for writing");
717 
718 
719 # The standard XML prefix and starting the gdml
720  print TPC <<EOF;
721 <?xml version='1.0'?>
722 <gdml>
723 EOF
724 
725 
726 # All the TPC solids save the wires.
727 print TPC <<EOF;
728 <solids>
729  <box name="TPC" lunit="cm"
730  x="$TPCWidth"
731  y="$TPCHeight"
732  z="$TPCLength"/>
733  <box name="TPCPlane" lunit="cm"
734  x="$TPCWirePlaneThickness"
735  y="$TPCWirePlaneHeight"
736  z="$TPCWirePlaneLength"/>
737  <box name="TPCActive" lunit="cm"
738  x="$TPCActiveWidth"
739  y="$TPCActiveHeight"
740  z="$TPCActiveLength"/>
741 EOF
742 
743 
744 #++++++++++++++++++++++++++++ Wire Solids ++++++++++++++++++++++++++++++
745 
746 print TPC <<EOF;
747 
748  <tube name="TPCWireVert"
749  rmax="0.5*$TPCWireThickness"
750  z="$TPCWirePlaneHeight"
751  deltaphi="360"
752  aunit="deg"
753  lunit="cm"/>
754 EOF
755 
756 # Set number of wires to default to zero, when $wires_on = 0, for a low memory
757 # version. But if $wires_on = 1, calculate the number of wires on each side of each
758 # plane to be used in the for loops
759 
760 my $NumberCornerUWires = 0;
761 my $NumberSideUWires = 0;
762 my $NumberCommonUWires = 0;
763 my $NumberCornerVWires = 0;
764 my $NumberSideVWires = 0;
765 my $NumberCommonVWires = 0;
766 my $NumberVerticalWires = 0;
767 
768 if ($wires_on == 1)
769 {
770  # Number of wires in one corner
771 $NumberCornerUWires = int( $TPCWirePlaneLength/($UWirePitch/$CosUAngle) );
772 
773 $NumberCornerVWires = int( $TPCWirePlaneLength/($VWirePitch/$CosVAngle) );
774 
775  # Total number of wires touching one vertical (longer) side
776  # Note that the total number of wires per plane is this + another set of corner wires
777 $NumberSideUWires = int( $TPCWirePlaneHeight/($UWirePitch/$SinUAngle) );
778 
779 $NumberSideVWires = int( $TPCWirePlaneHeight/($VWirePitch/$SinVAngle) );
780 
781  # Number of wires per side that aren't cut off by the corner
782 $NumberCommonUWires = $NumberSideUWires - $NumberCornerUWires;
783 
784 $NumberCommonVWires = $NumberSideVWires - $NumberCornerVWires;
785 
786  # number of wires on the vertical plane
787 $NumberVerticalWires = int( ($TPCWirePlaneLength-$TPCWireThickness)/$XWirePitch );
788 }
789 
790 # These XML comments throughout make the GDML file easier to navigate
791 print TPC <<EOF;
792 
793 <!--+++++++++++++++++++ U Wire Solids ++++++++++++++++++++++-->
794 
795 EOF
796 
797 # The corner wires for the U plane
798 if ($wires_on==1)
799 {
800  for ($i = 0; $i < $NumberCornerUWires; ++$i)
801  {
802  # Subtraction to avoid corners of wires overlapping the TPCPlane sides,
803  # equal to 0.5*TCPWireThickness*($TanUAngle+1/$TanUAngle),
804  # allowing for 30deg<UAngle
805 
806  print TPC <<EOF;
807  <tube name="TPCWireU$i"
808  rmax="0.5*$TPCWireThickness"
809  z="$UWirePitch*($TanUAngle+1/$TanUAngle)*($i+1)-0.01732"
810  deltaphi="360"
811  aunit="deg"
812  lunit="cm"/>
813 EOF
814 
815  }
816  # Next, the wire used many times in the middle of the U plane.
817  # Subtraction again to avoid wire corners overlapping, equal to
818  # 0.5*TCPWireThickness*2/$TanVAngle, allowing for 30deg<VAngle
819 
820  print TPC <<EOF;
821  <tube name="TPCWireUCommon"
822  rmax="0.5*$TPCWireThickness"
823  z="$TPCWirePlaneLength/$SinUAngle-0.02598"
824  deltaphi="360"
825  aunit="deg"
826  lunit="cm"/>
827 EOF
828 
829 } else {
830 #inform the gdml user why no wires show up when -w=0 is used
831 
832 print TPC <<EOF;
833 
834 
835  <!-- The command -w=0 has been used when running generate_dune_gdml-NEW.pl -->
836 
837  <!-- This GDML version has no wires and uses much less memory -->
838 
839 EOF
840 
841 }
842 
843 print TPC <<EOF;
844 
845 
846 
847 
848 
849 
850 
851 
852 
853 <!--+++++++++++++++++++ V Wire Solids ++++++++++++++++++++++-->
854 
855 
856 EOF
857 
858 # The corner wires for the V plane
859 if ($wires_on==1)
860 {
861  for ($i = 0; $i < $NumberCornerVWires; ++$i)
862  {
863  # Same subtraction to avoid corners of wires overlapping
864  # the TPCPlane sides
865 
866  print TPC <<EOF;
867 
868  <tube name="TPCWireV$i"
869  rmax="0.5*$TPCWireThickness"
870  z="$VWirePitch*($TanVAngle+1/$TanVAngle)*($i+1)-0.01732"
871  deltaphi="360"
872  aunit="deg"
873  lunit="cm"/>
874 
875 EOF
876 
877  }
878 
879  # The wire used many times in the middle of the V plane
880  # Same subtraction as U common
881 
882  print TPC <<EOF;
883  <tube name="TPCWireVCommon"
884  rmax="0.5*$TPCWireThickness"
885  z="$TPCWirePlaneLength/$SinVAngle-0.02598"
886  deltaphi="360"
887  aunit="deg"
888  lunit="cm"/>
889 EOF
890 
891 } else {
892 #inform the gdml user why no wires show up when -w=0 is used
893 
894 print TPC <<EOF;
895 
896 
897  <!-- no wires in this GDML -->
898 
899 EOF
900 
901 }
902 
903 
904 
905 # Begin structure and create the vertical wire logical volume
906 print TPC <<EOF;
907 </solids>
908 <structure>
909  <volume name="volTPCActive">
910  <materialref ref="LAr"/>
911  <solidref ref="TPCActive"/>
912  </volume>
913 
914 
915 
916 
917 
918 
919 
920 
921 
922 <!--+++++++++++++++++ Wire Logical Volumes ++++++++++++++++++++-->
923 
924 EOF
925 
926 
927 if ($wires_on==1)
928 {
929  print TPC <<EOF;
930  <volume name="volTPCWireVert">
931  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
932  <solidref ref="TPCWireVert" />
933  </volume>
934 EOF
935 
936  # Corner U wires logical volumes
937  for ($i = 0; $i < $NumberCornerUWires; ++$i)
938  {
939  print TPC <<EOF;
940  <volume name="volTPCWireU$i">
941  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
942  <solidref ref="TPCWireU$i" />
943  </volume>
944 EOF
945 
946  }
947 
948  # Common U wire logical volume, referenced many times
949  print TPC <<EOF;
950  <volume name="volTPCWireUCommon">
951  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
952  <solidref ref="TPCWireUCommon" />
953  </volume>
954 EOF
955 
956  # Corner V wires logical volumes
957  for ($i = 0; $i < $NumberCornerVWires; ++$i)
958  {
959  print TPC <<EOF;
960  <volume name="volTPCWireV$i">
961  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
962  <solidref ref="TPCWireV$i" />
963  </volume>
964 EOF
965 
966  }
967 
968  # Common V wire logical volume, referenced many times
969  print TPC <<EOF;
970  <volume name="volTPCWireVCommon">
971  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
972  <solidref ref="TPCWireVCommon" />
973  </volume>
974 EOF
975 
976 } else {
977 #inform the gdml user why no wires show up when -w=0 is used
978 
979 print TPC <<EOF;
980 
981 
982  <!-- The command -w=0 has been used when running generate_dune_gdml-NEW.pl -->
983 
984  <!-- This GDML version has no wires and uses much less memory -->
985 
986 EOF
987 
988 }
989 
990 
991 
992 
993 #+++++++++++++++++++++++++ Position physical wires ++++++++++++++++++++++++++
994 
995 # ++++++++++++++++++++++ U Plane +++++++++++++++++++++++
996 
997 # Create U plane logical volume
998 print TPC <<EOF;
999 
1000 
1001 
1002 
1003 
1004 
1005 
1006 <!--+++++++++++++++++++++ U Plane ++++++++++++++++++++++++-->
1007 
1008 
1009  <volume name="volTPCPlaneU">
1010  <materialref ref="LAr"/>
1011  <solidref ref="TPCPlane"/>
1012 EOF
1013 
1014 if ($wires_on==0)
1015 {
1016 print TPC <<EOF;
1017 
1018  <!-- no wires -->
1019 
1020 EOF
1021 
1022 } else {
1023 
1024 # Starting with the bottom left corner wires:
1025  # x=0 to center the wires in the plane
1026  # y positioning: (-0.5*$TPCWirePlaneHeight) starts the incremental increase
1027  # from the bottom of the plane, and trigonometry gives the increment
1028  # z positioning: Looking at the plane from the positive x direction,
1029  # (0.5*$TPCWirePlaneLength) starts the incremental increase from
1030  # the lower left corner.
1031  # rotation: same as common wire in code below
1032 
1033 for ($i = 0; $i < $NumberCornerUWires; ++$i)
1034 {
1035 my $ypos = (-0.5*$TPCWirePlaneHeight)+0.5*($i+1)*$UWire_yint;
1036 my $zpos = (0.5*$TPCWirePlaneLength)-0.5*($i+1)*$UWire_zint;
1037 
1038 my $diff=(0.5*$TPCWirePlaneLength)-0.5*($NumberCornerUWires)*$UWire_zint;
1039 my $zpos=$zpos-$diff;
1040 
1041 print TPC <<EOF;
1042  <physvol>
1043  <volumeref ref="volTPCWireU$i"/>
1044  <position name="posTPCWireU$i" unit="cm" x="0" y="$ypos " z="$zpos"/>
1045  <rotationref ref="rPlusUAngleAboutX"/>
1046  </physvol>
1047 EOF
1048 
1049 }
1050 
1051 
1052 # Moving upwards to the common wires:
1053  # x and z are zero to center the wires along a vertical axis
1054  # y positioning: The trick is positioning the lowest common wire so that the pitch
1055  # is consistent, then the increment is double the increment of
1056  # the corner wires since there is no z incriment.
1057  # rotation: wires in \\\\ direction, so +90deg to bring them to vertical and
1058  # +UAngle counterclockwise to arrive at proper orientation
1059 # Note that the counter maintains wire number (in pos. name) counting bottom to top
1060 
1061 for ($i = $NumberCornerUWires; $i < $NumberSideUWires; ++$i)
1062 {
1063 my $ypos = (-0.5*$TPCWirePlaneHeight)+0.5*($NumberCornerUWires)*$UWire_yint+($i+1-$NumberCornerUWires)*$UWire_yint;
1064 
1065 print TPC <<EOF;
1066  <physvol>
1067  <volumeref ref="volTPCWireUCommon"/>
1068  <position name="posTPCWireU$i" unit="cm" x="0" y="$ypos " z="0"/>
1069  <rotationref ref="rPlusUAngleAboutX"/>
1070  </physvol>
1071 EOF
1072 
1073 }
1074 
1075 
1076 # Finally moving to the corner wires on the top right:
1077  # x=0 to center the wires in the plane
1078  # y positioning: plug wire number into same equation
1079  # z positioning: start at z=0 and go negatively at the same z increment
1080  # rotation: same as common wire in code above
1081 # note that the counter maintains wire number shown in the position name
1082 
1083 for ($i = $NumberSideUWires; $i < $NumberSideUWires+$NumberCornerUWires-1; ++$i)
1084 {
1085  # Make a counter to recall the right logical volume reference:
1086  # We want the last U wire in this loop (the highest wire) to be the
1087  # first wire in the logical volume loop for U wires.
1088 
1089 $j = $NumberSideUWires+$NumberCornerUWires - $i - 2;
1090 
1091  # Note that since we are referencing the same logical volumes/same solids for
1092  # the top wires as well as the bottom, the pattern of "stacking" wire on top of wire
1093  # with an incremental separation is likely to cause the top corner wires to be a
1094  # a little shorter than they can be, but never any longer. There is no immediately
1095  # elegant way to fix this, but at 5mm pitch and around 45deg wire orientation, the
1096  # wires can be at most 1cm shorter than possible which is negligible until the top
1097  # 20 wires or so where 1cm is >5% of their length. This also means that there
1098  # could be one more space for a wire left over, but that is highly unlikely.
1099 
1100 my $ypos = (-0.5*$TPCWirePlaneHeight)+0.5*($NumberCornerUWires)*$UWire_yint+($NumberCommonUWires)*$UWire_yint+0.5*($i+1-$NumberSideUWires)*$UWire_yint;
1101 my $zpos = -0.5*($i+1-$NumberSideUWires)*$UWire_zint;
1102 
1103 print TPC <<EOF;
1104  <physvol>
1105  <volumeref ref="volTPCWireU$j"/>
1106  <position name="posTPCWireU$i" unit="cm" x="0" y="$ypos " z="$zpos"/>
1107  <rotationref ref="rPlusUAngleAboutX"/>
1108  </physvol>
1109 EOF
1110 
1111 }
1112 
1113 } #ends else
1114 
1115 
1116 # ++++++++++++++++++++++ V Plane +++++++++++++++++++++++
1117 
1118 # End U plane and create V plane logical volume
1119 print TPC <<EOF;
1120  </volume>
1121 
1122 
1123 
1124 
1125 
1126 
1127 
1128 <!--+++++++++++++++++++++ V Plane ++++++++++++++++++++++++-->
1129 
1130 
1131  <volume name="volTPCPlaneV">
1132  <materialref ref="LAr"/>
1133  <solidref ref="TPCPlane"/>
1134 EOF
1135 
1136 if ($wires_on==0)
1137 {
1138 print TPC <<EOF;
1139 
1140  <!-- no wires -->
1141 
1142 EOF
1143 
1144 } else {
1145 
1146 
1147 # Starting with the bottom right corner wires:
1148  # x=0 to center the wires in the plane
1149  # y positioning: (-0.5*$TPCWirePlaneHeight) starts the incremental increase
1150  # from the bottom of the plane, and trigonometry gives the increment
1151  # z positioning: Looking at the plane from the positive x direction,
1152  # (-0.5*$TPCWirePlaneLength) starts the incremental increase from
1153  # the lower right corner.
1154  # rotation: same as common wire in code below
1155 
1156 for ($i = 0; $i < $NumberCornerVWires; ++$i)
1157 {
1158 my $ypos = (-0.5*$TPCWirePlaneHeight)+0.5*($i+1)*$VWire_yint;
1159 my $zpos = (-0.5*$TPCWirePlaneLength)+0.5*($i+1)*$VWire_zint;
1160 
1161 my $diff=(-0.5*$TPCWirePlaneLength)+0.5*($NumberCornerVWires)*$VWire_zint;
1162 my $zpos=$zpos-$diff;
1163 
1164 print TPC <<EOF;
1165  <physvol>
1166  <volumeref ref="volTPCWireV$i"/>
1167  <position name="posTPCWireV$i" unit="cm" x="0" y="$ypos " z="$zpos"/>
1168  <rotationref ref="rPlusVAngleAboutX"/>
1169  </physvol>
1170 EOF
1171 
1172 }
1173 
1174 
1175 # Moving upwards to the common wires:
1176  # x and z are zero to center the wires along a vertical axis
1177  # y positioning: Plug wire number into the same corner ypos equation
1178  # rotation: wires in //// direction, so +90deg to bring them to vertical and
1179  # --VAngle counterclockwise to arrive at proper orientation
1180 # Note that the counter maintains wire number in the position name
1181 
1182 for ($i = $NumberCornerVWires; $i < $NumberSideVWires; ++$i)
1183 {
1184 my $ypos = (-0.5*$TPCWirePlaneHeight)-0.5*($NumberCornerVWires)*$VWire_yint+($i+1)*$VWire_yint;
1185 
1186 print TPC <<EOF;
1187  <physvol>
1188  <volumeref ref="volTPCWireVCommon"/>
1189  <position name="posTPCWireV$i" unit="cm" x="0" y="$ypos " z="0"/>
1190  <rotationref ref="rPlusVAngleAboutX"/>
1191  </physvol>
1192 EOF
1193 
1194 }
1195 
1196 
1197 # Finally moving to the corner wires on the top right:
1198  # x=0 to center the wires in the y
1199  # plane positioning: plug wire number into same equation
1200  # z positioning: start at z=0 and go positively at the same z increment
1201  # rotation: same as common wire in code above
1202 # note that the counter maintains wire number shown in the position name
1203 
1204 for ($i = $NumberSideVWires; $i < $NumberSideVWires+$NumberCornerVWires-1; ++$i)
1205 {
1206  # Make a counter to recall the right logical volume reference where the last
1207  # wire in this loop is the smallest, first wire in the logical volume loop, just as in U
1208 
1209 $j = $NumberSideVWires+$NumberCornerVWires - $i - 2;
1210 
1211  # Note that since we are referencing the same logical volumes/same solids for
1212  # the top wires as well as the bottom, the pattern of "stacking" wire on top of wire
1213  # with an incremental separation is likely to cause the top corner wires to be a
1214  # a little shorter than they can be, but never any longer. Just as in U
1215 
1216 my $ypos = (-0.5*$TPCWirePlaneHeight)+0.5*($NumberCornerVWires)*$VWire_yint+($NumberCommonVWires)*$VWire_yint+0.5*($i+1-$NumberSideVWires)*$VWire_yint;
1217 my $zpos = 0.5*($i+1-$NumberSideVWires)*$VWire_zint;
1218 
1219 print TPC <<EOF;
1220  <physvol>
1221  <volumeref ref="volTPCWireV$j"/>
1222  <position name="posTPCWireV$i" unit="cm" x="0" y="$ypos " z="$zpos"/>
1223  <rotationref ref="rPlusVAngleAboutX"/>
1224  </physvol>
1225 EOF
1226 }
1227 
1228 } #ends else
1229 
1230 
1231 
1232 # ++++++++++++++++++++++ X Plane +++++++++++++++++++++++
1233 
1234 # End V plane and create X plane logical volume
1235 print TPC <<EOF;
1236  </volume>
1237 
1238 
1239 
1240 
1241 
1242 
1243 <!--+++++++++++++++++++++ X Plane ++++++++++++++++++++++++-->
1244 
1245 
1246  <volume name="volTPCPlaneX">
1247  <materialref ref="LAr"/>
1248  <solidref ref="TPCPlane"/>
1249 EOF
1250 
1251 if ($wires_on==0)
1252 {
1253 print TPC <<EOF;
1254 
1255  <!-- no wires -->
1256 
1257 EOF
1258 
1259 } else {
1260 
1261 # This is the simplest plane, one loop creates all of the wires
1262  # x and y position at zero to center the wires
1263  # z position: moving from front of detector to back, in the positive z direction,
1264  # starting at (-0.5*$TPCWirePlaneLength), the right side looking from
1265  # the +x direction
1266 
1267 for ($i=0; $i<$NumberVerticalWires; ++$i)
1268 {
1269 
1270  # DocDb-6464 pg. 7 says that the center of the first wire is half of the pitch from the edge
1271 my $zpos = (-0.5*$TPCWirePlaneLength)+$TPCWireThickness/2+$XWirePitch*($i+0.5);
1272 
1273 print TPC <<EOF;
1274  <physvol>
1275  <volumeref ref="volTPCWireVert"/>
1276  <position name="posTPCWireX$i" unit="cm" x="0" y="0 " z="$zpos"/>
1277  <rotationref ref="rPlus90AboutX" />
1278  </physvol>
1279 EOF
1280 
1281 }
1282 
1283 } #ends else
1284 
1285 print TPC <<EOF;
1286  </volume>
1287 EOF
1288 
1289 #+++++++++++++++++++++ Position physical wires Above +++++++++++++++++++++
1290 
1291 #wrap up the TPC file
1292 print TPC <<EOF;
1293  <volume name="volTPC">
1294  <materialref ref="LAr" />
1295  <solidref ref="TPC" />
1296  <physvol>
1297  <volumeref ref="volTPCPlaneU" />
1298  <position name="posTPCPlaneU" unit="cm" x="(-$TPCWidth/2)+3*$APAWirePlaneSpacing" y="0" z="0" />
1299  </physvol>
1300  <physvol>
1301  <volumeref ref="volTPCPlaneV" />
1302  <position name="posTPCPlaneV" unit="cm" x="(-$TPCWidth/2)+2*$APAWirePlaneSpacing" y="0" z="0" />
1303  </physvol>
1304  <physvol>
1305  <volumeref ref="volTPCPlaneX" />
1306  <position name="posTPCPlaneX" unit="cm" x="(-$TPCWidth/2)+$APAWirePlaneSpacing" y="0" z="0" />
1307  </physvol>
1308  <physvol>
1309  <volumeref ref="volTPCActive"/>
1310  <positionref ref="posTPCActive"/>
1311  </physvol>
1312  </volume>
1313 </structure>
1314 </gdml>
1315 EOF
1316 
1317  close(GDML);
1318 
1319 } #end of sub gen_TPC
1320 
1321 
1322 
1323 
1324 
1325 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1326 #++++++++++++++++++++++++++++++++++++++ gen_Cryostat +++++++++++++++++++++++++++++++++++++
1327 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1328 
1329 sub gen_Cryostat()
1330 {
1331 
1332 # Create the cryostat fragment file name,
1333 # add file to list of output GDML fragments,
1334 # and open it
1335  $CRYO = "dune_10kT_Cryostat" . $suffix . ".gdml";
1336  push (@gdmlFiles, $CRYO);
1337  $CRYO = ">" . $CRYO;
1338  open(CRYO) or die("Could not open file $CRYO for writing");
1339 
1340 
1341 # The standard XML prefix and starting the gdml
1342  print CRYO <<EOF;
1343 <?xml version='1.0'?>
1344 <gdml>
1345 EOF
1346 
1347 
1348 # All the cryostat solids.
1349 print CRYO <<EOF;
1350 <solids>
1351  <box name="Cryostat" lunit="cm"
1352  x="$CryostatWidth"
1353  y="$CryostatHeight"
1354  z="$CryostatLength"/>
1355  <box name="ArgonInterior" lunit="cm"
1356  x="$ArgonWidth"
1357  y="$ArgonHeight"
1358  z="$ArgonLength"/>
1359  <box name="GaseousArgon" lunit="cm"
1360  x="$ArgonWidth"
1361  y="$HeightGaseousAr"
1362  z="$ArgonLength"/>
1363  <subtraction name="SteelShell">
1364  <first ref="Cryostat"/>
1365  <second ref="ArgonInterior"/>
1366  </subtraction>
1367 
1368  <box name="Cathode" lunit="cm"
1369  x="$CPAThickness"
1370  y="$TPCHeight"
1371  z="$TPCLength"/>
1372 
1373  <box name="LightPaddle" lunit="cm"
1374  x="$LightPaddleWidth"
1375  y="$LightPaddleHeight"
1376  z="$LightPaddleLength + $SiPM_z"/>
1377 
1378  <box name="APAFrameYSideHollow" lunit="cm"
1379  x="$APAFrameYSide_x-2*$EdgeFrameSteelThickness"
1380  y="$APAFrameYSide_y-2*$EdgeFrameSteelThickness"
1381  z="$APAFrameYSide_z" />
1382  <box name="APAFrameYSideShell" lunit="cm"
1383  x="$APAFrameYSide_x"
1384  y="$APAFrameYSide_y"
1385  z="$APAFrameYSide_z" />
1386  <subtraction name="APAFrameYSide">
1387  <first ref="APAFrameYSideShell" />
1388  <second ref="APAFrameYSideHollow"/>
1389  <positionref ref="posCenter" />
1390  <rotationref ref="rIdentity" />
1391  </subtraction>
1392 
1393  <box name="APAFrameZSideHollow" lunit="cm"
1394  x="$APAFrameZSide_x-2*$EdgeFrameSteelThickness"
1395  y="$APAFrameZSide_y-2*$EdgeFrameSteelThickness"
1396  z="$APAFrameZSide_z" />
1397  <box name="APAFrameZSideShell" lunit="cm"
1398  x="$APAFrameZSide_x"
1399  y="$APAFrameZSide_y"
1400  z="$APAFrameZSide_z" />
1401  <subtraction name="APAFrameZSide">
1402  <first ref="APAFrameZSideShell" />
1403  <second ref="APAFrameZSideHollow"/>
1404  <positionref ref="posCenter" />
1405  <rotationref ref="rIdentity" />
1406  </subtraction>
1407 
1408  <box name="APAFrameYOuterSupport" lunit="cm"
1409  x="$EdgeFrameSteelThickness"
1410  y="$APAFrameYOuterSupport_y"
1411  z="$APAFrameYOuterSupport_z" />
1412 
1413  <box name="APAFrameYInnerSupport" lunit="cm"
1414  x="$APAFrameYInnerSupport_x"
1415  y="$APAFrameYInnerSupport_y"
1416  z="$APAFrameYInnerSupport_z" />
1417 
1418  <box name="APAFrameZHalfSupport" lunit="cm"
1419  x="$APAFrameZHalfSupport_x"
1420  y="$APAFrameZHalfSupport_y"
1421  z="$APAFrameZHalfSupport_z" />
1422 </solids>
1423 EOF
1424 
1425 # Cryostat structure
1426 print CRYO <<EOF;
1427 <structure>
1428  <volume name="volSteelShell">
1429  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1430  <solidref ref="SteelShell" />
1431  </volume>
1432  <volume name="volGaseousArgon">
1433  <materialref ref="ArGas"/>
1434  <solidref ref="GaseousArgon"/>
1435  </volume>
1436 
1437  <volume name="volCathode">
1438  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1439  <solidref ref="Cathode" />
1440  </volume>
1441 
1442  <volume name="volOpDetSensitive">
1443  <materialref ref="Acrylic"/>
1444  <solidref ref="LightPaddle"/>
1445  </volume>
1446 
1447  <volume name="volAPAFrameYSide">
1448  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1449  <solidref ref="APAFrameYSide" />
1450  </volume>
1451 
1452  <volume name="volAPAFrameZSide">
1453  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1454  <solidref ref="APAFrameZSide" />
1455  </volume>
1456 
1457  <volume name="volAPAFrameYOuterSupport">
1458  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1459  <solidref ref="APAFrameYOuterSupport" />
1460  </volume>
1461 
1462  <volume name="volAPAFrameYInnerSupport">
1463  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1464  <solidref ref="APAFrameYInnerSupport" />
1465  </volume>
1466 
1467  <volume name="volAPAFrameZHalfSupport">
1468  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1469  <solidref ref="APAFrameZHalfSupport" />
1470  </volume>
1471 
1472  <volume name="volCryostat">
1473  <materialref ref="LAr" />
1474  <solidref ref="Cryostat" />
1475  <physvol>
1476  <volumeref ref="volGaseousArgon"/>
1477  <position name="posGaseousArgon" unit="cm" x="0" y="$ArgonHeight/2-$HeightGaseousAr/2" z="0"/>
1478  </physvol>
1479  <physvol>
1480  <volumeref ref="volSteelShell"/>
1481  <position name="posSteelShell" unit="cm" x="0" y="0" z="0"/>
1482  </physvol>
1483 EOF
1484 
1485 # nested for loops to place the non-rotated AND rotated volTPC
1486  # x loop rotation: There are six drift volumes. Looking into the
1487  # detector from incident direction, and counting from right (-x) to
1488  # left (+x), odd number volumes need to be rotated 180deg about Y in
1489  # order for the cathode to be on the right of the APA.
1490 
1491 if ($tpc_on==1) {
1492 
1493 
1494  for($k=0 ; $k<$nAPALong ; $k++)
1495  {
1496 
1497  for($i=0 ; $i<$nAPAWide+1 ; $i++)
1498  {
1499 
1500  for($j=0 ; $j<$nAPAHigh ; $j++)
1501  {
1502 
1503 
1504  $CAT_X = - $FiducialWidth/2
1505  + $CPAThickness/2
1506  + $i*($APAWidth);
1507 
1508  $APACenter_x = - $FiducialWidth/2
1509  + $CPAThickness/2
1510  + ($i+0.5)*($APAWidth);
1511 
1512  $APACenter_y = - $ArgonHeight/2 + $SpaceAPAToFloor
1513  + $APAHeight/2
1514  + $j*($APAHeight+$APAVerticalGap);
1515 
1516  $APACenter_z = - $ArgonLength/2
1517  + $UpstreamLArPadding
1518  + $APALength/2
1519  + $k*($APALength+$APALongGap);
1520 
1521 
1522  print CRYO <<EOF;
1523 
1524  <physvol>
1525  <volumeref ref="volCathode" />
1526  <position name="posCathode\-$i\-$j\-$k" unit="cm" x="$CAT_X" y="$APACenter_y" z="$APACenter_z" />
1527  </physvol>
1528 
1529 EOF
1530 
1531  # This if statement is to stop placement of this last set of TPCs/LightPaddles when placing
1532  # the last set of CPAs that do not have any drift volume beyond them in +x
1533 
1534  if ($i<$nAPAWide){
1535 
1536  # place APA volumes around this center: Frame, TPCs, paddles
1537  make_APA($APACenter_x, $APACenter_y, $APACenter_z, $i, $j, $k);
1538 
1539  for ($paddle = 0; $paddle<$nLightPaddlesPerAPA; $paddle++)
1540  {
1541 
1542  # All Light Paddle centers will have the same
1543  # X coordinate as the center of the current APA
1544  # Z coordinate as the current TPC pair
1545  # The Y coordinate must be looped over:
1546 
1547  #the multiplication by j here is a temporary dirty trick to get around some strange behavior
1548 
1549  $Paddle_Y = $APACenter_y
1550  - $APAHeight/2
1551  + $j*$FrameToPaddleSpace
1552  + (1-$j)*($LightPaddleHeight/2 + $APAFrameZSide_y)
1553  + $PaddleYInterval*$paddle;
1554 
1555  print CRYO <<EOF;
1556 
1557  <physvol>
1558  <volumeref ref="volOpDetSensitive"/>
1559  <position name="posPaddle\-$paddle\-TPC\-$i\-$j\-$k" unit="cm" x="$APACenter_x" y="$Paddle_Y" z="$APACenter_z + $SiPM_z/2"/>
1560  <rotationref ref="rIdentity"/>
1561  </physvol>
1562 
1563 EOF
1564 
1565  }#end Paddle for-loop
1566 
1567  }#end if
1568 
1569  } #high
1570  } #wide
1571  } #long
1572 
1573 }# end if tpc
1574 
1575 print CRYO <<EOF;
1576  </volume>
1577 </structure>
1578 </gdml>
1579 EOF
1580 
1581 close(CRYO);
1582 }
1583 
1584 
1585 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1586 #+++++++++++++++++++++++++++++++++++++++ make_APA ++++++++++++++++++++++++++++++++++++++++
1587 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1588 
1589 # Must be called only within gen_Cryostat(),
1590 # with APA center x, y, and z as three arguments
1591 
1592 sub make_APA()
1593 {
1594 
1595  $TPC_X_rot = $_[0] - ($TPCWidth+$APAFrame_x)/2;
1596  $TPC_X = $_[0] + ($TPCWidth+$APAFrame_x)/2;
1597  #for the rotation, remember the wires are on the negative side of volTPC
1598 
1599  print CRYO <<EOF;
1600  <physvol>
1601  <volumeref ref="volAPAFrameYOuterSupport"/>
1602  <position name="posAPAFrameYOuterSupportNeg\-$_[3]\-$_[4]\-$_[5]" unit="cm"
1603  x="$_[0] - ($APAFrameYOuterSupport_x + $APAFrameYInnerSupport_x/2 - $EdgeFrameSteelThickness/2)"
1604  y="$_[1]"
1605  z="$_[2]"/>
1606  <rotationref ref="rIdentity"/>
1607  </physvol>
1608  <physvol>
1609  <volumeref ref="volAPAFrameYOuterSupport"/>
1610  <position name="posAPAFrameYOuterSupportPos\-$_[3]\-$_[4]\-$_[5]" unit="cm"
1611  x="$_[0] + ($APAFrameYOuterSupport_x + $APAFrameYInnerSupport_x/2 - $EdgeFrameSteelThickness/2)"
1612  y="$_[1]"
1613  z="$_[2]"/>
1614  <rotationref ref="rIdentity"/>
1615  </physvol>
1616  <physvol>
1617  <volumeref ref="volAPAFrameYSide"/>
1618  <position name="posAPAFrameYSideNeg\-$_[3]\-$_[4]\-$_[5]" unit="cm"
1619  x="$_[0]"
1620  y="$_[1]"
1621  z="$_[2] - $APALength/2 + $APAFrameYSide_z/2"/>
1622  <rotationref ref="rIdentity"/>
1623  </physvol>
1624  <physvol>
1625  <volumeref ref="volAPAFrameYSide"/>
1626  <position name="posAPAFrameYSidePos\-$_[3]\-$_[4]\-$_[5]" unit="cm"
1627  x="$_[0]"
1628  y="$_[1]"
1629  z="$_[2] + $APALength/2 - $APAFrameYSide_z/2"/>
1630  <rotationref ref="rIdentity"/>
1631  </physvol>
1632  <physvol>
1633  <volumeref ref="volAPAFrameZSide"/>
1634  <position name="posAPAFrameZSidePos\-$_[3]\-$_[4]\-$_[5]" unit="cm"
1635  x="$_[0]"
1636  y="$_[1] + $APAHeight/2 - $APAFrameZSide_y/2"
1637  z="$_[2]"/>
1638  <rotationref ref="rIdentity"/>
1639  </physvol>
1640  <physvol>
1641  <volumeref ref="volAPAFrameZSide"/>
1642  <position name="posAPAFrameZSideNeg\-$_[3]\-$_[4]\-$_[5]" unit="cm"
1643  x="$_[0]"
1644  y="$_[1] - $APAHeight/2 + $APAFrameZSide_y/2"
1645  z="$_[2]"/>
1646  <rotationref ref="rIdentity"/>
1647  </physvol>
1648 
1649  <physvol>
1650  <volumeref ref="volTPC"/>
1651  <position name="posTPCrot\-$_[3]\-$_[4]\-$_[5]" unit="cm" x="$TPC_X_rot" y="$_[1]" z="$_[2]"/>
1652  <rotationref ref="rPlus180AboutY"/>
1653  </physvol>
1654  <physvol>
1655  <volumeref ref="volTPC"/>
1656  <position name="posTPC\-$_[3]\-$_[4]\-$_[5]" unit="cm" x="$TPC_X" y="$_[1]" z="$_[2]"/>
1657  <rotationref ref="rIdentity"/>
1658  </physvol>
1659 EOF
1660 
1661 }
1662 
1663 
1664 
1665 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1666 #+++++++++++++++++++++++++++++++++++++ gen_Enclosure +++++++++++++++++++++++++++++++++++++
1667 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1668 
1669 sub gen_Enclosure()
1670 {
1671 
1672 # Create the detector enclosure fragment file name,
1673 # add file to list of output GDML fragments,
1674 # and open it
1675  $ENCL = "dune_10kT_DetEnclosure" . $suffix . ".gdml";
1676  push (@gdmlFiles, $ENCL);
1677  $ENCL = ">" . $ENCL;
1678  open(ENCL) or die("Could not open file $ENCL for writing");
1679 
1680 
1681 # The standard XML prefix and starting the gdml
1682  print ENCL <<EOF;
1683 <?xml version='1.0'?>
1684 <gdml>
1685 EOF
1686 
1687 
1688 # 34kt differences: The following dimensions and positioning allows
1689 # end to end cryostats, as opposed to side by side in 10kt.
1690 
1691 # The x and z dimensions for ConcreteWall are switched
1692 
1693 
1694 # All the detector enclosure solids.
1695 print ENCL <<EOF;
1696 <solids>
1697 
1698  <box name="FoamPadBlock" lunit="cm"
1699  x="$CryostatWidth+2*$FoamPadding"
1700  y="$CryostatHeight"
1701  z="$CryostatLength+2*$FoamPadding" />
1702 
1703  <subtraction name="FoamPadding">
1704  <first ref="FoamPadBlock"/>
1705  <second ref="Cryostat"/>
1706  <position name="posCryoInFoam" x="0" y="0" z="0"/>
1707  </subtraction>
1708 
1709  <box name="ConcreteWall" lunit="cm"
1710  x="$CryostatWidth+2*$TotalPadding"
1711  y="$CryostatHeight+$ConcretePadding"
1712  z="$ArToAr-2*$FoamPadding"/>
1713 
1714  <box name="DetEnclosure" lunit="cm"
1715  x="$DetEncWidth"
1716  y="$DetEncHeight"
1717  z="$DetEncLength"/>
1718 
1719 </solids>
1720 EOF
1721 
1722 
1723 
1724 # Detector enclosure structure
1725  print ENCL <<EOF;
1726 <structure>
1727  <volume name="volFoamPadding">
1728  <materialref ref="fibrous_glass"/>
1729  <solidref ref="FoamPadding"/>
1730  </volume>
1731 
1732  <volume name="volConcreteWall">
1733  <materialref ref="Concrete"/>
1734  <solidref ref="ConcreteWall"/>
1735  </volume>
1736 
1737  <volume name="volDetEnclosure">
1738  <materialref ref="Concrete"/>
1739  <solidref ref="DetEnclosure"/>
1740  <physvol>
1741  <volumeref ref="volFoamPadding"/>
1742  <position name="posNegFoamCryo" unit="cm"
1743  x="0"
1744  y="$ConcretePadding/2"
1745  z="-$CryostatLength/2-$ArToAr/2-$FoamPadding"/>
1746  </physvol>
1747  <physvol>
1748  <volumeref ref="volCryostat"/>
1749  <position name="posNegCryo" unit="cm"
1750  x="0"
1751  y="$ConcretePadding/2"
1752  z="-$CryostatLength/2-$ArToAr/2-$FoamPadding" />
1753  </physvol>
1754  <physvol>
1755  <volumeref ref="volConcreteWall"/>
1756  <position name="posConcreteWall" unit="cm"
1757  x="0"
1758  y="0"
1759  z="0"/>
1760  </physvol>
1761  <physvol>
1762  <volumeref ref="volFoamPadding"/>
1763  <position name="posPosFoamCryo" unit="cm"
1764  x="0"
1765  y="$ConcretePadding/2"
1766  z="$CryostatLength/2+$ArToAr/2+$FoamPadding"/>
1767  </physvol>
1768  <physvol>
1769  <volumeref ref="volCryostat"/>
1770  <position name="posPosCryo" unit="cm"
1771  x="0"
1772  y="$ConcretePadding/2"
1773  z="$CryostatLength/2+$ArToAr/2+$FoamPadding" />
1774  </physvol>
1775  </volume>
1776 EOF
1777 
1778 print ENCL <<EOF;
1779 </structure>
1780 </gdml>
1781 EOF
1782 
1783 close(ENCL);
1784 }
1785 
1786 # 34kt difference: world volumes such as hillside and service building were
1787 # defined here in their own generate submethods, but 34kt won't have those,
1788 # ind if it does have something similar, we can start with these submethods
1789 # saved in the 10kt script.
1790 
1791 ### TODO: World is just a large volume (> 900x900x900m) containing the detector
1792 ### enclosre positioned such that the world origin is exactly in the place
1793 ### we want it--see OriginYSet, and OrignZSet in the parameters at beginning.
1794 ### The mother material is rock, and there is no air yet. Work on this will
1795 ### come when the time deems it relevant/priority
1796 
1797 
1798 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1799 #+++++++++++++++++++++++++++++++++++++++ gen_World +++++++++++++++++++++++++++++++++++++++
1800 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1801 
1802 sub gen_World()
1803 {
1804 
1805 # Create the WORLD fragment file name,
1806 # add file to list of output GDML fragments,
1807 # and open it
1808  $WORLD = "dune_10kT_World" . $suffix . ".gdml";
1809  push (@gdmlFiles, $WORLD);
1810  $WORLD = ">" . $WORLD;
1811  open(WORLD) or die("Could not open file $WORLD for writing");
1812 
1813 
1814 # The standard XML prefix and starting the gdml
1815  print WORLD <<EOF;
1816 <?xml version='1.0'?>
1817 <gdml>
1818 EOF
1819 
1820 
1821 # All the World solids.
1822 print WORLD <<EOF;
1823 <solids>
1824  <box name="World" lunit="cm"
1825  x="$WorldWidth"
1826  y="$WorldHeight"
1827  z="$WorldLength"/>
1828 </solids>
1829 EOF
1830 
1831 # World structure
1832 print WORLD <<EOF;
1833 <structure>
1834  <volume name="volWorld" >
1835  <materialref ref="DUSEL_Rock"/>
1836  <solidref ref="World"/>
1837  <physvol>
1838  <volumeref ref="volDetEnclosure"/>
1839  <position name="posDetEnclosure" unit="cm" x="0" y="$OriginYSet" z="$OriginZSet"/>
1840  </physvol>
1841  </volume>
1842 </structure>
1843 </gdml>
1844 EOF
1845 
1846 # make_gdml.pl will take care of <setup/>
1847 
1848 close(WORLD);
1849 }
1850 
1851 
1852 
1853 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1854 #++++++++++++++++++++++++++++++++++++ write_fragments ++++++++++++++++++++++++++++++++++++
1855 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1856 
1857 sub write_fragments()
1858 {
1859  # This subroutine creates an XML file that summarizes the the subfiles output
1860  # by the other sub routines - it is the input file for make_gdml.pl which will
1861  # give the final desired GDML file. Specify its name with the output option.
1862  # (you can change the name when running make_gdml)
1863 
1864  # This code is taken straigh from the similar MicroBooNE generate script, Thank you.
1865 
1866  if ( ! defined $output )
1867  {
1868  $output = "-"; # write to STDOUT
1869  }
1870 
1871  # Set up the output file.
1872  $OUTPUT = ">" . $output;
1873  open(OUTPUT) or die("Could not open file $OUTPUT");
1874 
1875  print OUTPUT <<EOF;
1876 <?xml version='1.0'?>
1877 
1878 <!-- Input to Geometry/gdml/make_gdml.pl; define the GDML fragments
1879  that will be zipped together to create a detector description.
1880  -->
1881 
1882 <config>
1883 
1884  <constantfiles>
1885 
1886  <!-- These files contain GDML <constant></constant>
1887  blocks. They are read in separately, so they can be
1888  interpreted into the remaining GDML. See make_gdml.pl for
1889  more information.
1890  -->
1891 
1892 EOF
1893 
1894  foreach $filename (@defFiles)
1895  {
1896  print OUTPUT <<EOF;
1897  <filename> $filename </filename>
1898 EOF
1899  }
1900 
1901  print OUTPUT <<EOF;
1902 
1903  </constantfiles>
1904 
1905  <gdmlfiles>
1906 
1907  <!-- The GDML file fragments to be zipped together. -->
1908 
1909 EOF
1910 
1911  foreach $filename (@gdmlFiles)
1912  {
1913  print OUTPUT <<EOF;
1914  <filename> $filename </filename>
1915 EOF
1916  }
1917 
1918  print OUTPUT <<EOF;
1919 
1920  </gdmlfiles>
1921 
1922 </config>
1923 EOF
1924 
1925  close(OUTPUT);
1926 }