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