All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
generate_icarus_geometry_splitwire.pl
Go to the documentation of this file.
1 #!/usr/bin/perl
2 
3 
4 # Each subroutine generates a fragment GDML file, and the last subroutine
5 # creates an XML file that make_gdml.pl will use to appropriately arrange
6 # the fragment GDML files to create the final desired ICARUS GDML file,
7 # to be named by make_gdml output command
8 
9 # If you are playing with different geometries, you can use the
10 # suffix command to help organize your work.
11 
12 use Math::Trig;
13 use Getopt::Long;
14 use Math::BigFloat;
15 Math::BigFloat->precision(-16);
16 #Math::BigFloat->accuracy(16);
17 
18 GetOptions( "help|h" => \$help,
19  "suffix|s:s" => \$suffix,
20  "output|o:s" => \$output,
21  "concrete|c:s" => \$thickness_over,
22  "wires|w:s" => \$wires,
23  "vetocrt|v:s" => \$crt);
24 
25 if ( defined $help )
26 {
27  # If the user requested help, print the usage notes and exit.
28  usage();
29  exit;
30 }
31 
32 if ( ! defined $suffix )
33 {
34  # The user didn't supply a suffix, so append nothing to the file
35  # names.
36  $suffix = "";
37 }
38 else
39 {
40  # Otherwise, stick a "-" before the suffix, so that a suffix of
41  # "test" applied to filename.gdml becomes "filename-test.gdml".
42  $suffix = "-" . $suffix;
43 }
44 
45 #++++++++++++++++++++++++ Begin defining variables +++++++++++++++++++++++++
46 
47 # set wires on to be the default, unless given an input by the user: 1=on, 0=off
48 if (defined $wires)
49 {
50  $wires_on = $wires;
51 
52 }
53 
54 else { $wires_on = 1;} # 1=on, 0=off
55 
56 
57 #set crt on or off: 1=on, 0=off
58 if (defined $crt)
59 {
60  $crt_on = $crt;
61 }
62 
63 else { $crt_on = 1;} # 1=on, 0=off
64 
65 #set thickness of the concrete overburden. Remmeber: the dafaul value is 300 cm and 0 means no everburden
66 if (defined $thickness_over)
67 {
68  $concrete_on = $thickness_over;
69 }
70 
71 else { $concrete_on = 300;}
72 
73 
74 #-------Definitions of all variables: unit= cm
75 
76 $inch = 2.54;
77 
78 ##################################################################
79 ##################### wire plane parameters ######################
80 
84 
85 #respect to the z axes
86 #$YAngle = 0;
87 $UAngle = 60;
88 $VAngle = 60;
89 
90 $SinUAngle = sin( deg2rad($UAngle) );
91 $CosUAngle = cos( deg2rad($UAngle) );
92 $TanUAngle = tan( deg2rad($UAngle) );
93 
94 $SinVAngle = sin( deg2rad($VAngle) );
95 $CosVAngle = cos( deg2rad($VAngle) );
96 $TanVAngle = tan( deg2rad($VAngle) );
97 
98 #$UWireCornerInt_y = $UWirePitch * $CosUAngle;
99 #$UWireCornerInt_z = $UWirePitch * $SinUAngle;
102 
103 #$VWireCornerInt_y = $VWirePitch * $CosVAngle;
104 #$VWireCornerInt_z = $VWirePitch * $SinVAngle;
107 
108 
109 $TPCWireThickness = 0.015; #wire diameter
111 
112 $CommonWireLength = (1056 * $YWirePitch) / $SinUAngle; #365.809;
113 #print("CommonWireLength: $CommonWireLength \n");
114 
115 ###########################################################################
116 ########################### spacing parameters ############################
117 
118 
119 $CPA_x = 0.15; #cathode plane 1.5 mm
120 $WirePlaneSpacing = 0.3; # center to center
121 $MaxDrift = 148.2; #drift length in LAr at cryogenic temperature
122 
123 #Cryostat space with LAr outside of entire fiducial volume
125 $SpaceWirePlToWirePl = 85; # edge to edge, like all of these (it was in the original perl script)
126 #$SpaceTPCToFloor = 37; # from the article
127 #$SpaceTPCToTopLAr = 30.5;
128 $SpaceTPCToFloor = 36; # from the article
130 #$UpstreamLArPadding = 82.50; # from the article
131 #$DownstreamLArPadding = 82.50; # from the article
132 $UpstreamLArPadding = 90.0; # from the drawings
133 $DownstreamLArPadding = 90.0; # from the drawings
134 
135 ##########################################################
136 ######## Other Cathode relevant parameters ###############
137 
138 $CPA_epsi = 0.001; #to avoid overlaps
139 $CPA_y = 320; #Cathode height.
140 $CPA_z = 1800; #Cathode length.
141 $CPAStrip_x = $CPA_x-$CPA_epsi; #Cathode strip thickness.
142 $CPAStrip_y = 2.1; #Cathode strip height.
143 $CPAStrip_pitch = 5; #Cathode strip pitch.
144 
145 ##############################################################
146 ############## Cryo and TPC relevant dimensions #############
147 
148 #Active LAr volume
151 #$TPCActive_z = 1795.5;
152 
153 #print("TPCActive_x: $TPCActive_x, TPCActive_y: $TPCActive_y, TPCActive_z: $TPCActive_z ");
154 
155  #Reset the active length and the common wire length
156 $TPCActive_z = $CommonWireLength * $CosUAngle + (4640 - 1) * $UWire_zpitch - 0.000000000002;
158 
159 #print(" - change with wire pitch: $UWire_zpitch to $TPCActive_z \n");
160 
161 # TPCWirePlane dimensions
162 $TPCWirePlane_x = 2*$TPCWireThickness; #ATTENTION: tentative to not overlap planes: is this correct?Should be the right thickness of the planes!
166 
167 #print("TPCWirePlane_x: $TPCWirePlane_x, TPCWirePlane_y: $TPCWirePlane_y, TPCWirePlane_z: $TPCWirePlane_z \n");
168 
169 ##################################################################
170 #Dimension of the TPC (active+passive volume)
172 #$TPC_x = 150.0;
173 
174 $DeltaLUCorner = $UWirePitch/($SinUAngle*$CosUAngle); #this is the Delta L for the corner wire length
176 
177 #print(" ******** DELTA CORENR ***** \n");
178 #print(" $DeltaLUCorner $DeltaLVCorner \n");
179 
180 $LAr_x = $CPA_x
181  + 2*($TPC_x + $SpaceWirePlToWall);
189 
190 #$TPC_y = 388.0; #From official drawings
191 #$TPC_z = 1969.9; #From official drawings
195 
199 
201 #$Cryostat_y = $LAr_y + 2*$AlumThickness + $GaseousAr_y ;
202 #$Cryostat_z = $LAr_z + 2*$AlumThickness ;
203 #$Cryostat_y = $TPC_y + 2*$AlumThickness ;
206 
207 #$LAr_x_orig = 4*($TPC_x) + 2*($CPA_x + $SpaceWirePlToWall) + $SpaceWirePlToWirePl;
208 
209 $LAr_x_orig = 2*$LAr_x + 2*$AlumThickness + $CryoDist ; #for total positioning
210 
211 $Cryostat_x_orig = $LAr_x_orig + 2*$AlumThickness ; #for total positioning
212 
213 
214 $TPCinCryo_x[0] = - $TPC_x/2 - $CPA_x/2;
215 #$TPCinCryo_x[1] = - $LAr_x/2 + $SpaceWirePlToWall + 1.5*($TPC_x) + $CPA_x ;
216 #$TPCinCryo_x[2] = $LAr_x/2 - $SpaceWirePlToWall - 1.5*($TPC_x) - $CPA_x ;
217 $TPCinCryo_x[1] = $TPC_x/2 + $CPA_x/2;
218 
220 
221 #$posRightCat_x = - $Cryostat_x/2 + 1.0*($TPC_x) + $SpaceWirePlToWall + $CPA_x/2 ;
222 #$posLeftCat_x = $Cryostat_x/2 - 1.0*($TPC_x) - $SpaceWirePlToWall - $CPA_x/2 ;
223 
224 #$TPCinCryo_y = - $Cryostat_y/2 + $TPC_y/2 + $SpaceTPCToFloor;
225 #$TPCinCryo_z = - $Cryostat_z/2 + $TPC_z/2 + $UpstreamLArPadding;
226 #$TPCinCryo_y = 0.;
229 #$TPCinCryo_zneg = (-$TPCHalf_z/2 + $UpstreamLArPadding/2);
230 #$TPCinCryo_zpos = ( $TPCHalf_z/2 - $UpstreamLArPadding/2);
231 
234 
235 $posTPCActive0_x = 0.570000000000007;
236 #$posTPCActive1_x = -0.570000000000007;
238 $posTPCActive_z = $UpstreamLArPadding/2;
239 
240 ##################################################################
241 #am ########## Steel Mechanical Structure Parameters ############
242 ##################################################################
243 
244  $struct_width = 10.; # width of the structure box segment;
245  $ext_struct_x = $struct_width; # external width of structure segment;
246  $ext_struct_y = 341.8; # external heigh of structure segment;
247  $ext_struct_z = 199.532; # external length of structure segment;
248  $int_struct_x = $ext_struct_x; # internal width of structure segment;
249  $int_struct_y = $ext_struct_y - 2*$struct_width; # internal heigh of structure segment;
250  $int_struct_z = $ext_struct_z - 2*$struct_width; # internal length of structure segment;
251 
252 ##################################################################
253 ############## PMTs relevant parameters #########################
254 
258 $PMTradiusOuter = 4*$inch; #10.16 cm
260 $PMTGrid_offset = 2; # from GLR communication
261 $PMTx = 0.557*$PMTradiusOuter; # x semi-axis of PMT
262 #$PMTtube_x = 10.3; #length of the glass tube
263 $PMTtubeRmax = 4.225; #outer radius of PMT glass tube;
264 $PMTtubeRmin = 3.725; #inner radius of PMT glass tube;$PMTtube_x = 2*$PMTtubeRmax;
266 #$PMTxCut = ($PMTx*$PMTx - $PMTtubeRmax*$PMTtubeRmax)^0.5;
268 #$PMTPlane_y = $TPCActive_y ;
270 #$PMTPlane_z = $TPCActive_z ;
271 $PMTPlane_z = 9*$ext_struct_z + 2*$struct_width + 6.;
272 $PMTWiresOffset = 0.5 ; # space between PMTs and wire planes
273 
274 ##################################################################
275 ######################### CRT parameters ########################
276 
277 #defined in seperate python script "gen_crt_frags.py"
278 #N.B. warm vessel origin, size currently hardcoded - changes
279 # in these values here need to be copied over (will fix eventually..)
280 
281 ##################################################################
282 ############## DetEnc and World relevant parameters #############
283 
284 #Foam thickness and Warm vessel thickness
288 $SpaceTop = 22.4; #Space between cryostat and top thermal insulation
289 $SpaceUpstream = 65.55; #Space between cryostat and upstream thermal insulation
290 $SpaceDownstream = 15.55; #Space between cryostat and downstream thermal insulation
291 $SpaceBottom = 18.0; #Space between cryostat and bottom thermal insulation
292 
293 #Thermal insulation surrounding the two cryostats
297 
298 #$InDetEncl_y = -154.995; #0; #-$WarmVessel_y/6; #-($WarmVessel_y + $CRT_tot_y)/6; original value
299 #$InDetEncl_y = -154.995; #0; #-$WarmVessel_y/6; #-($WarmVessel_y + $CRT_tot_y)/6; +15cm
300 
302 #$ThermInsInDetEncl_y = $InDetEncl_y;
304 
305 #Warm Vessel surrounding the thermal insulation
306 #$WarmVessel_x = $ThermIns_x+2*$WarmVesselThickness;
310 
312 #$WarmVesselInDetEncl_y = $InDetEncl_y;
314 
315 #$MoreDetEnc_y = 60.0; # More space in height to cope with few extrusions
316 #Big detector Enclosure to contain detector + CRT.
317 #$DetEnc_x = 1235.96;#$WarmVessel_x + $CRT_tot_x;
318 #$DetEnc_y = 963.37 + $MoreDetEnc_y;#$WarmVessel_y + $CRT_tot_y;
319 #$DetEnc_z = 2709.56;#$WarmVessel_z + $CRT_tot_z;
320 
321 
322 #Cryostat respect to the warm vessel
325 #$CryoInWarmVessel_y = -$WarmVessel_y/2 + $ConcretePadding + $Cryostat_y/2; #in original way
326 #$CryoInWarmVessel_y = -$WarmVessel_y/2 + $FoamPadding + $WarmVesselThickness + $Cryostat_y/2 -154.995; #(-$WarmVessel_y/2 + $TotalPadding + $Cryostat_y/2)- ($WarmVessel_y)/6 ;
328 
329 #Original Origin point found in the Larsoft perl script
330  # We want the world origin to be at the very front of the fiducial volume.
331  # move it to the front of the enclosure, then back it up through the concrete/foam,
332  # then through the Cryostat shell, then through the upstream dead LAr (including the
333  # dead LAr on the edge of the TPC, but this is covered in $UpstreamLArPadding).
334  # This is to be added to the z position of every volume in volWorld
335 
336 #$OriginZSet = $WarmVessel_z/2 - $TotalPadding - $SteelThickness - $UpstreamLArPadding;
337 #$OriginYSet = $DetEnWarmVessel_y/2 - $TotalPadding - $SteelThickness - $SpaceTPCToFloor - $TPC_y/2;
338 ##$OriginXSet = $LAr_x_orig/2 - $SpaceWirePlToWall - 3*$WirePlaneSpacing - $TPCWirePlane_x;
339 #$OriginXSet = $WarmVessel_x/2- $TotalPadding - $SteelThickness;
340 
341 #Marta: I would like that the origin is in the middle of the two cryostats. It corresponds to the world center. It do not correspond to the experimental hall centre.
345 
346 
347 #Experimental hall
348 $Building_y = 1040.0 ; #part of the building outside
349 $ExpHall_y = 1170.0 + 80; #building underground
350 
351 $Hall_x = 1890.0;
353 $Hall_z = 3870.0;
354 
356 $Overburden_yDefault = 300; #for positioning of the dirt volume: it not depends on the concrete dimensions
357 
358 #True overburden dimensions
359 #$Overburden_x = 1830;
360 #$Overburden_y = $concrete_on;
361 #$Overburden_z = 2930;
362 
363 #Overburden dimensions to include also the floor
364 $Overburden_x = 1830.0 ; #Hall_x - thickness of the wall
365 $Overburden_y = $concrete_on;
366 $Overburden_z = 3810.0; #Hall_z - thickness of the wall
367 
368 
369 #Overburden
371 #$posOverburden_y = $WarmVessel_y/2 + $Overburden_yDefault/2 + (820 - $WarmVessel_y/2) ; #warm vessel_y + overburden_y + distance between overburden and warm vessel 820 (taken from the drawings)
373 
374 #DetectorEnclosure (centered between expHall walls, between expHall floor and bottom of overburden)
377 $DetEnc_x = 1245;
379 $DetEnc_z = 3200;
380 $WarmVessel_FootHeight = 6.0; # heigth of support feet from bottom of support structure
381 $WarmVessel_FloorSpace = 10.16; # space between WV feet and concrete floor due to concrete islands, grout, padding
383 #$DetEncl_yOffset = $ExpHall_VertSpace/2 - $WarmVessel_CenterToFloor;
384 #$ThermInsInDetEncl_y = -1*$DetEncl_yOffset;
385 #$WarmVesselInDetEncl_y = $ThermInsInDetEncl_y;
386 #World
387 $World_x = 1e4; #Originally was 2*$DetEnc_x;
388 $World_y = 1e4; #Originally was 2*$DetEnc_y;
389 $World_z = 1e4; #Originally was 2*$DetEnc_z;
390 
393 
394 #Ground Level
395 #$Ground_y = -$World_y/4+$ExpHall_y/2-$Overburden_y/6 + 0.5*($World_y/2 + $ExpHall_y - $Overburden_y/3);
396 #$Ground_y = $ExpHall_y - $Overburden_y/3 ;
397 $Ground_y = 780.0;# - 40.0; #from detector building drawing: distance between beamline and ground level
402 #$CryoInWarmVessel_y = $WarmVesselInDetEncl_y -$WarmVessel_y/2 + $FoamPadding + $WarmVesselThickness + $Cryostat_y/2 + $GaseousAr_y/2;
403 #+++++++++++++++++++++++++ End defining variables ++++++++++++++++++++++++++
404 
405 # run the sub routines that generate the fragments
406 
407 gen_Define(); # generates definitions at beginning of GDML
408 gen_Materials(); # generates materials to be used
409 
410 gen_RaceTracks(); # generates the geometry of race-tracks
411 
412 gen_TPC(); # generates wires, wire planes, and puts them in volTPC
413  # This is the bulk of the code, and has zero wires option
414 
415 
416 gen_PMT(); #generates PMTs
417 
418 gen_Mech_Structure(); # generates the geometry of the TPC mechanical structure
419 
420 gen_Cryostat(); # places volTPC,
421  # half rotated 180 about Y
422 if ($crt_on==1) {gen_CRT();} # places CRT: CERN modules top, eves; MINOS modules sides, DC bottom
423 gen_Enclosure(); # places two cryostats and warm vessel
424 
425 gen_World(); # places the enclosure in the experimental hall
426 
427 
428 write_fragments(); # writes the XML input for make_gdml.pl
429  # which zips together the final GDML
431 
432 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
433 #+++++++++++++++++++++++++++++++++++++++++ usage +++++++++++++++++++++++++++++++++++++++++
434 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
435 
437 {
438  print "Usage: $0 [-h|--help] [-o|--output <fragments-file>] [-s|--suffix <string>]";
439  print " [-c|--concrete <double>] [-w|--wires <wire or no wire geometry>] [-v <crt or no crt geometry>] \n";
440  print " if -o is omitted, output goes to STDOUT; <fragments-file.xml> is input to make_gdml.pl\n";
441  print " -s <string> appends the string to the file names; useful for multiple detector versions\n";
442  print " -c <double> set the thickness in cm of the concrete overburden\n";
443  print " (default is 300 and 0 means no overburden)\n";
444  print " -w <1> geometry with wires, <0> geometry with no wires\n";
445  print " -v <1> geometry with CRT, <0> geometry with no CRT \n";
446  print " -h prints this message, then quits\n";
447  print "Remind: the file without wires has to be <filename_nowires.gdml> \n";
448 }
449 
450 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
451 #++++++++++++++++++++++++++++++++++++++ gen_Define +++++++++++++++++++++++++++++++++++++++
452 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
453 
455 {
456 
457 # Create the <define> fragment file name,
458 # add file to list of fragments,
459 # and open it
460  $DEF = "icarus_Def" . $suffix . ".gdml";
461  push (@gdmlFiles, $DEF);
462  $DEF = ">" . $DEF;
463  open(DEF) or die("Could not open file $DEF for writing");
464 
465 
466 print DEF <<EOF;
467 <?xml version='1.0'?>
468 <gdml>
469 <define>
470 
471 <!--
472 -->
473  <position name="PMTtube" unit="cm" x="0" y="0" z="@{[1.5*$PMTtube_x]}"/>
474  <position name="posActiveInTPC0" unit="cm" x="$posTPCActive0_x" y="$posTPCActive_y" z="$posTPCActive_z"/>
475  <position name="posTPC00inCryo" unit="cm" x="$TPCinCryo_x[0]" y="$TPCinCryo_y" z="$TPCinCryo_zneg" />
476  <position name="posTPC01inCryo" unit="cm" x="$TPCinCryo_x[0]" y="$TPCinCryo_y" z="$TPCinCryo_zpos" />
477  <position name="posTPC10inCryo" unit="cm" x="$TPCinCryo_x[1]" y="$TPCinCryo_y" z="$TPCinCryo_zneg" />
478  <position name="posTPC11inCryo" unit="cm" x="$TPCinCryo_x[1]" y="$TPCinCryo_y" z="$TPCinCryo_zpos" />
479  <position name="posCathode" unit="cm" x="$posCat_x" y="$TPCinCryo_y" z="$TPCinCryo_z" />
480  <position name="posCryo1InWarmVessel" unit="cm" x="$Cryo1InWarmVessel_x" y="$CryoInWarmVessel_y" z="$CryoInWarmVessel_z" />
481  <position name="posCryo2InWarmVessel" unit="cm" x="$Cryo2InWarmVessel_x" y="$CryoInWarmVessel_y" z="$CryoInWarmVessel_z" />
482  <position name="posDetEncInWorld" unit="cm" x="$OriginXSet" y="$DetEncl_yOffset" z="$OriginZSet"/>
483  <position name="posCenter" unit="cm" x="0" y="0" z="0"/>
484  <position name="posThermInsInDetEncl" unit="cm" x="$ThermInsInDetEncl_x" y="$ThermInsInDetEncl_y" z="$ThermInsInDetEncl_z"/>
485  <position name="posWarmVesselInDetEncl" unit="cm" x="$WarmVesselInDetEncl_x" y="$WarmVesselInDetEncl_y" z="$WarmVesselInDetEncl_z"/>
486  <position name="posCRTShellInDetEncl" unit="cm" x="0" y="$CRTSHELL_WV_OFFSET_Y" z="$CRTSHELL_WV_OFFSET_Z"/>
487  <position name="posBuildingInWorld" unit="cm" x="0" y="@{[$Ground_y + $Building_y/2]}" z="0"/>
488  <position name="posExpHallInWorld" unit="cm" x="0" y="@{[$Ground_y - $ExpHall_y/2 ]}" z="0"/>
489  <rotation name="rPlus90AboutZPlus90AboutY" unit="deg" x="0" y="90" z="90"/>
490  <rotation name="rPlus90AboutX" unit="deg" x="90" y="0" z="0"/>
491  <rotation name="rMinus90AboutX" unit="deg" x="-90" y="0" z="0"/>
492  <rotation name="rPlus90AboutY" unit="deg" x="0" y="90" z="0"/>
493  <rotation name="rPlus90AboutZ" unit="deg" x="0" y="0" z="90"/>
494  <rotation name="rMinus90AboutZ" unit="deg" x="0" y="0" z="-90"/>
495  <rotation name="rMinus90AboutY" unit="deg" x="0" y="270" z="0"/>
496  <rotation name="rMinus90AboutYMinus90AboutX" unit="deg" x="270" y="270" z="0"/>
497  <rotation name="rPlus90VAngleAboutX" unit="deg" x="@{[90-$VAngle]}" y="0" z="0"/>
498  <rotation name="rPlus90UAngleAboutX" unit="deg" x="@{[90+$UAngle]}" y="0" z="0"/>
499  <rotation name="rPlus180AboutX" unit="deg" x="180" y="0" z="0"/>
500  <rotation name="rPlus180AboutY" unit="deg" x="0" y="180" z="0"/>
501  <rotation name="rPlus180AboutZ" unit="deg" x="0" y="0" z="180"/>
502  <rotation name="rPlus180AboutXZ" unit="deg" x="180" y="0" z="180"/>
503  <rotation name="rIdentity" unit="deg" x="0" y="0" z="0"/>
504  <rotation name="rPlusUAngleAboutX" unit="deg" x="$UAngle" y="0" z="0"/>
505  <rotation name="rMinusVAngleAboutX" unit="deg" x="300" y="0" z="0"/>
506 </define>
507 </gdml>
508 EOF
509  close (DEF);
510 }
511 
512 
513 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
514 #+++++++++++++++++++++++++++++++++++++ gen_Materials +++++++++++++++++++++++++++++++++++++
515 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
516 
518 {
519 
520 # Create the <materials> fragment file name,
521 # add file to list of output GDML fragments,
522 # and open it
523  $MAT = "icarus_Materials" . $suffix . ".gdml";
524  push (@gdmlFiles, $MAT);
525  $MAT = ">" . $MAT;
526  open(MAT) or die("Could not open file $MAT for writing");
527 
528 
529  print MAT <<EOF;
530 <materials>
531  <element name="videRef" formula="VACUUM" Z="1"> <atom value="1"/> </element>
532  <element name="bromine" formula="Br" Z="35"> <atom value="79.904"/> </element>
533  <element name="hydrogen" formula="H" Z="1"> <atom value="1.0079"/> </element>
534  <element name="nitrogen" formula="N" Z="7"> <atom value="14.0067"/> </element>
535  <element name="oxygen" formula="O" Z="8"> <atom value="15.999"/> </element>
536  <element name="aluminum" formula="Al" Z="13"> <atom value="26.9815"/> </element>
537  <element name="silicon" formula="Si" Z="14"> <atom value="28.0855"/> </element>
538  <element name="carbon" formula="C" Z="6"> <atom value="12.0107"/> </element>
539  <element name="potassium" formula="K" Z="19"> <atom value="39.0983"/> </element>
540  <element name="chromium" formula="Cr" Z="24"> <atom value="51.9961"/> </element>
541  <element name="iron" formula="Fe" Z="26"> <atom value="55.8450"/> </element>
542  <element name="nickel" formula="Ni" Z="28"> <atom value="58.6934"/> </element>
543  <element name="calcium" formula="Ca" Z="20"> <atom value="40.078"/> </element>
544  <element name="magnesium" formula="Mg" Z="12"> <atom value="24.305"/> </element>
545  <element name="sodium" formula="Na" Z="11"> <atom value="22.99"/> </element>
546  <element name="titanium" formula="Ti" Z="22"> <atom value="47.867"/> </element>
547  <element name="argon" formula="Ar" Z="18"> <atom value="39.9480"/> </element>
548  <element name="sulphur" formula="S" Z="16"> <atom value="32.065"/> </element>
549  <element name="phosphorus" formula="P" Z="15"> <atom value="30.973"/> </element>
550  <element name="copper" formula="Cu" Z="29"> <atom value="63.5463"/> </element>
551  <element name="manganese" formula="Mn" Z="25"> <atom value="54.938043"/> </element>
552  <element name="vanadium" formula="V" Z="23"> <atom value="50.94151"/> </element>
553 
554  <material name="Vacuum" formula="Vacuum">
555  <D value="1.e-25" unit="g/cm3"/>
556  <fraction n="1.0" ref="videRef"/>
557  </material>
558 
559  <material name="ALUMINUM_Al" formula="ALUMINUM_Al">
560  <D value="2.6990" unit="g/cm3"/>
561  <fraction n="1.0000" ref="aluminum"/>
562  </material>
563 
564  <material name="ALUMINUM_CRYO" formula="ALUMINUM_CRYO">
565  <D value="0.5991" unit="g/cm3"/>
566  <fraction n="1.0000" ref="aluminum"/>
567  </material>
568 
569  <material name="SILICON_Si" formula="SILICON_Si">
570  <D value="2.3300" unit="g/cm3"/>
571  <fraction n="1.0000" ref="silicon"/>
572  </material>
573 
574  <material name="epoxy_resin" formula="C38H40O6Br4">
575  <D value="1.1250" unit="g/cm3"/>
576  <composite n="38" ref="carbon"/>
577  <composite n="40" ref="hydrogen"/>
578  <composite n="6" ref="oxygen"/>
579  <composite n="4" ref="bromine"/>
580  </material>
581 
582  <material name="SiO2" formula="SiO2">
583  <D value="2.2" unit="g/cm3"/>
584  <composite n="1" ref="silicon"/>
585  <composite n="2" ref="oxygen"/>
586  </material>
587 
588  <material name="Al2O3" formula="Al2O3">
589  <D value="3.97" unit="g/cm3"/>
590  <composite n="2" ref="aluminum"/>
591  <composite n="3" ref="oxygen"/>
592  </material>
593 
594  <material name="Fe2O3" formula="Fe2O3">
595  <D value="5.24" unit="g/cm3"/>
596  <composite n="2" ref="iron"/>
597  <composite n="3" ref="oxygen"/>
598  </material>
599 
600  <material name="CaO" formula="CaO">
601  <D value="3.35" unit="g/cm3"/>
602  <composite n="1" ref="calcium"/>
603  <composite n="1" ref="oxygen"/>
604  </material>
605 
606  <material name="MgO" formula="MgO">
607  <D value="3.58" unit="g/cm3"/>
608  <composite n="1" ref="magnesium"/>
609  <composite n="1" ref="oxygen"/>
610  </material>
611 
612  <material name="Na2O" formula="Na2O">
613  <D value="2.27" unit="g/cm3"/>
614  <composite n="2" ref="sodium"/>
615  <composite n="1" ref="oxygen"/>
616  </material>
617 
618  <material name="TiO2" formula="TiO2">
619  <D value="4.23" unit="g/cm3"/>
620  <composite n="1" ref="titanium"/>
621  <composite n="2" ref="oxygen"/>
622  </material>
623 
624  <material name="FeO" formula="FeO">
625  <D value="5.745" unit="g/cm3"/>
626  <composite n="1" ref="iron"/>
627  <composite n="1" ref="oxygen"/>
628  </material>
629 
630  <material name="CO2" formula="CO2">
631  <D value="1.562" unit="g/cm3"/>
632  <composite n="1" ref="iron"/>
633  <composite n="2" ref="oxygen"/>
634  </material>
635 
636  <material name="P2O5" formula="P2O5">
637  <D value="1.562" unit="g/cm3"/>
638  <composite n="2" ref="phosphorus"/>
639  <composite n="5" ref="oxygen"/>
640  </material>
641 
642  <material formula=" " name="DUSEL_Rock">
643  <D value="2.82" unit="g/cm3"/>
644  <fraction n="0.5267" ref="SiO2"/>
645  <fraction n="0.1174" ref="FeO"/>
646  <fraction n="0.1025" ref="Al2O3"/>
647  <fraction n="0.0473" ref="MgO"/>
648  <fraction n="0.0422" ref="CO2"/>
649  <fraction n="0.0382" ref="CaO"/>
650  <fraction n="0.0240" ref="carbon"/>
651  <fraction n="0.0186" ref="sulphur"/>
652  <fraction n="0.0053" ref="Na2O"/>
653  <fraction n="0.00070" ref="P2O5"/>
654  <fraction n="0.0771" ref="oxygen"/>
655  </material>
656 
657  <material name="fibrous_glass">
658  <D value="2.74351" unit="g/cm3"/>
659  <fraction n="0.600" ref="SiO2"/>
660  <fraction n="0.118" ref="Al2O3"/>
661  <fraction n="0.001" ref="Fe2O3"/>
662  <fraction n="0.224" ref="CaO"/>
663  <fraction n="0.034" ref="MgO"/>
664  <fraction n="0.010" ref="Na2O"/>
665  <fraction n="0.013" ref="TiO2"/>
666  </material>
667 
668  <material name="FR4">
669  <D value="1.98281" unit="g/cm3"/>
670  <fraction n="0.47" ref="epoxy_resin"/>
671  <fraction n="0.53" ref="fibrous_glass"/>
672  </material>
673 
674  <material name="STEEL_STAINLESS_Fe7Cr2Ni" formula="STEEL_STAINLESS_Fe7Cr2Ni">
675  <D value="7.9300" unit="g/cm3"/>
676  <fraction n="0.0010" ref="carbon"/>
677  <fraction n="0.1792" ref="chromium"/>
678  <fraction n="0.7298" ref="iron"/>
679  <fraction n="0.0900" ref="nickel"/>
680  </material>
681 
682  <material name="STEEL_STAINLESS_Fe7Cr2Ni_WV" formula="STEEL_STAINLESS_Fe7Cr2Ni_WV">
683  <!-- <D value="0.3844" unit="g/cm3"/> -->
684  <D value="0.38897" unit="g/cm3"/>
685  <fraction n="0.0010" ref="carbon"/>
686  <fraction n="0.1792" ref="chromium"/>
687  <fraction n="0.7298" ref="iron"/>
688  <fraction n="0.0900" ref="nickel"/>
689  </material>
690 
691  <material name="LAr" formula="LAr">
692  <D value="1.40" unit="g/cm3"/>
693  <fraction n="1.0000" ref="argon"/>
694  </material>
695 
696  <material name="ArGas" formula="ArGas">
697  <D value="0.00166" unit="g/cm3"/>
698  <fraction n="1.0" ref="argon"/>
699  </material>
700 
701  <material formula=" " name="Air">
702  <D value="0.001205" unit="g/cm3"/>
703  <fraction n="0.781154" ref="nitrogen"/>
704  <fraction n="0.209476" ref="oxygen"/>
705  <fraction n="0.00934" ref="argon"/>
706  </material>
707 
708  <material formula=" " name="G10">
709  <D value="1.7" unit="g/cm3"/>
710  <fraction n="0.2805" ref="silicon"/>
711  <fraction n="0.3954" ref="oxygen"/>
712  <fraction n="0.2990" ref="carbon"/>
713  <fraction n="0.0251" ref="hydrogen"/>
714  </material>
715 
716  <material formula=" " name="Granite">
717  <D value="2.7" unit="g/cm3"/>
718  <fraction n="0.438" ref="oxygen"/>
719  <fraction n="0.257" ref="silicon"/>
720  <fraction n="0.222" ref="sodium"/>
721  <fraction n="0.049" ref="aluminum"/>
722  <fraction n="0.019" ref="iron"/>
723  <fraction n="0.015" ref="potassium"/>
724  </material>
725 
726  <material formula=" " name="ShotRock">
727  <D value="@{[2.7*0.6]}" unit="g/cm3"/>
728  <fraction n="0.438" ref="oxygen"/>
729  <fraction n="0.257" ref="silicon"/>
730  <fraction n="0.222" ref="sodium"/>
731  <fraction n="0.049" ref="aluminum"/>
732  <fraction n="0.019" ref="iron"/>
733  <fraction n="0.015" ref="potassium"/>
734  </material>
735 
736  <material formula=" " name="Dirt">
737  <D value="1.7" unit="g/cm3"/>
738  <fraction n="0.438" ref="oxygen"/>
739  <fraction n="0.257" ref="silicon"/>
740  <fraction n="0.222" ref="sodium"/>
741  <fraction n="0.049" ref="aluminum"/>
742  <fraction n="0.019" ref="iron"/>
743  <fraction n="0.015" ref="potassium"/>
744  </material>
745 
746  <material formula=" " name="Concrete">
747  <D value="2.3" unit="g/cm3"/>
748  <fraction n="0.530" ref="oxygen"/>
749  <fraction n="0.335" ref="silicon"/>
750  <fraction n="0.060" ref="calcium"/>
751  <fraction n="0.015" ref="sodium"/>
752  <fraction n="0.020" ref="iron"/>
753  <fraction n="0.040" ref="aluminum"/>
754  </material>
755 
756  <material formula="H2O" name="Water">
757  <D value="1.0" unit="g/cm3"/>
758  <fraction n="0.1119" ref="hydrogen"/>
759  <fraction n="0.8881" ref="oxygen"/>
760  </material>
761 
762  <material formula="Ti" name="Titanium">
763  <D value="4.506" unit="g/cm3"/>
764  <fraction n="1." ref="titanium"/>
765  </material>
766 
767  <material name="TPB" formula="TPB">
768  <D value="1.40" unit="g/cm3"/>
769  <fraction n="1.0000" ref="argon"/>
770  </material>
771 
772  <material name="Glass">
773  <D value="2.74351" unit="g/cm3"/>
774  <fraction n="0.600" ref="SiO2"/>
775  <fraction n="0.118" ref="Al2O3"/>
776  <fraction n="0.001" ref="Fe2O3"/>
777  <fraction n="0.224" ref="CaO"/>
778  <fraction n="0.034" ref="MgO"/>
779  <fraction n="0.010" ref="Na2O"/>
780  <fraction n="0.013" ref="TiO2"/>
781  </material>
782 
783  <material name="Acrylic">
784  <D value="1.19" unit="g/cm3"/>
785  <fraction n="0.600" ref="carbon"/>
786  <fraction n="0.320" ref="oxygen"/>
787  <fraction n="0.080" ref="hydrogen"/>
788  </material>
789 
790  <material name="Polystyrene">
791  <D unit="g/cm3" value="1.06"/>
792  <fraction n="0.077418" ref="hydrogen"/>
793  <fraction n="0.922582" ref="carbon"/>
794  </material>
795 
796  <material name="Polyurethane" formula="C27H36N2O10" >
797  <D value="0.9" unit="g/cm3"/>
798  <composite n="27" ref="carbon"/>
799  <composite n="36" ref="hydrogen"/>
800  <composite n="2" ref="nitrogen"/>
801  <composite n="10" ref="oxygen"/>
802  </material>
803 
804  <material name="STEEL_A992">
805  <D unit="g/cm3" value="7.85"/>
806  <fraction n="0.0022" ref="carbon"/>
807  <fraction n="0.005" ref="copper"/>
808  <fraction n="0.01" ref="manganese"/>
809  <fraction n="0.0044" ref="nickel"/>
810  <fraction n="0.00034" ref="phosphorus"/>
811  <fraction n="0.0039" ref="silicon"/>
812  <fraction n="0.00044" ref="sulphur"/>
813  <fraction n="0.001" ref="vanadium"/>
814  <fraction n="0.97272" ref="iron" />
815  </material>
816 
817 
818 </materials>
819 EOF
820 
821 close(MAT);
822 }
823 
824 
825 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
826 #++++++++++++++++++++++++++++++++++++++++ gen_TPC ++++++++++++++++++++++++++++++++++++++++
827 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
828 
829 
831 {
832 # Create the TPC fragment file name,
833 # add file to list of output GDML fragments,
834 # and open it
835  $TPC = "icarus_TPC" . $suffix . ".gdml";
836  push (@gdmlFiles, $TPC);
837  $TPC = ">" . $TPC;
838  open(TPC) or die("Could not open file $TPC for writing");
839 
840 
841 # The standard XML prefix and starting the gdml
842  print TPC <<EOF;
843 <?xml version='1.0'?>
844 <gdml>
845 EOF
846 
847 
848 # All the TPC solids save the wires.
849 print TPC <<EOF;
850 <solids>
851  <box name="TPC" lunit="cm"
852  x="$TPC_x"
853  y="$TPC_y"
854  z="$TPCHalf_z"/>
855  <box name="TPCPlane" lunit="cm"
856  x="$TPCWirePlane_x"
857  y="$TPCWirePlane_y"
858  z="$TPCWirePlaneHalf_z"/>
859  <box name="TPCActive" lunit="cm"
860  x="$TPCActive_x"
861  y="$TPCActive_y"
862  z="$TPCActiveHalf_z"/>
863 EOF
864 
865 
866 #++++++++++++++++++++++++++++ Wire Solids ++++++++++++++++++++++++++++++
867 
868 # Set number of wires to default to zero, when $wires_on = 0, for a low memory
869 # version. But if $wires_on = 1, calculate the number of wires on each side of each
870 # plane to be used in the for loops
871 
872 my $NumberHorizontalWires = 0;
873 my $NumberCornerUWires = 0;
874 my $NumberCommonUWires = 0;
875 my $NumberCornerVWires = 0;
876 my $NumberCommonVWires = 0;
877 
878 
879 if ($wires_on == 1)
880 {
881  # Number of wires in one corner
882  #$NumberCornerVWires = int( $TPCWirePlane_y/$VWire_ypitch );
883  #$NumberCornerWWires = int( $TPCWirePlane_y/$WWire_ypitch );
884  $NumberCornerUWires = 480;
885  $NumberCornerVWires = 480;
886 
887  # Number of wires in one corner + the number to cover the whole corner.
888  $NumberCornerExtUWires = 528;
889  $NumberCornerExtVWires = 528;
890 
891  # Total number of wires touching one vertical (longer) side
892  # Note that the total number of wires per plane is this + another set of corner wires
893  # $NumberSideUWires = int( $TPCWirePlane_z/$UWire_zpitch );
894  # $NumberSideVWires = int( $TPCWirePlane_z/$VWire_zpitch );
895  # $NumberSideWWires = int( $TPCWirePlane_z/$WWire_zpitch );
896 
897  # Number of wires per side that aren't cut off by the corner
898  # $NumberCommonUWires = $NumberSideUWires - $NumberCornerUWires;
899  # $NumberCommonVWires = $NumberSideVWires - $NumberCornerVWires;
900  #$NumberCommonWWires = $NumberSideWWires - $NumberCornerWWires;
901  #$NumberCommonUWires = 4640;
902  #$NumberCommonVWires = 4640;
903  $NumberCommonUWires = 2056;
904  $NumberCommonVWires = 2056;
905 
906  # number of wires on the vertical plane
907  #$NumberHorizontalWires = int( ($TPCWirePlane_y-$TPCWireThickness)/$UWirePitch );
908  #Number of wires inthe Y plane-->Horizontal plane Induction I
909  $NumberHorizontalWires = 1056;
910 
911 }
912 
913 # These XML comments throughout make the GDML file easier to navigate
914 print TPC <<EOF;
915 
916 <!--+++++++++++++++++++ Y Wire Solids ++++++++++++++++++++++-->
917 
918 EOF
919 
920 if ($wires_on==1)
921 {
922 
923 #CommonWire = wires with same length
924 
925  print TPC <<EOF;
926  <tube name="TPCWireYCommon"
927  rmax="$TPCWireRadius"
928  z="$TPCWirePlaneHalf_z"
929  deltaphi="360"
930  aunit="deg"
931  lunit="cm"/>
932 EOF
933 
934 } else {
935 
936 print TPC <<EOF;
937 
938  <!-- This GDML version has no wires and uses much less memory -->
939 
940 EOF
941 
942 }
943 
944 print TPC <<EOF;
945 
946 
947 <!--+++++++++++++++++++ U Wire Solids ++++++++++++++++++++++-->
948 
949 
950 EOF
951 
952 # The corner wires for the U plane
953 if ($wires_on==1)
954 {
955 #FAKE CORNER
956  $length = $CommonWireLength + $DeltaLUCorner/2;
957 
958  for ($i = 0; $i < $NumberCornerExtUWires; ++$i)
959  {
960  $length -= $DeltaLUCorner;
961 
962 print TPC <<EOF;
963  <tube name="TPCWireU$i"
964  rmax="$TPCWireRadius"
965  z="$length"
966  deltaphi="360"
967  aunit="deg"
968  lunit="cm"/>
969 EOF
970 
971 #print(" $i $length \n");
972 
973  } #ends FAKE CORNER
974 
975 #REAL CORNER
976  $length = $CommonWireLength;
977 
978  for ($i = 0; $i < $NumberCornerUWires; ++$i)
979  {
980  $length -= $DeltaLUCorner;
981 
982 print TPC <<EOF;
983  <tube name="TPCWireCornerU$i"
984  rmax="$TPCWireRadius"
985  z="$length"
986  deltaphi="360"
987  aunit="deg"
988  lunit="cm"/>
989 EOF
990 
991 #print(" $i $length \n");
992 
993  } #ends REAL CORNER
994 
995 print TPC <<EOF;
996  <tube name="TPCWireUCommon"
997  rmax="$TPCWireRadius"
998  z="$CommonWireLength"
999  deltaphi="360"
1000  aunit="deg"
1001  lunit="cm"/>
1002 EOF
1003 
1004 } else {
1005 
1006 print TPC <<EOF;
1007 
1008  <!-- no wires in this GDML -->
1009 
1010 EOF
1011 
1012 }
1013 
1014 
1015 print TPC <<EOF;
1016 
1017 
1018 <!--+++++++++++++++++++ V Wire Solids ++++++++++++++++++++++-->
1019 
1020 
1021 EOF
1022 
1023 # The corner wires for the V plane
1024 if ($wires_on==1)
1025 {
1026 # FAKE CORNER
1027  $length = $CommonWireLength + $DeltaLVCorner/2;
1028 
1029  for ($i = 0; $i < $NumberCornerExtVWires; ++$i)
1030  {
1031 
1032  $length -= $DeltaLVCorner;
1033 
1034  print TPC <<EOF;
1035  <tube name="TPCWireV$i"
1036  rmax="$TPCWireRadius"
1037  z="$length"
1038  deltaphi="360"
1039  aunit="deg"
1040  lunit="cm"/>
1041 EOF
1042 
1043 #print(" $i $length \n");
1044 
1045  } #ends FAKE CORNER
1046 
1047 # REAL CORNER
1048  $length = $CommonWireLength;
1049 
1050  for ($i = 0; $i < $NumberCornerVWires; ++$i)
1051  {
1052 
1053  $length -= $DeltaLVCorner;
1054 
1055  print TPC <<EOF;
1056  <tube name="TPCWireCornerV$i"
1057  rmax="$TPCWireRadius"
1058  z="$length"
1059  deltaphi="360"
1060  aunit="deg"
1061  lunit="cm"/>
1062 EOF
1063 
1064 #print(" $i $length \n");
1065 
1066  } #ends REAL CORNER
1067 
1068 
1069  print TPC <<EOF;
1070  <tube name="TPCWireVCommon"
1071  rmax="$TPCWireRadius"
1072  z="$CommonWireLength"
1073  deltaphi="360"
1074  aunit="deg"
1075  lunit="cm"/>
1076 EOF
1077 
1078 } else {
1079 
1080 print TPC <<EOF;
1081 
1082  <!-- no wires in this GDML -->
1083 
1084 EOF
1085 
1086 }
1087 
1088 # Begin structure and create the vertical wire logical volume
1089 print TPC <<EOF;
1090 </solids>
1091 <structure>
1092  <volume name="volTPCActive">
1093  <materialref ref="LAr"/>
1094  <solidref ref="TPCActive"/>
1095  </volume>
1096 
1097 <!--+++++++++++++++++ Wire Logical Volumes ++++++++++++++++++++-->
1098 
1099 EOF
1100 
1101 
1102 if ($wires_on==1)
1103 {
1104 
1105  # Common Y wire logical volume, referenced many times
1106  print TPC <<EOF;
1107  <volume name="volTPCWireYCommon">
1108  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1109  <solidref ref="TPCWireYCommon" />
1110  </volume>
1111 EOF
1112 
1113  # Fake Corner U wires logical volumes
1114  for ($i = 0; $i < $NumberCornerExtUWires; ++$i)
1115  {
1116  print TPC <<EOF;
1117  <volume name="volTPCWireU$i">
1118  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1119  <solidref ref="TPCWireU$i" />
1120  </volume>
1121 EOF
1122 
1123  }
1124 
1125  # Real Corner U wires logical volumes
1126  for ($i = 0; $i < $NumberCornerUWires; ++$i)
1127  {
1128  print TPC <<EOF;
1129  <volume name="volTPCWireCornerU$i">
1130  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1131  <solidref ref="TPCWireCornerU$i" />
1132  </volume>
1133 EOF
1134 
1135  }
1136 
1137  # Common U wire logical volume, referenced many times
1138  print TPC <<EOF;
1139  <volume name="volTPCWireUCommon">
1140  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1141  <solidref ref="TPCWireUCommon" />
1142  </volume>
1143 EOF
1144 
1145  # Fake Corner V wires logical volumes
1146  for ($i = 0; $i < $NumberCornerExtVWires; ++$i)
1147  {
1148  print TPC <<EOF;
1149  <volume name="volTPCWireV$i">
1150  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1151  <solidref ref="TPCWireV$i" />
1152  </volume>
1153 EOF
1154 
1155  }
1156 
1157  # Real Corner V wires logical volumes
1158  for ($i = 0; $i < $NumberCornerVWires; ++$i)
1159  {
1160  print TPC <<EOF;
1161  <volume name="volTPCWireCornerV$i">
1162  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1163  <solidref ref="TPCWireCornerV$i" />
1164  </volume>
1165 EOF
1166 
1167  }
1168  # Common V wire logical volume, referenced many times
1169  print TPC <<EOF;
1170  <volume name="volTPCWireVCommon">
1171  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni" />
1172  <solidref ref="TPCWireVCommon" />
1173  </volume>
1174 EOF
1175 
1176 } else {
1177 
1178 
1179 print TPC <<EOF;
1180 
1181  <!-- This GDML version has no wires and uses much less memory -->
1182 
1183 EOF
1184 
1185 }
1186 
1187 
1188 #+++++++++++++++++++++++++ Position physical wires ++++++++++++++++++++++++++
1189 
1190 # ++++++++++++++++++++++ Y Plane +++++++++++++++++++++++
1191 
1192 # Create Y plane logical volume
1193 print TPC <<EOF;
1194 
1195 
1196 <!--+++++++++++++++++++++ Y Plane ++++++++++++++++++++++++-->
1197 
1198 
1199  <volume name="volTPCPlaneY">
1200  <materialref ref="LAr"/>
1201  <solidref ref="TPCPlane"/>
1202 EOF
1203 
1204 if ($wires_on==0)
1205 {
1206 print TPC <<EOF;
1207 
1208  <!-- no wires -->
1209 
1210 EOF
1211 
1212 } else {
1213 
1214  $ypos = ($NumberHorizontalWires+1)*$YWirePitch/2;
1215 
1216  for ($i = 0; $i < $NumberHorizontalWires; ++$i)
1217  {
1218  $ypos -= $YWirePitch;
1219 
1220 
1221 print TPC <<EOF;
1222  <physvol>
1223  <volumeref ref="volTPCWireYCommon"/>
1224  <position name="posTPCWireY$i" unit="cm" x="0" y="$ypos " z="0"/>
1225  <rotationref ref="rIdentity"/>
1226  </physvol>
1227 EOF
1228 
1229  #print("0 $ypos \n");
1230 
1231  #$ypos -= $YWirePitch;
1232 
1233  }
1234 
1235 } #ends else
1236 
1237 
1238 # ++++++++++++++++++++++ U Plane +++++++++++++++++++++++
1239 
1240 # End U plane and create U plane logical volume
1241 print TPC <<EOF;
1242  </volume>
1243 
1244 
1245 <!--+++++++++++++++++++++ U Plane ++++++++++++++++++++++++-->
1246 
1247 
1248  <volume name="volTPCPlaneU">
1249  <materialref ref="LAr"/>
1250  <solidref ref="TPCPlane"/>
1251 EOF
1252 
1253 if ($wires_on==0)
1254 {
1255 print TPC <<EOF;
1256 
1257  <!-- no wires -->
1258 
1259 EOF
1260 
1261 } else {
1262 
1263 #CORNERS
1264 
1265  $ypos1 = $TPCActive_y/2;
1267 
1268  $ypos2 = -$TPCActive_y/2;
1269  $zpos2 = -$TPCActiveHalf_z/2;
1270 
1271  #Positioning of 480 real U corner wires.
1272  for ($i = 0; $i < $NumberCornerUWires; ++$i)
1273  {
1274  $ypos1 += $UWire_ypitch ;
1275  $zpos2 -= $UWire_zpitch ;
1276 
1277  $ypos = ($ypos1+$ypos2)/2;
1278  $zpos = ($zpos1+$zpos2)/2;
1279 
1280  #print("U Corner wires: $i $zpos $ypos , ");
1281 
1282 print TPC <<EOF;
1283  <physvol>
1284  <volumeref ref="volTPCWireCornerU$i"/>
1285  <position name="posTPCWireU$i" unit="cm" x="0" y="$ypos " z="$zpos"/>
1286  <rotationref ref="rPlusUAngleAboutX"/>
1287  </physvol>
1288 EOF
1289  }
1290 
1291  $ypos1 = $TPCActive_y/2 - $UWire_ypitch + $UWire_ypitch/2;
1293 
1294  $ypos2 = - $TPCActive_y/2;
1295  $zpos2 = -$TPCActiveHalf_z/2;
1296 
1297  #Positioning of 528 fake U corners wires.
1298  for ($i = 0; $i < $NumberCornerExtUWires; ++$i)
1299  {
1300  $ypos1 += $UWire_ypitch;
1301  $zpos2 -= $UWire_zpitch;
1302 
1303  $ypos = ($ypos1+$ypos2)/2;
1304  $zpos = ($zpos1+$zpos2)/2;
1305 
1306  $ypos = - $ypos;
1307  $zpos = - $zpos;
1308 
1309 print TPC <<EOF;
1310  <physvol>
1311  <volumeref ref="volTPCWireU$i"/>
1312  <position name="posTPCWireU@{[$i+$NumberCommonUWires+$NumberCornerUWires]}" unit="cm" x="0" y="$ypos " z="$zpos"/>
1313  <rotationref ref="rPlusUAngleAboutX"/>
1314  </physvol>
1315 EOF
1316  } #ends CORNER
1317 
1318 
1319 #Common Wires
1320 
1322  #print("common wires $zpos \n");
1323 
1324  for ($i = 0; $i < $NumberCommonUWires; ++$i)
1325  {
1326 
1327 print TPC <<EOF;
1328  <physvol>
1329  <volumeref ref="volTPCWireUCommon"/>
1330  <position name="posTPCWireU@{[$i+$NumberCornerUWires]}" unit="cm" x="0" y="0 " z="$zpos"/>
1331  <rotationref ref="rPlusUAngleAboutX"/>
1332  </physvol>
1333 EOF
1334 
1335  #print("U wires $i $zpos 0 \n");
1336  $zpos += $UWire_zpitch;
1337 
1338  }
1339 
1340 
1341 } #ends else
1342 
1343 # ++++++++++++++++++++++ V Plane +++++++++++++++++++++++
1344 
1345 # End V plane and create V plane logical volume
1346 print TPC <<EOF;
1347  </volume>
1348 
1349 <!--+++++++++++++++++++++ V Plane ++++++++++++++++++++++++-->
1350 
1351 
1352  <volume name="volTPCPlaneV">
1353  <materialref ref="LAr"/>
1354  <solidref ref="TPCPlane"/>
1355 EOF
1356 
1357 if ($wires_on==0)
1358 {
1359 print TPC <<EOF;
1360 
1361  <!-- no wires -->
1362 
1363 EOF
1364 
1365 } else {
1366 
1367 #CORNERS
1368 
1369  $ypos1 = $TPCActive_y/2;
1370  $zpos1 = -$TPCActiveHalf_z/2;
1371 
1372  $ypos2 = -$TPCActive_y/2;
1374 
1375  #Positioning of 480 real V corners wires.
1376 
1377  for ($i = 0; $i < $NumberCornerVWires; ++$i)
1378  {
1379  $ypos1 -= $VWire_ypitch ;
1380  $zpos2 -= $VWire_zpitch ;
1381 
1382  $ypos = ($ypos1+$ypos2)/2;
1383  $zpos = ($zpos1+$zpos2)/2;
1384 
1385  #print("V Corner wires: $i $zpos $ypos , ");
1386 
1387 
1388 print TPC <<EOF;
1389  <physvol>
1390  <volumeref ref="volTPCWireCornerV$i"/>
1391  <position name="posTPCWireV$i" unit="cm" x="0" y="$ypos " z="$zpos"/>
1392  <rotationref ref="rMinusVAngleAboutX"/>
1393  </physvol>
1394 EOF
1395  }
1396 
1397  $ypos1 = $TPCActive_y/2 + $VWire_ypitch - $VWire_ypitch/2;
1398  $zpos1 = -$TPCActiveHalf_z/2 + $VWire_zpitch - $VWire_zpitch/2;
1399 
1400  $ypos2 = -$TPCActive_y/2;
1402 
1403  #Positioning of 528 fake V corners wires.
1404  for ($i = 0; $i < $NumberCornerExtVWires; ++$i)
1405  {
1406  $ypos1 -= $VWire_ypitch;
1407  $zpos2 -= $VWire_zpitch;
1408 
1409  $ypos = ($ypos1+$ypos2)/2;
1410  $zpos = ($zpos1+$zpos2)/2;
1411 
1412  $ypos = - $ypos;
1413  $zpos = - $zpos;
1414 
1415 print TPC <<EOF;
1416  <physvol>
1417  <volumeref ref="volTPCWireV$i"/>
1418  <position name="posTPCWireV@{[$i+$NumberCommonVWires+$NumberCornerVWires]}" unit="cm" x="0" y="$ypos " z="$zpos"/>
1419  <rotationref ref="rMinusVAngleAboutX"/>
1420  </physvol>
1421 EOF
1422 
1423  #print(" $zpos $ypos \n");
1424 
1425  } #ends CORNERS
1426 
1427  #Common Wires
1428 
1429  $zpos = (-$TPCActiveHalf_z + $CommonWireLength * $CosVAngle + $VWire_zpitch) / 2. - $VWire_zpitch/2;
1430 
1431  for ($i = 0; $i < $NumberCommonVWires; ++$i)
1432  {
1433 
1434 print TPC <<EOF;
1435  <physvol>
1436  <volumeref ref="volTPCWireVCommon"/>
1437  <position name="posTPCWireV@{[$i+$NumberCornerVWires]}" unit="cm" x="0" y="0 " z="$zpos"/>
1438  <rotationref ref="rMinusVAngleAboutX"/>
1439  </physvol>
1440 EOF
1441 
1442  #print("V wires: $i $zpos 0 \n");
1443  $zpos += $VWire_zpitch;
1444 
1445  }
1446 
1447 
1448 } #ends else
1449 
1450 print TPC <<EOF;
1451  </volume>
1452 EOF
1453 
1454 #+++++++++++++++++++++ Position physical wires Above +++++++++++++++++++++
1455 
1456 my $VolY_x = (-$TPC_x/2) + 3*$WirePlaneSpacing; #+ $TPCWirePlane_x/2;
1457 my $VolU_x = (-$TPC_x/2) + 2*$WirePlaneSpacing; #+ $TPCWirePlane_x/2;
1458 my $VolV_x = (-$TPC_x/2) + 1*$WirePlaneSpacing; #+ $TPCWirePlane_x/2;
1459 
1460 
1461 #wrap up the TPC file
1462 print TPC <<EOF;
1463 
1464  <volume name="volTPC0">
1465  <materialref ref="LAr" />
1466  <solidref ref="TPC" />
1467  <physvol>
1468  <volumeref ref="volTPCPlaneY" />
1469  <position name="posTPCPlaneY" unit="cm" x="$VolY_x" y="0" z="@{[$UpstreamLArPadding/2]}" />
1470  </physvol>
1471  <physvol>
1472  <volumeref ref="volTPCPlaneU" />
1473  <position name="posTPCPlaneU" unit="cm" x="$VolU_x" y="0" z="@{[$UpstreamLArPadding/2]}" />
1474  </physvol>
1475  <physvol>
1476  <volumeref ref="volTPCPlaneV" />
1477  <position name="posTPCPlaneV" unit="cm" x="$VolV_x" y="0" z="@{[$UpstreamLArPadding/2]}" />
1478  </physvol>
1479  <physvol>
1480  <volumeref ref="volTPCActive"/>
1481  <positionref ref="posActiveInTPC0"/>
1482  </physvol>
1483  <physvol>
1484  <volumeref ref="volRaceTrackTVolume"/>
1485  <positionref ref="posRaceTrackTInTPC"/>
1486  <rotationref ref="rIdentity"/>
1487  </physvol>
1488  <physvol>
1489  <volumeref ref="volRaceTrackBVolume"/>
1490  <positionref ref="posRaceTrackBInTPC"/>
1491  <rotationref ref="rIdentity"/>
1492  </physvol>
1493  <physvol>
1494  <volumeref ref="volRaceTrackUVolume"/>
1495  <positionref ref="posRaceTrackUInTPC"/>
1496  <rotationref ref="rPlus90AboutX"/>
1497  </physvol>
1498  </volume>
1499 
1500 </structure>
1501 </gdml>
1502 EOF
1503 
1504  close(GDML);
1505 
1506 } #end of sub gen_TPC
1507 
1508 ##################################################################
1509 #dg ########## Race Tracks Parameters ###########################
1510 ##################################################################
1512 {
1513 # from "Design, construction and tests of the ICARUS T600 detector",
1514 # ICARUS Collaboration (S. Amerio et al.). Jul 2004. 82 pp.
1515 # Nucl.Instrum.Meth. A527 (2004) 329-410
1516 #
1517 # 4 parts: Top (T) Bottom (B) Upstream (U) Downstream (D)
1518  $RT_epsilon = .0001 ;# extra safety space;
1519  $RaceTrack_d = 3.4; # cm race track tube diameter
1520  $RaceTrack_TubeThick = 0.08; #cm race track tube thick
1521 # $RaceTrack_lz = 1810.0; #cm length of race track structure
1522  $RaceTrack_lz = 905; #cm length of race track structure (half to accommodate for split wire TPC)
1523 # $RaceTrack_ly = 320.0 - 2*$RT_epsilon; #cm length of race track tubes
1524  $RaceTrack_ly = 323.6201 ; #cm height of race track structure (modified to be external to TPCActive_y
1525  $RaceTrack_number = 29; #number of race tracks
1526  $RaceTrack_pitch = 4.96; #distance between each race track tube
1527  $RaceTrack_ExternalRadius = $RaceTrack_d * 0.5; # cm external race track tube radius
1528  $RaceTrack_InnerRadius = $RaceTrack_d * 0.5-$RaceTrack_TubeThick; # cm internal race track tube radius
1529  $RaceTrack_width = ($RaceTrack_pitch +$RT_epsilon) * $RaceTrack_number;
1530  $RaceTrackT_length = $RaceTrack_lz + $RT_epsilon; # guess about Horizontal length
1531  $RaceTrackTTube_length = $RaceTrackT_length - $RT_epsilon; # guess about Horizontal length
1532  $RaceTrackB_length = $RaceTrack_lz + $RT_epsilon; # guess about Horizontal length
1533  $RaceTrackBTube_length = $RaceTrackB_length - $RT_epsilon; # guess about Horizontal length
1534  $RaceTrackU_length = $RaceTrack_ly - 2* $RaceTrack_d; # guess of vertical length
1535  $RaceTrackUTube_length = $RaceTrackU_length - $RT_epsilon; # guess of vertical length
1536  $RaceTrack_thickness=$RaceTrack_d+2*$RT_epsilon; #
1537 }
1538 
1539 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1540 #dg +++++++++++++++++++++++++++++++++++ gen_RaceTracks +++++++++++++++++++++++++++++++++++
1541 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1542 
1544 
1545 # 4 parts: Top (T) Bottom (B) Upstream (U) Downstream (D)
1546 # define the racetrack geometrical parameters
1547  define_RaceTrack();
1548 
1549  $RACETRACK= "icarus_racetracks" . $suffix . ".gdml";
1550  push (@gdmlFiles, $RACETRACK); # Add file to list of GDML fragments
1551  $RACETRACK = ">" . $RACETRACK;
1552  open(RACETRACK) or die("Could not open file $RACETRACK for writing");
1553 
1554 # The standard XML prefix and starting the gdml
1555  print RACETRACK <<EOF;
1556  <?xml version='1.0'?>
1557 <gdml>
1558 EOF
1559 
1560 #Create the RACETRACK volumes:
1561 # positions
1562 
1563 $RTy_T= ($RaceTrack_ly - $RaceTrack_thickness )/2. + $RT_epsilon ;
1564 $RTy_B=-($RaceTrack_ly - $RaceTrack_thickness )/2. + $RT_epsilon ;
1565 $RTx_T= ($TPC_x - $RaceTrack_pitch -$RaceTrack_width )/2. ;
1568 $RTz_U= -($RaceTrackT_length - $RaceTrack_thickness)/2. - $RT_epsilon + 45 - ($RaceTrackT_length - $TPCActiveHalf_z)/2;
1571 $RTz_T= 45 - ($RaceTrackT_length - $TPCActiveHalf_z)/2;
1572 $RTz_B= 45 - ($RaceTrackT_length - $TPCActiveHalf_z)/2;
1573 
1574 
1575 print RACETRACK <<EOF;
1576 <define>
1577 
1578  <position name="posRaceTrackTInTPC" unit="cm" x="$RTx_T" y="$RTy_T" z="$RTz_T"/>
1579  <position name="posRaceTrackBInTPC" unit="cm" x="$RTx_B" y="$RTy_B" z="$RTz_B"/>
1580  <position name="posRaceTrackUInTPC" unit="cm" x="$RTx_U" y="0" z="$RTz_U"/>
1581  <position name="posRaceTrackDInTPC" unit="cm" x="$RTx_D" y="0" z="$RTz_D"/>
1582 
1583 </define>
1584 <!--+++++++++++++++++++ RACETRACK Solids +++++++++++++++++++-->
1585 
1586 EOF
1587 
1588 print RACETRACK <<EOF;
1589 
1590 
1591 <solids>
1592  <box name="RaceTrackTVolume"
1593  x="$RaceTrack_width"
1594  y="$RaceTrack_thickness"
1595  z="$RaceTrackT_length"
1596  lunit="cm" />
1597  <box name="RaceTrackBVolume"
1598  x="$RaceTrack_width"
1599  y="$RaceTrack_thickness"
1600  z="$RaceTrackB_length"
1601  lunit="cm"/>
1602  <box name="RaceTrackUVolume"
1603  x="$RaceTrack_width"
1604  y="$RaceTrack_thickness"
1605  z="$RaceTrackU_length"
1606  lunit="cm"/>
1607  <tube name="RaceTrackTTubeVolume"
1608  rmax="$RaceTrack_ExternalRadius"
1609  rmin="$RaceTrack_InnerRadius"
1610  z="$RaceTrackTTube_length"
1611  deltaphi="360"
1612  aunit="deg"
1613  lunit="cm"/>
1614  <tube name="RaceTrackBTubeVolume"
1615  rmax="$RaceTrack_ExternalRadius"
1616  rmin="$RaceTrack_InnerRadius"
1617  z="$RaceTrackBTube_length"
1618  deltaphi="360"
1619  aunit="deg"
1620  lunit="cm"/>
1621  <tube name="RaceTrackUTubeVolume"
1622  rmax="$RaceTrack_ExternalRadius"
1623  rmin="$RaceTrack_InnerRadius"
1624  z="$RaceTrackUTube_length"
1625  deltaphi="360"
1626  aunit="deg"
1627  lunit="cm"/>
1628 
1629 </solids>
1630 EOF
1631 
1632 
1633 # assume Upstream identical to Downstream part
1634 # First define RaceTrack tubes
1635 
1636 print RACETRACK <<EOF;
1637 <structure>
1638 
1639 <!--+++++++++++++++++ RACETRACK Logical Volumes ++++++++++++++++++++-->
1640 
1641  <volume name="volRaceTrackTTubeVolume">
1642  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1643  <solidref ref="RaceTrackTTubeVolume"/>
1644  </volume>
1645  <volume name="volRaceTrackBTubeVolume">
1646  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1647  <solidref ref="RaceTrackBTubeVolume"/>
1648  </volume>
1649  <volume name="volRaceTrackUTubeVolume">
1650  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1651  <solidref ref="RaceTrackUTubeVolume"/>
1652  </volume>
1653 EOF
1654 
1655 # Define Upper part of RaceTrack
1656 print RACETRACK <<EOF;
1657 
1658 <!--+++++++++++++++++ RACETRACK Top Volume ++++++++++++++++++++-->
1659 
1660  <volume name="volRaceTrackTVolume">
1661  <materialref ref="LAr"/>
1662  <solidref ref="RaceTrackTVolume"/>
1663 
1664 
1665 EOF
1666 
1667 
1668 # Here it would be better to divide the volume into slices and then embedding tubes
1669 # at the moment simply replicate each tube
1670 $xTpos=-($RaceTrack_width - $RaceTrack_pitch - $RT_epsilon )/2.;
1671 for ($it = 0; $it < $RaceTrack_number; $it++)
1672 {
1673  print RACETRACK <<EOF;
1674  <physvol>
1675  <volumeref ref="volRaceTrackTTubeVolume"/>
1676  <position name="posRTkTTube$it" unit="cm" x="$xTpos" y="0" z="0" />
1677  <rotationref ref="rIdentity" />
1678  </physvol>
1679 EOF
1680  $xTpos+= $RaceTrack_pitch ;
1681 }
1682 print RACETRACK <<EOF;
1683 
1684  </volume>
1685 EOF
1686 
1687 # Define Lower part of RaceTrack
1688 print RACETRACK <<EOF;
1689 
1690 <!--+++++++++++++++++ RACETRACK Bottom Volume ++++++++++++++++++++-->
1691 
1692  <volume name="volRaceTrackBVolume">
1693  <materialref ref="LAr"/>
1694  <solidref ref="RaceTrackBVolume"/>
1695 EOF
1696 
1697 
1698 # Here it would be better to divide the volume into slices and then embedding tubes
1699 # at the moment simply replicate each tube
1700 $xTpos=-($RaceTrack_width - $RaceTrack_pitch - $RT_epsilon )/2.;
1701 for ($it = 0; $it < $RaceTrack_number; $it++)
1702 {
1703  print RACETRACK <<EOF;
1704  <physvol>
1705  <volumeref ref="volRaceTrackBTubeVolume"/>
1706  <position name="posRTkBTube$it" unit="cm" x="$xTpos" y="0" z="0" />
1707  <rotationref ref="rIdentity" />
1708  </physvol>
1709 EOF
1710  $xTpos+= $RaceTrack_pitch ;
1711 }
1712 print RACETRACK <<EOF;
1713 
1714  </volume>
1715 EOF
1716 
1717 # Define Upstream part of RaceTrack
1718 print RACETRACK <<EOF;
1719 
1720 <!--+++++++++++++++++ RACETRACK Upstream Volume ++++++++++++++++++++-->
1721 
1722  <volume name="volRaceTrackUVolume">
1723  <materialref ref="LAr"/>
1724  <solidref ref="RaceTrackUVolume"/>
1725 EOF
1726 
1727 # Here it would be better to divide the volume into slices and then embedding tubes
1728 # at the moment simply replicate each tube
1729 $xTpos=-($RaceTrack_width - $RaceTrack_pitch - $RT_epsilon )/2.;
1730 for ($it = 0; $it < $RaceTrack_number; $it++)
1731 {
1732  print RACETRACK <<EOF;
1733  <physvol>
1734  <volumeref ref="volRaceTrackUTubeVolume"/>
1735  <position name="posRTkUTube$it" unit="cm" x="$xTpos" y="0" z="0" />
1736  <rotationref ref="rIdentity" />
1737  </physvol>
1738 EOF
1739  $xTpos+= $RaceTrack_pitch ;
1740 }
1741 print RACETRACK <<EOF;
1742 
1743  </volume>
1744 EOF
1745 
1746 # close the RaceTrack structure
1747 print RACETRACK <<EOF;
1748 
1749 <!--+++++++++++++++++ RACETRACK end structure +++++++++++++++++++-->
1750 </structure>
1751 EOF
1752 
1753 #Close standard XML file
1754 print RACETRACK <<EOF;
1755 </gdml>
1756 EOF
1757 
1758 }
1759 #ends gen_RaceTracks
1760 
1761 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1762 #++++++++++++++++++++++++++++++++++++++ gen_PMTs +++++++++++++++++++++++++++++++++++++++++
1763 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1764 
1766 
1767  $PMT = "icarus_pmt" . $suffix . ".gdml";
1768  push (@gdmlFiles, $PMT); # Add file to list of GDML fragments
1769  $PMT = ">" . $PMT;
1770  open(PMT) or die("Could not open file $PMT for writing");
1771 
1772 # The standard XML prefix and starting the gdml
1773  print PMT <<EOF;
1774 <?xml version='1.0'?>
1775 <gdml>
1776 EOF
1777 
1778 #Create the PMT volume original z=2.54
1779 print PMT <<EOF;
1780 
1781 <!--+++++++++++++++++++ PMT Solids ++++++++++++++++++++++-->
1782 
1783 EOF
1784 #<position name="PMTtube" unit="cm" x="30" y="0" z="0"/>
1785 #was after print PMT <<EOF; line
1786 #moved here to comment out for moving to position defs
1787 
1788 print PMT <<EOF;
1789 <solids>
1790  <sphere name="PMTVolume"
1791  rmin="$PMTradiusInner"
1792  rmax="$PMTradiusOuter"
1793  deltaphi="360"
1794  deltatheta="90"
1795  aunit="deg"
1796  lunit="cm"/>
1797  <sphere name="PMTPassSphere"
1798  rmin="$PMTradiusInner"
1799  rmax="$PMTradiusOuter"
1800  deltaphi="360"
1801  deltatheta="90"
1802  aunit="deg"
1803  lunit="cm"/>
1804  <tube name="PMTPassTube"
1805  rmax="$PMTtubeRmax"
1806  rmin="$PMTtubeRmin"
1807  z="$PMTtube_x"
1808  deltaphi="360"
1809  aunit="deg"
1810  lunit="cm"/>
1811  <union name="PMTPassVolume">
1812  <first ref="PMTPassSphere"/>
1813  <second ref="PMTPassTube"/>
1814  <positionref ref="PMTtube"/>
1815  <rotationref ref="rMinus90AboutZ"/>
1816  </union>
1817 </solids>
1818 EOF
1819 
1820 #For some reasons, the Optical Sensitive Volume for PMT has to be LAr ... I found this info both in SBND and MicroBoone geometries
1821 print PMT <<EOF;
1822 <structure>
1823 
1824 <!--+++++++++++++++++ PMT Logical Volumes ++++++++++++++++++++-->
1825 
1826  <volume name="volOpDetSensitive">
1827  <materialref ref="LAr"/>
1828  <solidref ref="PMTVolume"/>
1829  </volume>
1830  <volume name="volNotOpDetSensitive">
1831  <materialref ref="Glass"/>
1832  <solidref ref="PMTPassVolume"/>
1833  </volume>
1834 
1835 </structure>
1836 EOF
1837 
1838 #Close standard XML file
1839 print PMT <<EOF;
1840 </gdml>
1841 EOF
1842 
1843 }
1844 #ends gen PMTs
1845 
1846 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1847 #am+++++++++++++++++++++++ gen_structure +++++++++++++++++++++++++
1848 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1849 
1851 
1852  $MECH = "icarus_Mech_Structure" . $suffix . ".gdml";
1853  push (@gdmlFiles, $MECH); # Add file to list of GDML fragments
1854  $MECH = ">" . $MECH;
1855  open(MECH) or die("Could not open file $MECH for writing");
1856 
1857 # The standard XML prefix and starting the gdml
1858  print MECH <<EOF;
1859 <?xml version='1.0'?>
1860 <gdml>
1861 EOF
1862 
1863 #All the steel structure solids
1864 print MECH <<EOF;
1865 
1866 <!--+++++++++++++++++++ Structure Solids ++++++++++++++++++++++-->
1867 
1868 EOF
1869 print MECH <<EOF;
1870 <solids>
1871  <box name="LatExtMechBox"
1872  x="$ext_struct_x"
1873  y="$ext_struct_y"
1874  z="$ext_struct_z"
1875  lunit="cm" />
1876  <box name="LatIntMechBox"
1877  x="@{[0.1+$int_struct_x]}"
1878  y="$int_struct_y"
1879  z="$int_struct_z"
1880  lunit="cm" />
1881  <box name="Pillar"
1882  x="$int_struct_x"
1883  y="$int_struct_y"
1884  z="$int_struct_x"
1885  lunit="cm" />
1886  <subtraction name="LatIntMechShell">
1887  <first ref="LatIntMechBox"/>
1888  <second ref="Pillar"/>
1889  </subtraction>
1890  <subtraction name="LatMechShell">
1891  <first ref="LatExtMechBox"/>
1892  <second ref="LatIntMechShell"/>
1893  </subtraction>
1894 </solids>
1895 EOF
1896 
1897 print MECH <<EOF;
1898 <structure>
1899 
1900 <!--+++++++++++++++++ Structure Logical Volumes ++++++++++++++++++++-->
1901 
1902 <volume name="volLatMech">
1903  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1904  <solidref ref="LatMechShell"/>
1905 </volume>
1906 
1907 </structure>
1908 EOF
1909 
1910 #Close standard XML file
1911 print MECH <<EOF;
1912 </gdml>
1913 EOF
1914 
1915 }
1916 #ends gen mechanical structure
1917 
1918 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1919 #++++++++++++++++++++++++++++++++++++++ gen_Cryostat +++++++++++++++++++++++++++++++++++++
1920 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1921 
1922 sub gen_Cryostat()
1923 {
1924 
1925 # Create the cryostat fragment file name,
1926 # add file to list of output GDML fragments,
1927 # and open it
1928  $CRYO = "icarus_Cryostat" . $suffix . ".gdml";
1929  push (@gdmlFiles, $CRYO);
1930  $CRYO = ">" . $CRYO;
1931  open(CRYO) or die("Could not open file $CRYO for writing");
1932 
1933 
1934 # The standard XML prefix and starting the gdml
1935  print CRYO <<EOF;
1936 <?xml version='1.0'?>
1937 <gdml>
1938 EOF
1939 
1940 
1941 # All the cryostat solids.
1942 print CRYO <<EOF;
1943 <solids>
1944 
1945  <box name="Cryostat" lunit="cm"
1946  x="$Cryostat_x"
1947  y="$Cryostat_y"
1948  z="$Cryostat_z"/>
1949  <box name="ArgonInterior" lunit="cm"
1950  x="$LAr_x"
1951  y="@{[$LAr_y + $GaseousAr_y]}"
1952  z="$TPC_z"/>
1953  <box name="GaseousArgon" lunit="cm"
1954  x="$LAr_x"
1955  y="$GaseousAr_y"
1956  z="$LAr_z"/>
1957  <subtraction name="AlumShell">
1958  <first ref="Cryostat"/>
1959  <second ref="ArgonInterior"/>
1960  </subtraction>
1961 
1962  <box name="PMTPlane" lunit="cm"
1963  x="$PMTPlane_x"
1964  y="$PMTPlane_y"
1965  z="$PMTPlane_z"/>
1966 
1967  <box name="Cathode" lunit="cm"
1968  x="$CPA_x"
1969  y="$CPA_y"
1970  z="$CPA_z"/>
1971 
1972  <box name="CathodeStrip" lunit="cm"
1973  x="$CPAStrip_x"
1974  y="$CPAStrip_y"
1975  z="$CPA_z"/>
1976 
1977 </solids>
1978 EOF
1979 
1980 # Cryostat structure
1981 
1982 
1983 print CRYO <<EOF;
1984 <structure>
1985  <volume name="volAlumShell">
1986  <materialref ref="ALUMINUM_CRYO" />
1987  <solidref ref="AlumShell" />
1988  </volume>
1989  <volume name="volGaseousArgon">
1990  <materialref ref="ArGas"/>
1991  <solidref ref="GaseousArgon"/>
1992  </volume>
1993  <volume name="volCathodeStrip">
1994  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
1995  <solidref ref="CathodeStrip"/>
1996  </volume>
1997  <volume name="volCathode">
1998  <materialref ref="LAr" />
1999  <solidref ref="Cathode" />
2000 EOF
2001 
2002 ############################################################################################
2003 #Positioning 64 cathode strips, 2.1 cm high.
2004 
2005 $Num_CStrips = 64;
2006 $yCSpos = -($CPA_y-$CPAStrip_pitch)/2;
2007 
2008  for ( $j=0; $j<$Num_CStrips; ++$j ){
2009  print CRYO <<EOF;
2010  <physvol>
2011  <volumeref ref="volCathodeStrip"/>
2012  <position name="posCStrip$j" unit="cm" x="0" y="$yCSpos" z="0"/>
2013  </physvol>
2014 EOF
2015 $yCSpos+= $CPAStrip_pitch;
2016 }
2017 print CRYO <<EOF;
2018  </volume>
2019 EOF
2020 ############################################################################################
2021 print CRYO <<EOF;
2022  <volume name="volPMTPlane">
2023  <materialref ref="LAr"/>
2024  <solidref ref="PMTPlane"/>
2025 EOF
2026 
2027 ############################################################################################
2028 #Positioning PMTs: positions from a file
2029 
2030 #$PMT_x0 = 0;
2031 $PMT_x0 = $PMTradiusOuter/2 - $PMTGrid_offset/2 - $PMTtube_x ;
2032 $PMT_x1 = $PMT_x0 ;
2033 @pmt_pos0 = read_pmt_pos("dispositionPMT.txt", $PMT_x0);
2034 @pmt_pos1 = read_pmt_pos("dispositionPMT.txt", $PMT_x1);
2035 $Num_PMTs0 = @pmt_pos0;
2036 
2037  for ( $i=0; $i<$Num_PMTs0; ++$i ){
2038  print CRYO <<EOF;
2039  <physvol>
2040  <volumeref ref="volOpDetSensitive"/>
2041  <position name="posPMT0$i" unit="cm" @pmt_pos0[$i]/>
2042  <rotationref ref="rPlus90AboutY"/>
2043  </physvol>
2044  <physvol>
2045  <volumeref ref="volNotOpDetSensitive"/>
2046  <position name="posPMT1$i" unit="cm" @pmt_pos1[$i]/>
2047  <rotationref ref="rMinus90AboutY"/>
2048  </physvol>
2049 EOF
2050  }
2051 
2052 ############################################################################################
2053 #Positioning Mechanical Structure elements:
2054 
2055 #$TPCActive_z
2056 
2057 $zMpos = -$TPCActive_z/2 + $ext_struct_z/2 ;
2058 $mech_number = 9.;
2059 for ($im = 0; $im < $mech_number; $im++)
2060 {
2061  print CRYO <<EOF;
2062  <physvol>
2063  <volumeref ref="volLatMech"/>
2064  <position name="posLatMech$im" unit="cm" x="0" y="0" z="$zMpos" />
2065 <!-- <rotationref ref="rIdentity" /> -->
2066  </physvol>
2067 EOF
2068  $zMpos+= $ext_struct_z ;
2069 }
2070 print CRYO <<EOF;
2071  </volume>
2072 EOF
2073 
2074 ############################################################################################
2075 print CRYO <<EOF;
2076  <volume name="volCryostat">
2077  <materialref ref="LAr" />
2078  <solidref ref="Cryostat" />
2079  <physvol>
2080  <volumeref ref="volGaseousArgon"/>
2081  <position name="posGaseousArgon" unit="cm" x="0" y="@{[$LAr_y/2]}" z="0" />
2082  </physvol>
2083  <physvol>
2084  <volumeref ref="volAlumShell"/>
2085  <position name="posAlumShell" unit="cm" x="0" y="0" z="0"/>
2086  </physvol>
2087 
2088  <physvol>
2089  <volumeref ref="volPMTPlane" />
2090  <position name="posPMTPlane0" unit="cm" x="@{[-$TPC_x - $PMTPlane_x/2 - $PMTWiresOffset ]}" y="$TPCinCryo_y" z="0" />
2091  <rotationref ref="rPlus180AboutY"/>
2092  </physvol>
2093 
2094  <physvol>
2095  <volumeref ref="volTPC0"/>
2096  <positionref ref="posTPC00inCryo"/>
2097  <rotationref ref="rIdentity"/>
2098  </physvol>
2099 
2100  <physvol>
2101  <volumeref ref="volTPC0"/>
2102  <positionref ref="posTPC01inCryo"/>
2103  <rotationref ref="rPlus180AboutX"/>
2104  </physvol>
2105 
2106  <physvol>
2107  <volumeref ref="volCathode" />
2108  <positionref ref="posCathode"/>
2109  </physvol>
2110 
2111  <physvol>
2112  <volumeref ref="volTPC0"/>
2113  <positionref ref="posTPC10inCryo"/>
2114  <rotationref ref="rPlus180AboutZ"/>
2115  </physvol>
2116 
2117  <physvol>
2118  <volumeref ref="volTPC0"/>
2119  <positionref ref="posTPC11inCryo"/>
2120  <rotationref ref="rPlus180AboutXZ"/>
2121  </physvol>
2122 
2123 
2124  <physvol>
2125  <volumeref ref="volPMTPlane" />
2126  <position name="posPMTPlane1" unit="cm" x="@{[$TPC_x + $PMTPlane_x/2 + $PMTWiresOffset ]}" y="$TPCinCryo_y" z="0" />
2127  </physvol>
2128 
2129 EOF
2130 
2131 print CRYO <<EOF;
2132  </volume>
2133 </structure>
2134 </gdml>
2135 EOF
2136 
2137 close(CRYO);
2138 }
2139 
2140 
2141 ##############################################################################################################
2142 ##############################################################################################################
2143 ##############################################################################################################
2144 ##############################################################################################################
2145 ##############################################################################################################
2146 ##############################################################################################################
2147 
2148 
2149 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2150 #++++++++++++++++++++++++++++++++++++++ gen_CRT ++++++++++++++++++++++++++++++++++++++++++
2151 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2152 
2154 {
2155 # Create the CRT fragment file name,
2156 # add file to list of output GDML fragments,
2157 # and open it
2158 
2159 # using a python script to generate the CRT geometry
2160  $CRTPYTHON="gen_crt_frags.py";
2161  my $ret=`python $CRTPYTHON `;
2162 
2163 
2164  $CRT = "icarus_crt" . $suffix . ".gdml";
2165  push (@gdmlFiles, $CRT);
2166 # expecting the python script to generate a file "icarus_crt_test.gdml"
2167 # $CRT = ">" . $CRT;
2168 # open(CRT) or die("Could not open file $CRT for writing");
2169 
2170 
2171 # The standard XML prefix and starting the gdml
2172 # print CRT <<EOF;
2173 #<?xml version='1.0'?>
2174 #<gdml>
2175 #EOF
2176 
2177 
2178 close(CRT);
2179 }
2180 
2181 ##############################################################################################################
2182 ##############################################################################################################
2183 ##############################################################################################################
2184 ##############################################################################################################
2185 ##############################################################################################################
2186 ##############################################################################################################
2187 
2188 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2189 #+++++++++++++++++++++++++++++++++++++ gen_Enclosure +++++++++++++++++++++++++++++++++++++
2190 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2191 
2193 {
2194 
2195 # Create the detector enclosure fragment file name,
2196 # add file to list of output GDML fragments,
2197 # and open it
2198  $ENCL = "icarus_DetEnclosure" . $suffix . ".gdml";
2199  push (@gdmlFiles, $ENCL);
2200  $ENCL = ">" . $ENCL;
2201  open(ENCL) or die("Could not open file $ENCL for writing");
2202 
2203 
2204 # The standard XML prefix and starting the gdml
2205  print ENCL <<EOF;
2206 <?xml version='1.0'?>
2207 <gdml>
2208 EOF
2209 
2210 # All the detector enclosure solids.
2211 print ENCL <<EOF;
2212 <solids>
2213 
2214  <box name="DetEnclosure" lunit="cm"
2215  x="$DetEnc_x"
2216  y="$DetEnc_y"
2217  z="$DetEnc_z"/>
2218 
2219  <box name="ThermIns" lunit="cm"
2220  x="$ThermIns_x"
2221  y="$ThermIns_y"
2222  z="$ThermIns_z"/>
2223 
2224  <box name="WarmVessel" lunit="cm"
2225  x="$WarmVessel_x"
2226  y="$WarmVessel_y"
2227  z="$WarmVessel_z"/>
2228 
2229  <box name="ThermInsInterior" lunit="cm"
2230  x="@{[$ThermIns_x - 2*$FoamPadding]}"
2231  y="@{[$ThermIns_y - 2*$FoamPadding]}"
2232  z="@{[$ThermIns_z - 2*$FoamPadding]}"/>
2233 
2234  <box name="WarmVesselInterior" lunit="cm"
2235  x="@{[$WarmVessel_x - 2*$WarmVesselThickness_x]}"
2236  y="@{[$WarmVessel_y - 2*$WarmVesselThickness]}"
2237  z="@{[$WarmVessel_z - 2*$WarmVesselThickness]}"/>
2238 
2239  <subtraction name="ThermInsShell">
2240  <first ref="ThermIns"/>
2241  <second ref="ThermInsInterior"/>
2242  </subtraction>
2243 
2244  <subtraction name="WarmVesselShell">
2245  <first ref="WarmVessel"/>
2246  <second ref="WarmVesselInterior"/>
2247  </subtraction>
2248 
2249 </solids>
2250 EOF
2251 
2252 
2253 # Detector enclosure structure
2254  print ENCL <<EOF;
2255 <structure>
2256 
2257  <volume name="volThermIns">
2258  <materialref ref="Polyurethane"/>
2259  <solidref ref="ThermInsShell"/>
2260  </volume>
2261 
2262  <volume name="volWarmVessel">
2263  <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni_WV"/>
2264  <solidref ref="WarmVesselShell"/>
2265  </volume>
2266 
2267  <volume name="volDetEnclosure">
2268  <materialref ref="Air"/>
2269  <solidref ref="DetEnclosure"/>
2270 
2271  <physvol>
2272  <volumeref ref="volThermIns"/>
2273  <positionref ref="posThermInsInDetEncl"/>
2274  </physvol>
2275 
2276  <physvol>
2277  <volumeref ref="volCRT_Shell"/>
2278  <positionref ref="posCRTShellInDetEncl"/>
2279  </physvol>
2280 
2281  <physvol>
2282  <volumeref ref="volWarmVessel"/>
2283  <positionref ref="posWarmVesselInDetEncl"/>
2284  </physvol>
2285 
2286  <physvol>
2287  <volumeref ref="volCryostat"/>
2288  <positionref ref="posCryo1InWarmVessel"/>
2289  </physvol>
2290 
2291  <physvol>
2292  <volumeref ref="volCryostat"/>
2293  <positionref ref="posCryo2InWarmVessel"/>
2294  </physvol>
2295 
2296 EOF
2297 if ($crt_on==1)
2298 {
2299 #+++++++++++++++++++++++++ Position CRT modules ++++++++++++++++++++++++++
2300  #$YPosMINOSSide = $Cryostat_y/2+$MINOSModWidth/2;
2301 
2302 
2303 } #end of crt_on
2304 
2305  else {
2306 
2307 print ENCL <<EOF;
2308 
2309  <!-- This GDML version has no crt and uses much less memory -->
2310 
2311 EOF
2312 
2313 }
2314 
2315 print ENCL <<EOF;
2316 
2317 </volume>
2318 
2319 </structure>
2320 </gdml>
2321 EOF
2322 
2323 close(ENCL);
2324 }
2325 
2326 
2327 
2328 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2329 #+++++++++++++++++++++++++++++++++++++++ gen_World +++++++++++++++++++++++++++++++++++++++
2330 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2331 
2333 {
2334 
2335 # Create the WORLD fragment file name,
2336 # add file to list of output GDML fragments,
2337 # and open it
2338  $WORLD = "icarus_World" . $suffix . ".gdml";
2339  push (@gdmlFiles, $WORLD);
2340  $WORLD = ">" . $WORLD;
2341  open(WORLD) or die("Could not open file $WORLD for writing");
2342 
2343 
2344 # The standard XML prefix and starting the gdml
2345  print WORLD <<EOF;
2346 <?xml version='1.0'?>
2347 <gdml>
2348 EOF
2349 
2350 #Dirt global
2351 # <box name="DirtWorld" lunit="cm"
2352 # x="$World_x"
2353 # y="@{[$World_y/2 + $Ground_y]}"
2354 # z="$World_z"/>
2355 
2356 # All the World solids.
2357 print WORLD <<EOF;
2358 <solids>
2359  <box name="World" lunit="cm"
2360  x="$World_x"
2361  y="$World_y"
2362  z="$World_z"/>
2363 
2364  <box name="BoxDirtAlongX" lunit="cm"
2365  x="@{[$Hall_x-0.1]}"
2366  y="@{[$ExpHall_y-0.1]}"
2367  z="@{[$World_z/2-$Hall_z/2-0.1]}"/>
2368 
2369  <box name="BoxDirtAlongZ" lunit="cm"
2370  x="@{[$World_x/2-$Hall_x/2-0.1]}"
2371  y="@{[$ExpHall_y-0.1]}"
2372  z="@{[$World_z-0.1]}"/>
2373 
2374  <box name="BoxDirtBottom" lunit="cm"
2375  x="@{[$World_x-0.1]}"
2376  y="@{[$World_y/2+$Ground_y-$ExpHall_y]}"
2377  z="@{[$World_z-0.1]}"/>
2378 
2379 EOF
2380 
2381 if ($concrete_on != 0)
2382 {
2383 
2384 #part of the overburden above the dirt
2385 print WORLD <<EOF;
2386  <box name="OverburdenUp" lunit="cm"
2387  x="$Overburden_x"
2388  y="@{[2*$Overburden_y/3]}"
2389  z="$Overburden_z"/>
2390 
2391  <box name="OverburdenDown" lunit="cm"
2392  x="$Overburden_x"
2393  y="@{[$Overburden_y/3]}"
2394  z="$Overburden_z"/>
2395 EOF
2396 }
2397 
2398 else {
2399 print WORLD <<EOF;
2400  <!-- This GDML version has no overburden-->
2401 EOF
2402 }
2403 
2404 print WORLD <<EOF;
2405 
2406  <box name="Building" lunit="cm"
2407  x="$Hall_x"
2408  y="$Building_y"
2409  z="$Hall_z"/>
2410 
2411  <box name="AirBuilding" lunit="cm"
2412  x="@{[$Hall_x - $HallWallThicnekss]}"
2413  y="@{[$Building_y - $HallWallThicnekss/2]} "
2414  z="@{[$Hall_z - $HallWallThicnekss]}"/>
2415 
2416  <subtraction name="WallBuilding">
2417  <first ref="Building"/>
2418  <second ref="AirBuilding"/>
2419  <position name="posAirBuilding" unit="cm" x="0" y="@{[-$HallWallThicnekss/4]}" z="0"/>
2420  </subtraction>
2421 
2422  <box name="ExpHall" lunit="cm"
2423  x="$Hall_x"
2424  y="$ExpHall_y"
2425  z="$Hall_z"/>
2426 
2427  <box name="AirExpHall" lunit="cm"
2428  x="@{[$Hall_x - $HallWallThicnekss]}"
2429  y="@{[$ExpHall_y - $HallWallThicnekss/2]}"
2430  z="@{[$Hall_z - $HallWallThicnekss]}"/>
2431 
2432  <subtraction name="WallExpHall">
2433  <first ref="ExpHall"/>
2434  <second ref="AirExpHall"/>
2435  <position name="posAirExpHall" unit="cm" x="0" y="@{[$HallWallThicnekss/4]}" z="0"/>
2436  </subtraction>
2437 </solids>
2438 EOF
2439 
2440 
2441 # World structure: Building + underground experimental hall + detector
2442 
2443 print WORLD <<EOF;
2444 <structure>
2445 EOF
2446 
2447 #Building: building + upper part of the overburden
2448 
2449 if ( $concrete_on != 0) {
2450 print WORLD <<EOF;
2451  <volume name="volOverburdenUp" >
2452  <materialref ref="Concrete"/>
2453  <solidref ref="OverburdenUp"/>
2454  </volume>
2455 EOF
2456 }
2457 
2458 print WORLD <<EOF;
2459 
2460  <volume name="volBuilding" >
2461  <materialref ref="Air"/>
2462  <solidref ref="AirBuilding"/>
2463  </volume>
2464 
2465  <volume name="volWallBuilding" >
2466  <materialref ref="Concrete"/>
2467  <solidref ref="WallBuilding"/>
2468 
2469 EOF
2470 
2471 #if ($concrete_on !=0) {
2472 
2473 #print WORLD <<EOF;
2474 
2475 # <physvol>
2476 # <volumeref ref="volOverburdenUp"/>
2477 # <position name="posOverburdenUp" unit="cm" x="$posOverburden_x" y="@{[-$Building_y/2 + $Overburden_y/6 ]}" z="$posOverburden_z" />
2478 # </physvol>
2479 #EOF
2480 
2481 #}
2482 
2483 #Experimental hall: experimental hall + overburden
2484 
2485 print WORLD <<EOF;
2486 </volume>
2487  <volume name="volExpHall" >
2488  <materialref ref="Air"/>
2489  <solidref ref="AirExpHall"/>
2490  </volume>
2491 
2492 EOF
2493 
2494 if ( $concrete_on != 0) {
2495 print WORLD <<EOF;
2496  <volume name="volOverburdenDown" >
2497  <materialref ref="Concrete"/>
2498  <solidref ref="OverburdenDown"/>
2499  </volume>
2500 EOF
2501 }
2502 
2503 print WORLD <<EOF;
2504 
2505  <volume name="volWallExpHall" >
2506  <materialref ref="Concrete"/>
2507  <solidref ref="WallExpHall"/>
2508 EOF
2509 
2510 
2511 #if ( $concrete_on != 0) {
2512 #print WORLD <<EOF;
2513 # <physvol>
2514 # <volumeref ref="volOverburdenDown"/>
2515 # <position name="posOverburdenDown" unit="cm" x="$posOverburden_x" y="@{[$ExpHall_y/2 - $Overburden_y/3]}" z="$posOverburden_z" />
2516 # </physvol>
2517 #EOF
2518 #}
2519 
2520 
2521 
2522 #Complete world: building + underground parts + detector
2523 
2524 print WORLD <<EOF;
2525 </volume>
2526 
2527  <volume name="volBoxDirtAlongX" >
2528  <materialref ref="Dirt"/>
2529  <solidref ref="BoxDirtAlongX"/>
2530  </volume>
2531 
2532  <volume name="volBoxDirtAlongZ" >
2533  <materialref ref="Dirt"/>
2534  <solidref ref="BoxDirtAlongZ"/>
2535  </volume>
2536 
2537  <volume name="volBoxDirtBottom" >
2538  <materialref ref="Dirt"/>
2539  <solidref ref="BoxDirtBottom"/>
2540  </volume>
2541 
2542  <volume name="volWorld" >
2543  <materialref ref="Air"/>
2544  <solidref ref="World"/>
2545 
2546  <physvol>
2547  <volumeref ref="volWallBuilding"/>
2548  <positionref ref="posBuildingInWorld"/>
2549  </physvol>
2550 
2551  <physvol>
2552  <volumeref ref="volWallExpHall"/>
2553  <positionref ref="posExpHallInWorld"/>
2554  </physvol>
2555 
2556  <physvol>
2557  <volumeref ref="volOverburdenUp"/>
2558  <position name="posOverburdenUp" unit="cm" x="$posOverburden_x" y="@{[$Ground_y + $Overburden_y/3 ]}" z="$posOverburden_z" />
2559  </physvol>
2560 
2561  <physvol>
2562  <volumeref ref="volOverburdenDown"/>
2563  <position name="posOverburdenDown" unit="cm" x="$posOverburden_x" y="@{[$Ground_y - $Overburden_y/6]}" z="$posOverburden_z" />
2564  </physvol>
2565 
2566  <physvol>
2567  <volumeref ref="volBoxDirtAlongX"/>
2568  <position name="posBoxDirtAlongX1" unit="cm" x="$posOverburden_x" y="@{[$Ground_y-0.5*($ExpHall_y-0.1)]}" z="@{[$World_z/2-0.5*($World_z/2-$Hall_z/2)]}"/>
2569  </physvol>
2570 
2571  <physvol>
2572  <volumeref ref="volBoxDirtAlongX"/>
2573  <position name="posBoxDirtAlongX2" unit="cm" x="$posOverburden_x" y="@{[$Ground_y-0.5*($ExpHall_y-0.1)]}" z="@{[-$World_z/2+0.5*($World_z/2-$Hall_z/2)]}"/>
2574  </physvol>
2575 
2576  <physvol>
2577  <volumeref ref="volBoxDirtAlongZ"/>
2578  <position name="posBoxDirtAlongZ1" unit="cm" x="@{[$World_x/2- 0.5*($World_x/2-$Hall_x/2)]}" y="@{[$Ground_y-0.5*($ExpHall_y-0.1)]}" z="$posOverburden_z"/>
2579  </physvol>
2580 
2581  <physvol>
2582  <volumeref ref="volBoxDirtAlongZ"/>
2583  <position name="posBoxDirtAlongZ2" unit="cm" x="@{[-$World_x/2+0.5*($World_x/2-$Hall_x/2)]}" y="@{[$Ground_y-0.5*($ExpHall_y-0.1)]}" z="$posOverburden_z"/>
2584  </physvol>
2585 
2586  <physvol>
2587  <volumeref ref="volBoxDirtBottom"/>
2588  <position name="posBoxDirtBottom" unit="cm" x="$posOverburden_x" y="@{[-$World_y/2+0.5*($World_y/2+$Ground_y-$ExpHall_y)]}" z="$posOverburden_z"/>
2589  </physvol>
2590 
2591  <physvol>
2592  <volumeref ref="volDetEnclosure"/>
2593  <positionref ref="posDetEncInWorld"/>
2594  </physvol>
2595 
2596  </volume>
2597 </structure>
2598 </gdml>
2599 EOF
2600 
2601 #big dirt volume
2602 #<physvol>
2603 #<volumeref ref="volDirtWorld"/>
2604 #<position name="posDirtWorld" unit="cm" x="$posOverburden_x" y="@{[-$World_y/4 + $Ground_y/2]}" z="$posOverburden_z"/>
2605 #</physvol>
2606 
2607 # make_gdml.pl will take care of <setup/>
2608 
2609 close(WORLD);
2610 }
2611 
2612 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2613 #++++++++++++++++++++++++++++++++++++ write_fragments ++++++++++++++++++++++++++++++++++++
2614 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2615 #sub gen_CRT()
2616 #{
2617 # Create the TPC fragment file name,
2618 # add file to list of output GDML fragments,
2619 # and open it
2620 # $CRT = "crt.gdml";
2621 # push (@gdmlFiles, $CRT);
2622 #}
2623 
2625 {
2626  # This subroutine creates an XML file that summarizes the the subfiles output
2627  # by the other sub routines - it is the input file for make_gdml.pl which will
2628  # give the final desired GDML file. Specify its name with the output option.
2629  # (you can change the name when running make_gdml)
2630 
2631  # This code is taken straigh from the similar MicroBooNE generate script, Thank you.
2632 
2633  if ( ! defined $output )
2634  {
2635  $output = "-"; # write to STDOUT
2636  }
2637 
2638  # Set up the output file.
2639  $OUTPUT = ">" . $output;
2640  open(OUTPUT) or die("Could not open file $OUTPUT");
2641 
2642  print OUTPUT <<EOF;
2643 <?xml version='1.0'?>
2644 
2645 <!-- Input to Geometry/gdml/make_gdml.pl; define the GDML fragments
2646  that will be zipped together to create a detector description.
2647  -->
2648 
2649 <config>
2650 
2651  <constantfiles>
2652 
2653  <!-- These files contain GDML <constant></constant>
2654  blocks. They are read in separately, so they can be
2655  interpreted into the remaining GDML. See make_gdml.pl for
2656  more information.
2657  -->
2658 
2659 EOF
2660 
2661  foreach $filename (@defFiles)
2662  {
2663  print OUTPUT <<EOF;
2665 EOF
2666  }
2667 
2668  print OUTPUT <<EOF;
2669 
2670  </constantfiles>
2671 
2672  <gdmlfiles>
2673 
2674  <!-- The GDML file fragments to be zipped together. -->
2675 
2676 EOF
2677 
2678  foreach $filename (@gdmlFiles)
2679  {
2680  print OUTPUT <<EOF;
2682 EOF
2683  }
2684 
2685  print OUTPUT <<EOF;
2686 
2687  </gdmlfiles>
2688 
2689 </config>
2690 EOF
2691 
2692  close(OUTPUT);
2693 }
2694 
2695 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2696 sub read_pmt_pos {
2697 
2698  $pmt_x = $_[1];
2699 
2700  $PMT_pos_file = $_[0];
2701  open(PMTPOS, $PMT_pos_file) or die("Could not open file $PMT_pos_file.");
2702 
2703  @pmt_pos = ();
2704 
2705  foreach $line (<PMTPOS>) {
2706 
2707  @coord = split(/\s/, $line);
2708 
2709  $string = " x=\" $pmt_x\" y=\"$coord[1]\" z=\"$coord[0]\"";
2710  push(@pmt_pos, $string);
2711 
2712  }
2713 
2714  close(PMTPOS);
2715 
2716  return @pmt_pos;
2717 }
2718 
process_name opflash particleana ie ie ie z
walls no bottom
Definition: selectors.fcl:105
BEGIN_PROLOG true icarus_rawdigitfilter FilterTools FilterPlane1 Plane
ClusterModuleLabel join with tracks
const geo::GeometryCore * geometry
process_name opflash particleana ie x
foreach $filename(@defFiles)
process_name can override from command line with o or output proton mvapid_weights muon_all_BDT weights xml
Definition: runPID.fcl:28
#define PMT
Definition: NestAlg.cxx:19
esac done echo Signal files are
Definition: TrainMVA.sh:25
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
* file
Definition: file_to_url.sh:69
GetOptions("help|h"=>\$help,"suffix|s:s"=>\$suffix,"output|o:s"=>\$output,"concrete|c:s"=>\$thickness_over,"wires|w:s"=>\$wires,"vetocrt|v:s"=>\$crt)
walls no right
Definition: selectors.fcl:105
BEGIN_PROLOG could also be dds filename
#define the
do one_file $F done echo for F in find $TOP name CMakeLists txt print
process_name use argoneut_mc_hitfinder track
def write
Definition: util.py:23
print RACETRACK<< EOF;<?xml version='1.0'?>< gdml > EOF $RTy_T
BEGIN_PROLOG TPC
my($xml, $fcl, $workdir, $check, $merge)
usage
Definition: doGit.sh:21
gen_Cryostat()
process_name gaushit a
walls no top
Definition: selectors.fcl:105
BEGIN_PROLOG KDIF from and KDAR from beamline(this option orthogonal to"KDAROnly") Beam2DetectorRotation
BEGIN_PROLOG V
print RACETRACK<< EOF;< define >< positionname="posRaceTrackTInTPC"unit="cm"x="$RTx_T"y="$RTy_T"z="$RTz_T"/>< positionname="posRaceTrackBInTPC"unit="cm"x="$RTx_B"y="$RTy_B"z="$RTz_B"/>< positionname="posRaceTrackUInTPC"unit="cm"x="$RTx_U"y="0"z="$RTz_U"/>< positionname="posRaceTrackDInTPC"unit="cm"x="$RTx_D"y="0"z="$RTz_D"/></define ><!--+++++++++++++++++++RACETRACKSolids+++++++++++++++++++--> EOF print RACETRACK<< EOF;< solids >< boxname="RaceTrackTVolume"x="$RaceTrack_width"y="$RaceTrack_thickness"z="$RaceTrackT_length"lunit="cm"/>< boxname="RaceTrackBVolume"x="$RaceTrack_width"y="$RaceTrack_thickness"z="$RaceTrackB_length"lunit="cm"/>< boxname="RaceTrackUVolume"x="$RaceTrack_width"y="$RaceTrack_thickness"z="$RaceTrackU_length"lunit="cm"/>< tubename="RaceTrackTTubeVolume"rmax="$RaceTrack_ExternalRadius"rmin="$RaceTrack_InnerRadius"z="$RaceTrackTTube_length"deltaphi="360"aunit="deg"lunit="cm"/>< tubename="RaceTrackBTubeVolume"rmax="$RaceTrack_ExternalRadius"rmin="$RaceTrack_InnerRadius"z="$RaceTrackBTube_length"deltaphi="360"aunit="deg"lunit="cm"/>< tubename="RaceTrackUTubeVolume"rmax="$RaceTrack_ExternalRadius"rmin="$RaceTrack_InnerRadius"z="$RaceTrackUTube_length"deltaphi="360"aunit="deg"lunit="cm"/></solids > EOF print RACETRACK<< EOF;< structure ><!--+++++++++++++++++RACETRACKLogicalVolumes++++++++++++++++++++-->< volumename="volRaceTrackTTubeVolume">< materialrefref="STEEL_STAINLESS_Fe7Cr2Ni"/>< solidrefref="RaceTrackTTubeVolume"/></volume >< volumename="volRaceTrackBTubeVolume">< materialrefref="STEEL_STAINLESS_Fe7Cr2Ni"/>< solidrefref="RaceTrackBTubeVolume"/></volume >< volumename="volRaceTrackUTubeVolume">< materialrefref="STEEL_STAINLESS_Fe7Cr2Ni"/>< solidrefref="RaceTrackUTubeVolume"/></volume > EOF print RACETRACK<< EOF;<!--+++++++++++++++++RACETRACK Top Volume++++++++++++++++++++-->< volumename="volRaceTrackTVolume">< materialrefref="LAr"/>< solidrefref="RaceTrackTVolume"/> EOF $xTpos
process_name opflash particleana ie ie y
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
then if echo $newprj grep q dirt
print PMT<< EOF;<?xml version='1.0'?>< gdml > EOF print PMT<< EOF;<!--+++++++++++++++++++PMT Solids++++++++++++++++++++++--> EOF print PMT<< EOF;< solids >< spherename="PMTVolume"rmin="$PMTradiusInner"rmax="$PMTradiusOuter"deltaphi="360"deltatheta="90"aunit="deg"lunit="cm"/>< spherename="PMTPassSphere"rmin="$PMTradiusInner"rmax="$PMTradiusOuter"deltaphi="360"deltatheta="90"aunit="deg"lunit="cm"/>< tubename="PMTPassTube"rmax="$PMTtubeRmax"rmin="$PMTtubeRmin"z="$PMTtube_x"deltaphi="360"aunit="deg"lunit="cm"/>< unionname="PMTPassVolume">< firstref="PMTPassSphere"/>< secondref="PMTPassTube"/>< positionrefref="PMTtube"/>< rotationrefref="rMinus90AboutZ"/></union ></solids > EOF print PMT<< EOF;< structure ><!--+++++++++++++++++PMTLogicalVolumes++++++++++++++++++++-->< volumename="volOpDetSensitive">< materialrefref="LAr"/>< solidrefref="PMTVolume"/></volume >< volumename="volNotOpDetSensitive">< materialrefref="Glass"/>< solidrefref="PMTPassVolume"/></volume ></structure > EOF print PMT<< EOF;</gdml > EOF sub gen_Mech_Structure
for($it=0;$it< $RaceTrack_number;$it++)
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker see the discussion of warn common echo in *Note Linker such as a global int variable echo as opposed to a large global array echo echo I echo The symbol is an indirect reference to another symbol This echo is a GNU extension to the a out object file format which is echo rarely used echo echo N echo The symbol is a debugging symbol echo echo R echo The symbol is in a read only data section echo echo S echo The symbol is in an uninitialized data section for small echo objects echo echo T echo The symbol is in the the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo W echo The symbol is a weak symbol that has not been specifically echo tagged as a weak object symbol When a weak defined symbol echo is linked with a normal defined the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo echo The symbol is a stabs symbol in an a out object file In echo this the next values printed are the stabs other echo the stabs desc and the stab type Stabs symbols are echo used to hold debugging information For more information
print RACETRACK<< EOF;</volume > EOF print RACETRACK<< EOF;<!--+++++++++++++++++RACETRACK end structure+++++++++++++++++++--></structure > EOF print RACETRACK<< EOF;</gdml > EOF sub gen_PMT
BEGIN_PROLOG Z planes
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker see the discussion of warn common echo in *Note Linker such as a global int variable echo as opposed to a large global array echo echo I echo The symbol is an indirect reference to another symbol This echo is a GNU extension to the a out object file format which is echo rarely used echo echo N echo The symbol is a debugging symbol echo echo R echo The symbol is in a read only data section echo echo S echo The symbol is in an uninitialized data section for small echo objects echo echo T echo The symbol is in the the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not defined
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
write_fragments()
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
walls no wall
Definition: selectors.fcl:105
do echo $i
Definition: TrainMVA.sh:30
then echo fcl name
temporary value
print OUTPUT<< EOF;< setup name="Default"version="1.0">< worldref="volWorld"/></setup ></gdml > EOF close(OUTPUT)
process_name crt
list
Definition: file_to_url.sh:28
push(@gdmlFiles, $RACETRACK)
std::string sub(const std::string &a, const std::string &b)
Definition: TruthText.cxx:100
open(RACETRACK) or die("Could not open file $RACETRACK for writing")