3 ##################################################################################
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 3x1x1 dual phase geometry (e.g. driftTPCActive
8 # and number of CRM's).
9 # More detector elements are going to be added (e.g. PMTs, field cage, ...)
10 # For more info, please contact Christoph Alt: christoph.alt@cern.ch
12 # !!!NOTE!!!: the readout is on a positive X -- a fix for electric field
13 # direction problem in larsoft
15 ##################################################################################
23 Math::BigFloat->precision(-16);
25 GetOptions( "help|h" => \$help,
26 "suffix|s:s" => \$suffix,
27 "output|o:s" => \$output,
28 "wires|w:s" => \$wires);
34 # If the user requested help, print the usage notes and exit.
39 if ( ! defined $suffix )
41 # The user didn't supply a suffix, so append nothing to the file
47 # Otherwise, stick a "-" before the suffix, so that a suffix of
48 # "test" applied to filename.gdml becomes "filename-test.gdml".
49 $suffix = "-" . $suffix;
52 #if ( ! defined $workspace ) # not done
56 #elsif ( $workspace == 1)
58 # print "\t\tCreating smaller workspace geometry.\n";
61 # set wires on to be the default, unless given an input by the user
62 $wires_on = 1; # 1=on, 0=off
70 $basename = "3x1x1dphase";
73 $basename = $basename."_nowires";
76 #if ( $workspace == 1 )
78 # $basename = $basename."_workspace";
82 ##################################################################
83 ############## Parameters for Charge Readout Plane ###############
86 $wirePitch = 0.3125; # channel pitch
87 $nChannelsLengthPerCRM = 960; # channels along the length of the CRM
88 $nChannelsWidthPerCRM = 320; # channels along the width of the CRM
89 $borderCRM = 0.5; # dead space at the border of each CRM
91 # dimensions of a single Charge Readout Module (CRM)
92 $widthCRM_active = $wirePitch * $nChannelsWidthPerCRM;
93 $lengthCRM_active = $wirePitch * $nChannelsLengthPerCRM;
95 $widthCRM = $widthCRM_active + 2 * $borderCRM;
96 $lengthCRM = $lengthCRM_active + 2 * $borderCRM;
98 # number of CRMs in y and z
102 # calculate tpc area based on number of CRMs and their dimensions
103 $widthTPCActive = $nCRM_y * $widthCRM; # around 100
104 $lengthTPCActive = $nCRM_z * $lengthCRM; # around 300
106 # active volume dimensions
107 $driftTPCActive = 100.0;
109 # model anode strips as wires
111 $ReadoutPlane = 2 * $padWidth;
113 #$padHeight = 0.0035;
115 ##################################################################
116 ############## Parameters for TPC and inner volume ###############
118 # inner volume dimensions of the cryostat
123 # height of gas argon layer on top
124 $HeightGaseousAr = 50.8;
126 # size of liquid argon buffer
127 $xLArBuffer = $Argon_x - $driftTPCActive - $HeightGaseousAr - $ReadoutPlane;
128 $yLArBuffer = 0.5 * ($Argon_y - $widthTPCActive);
129 $zLArBuffer = 0.5 * ($Argon_z - $lengthTPCActive);
132 $SteelThickness = 0.12; # membrane
134 $Cryostat_x = $Argon_x + 2*$SteelThickness;
135 $Cryostat_y = $Argon_y + 2*$SteelThickness;
136 $Cryostat_z = $Argon_z + 2*$SteelThickness;
138 ##################################################################
139 ############## Parameters for PMTs ###############
141 #pos in cm inside the cryostat X coordinate: 2.3cm from the ground grid
142 @pmt_pos = ( ' x="-46.06" y="0" z="-92.246"', #-92.246"', #PMT1 - negative base - direct coating #x="-50-4.5+5.5*2.54-1.27*2.54-2.3"
143 ' x="-46.06" y="0" z="-46.123"', #-46.123"', #PMT2- negative base - plate
144 ' x="-46.06" y="0" z="0"', #PMT3 - positive base - direct coating
145 ' x="-46.06" y="0" z="46.123"', #46.123"', #PMT4 - positive base - plate
146 ' x="-46.06" y="0" z="92.246"'); #92.246"'); #PMT5 - negative base - direct coating
149 ##################################################################
150 ############## DetEnc and World relevant parameters #############
152 $SteelSupport_x = 0.6;
153 $SteelSupport_y = 0.6;
154 $SteelSupport_z = 0.6;
155 $FoamPadding = 102.3;
156 $FracMassOfSteel = 0.5; #The steel support is not a solid block, but a mixture of air and steel
157 $FracMassOfAir = 1 - $FracMassOfSteel;
160 $SpaceSteelSupportToWall = 0;
161 $SpaceSteelSupportToCeiling = 0;
163 $DetEncX = $Cryostat_x
164 + 2*($SteelSupport_x + $FoamPadding) + $SpaceSteelSupportToCeiling;
166 $DetEncY = $Cryostat_y
167 + 2*($SteelSupport_y + $FoamPadding) + 2*$SpaceSteelSupportToWall;
169 $DetEncZ = $Cryostat_z
170 + 2*($SteelSupport_z + $FoamPadding) + 2*$SpaceSteelSupportToWall;
172 $posCryoInDetEnc_x = - $DetEncX/2 + $SteelSupport_x + $FoamPadding + $Cryostat_x/2;
175 # 2*AirThickness is added to the world volume in x, y and z
176 $AirThickness = 3000;
178 # We want the world origin to be vertically centered on active TPC
179 # This is to be added to the x and y position of every volume in volWorld
181 $OriginXSet = $DetEncX/2.0
186 -$driftTPCActive/2.0;
188 $OriginYSet = $DetEncY/2.0
189 - $SpaceSteelSupportToWall
194 - $widthTPCActive/2.0;
196 # We want the world origin to be at the very front of the fiducial volume.
197 # move it to the front of the enclosure, then back it up through the concrete/foam,
198 # then through the Cryostat shell, then through the upstream dead LAr (including the
199 # dead LAr on the edge of the TPC)
200 # This is to be added to the z position of every volume in volWorld
202 $OriginZSet = $DetEncZ/2.0
203 - $SpaceSteelSupportToWall
211 ##################################################################
212 ############### Parameters for det elements ######################
215 #$Cathode_x = $widthTPCActive;
217 #$Cathode_z = $lengthTPCActive;
221 #+++++++++++++++++++++++++ End defining variables ++++++++++++++++++++++++++
224 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
225 #+++++++++++++++++++++++++++++++++++++++++ usage +++++++++++++++++++++++++++++++++++++++++
226 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
230 print "Usage: $0 [-h|--help] [-o|--output <fragments-file>] [-s|--suffix <string>]\n";
231 print " if -o is omitted, output goes to STDOUT; <fragments-file> is input to make_gdml.pl\n";
232 print " -s <string> appends the string to the file names; useful for multiple detector versions\n";
233 print " -h prints this message, then quits\n";
238 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
239 #++++++++++++++++++++++++++++++++++++++ gen_Define +++++++++++++++++++++++++++++++++++++++
240 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
245 # Create the <define> fragment file name,
246 # add file to list of fragments,
248 $DEF = $basename."_Def" . $suffix . ".gdml";
249 push (@gdmlFiles, $DEF);
251 open(DEF) or die("Could not open file $DEF for writing");
255 <?xml version='1.0'?>
265 <position name="posCryoInDetEnc" unit="cm" x="$posCryoInDetEnc_x" y="0" z="0"/>
266 <position name="posCenter" unit="cm" x="0" y="0" z="0"/>
267 <rotation name="rPlus90AboutX" unit="deg" x="90" y="0" z="0"/>
268 <rotation name="rMinus90AboutY" unit="deg" x="0" y="270" z="0"/>
269 <rotation name="rMinus90AboutYMinus90AboutX" unit="deg" x="270" y="270" z="0"/>
270 <rotation name="rPlus180AboutX" unit="deg" x="180" y="0" z="0"/>
271 <rotation name="rPlus180AboutY" unit="deg" x="0" y="180" z="0"/>
272 <rotation name="rPlus180AboutXPlus180AboutY" unit="deg" x="180" y="180" z="0"/>
273 <rotation name="rIdentity" unit="deg" x="0" y="0" z="0"/>
280 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
281 #+++++++++++++++++++++++++++++++++++++ gen_Materials +++++++++++++++++++++++++++++++++++++
282 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
287 # Create the <materials> fragment file name,
288 # add file to list of output GDML fragments,
290 $MAT = $basename."_Materials" . $suffix . ".gdml";
291 push (@gdmlFiles, $MAT);
294 open(MAT) or die("Could not open file $MAT for writing");
296 # Add any materials special to this geometry by defining a mulitline string
297 # and passing it to the gdmlMaterials::gen_Materials() function.
299 <!-- preliminary values -->
300 <material name="AirSteelMixture" formula="AirSteelMixture">
301 <D value=" @{[0.001205*(1-$FracMassOfSteel) + 7.9300*$FracMassOfSteel]} " unit="g/cm3"/>
302 <fraction n="$FracMassOfSteel" ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
303 <fraction n="$FracMassOfAir" ref="Air"/>
307 # add the general materials used anywere
308 print MAT gdmlMaterials::gen_Materials( $asmix );
313 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
314 #++++++++++++++++++++++++++++++++++++++++ gen_TPC ++++++++++++++++++++++++++++++++++++++++
315 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
319 my $TPCActive_x = $driftTPCActive;
320 my $TPCActive_y = $widthCRM_active;
321 my $TPCActive_z = $lengthCRM_active;
324 my $TPC_x = $TPCActive_x + $ReadoutPlane;
325 my $TPC_y = $widthCRM;
326 my $TPC_z = $lengthCRM;
329 $TPC = $basename."_TPC" . $suffix . ".gdml";
330 push (@gdmlFiles, $TPC);
332 open(TPC) or die("Could not open file $TPC for writing");
334 # The standard XML prefix and starting the gdml
336 <?xml version='1.0'?>
341 # All the TPC solids save the wires.
344 <box name="CRM" lunit="cm"
348 <box name="CRMVPlane" lunit="cm"
352 <box name="CRMZPlane" lunit="cm"
356 <box name="CRMActive" lunit="cm"
363 #++++++++++++++++++++++++++++ Wire Solids ++++++++++++++++++++++++++++++
364 # in principle we only need only one wire solid, since CRM is a square
365 # but to be more general ...
369 <tube name="CRMWireV"
370 rmax="@{[0.5*$padWidth]}"
375 <tube name="CRMWireZ"
376 rmax="@{[0.5*$padWidth]}"
386 # Begin structure and create wire logical volumes
389 <volume name="volTPCActive">
390 <materialref ref="LAr"/>
391 <solidref ref="CRMActive"/>
392 <auxiliary auxtype="SensDet" auxvalue="SimEnergyDeposit"/>
399 <volume name="volTPCWireV">
400 <materialref ref="Copper_Beryllium_alloy25"/>
401 <solidref ref="CRMWireV"/>
404 <volume name="volTPCWireZ">
405 <materialref ref="Copper_Beryllium_alloy25"/>
406 <solidref ref="CRMWireZ"/>
413 <volume name="volTPCPlaneV">
414 <materialref ref="LAr"/>
415 <solidref ref="CRMVPlane"/>
418 if ($wires_on==1) # add wires to Y plane (plane with wires reading y position)
420 for($i=0;$i<$nChannelsWidthPerCRM;++$i)
422 my $ypos = -0.5 * $TPCActive_y + ($i+0.5)*$wirePitch + 0.5*$padWidth;
426 <volumeref ref="volTPCWireV"/>
427 <position name="posWireV$i" unit="cm" x="0" y="$ypos" z="0"/>
428 <rotationref ref="rIdentity"/>
437 <volume name="volTPCPlaneZ">
438 <materialref ref="LAr"/>
439 <solidref ref="CRMZPlane"/>
443 if ($wires_on==1) # add wires to Z plane (plane with wires reading z position)
445 for($i=0;$i<$nChannelsLengthPerCRM;++$i)
448 my $zpos = -0.5 * $TPCActive_z + ($i+0.5)*$wirePitch + 0.5*$padWidth;
451 <volumeref ref="volTPCWireZ"/>
452 <position name="posWireZ$i" unit="cm" x="0" y="0" z="$zpos"/>
453 <rotationref ref="rPlus90AboutX"/>
465 $posVplane[0] = 0.5*$TPC_x - 1.5*$padWidth;
469 $posZplane[0] = 0.5*$TPC_x - 0.5*$padWidth;
473 $posTPCActive[0] = -$ReadoutPlane;
474 $posTPCActive[1] = 0;
475 $posTPCActive[2] = 0;
478 #wrap up the TPC file
481 <volume name="volTPC">
482 <materialref ref="LAr"/>
483 <solidref ref="CRM"/>
485 <volumeref ref="volTPCPlaneV"/>
486 <position name="posPlaneV" unit="cm"
487 x="$posVplane[0]" y="$posVplane[1]" z="$posVplane[2]"/>
488 <rotationref ref="rIdentity"/>
491 <volumeref ref="volTPCPlaneZ"/>
492 <position name="posPlaneZ" unit="cm"
493 x="$posZplane[0]" y="$posZplane[1]" z="$posZplane[2]"/>
494 <rotationref ref="rIdentity"/>
497 <volumeref ref="volTPCActive"/>
498 <position name="posActive" unit="cm"
499 x="@{[$posTPCActive[0]+$padWidth]}" y="$posTPCActive[1]" z="$posTPCActive[2]"/>
500 <rotationref ref="rIdentity"/>
513 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
514 #++++++++++++++++++++++++++++++++++++++ gen_pmt +++++++++++++++++++++++++++++++++++++
515 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
522 #$PMT_COATING_THICKNESS=0.2;
523 #$PMT_PLATE_THICKNESS=0.4;
524 #$PMT_GLASS_THICKNESS=0.2;
526 $PMT = $basename."_PMT" . $suffix . ".gdml";
527 push (@gdmlFiles, $PMT);
529 open(PMT) or die("Could not open file $PMT for writing");
535 <tube name="PMTVolume"
542 <tube name="PMT_AcrylicPlate"
549 <tube name="PMT_plate_coat"
557 <tube aunit="deg" deltaphi="360" lunit="mm" name="pmtMiddleCylinder" rmax="102.351822048586" rmin="100.351822048586" startphi="0" z="54"/>
558 <sphere aunit="deg" deltaphi="360" deltatheta="50" lunit="mm" name="sphPartTop" rmax="133" rmin="131" startphi="0" starttheta="0"/>
559 <union name="pmt0x7fb8f489dfe0">
560 <first ref="pmtMiddleCylinder"/>
561 <second ref="sphPartTop"/>
562 <position name="pmt0x7fb8f489dfe0_pos" unit="mm" x="0" y="0" z="-57.2051768689367"/>
564 <sphere aunit="deg" deltaphi="360" deltatheta="31.477975238527" lunit="mm" name="sphPartBtm" rmax="133" rmin="131" startphi="0" starttheta="130"/>
565 <union name="pmt0x7fb8f48a0d50">
566 <first ref="pmt0x7fb8f489dfe0"/>
567 <second ref="sphPartBtm"/>
568 <position name="pmt0x7fb8f48a0d50_pos" unit="mm" x="0" y="0" z="57.2051768689367"/>
570 <tube aunit="deg" deltaphi="360" lunit="mm" name="pmtBtmTube" rmax="44.25" rmin="42.25" startphi="0" z="72"/>
571 <union name="solidpmt">
572 <first ref="pmt0x7fb8f48a0d50"/>
573 <second ref="pmtBtmTube"/>
574 <position name="solidpmt_pos" unit="mm" x="0" y="0" z="-104.905637496842"/>
576 <sphere aunit="deg" deltaphi="360" deltatheta="50" lunit="mm" name="pmt0x7fb8f48a1eb0" rmax="133.2" rmin="133" startphi="0" starttheta="0"/>
577 <sphere aunit="deg" deltaphi="360" deltatheta="46.5" lunit="mm" name="pmt0x7fb8f48a4860" rmax="131" rmin="130.999" startphi="0" starttheta="0"/>
584 <volume name="volPMTplatecoat">
585 <materialref ref="TPB"/>
586 <solidref ref="PMT_plate_coat"/>
587 <auxiliary auxtype="SensDet" auxvalue="PhotonDetector"/>
590 <volume name="vol_PMT_AcrylicPlate">
591 <materialref ref="Acrylic"/>
592 <solidref ref="PMT_AcrylicPlate"/>
595 <volume name="pmtCoatVol">
596 <materialref ref="TPB"/>
597 <solidref ref="pmt0x7fb8f48a1eb0"/>
598 <auxiliary auxtype="SensDet" auxvalue="PhotonDetector"/>
601 <volume name="allpmt">
602 <materialref ref="Glass"/>
603 <solidref ref="solidpmt"/>
608 <volume name="volPMT_plate">
609 <materialref ref="LAr"/>
610 <solidref ref="PMTVolume"/>
613 <volumeref ref="allpmt"/>
614 <position name="posallpmt" unit="cm" x="0" y="0" z="1.27*2.54"/>
617 <physvol name="volOpDetSensitive">
618 <volumeref ref="volPMTplatecoat"/>
619 <position name="posOpDetSensitive" unit="cm" x="0" y="0" z="1.27*2.54+2.5*2.54 + 1.7"/>
623 <volumeref ref="vol_PMT_AcrylicPlate"/>
624 <position name="pos_PMT_AcrylicPlate" unit="cm" x="0" y="0" z="1.27*2.54+2.5*2.54 + 1.5"/>
628 <volume name="volPMT_coated">
629 <materialref ref="LAr"/>
630 <solidref ref="PMTVolume"/>
633 <volumeref ref="allpmt"/>
634 <position name="posallpmt" unit="cm" x="0" y="0" z="1.27*2.54"/>
637 <physvol name="volOpDetSensitive">
638 <volumeref ref="pmtCoatVol"/>
639 <position name="posOpDetSensitive" unit="cm" x="0" y="0" z="1.27*2.54- (2.23*2.54)"/>
650 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
651 #++++++++++++++++++++++++++++++++++++++ gen_Cryostat +++++++++++++++++++++++++++++++++++++
652 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
657 # Create the cryostat fragment file name,
658 # add file to list of output GDML fragments,
660 $CRYO = $basename."_Cryostat" . $suffix . ".gdml";
661 push (@gdmlFiles, $CRYO);
663 open(CRYO) or die("Could not open file $CRYO for writing");
666 # The standard XML prefix and starting the gdml
668 <?xml version='1.0'?>
672 # All the cryostat solids.
675 <box name="Cryostat" lunit="cm"
680 <box name="ArgonInterior" lunit="cm"
685 <box name="GaseousArgon" lunit="cm"
690 <subtraction name="SteelShell">
691 <first ref="Cryostat"/>
692 <second ref="ArgonInterior"/>
701 <volume name="volSteelShell">
702 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
703 <solidref ref="SteelShell" />
705 <volume name="volGaseousArgon">
706 <materialref ref="ArGas"/>
707 <solidref ref="GaseousArgon"/>
710 <volume name="volCryostat">
711 <materialref ref="LAr" />
712 <solidref ref="Cryostat" />
714 <volumeref ref="volGaseousArgon"/>
715 <position name="posGaseousArgon" unit="cm" x="$Argon_x/2-$HeightGaseousAr/2" y="0" z="0"/>
718 <volumeref ref="volSteelShell"/>
719 <position name="posSteelShell" unit="cm" x="0" y="0" z="0"/>
724 if ($tpc_on==1) # place TPC inside croysotat
727 $posX = $Argon_x/2 - $HeightGaseousAr - 0.5*($driftTPCActive + $ReadoutPlane);
728 for($ii=0;$ii<$nCRM_z;$ii++)
730 $posZ = -0.5*$Argon_z + $zLArBuffer + ($ii+0.5)*$lengthCRM;
732 for($jj=0;$jj<$nCRM_y;$jj++)
734 $posY = -0.5*$Argon_y + $yLArBuffer + ($jj+0.5)*$widthCRM;
737 <volumeref ref="volTPC"/>
738 <position name="posTPC\-$ii\-$jj" unit="cm"
739 x="$posX" y="$posY" z="$posZ"/>
748 if ( $pmt_switch eq "on" ) {
749 for ( $i=0; $i<5; $i=$i+1 ) { # pmts with coating
753 if ( $i eq "1" || $i eq "3") {
755 <volumeref ref="volPMT_plate"/>
760 <volumeref ref="volPMT_coated"/>
765 <position name="posPMT$i" unit="cm" @pmt_pos[$i]/>
766 <rotationref ref="rMinus90AboutY"/>
785 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
786 #+++++++++++++++++++++++++++++++++++++ gen_Enclosure +++++++++++++++++++++++++++++++++++++
787 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
792 # Create the detector enclosure fragment file name,
793 # add file to list of output GDML fragments,
795 $ENCL = $basename."_DetEnclosure" . $suffix . ".gdml";
796 push (@gdmlFiles, $ENCL);
798 open(ENCL) or die("Could not open file $ENCL for writing");
801 # The standard XML prefix and starting the gdml
803 <?xml version='1.0'?>
808 # All the detector enclosure solids.
812 <box name="FoamPadBlock" lunit="cm"
813 x="@{[$Cryostat_x + 2*$FoamPadding]}"
814 y="@{[$Cryostat_y + 2*$FoamPadding]}"
815 z="@{[$Cryostat_z + 2*$FoamPadding]}" />
817 <subtraction name="FoamPadding">
818 <first ref="FoamPadBlock"/>
819 <second ref="Cryostat"/>
820 <positionref ref="posCenter"/>
823 <box name="SteelSupportBlock" lunit="cm"
824 x="@{[$Cryostat_x + 2*$FoamPadding + 2*$SteelSupport_x]}"
825 y="@{[$Cryostat_y + 2*$FoamPadding + 2*$SteelSupport_y]}"
826 z="@{[$Cryostat_z + 2*$FoamPadding + 2*$SteelSupport_z]}" />
828 <subtraction name="SteelSupport">
829 <first ref="SteelSupportBlock"/>
830 <second ref="FoamPadBlock"/>
831 <positionref ref="posCenter"/>
834 <box name="DetEnclosure" lunit="cm"
843 # Detector enclosure structure
846 <volume name="volFoamPadding">
847 <materialref ref="foam_3x1x1dp"/>
848 <solidref ref="FoamPadding"/>
851 <volume name="volSteelSupport">
852 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
853 <solidref ref="SteelSupport"/>
856 <volume name="volDetEnclosure">
857 <materialref ref="Air"/>
858 <solidref ref="DetEnclosure"/>
861 <volumeref ref="volFoamPadding"/>
862 <positionref ref="posCryoInDetEnc"/>
865 <volumeref ref="volSteelSupport"/>
866 <positionref ref="posCryoInDetEnc"/>
869 <volumeref ref="volCryostat"/>
870 <positionref ref="posCryoInDetEnc"/>
889 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
890 #+++++++++++++++++++++++++++++++++++++++ gen_World +++++++++++++++++++++++++++++++++++++++
891 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
896 # Create the WORLD fragment file name,
897 # add file to list of output GDML fragments,
899 $WORLD = $basename."_World" . $suffix . ".gdml";
900 push (@gdmlFiles, $WORLD);
901 $WORLD = ">" . $WORLD;
902 open(WORLD) or die("Could not open file $WORLD for writing");
905 # The standard XML prefix and starting the gdml
907 <?xml version='1.0'?>
912 # All the World solids.
915 <box name="World" lunit="cm"
916 x="@{[$DetEncX+2*$AirThickness]}"
917 y="@{[$DetEncY+2*$AirThickness]}"
918 z="@{[$DetEncZ+2*$AirThickness]}"/>
925 <volume name="volWorld" >
926 <materialref ref="Air"/>
927 <solidref ref="World"/>
930 <volumeref ref="volDetEnclosure"/>
931 <position name="posDetEnclosure" unit="cm" x="$OriginXSet" y="$OriginYSet" z="$OriginZSet"/>
939 # make_gdml.pl will take care of <setup/>
946 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
947 #++++++++++++++++++++++++++++++++++++ write_fragments ++++++++++++++++++++++++++++++++++++
948 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
950 sub write_fragments()
952 # This subroutine creates an XML file that summarizes the the subfiles output
953 # by the other sub routines - it is the input file for make_gdml.pl which will
954 # give the final desired GDML file. Specify its name with the output option.
955 # (you can change the name when running make_gdml)
957 # This code is taken straigh from the similar MicroBooNE generate script, Thank you.
959 if ( ! defined $output )
961 $output = "-"; # write to STDOUT
964 # Set up the output file.
965 $OUTPUT = ">" . $output;
966 open(OUTPUT) or die("Could not open file $OUTPUT");
969 <?xml version='1.0'?>
971 <!-- Input to Geometry/gdml/make_gdml.pl; define the GDML fragments
972 that will be zipped together to create a detector description.
979 <!-- These files contain GDML <constant></constant>
980 blocks. They are read in separately, so they can be
981 interpreted into the remaining GDML. See make_gdml.pl for
987 foreach $filename (@defFiles)
990 <filename> $filename </filename>
1000 <!-- The GDML file fragments to be zipped together. -->
1004 foreach $filename (@gdmlFiles)
1007 <filename> $filename </filename>
1022 print "Some key parameters for dual-phase LAr TPC (unit cm unless noted otherwise)\n";
1023 print "CRM active area : $widthCRM_active x $lengthCRM_active\n";
1024 print "CRM total area : $widthCRM x $lengthCRM\n";
1025 print "TPC active volume : $driftTPCActive x $widthTPCActive x $lengthTPCActive\n";
1026 print "Argon buffer : ($xLArBuffer, $yLArBuffer, $zLArBuffer) \n";
1027 print "Detector enclosure : $DetEncX x $DetEncY x $DetEncZ\n";
1028 print "TPC Origin : ($OriginXSet, $OriginYSet, $OriginZSet) \n";
1029 print "PMTs : $pmt_switch \n";
1031 # run the sub routines that generate the fragments
1032 if ( $pmt_switch eq "on" ) { gen_pmt(); }
1035 gen_Define(); # generates definitions at beginning of GDML
1036 gen_Materials(); # generates materials to be used
1037 gen_TPC(); # generate TPC for a given unit CRM
1040 gen_World(); # places the enclosure among DUSEL Rock
1043 write_fragments(); # writes the XML input for make_gdml.pl
1044 # which zips together the final GDML