generate_protodunedphase.pl
Go to the documentation of this file.
1 #!/usr/bin/perl
2 
3 ##################################################################################
4 #
5 # This script is based on generate_dunedphase10kt_v2.pl (see description
6 # in there file for more info). Some parameters were changed to generate
7 # a first version of the protodune dual phase geometry (e.g. driftTPCActive
8 # and number of CRM's). The beam window is not included in this version!
9 # For more info, please contact Christoph Alt: christoph.alt@cern.ch
10 #
11 ##################################################################################
12 
13 
14 #use warnings;
15 use gdmlMaterials;
16 use Math::Trig;
17 use Getopt::Long;
18 use Math::BigFloat;
19 Math::BigFloat->precision(-16);
20 
21 GetOptions( "help|h" => \$help,
22  "suffix|s:s" => \$suffix,
23  "output|o:s" => \$output,
24  "wires|w:s" => \$wires,
25  "optical|opt:s" => \$optical);
26 
27 if ( defined $help )
28 {
29  # If the user requested help, print the usage notes and exit.
30  usage();
31  exit;
32 }
33 
34 if ( ! defined $suffix )
35 {
36  # The user didn't supply a suffix, so append nothing to the file
37  # names.
38  $suffix = "";
39 }
40 else
41 {
42  # Otherwise, stick a "-" before the suffix, so that a suffix of
43  # "test" applied to filename.gdml becomes "filename-test.gdml".
44  $suffix = "-" . $suffix;
45 }
46 
47 #if ( ! defined $workspace ) # not done
48 #{
49 # $workspace = 0;
50 #}
51 #elsif ( $workspace == 1)
52 #{
53 # print "\t\tCreating smaller workspace geometry.\n";
54 #}
55 $basename = "protodunedphase";
56 
57 
58 my $pmt_switch="on";
59 my $FieldCage_switch="on";
60 $GroundGrid_switch="off";
61 $Cathode_switch="off";
62 $ExtractionGrid_switch="off";
63 $LEMs_switch="off";
64 
65 if (defined $optical)
66 {
67  if ($optical==1)
68  {
69  $GroundGrid_switch="on";
70  $Cathode_switch="on";
71  $ExtractionGrid_switch="on";
72  $basename = $basename."_optical";
73  $LEMs_switch="on";
74  }
75 }
76 
77 
78 # set wires on to be the default, unless given an input by the user
79 
80 $wires_on = 1; # 1=on, 0=off
81 if (defined $wires)
82 {
83  $wires_on = $wires
84 }
85 
86 $tpc_on = 1;
87 
88 
89 if ( $wires_on == 0 )
90 {
91  $basename = $basename."_nowires";
92 }
93 
94 #if ( $workspace == 1 )
95 #{
96 # $basename = $basename."_workspace";
97 #}
98 
99 
100 ##################################################################
101 ############## Parameters for Charge Readout Plane ###############
102 
103 # dune10kt dual-phase
104 $wirePitch = 0.3125; # channel pitch
105 $nChannelsViewPerCRM = 960; # channels per collection view
106 $borderCRM = 0.5; # dead space at the border of each CRM
107 
108 # dimensions of a single Charge Readout Module (CRM)
109 $widthCRM_active = $wirePitch * $nChannelsViewPerCRM;
110 $lengthCRM_active = $wirePitch * $nChannelsViewPerCRM;
111 
112 $widthCRM = $widthCRM_active + 2 * $borderCRM;
113 $lengthCRM = $lengthCRM_active + 2 * $borderCRM;
114 
115 # number of CRMs in y and z
116 $nCRM_y = 2;
117 $nCRM_z = 2;
118 
119 # calculate tpc area based on number of CRMs and their dimensions
120 $widthTPCActive = $nCRM_y * $widthCRM; # around 600
121 $lengthTPCActive = $nCRM_z * $lengthCRM; # around 600
122 
123 # active volume dimensions
124 $driftTPCActive = 597.0;
125 
126 # model anode strips as wires
127 $padWidth = 0.015;
128 $ReadoutPlane = 2 * $padWidth;
129 
130 #$padHeight = 0.0035;
131 
132 ##################################################################
133 ############## Parameters for TPC and inner volume ###############
134 
135 # inner volume dimensions of the cryostat
136 $Argon_x = 790.0;
137 $Argon_y = 854.8;
138 $Argon_z = 854.8;
139 
140 
141 # width of gas argon layer on top
142 #$HeightGaseousAr = 81.8;
143 $HeightGaseousAr = 51.5;
144 
145 # size of liquid argon buffer
146 $xLArBuffer = $Argon_x - $driftTPCActive - $HeightGaseousAr - $ReadoutPlane;
147 $yLArBuffer = 0.5 * ($Argon_y - $widthTPCActive);
148 $zLArBuffer = 0.5 * ($Argon_z - $lengthTPCActive);
149 
150 # cryostat
151 #$SteelThickness = 0.12; # membrane
152 $SteelThickness = 0.2; # membrane
153 
154 $Cryostat_x = $Argon_x + 2*$SteelThickness;
155 $Cryostat_y = $Argon_y + 2*$SteelThickness;
156 $Cryostat_z = $Argon_z + 2*$SteelThickness;
157 
158 ##################################################################
159 ############## Field Cage Parameters ###############
160 
161 $FieldShaperSizeX = 304.9;
162 $FieldShaperSizeY = 5.999;
163 $FieldShaperSizeZ = 4.603;
164 
165 $FieldCageShaperProfileShift=-4.82;
166 $NFieldShapers = 100.0;
167 $FFSSeparation = 6.0;
168 
169 $FieldCageSizeX = $FieldShaperSizeX+0.2;
170 $FieldCageSizeY = $FieldShaperSizeY+0.2;
171 $FieldCageSizeZ = $NFieldShapers*$FFSSeparation;
172 
173 $FFSPositionX = 277.5;
174 $FFSPositionY = 153.521;
175 $FFSPositionZ = 309.593;
176 
177 
178 ##################################################################
179 ############## Parameters for PMTs ###############
180 
181 #pos in cm inside the cryostat
182  #$pmt_pos_x = -300-(5.5 * 2.54)+5.115; #just below the active volume
183  #$pmt_pos_x = -300-(5.5 * 2.54)+5.115 + 22 -141.5; just on the top of the cryostat (new version)
184  ##$pmt_pos_x = -300 + 5.115 - 1.27*2.54 + 22 -107.8; #8.4cm from the bottom volTPCActive
185  $HeightPMT = 37.0;
186 
187  # $pmt_pos_x = -$Argon_x/2 - 0.5*($HeightPMT);
188 
189 #pmts not equally spaced:
190  @pmt_pos = ( ' y="-238" z="-170" ', #pmt1
191  ' y="-238" z="-34" ', #pmt2
192  ' y="-238" z="34" ', #pmt3
193  ' y="-238" z="170" ', #pmt4
194  ' y="-170" z="-238" ', #pmt5
195  ' y="-170" z="-102" ', #pmt6
196  ' y="-170" z="102" ', #pmt7
197  ' y="-170" z="238" ', #pmt8
198  ' y="-102" z="-170" ', #pmt9
199  ' y="-102" z="-34" ', #pmt10
200  ' y="-102" z="34" ', #pmt11
201  ' y="-102" z="170" ', #pmt12
202  ' y="-34" z="-238" ', #pmt13
203  ' y="-34" z="-102" ', #pmt14
204  ' y="-34" z="-34" ', #pmt15
205  ' y="-34" z="34" ', #pmt16
206  ' y="-34" z="102" ', #pmt17
207  ' y="-34" z="238" ', #pmt18
208  ' y="34" z="-238" ', #pmt19
209  ' y="34" z="-102" ', #pmt20
210  ' y="34" z="-34" ', #pmt21
211  ' y="34" z="34" ', #pmt22
212  ' y="34" z="102" ', #pmt23
213  ' y="34" z="238" ', #pmt24
214  ' y="102" z="-170" ', #pmt25
215  ' y="102" z="-34" ', #pmt26
216  ' y="102" z="34" ', #pmt27
217  ' y="102" z="170" ', #pmt28
218  ' y="170" z="-238" ', #pmt29
219  ' y="170" z="-102" ', #pmt30
220  ' y="170" z="102" ', #pmt31
221  ' y="170" z="238" ', #pmt32
222  ' y="238" z="-170" ', #pmt33
223  ' y="238" z="-34" ', #pmt34
224  ' y="238" z="34" ', #pmt35
225  ' y="238" z="170" '); #PMT36
226 
227 #pmts equally spaced:
228 # @pmt_pos = ( ' y="-162.5" z="-162.5"', #PMT1
229 # ' y="-162.5" z="-97.5"', #PMT2
230 # ' y="-162.5" z="-32.5"', #PMT3
231 # ' y="-162.5" z="32.5"', #PMT4
232 # ' y="-162.5" z="97.5"', #PMT5
233 # ' y="-162.5" z="162.5"', #PMT6
234 # ' y="-97.5" z="-162.5"', #PMT7
235 # ' y="-97.5" z="-97.5"', #PMT8
236 # ' y="-97.5" z="-32.5"', #PMT9
237 # ' y="-97.5" z="32.5"', #PMT10#
238 # ' y="-97.5" z="97.5"', #PMT11
239 # ' y="-97.5" z="162.5"', #PMT12
240 # ' y="-32.5" z="-162.5"', #PMT13
241 # ' y="-32.5" z="-97.5"', #PMT14
242 # ' y="-32.5" z="-32.5"', #PMT15
243 # ' y="-32.5" z="32.5"', #PMT16
244 # ' y="-32.5" z="97.5"', #PMT17
245 # ' y="-32.5" z="162.5"', #PMT18
246 # ' y="32.5" z="-162.5"', #PMT19
247 # ' y="32.5" z="-97.5"', #PMT20
248 # ' y="32.5" z="-32.5"', #PMT21
249 # ' y="32.5" z="32.5"', #PMT22
250 # ' y="32.5" z="97.5"', #PMT23
251 # ' y="32.5" z="162.5"', #PMT24
252 # ' y="97.5" z="-162.5"', #PMT25
253 # ' y="97.5" z="-97.5"', #PMT26
254 # ' y="97.5" z="-32.5"', #PMT27
255 # ' y="97.5" z="32.5"', #PMT27
256 # ' y="97.5" z="97.5"', #PMT29
257 # ' y="97.5" z="162.5"', #PMT30
258 # ' y="162.5" z="-162.5"', #PMT31
259 # ' y="162.5" z="-97.5"', #PMT32
260 # ' y="162.5" z="-32.5"', #PMT33
261 # ' y="162.5" z="32.5"', #PMT34
262 # ' y="162.5" z="97.5"', #PMT35
263 # ' y="162.5" z="162.5"'); #PMT36
264 
265 ##################################################################
266 ############## DetEnc and World relevant parameters #############
267 
268 $SteelSupport_x = 1;
269 $SteelSupport_y = 1;
270 $SteelSupport_z = 1;
271 $FoamPadding = 80;
272 
273 $FracMassOfSteel = 0.5; #The steel support is not a solid block, but a mixture of air and steel
274 $FracMassOfAir = 1 - $FracMassOfSteel;
275 
276 
277 $SpaceSteelSupportToWall = 200;
278 $SpaceSteelSupportToCeiling = 200;
279 
280 $DetEncWidth = $Cryostat_x
281  + 2*($SteelSupport_x + $FoamPadding) + 2*$SpaceSteelSupportToWall;
282 $DetEncHeight = $Cryostat_y
283  + 2*($SteelSupport_y + $FoamPadding) + $SpaceSteelSupportToCeiling;
284 $DetEncLength = $Cryostat_z
285  + 2*($SteelSupport_z + $FoamPadding) + 2*$SpaceSteelSupportToWall;
286 
287 $posCryoInDetEnc_y = 0;
288 $posCryoInDetEnc_y2 = - $DetEncHeight/2 + $SteelSupport_y + $FoamPadding + $Cryostat_y/2;
289 
290 $posTopSteelStruct = $Argon_x/2+$FoamPadding+$SteelSupport_x;
291 $posBotSteelStruct = -$Argon_x/2-$FoamPadding-$SteelSupport_x;
292 $posZBackSteelStruct = $Argon_z/2+$FoamPadding+$SteelSupport_z;
293 $posZFrontSteelStruct = -$Argon_z/2-$FoamPadding-$SteelSupport_z;
294 $posLeftSteelStruct = -$Argon_y/2-$FoamPadding-$SteelSupport_y;
295 $posRightSteelStruct = $Argon_y/2+$FoamPadding+$SteelSupport_y;
296 
297 $RockThickness = 3000;
298 
299  # We want the world origin to be at the very front of the fiducial volume.
300  # move it to the front of the enclosure, then back it up through the concrete/foam,
301  # then through the Cryostat shell, then through the upstream dead LAr (including the
302  # dead LAr on the edge of the TPC)
303  # This is to be added to the z position of every volume in volWorld
304 
305 $OriginZSet = $DetEncLength/2.0
306  - $SpaceSteelSupportToWall
307  - $SteelSupport_z
308  - $FoamPadding
309  - $SteelThickness
310  - $zLArBuffer
311  - $borderCRM;
312 
313  # We want the world origin to be vertically centered on active TPC
314  # This is to be added to the y position of every volume in volWorld
315 
316 $OriginYSet = $DetEncHeight/2.0
317  - $SteelSupport_y
318  - $FoamPadding
319  - $SteelThickness
320  - $yLArBuffer
321  - $widthTPCActive/2.0
322  + $posCryoInDetEnc_y2;
323 
324 $OriginXSet = $DetEncWidth/2.0
325  -$SpaceSteelSupportToWall
326  -$SteelSupport_x
327  -$FoamPadding
328  -$SteelThickenss
329  -$xLArBuffer
330  -$driftTPCActive/2.0;
331 
332 
333 ##################################################################
334 ############### Parameters for det elements ######################
335 
336 # cathode plane
337 #$Cathode_x = $widthTPCActive;
338 #$Cathode_y = 1.0;
339 #$Cathode_z = $lengthTPCActive;
340 
341 
342 
343 #+++++++++++++++++++++++++ End defining variables ++++++++++++++++++++++++++
344 
345 
346 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
347 #+++++++++++++++++++++++++++++++++++++++++ usage +++++++++++++++++++++++++++++++++++++++++
348 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
349 
350 sub usage()
351 {
352  print "Usage: $0 [-h|--help] [-o|--output <fragments-file>] [-s|--suffix <string>]\n";
353  print " if -o is omitted, output goes to STDOUT; <fragments-file> is input to make_gdml.pl\n";
354  print " -s <string> appends the string to the file names; useful for multiple detector versions\n";
355  print " -h prints this message, then quits\n";
356 }
357 
358 
359 
360 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
361 #++++++++++++++++++++++++++++++++++++++ gen_Define +++++++++++++++++++++++++++++++++++++++
362 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
363 
364 sub gen_Define()
365 {
366 
367 # Create the <define> fragment file name,
368 # add file to list of fragments,
369 # and open it
370  $DEF = $basename."_Def" . $suffix . ".gdml";
371  push (@gdmlFiles, $DEF);
372  $DEF = ">" . $DEF;
373  open(DEF) or die("Could not open file $DEF for writing");
374 
375 
376 print DEF <<EOF;
377 <?xml version='1.0'?>
378 <gdml>
379 <define>
380 
381 <!--
382 
383 
384 
385 -->
386 
387  <position name="posCryoInDetEnc" unit="cm" x="0" y="$posCryoInDetEnc_y" z="0"/>
388  <position name="posCenter" unit="cm" x="0" y="0" z="0"/>
389  <rotation name="rPlus90AboutX" unit="deg" x="90" y="0" z="0"/>
390  <rotation name="rMinus90AboutX" unit="deg" x="270" y="0" z="0"/>
391 
392  <rotation name="rMinus90AboutYMinus90AboutX" unit="deg" x="270" y="270" z="0"/>
393  <rotation name="rPlus180AboutXPlus180AboutY" unit="deg" x="180" y="180" z="0"/>
394  <rotation name="rIdentity" unit="deg" x="0" y="0" z="0"/>
395 
396  <rotation name="rPlus180AboutX" unit="deg" x="180" y="0" z="0"/>
397  <rotation name="rPlus180AboutY" unit="deg" x="0" y="180" z="0"/>
398  <rotation name="rPlus180AboutZ" unit="deg" x="0" y="0" z="180"/>
399 
400  <rotation name="rPlus90AboutY" unit="deg" x="0" y="90" z="0"/>
401  <rotation name="rMinus90AboutY" unit="deg" x="0" y="270" z="0"/>
402 
403 
404  <rotation name="rot04" unit="deg" x="0" y="270" z="90"/>
405  <rotation name="rot07" unit="deg" x="0" y="90" z="90"/>
406 
407  <rotation name="rot03" unit="deg" x="0" y="90" z="270"/>
408  <rotation name="rot08" unit="deg" x="0" y="270" z="270"/>
409 
410  <rotation name="rot06" unit="deg" x="180" y="270" z="0"/>
411  <rotation name="rot05" unit="deg" x="180" y="90" z="0"/>
412 
413  <rotation name="rPlus90AboutZ" unit="deg" x="0" y="0" z="90"/>
414  <rotation name="rMinus90AboutZ" unit="deg" x="0" y="0" z="270"/>
415 
416 
417  <rotation name="rBeamW3" unit="deg" x="0" y="-16.1824077173347" z="43.7252002244654"/>
418 
419 
420 
421 EOF
422 
423 print DEF <<EOF;
424 </define>
425 </gdml>
426 EOF
427  close (DEF);
428 }
429 
430 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
431 #+++++++++++++++++++++++++++++++++++++ gen_Materials +++++++++++++++++++++++++++++++++++++
432 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
433 
434 sub gen_Materials()
435 {
436 
437 # Create the <materials> fragment file name,
438 # add file to list of output GDML fragments,
439 # and open it
440  $MAT = $basename."_Materials" . $suffix . ".gdml";
441  push (@gdmlFiles, $MAT);
442  $MAT = ">" . $MAT;
443 
444  open(MAT) or die("Could not open file $MAT for writing");
445 
446  # Add any materials special to this geometry by defining a mulitline string
447  # and passing it to the gdmlMaterials::gen_Materials() function.
448 my $asmix = <<EOF;
449  <!-- preliminary values -->
450  <material name="AirSteelMixture" formula="AirSteelMixture">
451  <D value=" @{[0.001205*(1-$FracMassOfSteel) + 7.9300*$FracMassOfSteel]} " unit="g/cm3"/>
452  <fraction n="$FracMassOfSteel" ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
453  <fraction n="$FracMassOfAir" ref="Air"/>
454  </material>
455 EOF
456 
457  # add the general materials used anywere
458  print MAT gdmlMaterials::gen_Materials( $asmix );
459 
460  close(MAT);
461 }
462 
463 
464 
465 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
466 #++++++++++++++++++++++++++++++++++++++ gen_ExtractionGrid +++++++++++++++++++++++++++++++++++
467 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
468 
469 sub gen_ExtractionGrid {
470 
471  $ExtractionGrid = $basename."_ExtractionGrid" . $suffix . ".gdml";
472  push (@gdmlFiles, $ExtractionGrid);
473  $ExtractionGrid = ">" . $ExtractionGrid;
474  open(ExtractionGrid) or die("Could not open file $ExtractionGrid for writing");
475 
476 # The standard XML prefix and starting the gdml
477 print ExtractionGrid <<EOF;
478 <?xml version='1.0'?>
479 <gdml>
480 EOF
481 
482 #GroundGrid SOLIDS
483 $ExtractionGridRadious = 0.05;
484 $ExtractionGridPitch = 0.3;
485 
486 $ExtractionGridSizeX = 2*$ExtractionGridRadious;
487 
488 $ExtractionGridSizeY = $widthCRM_active;
489 $ExtractionGridSizeZ = $lengthCRM_active;
490 
491 print ExtractionGrid <<EOF;
492 
493 <solids>
494  <tube name="solExtractionGridCable" rmin="0" rmax="$ExtractionGridRadious" z="$ExtractionGridSizeZ" deltaphi="360" startphi="0" aunit="deg" lunit="cm"/>
495  <box name="solExtractionGrid" x="@{[$ExtractionGridSizeX]}" y="$ExtractionGridSizeY" z="@{[$ExtractionGridSizeZ]}" lunit="cm"/>
496 </solids>
497 
498 EOF
499 
500 
501 print ExtractionGrid <<EOF;
502 
503 <structure>
504 
505 <volume name="volExtractionGridCable">
506  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
507  <solidref ref="solExtractionGridCable"/>
508 </volume>
509 
510 <volume name="volExtractionGrid">
511  <materialref ref="LAr"/>
512  <solidref ref="solExtractionGrid"/>
513 EOF
514 
515 for($ii=0;$ii<$ExtractionGridSizeY;$ii=$ii+$ExtractionGridPitch)
516 {
517  print ExtractionGrid <<EOF;
518  <physvol>
519  <volumeref ref="volExtractionGridCable"/>
520  <position name="posExtractionGridCable$ii" unit="cm" x="0" y="@{[$ii-0.5*$ExtractionGridSizeY]}" z="0"/>
521  <rotation name="GGrot$aux2" unit="deg" x="0" y="90" z="0" />
522  </physvol>
523 EOF
524 
525 }
526 
527 for($jj=0;$jj<$ExtractionGridSizeZ;$jj=$jj+$ExtractionGridPitch)
528 {
529  print ExtractionGrid <<EOF;
530  <physvol>
531  <volumeref ref="volExtractionGridCable"/>
532  <position name="posExtractionGridCableLat$jj" unit="cm" x="0" y="0" z="@{[$jj-0.5*$ExtractionGridSizeZ]}"/>
533  <rotation name="GGrot$aux2" unit="deg" x="90" y="0" z="0" />
534  </physvol>
535 EOF
536 
537 }
538 
539  print ExtractionGrid <<EOF;
540 
541  </volume>
542 </structure>
543 </gdml>
544 EOF
545 close(ExtractionGrid);
546 }
547 
548 
549 
550 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
551 #++++++++++++++++++++++++++++++++++++++++ gen_TPC ++++++++++++++++++++++++++++++++++++++++
552 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
553 sub gen_TPC()
554 {
555  # CRM active volume
556  my $TPCActive_x = $driftTPCActive;
557  my $TPCActive_y = $widthCRM_active;
558  my $TPCActive_z = $lengthCRM_active;
559 
560  # CRM total volume
561  my $TPC_x = $TPCActive_x + $ReadoutPlane;
562  my $TPC_y = $widthCRM;
563  my $TPC_z = $lengthCRM;
564 
565 
566  $TPC = $basename."_TPC" . $suffix . ".gdml";
567  push (@gdmlFiles, $TPC);
568  $TPC = ">" . $TPC;
569  open(TPC) or die("Could not open file $TPC for writing");
570 
571 # The standard XML prefix and starting the gdml
572  print TPC <<EOF;
573 <?xml version='1.0'?>
574 <gdml>
575 EOF
576 
577 
578  # All the TPC solids save the wires.
579  print TPC <<EOF;
580 <solids>
581  <box name="CRM" lunit="cm"
582  x="$TPC_x"
583  y="$TPC_y"
584  z="$TPC_z"/>
585  <box name="CRMVPlane" lunit="cm"
586  x="$padWidth"
587  y="$TPCActive_y"
588  z="$TPCActive_z"/>
589  <box name="CRMZPlane" lunit="cm"
590  x="$padWidth"
591  y="$TPCActive_y"
592  z="$TPCActive_z"/>
593  <box name="CRMActive" lunit="cm"
594  x="$TPCActive_x"
595  y="$TPCActive_y"
596  z="$TPCActive_z"/>
597 EOF
598 
599 
600 #++++++++++++++++++++++++++++ Wire Solids ++++++++++++++++++++++++++++++
601 # in principle we only need only one wire solid, since CRM is a square
602 # but to be more general ...
603 
604 print TPC <<EOF;
605 
606  <tube name="CRMWireV"
607  rmax="@{[0.5*$padWidth]}"
608  z="$TPCActive_z"
609  deltaphi="360"
610  aunit="deg"
611  lunit="cm"/>
612  <tube name="CRMWireZ"
613  rmax="@{[0.5*$padWidth]}"
614  z="$TPCActive_y"
615  deltaphi="360"
616  aunit="deg"
617  lunit="cm"/>
618 </solids>
619 
620 EOF
621 
622 
623 # Begin structure and create wire logical volumes
624 print TPC <<EOF;
625 <structure>
626 
627  <volume name="volTPCActive">
628  <materialref ref="LAr"/>
629  <solidref ref="CRMActive"/>
630  </volume>
631 EOF
632 
633 if ($wires_on==1)
634 {
635  print TPC <<EOF;
636  <volume name="volTPCWireV">
637  <materialref ref="Copper_Beryllium_alloy25"/>
638  <solidref ref="CRMWireV"/>
639  </volume>
640 
641  <volume name="volTPCWireZ">
642  <materialref ref="Copper_Beryllium_alloy25"/>
643  <solidref ref="CRMWireZ"/>
644  </volume>
645 EOF
646 }
647 
648 print TPC <<EOF;
649 
650  <volume name="volTPCPlaneV">
651  <materialref ref="LAr"/>
652  <solidref ref="CRMVPlane"/>
653 EOF
654 
655 if ($wires_on==1) # add wires to Z plane
656 {
657 for($i=0;$i<$nChannelsViewPerCRM;++$i)
658 {
659 my $ypos = -0.5 * $TPCActive_y + ($i+0.5)*$wirePitch + 0.5*$padWidth;
660 
661 print TPC <<EOF;
662  <physvol>
663  <volumeref ref="volTPCWireV"/>
664  <position name="posWireV$i" unit="cm" x="0" y="$ypos" z="0"/>
665  <rotationref ref="rIdentity"/>
666  </physvol>
667 EOF
668 }
669 }
670 
671 print TPC <<EOF;
672  </volume>
673 
674  <volume name="volTPCPlaneZ">
675  <materialref ref="LAr"/>
676  <solidref ref="CRMZPlane"/>
677 EOF
678 
679 
680 if ($wires_on==1) # add wires to X plane
681 {
682 for($i=0;$i<$nChannelsViewPerCRM;++$i)
683 {
684 
685 my $zpos = -0.5 * $TPCActive_z + ($i+0.5)*$wirePitch + 0.5*$padWidth;
686 print TPC <<EOF;
687  <physvol>
688  <volumeref ref="volTPCWireZ"/>
689  <position name="posWireZ$i" unit="cm" x="0" y="0" z="$zpos"/>
690  <rotationref ref="rPlus90AboutX"/>
691  </physvol>
692 EOF
693 }
694 }
695 
696 
697 print TPC <<EOF;
698  </volume>
699 EOF
700 
701 
702 $posVplane[0] = 0.5*$TPC_x - 1.5*$padWidth;
703 $posVplane[1] = 0;
704 $posVplane[2] = 0;
705 
706 $posZplane[0] = 0.5*$TPC_x - 0.5*$padWidth;
707 $posZplane[1] = 0;
708 $posZplane[2] = 0;
709 
710 $posTPCActive[0] = -$ReadoutPlane;
711 $posTPCActive[1] = 0;
712 $posTPCActive[2] = 0;
713 
714 $ExtractionGridX = 0.5*$Argon_x-$HeightGaseousAr-0.5-0.5*$ExtractionGridSizeX;
715 $ExtractionGridY = 0;
716 $ExtractionGridZ = 0;
717 
718 $ExtractionGridX = 0.5*$TPC_x-0.5-0.5*$ExtractionGridSizeX;
719 $ExtractionGridY = 0;
720 $ExtractionGridZ = 0;
721 
722 #wrap up the TPC file
723 print TPC <<EOF;
724 
725  <volume name="volTPC">
726  <materialref ref="LAr"/>
727  <solidref ref="CRM"/>
728  <physvol>
729  <volumeref ref="volTPCPlaneV"/>
730  <position name="posPlaneV" unit="cm"
731  x="$posVplane[0]" y="$posVplane[1]" z="$posVplane[2]"/>
732  <rotationref ref="rIdentity"/>
733  </physvol>
734  <physvol>
735  <volumeref ref="volTPCPlaneZ"/>
736  <position name="posPlaneZ" unit="cm"
737  x="$posZplane[0]" y="$posZplane[1]" z="$posZplane[2]"/>
738  <rotationref ref="rIdentity"/>
739  </physvol>
740  <physvol>
741  <volumeref ref="volTPCActive"/>
742  <position name="posActive" unit="cm"
743  x="$posTPCActive[0]" y="$posTPCActive[1]" z="$posTPCActive[2]"/>
744  <rotationref ref="rIdentity"/>
745  </physvol>
746 EOF
747 
748  if ( $ExtractionGrid_switch eq "on" )
749  {
750 
751  print TPC <<EOF;
752  <physvol>
753  <volumeref ref="volExtractionGrid"/>
754  <position name="posExtractionGrid" unit="cm" x="$ExtractionGridX" y="$ExtractionGridY" z="$ExtractionGridZ"/>
755  </physvol>
756 EOF
757 
758  }
759 
760 print TPC <<EOF;
761  </volume>
762 EOF
763 
764 
765 print TPC <<EOF;
766 </structure>
767 </gdml>
768 EOF
769 
770 close(TPC);
771 }
772 
773 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
774 #++++++++++++++++++++++++++++++++++++++ gen_FieldCage +++++++++++++++++++++++++++++++++++++
775 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
776 
777 sub gen_FieldCage {
778 
779 
780 #FieldCage
781 
782 
783  $FieldCage = $basename."_FieldCage" . $suffix . ".gdml";
784  push (@gdmlFiles, $FieldCage);
785  $FieldCage = ">" . $FieldCage;
786  open(FieldCage) or die("Could not open file $FieldCage for writing");
787 
788 # Create the <define> fragment file name,
789 # add file to list of fragments,
790 # and open it
791 
792 
793 
794 
795 # The standard XML prefix and starting the gdml
796 print FieldCage <<EOF;
797  <?xml version='1.0'?>
798  <gdml>
799 EOF
800 # The printing solids used in the Field Cage
801 print FieldCage <<EOF;
802 
803  <solids>
804 
805  <xtru name="FIELD_SHAPER-SOL" lunit="mm">
806  <twoDimVertex x="3.174889" y="4.182078"/>
807  <twoDimVertex x="3.287192" y="4.163508"/>
808  <twoDimVertex x="3.392385" y="4.120019"/>
809  <twoDimVertex x="3.485016" y="4.053866"/>
810  <twoDimVertex x="3.560284" y="3.968476"/>
811  <twoDimVertex x="3.614289" y="3.868273"/>
812  <twoDimVertex x="3.640993" y="3.777188"/>
813  <twoDimVertex x="3.650003" y="3.682696"/>
814  <twoDimVertex x="3.650003" y="0.765841000000002"/>
815  <twoDimVertex x="3.635299" y="0.645475999999999"/>
816  <twoDimVertex x="3.59205" y="0.532188999999999"/>
817  <twoDimVertex x="3.522803" y="0.432644"/>
818  <twoDimVertex x="3.431628" y="0.352698"/>
819  <twoDimVertex x="3.323888" y="0.297053000000002"/>
820  <twoDimVertex x="3.226003" y="0.271650999999999"/>
821  <twoDimVertex x="3.125008" y="0.266466999999999"/>
822  <twoDimVertex x="3.044094" y="0.263959"/>
823  <twoDimVertex x="2.964646" y="0.248422999999999"/>
824  <twoDimVertex x="2.852753" y="0.201684"/>
825  <twoDimVertex x="2.755402" y="0.129382"/>
826  <twoDimVertex x="2.67832" y="0.0357690000000019"/>
827  <twoDimVertex x="2.626041" y="-0.0736460000000001"/>
828  <twoDimVertex x="2.60164" y="-0.192428"/>
829  <twoDimVertex x="2.606552" y="-0.313592"/>
830  <twoDimVertex x="2.640488" y="-0.430011"/>
831  <twoDimVertex x="2.701452" y="-0.534835000000001"/>
832  <twoDimVertex x="2.785858" y="-0.6219"/>
833  <twoDimVertex x="2.888742" y="-0.686086"/>
834  <twoDimVertex x="3.004052" y="-0.723614999999999"/>
835  <twoDimVertex x="3.125005" y="-0.732282000000001"/>
836  <twoDimVertex x="3.245956" y="-0.740949000000001"/>
837  <twoDimVertex x="3.361264" y="-0.778479999999998"/>
838  <twoDimVertex x="3.464146" y="-0.842666000000001"/>
839  <twoDimVertex x="3.548551" y="-0.929731"/>
840  <twoDimVertex x="3.609514" y="-1.034553"/>
841  <twoDimVertex x="3.639776" y="-1.131048"/>
842  <twoDimVertex x="3.650003" y="-1.231656"/>
843  <twoDimVertex x="3.650003" y="-4.051359"/>
844  <twoDimVertex x="3.636188" y="-4.168081"/>
845  <twoDimVertex x="3.595506" y="-4.278353"/>
846  <twoDimVertex x="3.530206" y="-4.376082"/>
847  <twoDimVertex x="3.443895" y="-4.455866"/>
848  <twoDimVertex x="3.341345" y="-4.513298"/>
849  <twoDimVertex x="3.247548" y="-4.54175"/>
850  <twoDimVertex x="3.150003" y="-4.551358"/>
851  <twoDimVertex x="2.599999" y="-4.551358"/>
852  <twoDimVertex x="2.521782" y="-4.557514"/>
853  <twoDimVertex x="2.44549" y="-4.57583"/>
854  <twoDimVertex x="2.338749" y="-4.625038"/>
855  <twoDimVertex x="2.246446" y="-4.697805"/>
856  <twoDimVertex x="2.173679" y="-4.790109"/>
857  <twoDimVertex x="2.124471" y="-4.89685"/>
858  <twoDimVertex x="2.10154" y="-5.012128"/>
859  <twoDimVertex x="2.106155" y="-5.129575"/>
860  <twoDimVertex x="2.138059" y="-5.2427"/>
861  <twoDimVertex x="2.19549" y="-5.345251"/>
862  <twoDimVertex x="2.275275" y="-5.431561"/>
863  <twoDimVertex x="2.373003" y="-5.496861"/>
864  <twoDimVertex x="2.483276" y="-5.537543"/>
865  <twoDimVertex x="2.599999" y="-5.551358"/>
866  <twoDimVertex x="4.449998" y="-5.551358"/>
867  <twoDimVertex x="4.547543" y="-5.54175"/>
868  <twoDimVertex x="4.64134" y="-5.513298"/>
869  <twoDimVertex x="4.743891" y="-5.455866"/>
870  <twoDimVertex x="4.830201" y="-5.376082"/>
871  <twoDimVertex x="4.895501" y="-5.278353"/>
872  <twoDimVertex x="4.936183" y="-5.168081"/>
873  <twoDimVertex x="4.949998" y="-5.051358"/>
874  <twoDimVertex x="4.949998" y="3.827153"/>
875  <twoDimVertex x="4.965356" y="3.950123"/>
876  <twoDimVertex x="5.010485" y="4.065541"/>
877  <twoDimVertex x="5.082615" y="4.166314"/>
878  <twoDimVertex x="5.177314" y="4.246251"/>
879  <twoDimVertex x="5.288764" y="4.300442"/>
880  <twoDimVertex x="5.389517" y="4.323481"/>
881  <twoDimVertex x="5.492853" y="4.325318"/>
882  <twoDimVertex x="9.961787" y="3.782179"/>
883  <twoDimVertex x="13.85859" y="2.875176"/>
884  <twoDimVertex x="17.583122" y="1.413806"/>
885  <twoDimVertex x="21.056972" y="-0.571162999999999"/>
886  <twoDimVertex x="21.410387" y="-0.867622000000001"/>
887  <twoDimVertex x="21.693333" y="-1.231946"/>
888  <twoDimVertex x="21.893082" y="-1.647748"/>
889  <twoDimVertex x="22.000649" y="-2.096324"/>
890  <twoDimVertex x="22.011195" y="-2.557496"/>
891  <twoDimVertex x="21.924246" y="-3.01052"/>
892  <twoDimVertex x="21.743713" y="-3.435018"/>
893  <twoDimVertex x="21.477717" y="-3.811897"/>
894  <twoDimVertex x="21.138223" y="-4.124202"/>
895  <twoDimVertex x="20.740501" y="-4.357886"/>
896  <twoDimVertex x="20.302442" y="-4.502438"/>
897  <twoDimVertex x="19.84375" y="-4.551358"/>
898  <twoDimVertex x="14.900003" y="-4.551358"/>
899  <twoDimVertex x="14.821786" y="-4.557514"/>
900  <twoDimVertex x="14.745494" y="-4.57583"/>
901  <twoDimVertex x="14.638754" y="-4.625038"/>
902  <twoDimVertex x="14.54645" y="-4.697805"/>
903  <twoDimVertex x="14.473683" y="-4.790109"/>
904  <twoDimVertex x="14.424475" y="-4.89685"/>
905  <twoDimVertex x="14.401544" y="-5.012128"/>
906  <twoDimVertex x="14.406159" y="-5.129575"/>
907  <twoDimVertex x="14.438063" y="-5.2427"/>
908  <twoDimVertex x="14.495494" y="-5.345251"/>
909  <twoDimVertex x="14.575279" y="-5.431561"/>
910  <twoDimVertex x="14.673007" y="-5.496862"/>
911  <twoDimVertex x="14.78328" y="-5.537543"/>
912  <twoDimVertex x="14.900003" y="-5.551358"/>
913  <twoDimVertex x="19.843727" y="-5.551355"/>
914  <twoDimVertex x="20.513314" y="-5.479951"/>
915  <twoDimVertex x="21.152782" y="-5.268942"/>
916  <twoDimVertex x="21.733367" y="-4.927821"/>
917  <twoDimVertex x="22.228955" y="-4.471929"/>
918  <twoDimVertex x="22.617251" y="-3.921775"/>
919  <twoDimVertex x="22.880791" y="-3.302104"/>
920  <twoDimVertex x="23.007719" y="-2.640792"/>
921  <twoDimVertex x="22.992327" y="-1.967586"/>
922  <twoDimVertex x="22.835306" y="-1.312766"/>
923  <twoDimVertex x="22.543721" y="-0.705788999999999"/>
924  <twoDimVertex x="22.130685" y="-0.173957000000001"/>
925  <twoDimVertex x="21.614779" y="0.258807000000001"/>
926  <twoDimVertex x="18.014949" y="2.315762"/>
927  <twoDimVertex x="14.155346" y="3.830128"/>
928  <twoDimVertex x="10.117223" y="4.770024"/>
929  <twoDimVertex x="4.51123" y="5.404618"/>
930  <twoDimVertex x="-1.128658" y="5.551358"/>
931  <twoDimVertex x="-10.117225" y="4.770024"/>
932  <twoDimVertex x="-14.155346" y="3.830128"/>
933  <twoDimVertex x="-18.014946" y="2.315762"/>
934  <twoDimVertex x="-21.614774" y="0.258808999999999"/>
935  <twoDimVertex x="-22.130682" y="-0.173954999999999"/>
936  <twoDimVertex x="-22.543718" y="-0.705787000000001"/>
937  <twoDimVertex x="-22.835302" y="-1.312765"/>
938  <twoDimVertex x="-22.992326" y="-1.967584"/>
939  <twoDimVertex x="-23.007719" y="-2.64079"/>
940  <twoDimVertex x="-22.880788" y="-3.302103"/>
941  <twoDimVertex x="-22.61725" y="-3.921773"/>
942  <twoDimVertex x="-22.228952" y="-4.471928"/>
943  <twoDimVertex x="-21.733366" y="-4.92782"/>
944  <twoDimVertex x="-21.15278" y="-5.268942"/>
945  <twoDimVertex x="-20.513313" y="-5.479951"/>
946  <twoDimVertex x="-19.843727" y="-5.551358"/>
947  <twoDimVertex x="-14.900001" y="-5.551358"/>
948  <twoDimVertex x="-14.821785" y="-5.545203"/>
949  <twoDimVertex x="-14.745493" y="-5.526886"/>
950  <twoDimVertex x="-14.638752" y="-5.477678"/>
951  <twoDimVertex x="-14.546447" y="-5.404911"/>
952  <twoDimVertex x="-14.47368" y="-5.312607"/>
953  <twoDimVertex x="-14.424472" y="-5.205866"/>
954  <twoDimVertex x="-14.401542" y="-5.090588"/>
955  <twoDimVertex x="-14.406156" y="-4.973141"/>
956  <twoDimVertex x="-14.438062" y="-4.860016"/>
957  <twoDimVertex x="-14.495493" y="-4.757466"/>
958  <twoDimVertex x="-14.575277" y="-4.671155"/>
959  <twoDimVertex x="-14.673006" y="-4.605854"/>
960  <twoDimVertex x="-14.783279" y="-4.565174"/>
961  <twoDimVertex x="-14.900001" y="-4.551358"/>
962  <twoDimVertex x="-19.84375" y="-4.551355"/>
963  <twoDimVertex x="-20.30244" y="-4.502438"/>
964  <twoDimVertex x="-20.740499" y="-4.357886"/>
965  <twoDimVertex x="-21.13822" y="-4.124202"/>
966  <twoDimVertex x="-21.477714" y="-3.811899"/>
967  <twoDimVertex x="-21.743711" y="-3.43502"/>
968  <twoDimVertex x="-21.924244" y="-3.010522"/>
969  <twoDimVertex x="-22.011194" y="-2.557498"/>
970  <twoDimVertex x="-22.000646" y="-2.096328"/>
971  <twoDimVertex x="-21.893081" y="-1.647752"/>
972  <twoDimVertex x="-21.693334" y="-1.23195"/>
973  <twoDimVertex x="-21.410389" y="-0.867626000000001"/>
974  <twoDimVertex x="-21.056972" y="-0.571165999999998"/>
975  <twoDimVertex x="-17.583122" y="1.413806"/>
976  <twoDimVertex x="-13.858589" y="2.875176"/>
977  <twoDimVertex x="-9.961782" y="3.782178"/>
978  <twoDimVertex x="-5.492853" y="4.325312"/>
979  <twoDimVertex x="-5.369017" y="4.320551"/>
980  <twoDimVertex x="-5.250157" y="4.285479"/>
981  <twoDimVertex x="-5.143572" y="4.222252"/>
982  <twoDimVertex x="-5.055813" y="4.134755"/>
983  <twoDimVertex x="-4.992267" y="4.028359"/>
984  <twoDimVertex x="-4.960678" y="3.929951"/>
985  <twoDimVertex x="-4.949997" y="3.827153"/>
986  <twoDimVertex x="-4.949997" y="-5.051358"/>
987  <twoDimVertex x="-4.940388" y="-5.148903"/>
988  <twoDimVertex x="-4.911935" y="-5.2427"/>
989  <twoDimVertex x="-4.854504" y="-5.345251"/>
990  <twoDimVertex x="-4.77472" y="-5.431561"/>
991  <twoDimVertex x="-4.676991" y="-5.496861"/>
992  <twoDimVertex x="-4.566719" y="-5.537543"/>
993  <twoDimVertex x="-4.449997" y="-5.551358"/>
994  <twoDimVertex x="-2.599997" y="-5.551358"/>
995  <twoDimVertex x="-2.52178" y="-5.545203"/>
996  <twoDimVertex x="-2.445489" y="-5.526886"/>
997  <twoDimVertex x="-2.338748" y="-5.477678"/>
998  <twoDimVertex x="-2.246443" y="-5.404911"/>
999  <twoDimVertex x="-2.173677" y="-5.312607"/>
1000  <twoDimVertex x="-2.124468" y="-5.205866"/>
1001  <twoDimVertex x="-2.101538" y="-5.090588"/>
1002  <twoDimVertex x="-2.106153" y="-4.973141"/>
1003  <twoDimVertex x="-2.138057" y="-4.860016"/>
1004  <twoDimVertex x="-2.195489" y="-4.757466"/>
1005  <twoDimVertex x="-2.275273" y="-4.671155"/>
1006  <twoDimVertex x="-2.373002" y="-4.605854"/>
1007  <twoDimVertex x="-2.483274" y="-4.565174"/>
1008  <twoDimVertex x="-2.599997" y="-4.551358"/>
1009  <twoDimVertex x="-3.150001" y="-4.551358"/>
1010  <twoDimVertex x="-3.266724" y="-4.537543"/>
1011  <twoDimVertex x="-3.376997" y="-4.496862"/>
1012  <twoDimVertex x="-3.474725" y="-4.431561"/>
1013  <twoDimVertex x="-3.55451" y="-4.345251"/>
1014  <twoDimVertex x="-3.611941" y="-4.2427"/>
1015  <twoDimVertex x="-3.640394" y="-4.148904"/>
1016  <twoDimVertex x="-3.650001" y="-4.051359"/>
1017  <twoDimVertex x="-3.650001" y="-1.231656"/>
1018  <twoDimVertex x="-3.635296" y="-1.111289"/>
1019  <twoDimVertex x="-3.592049" y="-0.998002"/>
1020  <twoDimVertex x="-3.522801" y="-0.89846"/>
1021  <twoDimVertex x="-3.431626" y="-0.818512999999999"/>
1022  <twoDimVertex x="-3.323887" y="-0.762865999999999"/>
1023  <twoDimVertex x="-3.226001" y="-0.737466000000001"/>
1024  <twoDimVertex x="-3.125007" y="-0.732282000000001"/>
1025  <twoDimVertex x="-3.049645" y="-0.722729999999999"/>
1026  <twoDimVertex x="-2.976599" y="-0.701872999999999"/>
1027  <twoDimVertex x="-2.875039" y="-0.650507999999999"/>
1028  <twoDimVertex x="-2.787724" y="-0.577507999999998"/>
1029  <twoDimVertex x="-2.719181" y="-0.486654000000002"/>
1030  <twoDimVertex x="-2.672959" y="-0.382652"/>
1031  <twoDimVertex x="-2.651454" y="-0.270893000000001"/>
1032  <twoDimVertex x="-2.65578" y="-0.157163000000001"/>
1033  <twoDimVertex x="-2.685712" y="-0.0473590000000002"/>
1034  <twoDimVertex x="-2.739699" y="0.0528300000000002"/>
1035  <twoDimVertex x="-2.814946" y="0.138217000000001"/>
1036  <twoDimVertex x="-2.907552" y="0.204374999999999"/>
1037  <twoDimVertex x="-3.012722" y="0.247876000000002"/>
1038  <twoDimVertex x="-3.125003" y="0.266466999999999"/>
1039  <twoDimVertex x="-3.245954" y="0.275136"/>
1040  <twoDimVertex x="-3.361263" y="0.312666"/>
1041  <twoDimVertex x="-3.464144" y="0.376850999999998"/>
1042  <twoDimVertex x="-3.548549" y="0.463915"/>
1043  <twoDimVertex x="-3.609512" y="0.568739000000001"/>
1044  <twoDimVertex x="-3.639774" y="0.665232"/>
1045  <twoDimVertex x="-3.650001" y="0.765841000000002"/>
1046  <twoDimVertex x="-3.650001" y="3.682696"/>
1047  <twoDimVertex x="-3.637045" y="3.795785"/>
1048  <twoDimVertex x="-3.598845" y="3.903012"/>
1049  <twoDimVertex x="-3.537384" y="3.998822"/>
1050  <twoDimVertex x="-3.455846" y="4.078246"/>
1051  <twoDimVertex x="-3.358455" y="4.137171"/>
1052  <twoDimVertex x="-3.268812" y="4.168376"/>
1053  <twoDimVertex x="-3.174888" y="4.182084"/>
1054 
1055 
1056  <section zOrder="0" zPosition="-1523.5077" xOffset="0" yOffset="0" scalingFactor="1"/>
1057  <section zOrder="1" zPosition="1431.2323" xOffset="0" yOffset="0" scalingFactor="1"/>
1058  <section zOrder="2" zPosition="1523.5077" xOffset="0" yOffset="@{[10*$FieldCageShaperProfileShift]}" scalingFactor="1"/>
1059 
1060 
1061  </xtru>
1062 
1063  <box name="FieldCageModule" lunit="cm"
1064  x="$FieldCageSizeX"
1065  y="$FieldCageSizeY"
1066  z="$FieldCageSizeZ"/>
1067 
1068  </solids>
1069 
1070 EOF
1071 
1072 print FieldCage <<EOF;
1073 
1074 <structure>
1075 
1076 
1077 
1078  <volume name="volFIELDSHAPER">
1079  <materialref ref="ALUMINUM_Al"/>
1080  <solidref ref="FIELD_SHAPER-SOL"/>
1081  </volume>
1082 
1083 
1084  <volume name="volFieldCageModule">
1085  <materialref ref="LAr"/>
1086  <solidref ref="FieldCageModule"/>
1087 
1088 EOF
1089  for ( $i=0; $i<$NFieldShapers; $i=$i+1 ) { # pmts with coating
1090 
1091  $Zposition = +0.5*$FieldCageSizeZ-0.5*$FFSSeparation-$i*$FFSSeparation;
1092  print FieldCage <<EOF;
1093 
1094  <physvol>
1095  <volumeref ref="volFIELDSHAPER"/>
1096  <position name="posFieldShaper$i" unit="cm" x="0" y="@{[-0.5*$FieldCageShaperProfileShift]}" z="$Zposition"/>
1097  <rotation name="FShaperRot$i" unit="deg" x="0" y="270" z="0"/>
1098  </physvol>
1099 
1100 EOF
1101  }
1102 
1103 print FieldCage <<EOF;
1104 
1105 </volume>
1106 </structure>
1107 </gdml>
1108 EOF
1109 close(FieldCage);
1110 }
1111 
1112 
1113 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1114 #++++++++++++++++++++++++++++++++++++++ gen_GroundGrid +++++++++++++++++++++++++++++++++++
1115 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1116 
1117 sub gen_GroundGrid {
1118 
1119  $GroundGrid = $basename."_GroundGrid" . $suffix . ".gdml";
1120  push (@gdmlFiles, $GroundGrid);
1121  $GroundGrid = ">" . $GroundGrid;
1122  open(GroundGrid) or die("Could not open file $GroundGrid for writing");
1123 
1124 # The standard XML prefix and starting the gdml
1125 print GroundGrid <<EOF;
1126 <?xml version='1.0'?>
1127 <gdml>
1128 EOF
1129 
1130 #GroundGrid SOLIDS
1131 $GroundGridTubeLength = 297.5;
1132 $GroundGridInnerRadious = 1.85;
1133 $GroundGridOuterRadious = 2.0;
1134 $GroundGridTorRad = 16;
1135 
1136 $GroundGridInnerStructureLength = 313.5;
1137 $GroundGridInnerStructureWidth = 2;
1138 $GroundGridInnerStructureHeight = 4;
1139 $GroundGridInnerStructureSeparation = 65.0;
1140 $GroundGridInnerStructureNumberOfBars = 4;
1141 
1142 $GroundGridInnerStructureNumberOfCablesPerInnerSquare = 5.0;
1143 $GroundGridInnerStructureCableRadious = 0.1;
1144 $GroundGridInnerStructureCableSeparation = $GroundGridInnerStructureSeparation/($GroundGridInnerStructureNumberOfCablesPerInnerSquare+1);
1145 
1146 print GroundGrid <<EOF;
1147 
1148 <solids>
1149  <torus name="GroundGridCorner" rmin="$GroundGridInnerRadious" rmax="$GroundGridOuterRadious" rtor="$GroundGridTorRad" deltaphi="90" startphi="0" aunit="deg" lunit="cm"/>
1150  <tube name="GroundGridtube" rmin="$GroundGridInnerRadious" rmax="$GroundGridOuterRadious" z="$GroundGridTubeLength" deltaphi="360" startphi="0" aunit="deg" lunit="cm"/>
1151  <box name="GroundGridInnerBoxBorder" x="@{[0.5*$GroundGridInnerStructureWidth]}" y="$GroundGridInnerStructureHeight" z="@{[$GroundGridInnerStructureLength]}" lunit="cm"/>
1152  <box name="GroundGridInnerBox" x="@{[$GroundGridInnerStructureWidth]}" y="$GroundGridInnerStructureHeight" z="@{[$GroundGridInnerStructureLength]}" lunit="cm"/>
1153  <box name="GroundGridModule" x="@{[$GroundGridInnerStructureLength+2+$GroundGridOuterRadious]}" y="$GroundGridInnerStructureHeight" z="@{[$GroundGridInnerStructureLength+2+$GroundGridOuterRadious]}" lunit="cm"/>
1154  <tube name="GroundGridCable" rmin="0" rmax="$GroundGridInnerStructureCableRadious" z="@{[$GroundGridInnerStructureLength]}" deltaphi="360" startphi="0" aunit="deg" lunit="cm"/>
1155 
1156 
1157 
1158  <union name="GGunion1">
1159  <first ref="GroundGridtube"/>
1160  <second ref="GroundGridCorner"/>
1161  <position name="GGcorner1" unit="cm" x="@{[-$GroundGridTorRad]}" y="0" z="@{[0.5*$GroundGridTubeLength]}"/>
1162  <rotation name="GGrot1" unit="deg" x="90" y="0" z="0" />
1163  </union>
1164 
1165  <union name="GGunion2">
1166  <first ref="GGunion1"/>
1167  <second ref="GroundGridtube"/>
1168  <position name="GGcorner2" unit="cm" x="@{[-0.5*$GroundGridTubeLength-$GroundGridTorRad]}" y="0" z="@{[+0.5*$GroundGridTubeLength+$GroundGridTorRad]}"/>
1169  <rotation name="GGrot2" unit="deg" x="0" y="90" z="0" />
1170  </union>
1171 
1172  <union name="GGunion3">
1173  <first ref="GGunion2"/>
1174  <second ref="GroundGridInnerBoxBorder"/>
1175  <position name="GGcorner3" unit="cm" x="@{[-$GroundGridTubeLength-$GroundGridTorRad+0.25*$GroundGridInnerStructureWidth]}" y="0" z="@{[$GroundGridTorRad-0.5*($GroundGridInnerStructureLength-$GroundGridTubeLength)]}"/>
1176  </union>
1177 
1178 
1179  <union name="GGunion4">
1180  <first ref="GGunion3"/>
1181  <second ref="GroundGridInnerBoxBorder"/>
1182  <position name="GGcorner4" unit="cm" x="@{[-0.5*$GroundGridTubeLength-$GroundGridTorRad+0.5*($GroundGridInnerStructureLength-$GroundGridTubeLength)]}" y="0" z="@{[-0.5*$GroundGridTubeLength+0.25*$GroundGridInnerStructureWidth]}"/>
1183  <rotation name="GGrot4" unit="deg" x="0" y="90" z="0" />
1184  </union>
1185 
1186 </solids>
1187 
1188 EOF
1189 
1190 $xGGorigin=0.5*($GroundGridInnerStructureLength+2+$GroundGridOuterRadious)-$GroundGridOuterRadious-2;
1191 $zGGoriging=-0.5*($GroundGridInnerStructureLength+2+$GroundGridOuterRadious)+0.5*$GroundGridTubeLength;
1192 
1193 
1194 print GroundGrid <<EOF;
1195 
1196 <structure>
1197 
1198 <volume name="volGroundGridCable">
1199  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1200  <solidref ref="GroundGridCable"/>
1201 </volume>
1202 
1203 <volume name="volGroundGridInnerBox">
1204  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1205  <solidref ref="GroundGridInnerBox"/>
1206 </volume>
1207 
1208 <volume name="volGGunion">
1209  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1210  <solidref ref="GGunion4"/>
1211 </volume>
1212 
1213  <volume name="volGroundGrid">
1214  <materialref ref="LAr"/>
1215  <solidref ref="GroundGridModule"/>
1216 
1217  <physvol>
1218  <volumeref ref="volGGunion"/>
1219  <position name="posGG18" unit="cm" x="@{[$xGGorigin]}" y="0" z="@{[$zGGoriging]}"/>
1220  </physvol>
1221 
1222 EOF
1223 
1224 $aux=4;
1225 $aux2=$aux+1;
1226 for($ii=0;$ii<$GroundGridInnerStructureNumberOfBars;$ii++)
1227 {
1228  $aux2=$aux+1;
1229  print GroundGrid <<EOF;
1230  <physvol>
1231  <volumeref ref="volGroundGridInnerBox"/>
1232  <position name="posGGInnerBox$ii" unit="cm" x="@{[$xGGorigin-$GroundGridTubeLength-$GroundGridTorRad+$GroundGridInnerStructureWidth+($ii+1)*$GroundGridInnerStructureSeparation]}" y="0" z="@{[zGGoriging+$GroundGridTorRad-0.5*($GroundGridInnerStructureLength-$GroundGridTubeLength)-0.5*$GroundGridTorRad- 0.5*$GroundGridOuterRadious]}"/>
1233  </physvol>
1234 EOF
1235  $aux++;
1236 }
1237 
1238 for($ii=0;$ii<=$GroundGridInnerStructureNumberOfBars;$ii++)
1239 {
1240  for($jj=0;$jj<$GroundGridInnerStructureNumberOfCablesPerInnerSquare;$jj++)
1241  {
1242  print GroundGrid <<EOF;
1243  <physvol>
1244  <volumeref ref="volGroundGridCable"/>
1245  <position name="posGGCable$ii$jj" unit="cm" x="@{[$xGGorigin-$GroundGridTubeLength-$GroundGridTorRad+$GroundGridInnerStructureWidth+($ii)*$GroundGridInnerStructureSeparation + ($jj+1)*$GroundGridInnerStructureCableSeparation]}" y="0" z="@{[zGGoriging+$GroundGridTorRad-0.5*($GroundGridInnerStructureLength-$GroundGridTubeLength)-0.5*$GroundGridTorRad- 0.5*$GroundGridOuterRadious]}"/>
1246  </physvol>
1247 EOF
1248  if($ii ==$GroundGridInnerStructureNumberOfBars) { if($jj == 3){ $jj=$GroundGridInnerStructureNumberOfCablesPerInnerSquare;}}
1249  }
1250 
1251 }
1252 
1253 for($ii=0;$ii<$GroundGridInnerStructureNumberOfBars;$ii++)
1254 {
1255  $aux2=$aux+1;
1256  print GroundGrid <<EOF;
1257  <physvol>
1258  <volumeref ref="volGroundGridInnerBox"/>
1259  <position name="posGGInnerBoxLat$ii" unit="cm" x="@{[$xGGorigin-0.5*$GroundGridTubeLength-$GroundGridTorRad+0.5*($GroundGridInnerStructureLength-$GroundGridTubeLength)]}" y="0" z="@{[zGGoriging-0.5*$GroundGridTubeLength+$GroundGridInnerStructureWidth +($ii+1)*$GroundGridInnerStructureSeparation - 0.5*$GroundGridTorRad- 0.5*$GroundGridOuterRadious]}"/>
1260  <rotation name="GGrot$aux2" unit="deg" x="0" y="90" z="0" />
1261  </physvol>
1262 EOF
1263  $aux++;
1264 }
1265  print GroundGrid <<EOF;
1266 
1267  </volume>
1268 </structure>
1269 </gdml>
1270 EOF
1271 close(GroundGrid);
1272 }
1273 
1274 
1275 
1276 
1277 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1278 #++++++++++++++++++++++++++++++++++++++ gen_Cathode +++++++++++++++++++++++++++++++++++++
1279 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1280 
1281 sub gen_Cathode {
1282 
1283  $Cathode = $basename."_Cathode" . $suffix . ".gdml";
1284  push (@gdmlFiles, $Cathode);
1285  $Cathode = ">" . $Cathode;
1286  open(Cathode) or die("Could not open file $Cathode for writing");
1287 
1288 # The standard XML prefix and starting the gdml
1289 print Cathode <<EOF;
1290 <?xml version='1.0'?>
1291 <gdml>
1292 EOF
1293 
1294 #Cathode SOLIDS
1295 $CathodeTubeLength = 297.5;
1296 $CathodeInnerRadious = 1.85;
1297 $CathodeOuterRadious = 2.0;
1298 $CathodeTorRad = 16;
1299 
1300 $CathodeInnerStructureLength = 313.5;
1301 $CathodeInnerStructureWidth = 2;
1302 $CathodeInnerStructureHeight = 4;
1303 $CathodeInnerStructureSeparation = 65.0;
1304 $CathodeInnerStructureNumberOfBars = 4;
1305 
1306 $CathodeInnerStructureNumberOfCablesPerInnerSquare = 5.0;
1307 $CathodeInnerStructureCableRadious = 0.5;
1308 $CathodeInnerStructureCableSeparation = $CathodeInnerStructureSeparation/($CathodeInnerStructureNumberOfCablesPerInnerSquare+1);
1309 $CathodeInnerCableLength = 128.0;
1310 $CathodeInnerCableLengthShort = 47.5;#48.5;
1311 
1312 $CathodeSupportTubeLength = 252.0;
1313 $CathodeSupportInnerRadious = 1.85;
1314 $CathodeSupportOuterRadious = 2.0;
1315 $CathodeSupportTorRad = 12;
1316 
1317 $CathodeSupportInnerStructureLength = 264.0;
1318 $CathodeSupportInnerStructureWidth = 2;
1319 $CathodeSupportInnerStructureHeight = 4;
1320 $CathodeSupportInnerStructureSeparation = 65.0;
1321 $CathodeSupportInnerStructureNumberOfBars = 3;
1322 
1323 $CathodeSupportDistance =20;
1324 $CathodeModuleX =$CathodeInnerStructureLength+2+$CathodeOuterRadious;
1325 $CathodeModuleY =$CathodeInnerStructureHeight + $CathodeSupportDistance;
1326 $CathodeModuleZ =$CathodeInnerStructureLength+2+$CathodeOuterRadious;
1327 
1328 $CathodeSupportSeparatorsHeight=$CathodeSupportDistance-$CathodeInnerStructureHeight;
1329 
1330 $CathodeSupportSeparatorsBorderLength=33;#53.39;
1331 print Cathode <<EOF;
1332 
1333 <solids>
1334  <torus name="CathodeCorner" rmin="$CathodeInnerRadious" rmax="$CathodeOuterRadious" rtor="$CathodeTorRad" deltaphi="90" startphi="0" aunit="deg" lunit="cm"/>
1335  <tube name="Cathodetube" rmin="$CathodeInnerRadious" rmax="$CathodeOuterRadious" z="$CathodeTubeLength" deltaphi="360" startphi="0" aunit="deg" lunit="cm"/>
1336  <box name="CathodeInnerBoxBorder" x="@{[0.5*$CathodeInnerStructureWidth]}" y="$CathodeInnerStructureHeight" z="@{[$CathodeInnerStructureLength]}" lunit="cm"/>
1337  <box name="CathodeInnerBox" x="@{[$CathodeInnerStructureWidth]}" y="$CathodeInnerStructureHeight" z="@{[$CathodeInnerStructureLength]}" lunit="cm"/>
1338  <box name="CathodeModule" x="@{[$CathodeModuleX]}" y="$CathodeModuleY" z="@{[$CathodeModuleZ]}" lunit="cm"/>
1339  <box name="CathodeSupportSeparators" x="@{[$CathodeSupportInnerStructureWidth]}" y="@{[$CathodeSupportSeparatorsHeight]}" z="@{[$CathodeSupportInnerStructureHeight]}" lunit="cm"/>
1340  <box name="CathodeSupportSeparatorsBorder" x="@{[$CathodeSupportInnerStructureWidth]}" y="$CathodeSupportSeparatorsBorderLength" z="@{[$CathodeSupportInnerStructureHeight]}" lunit="cm"/>
1341  <tube name="CathodeCable" rmin="0" rmax="$CathodeInnerStructureCableRadious" z="@{[$CathodeInnerCableLength]}" deltaphi="360" startphi="0" aunit="deg" lunit="cm"/>
1342  <tube name="CathodeCableShort" rmin="0" rmax="$CathodeInnerStructureCableRadious" z="@{[$CathodeInnerCableLengthShort]}" deltaphi="360" startphi="0" aunit="deg" lunit="cm"/>
1343  <tube name="CathodeCableShortShort" rmin="0" rmax="$CathodeInnerStructureCableRadious" z="@{[$CathodeInnerCableLengthShort-3]}" deltaphi="360" startphi="0" aunit="deg" lunit="cm"/>
1344 
1345 
1346 
1347  <union name="Cathunion1">
1348  <first ref="Cathodetube"/>
1349  <second ref="CathodeCorner"/>
1350  <position name="Cathcorner1" unit="cm" x="@{[-$CathodeTorRad]}" y="0" z="@{[0.5*$CathodeTubeLength]}"/>
1351  <rotation name="Cathrot1" unit="deg" x="90" y="0" z="0" />
1352  </union>
1353 
1354  <union name="Cathunion2">
1355  <first ref="Cathunion1"/>
1356  <second ref="Cathodetube"/>
1357  <position name="Cathcorner2" unit="cm" x="@{[-0.5*$CathodeTubeLength-$CathodeTorRad]}" y="0" z="@{[+0.5*$CathodeTubeLength+$CathodeTorRad]}"/>
1358  <rotation name="Cathrot2" unit="deg" x="0" y="90" z="0" />
1359  </union>
1360 
1361  <union name="Cathunion3">
1362  <first ref="Cathunion2"/>
1363  <second ref="CathodeInnerBoxBorder"/>
1364  <position name="Cathcorner3" unit="cm" x="@{[-$CathodeTubeLength-$CathodeTorRad+0.25*$CathodeInnerStructureWidth]}" y="0" z="@{[$CathodeTorRad-0.5*($CathodeInnerStructureLength-$CathodeTubeLength)]}"/>
1365  </union>
1366 
1367 
1368  <union name="Cathunion4">
1369  <first ref="Cathunion3"/>
1370  <second ref="CathodeInnerBoxBorder"/>
1371  <position name="Cathcorner4" unit="cm" x="@{[-0.5*$CathodeTubeLength-$CathodeTorRad+0.5*($CathodeInnerStructureLength-$CathodeTubeLength)]}" y="0" z="@{[-0.5*$CathodeTubeLength+0.25*$CathodeInnerStructureWidth]}"/>
1372  <rotation name="Cathrot4" unit="deg" x="0" y="90" z="0" />
1373  </union>
1374 
1375 
1376  <torus name="CathodeSupportCorner" rmin="$CathodeSupportInnerRadious" rmax="$CathodeSupportOuterRadious" rtor="$CathodeSupportTorRad" deltaphi="90" startphi="0" aunit="deg" lunit="cm"/>
1377  <tube name="CathodeSupporttube" rmin="$CathodeSupportInnerRadious" rmax="$CathodeSupportOuterRadious" z="$CathodeSupportTubeLength" deltaphi="360" startphi="0" aunit="deg" lunit="cm"/>
1378  <box name="CathodeSupportInnerBoxBorder" x="@{[0.5*$CathodeSupportInnerStructureWidth]}" y="$CathodeSupportInnerStructureHeight" z="@{[$CathodeSupportInnerStructureLength]}" lunit="cm"/>
1379  <box name="CathodeSupportInnerBox" x="@{[$CathodeSupportInnerStructureWidth]}" y="$CathodeSupportInnerStructureHeight" z="@{[$CathodeSupportInnerStructureLength]}" lunit="cm"/>
1380  <box name="CathodeSupportModule" x="@{[$CathodeSupportInnerStructureLength+2+$CathodeSupportOuterRadious]}" y="$CathodeSupportInnerStructureHeight" z="@{[$CathodeSupportInnerStructureLength+2+$CathodeSupportOuterRadious]}" lunit="cm"/>
1381 
1382 
1383 
1384  <union name="CathSupunion1">
1385  <first ref="CathodeSupporttube"/>
1386  <second ref="CathodeSupportCorner"/>
1387  <position name="CathSupcorner1" unit="cm" x="@{[-$CathodeSupportTorRad]}" y="0" z="@{[0.5*$CathodeSupportTubeLength]}"/>
1388  <rotation name="CathSuprot1" unit="deg" x="90" y="0" z="0" />
1389  </union>
1390 
1391  <union name="CathSupunion2">
1392  <first ref="CathSupunion1"/>
1393  <second ref="CathodeSupporttube"/>
1394  <position name="CathSupcorner2" unit="cm" x="@{[-0.5*$CathodeSupportTubeLength-$CathodeSupportTorRad]}" y="0" z="@{[+0.5*$CathodeSupportTubeLength+$CathodeSupportTorRad]}"/>
1395  <rotation name="CathSuprot2" unit="deg" x="0" y="90" z="0" />
1396  </union>
1397 
1398  <union name="CathSupunion3">
1399  <first ref="CathSupunion2"/>
1400  <second ref="CathodeSupportInnerBoxBorder"/>
1401  <position name="CathSupcorner3" unit="cm" x="@{[-$CathodeSupportTubeLength-$CathodeSupportTorRad+0.25*$CathodeSupportInnerStructureWidth]}" y="0" z="@{[$CathodeSupportTorRad-0.5*($CathodeSupportInnerStructureLength-$CathodeSupportTubeLength)]}"/>
1402  </union>
1403 
1404 
1405  <union name="CathSupunion4">
1406  <first ref="CathSupunion3"/>
1407  <second ref="CathodeSupportInnerBoxBorder"/>
1408  <position name="CathSupcorner4" unit="cm" x="@{[-0.5*$CathodeSupportTubeLength-$CathodeSupportTorRad+0.5*($CathodeSupportInnerStructureLength-$CathodeSupportTubeLength)]}" y="0" z="@{[-0.5*$CathodeSupportTubeLength+0.25*$CathodeSupportInnerStructureWidth]}"/>
1409  <rotation name="CathSuprot4" unit="deg" x="0" y="90" z="0" />
1410  </union>
1411 
1412 </solids>
1413 
1414 EOF
1415 
1416 
1417 $xCathorigin=0.5*($CathodeModuleX)-$CathodeOuterRadious-2;
1418 $yCathorigin=0.5*$CathodeModuleY - 0.5*$CathodeInnerStructureHeight;
1419 $zCathoriging=-0.5*($CathodeModuleX)+0.5*$CathodeTubeLength;
1420 $xCathSuporigin=$xCathorigin+($CathodeSupportInnerStructureLength-$CathodeInnerStructureLength);
1421 $zCathSuporigin=-$zCathoriging-($CathodeInnerStructureLength+$CathodeOuterRadious-$CathodeSupportInnerStructureLength-$CathodeSupportOuterRadious)+7;
1422 
1423 $xCathSuporigin=$xCathorigin+($CathodeSupportInnerStructureLength-$CathodeInnerStructureLength);
1424 $zCathSuporigin=-0.5*($CathodeModuleZ)+0.5*$CathodeSupportTubeLength;
1425 $yCathSuporigin=$yCathorigin-$CathodeSupportDistance;
1426 
1427 
1428 print Cathode <<EOF;
1429 
1430 <structure>
1431 
1432 
1433 
1434 <volume name="volCathodeSupportSeparators">
1435  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1436  <solidref ref="CathodeSupportSeparators"/>
1437 </volume>
1438 
1439 <volume name="volCathodeSupportSeparatorsBorder">
1440  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1441  <solidref ref="CathodeSupportSeparatorsBorder"/>
1442 </volume>
1443 
1444 
1445 
1446 
1447 <volume name="volCathodeCable">
1448  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1449  <solidref ref="CathodeCable"/>
1450 </volume>
1451 
1452 <volume name="volCathodeCableShort">
1453  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1454  <solidref ref="CathodeCableShort"/>
1455 </volume>
1456 
1457 <volume name="volCathodeCableShortShort">
1458  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1459  <solidref ref="CathodeCableShortShort"/>
1460 </volume>
1461 
1462 <volume name="volCathodeInnerBox">
1463  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1464  <solidref ref="CathodeInnerBox"/>
1465 </volume>
1466 
1467 <volume name="volCathodeSupportInnerBox">
1468  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1469  <solidref ref="CathodeSupportInnerBox"/>
1470 </volume>
1471 
1472 
1473 <volume name="volCathunion">
1474  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1475  <solidref ref="Cathunion4"/>
1476 </volume>
1477 
1478 <volume name="volCathSupunion">
1479  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1480  <solidref ref="CathSupunion4"/>
1481 </volume>
1482 
1483  <volume name="volCathode">
1484  <materialref ref="LAr"/>
1485  <solidref ref="CathodeModule"/>
1486 
1487  <physvol>
1488  <volumeref ref="volCathunion"/>
1489  <position name="posCath18" unit="cm" x="@{[$xCathorigin]}" y="$yCathorigin" z="@{[$zCathoriging]}"/>
1490  </physvol>
1491 
1492  <physvol>
1493  <volumeref ref="volCathSupunion"/>
1494  <position name="posCathSup" unit="cm" x="@{[$xCathSuporigin]}" y="$yCathSuporigin" z="@{[$zCathSuporigin]}"/>
1495  </physvol>
1496 
1497 EOF
1498 
1499 $aux=4;
1500 $aux2=$aux+1;
1501 for($ii=0;$ii<$CathodeInnerStructureNumberOfBars;$ii++)
1502 {
1503  $aux2=$aux+1;
1504  print Cathode <<EOF;
1505  <physvol>
1506  <volumeref ref="volCathodeInnerBox"/>
1507  <position name="posCathInnerBox$ii" unit="cm" x="@{[$xCathorigin-$CathodeTubeLength-$CathodeTorRad+$CathodeInnerStructureWidth+($ii+1)*$CathodeInnerStructureSeparation]}" y="$yCathorigin" z="@{[zCathoriging+$CathodeTorRad-0.5*($CathodeInnerStructureLength-$CathodeTubeLength)-0.5*$CathodeTorRad- 0.5*$CathodeOuterRadious]}"/>
1508  </physvol>
1509 EOF
1510  $aux++;
1511 }
1512 
1513 
1514 
1515 for($ii=0;$ii<$CathodeInnerStructureNumberOfBars;$ii++)
1516 {
1517  $aux2=$aux+1;
1518  print Cathode <<EOF;
1519  <physvol>
1520  <volumeref ref="volCathodeInnerBox"/>
1521  <position name="posCathInnerBoxLat$ii" unit="cm" x="@{[$xCathorigin-0.5*$CathodeTubeLength-$CathodeTorRad+0.5*($CathodeInnerStructureLength-$CathodeTubeLength)]}" y="$yCathorigin" z="@{[zCathoriging-0.5*$CathodeTubeLength+$CathodeInnerStructureWidth +($ii+1)*$CathodeInnerStructureSeparation - 0.5*$CathodeTorRad- 0.5*$CathodeOuterRadious]}"/>
1522  <rotation name="Cathrot$aux2" unit="deg" x="0" y="90" z="0" />
1523  </physvol>
1524 EOF
1525  $aux++;
1526 }
1527 
1528 
1529 for($kk=0;$kk<$CathodeInnerStructureNumberOfBars;$kk=$kk+2)
1530 {
1531 for($ii=0;$ii<=$CathodeInnerStructureNumberOfBars;$ii=$ii+2)
1532 {
1533 if ($kk==2) {$ii=$ii+2;};
1534 
1535  for($jj=0;$jj<2*$CathodeInnerStructureNumberOfCablesPerInnerSquare+1;$jj++)
1536  {
1537  print Cathode <<EOF;
1538  <physvol>
1539  <volumeref ref="volCathodeCable"/>
1540  <position name="posCathCable$ii$jj$kk" unit="cm" x="@{[($xCathorigin-$CathodeTubeLength-$CathodeTorRad+$CathodeInnerStructureWidth+($ii)*$CathodeInnerStructureSeparation+($jj+1)*$CathodeInnerStructureCableSeparation)]}" y="$yCathorigin" z="@{[zCathoriging-0.5*$CathodeTubeLength+$CathodeInnerStructureWidth +($kk+1)*$CathodeInnerStructureSeparation - 0.5*$CathodeTorRad- 0.5*$CathodeOuterRadious]}"/>
1541  </physvol>
1542 EOF
1543  if($ii ==$CathodeInnerStructureNumberOfCablesPerInnerSquare-1 && $jj ==$CathodeInnerStructureNumberOfCablesPerInnerSquare-2) {$jj=2*$CathodeInnerStructureNumberOfCablesPerInnerSquare+1;}
1544  if($jj ==$CathodeInnerStructureNumberOfCablesPerInnerSquare-1) {$jj++;}
1545 
1546  }
1547 if ($kk==2) {$ii=$ii+2;};
1548 if ($kk==0) {$ii=$ii+2;};
1549 
1550 }
1551 }
1552 
1553 
1554 $kk=4;
1555 for($ii=0;$ii<=$CathodeInnerStructureNumberOfBars;$ii=$ii+4)
1556 {
1557  for($jj=0;$jj<2*$CathodeInnerStructureNumberOfCablesPerInnerSquare+1;$jj++)
1558  {
1559  print Cathode <<EOF;
1560  <physvol>
1561  <volumeref ref="volCathodeCableShort"/>
1562  <position name="posCathCableShort$ii$jj$kk" unit="cm" x="@{[($xCathorigin-$CathodeTubeLength-$CathodeTorRad+$CathodeInnerStructureWidth+($ii)*$CathodeInnerStructureSeparation+($jj+1)*$CathodeInnerStructureCableSeparation)]}" y="$yCathorigin" z="@{[zCathoriging-0.5*$CathodeTubeLength+$CathodeInnerStructureWidth +($kk)*$CathodeInnerStructureSeparation - 0.5*$CathodeTorRad- 0.5*$CathodeOuterRadious+0.5*$CathodeInnerCableLengthShort+1]}"/>
1563  </physvol>
1564 EOF
1565  if($ii ==$CathodeInnerStructureNumberOfCablesPerInnerSquare-1 && $jj ==$CathodeInnerStructureNumberOfCablesPerInnerSquare-3) {$jj=2*$CathodeInnerStructureNumberOfCablesPerInnerSquare+1;}
1566  if($jj ==$CathodeInnerStructureNumberOfCablesPerInnerSquare-1) {$jj++;}
1567  #Falta el $ii 4 $jj 2 that needs to be shorter to not overlap.
1568 
1569 #print "$ii $jj \n";
1570 
1571  }
1572 }
1573 
1574 $ii=4;
1575 $jj=3;
1576 
1577  print Cathode <<EOF;
1578  <physvol>
1579  <volumeref ref="volCathodeCableShortShort"/>
1580  <position name="posCathCableShort$ii$jj$kk" unit="cm" x="@{[($xCathorigin-$CathodeTubeLength-$CathodeTorRad+$CathodeInnerStructureWidth+($ii)*$CathodeInnerStructureSeparation+($jj+1)*$CathodeInnerStructureCableSeparation)]}" y="$yCathorigin" z="@{[zCathoriging-0.5*$CathodeTubeLength+$CathodeInnerStructureWidth +($kk)*$CathodeInnerStructureSeparation - 0.5*$CathodeTorRad- 0.5*$CathodeOuterRadious+0.5*$CathodeInnerCableLengthShort+1-1]}"/>
1581  </physvol>
1582 EOF
1583 
1584 for($ii=0;$ii<$CathodeInnerStructureNumberOfBars;$ii=$ii+2)
1585 {
1586 for($kk=0;$kk<=$CathodeInnerStructureNumberOfBars;$kk=$kk+2)
1587 {
1588 if ($ii==0) {$kk=$kk+2;};
1589 
1590  for($jj=0;$jj<2*$CathodeInnerStructureNumberOfCablesPerInnerSquare+1;$jj++)
1591  {
1592  print Cathode <<EOF;
1593  <physvol>
1594  <volumeref ref="volCathodeCable"/>
1595  <position name="posCathCable$ii$jj$kk" unit="cm" x="@{[$xCathorigin-$CathodeTubeLength-$CathodeTorRad+$CathodeInnerStructureWidth+($ii+1)*$CathodeInnerStructureSeparation]}" y="$yCathorigin" z="@{[zCathoriging-0.5*$CathodeTubeLength+$CathodeInnerStructureWidth +($kk)*$CathodeInnerStructureSeparation - 0.5*$CathodeTorRad- 0.5*$CathodeOuterRadious +($jj+1)*$CathodeInnerStructureCableSeparation]}"/>
1596  <rotation name="CathCablerot$ii$jj$kk" unit="deg" x="0" y="90" z="0" />
1597  </physvol>
1598 EOF
1599  if($kk ==$CathodeInnerStructureNumberOfCablesPerInnerSquare-1 && $jj ==$CathodeInnerStructureNumberOfCablesPerInnerSquare-2) {$jj=2*$CathodeInnerStructureNumberOfCablesPerInnerSquare+1;}
1600  if($jj ==$CathodeInnerStructureNumberOfCablesPerInnerSquare-1) {$jj++;}
1601 
1602  }
1603 if ($ii==2) {$kk=$kk+2;};
1604 if ($ii==0) {$kk=$kk+2;};
1605 
1606 }
1607 }
1608 
1609 $ii=4;
1610 $kk=2;
1611  for($jj=0;$jj<2*$CathodeInnerStructureNumberOfCablesPerInnerSquare+1;$jj++)
1612  {
1613  print Cathode <<EOF;
1614  <physvol>
1615  <volumeref ref="volCathodeCableShort"/>
1616  <position name="posCathCableShort$ii$jj$kk" unit="cm" x="@{[$xCathorigin-$CathodeTubeLength-$CathodeTorRad+$CathodeInnerStructureWidth+($ii)*$CathodeInnerStructureSeparation+0.5*$CathodeInnerCableLengthShort+1]}" y="$yCathorigin" z="@{[zCathoriging-0.5*$CathodeTubeLength+$CathodeInnerStructureWidth +($kk)*$CathodeInnerStructureSeparation - 0.5*$CathodeTorRad- 0.5*$CathodeOuterRadious +($jj+1)*$CathodeInnerStructureCableSeparation]}"/>
1617  <rotation name="CathCablerot$ii$jj$kk" unit="deg" x="0" y="90" z="0" />
1618  </physvol>
1619 EOF
1620 
1621  if($jj ==$CathodeInnerStructureNumberOfCablesPerInnerSquare-1) {$jj++;}
1622  }
1623 
1624 
1625 for($ii=0;$ii<$CathodeSupportInnerStructureNumberOfBars;$ii++)
1626 {
1627  print Cathode <<EOF;
1628  <physvol>
1629  <volumeref ref="volCathodeSupportInnerBox"/>
1630  <position name="posCathSupInnerBoxLat$ii" unit="cm" x="@{[$xCathSuporigin-0.5*$CathodeSupportTubeLength-$CathodeSupportTorRad+0.5*($CathodeSupportInnerStructureLength-$CathodeSupportTubeLength)]}" y="$yCathSuporigin" z="@{[zCathoriging-0.5*$CathodeTubeLength+$CathodeInnerStructureWidth +($ii+1)*$CathodeInnerStructureSeparation - 0.5*$CathodeTorRad- 0.5*$CathodeOuterRadious]}"/>
1631  <rotation name="CathSupInnerBoxLatrot$ii" unit="deg" x="0" y="90" z="0" />
1632  </physvol>
1633 EOF
1634 }
1635 
1636 for($ii=0;$ii<$CathodeSupportInnerStructureNumberOfBars;$ii++)
1637 {
1638  $aux2=$aux+1;
1639  print Cathode <<EOF;
1640  <physvol>
1641  <volumeref ref="volCathodeSupportInnerBox"/>
1642  <position name="posCathSupInnerBox$ii" unit="cm" x="@{[$xCathSuporigin-$CathodeSupportTubeLength-$CathodeSupportTorRad+$CathodeSupportInnerStructureWidth+($ii+1)*$CathodeSupportInnerStructureSeparation]}" y="$yCathSuporigin" z="@{[$zCathSuporigin+$CathodeSupportTorRad-$CathodeSupportOuterRadious-4]}"/>
1643  </physvol>
1644 EOF
1645  $aux++;
1646 }
1647 
1648 for($ii=0;$ii<=$CathodeSupportInnerStructureNumberOfBars+1;$ii++)
1649 {
1650  for($jj=0;$jj<=$CathodeSupportInnerStructureNumberOfBars+1;$jj++)
1651  { print Cathode <<EOF;
1652  <physvol>
1653  <volumeref ref="volCathodeSupportSeparators"/>
1654  <position name="posCathodeSupportSeparators$ii$jj" unit="cm" x="@{[$xCathSuporigin-$CathodeSupportTubeLength-$CathodeSupportTorRad+$CathodeSupportInnerStructureWidth+($ii)*$CathodeSupportInnerStructureSeparation]}" y="@{[0.5*$CathodeSupportSeparatorsHeight+$yCathSuporigin+2]}" z="@{[zCathoriging-0.5*$CathodeTubeLength+$CathodeInnerStructureWidth +($jj)*$CathodeInnerStructureSeparation - 0.5*$CathodeTorRad- 0.5*$CathodeOuterRadious]}"/>
1655  </physvol>
1656 EOF
1657  if(($jj==$CathodeSupportInnerStructureNumberOfBars+1 )&& $jj!=$ii)
1658  {
1659 
1660  print Cathode <<EOF;
1661  <physvol>
1662  <volumeref ref="volCathodeSupportSeparatorsBorder"/>
1663  <position name="posCathodeSupportSeparatorsBorder$ii$jj" unit="cm" x="@{[$xCathSuporigin-$CathodeSupportTubeLength-$CathodeSupportTorRad+$CathodeSupportInnerStructureWidth+($ii)*$CathodeSupportInnerStructureSeparation]}" y="@{[0.5*$CathodeSupportDistance+$yCathSuporigin]}" z="@{[zCathoriging-0.5*$CathodeTubeLength+$CathodeInnerStructureWidth +($jj)*$CathodeInnerStructureSeparation - 0.5*$CathodeTorRad- 0.5*$CathodeOuterRadious+0.5*49.5]}"/>
1664  <rotation name="CathSupSepRot$ii$jj" unit="deg" x="292" y="0" z="0" />
1665  </physvol>
1666 EOF
1667 
1668  }
1669 
1670  if(($ii==$CathodeSupportInnerStructureNumberOfBars+1)&& $jj!=$ii)
1671  {
1672 
1673  print Cathode <<EOF;
1674  <physvol>
1675  <volumeref ref="volCathodeSupportSeparatorsBorder"/>
1676  <position name="posCathodeSupportSeparatorsBorder$ii$jj" unit="cm" x="@{[$xCathSuporigin-$CathodeSupportTubeLength-$CathodeSupportTorRad+$CathodeSupportInnerStructureWidth+($ii)*$CathodeSupportInnerStructureSeparation+0.5*49.5]}" y="@{[0.5*$CathodeSupportDistance+$yCathSuporigin]}" z="@{[zCathoriging-0.5*$CathodeTubeLength+$CathodeInnerStructureWidth +($jj)*$CathodeInnerStructureSeparation - 0.5*$CathodeTorRad- 0.5*$CathodeOuterRadious]}"/>
1677  <rotation name="CathSupSepRot$ii$jj" unit="deg" x="0" y="0" z="68" />
1678 
1679  </physvol>
1680 EOF
1681 
1682  }
1683 
1684 
1685  if($ii==$CathodeSupportInnerStructureNumberOfBars+1){if($jj==$CathodeSupportInnerStructureNumberOfBars) {$j++;}}
1686  }
1687 }
1688 
1689  print Cathode <<EOF;
1690 
1691  </volume>
1692 </structure>
1693 </gdml>
1694 EOF
1695 close(Cathode);
1696 }
1697 
1698 
1699 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1700 #++++++++++++++++++++++++++++++++++++++ gen_LEMs +++++++++++++++++++++++++++++++++++++
1701 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1702 
1703 sub gen_LEMs {
1704 
1705 
1706  $LEMs = $basename."_LEMs" . $suffix . ".gdml";
1707  push (@gdmlFiles, $LEMs);
1708  $LEMs = ">" . $LEMs;
1709  open(LEMs) or die("Could not open file $LEMs for writing");
1710 
1711 # The standard XML prefix and starting the gdml
1712 print LEMs <<EOF;
1713 <?xml version='1.0'?>
1714 <gdml>
1715 EOF
1716 
1717 $LEMsSizeX=0.1;
1718 $LEMsSizeY=600.64;
1719 $LEMsSizeZ=600.64;
1720 
1721 print LEMs <<EOF;
1722 
1723 <solids>
1724  <box name="solLEMs" x="@{[$LEMsSizeX]}" y="$LEMsSizeY" z="@{[$LEMsSizeZ]}" lunit="cm"/>
1725 
1726 </solids>
1727 
1728 EOF
1729 print LEMs <<EOF;
1730 
1731 
1732 <structure>
1733  <volume name="volLEMs">
1734  <materialref ref="Copper_Beryllium_alloy25"/>
1735  <solidref ref="solLEMs"/>
1736  </volume>
1737 </structure>
1738 </gdml>
1739 EOF
1740 close(LEMs);
1741 }
1742 
1743 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1744 #++++++++++++++++++++++++++++++++++++++ gen_pmt +++++++++++++++++++++++++++++++++++++
1745 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1746 
1747 sub gen_pmt {
1748 
1749 #PMTs
1750 #$PMT_COATING_THICKNESS=0.2;#
1751 #$PMT_PLATE_THICKNESS=0.4;
1752 #$PMT_GLASS_THICKNESS=0.2;
1753 
1754  $PMT = $basename."_PMT" . $suffix . ".gdml";
1755  push (@gdmlFiles, $PMT);
1756  $PMT = ">" . $PMT;
1757  open(PMT) or die("Could not open file $PMT for writing");
1758 
1759 # The standard XML prefix and starting the gdml
1760 print PMT <<EOF;
1761 <?xml version='1.0'?>
1762 <gdml>
1763 EOF
1764 
1765 #PMT SOLIDS
1766 print PMT <<EOF;
1767 
1768 <solids>
1769  <tube name="PMTVolume"
1770  rmax="(6.5*2.54)"
1771  z="(11.1*2.54)"
1772  deltaphi="360"
1773  aunit="deg"
1774  lunit="cm"/>
1775 
1776  <tube aunit="deg" deltaphi="360" lunit="mm" name="pmtMiddleCylinder" rmax="102.351822048586" rmin="100.351822048586" startphi="0" z="54"/>
1777  <sphere aunit="deg" deltaphi="360" deltatheta="50" lunit="mm" name="sphPartTop" rmax="133" rmin="131" startphi="0" starttheta="0"/>
1778  <union name="pmt0x7fb8f489dfe0">
1779  <first ref="pmtMiddleCylinder"/>
1780  <second ref="sphPartTop"/>
1781  <position name="pmt0x7fb8f489dfe0_pos" unit="mm" x="0" y="0" z="-57.2051768689367"/>
1782  </union>
1783  <sphere aunit="deg" deltaphi="360" deltatheta="31.477975238527" lunit="mm" name="sphPartBtm" rmax="133" rmin="131" startphi="0" starttheta="130"/>
1784  <union name="pmt0x7fb8f48a0d50">
1785  <first ref="pmt0x7fb8f489dfe0"/>
1786  <second ref="sphPartBtm"/>
1787  <position name="pmt0x7fb8f48a0d50_pos" unit="mm" x="0" y="0" z="57.2051768689367"/>
1788  </union>
1789  <tube aunit="deg" deltaphi="360" lunit="mm" name="pmtBtmTube" rmax="44.25" rmin="42.25" startphi="0" z="72"/>
1790  <union name="solidpmt">
1791  <first ref="pmt0x7fb8f48a0d50"/>
1792  <second ref="pmtBtmTube"/>
1793  <position name="solidpmt_pos" unit="mm" x="0" y="0" z="-104.905637496842"/>
1794  </union>
1795  <sphere aunit="deg" deltaphi="360" deltatheta="50" lunit="mm" name="pmt0x7fb8f48a1eb0" rmax="133.2" rmin="133" startphi="0" starttheta="0"/>
1796  <sphere aunit="deg" deltaphi="360" deltatheta="46.5" lunit="mm" name="pmt0x7fb8f48a4860" rmax="131" rmin="130.999" startphi="0" starttheta="0"/>
1797 
1798 
1799 </solids>
1800 
1801 EOF
1802 print PMT <<EOF;
1803 
1804 
1805 <structure>
1806  <volume name="pmtCoatVol">
1807  <materialref ref="LAr"/>
1808  <solidref ref="pmt0x7fb8f48a1eb0"/>
1809  <auxiliary auxtype="SensDet" auxvalue="PhotonDetector"/>
1810  </volume>
1811 
1812  <volume name="allpmt">
1813  <materialref ref="Glass"/>
1814  <solidref ref="solidpmt"/>
1815  </volume>
1816 
1817 <volume name="volPMT_coated">
1818  <materialref ref="LAr"/>
1819  <solidref ref="PMTVolume"/>
1820 
1821  <physvol>
1822  <volumeref ref="allpmt"/>
1823  <position name="posallpmt" unit="cm" x="0" y="0" z="@{[1.27*2.54]}"/>
1824  </physvol>
1825 
1826  <physvol name="volOpDetSensitive">
1827  <volumeref ref="pmtCoatVol"/>
1828  <position name="posOpDetSensitive" unit="cm" x="0" y="0" z="@{[1.27*2.54- (2.23*2.54)]}"/>
1829  </physvol>
1830 
1831  </volume>
1832 </structure>
1833 </gdml>
1834 EOF
1835 close(PMT);
1836 }
1837 
1838  #<physvol>
1839  #<volumeref ref="pmtCathVol"/>
1840  # <position name="pmtCath_pos" unit="cm" x="0" y="0" z="0"/>#8*2.54 + 0.9"/>
1841  #</physvol>
1842 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1843 #++++++++++++++++++++++++++++++++++++++ gen_Cryostat +++++++++++++++++++++++++++++++++++++
1844 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1845 
1846 sub gen_Cryostat()
1847 {
1848 
1849 # Create the cryostat fragment file name,
1850 # add file to list of output GDML fragments,
1851 # and open it
1852  $CRYO = $basename."_Cryostat" . $suffix . ".gdml";
1853  push (@gdmlFiles, $CRYO);
1854  $CRYO = ">" . $CRYO;
1855  open(CRYO) or die("Could not open file $CRYO for writing");
1856 
1857 
1858 # The standard XML prefix and starting the gdml
1859  print CRYO <<EOF;
1860 <?xml version='1.0'?>
1861 <gdml>
1862 EOF
1863 
1864 # All the cryostat solids.
1865 print CRYO <<EOF;
1866 <solids>
1867  <box name="Cryostat" lunit="cm"
1868  x="$Cryostat_x"
1869  y="$Cryostat_y"
1870  z="$Cryostat_z"/>
1871 
1872  <box name="ArgonInterior" lunit="cm"
1873  x="$Argon_x"
1874  y="$Argon_y"
1875  z="$Argon_z"/>
1876 
1877  <box name="GaseousArgon" lunit="cm"
1878  x="$HeightGaseousAr"
1879  y="$Argon_y"
1880  z="$Argon_z"/>
1881 
1882  <subtraction name="SteelShell">
1883  <first ref="Cryostat"/>
1884  <second ref="ArgonInterior"/>
1885  </subtraction>
1886 
1887 </solids>
1888 EOF
1889 
1890 # Cryostat structure
1891 print CRYO <<EOF;
1892 <structure>
1893  <volume name="volSteelShell">
1894  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1895  <solidref ref="SteelShell" />
1896  </volume>
1897  <volume name="volGaseousArgon">
1898  <materialref ref="ArGas"/>
1899  <solidref ref="GaseousArgon"/>
1900 
1901 EOF
1902  if ( $LEMs_switch eq "on" )
1903  {
1904 
1905 $posLEMsX = -0.5*$HeightGaseousAr+0.5+0.5*$LEMsSizeX;
1906 $posLEMsY = 0;
1907 $posLEMsZ = 0;
1908 
1909  print CRYO <<EOF;
1910  <physvol>
1911  <volumeref ref="volLEMs"/>
1912  <position name="posLEMs" unit="cm" x="$posLEMsX" y="$posLEMsY" z="$posLEMsZ"/>
1913 
1914  </physvol>
1915 EOF
1916 
1917  }
1918  print CRYO <<EOF;
1919  </volume>
1920 
1921  <volume name="volCryostat">
1922  <materialref ref="LAr" />
1923  <solidref ref="Cryostat" />
1924  <physvol>
1925  <volumeref ref="volGaseousArgon"/>
1926  <position name="posGaseousArgon" unit="cm" x="@{[$Argon_x/2-$HeightGaseousAr/2]}" y="0" z="0"/>
1927  </physvol>
1928  <physvol>
1929  <volumeref ref="volSteelShell"/>
1930  <position name="posSteelShell" unit="cm" x="0" y="0" z="0"/>
1931  </physvol>
1932 EOF
1933 
1934 
1935 if ($tpc_on==1) # place TPC inside croysotat
1936 {
1937 $posX = $Argon_x/2 - $HeightGaseousAr - 0.5*($driftTPCActive + $ReadoutPlane);
1938 $posY = -0.5*$Argon_y + $yLArBuffer;
1939 $posZ = -0.5*$Argon_z + $zLArBuffer;
1940 
1941 @crp_posy = ( $posY+1.5*$lengthCRM, $posY+1.5*$lengthCRM, $posY+0.5*$lengthCRM, $posY+0.5*$lengthCRM );
1942 @crp_posz = ( $posZ+1.5*$lengthCRM, $posZ+0.5*$lengthCRM, $posZ+0.5*$lengthCRM, $posZ+1.5*$lengthCRM );
1943 
1944 $idx = 0;
1945 foreach $posZ (@crp_posz) {
1946  $posY = @crp_posy[$idx];
1947  print CRYO <<EOF;
1948  <physvol>
1949  <volumeref ref="volTPC"/>
1950  <position name="posTPC\-$idx" unit="cm"
1951  x="$posX" y="$posY" z="$posZ"/>
1952  </physvol>
1953 EOF
1954 
1955  $idx++;
1956 }
1957 
1958 }
1959 
1960 
1961 
1962  if ( $pmt_switch eq "on" ) {
1963  $pmt_pos_x = -$Argon_x/2 + 0.5*($HeightPMT);
1964  for ( $i=0; $i<36; $i=$i+1 ) { # pmts with coating
1965  print CRYO <<EOF;
1966  <physvol>
1967  <volumeref ref="volPMT_coated"/>
1968  <position name="posPMT$i" unit="cm" x="$pmt_pos_x" @pmt_pos[$i]/>
1969  <rotationref ref="rMinus90AboutY"/>
1970  </physvol>
1971 EOF
1972  }
1973 
1974  }
1975 
1976 $GroundGridPosX=-$Argon_x/2 + 47.5;
1977 $GroundGridPosY=0.5*($GroundGridInnerStructureLength+2+$GroundGridOuterRadious);
1978 
1979  if ( $GroundGrid_switch eq "on" )
1980  {
1981  print CRYO <<EOF;
1982  <physvol>
1983  <volumeref ref="volGroundGrid"/>
1984  <position name="posGroundGrid01" unit="cm" x="$GroundGridPosX" y="@{[-$GroundGridPosY]}" z="@{[$GroundGridPosY]}"/>
1985  <rotation name="rotGG01" unit="deg" x="0" y="0" z="90" />
1986  </physvol>
1987 
1988  <physvol>
1989  <volumeref ref="volGroundGrid"/>
1990  <position name="posGroundGrid02" unit="cm" x="$GroundGridPosX" y="@{[-$GroundGridPosY]}" z="@{[-$GroundGridPosY]}"/>
1991  <rotation name="rotGG02" unit="deg" x="0" y="180" z="90" />
1992  </physvol>
1993 
1994  <physvol>
1995  <volumeref ref="volGroundGrid"/>
1996  <position name="posGroundGrid03" unit="cm" x="$GroundGridPosX" y="@{[$GroundGridPosY]}" z="@{[-$GroundGridPosY]}"/>
1997  <rotation name="rotGG03" unit="deg" x="180" y="0" z="90" />
1998  </physvol>
1999 
2000  <physvol>
2001  <volumeref ref="volGroundGrid"/>
2002  <position name="posGroundGrid04" unit="cm" x="$GroundGridPosX" y="@{[$GroundGridPosY]}" z="@{[$GroundGridPosY]}"/>
2003  <rotation name="rotGG04" unit="deg" x="180" y="180" z="90"/>
2004  </physvol>
2005 EOF
2006 
2007  }
2008 
2009 $CathodePosX=-$Argon_x/2 + 47.5 + 94.0 - 0.5*$CathodeSupportDistance-5.1;
2010 $CathodePosY=0.5*($CathodeInnerStructureLength+2+$CathodeOuterRadious);
2011 
2012  if ( $Cathode_switch eq "on" )
2013  {
2014  print CRYO <<EOF;
2015  <physvol>
2016  <volumeref ref="volCathode"/>
2017  <position name="posCathode01" unit="cm" x="$CathodePosX" y="@{[-$CathodePosY]}" z="@{[$CathodePosY]}"/>
2018  <rotation name="rotCath01" unit="deg" x="0" y="0" z="90" />
2019  </physvol>
2020 
2021  <physvol>
2022  <volumeref ref="volCathode"/>
2023  <position name="posCathode02" unit="cm" x="$CathodePosX" y="@{[-$CathodePosY]}" z="@{[-$CathodePosY]}"/>
2024  <rotation name="rotCath02" unit="deg" x="270" y="0" z="90" />
2025  </physvol>
2026 
2027  <physvol>
2028  <volumeref ref="volCathode"/>
2029  <position name="posCathode03" unit="cm" x="$CathodePosX" y="@{[$CathodePosY]}" z="@{[-$CathodePosY]}"/>
2030  <rotation name="rotCath03" unit="deg" x="180" y="0" z="90" />
2031  </physvol>
2032 
2033  <physvol>
2034  <volumeref ref="volCathode"/>
2035  <position name="posCathode04" unit="cm" x="$CathodePosX" y="@{[$CathodePosY]}" z="@{[$CathodePosY]}"/>
2036  <rotation name="rotCath04" unit="deg" x="90" y="0" z="90"/>
2037  </physvol>
2038 EOF
2039 
2040  }
2041 
2042  if ( $FieldCage_switch eq "on" )
2043  {
2044 
2045 $FFSPositionX = -$OriginXSet-1.3;
2046 $FFSPositionY = 309.593;
2047 $FFSPositionZ = 153.521;
2048  print CRYO <<EOF;
2049  <physvol>
2050  <volumeref ref="volFieldCageModule"/>
2051  <position name="posFieldCageModule01" unit="cm" x="$FFSPositionX" y="$FFSPositionY" z="$FFSPositionZ"/>
2052  <rotationref ref="rPlus90AboutY"/>
2053  </physvol>
2054 EOF
2055 $FFSPositionX = -$OriginXSet-1.3;
2056 $FFSPositionY = 309.593;
2057 $FFSPositionZ = -153.521;
2058  print CRYO <<EOF;
2059  <physvol>
2060  <volumeref ref="volFieldCageModule"/>
2061  <position name="posFieldCageModule02" unit="cm" x="$FFSPositionX" y="$FFSPositionY" z="$FFSPositionZ"/>
2062  <rotationref ref="rMinus90AboutY"/>
2063  </physvol>
2064 EOF
2065 $FFSPositionX = -$OriginXSet-1.3;
2066 $FFSPositionY = -309.593;
2067 $FFSPositionZ = -153.521;
2068  print CRYO <<EOF;
2069  <physvol>
2070  <volumeref ref="volFieldCageModule"/>
2071  <position name="posFieldCageModule05" unit="cm" x="$FFSPositionX" y="$FFSPositionY" z="$FFSPositionZ"/>
2072  <rotationref ref="rot05"/>
2073 
2074  </physvol>
2075 EOF
2076 $FFSPositionX = -$OriginXSet-1.3;
2077 $FFSPositionY = -309.593;
2078 $FFSPositionZ = 153.521;
2079  print CRYO <<EOF;
2080  <physvol>
2081  <volumeref ref="volFieldCageModule"/>
2082  <position name="posFieldCageModule06" unit="cm" x="$FFSPositionX" y="$FFSPositionY" z="$FFSPositionZ"/>
2083  <rotationref ref="rot06"/>
2084 
2085  </physvol>
2086 EOF
2087 
2088 $FFSPositionX = -$OriginXSet-1.3;
2089 $FFSPositionY = 153.521;
2090 $FFSPositionZ = -309.593;
2091  print CRYO <<EOF;
2092  <physvol>
2093  <volumeref ref="volFieldCageModule"/>
2094  <position name="posFieldCageModule03" unit="cm" x="$FFSPositionX" y="$FFSPositionY" z="$FFSPositionZ"/>
2095  <rotationref ref="rot03"/>
2096 
2097  </physvol>
2098 EOF
2099 $FFSPositionX = -$OriginXSet-1.3;
2100 $FFSPositionY = -153.521;
2101 $FFSPositionZ = -309.593;
2102  print CRYO <<EOF;
2103  <physvol>
2104  <volumeref ref="volFieldCageModule"/>
2105  <position name="posFieldCageModule04" unit="cm" x="$FFSPositionX" y="$FFSPositionY" z="$FFSPositionZ"/>
2106  <rotationref ref="rot04"/>
2107 
2108  </physvol>
2109 EOF
2110 $FFSPositionX = -$OriginXSet-1.3;
2111 $FFSPositionY = -153.521;
2112 $FFSPositionZ = 309.593;
2113  print CRYO <<EOF;
2114  <physvol>
2115  <volumeref ref="volFieldCageModule"/>
2116  <position name="posFieldCageModule07" unit="cm" x="$FFSPositionX" y="$FFSPositionY" z="$FFSPositionZ"/>
2117  <rotationref ref="rot07"/>
2118 
2119  </physvol>
2120 EOF
2121 $FFSPositionX = -$OriginXSet-1.3;
2122 $FFSPositionY = 153.521;
2123 $FFSPositionZ = 309.593;
2124  print CRYO <<EOF;
2125  <physvol>
2126  <volumeref ref="volFieldCageModule"/>
2127  <position name="posFieldCageModule08" unit="cm" x="$FFSPositionX" y="$FFSPositionY" z="$FFSPositionZ"/>
2128  <rotationref ref="rot08"/>
2129 
2130  </physvol>
2131 EOF
2132 
2133  }
2134 
2135 
2136 print CRYO <<EOF;
2137  </volume>
2138 </structure>
2139 </gdml>
2140 EOF
2141 
2142 close(CRYO);
2143 }
2144 
2145 
2146 
2147 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2148 #+++++++++++++++++++++++++++++++++++++ gen_Enclosure +++++++++++++++++++++++++++++++++++++
2149 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2150 
2151 sub gen_Enclosure()
2152 {
2153 
2154 # Create the detector enclosure fragment file name,
2155 # add file to list of output GDML fragments,
2156 # and open it
2157  $ENCL = $basename."_DetEnclosure" . $suffix . ".gdml";
2158  push (@gdmlFiles, $ENCL);
2159  $ENCL = ">" . $ENCL;
2160  open(ENCL) or die("Could not open file $ENCL for writing");
2161 
2162 
2163 # The standard XML prefix and starting the gdml
2164  print ENCL <<EOF;
2165 <?xml version='1.0'?>
2166 <gdml>
2167 EOF
2168 
2169 
2170 # All the detector enclosure solids.
2171 print ENCL <<EOF;
2172 <solids>
2173 
2174  <box name="FoamPadBlock" lunit="cm"
2175  x="@{[$Cryostat_x + 2*$FoamPadding]}"
2176  y="@{[$Cryostat_y + 2*$FoamPadding]}"
2177  z="@{[$Cryostat_z + 2*$FoamPadding]}" />
2178 
2179  <subtraction name="FoamPadding">
2180  <first ref="FoamPadBlock"/>
2181  <second ref="Cryostat"/>
2182  <positionref ref="posCenter"/>
2183  </subtraction>
2184 
2185 
2186  <box name="SteelSupportBlock" lunit="cm"
2187  x="@{[$Cryostat_x + 2*$FoamPadding + 2*$SteelSupport_x]}"
2188  y="@{[$Cryostat_y + 2*$FoamPadding + 2*$SteelSupport_y]}"
2189  z="@{[$Cryostat_z + 2*$FoamPadding + 2*$SteelSupport_z]}" />
2190 
2191  <subtraction name="SteelSupport">
2192  <first ref="SteelSupportBlock"/>
2193  <second ref="FoamPadBlock"/>
2194  <positionref ref="posCenter"/>
2195  </subtraction>
2196 
2197 
2198  <box name="DetEnclosure" lunit="cm"
2199  x="$DetEncWidth"
2200  y="$DetEncHeight"
2201  z="$DetEncLength"/>
2202 
2203  <box name="boxCryoTop" x="1016.8" y="1016.8" z="61.8" lunit="cm"/>
2204  <box name="boxCryoWallLg" x="1140.4" y="1075.6" z="61.8" lunit="cm"/>
2205  <box name="boxCryoWallSm" x="1016.8" y="1075.6" z="61.8" lunit="cm"/>
2206  <box name="box1" x="160" y="160" z="61.8" lunit="cm"/>
2207  <box name="box2" x="158.2" y="158.2" z="56.2" lunit="cm"/>
2208  <box name="box3" x="137.2" y="137.2" z="61.801" lunit="cm"/>
2209  <box name="box4" x="158.2" y="13.6" z="27.4" lunit="cm"/>
2210  <box name="box5" x="158.2" y="6.425" z="24.96" lunit="cm"/>
2211  <box name="box11" x="108.4" y="160" z="61.8" lunit="cm"/>
2212  <box name="box12" x="107.5" y="158.2" z="56.2" lunit="cm"/>
2213  <box name="box13" x="97" y="137.2" z="61.81" lunit="cm"/>
2214  <box name="box16" x="107.5" y="13.6" z="27.4" lunit="cm"/>
2215  <box name="box17" x="107.5" y="6.425" z="24.96" lunit="cm"/>
2216  <box name="box21" x="137.8" y="160" z="61.8" lunit="cm"/>
2217  <box name="box22" x="136.9" y="158.2" z="56.2" lunit="cm"/>
2218  <box name="box23" x="126.4" y="137.2" z="61.801" lunit="cm"/>
2219  <box name="box26" x="102.5" y="13.6" z="27.4" lunit="cm"/>
2220  <box name="box27" x="102.5" y="6.425" z="24.96" lunit="cm"/>
2221  <box name="box31" x="170.2" y="160" z="61.8" lunit="cm"/>
2222  <box name="box32" x="169.3" y="158.2" z="56.2" lunit="cm"/>
2223  <box name="box33" x="158.8" y="137.2" z="61.801" lunit="cm"/>
2224  <box name="box36" x="135.8" y="13.6" z="27.4" lunit="cm"/>
2225  <box name="box37" x="135.8" y="6.425" z="24.96" lunit="cm"/>
2226 
2227 
2228  <subtraction name="boxHoll">
2229  <first ref="box1"/>
2230  <second ref="box2"/>
2231  </subtraction>
2232  <subtraction name="boxLargeCent">
2233  <first ref="boxHoll"/>
2234  <second ref="box3"/>
2235  </subtraction>
2236  <subtraction name="boxBarI">
2237  <first ref="box4"/>
2238  <second ref="box5"/>
2239  <position name="posBoxBarI" x="0" y="3.5876" z="0" unit="cm"/>
2240  </subtraction>
2241  <subtraction name="boxBarCent">
2242  <first ref="boxBarI"/>
2243  <second ref="box5"/>
2244  <position name="posBoxBarCent" x="0" y="-3.5876" z="0" unit="cm"/>
2245  </subtraction>
2246  <union name="boxUniCent">
2247  <first ref="boxLargeCent"/>
2248  <second ref="boxBarCent"/>
2249  <position name="posBoxUniCent" x="0" y="0" z="-17.2" unit="cm"/>
2250  </union>
2251  <union name="UnitCent">
2252  <first ref="boxUniCent"/>
2253  <second ref="boxBarCent"/>
2254  <position name="posUnitCent" x="0" y="0" z="-17.2" unit="cm"/>
2255  <rotation name="rotUnitCent" x="0" y="0" z="90" unit="deg"/>
2256  </union>
2257 
2258  <subtraction name="boxTopHoll">
2259  <first ref="box11"/>
2260  <second ref="box12"/>
2261  <position name="posboxTopHoll" x="0.451" y="0" z="0" unit="cm"/>
2262  </subtraction>
2263  <subtraction name="boxLargeTop">
2264  <first ref="boxTopHoll"/>
2265  <second ref="box13"/>
2266  <position name="posboxLargeTop" x="5.701" y="0" z="0" unit="cm"/>
2267  </subtraction>
2268  <subtraction name="boxBarTopI">
2269  <first ref="box16"/>
2270  <second ref="box17"/>
2271  <position name="posboxBarTopI" x="0" y="3.5876" z="0" unit="cm"/>
2272  </subtraction>
2273  <subtraction name="boxBarTop">
2274  <first ref="boxBarTopI"/>
2275  <second ref="box17"/>
2276  <position name="posboxBarTop" x="0" y="-3.5876" z="0" unit="cm"/>
2277  </subtraction>
2278  <union name="boxUniTop">
2279  <first ref="boxLargeTop"/>
2280  <second ref="boxBarCent"/>
2281  <position name="posboxUni1" x="5.6" y="0" z="-17.2" unit="cm"/>
2282  <rotation name="rotUni1" x="0" y="0" z="90" unit="deg"/>
2283  </union>
2284  <union name="UnitTop">
2285  <first ref="boxUniTop"/>
2286  <second ref="boxBarTop"/>
2287  <position name="posUniTop" x="0.45" y="0" z="-17.2" unit="cm"/>
2288  </union>
2289 
2290  <!--
2291  <subtraction name="boxCryoWallSmUS">
2292  <first ref="boxCryoWallSm"/>
2293  <second ref="BeamWindowStSu"/>
2294  <position name="posBWCryoWallUS" x="-34.5198845542345" y="131.897988017573" z="0." unit="cm"/>
2295  < rotationref ref="rBeamW3"/>
2296  </subtraction>
2297  -->
2298 
2299  <subtraction name="boxWallUHoll">
2300  <first ref="box21"/>
2301  <second ref="box22"/>
2302  <position name="posboxWallUHoll" x="0.451" y="0" z="0" unit="cm"/>
2303  </subtraction>
2304  <subtraction name="boxLargeWallU">
2305  <first ref="boxWallUHoll"/>
2306  <second ref="box23"/>
2307  <position name="posboxLargeWallU" x="5.701" y="0" z="0" unit="cm"/>
2308  </subtraction>
2309  <subtraction name="boxBarWallUI">
2310  <first ref="box26"/>
2311  <second ref="box27"/>
2312  <position name="posboxBarWallUI" x="0" y="3.5876" z="0" unit="cm"/>
2313  </subtraction>
2314  <subtraction name="boxBarWallU">
2315  <first ref="boxBarWallUI"/>
2316  <second ref="box27"/>
2317  <position name="posboxBarWallU" x="0" y="-3.5876" z="0" unit="cm"/>
2318  </subtraction>
2319  <union name="boxUniWallU">
2320  <first ref="boxLargeWallU"/>
2321  <second ref="boxBarCent"/>
2322  <position name="posboxUni2" x="-9.1" y="0" z="-17.2" unit="cm"/>
2323  <rotation name="rotUni2" x="0" y="0" z="90" unit="deg"/>
2324  </union>
2325  <union name="UnitWallU">
2326  <first ref="boxUniWallU"/>
2327  <second ref="boxBarWallU"/>
2328  <position name="posUniWallU" x="-16.75" y="0" z="-17.2" unit="cm"/>
2329  </union>
2330 
2331  <subtraction name="boxWallLHoll">
2332  <first ref="box31"/>
2333  <second ref="box32"/>
2334  <position name="posboxWallLHoll" x="0.451" y="0" z="0" unit="cm"/>
2335  </subtraction>
2336  <subtraction name="boxLargeWallL">
2337  <first ref="boxWallLHoll"/>
2338  <second ref="box33"/>
2339  <position name="posboxLargeWallL" x="5.701" y="0" z="0" unit="cm"/>
2340  </subtraction>
2341  <subtraction name="boxBarWallLI">
2342  <first ref="box36"/>
2343  <second ref="box37"/>
2344  <position name="posboxBarWallLI" x="0" y="3.5876" z="0" unit="cm"/>
2345  </subtraction>
2346  <subtraction name="boxBarWallL">
2347  <first ref="boxBarWallLI"/>
2348  <second ref="box37"/>
2349  <position name="posboxBarWallL" x="0" y="-3.5876" z="0" unit="cm"/>
2350  </subtraction>
2351  <union name="boxUniWallL">
2352  <first ref="boxLargeWallL"/>
2353  <second ref="boxBarCent"/>
2354  <position name="posboxUni3" x="-25.3" y="0" z="-17.2" unit="cm"/>
2355  <rotation name="rotUni3" x="0" y="0" z="90" unit="deg"/>
2356  </union>
2357  <union name="UnitWallL">
2358  <first ref="boxUniWallL"/>
2359  <second ref="boxBarWallL"/>
2360  <position name="posUniWallL" x="-16.3" y="0" z="-17.2" unit="cm"/>
2361  </union>
2362 
2363 
2364 </solids>
2365 EOF
2366 
2367 
2368 # Detector enclosure structure
2369  print ENCL <<EOF;
2370 <structure>
2371  <volume name="volFoamPadding">
2372  <materialref ref="foam_protoDUNEdp"/>
2373  <solidref ref="FoamPadding"/>
2374  </volume>
2375 
2376  <volume name="volSteelSupport">
2377  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
2378  <solidref ref="SteelSupport"/>
2379  </volume>
2380 
2381  <volume name="volUnitCent">
2382  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
2383  <solidref ref="UnitCent"/>
2384  </volume>
2385  <volume name="volUnitTop">
2386  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
2387  <solidref ref="UnitTop"/>
2388  </volume>
2389  <volume name="volUnitWallS">
2390  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
2391  <solidref ref="UnitWallU"/>
2392  </volume>
2393  <volume name="volUnitWallL">
2394  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
2395  <solidref ref="UnitWallL"/>
2396  </volume>
2397 
2398  <volume name="volSteelSupport_TB">
2399  <materialref ref="Air"/>
2400  <solidref ref="boxCryoTop"/>
2401  <physvol name="volUnitTBCent_0-0">
2402  <volumeref ref="volUnitCent"/>
2403  <position name="posUnitTBCent_0-0" x="-320" y="-320" z="0" unit="cm"/>
2404  </physvol>
2405  <physvol name="volUnitTBCent_0-1">
2406  <volumeref ref="volUnitCent"/>
2407  <position name="posUnitTBCent_0-1" x="-320" y="-160" z="0" unit="cm"/>
2408  </physvol>
2409  <physvol name="volUnitTBCent_0-2">
2410  <volumeref ref="volUnitCent"/>
2411  <position name="posUnitTBCent_0-2" x="-320" y="0" z="0" unit="cm"/>
2412  </physvol>
2413  <physvol name="volUnitTBCent_0-3">
2414  <volumeref ref="volUnitCent"/>
2415  <position name="posUnitTBCent_0-3" x="-320" y="160" z="0" unit="cm"/>
2416  </physvol>
2417  <physvol name="volUnitTBCent_0-4">
2418  <volumeref ref="volUnitCent"/>
2419  <position name="posUnitTBCent_0-4" x="-320" y="320" z="0" unit="cm"/>
2420  </physvol>
2421  <physvol name="volUnitTBE_0">
2422  <volumeref ref="volUnitTop"/>
2423  <position name="posUnitTBE_0" x="454.2" y="-320" z="0" unit="cm"/>
2424  </physvol>
2425  <physvol name="volUnitTBS_0">
2426  <volumeref ref="volUnitTop"/>
2427  <position name="posUnitTBS_0" x="-320" y="454.2" z="0" unit="cm"/>
2428  <rotation name="rotUnitTBS_0" x="0" y="0" z="-90" unit="deg"/>
2429  </physvol>
2430  <physvol name="volUnitTBW_0">
2431  <volumeref ref="volUnitTop"/>
2432  <position name="posUnitTBW_0" x="-454.2" y="-320" z="0" unit="cm"/>
2433  <rotation name="rotUnitTBW_0" x="0" y="0" z="-180" unit="deg"/>
2434  </physvol>
2435  <physvol name="volUnitTBN_0">
2436  <volumeref ref="volUnitTop"/>
2437  <position name="posUnitTBN_0" x="-320" y="-454.2" z="0" unit="cm"/>
2438  <rotation name="rotUnitTBN_0" x="0" y="0" z="-270" unit="deg"/>
2439  </physvol>
2440  <physvol name="volUnitTBCent_1-0">
2441  <volumeref ref="volUnitCent"/>
2442  <position name="posUnitTBCent_1-0" x="-160" y="-320" z="0" unit="cm"/>
2443  </physvol>
2444  <physvol name="volUnitTBCent_1-1">
2445  <volumeref ref="volUnitCent"/>
2446  <position name="posUnitTBCent_1-1" x="-160" y="-160" z="0" unit="cm"/>
2447  </physvol>
2448  <physvol name="volUnitTBCent_1-2">
2449  <volumeref ref="volUnitCent"/>
2450  <position name="posUnitTBCent_1-2" x="-160" y="0" z="0" unit="cm"/>
2451  </physvol>
2452  <physvol name="volUnitTBCent_1-3">
2453  <volumeref ref="volUnitCent"/>
2454  <position name="posUnitTBCent_1-3" x="-160" y="160" z="0" unit="cm"/>
2455  </physvol>
2456  <physvol name="volUnitTBCent_1-4">
2457  <volumeref ref="volUnitCent"/>
2458  <position name="posUnitTBCent_1-4" x="-160" y="320" z="0" unit="cm"/>
2459  </physvol>
2460  <physvol name="volUnitTBE_1">
2461  <volumeref ref="volUnitTop"/>
2462  <position name="posUnitTBE_1" x="454.2" y="-160" z="0" unit="cm"/>
2463  </physvol>
2464  <physvol name="volUnitTBS_1">
2465  <volumeref ref="volUnitTop"/>
2466  <position name="posUnitTBS_1" x="-160" y="454.2" z="0" unit="cm"/>
2467  <rotation name="rotUnitTBS_1" x="0" y="0" z="-90" unit="deg"/>
2468  </physvol>
2469  <physvol name="volUnitTBW_1">
2470  <volumeref ref="volUnitTop"/>
2471  <position name="posUnitTBW_1" x="-454.2" y="-160" z="0" unit="cm"/>
2472  <rotation name="rotUnitTBW_1" x="0" y="0" z="-180" unit="deg"/>
2473  </physvol>
2474  <physvol name="volUnitTBN_1">
2475  <volumeref ref="volUnitTop"/>
2476  <position name="posUnitTBN_1" x="-160" y="-454.2" z="0" unit="cm"/>
2477  <rotation name="rotUnitTBN_1" x="0" y="0" z="-270" unit="deg"/>
2478  </physvol>
2479  <physvol name="volUnitTBCent_2-0">
2480  <volumeref ref="volUnitCent"/>
2481  <position name="posUnitTBCent_2-0" x="0" y="-320" z="0" unit="cm"/>
2482  </physvol>
2483  <physvol name="volUnitTBCent_2-1">
2484  <volumeref ref="volUnitCent"/>
2485  <position name="posUnitTBCent_2-1" x="0" y="-160" z="0" unit="cm"/>
2486  </physvol>
2487  <physvol name="volUnitTBCent_2-2">
2488  <volumeref ref="volUnitCent"/>
2489  <position name="posUnitTBCent_2-2" x="0" y="0" z="0" unit="cm"/>
2490  </physvol>
2491  <physvol name="volUnitTBCent_2-3">
2492  <volumeref ref="volUnitCent"/>
2493  <position name="posUnitTBCent_2-3" x="0" y="160" z="0" unit="cm"/>
2494  </physvol>
2495  <physvol name="volUnitTBCent_2-4">
2496  <volumeref ref="volUnitCent"/>
2497  <position name="posUnitTBCent_2-4" x="0" y="320" z="0" unit="cm"/>
2498  </physvol>
2499  <physvol name="volUnitTBE_2">
2500  <volumeref ref="volUnitTop"/>
2501  <position name="posUnitTBE_2" x="454.2" y="0" z="0" unit="cm"/>
2502  </physvol>
2503  <physvol name="volUnitTBS_2">
2504  <volumeref ref="volUnitTop"/>
2505  <position name="posUnitTBS_2" x="0" y="454.2" z="0" unit="cm"/>
2506  <rotation name="rotUnitTBS_2" x="0" y="0" z="-90" unit="deg"/>
2507  </physvol>
2508  <physvol name="volUnitTBW_2">
2509  <volumeref ref="volUnitTop"/>
2510  <position name="posUnitTBW_2" x="-454.2" y="0" z="0" unit="cm"/>
2511  <rotation name="rotUnitTBW_2" x="0" y="0" z="-180" unit="deg"/>
2512  </physvol>
2513  <physvol name="volUnitTBN_2">
2514  <volumeref ref="volUnitTop"/>
2515  <position name="posUnitTBN_2" x="0" y="-454.2" z="0" unit="cm"/>
2516  <rotation name="rotUnitTBN_2" x="0" y="0" z="-270" unit="deg"/>
2517  </physvol>
2518  <physvol name="volUnitTBCent_3-0">
2519  <volumeref ref="volUnitCent"/>
2520  <position name="posUnitTBCent_3-0" x="160" y="-320" z="0" unit="cm"/>
2521  </physvol>
2522  <physvol name="volUnitTBCent_3-1">
2523  <volumeref ref="volUnitCent"/>
2524  <position name="posUnitTBCent_3-1" x="160" y="-160" z="0" unit="cm"/>
2525  </physvol>
2526  <physvol name="volUnitTBCent_3-2">
2527  <volumeref ref="volUnitCent"/>
2528  <position name="posUnitTBCent_3-2" x="160" y="0" z="0" unit="cm"/>
2529  </physvol>
2530  <physvol name="volUnitTBCent_3-3">
2531  <volumeref ref="volUnitCent"/>
2532  <position name="posUnitTBCent_3-3" x="160" y="160" z="0" unit="cm"/>
2533  </physvol>
2534  <physvol name="volUnitTBCent_3-4">
2535  <volumeref ref="volUnitCent"/>
2536  <position name="posUnitTBCent_3-4" x="160" y="320" z="0" unit="cm"/>
2537  </physvol>
2538  <physvol name="volUnitTBE_3">
2539  <volumeref ref="volUnitTop"/>
2540  <position name="posUnitTBE_3" x="454.2" y="160" z="0" unit="cm"/>
2541  </physvol>
2542  <physvol name="volUnitTBS_3">
2543  <volumeref ref="volUnitTop"/>
2544  <position name="posUnitTBS_3" x="160" y="454.2" z="0" unit="cm"/>
2545  <rotation name="rotUnitTBS_3" x="0" y="0" z="-90" unit="deg"/>
2546  </physvol>
2547  <physvol name="volUnitTBW_3">
2548  <volumeref ref="volUnitTop"/>
2549  <position name="posUnitTBW_3" x="-454.2" y="160" z="0" unit="cm"/>
2550  <rotation name="rotUnitTBW_3" x="0" y="0" z="-180" unit="deg"/>
2551  </physvol>
2552  <physvol name="volUnitTBN_3">
2553  <volumeref ref="volUnitTop"/>
2554  <position name="posUnitTBN_3" x="160" y="-454.2" z="0" unit="cm"/>
2555  <rotation name="rotUnitTBN_3" x="0" y="0" z="-270" unit="deg"/>
2556  </physvol>
2557  <physvol name="volUnitTBCent_4-0">
2558  <volumeref ref="volUnitCent"/>
2559  <position name="posUnitTBCent_4-0" x="320" y="-320" z="0" unit="cm"/>
2560  </physvol>
2561  <physvol name="volUnitTBCent_4-1">
2562  <volumeref ref="volUnitCent"/>
2563  <position name="posUnitTBCent_4-1" x="320" y="-160" z="0" unit="cm"/>
2564  </physvol>
2565  <physvol name="volUnitTBCent_4-2">
2566  <volumeref ref="volUnitCent"/>
2567  <position name="posUnitTBCent_4-2" x="320" y="0" z="0" unit="cm"/>
2568  </physvol>
2569  <physvol name="volUnitTBCent_4-3">
2570  <volumeref ref="volUnitCent"/>
2571  <position name="posUnitTBCent_4-3" x="320" y="160" z="0" unit="cm"/>
2572  </physvol>
2573  <physvol name="volUnitTBCent_4-4">
2574  <volumeref ref="volUnitCent"/>
2575  <position name="posUnitTBCent_4-4" x="320" y="320" z="0" unit="cm"/>
2576  </physvol>
2577  <physvol name="volUnitTBE_4">
2578  <volumeref ref="volUnitTop"/>
2579  <position name="posUnitTBE_4" x="454.2" y="320" z="0" unit="cm"/>
2580  </physvol>
2581  <physvol name="volUnitTBS_4">
2582  <volumeref ref="volUnitTop"/>
2583  <position name="posUnitTBS_4" x="320" y="454.2" z="0" unit="cm"/>
2584  <rotation name="rotUnitTBS_4" x="0" y="0" z="-90" unit="deg"/>
2585  </physvol>
2586  <physvol name="volUnitTBW_4">
2587  <volumeref ref="volUnitTop"/>
2588  <position name="posUnitTBW_4" x="-454.2" y="320" z="0" unit="cm"/>
2589  <rotation name="rotUnitTBW_4" x="0" y="0" z="-180" unit="deg"/>
2590  </physvol>
2591  <physvol name="volUnitTBN_4">
2592  <volumeref ref="volUnitTop"/>
2593  <position name="posUnitTBN_4" x="320" y="-454.2" z="0" unit="cm"/>
2594  <rotation name="rotUnitTBN_4" x="0" y="0" z="-270" unit="deg"/>
2595  </physvol>
2596  </volume>
2597 
2598 
2599  <volume name="volSteelSupport_US">
2600  <materialref ref="Air"/>
2601  <solidref ref="boxCryoWallSm"/>
2602 
2603  <physvol name="volUnitUSCent_0-0">
2604  <volumeref ref="volUnitCent"/>
2605  <position name="posUnitUSCent_0-0" x="-320" y="-320" z="0" unit="cm"/>
2606  <rotationref ref="rPlus180AboutY"/>
2607  </physvol>
2608 
2609  <physvol name="volUnitUSCent_0-1">
2610  <volumeref ref="volUnitCent"/>
2611  <position name="posUnitUSCent_0-1" x="-320" y="-160" z="0" unit="cm"/>
2612  <rotationref ref="rPlus180AboutY"/>
2613  </physvol>
2614 
2615  <physvol name="volUnitUSCent_0-2">
2616  <volumeref ref="volUnitCent"/>
2617  <position name="posUnitUSCent_0-2" x="-320" y="0" z="0" unit="cm"/>
2618  <rotationref ref="rPlus180AboutY"/>
2619  </physvol>
2620 
2621  <physvol name="volUnitUSCent_0-3">
2622  <volumeref ref="volUnitCent"/>
2623  <position name="posUnitUSCent_0-3" x="-320" y="160" z="0" unit="cm"/>
2624  <rotationref ref="rPlus180AboutY"/>
2625  </physvol>
2626 
2627  <physvol name="volUnitUSCent_0-4">
2628  <volumeref ref="volUnitCent"/>
2629  <position name="posUnitUSCent_0-4" x="-320" y="320" z="0" unit="cm"/>
2630  <rotationref ref="rPlus180AboutY"/>
2631  </physvol>
2632  <physvol name="volUnitUSE_0">
2633  <volumeref ref="volUnitTop"/>
2634  <position name="posUnitUSE_0" x="454.2" y="-320" z="0" unit="cm"/>
2635  <rotationref ref="rPlus180AboutX"/>
2636  </physvol>
2637  <physvol name="volUnitUSS_0">
2638  <volumeref ref="volUnitWallS"/>
2639  <position name="posUnitUSS_0" x="-320" y="468.9" z="0" unit="cm"/>
2640  <rotation name="rotUnitUSS_0" x="0" y="180" z="-90" unit="deg"/>
2641  </physvol>
2642  <physvol name="volUnitUSW_0">
2643  <volumeref ref="volUnitTop"/>
2644  <position name="posUnitUSW_0" x="-454.2" y="-320" z="0" unit="cm"/>
2645  <rotation name="rotUnitUSW_0" x="180" y="0" z="-180" unit="deg"/>
2646  </physvol>
2647  <physvol name="volUnitUSN_0">
2648  <volumeref ref="volUnitWallS"/>
2649  <position name="posUnitUSN_0" x="-320" y="-468.9" z="0" unit="cm"/>
2650  <rotation name="rotUnitUSN_0" x="0" y="180" z="-270" unit="deg"/>
2651  </physvol>
2652 
2653 
2654  <physvol name="volUnitUSCent_1-0">
2655  <volumeref ref="volUnitCent"/>
2656  <position name="posUnitUSCent_1-0" x="-160" y="-320" z="0" unit="cm"/>
2657  <rotationref ref="rPlus180AboutY"/>
2658  </physvol>
2659 
2660  <physvol name="volUnitUSCent_1-1">
2661  <volumeref ref="volUnitCent"/>
2662  <position name="posUnitUSCent_1-1" x="-160" y="-160" z="0" unit="cm"/>
2663  <rotationref ref="rPlus180AboutY"/>
2664  </physvol>
2665 
2666  <physvol name="volUnitUSCent_1-2">
2667  <volumeref ref="volUnitCent"/>
2668  <position name="posUnitUSCent_1-2" x="-160" y="0" z="0" unit="cm"/>
2669  <rotationref ref="rPlus180AboutY"/>
2670  </physvol>
2671 
2672  <physvol name="volUnitUSCent_1-3">
2673  <volumeref ref="volUnitCent"/>
2674  <position name="posUnitUSCent_1-3" x="-160" y="160" z="0" unit="cm"/>
2675  <rotationref ref="rPlus180AboutY"/>
2676  </physvol>
2677 
2678  <physvol name="volUnitUSCent_1-4">
2679  <volumeref ref="volUnitCent"/>
2680  <position name="posUnitUSCent_1-4" x="-160" y="320" z="0" unit="cm"/>
2681  <rotationref ref="rPlus180AboutY"/>
2682  </physvol>
2683  <physvol name="volUnitUSE_1">
2684  <volumeref ref="volUnitTop"/>
2685  <position name="posUnitUSE_1" x="454.2" y="-160" z="0" unit="cm"/>
2686  <rotationref ref="rPlus180AboutX"/>
2687  </physvol>
2688  <physvol name="volUnitUSS_1">
2689  <volumeref ref="volUnitWallS"/>
2690  <position name="posUnitUSS_1" x="-160" y="468.9" z="0" unit="cm"/>
2691  <rotation name="rotUnitUSS_1" x="0" y="180" z="-90" unit="deg"/>
2692  </physvol>
2693  <physvol name="volUnitUSW_1">
2694  <volumeref ref="volUnitTop"/>
2695  <position name="posUnitUSW_1" x="-454.2" y="-160" z="0" unit="cm"/>
2696  <rotation name="rotUnitUSW_1" x="180" y="0" z="-180" unit="deg"/>
2697  </physvol>
2698  <physvol name="volUnitUSN_1">
2699  <volumeref ref="volUnitWallS"/>
2700  <position name="posUnitUSN_1" x="-160" y="-468.9" z="0" unit="cm"/>
2701  <rotation name="rotUnitUSN_1" x="0" y="180" z="-270" unit="deg"/>
2702  </physvol>
2703 
2704 
2705  <physvol name="volUnitUSCent_2-0">
2706  <volumeref ref="volUnitCent"/>
2707  <position name="posUnitUSCent_2-0" x="0" y="-320" z="0" unit="cm"/>
2708  <rotationref ref="rPlus180AboutY"/>
2709  </physvol>
2710 
2711  <physvol name="volUnitUSCent_2-1">
2712  <volumeref ref="volUnitCent"/>
2713  <position name="posUnitUSCent_2-1" x="0" y="-160" z="0" unit="cm"/>
2714  <rotationref ref="rPlus180AboutY"/>
2715  </physvol>
2716 
2717  <physvol name="volUnitUSCent_2-2">
2718  <volumeref ref="volUnitCent"/>
2719  <position name="posUnitUSCent_2-2" x="0" y="0" z="0" unit="cm"/>
2720  <rotationref ref="rPlus180AboutY"/>
2721  </physvol>
2722 
2723  <physvol name="volUnitUSCent_2-3">
2724  <volumeref ref="volUnitCent"/>
2725  <position name="posUnitUSCent_2-3" x="0" y="160" z="0" unit="cm"/>
2726  <rotationref ref="rPlus180AboutY"/>
2727  </physvol>
2728 
2729  <physvol name="volUnitUSCent_2-4">
2730  <volumeref ref="volUnitCent"/>
2731  <position name="posUnitUSCent_2-4" x="0" y="320" z="0" unit="cm"/>
2732  <rotationref ref="rPlus180AboutY"/>
2733  </physvol>
2734  <physvol name="volUnitUSE_2">
2735  <volumeref ref="volUnitTop"/>
2736  <position name="posUnitUSE_2" x="454.2" y="0" z="0" unit="cm"/>
2737  <rotationref ref="rPlus180AboutX"/>
2738  </physvol>
2739  <physvol name="volUnitUSS_2">
2740  <volumeref ref="volUnitWallS"/>
2741  <position name="posUnitUSS_2" x="0" y="468.9" z="0" unit="cm"/>
2742  <rotation name="rotUnitUSS_2" x="0" y="180" z="-90" unit="deg"/>
2743  </physvol>
2744  <physvol name="volUnitUSW_2">
2745  <volumeref ref="volUnitTop"/>
2746  <position name="posUnitUSW_2" x="-454.2" y="0" z="0" unit="cm"/>
2747  <rotation name="rotUnitUSW_2" x="180" y="0" z="-180" unit="deg"/>
2748  </physvol>
2749  <physvol name="volUnitUSN_2">
2750  <volumeref ref="volUnitWallS"/>
2751  <position name="posUnitUSN_2" x="0" y="-468.9" z="0" unit="cm"/>
2752  <rotation name="rotUnitUSN_2" x="0" y="180" z="-270" unit="deg"/>
2753  </physvol>
2754 
2755 
2756  <physvol name="volUnitUSCent_3-0">
2757  <volumeref ref="volUnitCent"/>
2758  <position name="posUnitUSCent_3-0" x="160" y="-320" z="0" unit="cm"/>
2759  <rotationref ref="rPlus180AboutY"/>
2760  </physvol>
2761 
2762  <physvol name="volUnitUSCent_3-1">
2763  <volumeref ref="volUnitCent"/>
2764  <position name="posUnitUSCent_3-1" x="160" y="-160" z="0" unit="cm"/>
2765  <rotationref ref="rPlus180AboutY"/>
2766  </physvol>
2767 
2768  <physvol name="volUnitUSCent_3-2">
2769  <volumeref ref="volUnitCent"/>
2770  <position name="posUnitUSCent_3-2" x="160" y="0" z="0" unit="cm"/>
2771  <rotationref ref="rPlus180AboutY"/>
2772  </physvol>
2773 
2774  <physvol name="volUnitUSCent_3-3">
2775  <volumeref ref="volUnitCent"/>
2776  <position name="posUnitUSCent_3-3" x="160" y="160" z="0" unit="cm"/>
2777  <rotationref ref="rPlus180AboutY"/>
2778  </physvol>
2779 
2780  <physvol name="volUnitUSCent_3-4">
2781  <volumeref ref="volUnitCent"/>
2782  <position name="posUnitUSCent_3-4" x="160" y="320" z="0" unit="cm"/>
2783  <rotationref ref="rPlus180AboutY"/>
2784  </physvol>
2785  <physvol name="volUnitUSE_3">
2786  <volumeref ref="volUnitTop"/>
2787  <position name="posUnitUSE_3" x="454.2" y="160" z="0" unit="cm"/>
2788  <rotationref ref="rPlus180AboutX"/>
2789  </physvol>
2790  <physvol name="volUnitUSS_3">
2791  <volumeref ref="volUnitWallS"/>
2792  <position name="posUnitUSS_3" x="160" y="468.9" z="0" unit="cm"/>
2793  <rotation name="rotUnitUSS_3" x="0" y="180" z="-90" unit="deg"/>
2794  </physvol>
2795  <physvol name="volUnitUSW_3">
2796  <volumeref ref="volUnitTop"/>
2797  <position name="posUnitUSW_3" x="-454.2" y="160" z="0" unit="cm"/>
2798  <rotation name="rotUnitUSW_3" x="180" y="0" z="-180" unit="deg"/>
2799  </physvol>
2800  <physvol name="volUnitUSN_3">
2801  <volumeref ref="volUnitWallS"/>
2802  <position name="posUnitUSN_3" x="160" y="-468.9" z="0" unit="cm"/>
2803  <rotation name="rotUnitUSN_3" x="0" y="180" z="-270" unit="deg"/>
2804  </physvol>
2805 
2806 
2807  <physvol name="volUnitUSCent_4-0">
2808  <volumeref ref="volUnitCent"/>
2809  <position name="posUnitUSCent_4-0" x="320" y="-320" z="0" unit="cm"/>
2810  <rotationref ref="rPlus180AboutY"/>
2811  </physvol>
2812 
2813  <physvol name="volUnitUSCent_4-1">
2814  <volumeref ref="volUnitCent"/>
2815  <position name="posUnitUSCent_4-1" x="320" y="-160" z="0" unit="cm"/>
2816  <rotationref ref="rPlus180AboutY"/>
2817  </physvol>
2818 
2819  <physvol name="volUnitUSCent_4-2">
2820  <volumeref ref="volUnitCent"/>
2821  <position name="posUnitUSCent_4-2" x="320" y="0" z="0" unit="cm"/>
2822  <rotationref ref="rPlus180AboutY"/>
2823  </physvol>
2824 
2825  <physvol name="volUnitUSCent_4-3">
2826  <volumeref ref="volUnitCent"/>
2827  <position name="posUnitUSCent_4-3" x="320" y="160" z="0" unit="cm"/>
2828  <rotationref ref="rPlus180AboutY"/>
2829  </physvol>
2830 
2831  <physvol name="volUnitUSCent_4-4">
2832  <volumeref ref="volUnitCent"/>
2833  <position name="posUnitUSCent_4-4" x="320" y="320" z="0" unit="cm"/>
2834  <rotationref ref="rPlus180AboutY"/>
2835  </physvol>
2836  <physvol name="volUnitUSE_4">
2837  <volumeref ref="volUnitTop"/>
2838  <position name="posUnitUSE_4" x="454.2" y="320" z="0" unit="cm"/>
2839  <rotationref ref="rPlus180AboutX"/>
2840  </physvol>
2841  <physvol name="volUnitUSS_4">
2842  <volumeref ref="volUnitWallS"/>
2843  <position name="posUnitUSS_4" x="320" y="468.9" z="0" unit="cm"/>
2844  <rotation name="rotUnitUSS_4" x="0" y="180" z="-90" unit="deg"/>
2845  </physvol>
2846  <physvol name="volUnitUSW_4">
2847  <volumeref ref="volUnitTop"/>
2848  <position name="posUnitUSW_4" x="-454.2" y="320" z="0" unit="cm"/>
2849  <rotation name="rotUnitUSW_4" x="180" y="0" z="-180" unit="deg"/>
2850  </physvol>
2851  <physvol name="volUnitUSN_4">
2852  <volumeref ref="volUnitWallS"/>
2853  <position name="posUnitUSN_4" x="320" y="-468.9" z="0" unit="cm"/>
2854  <rotation name="rotUnitUSN_4" x="0" y="180" z="-270" unit="deg"/>
2855  </physvol>
2856  </volume>
2857 
2858 
2859 
2860  <volume name="volSteelSupport_WS">
2861  <materialref ref="Air"/>
2862  <solidref ref="boxCryoWallSm"/>
2863  <physvol name="volUnitWSCent_0-0">
2864  <volumeref ref="volUnitCent"/>
2865  <position name="posUnitWSCent_0-0" x="-320" y="-320" z="0" unit="cm"/>
2866  </physvol>
2867  <physvol name="volUnitWSCent_0-1">
2868  <volumeref ref="volUnitCent"/>
2869  <position name="posUnitWSCent_0-1" x="-320" y="-160" z="0" unit="cm"/>
2870  </physvol>
2871  <physvol name="volUnitWSCent_0-2">
2872  <volumeref ref="volUnitCent"/>
2873  <position name="posUnitWSCent_0-2" x="-320" y="0" z="0" unit="cm"/>
2874  </physvol>
2875  <physvol name="volUnitWSCent_0-3">
2876  <volumeref ref="volUnitCent"/>
2877  <position name="posUnitWSCent_0-3" x="-320" y="160" z="0" unit="cm"/>
2878  </physvol>
2879  <physvol name="volUnitWSCent_0-4">
2880  <volumeref ref="volUnitCent"/>
2881  <position name="posUnitWSCent_0-4" x="-320" y="320" z="0" unit="cm"/>
2882  </physvol>
2883  <physvol name="volUnitWSE_0">
2884  <volumeref ref="volUnitTop"/>
2885  <position name="posUnitWSE_0" x="454.2" y="-320" z="0" unit="cm"/>
2886  </physvol>
2887  <physvol name="volUnitWSS_0">
2888  <volumeref ref="volUnitWallS"/>
2889  <position name="posUnitWSS_0" x="-320" y="468.9" z="0" unit="cm"/>
2890  <rotation name="rotUnitWSS_0" x="0" y="0" z="-90" unit="deg"/>
2891  </physvol>
2892  <physvol name="volUnitWSW_0">
2893  <volumeref ref="volUnitTop"/>
2894  <position name="posUnitWSW_0" x="-454.2" y="-320" z="0" unit="cm"/>
2895  <rotation name="rotUnitWSW_0" x="0" y="0" z="-180" unit="deg"/>
2896  </physvol>
2897  <physvol name="volUnitWSN_0">
2898  <volumeref ref="volUnitWallS"/>
2899  <position name="posUnitWSN_0" x="-320" y="-468.9" z="0" unit="cm"/>
2900  <rotation name="rotUnitWSN_0" x="0" y="0" z="-270" unit="deg"/>
2901  </physvol>
2902  <physvol name="volUnitWSCent_1-0">
2903  <volumeref ref="volUnitCent"/>
2904  <position name="posUnitWSCent_1-0" x="-160" y="-320" z="0" unit="cm"/>
2905  </physvol>
2906  <physvol name="volUnitWSCent_1-1">
2907  <volumeref ref="volUnitCent"/>
2908  <position name="posUnitWSCent_1-1" x="-160" y="-160" z="0" unit="cm"/>
2909  </physvol>
2910  <physvol name="volUnitWSCent_1-2">
2911  <volumeref ref="volUnitCent"/>
2912  <position name="posUnitWSCent_1-2" x="-160" y="0" z="0" unit="cm"/>
2913  </physvol>
2914  <physvol name="volUnitWSCent_1-3">
2915  <volumeref ref="volUnitCent"/>
2916  <position name="posUnitWSCent_1-3" x="-160" y="160" z="0" unit="cm"/>
2917  </physvol>
2918  <physvol name="volUnitWSCent_1-4">
2919  <volumeref ref="volUnitCent"/>
2920  <position name="posUnitWSCent_1-4" x="-160" y="320" z="0" unit="cm"/>
2921  </physvol>
2922  <physvol name="volUnitWSE_1">
2923  <volumeref ref="volUnitTop"/>
2924  <position name="posUnitWSE_1" x="454.2" y="-160" z="0" unit="cm"/>
2925  </physvol>
2926  <physvol name="volUnitWSS_1">
2927  <volumeref ref="volUnitWallS"/>
2928  <position name="posUnitWSS_1" x="-160" y="468.9" z="0" unit="cm"/>
2929  <rotation name="rotUnitWSS_1" x="0" y="0" z="-90" unit="deg"/>
2930  </physvol>
2931  <physvol name="volUnitWSW_1">
2932  <volumeref ref="volUnitTop"/>
2933  <position name="posUnitWSW_1" x="-454.2" y="-160" z="0" unit="cm"/>
2934  <rotation name="rotUnitWSW_1" x="0" y="0" z="-180" unit="deg"/>
2935  </physvol>
2936  <physvol name="volUnitWSN_1">
2937  <volumeref ref="volUnitWallS"/>
2938  <position name="posUnitWSN_1" x="-160" y="-468.9" z="0" unit="cm"/>
2939  <rotation name="rotUnitWSN_1" x="0" y="0" z="-270" unit="deg"/>
2940  </physvol>
2941  <physvol name="volUnitWSCent_2-0">
2942  <volumeref ref="volUnitCent"/>
2943  <position name="posUnitWSCent_2-0" x="0" y="-320" z="0" unit="cm"/>
2944  </physvol>
2945  <physvol name="volUnitWSCent_2-1">
2946  <volumeref ref="volUnitCent"/>
2947  <position name="posUnitWSCent_2-1" x="0" y="-160" z="0" unit="cm"/>
2948  </physvol>
2949  <physvol name="volUnitWSCent_2-2">
2950  <volumeref ref="volUnitCent"/>
2951  <position name="posUnitWSCent_2-2" x="0" y="0" z="0" unit="cm"/>
2952  </physvol>
2953  <physvol name="volUnitWSCent_2-3">
2954  <volumeref ref="volUnitCent"/>
2955  <position name="posUnitWSCent_2-3" x="0" y="160" z="0" unit="cm"/>
2956  </physvol>
2957  <physvol name="volUnitWSCent_2-4">
2958  <volumeref ref="volUnitCent"/>
2959  <position name="posUnitWSCent_2-4" x="0" y="320" z="0" unit="cm"/>
2960  </physvol>
2961  <physvol name="volUnitWSE_2">
2962  <volumeref ref="volUnitTop"/>
2963  <position name="posUnitWSE_2" x="454.2" y="0" z="0" unit="cm"/>
2964  </physvol>
2965  <physvol name="volUnitWSS_2">
2966  <volumeref ref="volUnitWallS"/>
2967  <position name="posUnitWSS_2" x="0" y="468.9" z="0" unit="cm"/>
2968  <rotation name="rotUnitWSS_2" x="0" y="0" z="-90" unit="deg"/>
2969  </physvol>
2970  <physvol name="volUnitWSW_2">
2971  <volumeref ref="volUnitTop"/>
2972  <position name="posUnitWSW_2" x="-454.2" y="0" z="0" unit="cm"/>
2973  <rotation name="rotUnitWSW_2" x="0" y="0" z="-180" unit="deg"/>
2974  </physvol>
2975  <physvol name="volUnitWSN_2">
2976  <volumeref ref="volUnitWallS"/>
2977  <position name="posUnitWSN_2" x="0" y="-468.9" z="0" unit="cm"/>
2978  <rotation name="rotUnitWSN_2" x="0" y="0" z="-270" unit="deg"/>
2979  </physvol>
2980  <physvol name="volUnitWSCent_3-0">
2981  <volumeref ref="volUnitCent"/>
2982  <position name="posUnitWSCent_3-0" x="160" y="-320" z="0" unit="cm"/>
2983  </physvol>
2984  <physvol name="volUnitWSCent_3-1">
2985  <volumeref ref="volUnitCent"/>
2986  <position name="posUnitWSCent_3-1" x="160" y="-160" z="0" unit="cm"/>
2987  </physvol>
2988  <physvol name="volUnitWSCent_3-2">
2989  <volumeref ref="volUnitCent"/>
2990  <position name="posUnitWSCent_3-2" x="160" y="0" z="0" unit="cm"/>
2991  </physvol>
2992  <physvol name="volUnitWSCent_3-3">
2993  <volumeref ref="volUnitCent"/>
2994  <position name="posUnitWSCent_3-3" x="160" y="160" z="0" unit="cm"/>
2995  </physvol>
2996  <physvol name="volUnitWSCent_3-4">
2997  <volumeref ref="volUnitCent"/>
2998  <position name="posUnitWSCent_3-4" x="160" y="320" z="0" unit="cm"/>
2999  </physvol>
3000  <physvol name="volUnitWSE_3">
3001  <volumeref ref="volUnitTop"/>
3002  <position name="posUnitWSE_3" x="454.2" y="160" z="0" unit="cm"/>
3003  </physvol>
3004  <physvol name="volUnitWSS_3">
3005  <volumeref ref="volUnitWallS"/>
3006  <position name="posUnitWSS_3" x="160" y="468.9" z="0" unit="cm"/>
3007  <rotation name="rotUnitWSS_3" x="0" y="0" z="-90" unit="deg"/>
3008  </physvol>
3009  <physvol name="volUnitWSW_3">
3010  <volumeref ref="volUnitTop"/>
3011  <position name="posUnitWSW_3" x="-454.2" y="160" z="0" unit="cm"/>
3012  <rotation name="rotUnitWSW_3" x="0" y="0" z="-180" unit="deg"/>
3013  </physvol>
3014  <physvol name="volUnitWSN_3">
3015  <volumeref ref="volUnitWallS"/>
3016  <position name="posUnitWSN_3" x="160" y="-468.9" z="0" unit="cm"/>
3017  <rotation name="rotUnitWSN_3" x="0" y="0" z="-270" unit="deg"/>
3018  </physvol>
3019  <physvol name="volUnitWSCent_4-0">
3020  <volumeref ref="volUnitCent"/>
3021  <position name="posUnitWSCent_4-0" x="320" y="-320" z="0" unit="cm"/>
3022  </physvol>
3023  <physvol name="volUnitWSCent_4-1">
3024  <volumeref ref="volUnitCent"/>
3025  <position name="posUnitWSCent_4-1" x="320" y="-160" z="0" unit="cm"/>
3026  </physvol>
3027  <physvol name="volUnitWSCent_4-2">
3028  <volumeref ref="volUnitCent"/>
3029  <position name="posUnitWSCent_4-2" x="320" y="0" z="0" unit="cm"/>
3030  </physvol>
3031  <physvol name="volUnitWSCent_4-3">
3032  <volumeref ref="volUnitCent"/>
3033  <position name="posUnitWSCent_4-3" x="320" y="160" z="0" unit="cm"/>
3034  </physvol>
3035  <physvol name="volUnitWSCent_4-4">
3036  <volumeref ref="volUnitCent"/>
3037  <position name="posUnitWSCent_4-4" x="320" y="320" z="0" unit="cm"/>
3038  </physvol>
3039  <physvol name="volUnitWSE_4">
3040  <volumeref ref="volUnitTop"/>
3041  <position name="posUnitWSE_4" x="454.2" y="320" z="0" unit="cm"/>
3042  </physvol>
3043  <physvol name="volUnitWSS_4">
3044  <volumeref ref="volUnitWallS"/>
3045  <position name="posUnitWSS_4" x="320" y="468.9" z="0" unit="cm"/>
3046  <rotation name="rotUnitWSS_4" x="0" y="0" z="-90" unit="deg"/>
3047  </physvol>
3048  <physvol name="volUnitWSW_4">
3049  <volumeref ref="volUnitTop"/>
3050  <position name="posUnitWSW_4" x="-454.2" y="320" z="0" unit="cm"/>
3051  <rotation name="rotUnitWSW_4" x="0" y="0" z="-180" unit="deg"/>
3052  </physvol>
3053  <physvol name="volUnitWSN_4">
3054  <volumeref ref="volUnitWallS"/>
3055  <position name="posUnitWSN_4" x="320" y="-468.9" z="0" unit="cm"/>
3056  <rotation name="rotUnitWSN_4" x="0" y="0" z="-270" unit="deg"/>
3057  </physvol>
3058  </volume>
3059 
3060 
3061  <volume name="volSteelSupport_LR">
3062  <materialref ref="Air"/>
3063  <solidref ref="boxCryoWallLg"/>
3064  <physvol name="volUnitLRCent_0-0">
3065  <volumeref ref="volUnitCent"/>
3066  <position name="posUnitLRCent_0-0" x="-320" y="-320" z="0" unit="cm"/>
3067  </physvol>
3068  <physvol name="volUnitLRCent_0-1">
3069  <volumeref ref="volUnitCent"/>
3070  <position name="posUnitLRCent_0-1" x="-320" y="-160" z="0" unit="cm"/>
3071  </physvol>
3072  <physvol name="volUnitLRCent_0-2">
3073  <volumeref ref="volUnitCent"/>
3074  <position name="posUnitLRCent_0-2" x="-320" y="0" z="0" unit="cm"/>
3075  </physvol>
3076  <physvol name="volUnitLRCent_0-3">
3077  <volumeref ref="volUnitCent"/>
3078  <position name="posUnitLRCent_0-3" x="-320" y="160" z="0" unit="cm"/>
3079  </physvol>
3080  <physvol name="volUnitLRCent_0-4">
3081  <volumeref ref="volUnitCent"/>
3082  <position name="posUnitLRCent_0-4" x="-320" y="320" z="0" unit="cm"/>
3083  </physvol>
3084  <physvol name="volUnitLRE_0">
3085  <volumeref ref="volUnitWallL"/>
3086  <position name="posUnitLRE_0" x="485.1" y="-320" z="0" unit="cm"/>
3087  </physvol>
3088  <physvol name="volUnitLRS_0">
3089  <volumeref ref="volUnitWallS"/>
3090  <position name="posUnitLRS_0" x="-320" y="468.9" z="0" unit="cm"/>
3091  <rotation name="rotUnitLRS_0" x="0" y="0" z="-90" unit="deg"/>
3092  </physvol>
3093  <physvol name="volUnitLRW_0">
3094  <volumeref ref="volUnitWallL"/>
3095  <position name="posUnitLRW_0" x="-485.1" y="-320" z="0" unit="cm"/>
3096  <rotation name="rotUnitLRW_0" x="0" y="0" z="-180" unit="deg"/>
3097  </physvol>
3098  <physvol name="volUnitLRN_0">
3099  <volumeref ref="volUnitWallS"/>
3100  <position name="posUnitLRN_0" x="-320" y="-468.9" z="0" unit="cm"/>
3101  <rotation name="rotUnitLRN_0" x="0" y="0" z="-270" unit="deg"/>
3102  </physvol>
3103  <physvol name="volUnitLRCent_1-0">
3104  <volumeref ref="volUnitCent"/>
3105  <position name="posUnitLRCent_1-0" x="-160" y="-320" z="0" unit="cm"/>
3106  </physvol>
3107  <physvol name="volUnitLRCent_1-1">
3108  <volumeref ref="volUnitCent"/>
3109  <position name="posUnitLRCent_1-1" x="-160" y="-160" z="0" unit="cm"/>
3110  </physvol>
3111  <physvol name="volUnitLRCent_1-2">
3112  <volumeref ref="volUnitCent"/>
3113  <position name="posUnitLRCent_1-2" x="-160" y="0" z="0" unit="cm"/>
3114  </physvol>
3115  <physvol name="volUnitLRCent_1-3">
3116  <volumeref ref="volUnitCent"/>
3117  <position name="posUnitLRCent_1-3" x="-160" y="160" z="0" unit="cm"/>
3118  </physvol>
3119  <physvol name="volUnitLRCent_1-4">
3120  <volumeref ref="volUnitCent"/>
3121  <position name="posUnitLRCent_1-4" x="-160" y="320" z="0" unit="cm"/>
3122  </physvol>
3123  <physvol name="volUnitLRE_1">
3124  <volumeref ref="volUnitWallL"/>
3125  <position name="posUnitLRE_1" x="485.1" y="-160" z="0" unit="cm"/>
3126  </physvol>
3127  <physvol name="volUnitLRS_1">
3128  <volumeref ref="volUnitWallS"/>
3129  <position name="posUnitLRS_1" x="-160" y="468.9" z="0" unit="cm"/>
3130  <rotation name="rotUnitLRS_1" x="0" y="0" z="-90" unit="deg"/>
3131  </physvol>
3132  <physvol name="volUnitLRW_1">
3133  <volumeref ref="volUnitWallL"/>
3134  <position name="posUnitLRW_1" x="-485.1" y="-160" z="0" unit="cm"/>
3135  <rotation name="rotUnitLRW_1" x="0" y="0" z="-180" unit="deg"/>
3136  </physvol>
3137  <physvol name="volUnitLRN_1">
3138  <volumeref ref="volUnitWallS"/>
3139  <position name="posUnitLRN_1" x="-160" y="-468.9" z="0" unit="cm"/>
3140  <rotation name="rotUnitLRN_1" x="0" y="0" z="-270" unit="deg"/>
3141  </physvol>
3142  <physvol name="volUnitLRCent_2-0">
3143  <volumeref ref="volUnitCent"/>
3144  <position name="posUnitLRCent_2-0" x="0" y="-320" z="0" unit="cm"/>
3145  </physvol>
3146  <physvol name="volUnitLRCent_2-1">
3147  <volumeref ref="volUnitCent"/>
3148  <position name="posUnitLRCent_2-1" x="0" y="-160" z="0" unit="cm"/>
3149  </physvol>
3150  <physvol name="volUnitLRCent_2-2">
3151  <volumeref ref="volUnitCent"/>
3152  <position name="posUnitLRCent_2-2" x="0" y="0" z="0" unit="cm"/>
3153  </physvol>
3154  <physvol name="volUnitLRCent_2-3">
3155  <volumeref ref="volUnitCent"/>
3156  <position name="posUnitLRCent_2-3" x="0" y="160" z="0" unit="cm"/>
3157  </physvol>
3158  <physvol name="volUnitLRCent_2-4">
3159  <volumeref ref="volUnitCent"/>
3160  <position name="posUnitLRCent_2-4" x="0" y="320" z="0" unit="cm"/>
3161  </physvol>
3162  <physvol name="volUnitLRE_2">
3163  <volumeref ref="volUnitWallL"/>
3164  <position name="posUnitLRE_2" x="485.1" y="0" z="0" unit="cm"/>
3165  </physvol>
3166  <physvol name="volUnitLRS_2">
3167  <volumeref ref="volUnitWallS"/>
3168  <position name="posUnitLRS_2" x="0" y="468.9" z="0" unit="cm"/>
3169  <rotation name="rotUnitLRS_2" x="0" y="0" z="-90" unit="deg"/>
3170  </physvol>
3171  <physvol name="volUnitLRW_2">
3172  <volumeref ref="volUnitWallL"/>
3173  <position name="posUnitLRW_2" x="-485.1" y="0" z="0" unit="cm"/>
3174  <rotation name="rotUnitLRW_2" x="0" y="0" z="-180" unit="deg"/>
3175  </physvol>
3176  <physvol name="volUnitLRN_2">
3177  <volumeref ref="volUnitWallS"/>
3178  <position name="posUnitLRN_2" x="0" y="-468.9" z="0" unit="cm"/>
3179  <rotation name="rotUnitLRN_2" x="0" y="0" z="-270" unit="deg"/>
3180  </physvol>
3181  <physvol name="volUnitLRCent_3-0">
3182  <volumeref ref="volUnitCent"/>
3183  <position name="posUnitLRCent_3-0" x="160" y="-320" z="0" unit="cm"/>
3184  </physvol>
3185  <physvol name="volUnitLRCent_3-1">
3186  <volumeref ref="volUnitCent"/>
3187  <position name="posUnitLRCent_3-1" x="160" y="-160" z="0" unit="cm"/>
3188  </physvol>
3189  <physvol name="volUnitLRCent_3-2">
3190  <volumeref ref="volUnitCent"/>
3191  <position name="posUnitLRCent_3-2" x="160" y="0" z="0" unit="cm"/>
3192  </physvol>
3193  <physvol name="volUnitLRCent_3-3">
3194  <volumeref ref="volUnitCent"/>
3195  <position name="posUnitLRCent_3-3" x="160" y="160" z="0" unit="cm"/>
3196  </physvol>
3197  <physvol name="volUnitLRCent_3-4">
3198  <volumeref ref="volUnitCent"/>
3199  <position name="posUnitLRCent_3-4" x="160" y="320" z="0" unit="cm"/>
3200  </physvol>
3201  <physvol name="volUnitLRE_3">
3202  <volumeref ref="volUnitWallL"/>
3203  <position name="posUnitLRE_3" x="485.1" y="160" z="0" unit="cm"/>
3204  </physvol>
3205  <physvol name="volUnitLRS_3">
3206  <volumeref ref="volUnitWallS"/>
3207  <position name="posUnitLRS_3" x="160" y="468.9" z="0" unit="cm"/>
3208  <rotation name="rotUnitLRS_3" x="0" y="0" z="-90" unit="deg"/>
3209  </physvol>
3210  <physvol name="volUnitLRW_3">
3211  <volumeref ref="volUnitWallL"/>
3212  <position name="posUnitLRW_3" x="-485.1" y="160" z="0" unit="cm"/>
3213  <rotation name="rotUnitLRW_3" x="0" y="0" z="-180" unit="deg"/>
3214  </physvol>
3215  <physvol name="volUnitLRN_3">
3216  <volumeref ref="volUnitWallS"/>
3217  <position name="posUnitLRN_3" x="160" y="-468.9" z="0" unit="cm"/>
3218  <rotation name="rotUnitLRN_3" x="0" y="0" z="-270" unit="deg"/>
3219  </physvol>
3220  <physvol name="volUnitLRCent_4-0">
3221  <volumeref ref="volUnitCent"/>
3222  <position name="posUnitLRCent_4-0" x="320" y="-320" z="0" unit="cm"/>
3223  </physvol>
3224  <physvol name="volUnitLRCent_4-1">
3225  <volumeref ref="volUnitCent"/>
3226  <position name="posUnitLRCent_4-1" x="320" y="-160" z="0" unit="cm"/>
3227  </physvol>
3228  <physvol name="volUnitLRCent_4-2">
3229  <volumeref ref="volUnitCent"/>
3230  <position name="posUnitLRCent_4-2" x="320" y="0" z="0" unit="cm"/>
3231  </physvol>
3232  <physvol name="volUnitLRCent_4-3">
3233  <volumeref ref="volUnitCent"/>
3234  <position name="posUnitLRCent_4-3" x="320" y="160" z="0" unit="cm"/>
3235  </physvol>
3236  <physvol name="volUnitLRCent_4-4">
3237  <volumeref ref="volUnitCent"/>
3238  <position name="posUnitLRCent_4-4" x="320" y="320" z="0" unit="cm"/>
3239  </physvol>
3240  <physvol name="volUnitLRE_4">
3241  <volumeref ref="volUnitWallL"/>
3242  <position name="posUnitLRE_4" x="485.1" y="320" z="0" unit="cm"/>
3243  </physvol>
3244  <physvol name="volUnitLRS_4">
3245  <volumeref ref="volUnitWallS"/>
3246  <position name="posUnitLRS_4" x="320" y="468.9" z="0" unit="cm"/>
3247  <rotation name="rotUnitLRS_4" x="0" y="0" z="-90" unit="deg"/>
3248  </physvol>
3249  <physvol name="volUnitLRW_4">
3250  <volumeref ref="volUnitWallL"/>
3251  <position name="posUnitLRW_4" x="-485.1" y="320" z="0" unit="cm"/>
3252  <rotation name="rotUnitLRW_4" x="0" y="0" z="-180" unit="deg"/>
3253  </physvol>
3254  <physvol name="volUnitLRN_4">
3255  <volumeref ref="volUnitWallS"/>
3256  <position name="posUnitLRN_4" x="320" y="-468.9" z="0" unit="cm"/>
3257  <rotation name="rotUnitLRN_4" x="0" y="0" z="-270" unit="deg"/>
3258  </physvol>
3259  </volume>
3260 
3261  <volume name="volDetEnclosure">
3262  <materialref ref="Air"/>
3263  <solidref ref="DetEnclosure"/>
3264 
3265  <physvol>
3266  <volumeref ref="volFoamPadding"/>
3267  <positionref ref="posCryoInDetEnc"/>
3268  </physvol>
3269 
3270 
3271  <physvol name="volSteelSupport_Top">
3272  <volumeref ref="volSteelSupport_TB"/>
3273  <position name="posSteelSupport_Top" x="$posTopSteelStruct+31.1" y="$posCryoInDetEnc_y" z="0" unit="cm"/>
3274  <rotation name="rotSteelSupport_Top" x="0" y="-90" z="0" unit="deg"/>
3275 
3276  </physvol>
3277 
3278  <physvol name="volSteelSupport_Bottom">
3279  <volumeref ref="volSteelSupport_TB"/>
3280  <position name="posSteelSupport_Bottom" x="$posBotSteelStruct-31.1" y="$posCryoInDetEnc_y" z="0" unit="cm"/>
3281  <rotation name="rotSteelSupport_Bottom" x="0" y="90" z="0" unit="deg"/>
3282  </physvol>
3283 
3284  <physvol>
3285  <volumeref ref="volSteelSupport_US"/>
3286  <position name="posSteelSupport_US" x="0" y="$posCryoInDetEnc_y" z="$posZFrontSteelStruct-31.1" unit="cm"/>
3287  <rotation name="rotSteelSupport_Front" x="0" y="0" z="90" unit="deg"/>
3288  </physvol>
3289 
3290  <physvol name="volSteelSupport_DS">
3291  <volumeref ref="volSteelSupport_WS"/>
3292  <position name="posSteelSupport_DS" x="0" y="$posCryoInDetEnc_y" z="$posZBackSteelStruct+31.1" unit="cm"/>
3293  <rotation name="rotSteelSupport_Back" x="0" y="0" z="90" unit="deg"/>
3294  </physvol>
3295 
3296 
3297  <physvol name="volSteelSupport_LS">
3298  <volumeref ref="volSteelSupport_LR"/>
3299  <position name="posSteelSupport_LS" x="0" y="$posLeftSteelStruct+$posCryoInDetEnc_y-31.1" z="0" unit="cm"/>
3300  <rotation name="rotSteelSupport_LS" x="-90" y="0" z="90" unit="deg"/>
3301  </physvol>
3302 
3303  <physvol name="volSteelSupport_RS">
3304  <volumeref ref="volSteelSupport_LR"/>
3305  <position name="posSteelSupport_RS" x="0" y="$posRightSteelStruct+$posCryoInDetEnc_y+31.1" z="0" unit="cm"/>
3306  <rotation name="rotSteelSupport_RS" x="90" y="0" z="90" unit="deg"/>
3307  </physvol>
3308 
3309  <physvol>
3310  <volumeref ref="volSteelSupport"/>
3311  <positionref ref="posCryoInDetEnc"/>
3312  </physvol>
3313 
3314  <physvol>
3315  <volumeref ref="volCryostat"/>
3316  <positionref ref="posCryoInDetEnc"/>
3317  </physvol>
3318 EOF
3319 
3320 
3321 print ENCL <<EOF;
3322  </volume>
3323 EOF
3324 
3325 print ENCL <<EOF;
3326 </structure>
3327 </gdml>
3328 EOF
3329 
3330 close(ENCL);
3331 }
3332 
3333 
3334 
3335 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3336 #+++++++++++++++++++++++++++++++++++++++ gen_World +++++++++++++++++++++++++++++++++++++++
3337 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3338 
3339 sub gen_World()
3340 {
3341 
3342 # Create the WORLD fragment file name,
3343 # add file to list of output GDML fragments,
3344 # and open it
3345  $WORLD = $basename."_World" . $suffix . ".gdml";
3346  push (@gdmlFiles, $WORLD);
3347  $WORLD = ">" . $WORLD;
3348  open(WORLD) or die("Could not open file $WORLD for writing");
3349 
3350 
3351 # The standard XML prefix and starting the gdml
3352  print WORLD <<EOF;
3353 <?xml version='1.0'?>
3354 <gdml>
3355 EOF
3356 
3357 
3358 # All the World solids.
3359 print WORLD <<EOF;
3360 <solids>
3361  <box name="World" lunit="cm"
3362  x="@{[$DetEncWidth+2*$RockThickness]}"
3363  y="@{[$DetEncHeight+2*$RockThickness]}"
3364  z="@{[$DetEncLength+2*$RockThickness]}"/>
3365 </solids>
3366 EOF
3367 
3368 # World structure
3369 print WORLD <<EOF;
3370 <structure>
3371  <volume name="volWorld" >
3372  <materialref ref="Air"/>
3373  <solidref ref="World"/>
3374 
3375  <physvol>
3376  <volumeref ref="volDetEnclosure"/>
3377  <position name="posDetEnclosure" unit="cm" x="$OriginXSet" y="$OriginYSet" z="$OriginZSet"/>
3378  </physvol>
3379 
3380  </volume>
3381 </structure>
3382 </gdml>
3383 EOF
3384 
3385 # make_gdml.pl will take care of <setup/>
3386 
3387 close(WORLD);
3388 }
3389 
3390 
3391 
3392 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3393 #++++++++++++++++++++++++++++++++++++ write_fragments ++++++++++++++++++++++++++++++++++++
3394 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3395 
3396 sub write_fragments()
3397 {
3398  # This subroutine creates an XML file that summarizes the the subfiles output
3399  # by the other sub routines - it is the input file for make_gdml.pl which will
3400  # give the final desired GDML file. Specify its name with the output option.
3401  # (you can change the name when running make_gdml)
3402 
3403  # This code is taken straigh from the similar MicroBooNE generate script, Thank you.
3404 
3405  if ( ! defined $output )
3406  {
3407  $output = "-"; # write to STDOUT
3408  }
3409 
3410  # Set up the output file.
3411  $OUTPUT = ">" . $output;
3412  open(OUTPUT) or die("Could not open file $OUTPUT");
3413 
3414  print OUTPUT <<EOF;
3415 <?xml version='1.0'?>
3416 
3417 <!-- Input to Geometry/gdml/make_gdml.pl; define the GDML fragments
3418  that will be zipped together to create a detector description.
3419  -->
3420 
3421 <config>
3422 
3423  <constantfiles>
3424 
3425  <!-- These files contain GDML <constant></constant>
3426  blocks. They are read in separately, so they can be
3427  interpreted into the remaining GDML. See make_gdml.pl for
3428  more information.
3429  -->
3430 
3431 EOF
3432 
3433  foreach $filename (@defFiles)
3434  {
3435  print OUTPUT <<EOF;
3436  <filename> $filename </filename>
3437 EOF
3438  }
3439 
3440  print OUTPUT <<EOF;
3441 
3442  </constantfiles>
3443 
3444  <gdmlfiles>
3445 
3446  <!-- The GDML file fragments to be zipped together. -->
3447 
3448 EOF
3449 
3450  foreach $filename (@gdmlFiles)
3451  {
3452  print OUTPUT <<EOF;
3453  <filename> $filename </filename>
3454 EOF
3455  }
3456 
3457  print OUTPUT <<EOF;
3458 
3459  </gdmlfiles>
3460 
3461 </config>
3462 EOF
3463 
3464  close(OUTPUT);
3465 }
3466 
3467 
3468 print "Some key parameters for dual-phase LAr TPC (unit cm unless noted otherwise)\n";
3469 print "CRM active area : $widthCRM_active x $lengthCRM_active\n";
3470 print "CRM total area : $widthCRM x $lengthCRM\n";
3471 print "TPC active volume : $driftTPCActive x $widthTPCActive x $lengthTPCActive\n";
3472 print "Argon buffer : ($xLArBuffer, $yLArBuffer, $zLArBuffer) \n";
3473 print "Detector enclosure : $DetEncWidth x $DetEncHeight x $DetEncLength\n";
3474 print "TPC Origin : ($OriginXSet, $OriginYSet, $OriginZSet) \n";
3475 print "Field Cage : $FieldCage_switch \n";
3476 print "Cathode : $Cathode_switch \n";;
3477 print "GroundGrid : $GroundGrid_switch \n";
3478 print "ExtractionGrid : $ExtractionGrid_switch \n";
3479 print "LEMs : $LEMs_switch \n";
3480 print "PMTs : $pmt_switch \n";
3481 # run the sub routines that generate the fragments
3482 
3483 
3484 
3485 
3486 gen_Define(); # generates definitions at beginning of GDML
3487 gen_Materials(); # generates materials to be used
3488 
3489 if ( $pmt_switch eq "on" ) { gen_pmt(); }
3490 if ( $FieldCage_switch eq "on" ) { gen_FieldCage(); }
3491 if ( $GroundGrid_switch eq "on" ) { gen_GroundGrid(); }
3492 if ( $Cathode_switch eq "on" ) { gen_Cathode(); }
3493 if ( $ExtractionGrid_switch eq "on" ) { gen_ExtractionGrid(); }
3494 if ( $LEMs_switch eq "on" ) { gen_LEMs(); }
3495 
3496 gen_TPC(); # generate TPC for a given unit CRM
3497 gen_Cryostat(); #
3498 gen_Enclosure(); #
3499 gen_World(); # places the enclosure among DUSEL Rockk
3500 write_fragments(); # writes the XML input for make_gdml.pl
3501  # which zips together the final GDML
3502 exit;