3 # contact tylerdalion@gmail.com for any GDML/generate questions
4 # I would love to help!
6 # This is essentially the same script as the one that generates 10kt,
7 # just with a different set of parameters/dimensions. Eventually these
8 # differing parameters will be handled by passing different xml inputs
9 # to a single script, thereby setting the parameters.
11 # For now, the differences are:
12 #--------------------- 34kt ------------------ 10kt -----------------
16 # The only structural differnce in this script is that 10kt places
17 # cryostats side by side, whereas 34kt is end to end.
20 # Each subroutine generates a fragment GDML file, and the last subroutine
21 # creates an XML file that make_gdml.pl will use to appropriately arrange
22 # the fragment GDML files to create the final desired DUNE GDML file,
23 # to be named by make_gdml output command
25 # If you are playing with different geometries, you can use the
26 # suffix command to help organize your work.
31 Math::BigFloat->precision(-16);
33 GetOptions( "help|h" => \$help,
34 "suffix|s:s" => \$suffix,
35 "output|o:s" => \$output,
36 "wires|w:s" => \$wires,
37 "helpcube|c" => \$helpcube);
41 # If the user requested help, print the usage notes and exit.
46 if ( ! defined $suffix )
48 # The user didn't supply a suffix, so append nothing to the file
54 # Otherwise, stick a "-" before the suffix, so that a suffix of
55 # "test" applied to filename.gdml becomes "filename-test.gdml".
56 $suffix = "-" . $suffix;
60 #++++++++++++++++++++++++ Begin defining variables +++++++++++++++++++++++++
62 # Define detector geometry variables - later to be put in a parameters
63 # XML file to be parsed as an input?
65 # set wires on to be the default, unless given an input by the user
66 $wires_on = 1; # 1=on, 0=off
76 ###### ALL PARAMETERS FROM DocDb-3383 #######
79 ##################################################################
80 ##################### wire plane parameters ######################
91 $SinUAngle = sin( deg2rad($UAngle) );
92 $CosUAngle = cos( deg2rad($UAngle) );
93 $TanUAngle = tan( deg2rad($UAngle) );
95 $SinVAngle = sin( deg2rad($VAngle) );
96 $CosVAngle = cos( deg2rad($VAngle) );
97 $TanVAngle = tan( deg2rad($VAngle) );
99 $UWire_yint = $UWirePitch/$SinUAngle;
100 $UWire_zint = $UWirePitch/$CosUAngle;
102 $VWire_yint = $VWirePitch/$SinVAngle;
103 $VWire_zint = $VWirePitch/$CosVAngle;
105 $TPCWireThickness = 0.015;
107 $TPCWirePlaneThickness = $TPCWireThickness;
108 #height and length defined lower
114 ###########################################################################
115 ############## modular APA dimension and spacing parameters ###############
123 $APAFrame_x = 2*$inch; # this does not include the wire spacing
124 $APAWirePlaneSpacing = 0.476; # spacing between all of the wire planes (u, v, and x)
126 #MaxDrift is the distance form the edge of the CPA to the edge of the first wire plane
127 #TODO: the implementation and value of MaxDrift will have to be re-evaluated if adding the grid plane.
129 $APALongGap = 1.5; # separation between APAs along the incident beam axis
130 $APAVerticalGap = 2.5; # separation between APAs along the vertical axis
132 #Cryostat space with LAr outside of entire fiducial volume
133 $SpaceCPAtoCryoWall = 85;
134 $SpaceAPAToFloor = 50;
135 $SpaceAPAToTopLAr = 50;
136 $UpstreamLArPadding = 250;
137 $DownstreamLArPadding = 50;
140 $APAWidth = 2*$MaxDrift
141 + 4*$APAWirePlaneSpacing
142 + 2*$TPCWirePlaneThickness
144 # This is the distance edge of CPA to edge of CPA.
145 # MaxDrift covers the spacing involving the grid plane.
146 # Unlike the other dimensions, this does not describe
147 # a physical dimension of an APA, but rather is used
148 # to position the "module" one would think of as having
149 # the APA and the corresponding drift distances.
151 $APAHeight = 700; # doesn't include front-end boards or hanger posts
152 $APALength = 252; # doesn't include the dead space on the sides of APA frame for wrapping wires
159 ####################################################################
160 ################# APA Frame and Paddle Dimensions ##################
162 $APAFrameZSide_x = $APAFrame_x;
163 $APAFrameZSide_y = 4*$inch;
164 $APAFrameZSide_z = $APALength;
167 $LightPaddleWidth = 0.476;
168 $LightPaddleHeight = 4*$inch;
169 $LightPaddleLength = 225-0.001;
170 $nLightPaddlesPerAPA = 10; # 10, or 20 for double coverage (for now)
171 $PaddleYInterval = (2*$APAHeight+$APAVerticalGap-$LightPaddleHeight-2*$APAFrameZSide_y)
172 /(2*$nLightPaddlesPerAPA-1);
173 $FrameToPaddleSpace = ($PaddleYInterval-$APAVerticalGap)/2;
177 # $PaddleYInterval is defined so that the center-to-center distance in the
178 # y direction between paddles is uniform between vertically stacked APAs.
179 # $FrameToPaddleSpace is from the BOTTOM of the APA frame (4" in y direction)
180 # to the CENTER of a paddle, including the 4" part of the frame. This variable's
181 # primary purpose is to position the lowest paddle in each APA.
184 $APAFrameZSide_x = $APAFrame_x;
185 $APAFrameZSide_y = 4*$inch;
186 $APAFrameZSide_z = $APALength;
188 $APAFrameYSide_x = $APAFrame_x;
189 $APAFrameYSide_y = $APAHeight-2*$APAFrameZSide_y;
190 $APAFrameYSide_z = 4*$inch;
192 # Two outer Y supports will sandwich the inner Y supports and light paddles
193 $APAFrameYOuterSupport_x = ($APAFrame_x-$LightPaddleWidth)/2;
194 $APAFrameYOuterSupport_y = $APAHeight-2*$APAFrameZSide_y;
195 $APAFrameYOuterSupport_z = 4*$inch;
197 $APAFrameYInnerSupport_x = $LightPaddleWidth;
198 $APAFrameYInnerSupport_y = $PaddleYInterval-$LightPaddleHeight;
199 $APAFrameYInnerSupport_z = 4*$inch;
201 $APAFrameZHalfSupport_x = $APAFrame_x;
202 $APAFrameZHalfSupport_y = 2*$inch;
203 $APAFrameZHalfSupport_z = $APAFrameZSide_z
205 - $APAFrameYSupport_z;
208 $EdgeFrameSteelThickness = 0.12*$inch;
209 $InnerFrameSteelThickness = 0.062*$inch;
217 ##############################################################
218 ############## Cryo and TPC relevant dimensions #############
220 # TODO: These fiducial parameters were useful in placement within the Cryostat,
221 # but now that it is only symmetric in the x direction, the only placement where
222 # these parameters are useful is in the x direction. possibly deprecate so as
223 # not to be misleading or overly complicated here.
224 $FiducialWidth = $APAWidth*$nAPAWide + $CPAThickness*($nAPAWide+1);
225 $FiducialHeight = $APAHeight*$nAPAHigh + ($nAPAHigh - 1)*$APAVerticalGap;
226 $FiducialLength = $APALength*$nAPALong + ($nAPALong - 1)*$APALongGap;
228 $SteelThickness = 0.5*$inch; #half inch
229 $HeightGaseousAr = 50;
232 $ArgonWidth = $FiducialWidth
233 + 2*$SpaceCPAToCryoWall;
234 $ArgonHeight = $FiducialHeight
235 + $SpaceAPAToFloor + $SpaceAPAToTopLAr
237 # both liquid AND gaseous argon
239 $ArgonLength = $FiducialLength
240 + $UpstreamLArPadding + $DownstreamLArPadding;
242 $CryostatWidth = $ArgonWidth + 2*$SteelThickness;
243 $CryostatHeight = $ArgonHeight + 2*$SteelThickness;
244 $CryostatLength = $ArgonLength + 2*$SteelThickness;
246 $TPCWidth = ($APAWidth-$APAFrame_x)/2;
247 # this distance is the distance from edge of
248 # the APA frame to the edge of the CPA
249 $TPCHeight = $APAHeight + $APAVerticalGap;
250 $TPCLength = $APALength + $APALongGap;
253 # $TPCWirePlaneThickness now defined higher up
254 $TPCWirePlaneHeight = $APAHeight;
255 # the wire plane region is the full height of the APA since
256 # the previous number doesn't have the front-end boards, etc.
257 $TPCWirePlaneLength = $APALength;
258 # the APA Length doesn't have the spacing on between the two
259 # APAs so the Wire Plane Length is the full length
262 ### TODO: MAY NEED ADJUSTMENT:
263 #TPC Active Variables -- apply cuts here
265 $TPCActiveWidth = $TPCWidth-(3*$APAWirePlaneSpacing);
266 $TPCActiveHeight = $TPCWirePlaneHeight;
267 $TPCActiveLength = $TPCWirePlaneLength;
269 $posTPCActive_X = $TPCWidth/2-$TPCActiveWidth/2;
280 ##################################################################
281 ############## DetEnc and World relevant parameters #############
284 # x distance between the LAr in each side by side cryo
285 $ConcretePadding = 50;
287 $TotalPadding = $ConcretePadding+$FoamPadding;
289 # 34kt difference: Lengtho holds 2 cryostats instead of width
290 # TODO: ArToAr same for now. not in 3833, need design diagrams or AutoCAD
291 $DetEncLength = 2*$CryostatLength+2*$TotalPadding+2*$FoamPadding + $ArToAr;
292 $DetEncWidth = $CryostatWidth+2*$TotalPadding;
293 $DetEncHeight = $CryostatHeight+$ConcretePadding;
294 # no foam on bottom or top, no concrete on top
298 # We want the world origin to be at the very front of the fiducial volume.
299 # move it to the front of the enclosure, then back it up through the concrete/foam,
300 # then through the Cryostat shell, then through the upstream dead LAr (including the
301 # dead LAr on the edge of the TPC, but this is covered in $UpstreamLArPadding).
302 # This is to be added to the z position of every volume in volWorld
304 $OriginZSet = $DetEncLength/2
307 - $UpstreamLArPadding;
309 # We want the world origin to be vertically centered between the stacked APAs.
310 # the cryostat sits on top of concrete padding, move the detector enclosure back
311 # This is to be added to the y position of every volume in volWorld
313 $OriginYSet = $HeightGaseousAr/2
314 - $ConcretePadding/2;
316 # similar X set variable may be set if needed later
319 # TODO: Needs work from here on... wait until design stabilizes
321 # Since we want the z center to be at the fron face of the first fiducial volume,
322 # nearly all of the first cryostat, and comletely all of the second, ar on the
323 # positive z side of the world volume. In other words, most of the very long
324 # volDetEnclosue is on the positive z side, so the world must be long enough to
327 $RockThickness = 5000;
329 $WorldWidth = $DetEncWidth+2*$RockThickness;
330 $WorldHeight = $DetEncHeight+2*$RockThickness;
331 $WorldLength = $DetEncLength+2*$RockThickness;
334 # 34kt difference: The Highbay and service building portions of
335 # the code have been entirely removed, since 34kt underground
336 # will be much different.
341 #################### Help get your bearings when drawing a symmetric detector. only in world.
344 if (defined $helpcube)
346 $PosDirCubeSide = $ArToAr; #seems to be a good proportion
353 #+++++++++++++++++++++++++ End defining variables ++++++++++++++++++++++++++
355 # run the sub routines that generate the fragments
357 gen_Define(); # generates definitions at beginning of GDML
358 gen_Materials(); # generates materials to be used
360 gen_TPC(); # generates wires, wire planes, and puts them in volTPC
361 # This is the bulk of the code, and has zero wires option
362 gen_Cryostat(); # places (2*nAPAWide x nAPAHigh x nAPALong) volTPC,
363 # half rotated 180 about Y
364 gen_Enclosure(); # places two cryostats and concrete volumes
366 gen_World(); # places the enclosure among DUSEL Rock
369 write_fragments(); # writes the XML input for make_gdml.pl
370 # which zips together the final GDML
374 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
375 #+++++++++++++++++++++++++++++++++++++++++ usage +++++++++++++++++++++++++++++++++++++++++
376 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
380 print "Usage: $0 [-h|--help] [-o|--output <fragments-file>] [-s|--suffix <string>]\n";
381 print " if -o is omitted, output goes to STDOUT; <fragments-file> is input to make_gdml.pl\n";
382 print " -s <string> appends the string to the file names; useful for multiple detector versions\n";
383 print " -h prints this message, then quits\n";
388 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
389 #++++++++++++++++++++++++++++++++++++++ gen_Define +++++++++++++++++++++++++++++++++++++++
390 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
395 # Create the <define> fragment file name,
396 # add file to list of fragments,
398 $DEF = "dune_10kT_Def" . $suffix . ".gdml";
399 push (@gdmlFiles, $DEF);
401 open(DEF) or die("Could not open file $DEF for writing");
405 <?xml version='1.0'?>
408 <position name="posTPCActive" unit="cm" x="$posTPCActive_X" y="$posTPCActive_Y" z="$posTPCActive_Z"/>
409 <position name="posCenter" unit="cm" x="0" y="0" z="0"/>
410 <rotation name="rPlus90AboutX" unit="deg" x="90" y="0" z="0"/>
411 <rotation name="rMinus90AboutY" unit="deg" x="0" y="270" z="0"/>
412 <rotation name="rMinus90AboutYMinus90AboutX" unit="deg" x="270" y="270" z="0"/>
413 <rotation name="rPlusUAngleAboutX" unit="deg" x="90-$UAngle" y="0" z="0"/>
414 <rotation name="rPlusVAngleAboutX" unit="deg" x="90+$VAngle" y="0" z="0"/>
415 <rotation name="rPlus180AboutY" unit="deg" x="0" y="180" z="0"/>
416 <rotation name="rIdentity" unit="deg" x="0" y="0" z="0"/>
426 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
427 #+++++++++++++++++++++++++++++++++++++ gen_Materials +++++++++++++++++++++++++++++++++++++
428 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
433 # Create the <materials> fragment file name,
434 # add file to list of output GDML fragments,
436 $MAT = "dune_10kT_Materials" . $suffix . ".gdml";
437 push (@gdmlFiles, $MAT);
439 open(MAT) or die("Could not open file $MAT for writing");
444 <element name="videRef" formula="VACUUM" Z="1"> <atom value="1"/> </element>
445 <element name="bromine" formula="Br" Z="35"> <atom value="79.904"/> </element>
446 <element name="hydrogen" formula="H" Z="1"> <atom value="1.0079"/> </element>
447 <element name="nitrogen" formula="N" Z="7"> <atom value="14.0067"/> </element>
448 <element name="oxygen" formula="O" Z="8"> <atom value="15.999"/> </element>
449 <element name="aluminum" formula="Al" Z="13"> <atom value="26.9815"/> </element>
450 <element name="silicon" formula="Si" Z="14"> <atom value="28.0855"/> </element>
451 <element name="carbon" formula="C" Z="6"> <atom value="12.0107"/> </element>
452 <element name="potassium" formula="K" Z="19"> <atom value="39.0983"/> </element>
453 <element name="chromium" formula="Cr" Z="24"> <atom value="51.9961"/> </element>
454 <element name="iron" formula="Fe" Z="26"> <atom value="55.8450"/> </element>
455 <element name="nickel" formula="Ni" Z="28"> <atom value="58.6934"/> </element>
456 <element name="calcium" formula="Ca" Z="20"> <atom value="40.078"/> </element>
457 <element name="magnesium" formula="Mg" Z="12"> <atom value="24.305"/> </element>
458 <element name="sodium" formula="Na" Z="11"> <atom value="22.99"/> </element>
459 <element name="titanium" formula="Ti" Z="22"> <atom value="47.867"/> </element>
460 <element name="argon" formula="Ar" Z="18"> <atom value="39.9480"/> </element>
461 <element name="sulphur" formula="S" Z="16"> <atom value="32.065"/> </element>
462 <element name="phosphorus" formula="P" Z="15"> <atom value="30.973"/> </element>
464 <material name="Vacuum" formula="Vacuum">
465 <D value="1.e-25" unit="g/cm3"/>
466 <fraction n="1.0" ref="videRef"/>
469 <material name="ALUMINUM_Al" formula="ALUMINUM_Al">
470 <D value="2.6990" unit="g/cm3"/>
471 <fraction n="1.0000" ref="aluminum"/>
474 <material name="SILICON_Si" formula="SILICON_Si">
475 <D value="2.3300" unit="g/cm3"/>
476 <fraction n="1.0000" ref="silicon"/>
479 <material name="epoxy_resin" formula="C38H40O6Br4">
480 <D value="1.1250" unit="g/cm3"/>
481 <composite n="38" ref="carbon"/>
482 <composite n="40" ref="hydrogen"/>
483 <composite n="6" ref="oxygen"/>
484 <composite n="4" ref="bromine"/>
487 <material name="SiO2" formula="SiO2">
488 <D value="2.2" unit="g/cm3"/>
489 <composite n="1" ref="silicon"/>
490 <composite n="2" ref="oxygen"/>
493 <material name="Al2O3" formula="Al2O3">
494 <D value="3.97" unit="g/cm3"/>
495 <composite n="2" ref="aluminum"/>
496 <composite n="3" ref="oxygen"/>
499 <material name="Fe2O3" formula="Fe2O3">
500 <D value="5.24" unit="g/cm3"/>
501 <composite n="2" ref="iron"/>
502 <composite n="3" ref="oxygen"/>
505 <material name="CaO" formula="CaO">
506 <D value="3.35" unit="g/cm3"/>
507 <composite n="1" ref="calcium"/>
508 <composite n="1" ref="oxygen"/>
511 <material name="MgO" formula="MgO">
512 <D value="3.58" unit="g/cm3"/>
513 <composite n="1" ref="magnesium"/>
514 <composite n="1" ref="oxygen"/>
517 <material name="Na2O" formula="Na2O">
518 <D value="2.27" unit="g/cm3"/>
519 <composite n="2" ref="sodium"/>
520 <composite n="1" ref="oxygen"/>
523 <material name="TiO2" formula="TiO2">
524 <D value="4.23" unit="g/cm3"/>
525 <composite n="1" ref="titanium"/>
526 <composite n="2" ref="oxygen"/>
529 <material name="FeO" formula="FeO">
530 <D value="5.745" unit="g/cm3"/>
531 <composite n="1" ref="iron"/>
532 <composite n="1" ref="oxygen"/>
535 <material name="CO2" formula="CO2">
536 <D value="1.562" unit="g/cm3"/>
537 <composite n="1" ref="iron"/>
538 <composite n="2" ref="oxygen"/>
541 <material name="P2O5" formula="P2O5">
542 <D value="1.562" unit="g/cm3"/>
543 <composite n="2" ref="phosphorus"/>
544 <composite n="5" ref="oxygen"/>
547 <material formula=" " name="DUSEL_Rock">
548 <D value="2.82" unit="g/cm3"/>
549 <fraction n="0.5267" ref="SiO2"/>
550 <fraction n="0.1174" ref="FeO"/>
551 <fraction n="0.1025" ref="Al2O3"/>
552 <fraction n="0.0473" ref="MgO"/>
553 <fraction n="0.0422" ref="CO2"/>
554 <fraction n="0.0382" ref="CaO"/>
555 <fraction n="0.0240" ref="carbon"/>
556 <fraction n="0.0186" ref="sulphur"/>
557 <fraction n="0.0053" ref="Na2O"/>
558 <fraction n="0.00070" ref="P2O5"/>
559 <fraction n="0.0771" ref="oxygen"/>
562 <material name="fibrous_glass">
563 <D value="2.74351" unit="g/cm3"/>
564 <fraction n="0.600" ref="SiO2"/>
565 <fraction n="0.118" ref="Al2O3"/>
566 <fraction n="0.001" ref="Fe2O3"/>
567 <fraction n="0.224" ref="CaO"/>
568 <fraction n="0.034" ref="MgO"/>
569 <fraction n="0.010" ref="Na2O"/>
570 <fraction n="0.013" ref="TiO2"/>
573 <material name="FR4">
574 <D value="1.98281" unit="g/cm3"/>
575 <fraction n="0.47" ref="epoxy_resin"/>
576 <fraction n="0.53" ref="fibrous_glass"/>
579 <material name="STEEL_STAINLESS_Fe7Cr2Ni" formula="STEEL_STAINLESS_Fe7Cr2Ni">
580 <D value="7.9300" unit="g/cm3"/>
581 <fraction n="0.0010" ref="carbon"/>
582 <fraction n="0.1792" ref="chromium"/>
583 <fraction n="0.7298" ref="iron"/>
584 <fraction n="0.0900" ref="nickel"/>
587 <material name="LAr" formula="LAr">
588 <D value="1.40" unit="g/cm3"/>
589 <fraction n="1.0000" ref="argon"/>
592 <material name="ArGas" formula="ArGas">
593 <D value="0.00166" unit="g/cm3"/>
594 <fraction n="1.0" ref="argon"/>
597 <material formula=" " name="Air">
598 <D value="0.001205" unit="g/cm3"/>
599 <fraction n="0.781154" ref="nitrogen"/>
600 <fraction n="0.209476" ref="oxygen"/>
601 <fraction n="0.00934" ref="argon"/>
604 <material formula=" " name="G10">
605 <D value="1.7" unit="g/cm3"/>
606 <fraction n="0.2805" ref="silicon"/>
607 <fraction n="0.3954" ref="oxygen"/>
608 <fraction n="0.2990" ref="carbon"/>
609 <fraction n="0.0251" ref="hydrogen"/>
612 <material formula=" " name="Granite">
613 <D value="2.7" unit="g/cm3"/>
614 <fraction n="0.438" ref="oxygen"/>
615 <fraction n="0.257" ref="silicon"/>
616 <fraction n="0.222" ref="sodium"/>
617 <fraction n="0.049" ref="aluminum"/>
618 <fraction n="0.019" ref="iron"/>
619 <fraction n="0.015" ref="potassium"/>
622 <material formula=" " name="ShotRock">
623 <D value="2.7*0.6" unit="g/cm3"/>
624 <fraction n="0.438" ref="oxygen"/>
625 <fraction n="0.257" ref="silicon"/>
626 <fraction n="0.222" ref="sodium"/>
627 <fraction n="0.049" ref="aluminum"/>
628 <fraction n="0.019" ref="iron"/>
629 <fraction n="0.015" ref="potassium"/>
632 <material formula=" " name="Dirt">
633 <D value="1.7" unit="g/cm3"/>
634 <fraction n="0.438" ref="oxygen"/>
635 <fraction n="0.257" ref="silicon"/>
636 <fraction n="0.222" ref="sodium"/>
637 <fraction n="0.049" ref="aluminum"/>
638 <fraction n="0.019" ref="iron"/>
639 <fraction n="0.015" ref="potassium"/>
642 <material formula=" " name="Concrete">
643 <D value="2.3" unit="g/cm3"/>
644 <fraction n="0.530" ref="oxygen"/>
645 <fraction n="0.335" ref="silicon"/>
646 <fraction n="0.060" ref="calcium"/>
647 <fraction n="0.015" ref="sodium"/>
648 <fraction n="0.020" ref="iron"/>
649 <fraction n="0.040" ref="aluminum"/>
652 <material formula="H2O" name="Water">
653 <D value="1.0" unit="g/cm3"/>
654 <fraction n="0.1119" ref="hydrogen"/>
655 <fraction n="0.8881" ref="oxygen"/>
658 <material formula="Ti" name="Titanium">
659 <D value="4.506" unit="g/cm3"/>
660 <fraction n="1." ref="titanium"/>
663 <material name="TPB" formula="TPB">
664 <D value="1.40" unit="g/cm3"/>
665 <fraction n="1.0000" ref="argon"/>
668 <material name="Glass">
669 <D value="2.74351" unit="g/cm3"/>
670 <fraction n="0.600" ref="SiO2"/>
671 <fraction n="0.118" ref="Al2O3"/>
672 <fraction n="0.001" ref="Fe2O3"/>
673 <fraction n="0.224" ref="CaO"/>
674 <fraction n="0.034" ref="MgO"/>
675 <fraction n="0.010" ref="Na2O"/>
676 <fraction n="0.013" ref="TiO2"/>
679 <material name="Acrylic">
680 <D value="1.19" unit="g/cm3"/>
681 <fraction n="0.600" ref="carbon"/>
682 <fraction n="0.320" ref="oxygen"/>
683 <fraction n="0.080" ref="hydrogen"/>
695 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
696 #++++++++++++++++++++++++++++++++++++++++ gen_TPC ++++++++++++++++++++++++++++++++++++++++
697 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
703 #constructs everything inside volTPC, namely
704 # (moving from left to right, or from +x to -x)
705 # -volTPCPlaneU: with wires angled from vertical slightly different than in V
706 # -volTPCPlaneV: with wires angled from vertical slightly differently than in U
707 # -volTPCPlaneX: with vertical wires
710 # Create the TPC fragment file name,
711 # add file to list of output GDML fragments,
713 $TPC = "dune_10kT_TPC" . $suffix . ".gdml";
714 push (@gdmlFiles, $TPC);
716 open(TPC) or die("Could not open file $TPC for writing");
719 # The standard XML prefix and starting the gdml
721 <?xml version='1.0'?>
726 # All the TPC solids save the wires.
729 <box name="TPC" lunit="cm"
733 <box name="TPCPlane" lunit="cm"
734 x="$TPCWirePlaneThickness"
735 y="$TPCWirePlaneHeight"
736 z="$TPCWirePlaneLength"/>
737 <box name="TPCActive" lunit="cm"
740 z="$TPCActiveLength"/>
744 #++++++++++++++++++++++++++++ Wire Solids ++++++++++++++++++++++++++++++
748 <tube name="TPCWireVert"
749 rmax="0.5*$TPCWireThickness"
750 z="$TPCWirePlaneHeight"
756 # Set number of wires to default to zero, when $wires_on = 0, for a low memory
757 # version. But if $wires_on = 1, calculate the number of wires on each side of each
758 # plane to be used in the for loops
760 my $NumberCornerUWires = 0;
761 my $NumberSideUWires = 0;
762 my $NumberCommonUWires = 0;
763 my $NumberCornerVWires = 0;
764 my $NumberSideVWires = 0;
765 my $NumberCommonVWires = 0;
766 my $NumberVerticalWires = 0;
770 # Number of wires in one corner
771 $NumberCornerUWires = int( $TPCWirePlaneLength/($UWirePitch/$CosUAngle) );
773 $NumberCornerVWires = int( $TPCWirePlaneLength/($VWirePitch/$CosVAngle) );
775 # Total number of wires touching one vertical (longer) side
776 # Note that the total number of wires per plane is this + another set of corner wires
777 $NumberSideUWires = int( $TPCWirePlaneHeight/($UWirePitch/$SinUAngle) );
779 $NumberSideVWires = int( $TPCWirePlaneHeight/($VWirePitch/$SinVAngle) );
781 # Number of wires per side that aren't cut off by the corner
782 $NumberCommonUWires = $NumberSideUWires - $NumberCornerUWires;
784 $NumberCommonVWires = $NumberSideVWires - $NumberCornerVWires;
786 # number of wires on the vertical plane
787 $NumberVerticalWires = int( ($TPCWirePlaneLength-$TPCWireThickness)/$XWirePitch );
790 # These XML comments throughout make the GDML file easier to navigate
793 <!--+++++++++++++++++++ U Wire Solids ++++++++++++++++++++++-->
797 # The corner wires for the U plane
800 for ($i = 0; $i < $NumberCornerUWires; ++$i)
802 # Subtraction to avoid corners of wires overlapping the TPCPlane sides,
803 # equal to 0.5*TCPWireThickness*($TanUAngle+1/$TanUAngle),
804 # allowing for 30deg<UAngle
807 <tube name="TPCWireU$i"
808 rmax="0.5*$TPCWireThickness"
809 z="$UWirePitch*($TanUAngle+1/$TanUAngle)*($i+1)-0.01732"
816 # Next, the wire used many times in the middle of the U plane.
817 # Subtraction again to avoid wire corners overlapping, equal to
818 # 0.5*TCPWireThickness*2/$TanVAngle, allowing for 30deg<VAngle
821 <tube name="TPCWireUCommon"
822 rmax="0.5*$TPCWireThickness"
823 z="$TPCWirePlaneLength/$SinUAngle-0.02598"
830 #inform the gdml user why no wires show up when -w=0 is used
835 <!-- The command -w=0 has been used when running generate_dune_gdml-NEW.pl -->
837 <!-- This GDML version has no wires and uses much less memory -->
853 <!--+++++++++++++++++++ V Wire Solids ++++++++++++++++++++++-->
858 # The corner wires for the V plane
861 for ($i = 0; $i < $NumberCornerVWires; ++$i)
863 # Same subtraction to avoid corners of wires overlapping
868 <tube name="TPCWireV$i"
869 rmax="0.5*$TPCWireThickness"
870 z="$VWirePitch*($TanVAngle+1/$TanVAngle)*($i+1)-0.01732"
879 # The wire used many times in the middle of the V plane
880 # Same subtraction as U common
883 <tube name="TPCWireVCommon"
884 rmax="0.5*$TPCWireThickness"
885 z="$TPCWirePlaneLength/$SinVAngle-0.02598"
892 #inform the gdml user why no wires show up when -w=0 is used
897 <!-- no wires in this GDML -->
905 # Begin structure and create the vertical wire logical volume
909 <volume name="volTPCActive">
910 <materialref ref="LAr"/>
911 <solidref ref="TPCActive"/>
922 <!--+++++++++++++++++ Wire Logical Volumes ++++++++++++++++++++-->
930 <volume name="volTPCWireVert">
931 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
932 <solidref ref="TPCWireVert" />
936 # Corner U wires logical volumes
937 for ($i = 0; $i < $NumberCornerUWires; ++$i)
940 <volume name="volTPCWireU$i">
941 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
942 <solidref ref="TPCWireU$i" />
948 # Common U wire logical volume, referenced many times
950 <volume name="volTPCWireUCommon">
951 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
952 <solidref ref="TPCWireUCommon" />
956 # Corner V wires logical volumes
957 for ($i = 0; $i < $NumberCornerVWires; ++$i)
960 <volume name="volTPCWireV$i">
961 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
962 <solidref ref="TPCWireV$i" />
968 # Common V wire logical volume, referenced many times
970 <volume name="volTPCWireVCommon">
971 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
972 <solidref ref="TPCWireVCommon" />
977 #inform the gdml user why no wires show up when -w=0 is used
982 <!-- The command -w=0 has been used when running generate_dune_gdml-NEW.pl -->
984 <!-- This GDML version has no wires and uses much less memory -->
993 #+++++++++++++++++++++++++ Position physical wires ++++++++++++++++++++++++++
995 # ++++++++++++++++++++++ U Plane +++++++++++++++++++++++
997 # Create U plane logical volume
1006 <!--+++++++++++++++++++++ U Plane ++++++++++++++++++++++++-->
1009 <volume name="volTPCPlaneU">
1010 <materialref ref="LAr"/>
1011 <solidref ref="TPCPlane"/>
1024 # Starting with the bottom left corner wires:
1025 # x=0 to center the wires in the plane
1026 # y positioning: (-0.5*$TPCWirePlaneHeight) starts the incremental increase
1027 # from the bottom of the plane, and trigonometry gives the increment
1028 # z positioning: Looking at the plane from the positive x direction,
1029 # (0.5*$TPCWirePlaneLength) starts the incremental increase from
1030 # the lower left corner.
1031 # rotation: same as common wire in code below
1033 for ($i = 0; $i < $NumberCornerUWires; ++$i)
1035 my $ypos = (-0.5*$TPCWirePlaneHeight)+0.5*($i+1)*$UWire_yint;
1036 my $zpos = (0.5*$TPCWirePlaneLength)-0.5*($i+1)*$UWire_zint;
1038 my $diff=(0.5*$TPCWirePlaneLength)-0.5*($NumberCornerUWires)*$UWire_zint;
1039 my $zpos=$zpos-$diff;
1043 <volumeref ref="volTPCWireU$i"/>
1044 <position name="posTPCWireU$i" unit="cm" x="0" y="$ypos " z="$zpos"/>
1045 <rotationref ref="rPlusUAngleAboutX"/>
1052 # Moving upwards to the common wires:
1053 # x and z are zero to center the wires along a vertical axis
1054 # y positioning: The trick is positioning the lowest common wire so that the pitch
1055 # is consistent, then the increment is double the increment of
1056 # the corner wires since there is no z incriment.
1057 # rotation: wires in \\\\ direction, so +90deg to bring them to vertical and
1058 # +UAngle counterclockwise to arrive at proper orientation
1059 # Note that the counter maintains wire number (in pos. name) counting bottom to top
1061 for ($i = $NumberCornerUWires; $i < $NumberSideUWires; ++$i)
1063 my $ypos = (-0.5*$TPCWirePlaneHeight)+0.5*($NumberCornerUWires)*$UWire_yint+($i+1-$NumberCornerUWires)*$UWire_yint;
1067 <volumeref ref="volTPCWireUCommon"/>
1068 <position name="posTPCWireU$i" unit="cm" x="0" y="$ypos " z="0"/>
1069 <rotationref ref="rPlusUAngleAboutX"/>
1076 # Finally moving to the corner wires on the top right:
1077 # x=0 to center the wires in the plane
1078 # y positioning: plug wire number into same equation
1079 # z positioning: start at z=0 and go negatively at the same z increment
1080 # rotation: same as common wire in code above
1081 # note that the counter maintains wire number shown in the position name
1083 for ($i = $NumberSideUWires; $i < $NumberSideUWires+$NumberCornerUWires-1; ++$i)
1085 # Make a counter to recall the right logical volume reference:
1086 # We want the last U wire in this loop (the highest wire) to be the
1087 # first wire in the logical volume loop for U wires.
1089 $j = $NumberSideUWires+$NumberCornerUWires - $i - 2;
1091 # Note that since we are referencing the same logical volumes/same solids for
1092 # the top wires as well as the bottom, the pattern of "stacking" wire on top of wire
1093 # with an incremental separation is likely to cause the top corner wires to be a
1094 # a little shorter than they can be, but never any longer. There is no immediately
1095 # elegant way to fix this, but at 5mm pitch and around 45deg wire orientation, the
1096 # wires can be at most 1cm shorter than possible which is negligible until the top
1097 # 20 wires or so where 1cm is >5% of their length. This also means that there
1098 # could be one more space for a wire left over, but that is highly unlikely.
1100 my $ypos = (-0.5*$TPCWirePlaneHeight)+0.5*($NumberCornerUWires)*$UWire_yint+($NumberCommonUWires)*$UWire_yint+0.5*($i+1-$NumberSideUWires)*$UWire_yint;
1101 my $zpos = -0.5*($i+1-$NumberSideUWires)*$UWire_zint;
1105 <volumeref ref="volTPCWireU$j"/>
1106 <position name="posTPCWireU$i" unit="cm" x="0" y="$ypos " z="$zpos"/>
1107 <rotationref ref="rPlusUAngleAboutX"/>
1116 # ++++++++++++++++++++++ V Plane +++++++++++++++++++++++
1118 # End U plane and create V plane logical volume
1128 <!--+++++++++++++++++++++ V Plane ++++++++++++++++++++++++-->
1131 <volume name="volTPCPlaneV">
1132 <materialref ref="LAr"/>
1133 <solidref ref="TPCPlane"/>
1147 # Starting with the bottom right corner wires:
1148 # x=0 to center the wires in the plane
1149 # y positioning: (-0.5*$TPCWirePlaneHeight) starts the incremental increase
1150 # from the bottom of the plane, and trigonometry gives the increment
1151 # z positioning: Looking at the plane from the positive x direction,
1152 # (-0.5*$TPCWirePlaneLength) starts the incremental increase from
1153 # the lower right corner.
1154 # rotation: same as common wire in code below
1156 for ($i = 0; $i < $NumberCornerVWires; ++$i)
1158 my $ypos = (-0.5*$TPCWirePlaneHeight)+0.5*($i+1)*$VWire_yint;
1159 my $zpos = (-0.5*$TPCWirePlaneLength)+0.5*($i+1)*$VWire_zint;
1161 my $diff=(-0.5*$TPCWirePlaneLength)+0.5*($NumberCornerVWires)*$VWire_zint;
1162 my $zpos=$zpos-$diff;
1166 <volumeref ref="volTPCWireV$i"/>
1167 <position name="posTPCWireV$i" unit="cm" x="0" y="$ypos " z="$zpos"/>
1168 <rotationref ref="rPlusVAngleAboutX"/>
1175 # Moving upwards to the common wires:
1176 # x and z are zero to center the wires along a vertical axis
1177 # y positioning: Plug wire number into the same corner ypos equation
1178 # rotation: wires in //// direction, so +90deg to bring them to vertical and
1179 # --VAngle counterclockwise to arrive at proper orientation
1180 # Note that the counter maintains wire number in the position name
1182 for ($i = $NumberCornerVWires; $i < $NumberSideVWires; ++$i)
1184 my $ypos = (-0.5*$TPCWirePlaneHeight)-0.5*($NumberCornerVWires)*$VWire_yint+($i+1)*$VWire_yint;
1188 <volumeref ref="volTPCWireVCommon"/>
1189 <position name="posTPCWireV$i" unit="cm" x="0" y="$ypos " z="0"/>
1190 <rotationref ref="rPlusVAngleAboutX"/>
1197 # Finally moving to the corner wires on the top right:
1198 # x=0 to center the wires in the y
1199 # plane positioning: plug wire number into same equation
1200 # z positioning: start at z=0 and go positively at the same z increment
1201 # rotation: same as common wire in code above
1202 # note that the counter maintains wire number shown in the position name
1204 for ($i = $NumberSideVWires; $i < $NumberSideVWires+$NumberCornerVWires-1; ++$i)
1206 # Make a counter to recall the right logical volume reference where the last
1207 # wire in this loop is the smallest, first wire in the logical volume loop, just as in U
1209 $j = $NumberSideVWires+$NumberCornerVWires - $i - 2;
1211 # Note that since we are referencing the same logical volumes/same solids for
1212 # the top wires as well as the bottom, the pattern of "stacking" wire on top of wire
1213 # with an incremental separation is likely to cause the top corner wires to be a
1214 # a little shorter than they can be, but never any longer. Just as in U
1216 my $ypos = (-0.5*$TPCWirePlaneHeight)+0.5*($NumberCornerVWires)*$VWire_yint+($NumberCommonVWires)*$VWire_yint+0.5*($i+1-$NumberSideVWires)*$VWire_yint;
1217 my $zpos = 0.5*($i+1-$NumberSideVWires)*$VWire_zint;
1221 <volumeref ref="volTPCWireV$j"/>
1222 <position name="posTPCWireV$i" unit="cm" x="0" y="$ypos " z="$zpos"/>
1223 <rotationref ref="rPlusVAngleAboutX"/>
1232 # ++++++++++++++++++++++ X Plane +++++++++++++++++++++++
1234 # End V plane and create X plane logical volume
1243 <!--+++++++++++++++++++++ X Plane ++++++++++++++++++++++++-->
1246 <volume name="volTPCPlaneX">
1247 <materialref ref="LAr"/>
1248 <solidref ref="TPCPlane"/>
1261 # This is the simplest plane, one loop creates all of the wires
1262 # x and y position at zero to center the wires
1263 # z position: moving from front of detector to back, in the positive z direction,
1264 # starting at (-0.5*$TPCWirePlaneLength), the right side looking from
1267 for ($i=0; $i<$NumberVerticalWires; ++$i)
1270 # DocDb-6464 pg. 7 says that the center of the first wire is half of the pitch from the edge
1271 my $zpos = (-0.5*$TPCWirePlaneLength)+$TPCWireThickness/2+$XWirePitch*($i+0.5);
1275 <volumeref ref="volTPCWireVert"/>
1276 <position name="posTPCWireX$i" unit="cm" x="0" y="0 " z="$zpos"/>
1277 <rotationref ref="rPlus90AboutX" />
1289 #+++++++++++++++++++++ Position physical wires Above +++++++++++++++++++++
1291 #wrap up the TPC file
1293 <volume name="volTPC">
1294 <materialref ref="LAr" />
1295 <solidref ref="TPC" />
1297 <volumeref ref="volTPCPlaneU" />
1298 <position name="posTPCPlaneU" unit="cm" x="(-$TPCWidth/2)+3*$APAWirePlaneSpacing" y="0" z="0" />
1301 <volumeref ref="volTPCPlaneV" />
1302 <position name="posTPCPlaneV" unit="cm" x="(-$TPCWidth/2)+2*$APAWirePlaneSpacing" y="0" z="0" />
1305 <volumeref ref="volTPCPlaneX" />
1306 <position name="posTPCPlaneX" unit="cm" x="(-$TPCWidth/2)+$APAWirePlaneSpacing" y="0" z="0" />
1309 <volumeref ref="volTPCActive"/>
1310 <positionref ref="posTPCActive"/>
1319 } #end of sub gen_TPC
1325 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1326 #++++++++++++++++++++++++++++++++++++++ gen_Cryostat +++++++++++++++++++++++++++++++++++++
1327 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1332 # Create the cryostat fragment file name,
1333 # add file to list of output GDML fragments,
1335 $CRYO = "dune_10kT_Cryostat" . $suffix . ".gdml";
1336 push (@gdmlFiles, $CRYO);
1337 $CRYO = ">" . $CRYO;
1338 open(CRYO) or die("Could not open file $CRYO for writing");
1341 # The standard XML prefix and starting the gdml
1343 <?xml version='1.0'?>
1348 # All the cryostat solids.
1351 <box name="Cryostat" lunit="cm"
1354 z="$CryostatLength"/>
1355 <box name="ArgonInterior" lunit="cm"
1359 <box name="GaseousArgon" lunit="cm"
1361 y="$HeightGaseousAr"
1363 <subtraction name="SteelShell">
1364 <first ref="Cryostat"/>
1365 <second ref="ArgonInterior"/>
1368 <box name="Cathode" lunit="cm"
1373 <box name="LightPaddle" lunit="cm"
1374 x="$LightPaddleWidth"
1375 y="$LightPaddleHeight"
1376 z="$LightPaddleLength + $SiPM_z"/>
1378 <box name="APAFrameYSideHollow" lunit="cm"
1379 x="$APAFrameYSide_x-2*$EdgeFrameSteelThickness"
1380 y="$APAFrameYSide_y-2*$EdgeFrameSteelThickness"
1381 z="$APAFrameYSide_z" />
1382 <box name="APAFrameYSideShell" lunit="cm"
1383 x="$APAFrameYSide_x"
1384 y="$APAFrameYSide_y"
1385 z="$APAFrameYSide_z" />
1386 <subtraction name="APAFrameYSide">
1387 <first ref="APAFrameYSideShell" />
1388 <second ref="APAFrameYSideHollow"/>
1389 <positionref ref="posCenter" />
1390 <rotationref ref="rIdentity" />
1393 <box name="APAFrameZSideHollow" lunit="cm"
1394 x="$APAFrameZSide_x-2*$EdgeFrameSteelThickness"
1395 y="$APAFrameZSide_y-2*$EdgeFrameSteelThickness"
1396 z="$APAFrameZSide_z" />
1397 <box name="APAFrameZSideShell" lunit="cm"
1398 x="$APAFrameZSide_x"
1399 y="$APAFrameZSide_y"
1400 z="$APAFrameZSide_z" />
1401 <subtraction name="APAFrameZSide">
1402 <first ref="APAFrameZSideShell" />
1403 <second ref="APAFrameZSideHollow"/>
1404 <positionref ref="posCenter" />
1405 <rotationref ref="rIdentity" />
1408 <box name="APAFrameYOuterSupport" lunit="cm"
1409 x="$EdgeFrameSteelThickness"
1410 y="$APAFrameYOuterSupport_y"
1411 z="$APAFrameYOuterSupport_z" />
1413 <box name="APAFrameYInnerSupport" lunit="cm"
1414 x="$APAFrameYInnerSupport_x"
1415 y="$APAFrameYInnerSupport_y"
1416 z="$APAFrameYInnerSupport_z" />
1418 <box name="APAFrameZHalfSupport" lunit="cm"
1419 x="$APAFrameZHalfSupport_x"
1420 y="$APAFrameZHalfSupport_y"
1421 z="$APAFrameZHalfSupport_z" />
1425 # Cryostat structure
1428 <volume name="volSteelShell">
1429 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1430 <solidref ref="SteelShell" />
1432 <volume name="volGaseousArgon">
1433 <materialref ref="ArGas"/>
1434 <solidref ref="GaseousArgon"/>
1437 <volume name="volCathode">
1438 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1439 <solidref ref="Cathode" />
1442 <volume name="volOpDetSensitive">
1443 <materialref ref="Acrylic"/>
1444 <solidref ref="LightPaddle"/>
1447 <volume name="volAPAFrameYSide">
1448 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1449 <solidref ref="APAFrameYSide" />
1452 <volume name="volAPAFrameZSide">
1453 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1454 <solidref ref="APAFrameZSide" />
1457 <volume name="volAPAFrameYOuterSupport">
1458 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1459 <solidref ref="APAFrameYOuterSupport" />
1462 <volume name="volAPAFrameYInnerSupport">
1463 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1464 <solidref ref="APAFrameYInnerSupport" />
1467 <volume name="volAPAFrameZHalfSupport">
1468 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1469 <solidref ref="APAFrameZHalfSupport" />
1472 <volume name="volCryostat">
1473 <materialref ref="LAr" />
1474 <solidref ref="Cryostat" />
1476 <volumeref ref="volGaseousArgon"/>
1477 <position name="posGaseousArgon" unit="cm" x="0" y="$ArgonHeight/2-$HeightGaseousAr/2" z="0"/>
1480 <volumeref ref="volSteelShell"/>
1481 <position name="posSteelShell" unit="cm" x="0" y="0" z="0"/>
1485 # nested for loops to place the non-rotated AND rotated volTPC
1486 # x loop rotation: There are six drift volumes. Looking into the
1487 # detector from incident direction, and counting from right (-x) to
1488 # left (+x), odd number volumes need to be rotated 180deg about Y in
1489 # order for the cathode to be on the right of the APA.
1494 for($k=0 ; $k<$nAPALong ; $k++)
1497 for($i=0 ; $i<$nAPAWide+1 ; $i++)
1500 for($j=0 ; $j<$nAPAHigh ; $j++)
1504 $CAT_X = - $FiducialWidth/2
1508 $APACenter_x = - $FiducialWidth/2
1510 + ($i+0.5)*($APAWidth);
1512 $APACenter_y = - $ArgonHeight/2 + $SpaceAPAToFloor
1514 + $j*($APAHeight+$APAVerticalGap);
1516 $APACenter_z = - $ArgonLength/2
1517 + $UpstreamLArPadding
1519 + $k*($APALength+$APALongGap);
1525 <volumeref ref="volCathode" />
1526 <position name="posCathode\-$i\-$j\-$k" unit="cm" x="$CAT_X" y="$APACenter_y" z="$APACenter_z" />
1531 # This if statement is to stop placement of this last set of TPCs/LightPaddles when placing
1532 # the last set of CPAs that do not have any drift volume beyond them in +x
1536 # place APA volumes around this center: Frame, TPCs, paddles
1537 make_APA($APACenter_x, $APACenter_y, $APACenter_z, $i, $j, $k);
1539 for ($paddle = 0; $paddle<$nLightPaddlesPerAPA; $paddle++)
1542 # All Light Paddle centers will have the same
1543 # X coordinate as the center of the current APA
1544 # Z coordinate as the current TPC pair
1545 # The Y coordinate must be looped over:
1547 #the multiplication by j here is a temporary dirty trick to get around some strange behavior
1549 $Paddle_Y = $APACenter_y
1551 + $j*$FrameToPaddleSpace
1552 + (1-$j)*($LightPaddleHeight/2 + $APAFrameZSide_y)
1553 + $PaddleYInterval*$paddle;
1558 <volumeref ref="volOpDetSensitive"/>
1559 <position name="posPaddle\-$paddle\-TPC\-$i\-$j\-$k" unit="cm" x="$APACenter_x" y="$Paddle_Y" z="$APACenter_z + $SiPM_z/2"/>
1560 <rotationref ref="rIdentity"/>
1565 }#end Paddle for-loop
1585 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1586 #+++++++++++++++++++++++++++++++++++++++ make_APA ++++++++++++++++++++++++++++++++++++++++
1587 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1589 # Must be called only within gen_Cryostat(),
1590 # with APA center x, y, and z as three arguments
1595 $TPC_X_rot = $_[0] - ($TPCWidth+$APAFrame_x)/2;
1596 $TPC_X = $_[0] + ($TPCWidth+$APAFrame_x)/2;
1597 #for the rotation, remember the wires are on the negative side of volTPC
1601 <volumeref ref="volAPAFrameYOuterSupport"/>
1602 <position name="posAPAFrameYOuterSupportNeg\-$_[3]\-$_[4]\-$_[5]" unit="cm"
1603 x="$_[0] - ($APAFrameYOuterSupport_x + $APAFrameYInnerSupport_x/2 - $EdgeFrameSteelThickness/2)"
1606 <rotationref ref="rIdentity"/>
1609 <volumeref ref="volAPAFrameYOuterSupport"/>
1610 <position name="posAPAFrameYOuterSupportPos\-$_[3]\-$_[4]\-$_[5]" unit="cm"
1611 x="$_[0] + ($APAFrameYOuterSupport_x + $APAFrameYInnerSupport_x/2 - $EdgeFrameSteelThickness/2)"
1614 <rotationref ref="rIdentity"/>
1617 <volumeref ref="volAPAFrameYSide"/>
1618 <position name="posAPAFrameYSideNeg\-$_[3]\-$_[4]\-$_[5]" unit="cm"
1621 z="$_[2] - $APALength/2 + $APAFrameYSide_z/2"/>
1622 <rotationref ref="rIdentity"/>
1625 <volumeref ref="volAPAFrameYSide"/>
1626 <position name="posAPAFrameYSidePos\-$_[3]\-$_[4]\-$_[5]" unit="cm"
1629 z="$_[2] + $APALength/2 - $APAFrameYSide_z/2"/>
1630 <rotationref ref="rIdentity"/>
1633 <volumeref ref="volAPAFrameZSide"/>
1634 <position name="posAPAFrameZSidePos\-$_[3]\-$_[4]\-$_[5]" unit="cm"
1636 y="$_[1] + $APAHeight/2 - $APAFrameZSide_y/2"
1638 <rotationref ref="rIdentity"/>
1641 <volumeref ref="volAPAFrameZSide"/>
1642 <position name="posAPAFrameZSideNeg\-$_[3]\-$_[4]\-$_[5]" unit="cm"
1644 y="$_[1] - $APAHeight/2 + $APAFrameZSide_y/2"
1646 <rotationref ref="rIdentity"/>
1650 <volumeref ref="volTPC"/>
1651 <position name="posTPCrot\-$_[3]\-$_[4]\-$_[5]" unit="cm" x="$TPC_X_rot" y="$_[1]" z="$_[2]"/>
1652 <rotationref ref="rPlus180AboutY"/>
1655 <volumeref ref="volTPC"/>
1656 <position name="posTPC\-$_[3]\-$_[4]\-$_[5]" unit="cm" x="$TPC_X" y="$_[1]" z="$_[2]"/>
1657 <rotationref ref="rIdentity"/>
1665 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1666 #+++++++++++++++++++++++++++++++++++++ gen_Enclosure +++++++++++++++++++++++++++++++++++++
1667 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1672 # Create the detector enclosure fragment file name,
1673 # add file to list of output GDML fragments,
1675 $ENCL = "dune_10kT_DetEnclosure" . $suffix . ".gdml";
1676 push (@gdmlFiles, $ENCL);
1677 $ENCL = ">" . $ENCL;
1678 open(ENCL) or die("Could not open file $ENCL for writing");
1681 # The standard XML prefix and starting the gdml
1683 <?xml version='1.0'?>
1688 # 34kt differences: The following dimensions and positioning allows
1689 # end to end cryostats, as opposed to side by side in 10kt.
1691 # The x and z dimensions for ConcreteWall are switched
1694 # All the detector enclosure solids.
1698 <box name="FoamPadBlock" lunit="cm"
1699 x="$CryostatWidth+2*$FoamPadding"
1701 z="$CryostatLength+2*$FoamPadding" />
1703 <subtraction name="FoamPadding">
1704 <first ref="FoamPadBlock"/>
1705 <second ref="Cryostat"/>
1706 <position name="posCryoInFoam" x="0" y="0" z="0"/>
1709 <box name="ConcreteWall" lunit="cm"
1710 x="$CryostatWidth+2*$TotalPadding"
1711 y="$CryostatHeight+$ConcretePadding"
1712 z="$ArToAr-2*$FoamPadding"/>
1714 <box name="DetEnclosure" lunit="cm"
1724 # Detector enclosure structure
1727 <volume name="volFoamPadding">
1728 <materialref ref="fibrous_glass"/>
1729 <solidref ref="FoamPadding"/>
1732 <volume name="volConcreteWall">
1733 <materialref ref="Concrete"/>
1734 <solidref ref="ConcreteWall"/>
1737 <volume name="volDetEnclosure">
1738 <materialref ref="Concrete"/>
1739 <solidref ref="DetEnclosure"/>
1741 <volumeref ref="volFoamPadding"/>
1742 <position name="posNegFoamCryo" unit="cm"
1744 y="$ConcretePadding/2"
1745 z="-$CryostatLength/2-$ArToAr/2-$FoamPadding"/>
1748 <volumeref ref="volCryostat"/>
1749 <position name="posNegCryo" unit="cm"
1751 y="$ConcretePadding/2"
1752 z="-$CryostatLength/2-$ArToAr/2-$FoamPadding" />
1755 <volumeref ref="volConcreteWall"/>
1756 <position name="posConcreteWall" unit="cm"
1762 <volumeref ref="volFoamPadding"/>
1763 <position name="posPosFoamCryo" unit="cm"
1765 y="$ConcretePadding/2"
1766 z="$CryostatLength/2+$ArToAr/2+$FoamPadding"/>
1769 <volumeref ref="volCryostat"/>
1770 <position name="posPosCryo" unit="cm"
1772 y="$ConcretePadding/2"
1773 z="$CryostatLength/2+$ArToAr/2+$FoamPadding" />
1786 # 34kt difference: world volumes such as hillside and service building were
1787 # defined here in their own generate submethods, but 34kt won't have those,
1788 # ind if it does have something similar, we can start with these submethods
1789 # saved in the 10kt script.
1791 ### TODO: World is just a large volume (> 900x900x900m) containing the detector
1792 ### enclosre positioned such that the world origin is exactly in the place
1793 ### we want it--see OriginYSet, and OrignZSet in the parameters at beginning.
1794 ### The mother material is rock, and there is no air yet. Work on this will
1795 ### come when the time deems it relevant/priority
1798 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1799 #+++++++++++++++++++++++++++++++++++++++ gen_World +++++++++++++++++++++++++++++++++++++++
1800 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1805 # Create the WORLD fragment file name,
1806 # add file to list of output GDML fragments,
1808 $WORLD = "dune_10kT_World" . $suffix . ".gdml";
1809 push (@gdmlFiles, $WORLD);
1810 $WORLD = ">" . $WORLD;
1811 open(WORLD) or die("Could not open file $WORLD for writing");
1814 # The standard XML prefix and starting the gdml
1816 <?xml version='1.0'?>
1821 # All the World solids.
1824 <box name="World" lunit="cm"
1834 <volume name="volWorld" >
1835 <materialref ref="DUSEL_Rock"/>
1836 <solidref ref="World"/>
1838 <volumeref ref="volDetEnclosure"/>
1839 <position name="posDetEnclosure" unit="cm" x="0" y="$OriginYSet" z="$OriginZSet"/>
1846 # make_gdml.pl will take care of <setup/>
1853 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1854 #++++++++++++++++++++++++++++++++++++ write_fragments ++++++++++++++++++++++++++++++++++++
1855 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1857 sub write_fragments()
1859 # This subroutine creates an XML file that summarizes the the subfiles output
1860 # by the other sub routines - it is the input file for make_gdml.pl which will
1861 # give the final desired GDML file. Specify its name with the output option.
1862 # (you can change the name when running make_gdml)
1864 # This code is taken straigh from the similar MicroBooNE generate script, Thank you.
1866 if ( ! defined $output )
1868 $output = "-"; # write to STDOUT
1871 # Set up the output file.
1872 $OUTPUT = ">" . $output;
1873 open(OUTPUT) or die("Could not open file $OUTPUT");
1876 <?xml version='1.0'?>
1878 <!-- Input to Geometry/gdml/make_gdml.pl; define the GDML fragments
1879 that will be zipped together to create a detector description.
1886 <!-- These files contain GDML <constant></constant>
1887 blocks. They are read in separately, so they can be
1888 interpreted into the remaining GDML. See make_gdml.pl for
1894 foreach $filename (@defFiles)
1897 <filename> $filename </filename>
1907 <!-- The GDML file fragments to be zipped together. -->
1911 foreach $filename (@gdmlFiles)
1914 <filename> $filename </filename>