3 # Much of this program is taken straight from generate_gdml.pl that
4 # generates MicroBooNE fragment files (Thank you.)
6 # Each subroutine generates a fragment GDML file, and the last subroutine
7 # creates an XML file that make_gdml.pl will use to appropriately arrange
8 # the fragment GDML files to create the final desired DUNE GDML file,
9 # to be named by make_gdml output command
11 # If you are playing with different geometries, you can use the
12 # suffix command to help organize your work.
21 Math::BigFloat->precision(-15);
23 GetOptions( "help|h" => \$help,
24 "suffix|s:s" => \$suffix,
25 "output|o:s" => \$output,
26 "wires|w:s" => \$wires,
27 "helpcube|c" => \$helpcube);
31 # If the user requested help, print the usage notes and exit.
36 if ( ! defined $suffix )
38 # The user didn't supply a suffix, so append nothing to the file
44 # Otherwise, stick a "-" before the suffix, so that a suffix of
45 # "test" applied to filename.gdml becomes "filename-test.gdml".
46 $suffix = "-" . $suffix;
52 #++++++++++++++++++++++++ Begin defining variables +++++++++++++++++++++++++
54 # Define detector geometry variables - later to be put in a parameters
55 # XML file to be parsed as an input?
57 # set wires on to be the default, unless given an input by the user
58 $wires_on = 1; # 1=on, 0=off
69 #################################################
70 #### 4APA 35t parameters from DocDb 7550 ####
71 #################################################
75 ##################################################################
76 ##################### wire plane parameters ######################
79 $UVReadoutBoardPitch = 0.698516;
80 #$UVReadoutBoardPitch = 0.7;
100 $UWirePitch = $UVReadoutBoardPitch*cos(deg2rad($UAng[0]));
101 $VWirePitch = $UVReadoutBoardPitch*cos(deg2rad($VAng[0]));
102 $XWirePitch = 0.449055;
105 ##################################################################
106 ######################## TPC parameters ##########################
108 $G10thickness = 0.3155;
110 #$G10thickness = $inch/8;
111 #$WrapCover = $inch/16;
115 $APAFrame_x = 5.0661; # ~2in -- this does not include the wire spacing
117 $TPCWireThickness = 0.015;
118 $TPCWirePlaneThickness = $TPCWireThickness;
119 $APAWirePlaneSpacing = 0.4730488 + $TPCWirePlaneThickness; # center to center spacing between all of the wire planes (g, u, v, and x)
121 # At creation of the plane volumes, the y and z boundaries will be increased
122 # by this much at each of the 4 edges. this is so the corners of the wire
123 # tubes don't extrude. For all other purposes, the plane dimensions stay as originally defined
124 $UVPlaneBoundNudge = $TPCWireThickness;
126 # The following are all widths about the same z center,
127 # namely the center of the corresponding APA
128 #$Zactive_z = 49.8441 + $TPCWireThickness;
129 $Zactive_z = 112*$XWirePitch + $TPCWireThickness;
130 $APAFrame_z = 50.2619;
131 #$Vactive_z = 50.8929 - 2*$G10thickness;
132 #$Uactive_z = 51.5240 - 2*$G10thickness;
133 $Vactive_z = $APAFrame_z;
134 $Uactive_z = $APAFrame_z + 2*$G10thickness;
135 $APAphys_z = 51.8395;
138 # NUMBER VERTICAL WIRES = (Zview_z / pitch) + 1
139 # Since Zview_z is defined in docdb 7550 to be distance
140 # between outer vertical wires, + 1 since the floor of this
141 # division will be one under, giveing the amt of spaces, not wires
142 # POSITIONING: plane centered between +/- APAActive_z/2
144 # Let APAs be numbered as follows
146 # 1 - Middle (Middle Top)
147 # 2 - Smallest (Middle Bottom)
148 # APA heights and positions will be indexed by APA number
150 $APAFrame_y[0] = 203.06;
151 $APAFrame_y[1] = 119.29;
152 $APAFrame_y[2] = 91.37;
153 $APAFrame_y[3] = $APAFrame_y[0];
155 # the physical assembply includes 4 boards to anchor Grid, U, V, and Z, then a cover
156 for($apa = 0; $apa < 4; ++$apa){
157 $APAphys_y[$apa] = $APAFrame_y[$apa] + 4*$G10thickness + $WrapCover;
160 # The field cage dictates the boundaries of the active volumes.
161 $ReadoutBoardOverlap = 7.61; #board overlaps wires, chop this off of their active height
162 $OuterWireToCage = 2.33;
163 $TopAPAToCage = -5.6647; # negative because the cage is actually lower than the APA frame
164 $BottomTallAPAToCage = 0.673;
165 $BottomShortAPAToCage = $BottomTallAPAToCage
166 - ($APAphys_y[1] + $APAGap_y + $APAphys_y[2] - $APAphys_y[0]); # also negative
168 for($apa = 0; $apa < 4; ++$apa){
170 $overlap = $ReadoutBoardOverlap;
172 # the smallest bottom APA wire planes extrude ~1cm past the field cage
173 # before being overlapped by the readout board. For the purposes of the
174 # LArSoft Geometry interface, we want to end the wires at the edge of the
175 # active volume, or rather the edge of the cage.
176 if($apa==2){ $overlap = -$BottomShortAPAToCage + $UVPlaneBoundNudge; }
177 # negative sign so overlap is positive
179 # each view has its own G10 board to wrap around at the bottom
180 # and is covered by the readout board at the top
181 $Zactive_y[$apa] = $APAFrame_y[$apa] + 0*$G10thickness - $overlap;
182 $Vactive_y[$apa] = $APAFrame_y[$apa] + 1*$G10thickness - $overlap;
183 $Uactive_y[$apa] = $APAFrame_y[$apa] + 2*$G10thickness - $overlap;
188 $APAGap_y = 0.0845; #separation between APAs along the incident beam axis
189 $APAGap_z = 0.0845; #separation between APAs along the vertical axis
192 # include APA spacing in y and z so volTPCs touch in y and z directions with correct APA
193 # spacing - this makes for smoother event generation.
195 $TPCLongDrift_x = $LongDrift + 3*$APAWirePlaneSpacing + $TPCWirePlaneThickness;
196 $TPCShortDrift_x = $ShortDrift + 3*$APAWirePlaneSpacing + $TPCWirePlaneThickness;
200 ############################################################
201 #################### AuxDet parameters #####################
203 $AuxDetHousingHeight = 27.72*$inch;
204 $AuxDetHousingLongSide = 13.07*$inch;
205 $AuxDetHousingShortSide = 10.64*$inch;
206 $AuxDetHousingThickness = 3;
207 $AuxDetScintillatorHeight = 24.80*$inch;
208 $AuxDetScintillatorLongSide = 12.82*$inch;
209 $AuxDetScintillatorShortSide = 10.65*$inch;
210 $AuxDetScintillatorThickness = 0.95;
212 # email from Michelle:
213 # the housing (AL box) is 13.07/10.64 x 27.72 (inches)
214 # the actual scintillator is 12.82/10.65 x 24.80 (inches)
217 # AuxDet configuration:
219 # / \ _______ / \ _______ } This spacing is only in the housing,
220 # / \\ // \\ / so it is not implimented in AuDet
221 #/______\\ //______\\ / which only represents the scintillator
225 # email from Michelle:
226 # Assume that the telescope scintillator is a rectangle, 64 3/4" x 6 5/8" x 3/4".
228 $AuxDetBSUScintWidth = (6+5/8)*$inch;
229 $AuxDetBSUScintHeight = 0.75*$inch;
230 $AuxDetBSUScintLength = 64.75*$inch;
233 # these positions pulled from a coordinate system with positive x and z are reversed
234 # positions are from a particular corner of the scintillators
235 ############################
236 ############################
237 @BSULayer1_xpos = ( 16.21, 9.46, 2.71, -4.04,
238 -17.33, -24.08, -30.83, -37.58,
239 -44.33, -51.08, -57.83, -64.58, -71.33 );
240 for($i = 0; $i < 13; ++$i){
241 $BSULayer1_xpos[$i] *= -$inch; # negative reverses coordinate system back
242 $BSULayer1_xpos[$i] -= $AuxDetBSUScintWidth/2; # move to center of volume
244 $BSULayer1_ypos = 75.14*$inch;
245 $BSULayer1_zpos = -1.21*$inch;
246 $BSULayer1_zpos = -1*$BSULayer1_zpos + $AuxDetBSUScintLength/2; # correct coordinates and move to center of scint
247 ############################
248 ############################
249 $BSULayer2_xpos = -67.24*$inch;
250 $BSULayer2_xpos = -1*$BSULayer2_xpos - $AuxDetBSUScintLength/2;
251 $BSULayer2_ypos = 89.49*$inch;
252 #@BSULayer2_zpos = ( -0.56, -7.31, -18.84, -25.59,
253 # -32.34, -39.09, -45.84, -52.59, -59.34 );
254 # assume pitch of 6.75:
255 @BSULayer2_zpos = ( 6.19, -0.56, -7.31, -18.84, -25.59,
256 -32.34, -39.09, -45.84, -52.59, -59.34 );
257 for($i = 0; $i < 10; ++$i){
258 $BSULayer2_zpos[$i] *= -$inch;
259 $BSULayer2_zpos[$i] -= $AuxDetBSUScintWidth/2;
261 ############################
262 ############################
263 @BSULayer3_xpos = ( 16.21, 9.46, 2.71, -4.04,
264 -10.79, -17.54, -24.29, -31.04,
265 -37.79, -44.54, -51.29, -58.04,
266 -64.79, -71.54, -78.29, -85.04 );
267 for($i = 0; $i < 16; ++$i){
268 $BSULayer3_xpos[$i] *= -$inch;
269 $BSULayer3_xpos[$i] -= $AuxDetBSUScintWidth/2;
271 $BSULayer3_ypos = 306.55*$inch;
272 $BSULayer3_zpos = -1.21*$inch;
273 $BSULayer3_zpos = -1*$BSULayer3_zpos + $AuxDetBSUScintLength/2;
274 ############################
275 ############################
276 $BSULayer4_xpos = -67.24*$inch;
277 $BSULayer4_xpos = -1*$BSULayer4_xpos - $AuxDetBSUScintLength/2;
278 $BSULayer4_ypos = 310.80*$inch;
279 @BSULayer4_zpos = ( 1.42, -5.34, -12.09, -18.84,
280 -25.59, -32.34, -39.09, -45.84,
282 for($i = 0; $i < 10; ++$i){
283 $BSULayer4_zpos[$i] *= -$inch;
284 $BSULayer4_zpos[$i] -= $AuxDetBSUScintWidth/2;
286 ############################
287 ## Layer 5 is not included in the final gdml
288 ############################
289 @BSULayer5_xpos = ( 16.21, 9.46, 2.71, -4.04,
290 -10.79, -17.54, -24.29, -31.04,
291 -37.79, -44.54, -51.29, -58.04,
292 -64.79, -71.54, -78.29, -85.04 );
293 for($i = 0; $i < 16; ++$i){
294 $BSULayer5_xpos[$i] *= -$inch;
295 $BSULayer5_xpos[$i] -= $AuxDetBSUScintWidth/2;
297 $BSULayer5_ypos = 314.55*$inch;
298 $BSULayer5_zpos = -1.21*$inch;
299 $BSULayer5_zpos = -1*$BSULayer5_zpos + $AuxDetBSUScintLength/2;
303 ############################################################
304 ############### Optical Detector parameters ################
306 # TODO: while the structure is exactly what we need, the parameters for
307 # paddle height and positioning are all placeholders
309 $nPaddlesInAPA[0] = 3;
310 $nPaddlesInAPA[1] = 1;
311 $nPaddlesInAPA[2] = 1;
312 $nPaddlesInAPA[3] = $nPaddlesInAPA[0]; # for now, this one is the same as 0
315 $LightPaddle_x = 0.476;
316 $LightPaddle_y = 56; # in cm from docDb 7803
317 $LightPaddle_z = 4*$inch;
319 # z and x are given by APA frame center.
320 # Hardcode y distance of each paddle from the
321 # bottom of the APA to the paddle y-center.
322 # To be used in make_APA like [apa#][paddle#]
324 $PaddleYPositions[0][0] = $APAFrame_y[0]/2; # this puts it in the y center
325 $PaddleYPositions[1][0] = $APAFrame_y[1] - 4*$inch - $LightPaddle_y/2;
326 $PaddleYPositions[2][0] = $APAFrame_y[2] - 4*$inch - $LightPaddle_y/2;
327 $PaddleYPositions[3][0] = $PaddleYPositions[0][0];
329 $PaddleYPositions[0][1] = $APAFrame_y[0] - 4*$inch - $LightPaddle_y/2;
330 $PaddleYPositions[3][1] = $PaddleYPositions[0][1];
332 $PaddleYPositions[0][2] = 4*$inch + $LightPaddle_y/2;
333 $PaddleYPositions[3][2] = $PaddleYPositions[0][2];
337 ##################################################################
338 ###################### Cryostat parameters #######################
341 $HeightGaseousAr = 14;
342 $FloorToSmallAPAFrame = 22.432;
343 $APAToTopCryo = 34.441;
344 $ClosestAPAToEastWall = 33.225; # To G10 cover, places all of the APAs in z
347 # Drift __________ Drift
350 # South | | | North Wall
355 $CPAToFloor = 26.955;
356 $CPAToCeiling = 36.010;
357 $CPAToEastWall = 27.994;
358 $CPAToWestWall = 76.234;
359 $CPAToSouthWall = 121.945;
360 $CPAToNorthWall = 22.907;
368 $CPATubeYSide_CenterToCenter = 166.269; # length in *z* direction
369 $CPATubeZSide_CenterToCenter = 207.532; # height in *y* direction
372 $Cathode_y = $CPATubeZSide_CenterToCenter - $CPATube_OD;
373 $Cathode_z = $CPATubeYSide_CenterToCenter - $CPATube_OD;
375 # Liquid and Gaseous Argon dimensions
376 $Argon_x = $TPCShortDrift_x
380 + $CPAToSouthWall + $CPATube_OD;
381 # note that the height y includes liquid and gaseous argon
382 $Argon_y = $APAphys_y[1]
386 + $FloorToSmallAPAFrame; # assuming mid_y+smallest_y > largest_y
388 $Argon_z = $CPATubeYSide_CenterToCenter
393 # try hardcoding parameters now that placements/dimensions are more accurate
394 # inside cryostat parameters
401 # Cryostat Dimensions
402 $SteelShellThickness = 0.5*$inch;
404 $Cryostat_x = $Argon_x; # move the steel shell out of volCryostat
405 $Cryostat_y = $Argon_y;
406 $Cryostat_z = $Argon_z;
410 ##################################################################
411 ################# Detector Enclosure parameters ##################
414 # Around the cryostat
415 $ConcretePadding = 30;
416 $FoamPadding = 39.75148;
417 $TotalPadding = $ConcretePadding + $FoamPadding;
418 $CryoWithPadding_x = $Argon_x + 2*$SteelShellThickness + 2*$TotalPadding;
419 $CryoWithPadding_y_noneck = $Argon_y + 2*$SteelShellThickness + 2*$FoamPadding + $ConcretePadding;
420 $CryoWithPadding_y_neck = ($Argon_y + $NeckInside_y) + 2*$SteelShellThickness + $TotalPadding;
421 $CryoWithPadding_z = $Argon_z + 2*$SteelShellThickness + 2*$TotalPadding;
423 print "CryoWithPadding: x=$CryoWithPadding_x, y=$CryoWithPadding_y_noneck ($CryoWithPadding_y_neck), z=$CryoWithPadding_z\n";
424 print "Cryo: x=$Argon_x, y=$Argon_y (+$NeckInside_y), z=$Argon_z\n";
427 # The actual enclosure
428 $TrenchLength = 9*$CryoWithPadding_x; # make this a reasonable length, still guessing
429 # quick measurments by Michelle Stancari, definitely good enough for now
430 $TrenchWallThickness = 14*$inch;
431 $WalkwayWidth = 34.5*$inch;
432 $EastWallToTrench = 10*$inch;
433 $PlateAToGroundLevel = 50*$inch;
436 # Bird's eye view of trench, walkway is on the west side
443 # | W|______||E +z <---| (+y out of screen)
451 # the container volume dimensions
452 $DetEnc_x = $TrenchLength;
453 $DetEnc_y = $TrenchWallThickness # use this for thickness of floor too
454 + $CryoWithPadding_y_noneck
455 + $PlateAToGroundLevel; # Make ground level the top of the DetEnc
456 $DetEnc_z = $CryoWithPadding_z
457 + $WalkwayWidth + $EastWallToTrench
458 + 2*$TrenchWallThickness;
461 $posCryoInDetEnc_x = 0;
462 $posCryoInDetEnc_y = - $DetEnc_y/2 + $TrenchWallThickness + $TotalPadding + $SteelShellThickness + $Argon_y/2;
463 $posCryoInDetEnc_z = - $DetEnc_z/2 + $TrenchWallThickness + $EastWallToTrench + $CryoWithPadding_z/2;
469 if (defined $helpcube)
471 $PosDirCubeSide = $ArToAr; #seems to be a good proportion
475 # The world dimensions are critical in the CRY cosmics generator
476 # following uboone's lead, make world much larger
477 # the cry helper needs a lot of room
480 $World_x = 5*$DetEnc_x;
481 $World_y = 25*$DetEnc_y;
482 $World_z = 25*$DetEnc_z;
484 $BermRadius = 5*12*$inch;
490 ##################################################################
491 ######################### TPC positions ##########################
494 $APA_Xcenter = $Argon_x/2
495 - $CPAToSouthWall # to center CPATube
500 # 0: One of the 2 identical tall APAs (Largest), call it the "upstream" one
501 $APACenter[0][0] = $APA_Xcenter;
502 $APACenter[0][1] = $Argon_y/2
503 - $APAToTopCryo # This subsumes the half vertical gap on the top...
504 - $APAphys_y[0]/2; # ... so use APAphys_y instead of TPC_y
505 $APACenter[0][2] = - $Argon_z/2
506 + $ClosestAPAToEastWall # ..Similarly, this already steps into the APAGap_z/2
510 # 1: The top middle APA (Mid)
511 $APACenter[1][0] = $APA_Xcenter;
512 $APACenter[1][1] = $Argon_y/2
515 $APACenter[1][2] = $APACenter[0][2]
516 + $APAphys_z + $APAGap_z;
518 # 2: The bottom middle APA (Smallest)
519 $APACenter[2][0] = $APA_Xcenter;
520 $APACenter[2][1] = $APACenter[1][1] # place relative to APA above it
524 $APACenter[2][2] = $APACenter[0][2]
525 + $APAphys_z + $APAGap_z;
527 # 3: The other tall APA, call it the "downstream" one
528 $APACenter[3][0] = $APACenter[0][0];
529 $APACenter[3][1] = $APACenter[0][1];
530 $APACenter[3][2] = $APACenter[1][2]
531 + $APAphys_z + $APAGap_z;
533 $posTPCShortDrift_x = $APACenter[0][0]
535 - $TPCShortDrift_x/2;
537 $posTPCLongDrift_x = $APACenter[0][0]
544 # We want the active volumes to extend all the way to the field cage
545 # so that LArG4 tracks everything inside the cage.
546 $TPCActive_z[0] = $APAphys_z
547 - ($APAphys_z-$Zactive_z)/2
550 $TPCActive_z[1] = $APAphys_z + $APAGap_z;
551 $TPCActive_z[2] = $APAphys_z + $APAGap_z;
552 $TPCActive_z[3] = $TPCActive_z[0];
555 $TPCActive_y[0] = $APAphys_y[0]
557 + $BottomTallAPAToCage;
558 $TPCActive_y[1] = $APAphys_y[1]
561 $TPCActive_y[2] = $APAphys_y[2]
563 + $BottomShortAPAToCage
564 + $UVPlaneBoundNudge; # Without this relatively negligible addition, the nudge
565 # further downstream on the plane causes the planes to extrude
566 # the TPC volume, whose height is TPCActive_y.
567 # The plane nudge is to avoid many overlaps between the wire
568 # corners and the plane boundaries.
569 $TPCActive_y[3] = $TPCActive_y[0];
574 $TPCCenter[0][2] = $APACenter[0][2]
578 $TPCCenter[1][2] = $APACenter[1][2];
579 $TPCCenter[2][2] = $APACenter[2][2];
580 $TPCCenter[3][2] = $APACenter[3][2]
587 $TPCCenter[0][1] = $APACenter[0][1]
589 - $BottomTallAPAToCage
591 $TPCCenter[1][1] = $APACenter[1][1]
595 $TPCCenter[2][1] = $APACenter[2][1]
597 - $BottomShortAPAToCage
599 $TPCCenter[3][1] = $TPCCenter[0][1];
605 # We want the world origin to be at the very front of the fiducial volume.
606 # move it to the front of the enclosure, then back it up through the concrete/foam,
607 # then through the Cryostat shell, then through the upstream dead LAr (including the
608 # dead LAr on the edge of the TPC, but this is covered in $UpstreamLArPadding).
609 # This is to be added to the z position of every volume in volWorld
613 + $TrenchWallThickness
616 + $SteelShellThickness
617 + $Argon_z/2 # at this point, we are at the center of the cryostat...
618 - $APACenter[0][2] # ... and now at the center of the East-most APA
621 # We want the world origin to be vertically centered between the two stacked APAs.
622 # (for now, that is, so the sorting works. this is quite asymetric, but then again
623 # so is the entire 35t geometry. this may be kept.)
624 # the cryostat sits on top of concrete padding, move the detector enclosure back
625 # and then move the world origin to the bottom of the smallest/lowest TPC, then
626 # and then up through the TPC, then back up to being centered between the stacked APAs.
627 # This is to be added to the y/x position of every volume in volWorld
631 - $TrenchWallThickness
633 - $SteelShellThickness
642 #$OriginXSet = $DetEnc_x/2
644 # - $SteelShellThickness
647 # - $ShortDrift ... through APA frame
650 - $CryoWithPadding_x/2
652 + $SteelShellThickness
653 + $Argon_x/2 # at this point, we are at the center of the cryostat...
654 - $APA_Xcenter # ... and now at the APA's center x coordinate
656 - 3*$APAWirePlaneSpacing
657 - $TPCWirePlaneThickness;
662 ## Correct Telescope Aux Det vertical position if necessary
664 if( $posCryoInDetEnc_y
666 + $SteelShellThickness
668 + $AuxDetBSUScintHeight/2 > $BSULayer1_ypos - $OriginYSet ){
670 $nudge_y = ( $posCryoInDetEnc_y
672 + $SteelShellThickness
674 + $AuxDetBSUScintHeight/2
675 + $OriginYSet ) - $BSULayer1_ypos;
677 print "--- NOTE: nudging telescope counters $nudge_y cm up to sit on top of GDML cryostat\n";
679 $BSULayer1_ypos += $nudge_y;
680 $BSULayer2_ypos += $nudge_y;
681 $BSULayer3_ypos += $nudge_y;
682 $BSULayer4_ypos += $nudge_y;
683 $BSULayer5_ypos += $nudge_y;
689 ##################################################################
690 ######################### CPA positions ##########################
693 # Drift __________ Drift
696 # South | | | North Wall
701 #$posCPAShortDrift_x = - $Argon_x/2 + $CPAToNorthWall + $CPATube_OD/2;
702 #$posCPALongDrift_x = $Argon_x/2 - $CPAToSouthWall - $CPATube_OD/2;
704 # ^^^ these would be ideal, but quick fix to check in
705 # v3 without overlaps:
707 #$posCPAShortDrift_x = - $Argon_x/2 + $CPAToNorthWall + $CPATube_OD/2;
708 #$posCPALongDrift_x = $Argon_x/2 - $CPAToSouthWall - $CPATube_OD/2;
709 $posCPAShortDrift_x = $posTPCShortDrift_x - $TPCShortDrift_x/2
710 - $CPATube_OD; #<-- temp overlap fix
711 $posCPALongDrift_x = $posTPCLongDrift_x + $TPCLongDrift_x/2
712 + $CPATube_OD; #<-- temp overlap fix
715 $posCPAShortDrift_y = - $Argon_y/2 + $CPAToFloor
716 + ($CPATubeZSide_CenterToCenter + $CPATube_OD)/2;
717 $posCPAShortDrift_z = - $Argon_z/2 + $CPAToEastWall
718 + ($CPATubeYSide_CenterToCenter + $CPATube_OD)/2;
720 $posCPALongDrift_y = $posCPAShortDrift_y;
721 $posCPALongDrift_z = $posCPAShortDrift_z;
727 ##################################################################
728 #################### Bar Fiber Module numbers ####################
729 $numberofbarmodules=4;
730 $numberoffibermodules=3;
731 $numberofplankmodules=1;
733 $PaddleCenterX=$APA_Xcenter;
734 $PaddleCenterY[0][0]=$APACenter[0][1]-$APAFrame_y[0]/2+ $PaddleYPositions[0][0];
735 $PaddleCenterY[0][1]=$APACenter[0][1]-$APAFrame_y[0]/2+ $PaddleYPositions[0][1];
736 $PaddleCenterY[0][2]=$APACenter[0][1]-$APAFrame_y[0]/2+ $PaddleYPositions[0][2];
737 $PaddleCenterY[1][0]=$APACenter[1][1]-$APAFrame_y[1]/2+ $PaddleYPositions[1][0];
738 $PaddleCenterY[2][0]=$APACenter[2][1]-$APAFrame_y[2]/2+ $PaddleYPositions[2][0];
739 $PaddleCenterY[3][0]=$PaddleCenterY[0][0];
740 $PaddleCenterY[3][1]=$PaddleCenterY[0][1];
741 $PaddleCenterY[3][2]=$PaddleCenterY[0][2];
742 $PaddleCenterZ[0]=$APACenter[0][2];
743 $PaddleCenterZ[1]=$APACenter[1][2];
744 $PaddleCenterZ[2]=$APACenter[2][2];
745 $PaddleCenterZ[3]=$APACenter[3][2];
748 #+++++++++++++++++++++++++ End defining variables ++++++++++++++++++++++++++
752 # run the sub routines that generate the fragments
754 gen_Define(); # generates definitions at beginning of GDML
755 gen_Materials(); # generates materials to be used
758 # gen_TPC( x dimension, y, z, string appended to TPC for name, APA number)
759 # generate the short drift and long drift sides of the APA as seperate TPCs
761 open(my $wout, '>', 'gdmlWireCenters.txt');
763 gen_TPC( $TPCLongDrift_x, $TPCActive_y[0], $TPCActive_z[0], 'LargestLongDriftUpstream', 0);
764 gen_TPC( $TPCShortDrift_x, $TPCActive_y[0], $TPCActive_z[0], 'LargestShortDriftUpstream', 0);
766 gen_TPC( $TPCLongDrift_x, $TPCActive_y[2], $TPCActive_z[2], 'SmallestLongDrift', 2);
767 gen_TPC( $TPCShortDrift_x, $TPCActive_y[2], $TPCActive_z[2], 'SmallestShortDrift', 2);
769 gen_TPC( $TPCLongDrift_x, $TPCActive_y[1], $TPCActive_z[1], 'MidLongDrift', 1);
770 gen_TPC( $TPCShortDrift_x, $TPCActive_y[1], $TPCActive_z[1], 'MidShortDrift', 1);
772 gen_TPC( $TPCLongDrift_x, $TPCActive_y[0], $TPCActive_z[3], 'LargestLongDriftDownstream', 3);
773 gen_TPC( $TPCShortDrift_x, $TPCActive_y[0], $TPCActive_z[3], 'LargestShortDriftDownstream', 3);
782 write_fragments(); # writes the XML input for make_gdml.pl
783 # which zips together the final GDML
787 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
788 #+++++++++++++++++++++++++++++++++++++++++ usage +++++++++++++++++++++++++++++++++++++++++
789 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
793 print "Usage: $0 [-h|--help] [-o|--output <fragments-file>] [-s|--suffix <string>]\n";
794 print " if -o is omitted, output goes to STDOUT; <fragments-file> is input to make_gdml.pl\n";
795 print " -s <string> appends the string to the file names; useful for multiple detector versions\n";
796 print " -h prints this message, then quits\n";
801 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
802 #++++++++++++++++++++++++++++++++++++++ gen_Define +++++++++++++++++++++++++++++++++++++++
803 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
808 # Create the <define> fragment file name,
809 # add file to list of fragments,
811 $DEF = "dune_10kT_Def" . $suffix . ".gdml";
812 push (@gdmlFiles, $DEF);
814 open(DEF) or die("Could not open file $DEF for writing");
818 <?xml version='1.0'?>
828 <position name="posOriginSet" unit="cm" x="$OriginXSet" y="$OriginYSet" z="$OriginZSet"/>
830 <position name="posTPCLargestShortDrift_Pos" unit="cm" x="$posTPCShortDrift_x" y="$TPCCenter[3][1]" z="$TPCCenter[3][2]"/>
831 <position name="posTPCLargestLongDrift_Pos" unit="cm" x="$posTPCLongDrift_x" y="$TPCCenter[3][1]" z="$TPCCenter[3][2]"/>
832 <position name="posTPCLargestShortDrift_Neg" unit="cm" x="$posTPCShortDrift_x" y="$TPCCenter[0][1]" z="$TPCCenter[0][2]"/>
833 <position name="posTPCLargestLongDrift_Neg" unit="cm" x="$posTPCLongDrift_x" y="$TPCCenter[0][1]" z="$TPCCenter[0][2]"/>
834 <position name="posTPCSmallestShortDrift" unit="cm" x="$posTPCShortDrift_x" y="$TPCCenter[2][1]" z="$TPCCenter[2][2]"/>
835 <position name="posTPCSmallestLongDrift" unit="cm" x="$posTPCLongDrift_x" y="$TPCCenter[2][1]" z="$TPCCenter[2][2]"/>
836 <position name="posTPCMidShortDrift" unit="cm" x="$posTPCShortDrift_x" y="$TPCCenter[1][1]" z="$TPCCenter[1][2]"/>
837 <position name="posTPCMidLongDrift" unit="cm" x="$posTPCLongDrift_x" y="$TPCCenter[1][1]" z="$TPCCenter[1][2]"/>
840 <position name="posCathodeLongDrift" unit="cm" x="$posCPAShortDrift_x" y="$posCPAShortDrift_y" z="$posCPAShortDrift_z"/>
841 <position name="posCathodeShortDrift" unit="cm" x="$posCPALongDrift_x" y="$posCPALongDrift_y" z="$posCPALongDrift_z"/>
843 <rotation name="rAuxDetNSWallUp" unit="deg" x="90" y="0" z="90"/>
844 <rotation name="rAuxDetNSWallDown" unit="deg" x="270" y="0" z="90"/>
845 <rotation name="rAuxDetEWWallUp" unit="deg" x="90" y="0" z="0"/>
846 <rotation name="rAuxDetEWWallDown" unit="deg" x="270" y="0" z="0"/>
848 <position name="posCenter" unit="cm" x="0" y="0" z="0"/>
849 <rotation name="rPlus90AboutX" unit="deg" x="90" y="0" z="0"/>
850 <rotation name="rPlus90AboutY" unit="deg" x="0" y="90" z="0"/>
851 <rotation name="rMinus90AboutY" unit="deg" x="0" y="270" z="0"/>
852 <rotation name="rMinus90AboutYMinus90AboutX" unit="deg" x="270" y="270" z="0"/>
853 <rotation name="rPlus180AboutY" unit="deg" x="0" y="180" z="0"/>
854 <rotation name="rPlus180AboutX" unit="deg" x="180" y="0" z="0"/>
855 <rotation name="rPlus180AboutXandY" unit="deg" x="180" y="180" z="0"/>
856 <rotation name="rIdentity" unit="deg" x="0" y="0" z="0"/>
859 ##################################################################
860 ###################### Bar Module Position #######################
861 for ($k=1; $k<$numberofbarmodules+1; ++$k)
863 if($k==1) {$APA_i=1;$p=0;$PD_zoffset=0;}
864 elsif($k==2) {$APA_i=0;$p=1;$PD_zoffset=0;}
865 elsif($k==3) {$APA_i=0;$p=2;$PD_zoffset=-0.00051;}
866 elsif($k==4) {$APA_i=3;$p=0;$PD_zoffset=0;}
868 #for ($j=1; $j<$numberofbars+1; ++$j)
870 #$bar_z=-4.11 + 2.74*($j-1)+$PaddleCenterZ[$APA_i];
871 $bar_z=$PaddleCenterZ[$APA_i]+2.794*1.5+$PD_zoffset;
872 $bar_name="Bar" . $k . "Pos";
874 <position name="$bar_name" x="$PaddleCenterX" y="$PaddleCenterY[$APA_i][$p]" z="$bar_z" unit="cm"/>
879 ##################################################################
880 ##################### Plank Module Position ######################
881 for ($k=1; $k<$numberofplankmodules+1; ++$k)
883 if($k==1) {$APA_i=3;$p=2;}
885 $plank_name="PlankPos";
887 <position name="$plank_name" x="$PaddleCenterX" y="$PaddleCenterY[$APA_i][$p]" z="$PaddleCenterZ[$APA_i]" unit="cm"/>
891 ##################################################################
892 ##################### Fiber Module Position ######################
894 for ($k=1; $k<$numberoffibermodules+1; ++$k)
896 if($k==1) {$APA_i=2;$p=0;$PD_zoffset=0;}
897 elsif($k==2) {$APA_i=0;$p=0;$PD_zoffset=0;}
898 elsif($k==3) {$APA_i=3;$p=1;$PD_zoffset=0.00051;}
900 $fiber_x=$PaddleCenterX+0.1445;
901 $fiber_y=$PaddleCenterY[$APA_i][$p];
902 $fiber_z=$PaddleCenterZ[$APA_i]+4.1905+$PD_zoffset;
904 $fiber_name="Fiber" . $k. "Pos";
906 <position name="$fiber_name" x="$fiber_x" y="$fiber_y" z="$fiber_z" unit="cm"/>
921 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
922 #+++++++++++++++++++++++++++++++++++++ gen_Materials +++++++++++++++++++++++++++++++++++++
923 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
928 # Create the <materials> fragment file name,
929 # add file to list of output GDML fragments,
931 $MAT = "dune_10kT_Materials" . $suffix . ".gdml";
932 push (@gdmlFiles, $MAT);
934 open(MAT) or die("Could not open file $MAT for writing");
939 <element name="videRef" formula="VACUUM" Z="1"> <atom value="1"/> </element>
940 <element name="hydrogen" formula="H" Z="1"> <atom value="1.0079"/> </element>
941 <element name="beryllium" formula="Be" Z="4"> <atom value="9.0121831"/> </element>
942 <element name="carbon" formula="C" Z="6"> <atom value="12.0107"/> </element>
943 <element name="nitrogen" formula="N" Z="7"> <atom value="14.0067"/> </element>
944 <element name="oxygen" formula="O" Z="8"> <atom value="15.999"/> </element>
945 <element name="sodium" formula="Na" Z="11"> <atom value="22.99"/> </element>
946 <element name="magnesium" formula="Mg" Z="12"> <atom value="24.305"/> </element>
947 <element name="aluminum" formula="Al" Z="13"> <atom value="26.9815"/> </element>
948 <element name="silicon" formula="Si" Z="14"> <atom value="28.0855"/> </element>
949 <element name="phosphorus" formula="P" Z="15"> <atom value="30.973"/> </element>
950 <element name="sulphur" formula="S" Z="16"> <atom value="32.065"/> </element>
951 <element name="argon" formula="Ar" Z="18"> <atom value="39.9480"/> </element>
952 <element name="potassium" formula="K" Z="19"> <atom value="39.0983"/> </element>
953 <element name="calcium" formula="Ca" Z="20"> <atom value="40.078"/> </element>
954 <element name="titanium" formula="Ti" Z="22"> <atom value="47.867"/> </element>
955 <element name="chromium" formula="Cr" Z="24"> <atom value="51.9961"/> </element>
956 <element name="iron" formula="Fe" Z="26"> <atom value="55.8450"/> </element>
957 <element name="nickel" formula="Ni" Z="28"> <atom value="58.6934"/> </element>
958 <element name="copper" formula="Cu" Z="29"> <atom value="63.546"/> </element>
959 <element name="bromine" formula="Br" Z="35"> <atom value="79.904"/> </element>
961 <material name="Vacuum" formula="Vacuum">
962 <D value="1.e-25" unit="g/cm3"/>
963 <fraction n="1.0" ref="videRef"/>
966 <material name="ALUMINUM_Al" formula="ALUMINUM_Al">
967 <D value="2.6990" unit="g/cm3"/>
968 <fraction n="1.0000" ref="aluminum"/>
971 <material name="SILICON_Si" formula="SILICON_Si">
972 <D value="2.3300" unit="g/cm3"/>
973 <fraction n="1.0000" ref="silicon"/>
976 <material name="epoxy_resin" formula="C38H40O6Br4">
977 <D value="1.1250" unit="g/cm3"/>
978 <composite n="38" ref="carbon"/>
979 <composite n="40" ref="hydrogen"/>
980 <composite n="6" ref="oxygen"/>
981 <composite n="4" ref="bromine"/>
984 <material name="SiO2" formula="SiO2">
985 <D value="2.2" unit="g/cm3"/>
986 <composite n="1" ref="silicon"/>
987 <composite n="2" ref="oxygen"/>
990 <material name="Al2O3" formula="Al2O3">
991 <D value="3.97" unit="g/cm3"/>
992 <composite n="2" ref="aluminum"/>
993 <composite n="3" ref="oxygen"/>
996 <material name="Polystyrene" formula="C8H8">
997 <D value="1.05" unit="g/cm3"/>
998 <composite n="8" ref="carbon"/>
999 <composite n="8" ref="hydrogen"/>
1002 <material name="Fe2O3" formula="Fe2O3">
1003 <D value="5.24" unit="g/cm3"/>
1004 <composite n="2" ref="iron"/>
1005 <composite n="3" ref="oxygen"/>
1008 <material name="CaO" formula="CaO">
1009 <D value="3.35" unit="g/cm3"/>
1010 <composite n="1" ref="calcium"/>
1011 <composite n="1" ref="oxygen"/>
1014 <material name="MgO" formula="MgO">
1015 <D value="3.58" unit="g/cm3"/>
1016 <composite n="1" ref="magnesium"/>
1017 <composite n="1" ref="oxygen"/>
1020 <material name="Na2O" formula="Na2O">
1021 <D value="2.27" unit="g/cm3"/>
1022 <composite n="2" ref="sodium"/>
1023 <composite n="1" ref="oxygen"/>
1026 <material name="TiO2" formula="TiO2">
1027 <D value="4.23" unit="g/cm3"/>
1028 <composite n="1" ref="titanium"/>
1029 <composite n="2" ref="oxygen"/>
1032 <material name="FeO" formula="FeO">
1033 <D value="5.745" unit="g/cm3"/>
1034 <composite n="1" ref="iron"/>
1035 <composite n="1" ref="oxygen"/>
1038 <material name="CO2" formula="CO2">
1039 <D value="1.562" unit="g/cm3"/>
1040 <composite n="1" ref="carbon"/>
1041 <composite n="2" ref="oxygen"/>
1044 <material name="P2O5" formula="P2O5">
1045 <D value="1.562" unit="g/cm3"/>
1046 <composite n="2" ref="phosphorus"/>
1047 <composite n="5" ref="oxygen"/>
1050 <material formula=" " name="DUSEL_Rock">
1051 <D value="2.82" unit="g/cm3"/>
1052 <fraction n="0.5267" ref="SiO2"/>
1053 <fraction n="0.1174" ref="FeO"/>
1054 <fraction n="0.1025" ref="Al2O3"/>
1055 <fraction n="0.0473" ref="MgO"/>
1056 <fraction n="0.0422" ref="CO2"/>
1057 <fraction n="0.0382" ref="CaO"/>
1058 <fraction n="0.0240" ref="carbon"/>
1059 <fraction n="0.0186" ref="sulphur"/>
1060 <fraction n="0.0053" ref="Na2O"/>
1061 <fraction n="0.00070" ref="P2O5"/>
1062 <fraction n="0.0771" ref="oxygen"/>
1065 <material name="fibrous_glass">
1066 <D value="2.58" unit="g/cm3"/>
1067 <fraction n="0.600" ref="SiO2"/>
1068 <fraction n="0.118" ref="Al2O3"/>
1069 <fraction n="0.001" ref="Fe2O3"/>
1070 <fraction n="0.224" ref="CaO"/>
1071 <fraction n="0.034" ref="MgO"/>
1072 <fraction n="0.010" ref="Na2O"/>
1073 <fraction n="0.013" ref="TiO2"/>
1076 <!-- The following fractional components are placeholders,
1077 to be fixed (though they have very little effect,
1078 as long as the density is correct) -->
1079 <material name="polyurethane_foam">
1080 <D value=".13" unit="g/cm3"/>
1081 <fraction n="0.600" ref="SiO2"/>
1082 <fraction n="0.118" ref="Al2O3"/>
1083 <fraction n="0.001" ref="Fe2O3"/>
1084 <fraction n="0.224" ref="CaO"/>
1085 <fraction n="0.034" ref="MgO"/>
1086 <fraction n="0.010" ref="Na2O"/>
1087 <fraction n="0.013" ref="TiO2"/>
1090 <!-- for the cryostat foam insulation -->
1091 <material name="R-PUF">
1092 <D value=".2525" unit="g/cm3"/>
1093 <fraction n="0.95" ref="polyurethane_foam"/>
1094 <fraction n="0.05" ref="fibrous_glass"/>
1097 <material name="FR4">
1098 <D value="1.98281" unit="g/cm3"/>
1099 <fraction n="0.47" ref="epoxy_resin"/>
1100 <fraction n="0.53" ref="fibrous_glass"/>
1103 <material name="STEEL_STAINLESS_Fe7Cr2Ni" formula="STEEL_STAINLESS_Fe7Cr2Ni">
1104 <D value="7.9300" unit="g/cm3"/>
1105 <fraction n="0.0010" ref="carbon"/>
1106 <fraction n="0.1792" ref="chromium"/>
1107 <fraction n="0.7298" ref="iron"/>
1108 <fraction n="0.0900" ref="nickel"/>
1111 <material name="Copper_Beryllium_alloy25" formula="Copper_Beryllium_alloy25">
1112 <D value="8.26" unit="g/cm3"/>
1113 <fraction n="0.981" ref="copper"/>
1114 <fraction n="0.019" ref="beryllium"/>
1117 <material name="LAr" formula="LAr">
1118 <D value="1.40" unit="g/cm3"/>
1119 <fraction n="1.0000" ref="argon"/>
1122 <material name="ArGas" formula="ArGas">
1123 <D value="0.00166" unit="g/cm3"/>
1124 <fraction n="1.0" ref="argon"/>
1127 <material formula=" " name="Air">
1128 <D value="0.001205" unit="g/cm3"/>
1129 <fraction n="0.781154" ref="nitrogen"/>
1130 <fraction n="0.209476" ref="oxygen"/>
1131 <fraction n="0.00934" ref="argon"/>
1134 <material formula=" " name="G10">
1135 <D value="1.7" unit="g/cm3"/>
1136 <fraction n="0.2805" ref="silicon"/>
1137 <fraction n="0.3954" ref="oxygen"/>
1138 <fraction n="0.2990" ref="carbon"/>
1139 <fraction n="0.0251" ref="hydrogen"/>
1142 <material formula=" " name="Granite">
1143 <D value="2.7" unit="g/cm3"/>
1144 <fraction n="0.438" ref="oxygen"/>
1145 <fraction n="0.257" ref="silicon"/>
1146 <fraction n="0.222" ref="sodium"/>
1147 <fraction n="0.049" ref="aluminum"/>
1148 <fraction n="0.019" ref="iron"/>
1149 <fraction n="0.015" ref="potassium"/>
1152 <material formula=" " name="ShotRock">
1153 <D value="2.7*0.6" unit="g/cm3"/>
1154 <fraction n="0.438" ref="oxygen"/>
1155 <fraction n="0.257" ref="silicon"/>
1156 <fraction n="0.222" ref="sodium"/>
1157 <fraction n="0.049" ref="aluminum"/>
1158 <fraction n="0.019" ref="iron"/>
1159 <fraction n="0.015" ref="potassium"/>
1162 <material formula=" " name="Dirt">
1163 <D value="1.7" unit="g/cm3"/>
1164 <fraction n="0.438" ref="oxygen"/>
1165 <fraction n="0.257" ref="silicon"/>
1166 <fraction n="0.222" ref="sodium"/>
1167 <fraction n="0.049" ref="aluminum"/>
1168 <fraction n="0.019" ref="iron"/>
1169 <fraction n="0.015" ref="potassium"/>
1172 <material formula=" " name="Concrete">
1173 <D value="2.3" unit="g/cm3"/>
1174 <fraction n="0.530" ref="oxygen"/>
1175 <fraction n="0.335" ref="silicon"/>
1176 <fraction n="0.060" ref="calcium"/>
1177 <fraction n="0.015" ref="sodium"/>
1178 <fraction n="0.020" ref="iron"/>
1179 <fraction n="0.040" ref="aluminum"/>
1182 <material formula="H2O" name="Water">
1183 <D value="1.0" unit="g/cm3"/>
1184 <fraction n="0.1119" ref="hydrogen"/>
1185 <fraction n="0.8881" ref="oxygen"/>
1188 <material formula="Ti" name="Titanium">
1189 <D value="4.506" unit="g/cm3"/>
1190 <fraction n="1." ref="titanium"/>
1193 <material name="TPB" formula="TPB">
1194 <D value="1.40" unit="g/cm3"/>
1195 <fraction n="1.0000" ref="argon"/>
1198 <material name="Glass">
1199 <D value="2.74351" unit="g/cm3"/>
1200 <fraction n="0.600" ref="SiO2"/>
1201 <fraction n="0.118" ref="Al2O3"/>
1202 <fraction n="0.001" ref="Fe2O3"/>
1203 <fraction n="0.224" ref="CaO"/>
1204 <fraction n="0.034" ref="MgO"/>
1205 <fraction n="0.010" ref="Na2O"/>
1206 <fraction n="0.013" ref="TiO2"/>
1209 <material name="Acrylic">
1210 <D value="1.19" unit="g/cm3"/>
1211 <fraction n="0.600" ref="carbon"/>
1212 <fraction n="0.320" ref="oxygen"/>
1213 <fraction n="0.080" ref="hydrogen"/>
1216 <material name="Plastic" formula="Plastic">
1217 <D value="1.032" unit="g/cm3"/>
1218 <fraction n=".474" ref="carbon"/>
1219 <fraction n=".526" ref="hydrogen"/>
1231 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1232 #++++++++++++++++++++++++++++++++++++++++ gen_TPC ++++++++++++++++++++++++++++++++++++++++
1233 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1243 # $_[4] = APA number
1247 my $TPCActive_x = $_[0]-(3*$APAWirePlaneSpacing);
1248 my $TPCActive_y = $_[1] - $APAGap_y/2 - $ReadoutBoardOverlap;
1250 my $UAngle = $UAng[$apa];
1251 my $VAngle = $VAng[$apa];
1253 my $SinUAngle = sin( deg2rad($UAngle) );
1254 my $CosUAngle = cos( deg2rad($UAngle) );
1255 my $TanUAngle = tan( deg2rad($UAngle) );
1257 my $SinVAngle = sin( deg2rad($VAngle) );
1258 my $CosVAngle = cos( deg2rad($VAngle) );
1259 my $TanVAngle = tan( deg2rad($VAngle) );
1261 my $UWire_yint = $UWirePitch/$SinUAngle;
1262 my $UWire_zint = $UVReadoutBoardPitch ;
1264 my $VWire_yint = $VWirePitch/$SinVAngle;
1265 my $VWire_zint = $UVReadoutBoardPitch ;
1267 #constructs everything inside volTPC, namely
1268 # (moving from left to right, or from +x to -x)
1270 # -volTPCPlaneU: with wires angled from vertical slightly different than in V
1271 # -volTPCPlaneV: with wires angled from vertical slightly differently than in U
1272 # -volTPCPlaneX: with vertical wires
1275 # Create the TPC fragment file name,
1276 # add file to list of output GDML fragments,
1278 $TPC = "35t_TPC_${_[3]}" . $suffix . ".gdml";
1279 push (@gdmlFiles, $TPC);
1281 open(TPC) or die("Could not open file $TPC for writing");
1284 print $wout "\n\n\n----- Wires for $_[3] -----\n\n\n";
1287 # The standard XML prefix and starting the gdml
1289 <?xml version='1.0'?>
1294 # All the TPC solids save the wires.
1297 <box name="$_[3]" lunit="cm"
1301 <box name="${_[3]}UPlane" lunit="cm"
1302 x="$TPCWirePlaneThickness"
1303 y="$Uactive_y[$apa] + $UVPlaneBoundNudge"
1304 z="$Uactive_z + $UVPlaneBoundNudge"/>
1305 <box name="${_[3]}VPlane" lunit="cm"
1306 x="$TPCWirePlaneThickness"
1307 y="$Vactive_y[$apa] + $UVPlaneBoundNudge"
1308 z="$Vactive_z + $UVPlaneBoundNudge"/>
1309 <box name="${_[3]}ZPlane" lunit="cm"
1310 x="$TPCWirePlaneThickness"
1311 y="$Zactive_y[$apa]"
1313 <box name="${_[3]}Active" lunit="cm"
1315 y="$TPCActive_y[$apa]"
1316 z="$TPCActive_z[$apa]"/>
1320 #++++++++++++++++++++++++++++ Wire Solids ++++++++++++++++++++++++++++++
1324 <tube name="${_[3]}WireVert"
1325 rmax="0.5*$TPCWireThickness"
1326 z="$Zactive_y[$apa]"
1332 # Set number of wires to default to zero, when $wires_on = 0, for a low memory
1333 # version. But if $wires_on = 1, calculate the number of wires on each side of each
1334 # plane to be used in the for loops
1336 my $NumberCornerUWires = 0;
1337 my $NumberSideUWires = 0;
1338 my $NumberCommonUWires = 0;
1339 my $NumberCornerVWires = 0;
1340 my $NumberSideVWires = 0;
1341 my $NumberCommonVWires = 0;
1342 my $NumberVerticalWires = 0;
1346 # Number of wires in one corner
1347 #$NumberCornerUWires = int( $APAFrame_z/($UWirePitch/$CosUAngle) );
1348 $NumberCornerUWires = 72;
1350 #$NumberCornerVWires = int( $APAFrame_z/($VWirePitch/$CosVAngle) );
1351 $NumberCornerVWires = 72;
1353 # Total number of wires touching one vertical (longer) side
1354 # Note that the total number of wires per plane is this + another set of corner wires
1355 $NumberSideUWires = int( $Uactive_y[$apa]/($UWirePitch/$SinUAngle) );
1357 $NumberSideVWires = int( $Vactive_y[$apa]/($VWirePitch/$SinVAngle) );
1359 # Number of wires per side that aren't cut off by the corner
1360 $NumberCommonUWires = $NumberSideUWires - $NumberCornerUWires;
1362 $NumberCommonVWires = $NumberSideVWires - $NumberCornerVWires;
1364 # Number of wires on the vertical plane
1365 # Since APA Active z is defined in docdb 7550 to be distance
1366 # between outer vertical wires, + 1 since the floor of this
1367 # division will be one under, giveing the amt of spaces, not wires
1368 # $NumberVerticalWires = int( $Zactive_z/$XWirePitch ) + 1;
1369 $NumberVerticalWires = 112; # Zactive now defined in terms of 112,
1372 $nUchans = 2*$NumberCornerUWires;
1373 $nVchans = 2*$NumberCornerVWires;
1375 print $wout "$nUchans U channels\n";
1376 print $wout "$nVchans V channels\n";
1377 print $wout "$NumberVerticalWires Z channels per side\n";
1382 my $FirstUWireOffset = .35 + $G10thickness + 2*$G10thickness*$TanUAngle - $UVReadoutBoardPitch;
1383 my $FirstVWireOffset = .35; # doesnt include a G10 board in width
1385 my $FirstTopUWire_yspan =
1387 - ( - $Uactive_y[$apa]/2
1388 + $FirstUWireOffset/$TanUAngle # walk us up to the first wire
1389 + $UWire_yint*($NumberSideUWires-1) # up to the top of the top common wire
1390 - $Uactive_z/$TanUAngle # back to the bottom of the top common wire
1391 + $UWire_yint); # nudge up to bottom of the first top corner wire
1393 my $FirstTopVWire_yspan =
1395 - ( - $Vactive_y[$apa]/2
1396 + $FirstVWireOffset/$TanVAngle # walk us up to the first wire
1397 + $VWire_yint*($NumberSideVWires-1) # up to the top of the top common wire
1398 - $Vactive_z/$TanVAngle # back to the bottom of the top common wire
1399 + $VWire_yint); # nudge up to bottom of the first top corner wire
1401 # The corner wires for the U plane
1404 for ($i = 0; $i < $NumberCornerUWires; $i++)
1406 $CornerUWireLength[$i] = ($FirstUWireOffset + $i*$UVReadoutBoardPitch)/$SinUAngle;
1409 <tube name="${_[3]}WireU$i"
1410 rmax="0.5*$TPCWireThickness"
1411 z="$CornerUWireLength[$i]"
1419 $CommonUWireLength = $Uactive_z/$SinUAngle;
1422 <tube name="${_[3]}WireUCommon"
1423 rmax="0.5*$TPCWireThickness"
1424 z="$CommonUWireLength"
1430 for ($i = 0; $i < $NumberCornerUWires; $i++)
1433 $TopCornerUWireLength[$i] = ($FirstTopUWire_yspan - $i*$UWire_yint)/$CosUAngle;
1435 $j = $i + $NumberSideUWires;
1438 <tube name="${_[3]}WireU$j"
1439 rmax="0.5*$TPCWireThickness"
1440 z="$TopCornerUWireLength[$i]"
1451 # The corner wires for the V plane
1454 for ($i = 0; $i < $NumberCornerVWires; ++$i)
1456 $CornerVWireLength[$i] = ($FirstVWireOffset + $i*$UVReadoutBoardPitch)/$SinVAngle;
1460 <tube name="${_[3]}WireV$i"
1461 rmax="0.5*$TPCWireThickness"
1462 z="$CornerVWireLength[$i]"
1471 # The wire used many times in the middle of the V plane
1472 # Same subtraction as U common
1474 $CommonVWireLength = $Vactive_z/$SinVAngle;
1477 <tube name="${_[3]}WireVCommon"
1478 rmax="0.5*$TPCWireThickness"
1479 z="$CommonVWireLength"
1485 for ($i = 0; $i < $NumberCornerVWires; $i++)
1488 $TopCornerVWireLength[$i] = ($FirstTopVWire_yspan - $i*$VWire_yint)/$CosVAngle;
1490 $j = $i + $NumberSideVWires;
1493 <tube name="${_[3]}WireV$j"
1494 rmax="0.5*$TPCWireThickness"
1495 z="$TopCornerVWireLength[$i]"
1506 # make the solids only once per APA
1507 # (here only from the lang drift TPC)
1508 if($_[0]>100){ solid_TPCG10( $_[4], $_[0], $_[1], $_[2]); }
1510 # Begin structure and create the vertical wire logical volume
1514 <volume name="volTPCActive${_[3]}">
1515 <materialref ref="LAr"/>
1516 <solidref ref="${_[3]}Active"/>
1525 <volume name="volTPCWireVert${_[3]}">
1526 <materialref ref="Copper_Beryllium_alloy25"/>
1527 <solidref ref="${_[3]}WireVert"/>
1531 # Corner U wires logical volumes
1532 for ($i = 0; $i < $NumberCornerUWires; ++$i)
1535 <volume name="volTPCWireU$i${_[3]}">
1536 <materialref ref="Copper_Beryllium_alloy25"/>
1537 <solidref ref="${_[3]}WireU$i"/>
1543 # Top Corner U wires logical volumes
1544 for ($j = $NumberSideUWires; $j < $NumberSideUWires + $NumberCornerUWires; ++$j)
1547 <volume name="volTPCWireU$j${_[3]}">
1548 <materialref ref="Copper_Beryllium_alloy25"/>
1549 <solidref ref="${_[3]}WireU$j"/>
1555 # Common U wire logical volume, referenced many times
1557 <volume name="volTPCWireUCommon${_[3]}">
1558 <materialref ref="Copper_Beryllium_alloy25"/>
1559 <solidref ref="${_[3]}WireUCommon"/>
1563 # Corner V wires logical volumes
1564 for ($i = 0; $i < $NumberCornerVWires; ++$i)
1567 <volume name="volTPCWireV$i${_[3]}">
1568 <materialref ref="Copper_Beryllium_alloy25"/>
1569 <solidref ref="${_[3]}WireV$i"/>
1575 # Top Corner V wires logical volumes
1576 for ($j = $NumberSideVWires; $j < $NumberSideVWires + $NumberCornerVWires; ++$j)
1579 <volume name="volTPCWireV$j${_[3]}">
1580 <materialref ref="Copper_Beryllium_alloy25"/>
1581 <solidref ref="${_[3]}WireV$j"/>
1586 # Common V wire logical volume, referenced many times
1588 <volume name="volTPCWireVCommon${_[3]}">
1589 <materialref ref="Copper_Beryllium_alloy25"/>
1590 <solidref ref="${_[3]}WireVCommon"/>
1596 # generate the G10 board solids and logical volumes
1597 # make the volumes only once per APA
1598 # (here only from the lang drift TPC)
1599 if($_[0]>100){ vol_TPCG10( $_[4] ); }
1605 #+++++++++++++++++++++++++ Position physical wires ++++++++++++++++++++++++++
1607 # ++++++++++++++++++++++ U Plane +++++++++++++++++++++++
1609 # Create U plane logical volume
1611 <volume name="volTPCPlaneU${_[3]}">
1612 <materialref ref="LAr"/>
1613 <solidref ref="${_[3]}UPlane"/>
1617 print $wout "\n- Wires for U plane -\n\n";
1618 print $wout " Uplane_y: $Uactive_y[$apa]\n";
1619 print $wout " Uplane_z: $Uactive_z\n";
1625 # Starting with the bottom left corner wires:
1626 # x=0 to center the wires in the plane
1627 # y positioning: (-0.5*$TPCWirePlaneHeight) starts the incremental increase
1628 # from the bottom of the plane, and trigonometry gives the increment
1629 # z positioning: Looking at the plane from the positive x direction,
1630 # (0.5*$TPCWirePlaneLength) starts the incremental increase from
1631 # the lower left corner.
1632 # rotation: same as common wire in code below
1634 $FirstU_ypos = - $Uactive_y[$apa]/2 + $FirstUWireOffset/$TanUAngle/2;
1635 $FirstU_zpos = + $Uactive_z/2 - $FirstUWireOffset/2;
1637 for ($i = 0; $i < $NumberCornerUWires; ++$i)
1640 my $ypos = $FirstU_ypos + ($i)*0.5*$UWire_yint;
1641 my $zpos = $FirstU_zpos - ($i)*0.5*$UVReadoutBoardPitch;
1643 # cant actually define like this:
1644 # my $ypos = (-0.5*$Uactive_y[$apa]) + $CornerUWireLength[$i]*$CosUAngle/2;
1645 # my $zpos = (+0.5*$Uactive_z) - $CornerUWireLength[$i]*$SinUAngle/2;
1646 # since the wire lengths need to be slightly reduced to avoid the
1647 # wire corner's overlap with the plane boundary
1651 <volumeref ref="volTPCWireU$i${_[3]}"/>
1652 <position name="pos${_[3]}WireU$i" unit="cm" x="0" y="$ypos " z="$zpos"/>
1653 <rotation name="rUAngle$i" unit="deg" x="90-$UAngle" y="0" z="0"/>
1657 $topY = $ypos + ($CosUAngle*$CornerUWireLength[$i]/2);
1658 $bottomY = $ypos - ($CosUAngle*$CornerUWireLength[$i]/2);
1659 $edgeZ_p = $zpos + ($SinUAngle*$CornerUWireLength[$i]/2);
1660 $edgeZ_m = $zpos - ($SinUAngle*$CornerUWireLength[$i]/2);
1661 print $wout "U$i: ( $ypos , $zpos ) \n";
1662 print $wout " -- Y: $bottomY to $topY -- Z: $edgeZ_m to $edgeZ_p \n";
1670 # Moving upwards to the common wires:
1671 # x and z are zero to center the wires along a vertical axis
1672 # y positioning: The trick is positioning the lowest common wire so that the pitch
1673 # is consistent, then the increment is double the increment of
1674 # the corner wires since there is no z incriment.
1675 # rotation: wires in \\\\ direction, so +90deg to bring them to vertical and
1676 # +UAngle counterclockwise to arrive at proper orientation
1677 # Note that the counter maintains wire number (in pos. name) counting bottom to top
1680 my $StartCommonUWires_ypos = $lastYpos + $UWire_yint - abs( $lastZpos )/$TanUAngle;
1681 #print "$StartCommonUWires_ypos = $lastYpos + $UWire_yint - abs( $lastZpos )/$TanUAngle\n";
1684 for ($i = $NumberCornerUWires; $i < $NumberSideUWires; ++$i)
1687 $j = $i - $NumberCornerUWires;
1689 #my $ypos = (-0.5*$Uactive_y[$apa])
1690 # + 0.5*($NumberCornerUWires)*$UWire_yint+($i+1-$NumberCornerUWires)*$UWire_yint;
1691 my $ypos = $StartCommonUWires_ypos + $UWire_yint*($j);
1695 <volumeref ref="volTPCWireUCommon${_[3]}"/>
1696 <position name="pos${_[3]}WireU$i" unit="cm" x="0" y="$ypos " z="0"/>
1697 <rotation name="rUAngle$i" unit="deg" x="90-$UAngle" y="0" z="0"/>
1701 $topY = $ypos + ($CosUAngle*$CommonUWireLength/2);
1702 $bottomY = $ypos - ($CosUAngle*$CommonUWireLength/2);
1703 $edgeZ_p = + ($SinUAngle*$CommonUWireLength/2);
1704 $edgeZ_m = - ($SinUAngle*$CommonUWireLength/2);
1705 print $wout "U$i: ( $ypos , 0 ) \n";
1706 print $wout " -- Y: $bottomY to $topY -- Z: $edgeZ_m to $edgeZ_p \n";
1709 #$lastZpos = $zpos; always 0
1715 my $FirstTopUWire_zspan = $FirstTopUWire_yspan*$TanUAngle;
1716 my $StartTopUWires_ypos = + $Uactive_y[$apa]/2 - $FirstTopUWire_yspan/2;
1717 my $StartTopUWires_zpos = - $Uactive_z/2 + $FirstTopUWire_zspan/2;
1719 # Finally moving to the corner wires on the top right:
1720 # x=0 to center the wires in the plane
1721 # y positioning: plug wire number into same equation
1722 # z positioning: start at z=0 and go negatively at the same z increment
1723 # rotation: same as common wire in code above
1724 # note that the counter maintains wire number shown in the position name
1726 for ($j = $NumberSideUWires; $j < $NumberSideUWires+$NumberCornerUWires; ++$j)
1729 $i = $j - $NumberSideUWires;
1731 my $ypos = $StartTopUWires_ypos + ($i)*0.5*$UWire_yint;
1732 my $zpos = $StartTopUWires_zpos - ($i)*0.5*$UVReadoutBoardPitch;
1737 <volumeref ref="volTPCWireU$j${_[3]}"/>
1738 <position name="pos${_[3]}WireU$j" unit="cm" x="0" y="$ypos " z="$zpos"/>
1739 <rotation name="rUAngle$j" unit="deg" x="90-$UAngle" y="0" z="0"/>
1743 $topY = $ypos + ($CosUAngle*$TopCornerUWireLength[$i]/2);
1744 $bottomY = $ypos - ($CosUAngle*$TopCornerUWireLength[$i]/2);
1745 $edgeZ_p = $zpos + ($SinUAngle*$TopCornerUWireLength[$i]/2);
1746 $edgeZ_m = $zpos - ($SinUAngle*$TopCornerUWireLength[$i]/2);
1747 print $wout "U$i: ( $ypos , $zpos ) \n";
1748 print $wout " -- Y: $bottomY to $topY -- Z: $edgeZ_m to $edgeZ_p \n";
1755 # ++++++++++++++++++++++ V Plane +++++++++++++++++++++++
1757 # End U plane and create V plane logical volume
1761 <volume name="volTPCPlaneV${_[3]}">
1762 <materialref ref="LAr"/>
1763 <solidref ref="${_[3]}VPlane"/>
1766 print $wout "\n- Wires for V plane -\n\n";
1767 print $wout " Vplane_y: $Vactive_y[$apa]\n";
1768 print $wout " Vplane_z: $Vactive_z\n";
1774 # Starting with the bottom right corner wires:
1775 # x=0 to center the wires in the plane
1776 # y positioning: (-0.5*$TPCWirePlaneHeight) starts the incremental increase
1777 # from the bottom of the plane, and trigonometry gives the increment
1778 # z positioning: Looking at the plane from the positive x direction,
1779 # (-0.5*$TPCWirePlaneLength) starts the incremental increase from
1780 # the lower right corner.
1781 # rotation: same as common wire in code below
1783 $FirstV_ypos = - $Vactive_y[$apa]/2 + $FirstVWireOffset/$TanVAngle/2;
1784 $FirstV_zpos = - $Vactive_z/2 + $FirstVWireOffset/2;
1786 for ($i = 0; $i < $NumberCornerVWires; ++$i)
1789 my $ypos = $FirstV_ypos + ($i)*0.5*$VWire_yint;
1790 my $zpos = $FirstV_zpos + ($i)*0.5*$UVReadoutBoardPitch;
1794 <volumeref ref="volTPCWireV$i${_[3]}"/>
1795 <position name="pos${_[3]}WireV$i" unit="cm" x="0" y="$ypos " z="$zpos"/>
1796 <rotation name="rVAngle$i" unit="deg" x="90+$VAngle" y="0" z="0"/>
1800 $topY = $ypos + ($CosVAngle*$CornerVWireLength[$i]/2);
1801 $bottomY = $ypos - ($CosVAngle*$CornerVWireLength[$i]/2);
1802 $edgeZ_p = $zpos + ($SinVAngle*$CornerVWireLength[$i]/2);
1803 $edgeZ_m = $zpos - ($SinVAngle*$CornerVWireLength[$i]/2);
1804 print $wout "V$i: ( $ypos , $zpos ) \n";
1805 print $wout " -- Y: $bottomY to $topY -- Z: $edgeZ_m to $edgeZ_p \n";
1813 # Moving upwards to the common wires:
1814 # x and z are zero to center the wires along a vertical axis
1815 # y positioning: Plug wire number into the same corner ypos equation
1816 # rotation: wires in //// direction, so +90deg to bring them to vertical and
1817 # --VAngle counterclockwise to arrive at proper orientation
1818 # Note that the counter maintains wire number in the position name
1820 my $StartCommonVWires_ypos = $lastYpos + $VWire_yint - abs( $lastZpos )/$TanVAngle;
1822 for ($i = $NumberCornerVWires; $i < $NumberSideVWires; ++$i)
1825 $j = $i - $NumberCornerVWires;
1826 my $ypos = $StartCommonVWires_ypos + $VWire_yint*($j);
1830 <volumeref ref="volTPCWireVCommon${_[3]}"/>
1831 <position name="pos${_[3]}WireV$i" unit="cm" x="0" y="$ypos " z="0"/>
1832 <rotation name="rVAngle$i" unit="deg" x="90+$VAngle" y="0" z="0"/>
1836 $topY = $ypos + ($CosVAngle*$CommonVWireLength/2);
1837 $bottomY = $ypos - ($CosVAngle*$CommonVWireLength/2);
1838 $edgeZ_p = + ($SinVAngle*$CommonVWireLength/2);
1839 $edgeZ_m = - ($SinVAngle*$CommonVWireLength/2);
1840 print $wout "V$i: ( $ypos , 0 ) \n";
1841 print $wout " -- Y: $bottomY to $topY -- Z: $edgeZ_m to $edgeZ_p \n";
1844 #$lastZpos = $zpos; always 0
1849 my $FirstTopVWire_zspan = $FirstTopVWire_yspan*$TanVAngle;
1850 my $StartTopVWires_ypos = + $Vactive_y[$apa]/2 - $FirstTopVWire_yspan/2;
1851 my $StartTopVWires_zpos = + $Vactive_z/2 - $FirstTopVWire_zspan/2;
1853 # Finally moving to the corner wires on the top right:
1854 # x=0 to center the wires in the plane
1855 # y positioning: plug wire number into same equation
1856 # z positioning: start at z=0 and go positively at the same z increment
1857 # rotation: same as common wire in code above
1858 # note that the counter maintains wire number shown in the position name
1860 for ($j = $NumberSideVWires; $j < $NumberSideVWires+$NumberCornerVWires; ++$j)
1863 $i = $j - $NumberSideVWires;
1865 my $ypos = $StartTopVWires_ypos + ($i)*0.5*$VWire_yint;
1866 my $zpos = $StartTopVWires_zpos + ($i)*0.5*$UVReadoutBoardPitch;
1870 <volumeref ref="volTPCWireV$j${_[3]}"/>
1871 <position name="pos${_[3]}WireV$j" unit="cm" x="0" y="$ypos " z="$zpos"/>
1872 <rotation name="rVAngle$j" unit="deg" x="90+$VAngle" y="0" z="0"/>
1876 $topY = $ypos + ($CosVAngle*$TopCornerVWireLength[$i]/2);
1877 $bottomY = $ypos - ($CosVAngle*$TopCornerVWireLength[$i]/2);
1878 $edgeZ_p = $zpos + ($SinVAngle*$TopCornerVWireLength[$i]/2);
1879 $edgeZ_m = $zpos - ($SinVAngle*$TopCornerVWireLength[$i]/2);
1880 print $wout "V$i: ( $ypos , $zpos ) \n";
1881 print $wout " -- Y: $bottomY to $topY -- Z: $edgeZ_m to $edgeZ_p \n";
1894 # ++++++++++++++++++++++ Z Plane +++++++++++++++++++++++
1896 # End V plane and create Z plane logical volume
1900 <volume name="volTPCPlaneZ${_[3]}">
1901 <materialref ref="LAr"/>
1902 <solidref ref="${_[3]}ZPlane"/>
1908 # This is the simplest plane, one loop creates all of the wires
1909 # x and y position at zero to center the wires
1910 # z position: moving from front of detector to back, in the positive z direction,
1911 # starting at (-0.5*$TPCWirePlaneLength), the right side looking from
1914 for ($i=0; $i<$NumberVerticalWires; ++$i)
1916 my $zpos = (-0.5*$Zactive_z) + $i*$XWirePitch + $TPCWireThickness/2;
1920 <volumeref ref="volTPCWireVert${_[3]}"/>
1921 <position name="pos${_[3]}WireZ$i" unit="cm" x="0" y="0 " z="$zpos"/>
1922 <rotationref ref="rPlus90AboutX"/>
1934 #+++++++++++++++++++++ ^^ Position physical wires Above ^^ +++++++++++++++++++++
1936 ## make the TPC active volume extend down to the G10 for the grid
1938 my $BottomOfAPA = - $TPC_y[$apa]/2 + $APAGap_y/2;
1942 $BottomOfAPA = -$TPCActive_y[0]/2 + $BottomTallAPAToCage;
1945 $BottomOfAPA = -$TPCActive_y[1]/2 + $APAGap_y/2;
1948 $BottomOfAPA = -$TPCActive_y[2]/2 + $APAGap_y/2;
1951 $BottomOfAPA = -$TPCActive_y[3]/2 + $BottomTallAPAToCage;
1955 if ($TPCActive_x<100){ $xx = -1; }
1958 $posZplane[0] = $xx*(-$_[0]/2 + $APAWirePlaneSpacing - $TPCWirePlaneThickness/2);
1959 $posZplane[1] = $BottomOfAPA + $WrapCover + 4*$G10thickness + $Zactive_y[$apa]/2;
1960 $posZplane[2] = $zz*(-$_[2]/2 + $APAGap_z/2 + $APAphys_z/2);
1962 $posVplane[0] = $posZplane[0] + $xx*$APAWirePlaneSpacing;
1963 $posVplane[1] = $BottomOfAPA + $WrapCover + 3*$G10thickness + $Vactive_y[$apa]/2;
1964 $posVplane[2] = $posZplane[2];
1966 $posUplane[0] = $posVplane[0] + $xx*$APAWirePlaneSpacing;
1967 $posUplane[1] = $BottomOfAPA + $WrapCover + 2*$G10thickness + $Uactive_y[$apa]/2;
1968 $posUplane[2] = $posZplane[2];
1970 $posTPCActive[0] = $posUplane[0] + $xx*($TPCWirePlaneThickness/2 + $TPCActive_x/2);
1971 $posTPCActive[1] = 0;
1972 $posTPCActive[2] = 0;
1974 if ($TPCActive_x<100){ $planeRot = "rIdentity"; }
1975 else { $planeRot = "rPlus180AboutY"; }
1978 #wrap up the TPC file
1980 <volume name="volTPC${_[3]}">
1981 <materialref ref="LAr"/>
1982 <solidref ref="${_[3]}"/>
1984 <volumeref ref="volTPCPlaneZ${_[3]}"/>
1985 <position name="pos${_[3]}PlaneZ" unit="cm"
1986 x="$posZplane[0]" y="$posZplane[1]" z="$posZplane[2]"/>
1987 <rotationref ref="rIdentity"/>
1990 <volumeref ref="volTPCPlaneV${_[3]}"/>
1991 <position name="pos${_[3]}PlaneV" unit="cm"
1992 x="$posVplane[0]" y="$posVplane[1]" z="$posVplane[2]"/>
1993 <rotationref ref="$planeRot"/>
1996 <volumeref ref="volTPCPlaneU${_[3]}"/>
1997 <position name="pos${_[3]}PlaneU" unit="cm"
1998 x="$posUplane[0]" y="$posUplane[1]" z="$posUplane[2]"/>
1999 <rotationref ref="$planeRot"/>
2002 <volumeref ref="volTPCActive${_[3]}"/>
2003 <position name="pos${_[3]}Active" unit="cm"
2004 x="$posTPCActive[0]" y="$posTPCActive[1]" z="$posTPCActive[2]"/>
2008 # place the G10 board extensions to the portions placed directly in volCryostat
2009 #place_TPCG10( $_[4], $_[0], $_[1], $_[2] );
2019 } #end of sub gen_TPC
2022 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2023 #++++++++++++++++++++++++++++++++++++++ solid_TPCG10 +++++++++++++++++++++++++++++++++++++
2024 #++++++++++++++++++++++++++++++++++++++++ vol_TPCG10 +++++++++++++++++++++++++++++++++++++
2025 #++++++++++++++++++++++++++++++++++++++ place_TPCG10 +++++++++++++++++++++++++++++++++++++
2026 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2029 # Must be called only within gen_TPC(),
2032 # $_[0] = APA number
2033 # convention: 0 is Largest, 1 is Mid, 2 is Smallest
2041 $G10BoardYSide_V_x = 2*$APAWirePlaneSpacing; # The rest of the x-direction extension
2042 # out to the V plane wires
2043 $G10BoardYSide_V_y = $APAFrame_y[$apa]; # Y and Z are the same as the center
2044 $G10BoardYSide_V_z = $G10thickness; # parts placed in volCryostat
2047 $G10BoardYSide_U_x = 3*$APAWirePlaneSpacing; # The rest of the x-direction extension
2048 # out to the U plane wires
2049 $G10BoardYSide_U_y = $APAFrame_y[$apa]; # Y and Z are the same as the center
2050 $G10BoardYSide_U_z = $G10thickness; # parts placed in volCryostat
2053 $G10BoardZSide_V_x = 2*$APAWirePlaneSpacing;
2054 $G10BoardZSide_V_y = $G10thickness;
2055 $G10BoardZSide_V_z = $APAFrame_z;
2056 $G10BoardZSide_U_x = 3*$APAWirePlaneSpacing;
2057 $G10BoardZSide_U_y = $G10thickness;
2058 $G10BoardZSide_U_z = $APAFrame_z;
2059 $G10BoardZSide_Grid_x = 4*$APAWirePlaneSpacing;
2060 $G10BoardZSide_Grid_y = $G10thickness;
2061 $G10BoardZSide_Grid_z = $APAFrame_z;
2065 <box name="G10BoardYSideVSeg\-$apa" lunit="cm"
2066 x="$G10BoardYSide_V_x"
2067 y="$G10BoardYSide_V_y"
2068 z="$G10BoardYSide_V_z"/>
2070 <box name="G10BoardYSideUSeg\-$apa" lunit="cm"
2071 x="$G10BoardYSide_U_x"
2072 y="$G10BoardYSide_U_y"
2073 z="$G10BoardYSide_U_z"/>
2075 <box name="G10BoardZSideVSeg\-$apa" lunit="cm"
2076 x="$G10BoardZSide_V_x"
2077 y="$G10BoardZSide_V_y"
2078 z="$G10BoardZSide_V_z"/>
2080 <box name="G10BoardZSideUSeg\-$apa" lunit="cm"
2081 x="$G10BoardZSide_U_x"
2082 y="$G10BoardZSide_U_y"
2083 z="$G10BoardZSide_U_z"/>
2085 <box name="G10BoardZSideGridSeg\-$apa" lunit="cm"
2086 x="$G10BoardZSide_Grid_x"
2087 y="$G10BoardZSide_Grid_y"
2088 z="$G10BoardZSide_Grid_z"/>
2102 <volume name="volG10BoardYSideVSeg\-$apa">
2103 <materialref ref="G10"/>
2104 <solidref ref="G10BoardYSideVSeg\-$apa"/>
2106 <volume name="volG10BoardYSideUSeg\-$apa">
2107 <materialref ref="G10"/>
2108 <solidref ref="G10BoardYSideUSeg\-$apa"/>
2111 <volume name="volG10BoardZSideVSeg\-$apa">
2112 <materialref ref="G10"/>
2113 <solidref ref="G10BoardZSideVSeg\-$apa"/>
2115 <volume name="volG10BoardZSideUSeg\-$apa">
2116 <materialref ref="G10"/>
2117 <solidref ref="G10BoardZSideUSeg\-$apa"/>
2119 <volume name="volG10BoardZSideGridSeg\-$apa">
2120 <materialref ref="G10"/>
2121 <solidref ref="G10BoardZSideGridSeg\-$apa"/>
2139 $G10BoardYSide_V_x = 1*$APAWirePlaneSpacing; # The rest of the x-direction extension
2140 # out to the V plane wires
2141 $G10BoardYSide_V_y = $APAFrame_y[$APA_i]; # Y and Z are the same as the center
2142 $G10BoardYSide_V_z = $G10thickness; # parts placed in volCryostat
2145 $G10BoardYSide_U_x = 2*$APAWirePlaneSpacing; # The rest of the x-direction extension
2146 # out to the U plane wires
2147 $G10BoardYSide_U_y = $APAFrame_y[$APA_i]; # Y and Z are the same as the center
2148 $G10BoardYSide_U_z = $G10thickness; # parts placed in volCryostat
2151 $G10BoardZSide_V_x = 1*$APAWirePlaneSpacing;
2152 $G10BoardZSide_V_y = $G10thickness;
2153 $G10BoardZSide_V_z = $APAFrame_z;
2154 $G10BoardZSide_U_x = 2*$APAWirePlaneSpacing;
2155 $G10BoardZSide_U_y = $G10thickness;
2156 $G10BoardZSide_U_z = $APAFrame_z;
2157 $G10BoardZSide_Grid_x = 3*$APAWirePlaneSpacing;
2158 $G10BoardZSide_Grid_y = $G10thickness;
2159 $G10BoardZSide_Grid_z = $APAFrame_z;
2162 $posG10ZSideZ_y = $APAFrameCenter_y - $APAFrame_y[$APA_i]/2 - (0+.5)*($G10BoardZSide_y);
2163 $posG10ZSideV_y = $APAFrameCenter_y - $APAFrame_y[$APA_i]/2 - (1+.5)*($G10BoardZSide_y);
2164 $posG10ZSideU_y = $APAFrameCenter_y - $APAFrame_y[$APA_i]/2 - (2+.5)*($G10BoardZSide_y);
2165 $posG10ZSideGrid_y = $APAFrameCenter_y - $APAFrame_y[$APA_i]/2 - (3+.5)*($G10BoardZSide_y);
2167 # ... but the smallest APA is upside-down, so put the G10 boards at the top in that case
2170 $posG10ZSideZ_y = $APAFrameCenter_y + $APAFrame_y[$APA_i]/2 + (0+.5)*($G10BoardZSide_y);
2171 $posG10ZSideV_y = $APAFrameCenter_y + $APAFrame_y[$APA_i]/2 + (1+.5)*($G10BoardZSide_y);
2172 $posG10ZSideU_y = $APAFrameCenter_y + $APAFrame_y[$APA_i]/2 + (2+.5)*($G10BoardZSide_y);
2173 $posG10ZSideGrid_y = $APAFrameCenter_y + $APAFrame_y[$APA_i]/2 + (3+.5)*($G10BoardZSide_y);
2179 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2180 - Add the *parts* of the G10 boards that extend those directly in volCryostat.
2181 - There are two side boards on each the up and downstream end,
2182 one each to wrap the U and V views around the APA frame
2183 - There are 4 on the bottom which anchor the U V and Z wires and the grid plane
2184 - The center parts of the G10 boards must be placed directly in volCryostat
2191 <volumeref ref="volG10BoardYSideVSeg\-$apa"/>
2192 <position name="posG10BoardYSideVSeg\-up\-$apa" unit="cm"
2193 x=" - $ThisTPC_x/2 + $G10BoardYSide_V_x/2"
2194 y=" - $APAphys_y[$apa]/2 + $WrapCover + 4*$G10thickness + $APAFrame_y[$apa]/2 "
2195 z=" - $APAFrame_z/2 - (0+.5)*($G10BoardYSide_V_z)"/>
2196 <rotationref ref="rIdentity"/>
2199 <volumeref ref="volG10BoardYSideUSeg\-$apa"/>
2200 <position name="posG10BoardYSideUSeg\-up\-$apa" unit="cm"
2201 x=" - $ThisTPC_x/2 + $G10BoardYSide_U_x/2"
2202 y=" - $APAphys_y[$apa]/2 + $WrapCover + 4*$G10thickness + $APAFrame_y[$apa]/2"
2203 z=" - $APAFrame_z/2 - (1+.5)*($G10BoardYSide_U_z)"/>
2204 <rotationref ref="rIdentity"/>
2208 <volumeref ref="volG10BoardYSideVSeg\-$apa"/>
2209 <position name="posG10BoardYSideVSeg\-down\-$apa" unit="cm"
2210 x=" - $ThisTPC_x/2 + $G10BoardYSide_V_x/2"
2211 y=" - $APAphys_y[$apa]/2 + $WrapCover + 4*$G10thickness + $APAFrame_y[$apa]/2 "
2212 z=" + $APAFrame_z/2 + (0+.5)*($G10BoardYSide_V_z)"/>
2213 <rotationref ref="rIdentity"/>
2216 <volumeref ref="volG10BoardYSideUSeg\-$apa"/>
2217 <position name="posG10BoardYSideUSeg\-down\-$apa" unit="cm"
2218 x=" - $ThisTPC_x/2 + $G10BoardYSide_U_x/2"
2219 y=" - $APAphys_y[$apa]/2 + $WrapCover + 4*$G10thickness + $APAFrame_y[$apa]/2"
2220 z=" + $APAFrame_z/2 + (1+.5)*($G10BoardYSide_U_z)"/>
2221 <rotationref ref="rIdentity"/>
2227 <volumeref ref="volG10BoardZSideVSeg\-$apa"/>
2228 <position name="posG10BoardZSideVSeg\-$apa" unit="cm"
2229 x=" - $ThisTPC_x/2 + $G10BoardZSide_V_x/2"
2230 y=" - $APAphys_y[$apa]/2 + $WrapCover + 2.5*$G10thickness"
2232 <rotationref ref="rIdentity"/>
2235 <volumeref ref="volG10BoardZSideUSeg\-$apa"/>
2236 <position name="posG10BoardZSideUSeg\-$apa" unit="cm"
2237 x=" - $ThisTPC_x/2 + $G10BoardZSide_U_x/2"
2238 y=" - $APAphys_y[$apa]/2 + $WrapCover + 1.5*$G10thickness"
2240 <rotationref ref="rIdentity"/>
2243 <volumeref ref="volG10BoardZSideGridSeg\-$apa"/>
2244 <position name="posG10BoardZSideGridSeg\-$apa" unit="cm"
2245 x=" - $ThisTPC_x/2 + $G10BoardZSide_Grid_x/2"
2246 y=" - $APAphys_y[$apa]/2 + $WrapCover + 0.5*$G10thickness"
2248 <rotationref ref="rIdentity"/>
2260 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2261 #++++++++++++++++++++++++++++++++++++++ gen_Cryostat +++++++++++++++++++++++++++++++++++++
2262 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2267 # Create the cryostat fragment file name,
2268 # add file to list of output GDML fragments,
2270 $CRYO = "35t_Cryostat" . $suffix . ".gdml";
2271 push (@gdmlFiles, $CRYO);
2272 $CRYO = ">" . $CRYO;
2273 open(CRYO) or die("Could not open file $CRYO for writing");
2276 # The standard XML prefix and starting the gdml
2278 <?xml version='1.0'?>
2283 # All the cryostat solids.
2286 <box name="Cryostat" lunit="cm"
2291 <box name="GaseousArgon" lunit="cm"
2293 y="$HeightGaseousAr"
2296 <box name="LightPaddle" lunit="cm"
2298 y="$LightPaddle_y + $SiPM_y"
2299 z="$LightPaddle_z"/>
2301 <box name="Bar" lunit="cm"
2306 <union name="TwoBars">
2307 <first ref="Bar"/> <second ref="Bar"/>
2308 <position name="bs2" z="-2.794" unit="cm"/>
2311 <union name="FourBars">
2312 <first ref="TwoBars"/> <second ref="TwoBars"/>
2313 <position name="bs4" z="-5.588" unit="cm"/>
2316 <box name="Plank" lunit="cm"
2321 <box name="Fiber" lunit="cm"
2326 <box name="FiberBottom" lunit="cm"
2331 <box name="FiberTop" lunit="cm"
2336 <para name="FiberRight" x="0.289" y="0.289" z="5.3975" alpha="0" theta="3.0649" phi="0" aunit="deg" lunit="cm"/>
2338 <para name="FiberLeft" x="0.289" y="0.289" z="5.3975" alpha="0" theta="-3.0649" phi="0" aunit="deg" lunit="cm"/>
2341 <first ref="Fiber"/> <second ref="Fiber"/>
2342 <position name="ff" x="-0.289" z="-0.289" unit="cm"/>
2346 <first ref="FF"/> <second ref="FiberBottom"/>
2347 <position name="ffb" x="-0.289" y="-3.81" z="0.289" unit="cm"/>
2351 <first ref="FFB"/> <second ref="FiberBottom"/>
2352 <position name="ffbb" y="-3.81" z="-0.578" unit="cm"/>
2355 <union name="FFBBT">
2356 <first ref="FFBB"/> <second ref="FiberTop"/>
2357 <position name="ffbbt" x="-0.289" y="24.28875" unit="cm"/>
2360 <union name="FFBBTT">
2361 <first ref="FFBBT"/> <second ref="FiberTop"/>
2362 <position name="ffbbtt" y="24.28875" z="-0.289" unit="cm"/>
2365 <union name="FFBBTTL">
2366 <first ref="FFBBTT"/> <second ref="FiberLeft"/>
2367 <position name="ffbbttl" x="0" y="20.47875" z="-0.4335" unit="cm"/> <rotation name="FiberRotLeft" x="-90" y="90" unit="deg"/>
2370 <union name="FourFibers">
2371 <first ref="FFBBTTL"/> <second ref="FiberRight"/>
2372 <position name="fs4" x="-0.289" y="20.47875" z="0.1445" unit="cm"/> <rotation name="FiberRotRight" x="-90" y="90" unit="deg"/>
2375 <union name="EightFibers">
2376 <first ref="FourFibers"/> <second ref="FourFibers"/>
2377 <position name="fs8" z="-1.2" unit="cm"/>
2380 <union name="SixteenFibers">
2381 <first ref="EightFibers"/> <second ref="EightFibers"/>
2382 <position name="fs16" z="-2.4" unit="cm"/>
2385 <union name="ThirtyTwoFibers">
2386 <first ref="SixteenFibers"/> <second ref="SixteenFibers"/>
2387 <position name="fs32" z="-4.8" unit="cm"/>
2393 # Add APA frames with G10 boards on them
2399 solid_CPA(); # no need for multiple sets of solids, the only 2 CPAs are identical
2402 # Cryostat structure
2407 <volume name="volGaseousArgon">
2408 <materialref ref="ArGas"/>
2409 <solidref ref="GaseousArgon"/>
2412 <volume name="volOpDetSensitive_Bar">
2413 <materialref ref="LAr"/>
2414 <solidref ref="FourBars"/>
2417 <volume name="volOpDetSensitive_Plank">
2418 <materialref ref="LAr"/>
2419 <solidref ref="Plank"/>
2422 <volume name="volOpDetSensitive_Fiber">
2423 <materialref ref="LAr"/>
2424 <solidref ref="ThirtyTwoFibers"/>
2438 <volume name="volCryostat">
2439 <materialref ref="LAr"/>
2440 <solidref ref="Cryostat"/>
2443 <volumeref ref="volGaseousArgon"/>
2444 <position name="posGaseousArgon" unit="cm" x="0" y="$Argon_y/2 - $HeightGaseousAr/2" z="0"/>
2448 <volumeref ref="volCathode"/>
2449 <positionref ref="posCathodeShortDrift"/>
2452 <volumeref ref="volCathode"/>
2453 <positionref ref="posCathodeLongDrift"/>
2459 <!-- The Smallest APA -->
2460 <!-- Note this is the only APA with a readout
2461 at the bottom. TPCs are constructed with
2462 readouts at the top, so rotate the two APAs
2463 180 around X to flip upside down -->
2466 <volumeref ref="volTPCSmallestLongDrift"/>
2467 <positionref ref="posTPCSmallestLongDrift"/>
2468 <rotationref ref="rPlus180AboutX"/>
2472 <volumeref ref="volTPCSmallestShortDrift"/>
2473 <positionref ref="posTPCSmallestShortDrift"/>
2474 <rotationref ref="rPlus180AboutX"/>
2480 place_APA($APACenter[2][0], $APACenter[2][1], $APACenter[2][2], 2);
2485 <!-- The Middle-sized APA -->
2488 <volumeref ref="volTPCMidLongDrift"/>
2489 <positionref ref="posTPCMidLongDrift"/>
2490 <rotationref ref="rIdentity"/>
2494 <volumeref ref="volTPCMidShortDrift"/>
2495 <positionref ref="posTPCMidShortDrift"/>
2496 <rotationref ref="rIdentity"/>
2502 place_APA($APACenter[1][0], $APACenter[1][1], $APACenter[1][2], 1);
2507 <!-- The Largest APAs, Upstream and Downstream -->
2510 <volumeref ref="volTPCLargestLongDriftUpstream"/>
2511 <positionref ref="posTPCLargestLongDrift_Neg"/>
2512 <rotationref ref="rIdentity"/>
2515 <volumeref ref="volTPCLargestShortDriftUpstream"/>
2516 <positionref ref="posTPCLargestShortDrift_Neg"/>
2517 <rotationref ref="rIdentity"/>
2521 <volumeref ref="volTPCLargestLongDriftDownstream"/>
2522 <positionref ref="posTPCLargestLongDrift_Pos"/>
2523 <rotationref ref="rIdentity"/>
2526 <volumeref ref="volTPCLargestShortDriftDownstream"/>
2527 <positionref ref="posTPCLargestShortDrift_Pos"/>
2528 <rotationref ref="rIdentity"/>
2533 place_APA($APACenter[0][0], $APACenter[0][1], $APACenter[0][2], 0);
2534 place_APA($APACenter[3][0], $APACenter[3][1], $APACenter[3][2], 3);
2536 place_CPA(0, $posCPAShortDrift_x, $posCPAShortDrift_y, $posCPAShortDrift_z);
2537 place_CPA(1, $posCPALongDrift_x, $posCPALongDrift_y, $posCPALongDrift_z);
2550 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2551 #++++++++++++++++++++++++++++++++++++++ solid_APA ++++++++++++++++++++++++++++++++++++++++
2552 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2555 # Must be called only within gen_Cryostat(),
2558 # $_[0] = APA number
2559 # convention: 0 is Largest, 1 is Mid, 2 is Smallest
2566 ####################################################################
2567 ################# APA Frame and Paddle Dimensions ##################
2569 $APA_y = $APAFrame_y[$APA_i];
2571 $APAFrameZSide_x = $APAFrame_x;
2572 $APAFrameZSide_y = 4*$inch;
2573 $APAFrameZSide_z = $APAFrame_z;
2575 $APAFrameYSide_x = $APAFrame_x;
2576 $APAFrameYSide_y = $APA_y-2*$APAFrameZSide_y;
2577 $APAFrameYSide_z = 4*$inch;
2579 # Two outer Y supports will sandwich the light paddles
2580 $APAFrameYOuterSupport_x = ($APAFrame_x-$LightPaddle_x)/2;
2581 $APAFrameYOuterSupport_y = $APA_y-2*$APAFrameZSide_y;
2582 $APAFrameYOuterSupport_z = 4*$inch;
2584 $EdgeFrameSteelThickness = 0.12*$inch;
2585 $InnerFrameSteelThickness = 0.062*$inch;
2588 $G10BoardYSide_x = $APAFrame_x;
2589 $G10BoardYSide_y = $APAFrame_y[$APA_i];
2590 $G10BoardYSide_z = $G10thickness;
2592 $G10BoardZSide_x = $APAFrame_x;
2593 $G10BoardZSide_y = $G10thickness;
2594 $G10BoardZSide_z = $APAFrame_z;
2598 <box name="APAFrameYSideHollow\-$APA_i" lunit="cm"
2599 x="$APAFrameYSide_x-2*$EdgeFrameSteelThickness"
2600 y="$APAFrameYSide_y-2*$EdgeFrameSteelThickness"
2601 z="$APAFrameYSide_z"/>
2602 <box name="APAFrameYSideShell\-$APA_i" lunit="cm"
2603 x="$APAFrameYSide_x"
2604 y="$APAFrameYSide_y"
2605 z="$APAFrameYSide_z"/>
2606 <subtraction name="APAFrameYSide\-$APA_i">
2607 <first ref="APAFrameYSideShell\-$APA_i"/>
2608 <second ref="APAFrameYSideHollow\-$APA_i"/>
2609 <positionref ref="posCenter"/>
2610 <rotationref ref="rIdentity"/>
2613 <box name="APAFrameZSideHollow\-$APA_i" lunit="cm"
2614 x="$APAFrameZSide_x-2*$EdgeFrameSteelThickness"
2615 y="$APAFrameZSide_y-2*$EdgeFrameSteelThickness"
2616 z="$APAFrameZSide_z"/>
2617 <box name="APAFrameZSideShell\-$APA_i" lunit="cm"
2618 x="$APAFrameZSide_x"
2619 y="$APAFrameZSide_y"
2620 z="$APAFrameZSide_z"/>
2621 <subtraction name="APAFrameZSide\-$APA_i">
2622 <first ref="APAFrameZSideShell\-$APA_i"/>
2623 <second ref="APAFrameZSideHollow\-$APA_i"/>
2624 <positionref ref="posCenter"/>
2625 <rotationref ref="rIdentity"/>
2628 <box name="APAFrameYOuterSupport\-$APA_i" lunit="cm"
2629 x="$EdgeFrameSteelThickness"
2630 y="$APAFrameYOuterSupport_y"
2631 z="$APAFrameYOuterSupport_z"/>
2634 <box name="G10BoardYSideCenterSeg\-$APA_i" lunit="cm"
2635 x="$G10BoardYSide_x"
2636 y="$G10BoardYSide_y"
2637 z="$G10BoardYSide_z"/>
2639 <box name="G10BoardZSideCenterSeg\-$APA_i" lunit="cm"
2640 x="$G10BoardZSide_x"
2641 y="$G10BoardZSide_y"
2642 z="$G10BoardZSide_z"/>
2652 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2653 #++++++++++++++++++++++++++++++++++++++ vol_APA ++++++++++++++++++++++++++++++++++++++++
2654 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2657 # Must be called only within gen_Cryostat(),
2660 # $_[0] = x APA center
2661 # $_[1] = y APA center
2662 # $_[2] = z APA center
2663 # $_[3] = APA number
2664 # convention: 0 and 3 are Largest, 1 is Mid, 2 is Smallest
2673 <volume name="volAPAFrameYSide\-$APA_i">
2674 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
2675 <solidref ref="APAFrameYSide\-$APA_i"/>
2678 <volume name="volAPAFrameZSide\-$APA_i">
2679 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
2680 <solidref ref="APAFrameZSide\-$APA_i"/>
2683 <volume name="volAPAFrameYOuterSupport\-$APA_i">
2684 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
2685 <solidref ref="APAFrameYOuterSupport\-$APA_i"/>
2688 <volume name="volG10BoardYSideCenterSeg\-$APA_i">
2689 <materialref ref="G10"/>
2690 <solidref ref="G10BoardYSideCenterSeg\-$APA_i"/>
2693 <volume name="volG10BoardZSideCenterSeg\-$APA_i">
2694 <materialref ref="G10"/>
2695 <solidref ref="G10BoardZSideCenterSeg\-$APA_i"/>
2705 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2706 #++++++++++++++++++++++++++++++++++++++ place_APA ++++++++++++++++++++++++++++++++++++++++
2707 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2710 # Must be called only within gen_Cryostat(),
2713 # $_[0] = x APA physical center
2714 # $_[1] = y APA physical center
2715 # $_[2] = z APA physical center
2716 # $_[3] = APA number
2717 # convention: 0 and 3 are Largest, 1 is Mid, 2 is Smallest
2724 ####################################################################
2725 ################# APA Frame and Paddle Dimensions ##################
2727 $APA_y = $APAFrame_y[$APA_i];
2730 # The center passed to this function is the physical APA center,
2731 # which is not quite the frame's center, since there are more boards
2732 # at the bottom. Transform them:
2734 $APAFrameCenter_x = $_[0];
2735 $APAFrameCenter_y = $_[1] - $APAphys_y[$APA_i]/2
2736 + $WrapCover + 4*$G10thickness
2737 + $APAFrame_y[$APA_i]/2;
2738 $APAFrameCenter_z = $_[2];
2740 # the smallest APA is different (upside down)
2743 $APAFrameCenter_y = $_[1] + $APAphys_y[$APA_i]/2
2744 - $WrapCover - 4*$G10thickness
2745 - $APAFrame_y[$APA_i]/2;
2749 $APAFrameZSide_x = $APAFrame_x;
2750 $APAFrameZSide_y = 4*$inch;
2751 $APAFrameZSide_z = $APAFrame_z;
2753 $APAFrameYSide_x = $APAFrame_x;
2754 $APAFrameYSide_y = $APA_y-2*$APAFrameZSide_y;
2755 $APAFrameYSide_z = 4*$inch;
2757 # Two outer Y supports will sandwich the light paddles
2758 $APAFrameYOuterSupport_x = ($APAFrame_x-$LightPaddle_x)/2;
2759 $APAFrameYOuterSupport_y = $APA_y-2*$APAFrameZSide_y;
2760 $APAFrameYOuterSupport_z = 4*$inch;
2762 # if there were an inner support to fill the hole
2763 $APAFrameYInnerSupport_x = $LightPaddle_x;
2765 $EdgeFrameSteelThickness = 0.12*$inch;
2766 $InnerFrameSteelThickness = 0.062*$inch;
2769 $G10BoardYSide_x = $APAFrame_x;
2770 $G10BoardYSide_y = $APAFrame_y[$APA_i];
2771 $G10BoardYSide_z = $G10thickness;
2773 $G10BoardZSide_x = $APAFrame_x;
2774 $G10BoardZSide_y = $G10thickness;
2775 $G10BoardZSide_z = $APAFrame_z;
2777 $posG10ZSideZ_y = $APAFrameCenter_y - $APAFrame_y[$APA_i]/2 - (0+.5)*($G10BoardZSide_y);
2778 $posG10ZSideV_y = $APAFrameCenter_y - $APAFrame_y[$APA_i]/2 - (1+.5)*($G10BoardZSide_y);
2779 $posG10ZSideU_y = $APAFrameCenter_y - $APAFrame_y[$APA_i]/2 - (2+.5)*($G10BoardZSide_y);
2780 $posG10ZSideGrid_y = $APAFrameCenter_y - $APAFrame_y[$APA_i]/2 - (3+.5)*($G10BoardZSide_y);
2782 # ... but the smallest APA is upside-down, so put the G10 boards at the top in that case
2785 $posG10ZSideZ_y = $APAFrameCenter_y + $APAFrame_y[$APA_i]/2 + (0+.5)*($G10BoardZSide_y);
2786 $posG10ZSideV_y = $APAFrameCenter_y + $APAFrame_y[$APA_i]/2 + (1+.5)*($G10BoardZSide_y);
2787 $posG10ZSideU_y = $APAFrameCenter_y + $APAFrame_y[$APA_i]/2 + (2+.5)*($G10BoardZSide_y);
2788 $posG10ZSideGrid_y = $APAFrameCenter_y + $APAFrame_y[$APA_i]/2 + (3+.5)*($G10BoardZSide_y);
2791 # First put in the frame
2801 <volumeref ref="volAPAFrameYOuterSupport\-$APA_i"/>
2802 <position name="posAPAFrameYOuterSupportNeg\-$APA_i" unit="cm"
2803 x="$APAFrameCenter_x - ($APAFrameYOuterSupport_x + $APAFrameYInnerSupport_x/2 - $EdgeFrameSteelThickness/2)"
2804 y="$APAFrameCenter_y"
2805 z="$APAFrameCenter_z"/>
2806 <rotationref ref="rIdentity"/>
2809 <volumeref ref="volAPAFrameYOuterSupport\-$APA_i"/>
2810 <position name="posAPAFrameYOuterSupportPos\-$APA_i" unit="cm"
2811 x="$APAFrameCenter_x + ($APAFrameYOuterSupport_x + $APAFrameYInnerSupport_x/2 - $EdgeFrameSteelThickness/2)"
2812 y="$APAFrameCenter_y"
2813 z="$APAFrameCenter_z"/>
2814 <rotationref ref="rIdentity"/>
2819 <volumeref ref="volAPAFrameYSide\-$APA_i"/>
2820 <position name="posAPAFrameYSideNeg\-$_[3]" unit="cm"
2821 x="$APAFrameCenter_x"
2822 y="$APAFrameCenter_y"
2823 z="$APAFrameCenter_z - $APAFrame_z/2 + $APAFrameYSide_z/2"/>
2824 <rotationref ref="rIdentity"/>
2827 <volumeref ref="volAPAFrameYSide\-$APA_i"/>
2828 <position name="posAPAFrameYSidePos\-$_[3]" unit="cm"
2829 x="$APAFrameCenter_x"
2830 y="$APAFrameCenter_y"
2831 z="$APAFrameCenter_z + $APAFrame_z/2 - $APAFrameYSide_z/2"/>
2832 <rotationref ref="rIdentity"/>
2835 <volumeref ref="volAPAFrameZSide\-$APA_i"/>
2836 <position name="posAPAFrameZSidePos\-$_[3]" unit="cm"
2837 x="$APAFrameCenter_x"
2838 y="$APAFrameCenter_y + $APAFrame_y[$APA_i]/2 - $APAFrameZSide_y/2"
2839 z="$APAFrameCenter_z"/>
2840 <rotationref ref="rIdentity"/>
2843 <volumeref ref="volAPAFrameZSide\-$APA_i"/>
2844 <position name="posAPAFrameZSideNeg\-$_[3]" unit="cm"
2845 x="$APAFrameCenter_x"
2846 y="$APAFrameCenter_y - $APAFrame_y[$APA_i]/2 + $APAFrameZSide_y/2"
2847 z="$APAFrameCenter_z"/>
2848 <rotationref ref="rIdentity"/>
2852 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2853 - Add the *parts* of the G10 boards that exist directly in volCryostat.
2854 - There are two boards on each the up and downstream end,
2855 one each to wrap the U and V views around the APA frame
2856 - There are 4 on the bottom which anchor the U V and Z wires and the grid plane
2857 - The rest of the parts of the G10 boards must be placed directly in volTPC -->
2860 <volumeref ref="volG10BoardYSideCenterSeg\-$APA_i"/>
2861 <position name="posG10BoardYSideCenterSeg\-Vup\-$APA_i" unit="cm"
2862 x="$APAFrameCenter_x"
2863 y="$APAFrameCenter_y"
2864 z="$APAFrameCenter_z - $APAFrame_z/2 - (0+.5)*($G10BoardYSide_z)"/>
2865 <rotationref ref="rIdentity"/>
2868 <volumeref ref="volG10BoardYSideCenterSeg\-$APA_i"/>
2869 <position name="posG10BoardYSideCenterSeg\-Uup\-$APA_i" unit="cm"
2870 x="$APAFrameCenter_x"
2871 y="$APAFrameCenter_y"
2872 z="$APAFrameCenter_z - $APAFrame_z/2 - (1+.5)*($G10BoardYSide_z)"/>
2873 <rotationref ref="rIdentity"/>
2877 <volumeref ref="volG10BoardYSideCenterSeg\-$APA_i"/>
2878 <position name="posG10BoardYSideCenterSeg\-Vdown\-$APA_i" unit="cm"
2879 x="$APAFrameCenter_x"
2880 y="$APAFrameCenter_y"
2881 z="$APAFrameCenter_z + $APAFrame_z/2 + (0+.5)*($G10BoardYSide_z)"/>
2882 <rotationref ref="rIdentity"/>
2885 <volumeref ref="volG10BoardYSideCenterSeg\-$APA_i"/>
2886 <position name="posG10BoardYSideCenterSeg\-Udown\-$APA_i" unit="cm"
2887 x="$APAFrameCenter_x"
2888 y="$APAFrameCenter_y"
2889 z="$APAFrameCenter_z + $APAFrame_z/2 + (1+.5)*($G10BoardYSide_z)"/>
2890 <rotationref ref="rIdentity"/>
2894 <volumeref ref="volG10BoardZSideCenterSeg\-$APA_i"/>
2895 <position name="posG10BoardZSideCenterSeg\-Z\-$APA_i" unit="cm"
2896 x="$APAFrameCenter_x"
2898 z="$APAFrameCenter_z"/>
2899 <rotationref ref="rIdentity"/>
2902 <volumeref ref="volG10BoardZSideCenterSeg\-$APA_i"/>
2903 <position name="posG10BoardZSideCenterSeg\-V\-$APA_i" unit="cm"
2904 x="$APAFrameCenter_x"
2906 z="$APAFrameCenter_z"/>
2907 <rotationref ref="rIdentity"/>
2910 <volumeref ref="volG10BoardZSideCenterSeg\-$APA_i"/>
2911 <position name="posG10BoardZSideCenterSeg\-U\-$APA_i" unit="cm"
2912 x="$APAFrameCenter_x"
2914 z="$APAFrameCenter_z"/>
2915 <rotationref ref="rIdentity"/>
2918 <volumeref ref="volG10BoardZSideCenterSeg\-$APA_i"/>
2919 <position name="posG10BoardZSideCenterSeg\-Grid\-$APA_i" unit="cm"
2920 x="$APAFrameCenter_x"
2921 y="$posG10ZSideGrid_y"
2922 z="$APAFrameCenter_z"/>
2923 <rotationref ref="rIdentity"/>
2931 # Now loop through paddle y positions and place them
2932 #for( $p=0; $p<$nPaddlesInAPA[$APA_i]; $p++ ){
2934 #if($nPaddlesInAPA[$APA_i]!=1)
2939 # <volumeref ref="volOpDetSensitive"/>
2940 # <position name="posPaddle\-$p\-APA\-$APA_i" unit="cm"
2941 # x="$APAFrameCenter_x"
2942 # y="$APAFrameCenter_y - $APAHeight[$APA_i]/2 + $PaddleYPositions[$APA_i][$p]"
2943 # z="$APAFrameCenter_z"/>
2944 # <rotationref ref="rIdentity"/>
2950 case 0 { place_bar(2);
2953 case 1 { place_bar(1); }
2954 case 2 { place_fiber(1); }
2955 case 3 { place_bar(4);
2968 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2969 #++++++++++++++++++++++++++++++++++++++ solid_CPA +++++++++++++++++++++++++++++++++++++
2970 #++++++++++++++++++++++++++++++++++++++++ vol_CPA +++++++++++++++++++++++++++++++++++++
2971 #++++++++++++++++++++++++++++++++++++++ place_CPA +++++++++++++++++++++++++++++++++++++
2972 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2974 # Must be called only within gen_Cryostat(),
2983 <box name="Cathode" lunit="cm"
2988 <tube name="CPATubeYSide"
2996 <tube name="CPATubeZSide"
3014 <volume name="volCathode">
3015 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
3016 <solidref ref="Cathode"/>
3018 <volume name="volCPATubeYSide">
3019 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
3020 <solidref ref="CPATubeYSide"/>
3022 <volume name="volCPATubeZSide">
3023 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
3024 <solidref ref="CPATubeZSide"/>
3037 $cpaCenter_x = $_[1];
3038 $cpaCenter_y = $_[2];
3039 $cpaCenter_z = $_[3];
3045 <volumeref ref="volCathode"/>
3046 <position name="posCathode\-$cpa" unit="cm"
3047 x="$cpaCenter_x - $Cathode_x/2"
3050 <rotationref ref="rIdentity"/>
3054 Curious... The CPATube_OD used here should be CPATube_OD/2,
3055 but that causes a baffling overlap. look into later!
3059 <volumeref ref="volCPATubeYSide"/>
3060 <position name="posCPATubeYSideUp\-$cpa" unit="cm"
3063 z="$cpaCenter_z - $Cathode_z/2 - $CPATube_OD"/>
3064 <rotationref ref="rPlus90AboutX"/>
3067 <volumeref ref="volCPATubeYSide"/>
3068 <position name="posCPATubeYSideDown\-$cpa" unit="cm"
3071 z="$cpaCenter_z + $Cathode_z/2 + $CPATube_OD"/>
3072 <rotationref ref="rPlus90AboutX"/>
3076 <volumeref ref="volCPATubeZSide"/>
3077 <position name="posCPATubeZSideBottom\-$cpa" unit="cm"
3079 y="$cpaCenter_y - $Cathode_y/2 - $CPATube_OD"
3081 <rotationref ref="rIdentity"/>
3084 <volumeref ref="volCPATubeZSide"/>
3085 <position name="posCPATubeZSideTop\-$cpa" unit="cm"
3087 y="$cpaCenter_y + $Cathode_y/2 + $CPATube_OD"
3089 <rotationref ref="rIdentity"/>
3102 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3103 #+++++++++++++++++++++++++++++++++++++ gen_Enclosure +++++++++++++++++++++++++++++++++++++
3104 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3109 # Create the detector enclosure fragment file name,
3110 # add file to list of output GDML fragments,
3112 $ENCL = "35t_DetEnclosure" . $suffix . ".gdml";
3113 push (@gdmlFiles, $ENCL);
3114 $ENCL = ">" . $ENCL;
3115 open(ENCL) or die("Could not open file $ENCL for writing");
3118 # The standard XML prefix and starting the gdml
3120 <?xml version='1.0'?>
3126 $TopSteelShell_x = $Argon_x - $NeckInside_x;
3128 $FoamSouth_y = $Argon_y + $NeckInside_y + 2*$SteelShellThickness;
3129 $FoamTop_x = $Argon_x - $NeckInside_x;
3130 $NeckConcreteShell_x = $TotalPadding + 2*$SteelShellThickness + $NeckInside_x + $FoamPadding;
3132 $TrenchTopConcrete_x = ($DetEnc_x - $CryoWithPadding_x)/2;
3134 # All the detector enclosure solids.
3138 <box name="DetEnclosure" lunit="cm"
3143 <trd name="AuxDetTrap" lunit="cm"
3144 x1="$AuxDetScintillatorLongSide" x2="$AuxDetScintillatorShortSide"
3145 y1="$AuxDetScintillatorThickness" y2="$AuxDetScintillatorThickness"
3146 z="$AuxDetScintillatorHeight"/>
3148 <box name="TrenchBottomConcrete" lunit="cm"
3152 <box name="TrenchBottomConcreteSubtract" lunit="cm"
3154 y="$DetEnc_y - $TrenchWallThickness"
3155 z="$DetEnc_z - 2*$TrenchWallThickness"/>
3156 <subtraction name="TrenchBottomConcreteShell">
3157 <first ref="TrenchBottomConcrete"/>
3158 <second ref="TrenchBottomConcreteSubtract"/>
3159 <position name="posHoleInTrench" unit="cm" x="0" y="$TrenchWallThickness/2" z="0"/>
3162 <box name="TrenchTopConcrete" lunit="cm"
3163 x="$TrenchTopConcrete_x"
3164 y="$TrenchWallThickness"
3165 z="$DetEnc_z - 2*$TrenchWallThickness"/>
3168 <box name="BottomSteel" lunit="cm"
3169 x="$Cryostat_x + 2*$SteelShellThickness"
3170 y="$Cryostat_y + $SteelShellThickness"
3171 z="$Cryostat_z + 2*$SteelShellThickness"/>
3172 <subtraction name="BottomSteelShell">
3173 <first ref="BottomSteel"/>
3174 <second ref="Cryostat"/>
3175 <position name="posLArInShell" unit="cm" x="0" y="$SteelShellThickness/2" z="0"/>
3179 <box name="Neck" lunit="cm"
3180 x="$NeckInside_x + 2*$SteelShellThickness"
3181 y="$NeckInside_y + $SteelShellThickness"
3182 z="$Cryostat_z + 2*$SteelShellThickness"/>
3183 <box name="NeckArgon" lunit="cm"
3187 <subtraction name="NeckSteelShell">
3189 <second ref="NeckArgon"/>
3190 <position name="posLArInNeckShell" unit="cm" x="0" y="-$SteelShellThickness/2" z="0"/>
3194 <box name="TopSteelShell" lunit="cm"
3195 x="$TopSteelShell_x"
3196 y="$SteelShellThickness"
3197 z="$Cryostat_z + 2*$SteelShellThickness"/>
3200 <box name="FoamSouth" lunit="cm"
3203 z="$Argon_z + 2*$SteelShellThickness + 2*$FoamPadding"/>
3205 <box name="FoamNorth" lunit="cm"
3207 y="$Argon_y + 2*$SteelShellThickness"
3208 z="$Argon_z + 2*$SteelShellThickness + 2*$FoamPadding"/>
3210 <box name="FoamEastWest" lunit="cm"
3211 x="$Argon_x + 2*$SteelShellThickness"
3212 y="$Argon_y + 2*$SteelShellThickness"
3215 <box name="FoamEastWestNeck" lunit="cm"
3216 x="$NeckInside_x + 2*$SteelShellThickness"
3217 y="$NeckInside_y + $SteelShellThickness"
3220 <box name="FoamBottom" lunit="cm"
3221 x="$Argon_x + 2*$SteelShellThickness + 2*$FoamPadding"
3223 z="$Argon_z + 2*$SteelShellThickness + 2*$FoamPadding"/>
3225 <box name="FoamTop" lunit="cm"
3228 z="$Argon_z + 2*$SteelShellThickness + 2*$FoamPadding"/>
3230 <box name="FoamNorthNeck" lunit="cm"
3233 z="$Argon_z + 2*$SteelShellThickness + 2*$FoamPadding"/>
3236 <box name="BottomConcrete" lunit="cm"
3237 x="$Argon_x + 2*($SteelShellThickness+$FoamPadding) + 2*$ConcretePadding"
3238 y="$Argon_y + 2*($SteelShellThickness+$FoamPadding) + $ConcretePadding"
3239 z="$Argon_z + 2*($SteelShellThickness+$FoamPadding) + 2*$ConcretePadding"/>
3240 <box name="BottomConcreteSubtract" lunit="cm"
3241 x="$Argon_x + 2*($SteelShellThickness+$FoamPadding)"
3242 y="$Argon_y + 2*($SteelShellThickness+$FoamPadding)"
3243 z="$Argon_z + 2*($SteelShellThickness+$FoamPadding)"/>
3244 <subtraction name="BottomConcreteShell">
3245 <first ref="BottomConcrete"/>
3246 <second ref="BottomConcreteSubtract"/>
3247 <position name="posHoleInConcrete" unit="cm" x="0" y="$ConcretePadding/2" z="0"/>
3251 <box name="NeckConcrete" lunit="cm"
3252 x="$NeckConcreteShell_x"
3253 y="$NeckInside_y + $SteelShellThickness - $FoamPadding"
3254 z="$Cryostat_z + 2*($SteelShellThickness+$FoamPadding) + 2*$ConcretePadding"/>
3255 <box name="NeckConcreteSubtract" lunit="cm"
3256 x="$NeckInside_x + 2*($SteelShellThickness+$FoamPadding)"
3257 y="$NeckInside_y + $SteelShellThickness - $FoamPadding"
3258 z="$Cryostat_z + 2*($SteelShellThickness+$FoamPadding)"/>
3259 <subtraction name="NeckConcreteShell">
3260 <first ref="NeckConcrete"/>
3261 <second ref="NeckConcreteSubtract"/>
3262 <position name="posHoleInNeckConcrete" unit="cm" x="-$ConcretePadding/2" y="0" z="0"/>
3272 # Detector enclosure structure
3276 <volume name="volBotSteelShell">
3277 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
3278 <solidref ref="BottomSteelShell"/>
3281 <volume name="volTopSteelShell">
3282 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
3283 <solidref ref="TopSteelShell"/>
3286 <volume name="volNeckSteelShell">
3287 <materialref ref="STEEL_STAINLESS_Fe7Cr2Ni"/>
3288 <solidref ref="NeckSteelShell"/>
3291 <volume name="volNeck">
3292 <materialref ref="ArGas"/>
3293 <solidref ref="Neck"/>
3295 <volumeref ref="volNeckSteelShell"/>
3296 <position name="posNeckSteelShell" unit="cm" x="0" y="0" z="0"/>
3301 <volume name="volFoamSouth">
3302 <materialref ref="polyurethane_foam"/>
3303 <solidref ref="FoamSouth"/>
3305 <volume name="volFoamNorth">
3306 <materialref ref="polyurethane_foam"/>
3307 <solidref ref="FoamNorth"/>
3309 <volume name="volFoamEastWest">
3310 <materialref ref="polyurethane_foam"/>
3311 <solidref ref="FoamEastWest"/>
3313 <volume name="volFoamEastWestNeck">
3314 <materialref ref="polyurethane_foam"/>
3315 <solidref ref="FoamEastWestNeck"/>
3317 <volume name="volFoamBottom">
3318 <materialref ref="polyurethane_foam"/>
3319 <solidref ref="FoamBottom"/>
3321 <volume name="volFoamTop">
3322 <materialref ref="polyurethane_foam"/>
3323 <solidref ref="FoamTop"/>
3325 <volume name="volFoamNorthNeck">
3326 <materialref ref="polyurethane_foam"/>
3327 <solidref ref="FoamNorthNeck"/>
3330 <volume name="volBottomConcreteShell">
3331 <materialref ref="Concrete"/>
3332 <solidref ref="BottomConcreteShell"/>
3334 <volume name="volNeckConcreteShell">
3335 <materialref ref="Concrete"/>
3336 <solidref ref="NeckConcreteShell"/>
3339 <volume name="volTrenchBottomConcreteShell">
3340 <materialref ref="Concrete"/>
3341 <solidref ref="TrenchBottomConcreteShell"/>
3343 <volume name="volTrenchTopConcrete">
3344 <materialref ref="Concrete"/>
3345 <solidref ref="TrenchTopConcrete"/>
3349 for($i = 1; $i <= 13; ++$i){
3351 <volume name="volAuxDetBoxBSU-L1-$i" >
3352 <materialref ref="Acrylic"/>
3353 <solidref ref="AuxDetBoxBSU"/>
3357 for($i = 1; $i <= 10; ++$i){
3359 <volume name="volAuxDetBoxBSU-L2-$i" >
3360 <materialref ref="Acrylic"/>
3361 <solidref ref="AuxDetBoxBSU"/>
3365 for($i = 1; $i <= 16; ++$i){
3367 <volume name="volAuxDetBoxBSU-L3-$i" >
3368 <materialref ref="Acrylic"/>
3369 <solidref ref="AuxDetBoxBSU"/>
3373 for($i = 1; $i <= 10; ++$i){
3375 <volume name="volAuxDetBoxBSU-L4-$i" >
3376 <materialref ref="Acrylic"/>
3377 <solidref ref="AuxDetBoxBSU"/>
3382 for ($i=1; $i<=12; ++$i) {
3384 <volume name="volAuxDetTrap-South-$i" >
3385 <materialref ref="Acrylic"/>
3386 <solidref ref="AuxDetTrap"/>
3388 <volume name="volAuxDetTrap-North-$i" >
3389 <materialref ref="Acrylic"/>
3390 <solidref ref="AuxDetTrap"/>
3394 for ($i=1; $i<=10; ++$i) {
3396 <volume name="volAuxDetTrap-East-$i" >
3397 <materialref ref="Acrylic"/>
3398 <solidref ref="AuxDetTrap"/>
3400 <volume name="volAuxDetTrap-West-$i" >
3401 <materialref ref="Acrylic"/>
3402 <solidref ref="AuxDetTrap"/>
3408 <volume name="volDetEnclosure">
3409 <materialref ref="Air"/>
3410 <solidref ref="DetEnclosure"/>
3413 <volumeref ref="volCryostat"/>
3414 <position name="posCryo" unit="cm" x="$posCryoInDetEnc_x" y="$posCryoInDetEnc_y" z="$posCryoInDetEnc_z"/>
3418 <volumeref ref="volNeck"/>
3419 <position name="posNeck" unit="cm"
3420 x="$posCryoInDetEnc_x + $Argon_x/2 - $NeckInside_x/2"
3421 y="$posCryoInDetEnc_y + $Argon_y/2 + ($NeckInside_y + $SteelShellThickness)/2"
3422 z="$posCryoInDetEnc_z"/>
3425 <volumeref ref="volTopSteelShell"/>
3426 <position name="posTopSteelShell" unit="cm"
3427 x="$posCryoInDetEnc_x - $Argon_x/2 - $SteelShellThickness + $TopSteelShell_x/2"
3428 y="$posCryoInDetEnc_y + $Argon_y/2 + $SteelShellThickness/2"
3429 z="$posCryoInDetEnc_z"/>
3432 <volumeref ref="volBotSteelShell"/>
3433 <position name="posBotSteelShell" unit="cm"
3434 x="$posCryoInDetEnc_x"
3435 y="$posCryoInDetEnc_y - $SteelShellThickness/2"
3436 z="$posCryoInDetEnc_z"/>
3441 <volumeref ref="volFoamSouth"/>
3442 <position name="posFoamSouth" unit="cm"
3443 x="$posCryoInDetEnc_x + $Argon_x/2 + $SteelShellThickness + $FoamPadding/2"
3444 y="$posCryoInDetEnc_y - $Argon_y/2 - $SteelShellThickness + $FoamSouth_y/2"
3445 z="$posCryoInDetEnc_z"/>
3448 <volumeref ref="volFoamNorth"/>
3449 <position name="posFoamNorth" unit="cm"
3450 x="$posCryoInDetEnc_x - $Argon_x/2 - $SteelShellThickness - $FoamPadding/2"
3451 y="$posCryoInDetEnc_y"
3452 z="$posCryoInDetEnc_z"/>
3455 <volumeref ref="volFoamEastWest"/>
3456 <position name="posFoamEast" unit="cm"
3457 x="$posCryoInDetEnc_x"
3458 y="$posCryoInDetEnc_y"
3459 z="$posCryoInDetEnc_z - $Argon_z/2 - $SteelShellThickness - $FoamPadding/2"/>
3462 <volumeref ref="volFoamEastWest"/>
3463 <position name="posFoamWest" unit="cm"
3464 x="$posCryoInDetEnc_x"
3465 y="$posCryoInDetEnc_y"
3466 z="$posCryoInDetEnc_z + $Argon_z/2 + $SteelShellThickness + $FoamPadding/2"/>
3469 <volumeref ref="volFoamEastWestNeck"/>
3470 <position name="posFoamEastNeck" unit="cm"
3471 x="$posCryoInDetEnc_x + $Argon_x/2 - $NeckInside_x/2"
3472 y="$posCryoInDetEnc_y + $Argon_y/2 + ($NeckInside_y + $SteelShellThickness)/2"
3473 z="$posCryoInDetEnc_z - $Argon_z/2 - $SteelShellThickness - $FoamPadding/2"/>
3476 <volumeref ref="volFoamEastWestNeck"/>
3477 <position name="posFoamWestNeck" unit="cm"
3478 x="$posCryoInDetEnc_x + $Argon_x/2 - $NeckInside_x/2"
3479 y="$posCryoInDetEnc_y + $Argon_y/2 + ($NeckInside_y + $SteelShellThickness)/2"
3480 z="$posCryoInDetEnc_z + $Argon_z/2 + $SteelShellThickness + $FoamPadding/2"/>
3483 <volumeref ref="volFoamBottom"/>
3484 <position name="posFoamBottom" unit="cm"
3485 x="$posCryoInDetEnc_x"
3486 y="$posCryoInDetEnc_y - $Argon_y/2 - $SteelShellThickness - $FoamPadding/2"
3487 z="$posCryoInDetEnc_z"/>
3490 <volumeref ref="volFoamTop"/>
3491 <position name="posFoamTop" unit="cm"
3492 x="$posCryoInDetEnc_x - $Argon_x/2 - $SteelShellThickness - $FoamPadding + $FoamTop_x/2"
3493 y="$posCryoInDetEnc_y + $Argon_y/2 + $SteelShellThickness + $FoamPadding/2"
3494 z="$posCryoInDetEnc_z"/>
3497 <volumeref ref="volFoamNorthNeck"/>
3498 <position name="posFoamNorthNeck" unit="cm"
3499 x="$posCryoInDetEnc_x + $Argon_x/2 - $NeckInside_x - $SteelShellThickness - $FoamPadding/2"
3500 y="$posCryoInDetEnc_y + $Argon_y/2 + $SteelShellThickness + $NeckInside_y/2"
3501 z="$posCryoInDetEnc_z"/>
3506 <volumeref ref="volBottomConcreteShell"/>
3507 <position name="posBottomConcreteShell" unit="cm"
3508 x="$posCryoInDetEnc_x"
3509 y="$posCryoInDetEnc_y - $ConcretePadding/2"
3510 z="$posCryoInDetEnc_z"/>
3513 <volumeref ref="volNeckConcreteShell"/>
3514 <position name="posNeckConcreteShell" unit="cm"
3515 x="$posCryoInDetEnc_x + $Argon_x/2 +$SteelShellThickness + $TotalPadding - $NeckConcreteShell_x/2"
3516 y="$posCryoInDetEnc_y + $Argon_y/2 + $FoamPadding + ($NeckInside_y + $SteelShellThickness - $FoamPadding)/2"
3517 z="$posCryoInDetEnc_z"/>
3523 <volumeref ref="volTrenchBottomConcreteShell"/>
3524 <position name="posTrenchConcrete" unit="cm" x="0" y="0" z="0"/>
3526 <!-- Concrete is too heavy for the roof
3528 <volumeref ref="volTrenchTopConcrete"/>
3529 <position name="posTrenchConcreteTop_Pos" unit="cm"
3530 x=" + $DetEnc_x/2 - $TrenchTopConcrete_x/2"
3531 y="$DetEnc_y/2 - $TrenchWallThickness/2"
3535 <volumeref ref="volTrenchTopConcrete"/>
3536 <position name="posTrenchConcreteTop_Neg" unit="cm"
3537 x=" - $DetEnc_x/2 + $TrenchTopConcrete_x/2"
3538 y="$DetEnc_y/2 - $TrenchWallThickness/2"
3547 # place the 12 North Wall AuxDets
3548 #$NorthWallInt_z = ((95+108)/2 - (35+48)/2)*$inch/5;
3549 $NorthWallInt_z = ( 274.32-(274.32-213.36)/4 - (88.9+121.92)/2 )/5;
3550 # these numbers from a spreadsheet emailed by Ohana Rodrigues
3551 for ($i=1; $i<=12; ++$i)
3553 #$FromCryoCorner_z = (35+48)/2*$inch + (($i-1) % 6)*$NorthWallInt_z;
3554 $FromCryoCorner_z = (88.9+121.92)/2 + (($i-1) % 6)*$NorthWallInt_z;
3556 $rotation = "rAuxDetNSWallUp";
3557 if($i>6) { $FromCryoCorner_y = (259.08 + 0.12*$inch) + $AuxDetScintillatorHeight/2; }
3558 else { $FromCryoCorner_y = (66.04 + 0.12*$inch) + $AuxDetScintillatorHeight/2; }
3561 $rotation = "rAuxDetNSWallDown";
3562 if($i>6) { $FromCryoCorner_y = (325.12 - 0.12*$inch) - $AuxDetScintillatorHeight/2; }
3563 else { $FromCryoCorner_y = (132.08 - 0.12*$inch) - $AuxDetScintillatorHeight/2; }
3566 $posAuxDet_y = $posCryoInDetEnc_y - 375.92/2 + $FromCryoCorner_y;
3570 <volumeref ref="volAuxDetTrap-North-$i"/>
3571 <position name="posAuxDet-North-$i" unit="cm"
3572 x=" $posCryoInDetEnc_x - $CryoWithPadding_x/2 - $AuxDetHousingThickness/2"
3574 z=" $posCryoInDetEnc_z - 411.99/2 + $FromCryoCorner_z"/>
3575 <rotationref ref="$rotation"/>
3581 # place the 12 South Wall AuxDets
3582 #$SouthWallInt_z = ((96.5+109.6)/2 - (36.8+49.5)/2)*$inch/5;
3583 $SouthWallInt_z = ( (245.11+278.38)/2 - (93.47+(153.67-93.47)/4) )/5;
3584 # these numbers from a spreadsheet emailed by Ohana Rodrigues
3585 for ($i=1; $i<=12; ++$i)
3587 #$FromCryoCorner_z = (96.5+109.6)/2*$inch - (($i-1) % 6)*$SouthWallInt_z;
3588 $FromCryoCorner_z = (245.11+278.38)/2 - (($i-1) % 6)*$SouthWallInt_z;
3590 $rotation = "rAuxDetNSWallUp";
3591 if($i>6) { $FromCryoCorner_y = (272.11 + 0.12*$inch) + $AuxDetScintillatorHeight/2; }
3592 else { $FromCryoCorner_y = (31.5 + 0.12*$inch) + $AuxDetScintillatorHeight/2; }
3595 $rotation = "rAuxDetNSWallDown";
3596 if($i>6) { $FromCryoCorner_y = (335.61 - 0.12*$inch) - $AuxDetScintillatorHeight/2; }
3597 else { $FromCryoCorner_y = (93.98 - 0.12*$inch) - $AuxDetScintillatorHeight/2; }
3600 $posAuxDet_y = $posCryoInDetEnc_y - 375.92/2 + $FromCryoCorner_y;
3604 <volumeref ref="volAuxDetTrap-South-$i"/>
3605 <position name="posAuxDet-South-$i" unit="cm"
3606 x=" $posCryoInDetEnc_x + $CryoWithPadding_x/2 + $AuxDetHousingThickness/2"
3608 z=" $posCryoInDetEnc_z - 411.99/2 + $FromCryoCorner_z"/>
3609 <rotationref ref="$rotation"/>
3615 # place the 10 East Wall AuxDets
3616 #$EastWallInt_x = ((136.7+149.9)/2 - (28.4+41.4)/2)*$inch/9;
3617 $EastWallInt_x = ( (347.48+380.75)/2 - (72.14+(133.1-72.14)/4) )/9;
3618 # these numbers from a spreadsheet emailed by Ohana Rodrigues
3619 for ($i=1; $i<=10; ++$i)
3622 # +6cm shift (towards the south wall) as requested by Michelle Stancari
3623 $FromCryoCorner_x = (347.48+380.75)/2 - ($i-1)*$EastWallInt_x + 6;
3624 if($i%2==1){ $rotation = "rAuxDetEWWallUp";
3625 $FromCryoCorner_y = ( 47 + 0.12*$inch) + $AuxDetScintillatorHeight/2; }
3626 else { $rotation = "rAuxDetEWWallDown";
3627 $FromCryoCorner_y = (112.45 - 0.12*$inch) - $AuxDetScintillatorHeight/2; }
3629 $posAuxDet_y = $posCryoInDetEnc_y - 375.92/2 + $FromCryoCorner_y;
3633 <volumeref ref="volAuxDetTrap-East-$i"/>
3634 <position name="posAuxDet-East-$i" unit="cm"
3635 x=" $posCryoInDetEnc_x - 541.53/2 + $FromCryoCorner_x"
3637 z=" $posCryoInDetEnc_z - $CryoWithPadding_z/2 - $AuxDetHousingThickness/2"/>
3638 <rotationref ref="$rotation"/>
3645 # place the 10 West Wall AuxDets
3646 #$WestWallInt_x = ((134+147)/2 - (26.3+39.3)/2)*$inch/9;
3647 $WestWallInt_x = ( (344.42+312.42)/2 - (66.37+99.82)/2 )/8;
3648 # these numbers from a spreadsheet emailed by Ohana Rodrigues
3649 for ($i=1; $i<=10; ++$i)
3652 # +6cm shift (towards the south wall) as requested by Michelle Stancari
3653 $FromCryoCorner_x = (66.11+99.82)/2 + ($i-1)*$WestWallInt_x + 6;
3654 if($i%2==1){ $rotation = "rAuxDetEWWallUp";
3655 $FromCryoCorner_y = (264.44 + 0.12*$inch) + $AuxDetScintillatorHeight/2 }
3656 else { $rotation = "rAuxDetEWWallDown";
3657 $FromCryoCorner_y = (329.95 - 0.12*$inch) - $AuxDetScintillatorHeight/2 }
3659 $posAuxDet_y = $posCryoInDetEnc_y - 375.92/2 + $FromCryoCorner_y;
3663 <volumeref ref="volAuxDetTrap-West-$i"/>
3664 <position name="posAuxDet-West-$i" unit="cm"
3665 x=" $posCryoInDetEnc_x - 541.53/2 + $FromCryoCorner_x"
3667 z=" $posCryoInDetEnc_z + $CryoWithPadding_z/2 + $AuxDetHousingThickness/2"/>
3668 <rotationref ref="$rotation"/>
3674 # place the 13 Layer 1 telescope counters
3675 for ($i=1; $i<=13; ++$i)
3679 <volumeref ref="volAuxDetBoxBSU-L1-$i"/>
3680 <position name="posAuxDet-BSU-L1-$i" unit="cm"
3681 x="$BSULayer1_xpos[$i-1] - $OriginXSet"
3682 y="$BSULayer1_ypos - $OriginYSet"
3683 z="$BSULayer1_zpos - $OriginZSet"/>
3688 # place the 9 Layer 2 telescope counters
3689 for ($i=1; $i<=10; ++$i)
3693 <volumeref ref="volAuxDetBoxBSU-L2-$i"/>
3694 <position name="posAuxDet-BSU-L2-$i" unit="cm"
3695 x="$BSULayer2_xpos - $OriginXSet"
3696 y="$BSULayer2_ypos - $OriginYSet"
3697 z="$BSULayer2_zpos[$i-1] - $OriginZSet"/>
3698 <rotationref ref="rPlus90AboutY"/>
3716 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3717 #+++++++++++++++++++++++++++++++++++++++ gen_World +++++++++++++++++++++++++++++++++++++++
3718 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3723 # Create the WORLD fragment file name,
3724 # add file to list of output GDML fragments,
3726 $WORLD = "35t_World" . $suffix . ".gdml";
3727 push (@gdmlFiles, $WORLD);
3728 $WORLD = ">" . $WORLD;
3729 open(WORLD) or die("Could not open file $WORLD for writing");
3732 # The standard XML prefix and starting the gdml
3734 <?xml version='1.0'?>
3738 $Dirt_y = $OriginYSet + $World_y/2 + $DetEnc_y/2;
3740 # All the World solids.
3743 <box name="World" lunit="cm"
3748 <box name="AuxDetBoxBSU" lunit="cm"
3749 x="$AuxDetBSUScintWidth"
3750 y="$AuxDetBSUScintHeight"
3751 z="$AuxDetBSUScintLength"/>
3753 <box name="DirtBlock" lunit="cm"
3757 <subtraction name="DirtWithHole">
3758 <first ref="DirtBlock"/>
3759 <second ref="DetEnclosure"/>
3760 <position name="posHoleInDirt" unit="cm"
3762 y="$Dirt_y/2 - $DetEnc_y/2"
3781 <volume name="volDirtWithHole" >
3782 <materialref ref="Dirt"/>
3783 <solidref ref="DirtWithHole"/>
3785 <volume name="volBerm" >
3786 <materialref ref="Dirt"/>
3787 <solidref ref="Berm"/>
3790 <volume name="volWorld" >
3791 <materialref ref="Air"/>
3792 <solidref ref="World"/>
3794 <volumeref ref="volDetEnclosure"/>
3795 <position name="posDetEnclosure" unit="cm"
3801 <volumeref ref="volDirtWithHole"/>
3802 <position name="posDirtWithHole" unit="cm"
3804 y=" -$World_y/2 + $Dirt_y/2 "
3808 <volumeref ref="volBerm"/>
3809 <position name="posBerm" unit="cm"
3811 y="$OriginYSet + $DetEnc_y/2 "
3812 z="$OriginZSet + $DetEnc_z/2 + $BermRadius"/>
3813 <rotationref ref="rPlus90AboutY"/>
3819 # place the 16 Layer 3 telescope counters
3820 for ($i=1; $i<=16; ++$i)
3824 <volumeref ref="volAuxDetBoxBSU-L3-$i"/>
3825 <position name="posAuxDetBox-BSU-L3-$i" unit="cm"
3826 x="$BSULayer3_xpos[$i-1]"
3828 z="$BSULayer3_zpos"/>
3833 # place the 10 Layer 4 telescope counters
3834 for ($i=1; $i<=10; ++$i)
3838 <volumeref ref="volAuxDetBoxBSU-L4-$i"/>
3839 <position name="posAuxDetBox-BSU-L4-$i" unit="cm"
3842 z="$BSULayer4_zpos[$i-1]"/>
3843 <rotationref ref="rPlus90AboutY"/>
3848 # place the 16 Layer 5 telescope counters
3849 #for ($i=1; $i<=16; ++$i)
3854 # <volumeref ref="volAuxDetBoxBSU-L5-$i"/>
3855 # <position name="posAuxDet-BSU-L5-$i" unit="cm"
3856 # x="$BSULayer5_xpos[$i-1]"
3857 # y="$BSULayer5_ypos"
3858 # z="$BSULayer5_zpos"/>
3871 # make_gdml.pl will take care of <setup/>
3876 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3877 #++++++++++++++++++++++++++++++++++++ write_fragments ++++++++++++++++++++++++++++++++++++
3878 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3880 sub write_fragments()
3882 # This subroutine creates an XML file that summarizes the the subfiles output
3883 # by the other sub routines - it is the input file for make_gdml.pl which will
3884 # give the final desired GDML file. Specify its name with the output option.
3885 # (you can change the name when running make_gdml)
3887 if ( ! defined $output )
3889 $output = "-"; # write to STDOUT
3892 # Set up the output file.
3893 $OUTPUT = ">" . $output;
3894 open(OUTPUT) or die("Could not open file $OUTPUT");
3897 <?xml version='1.0'?>
3899 <!-- Input to Geometry/gdml/make_gdml.pl; define the GDML fragments
3900 that will be zipped together to create a detector description.
3907 <!-- These files contain GDML <constant></constant>
3908 blocks. They are read in separately, so they can be
3909 interpreted into the remaining GDML. See make_gdml.pl for
3915 foreach $filename (@defFiles)
3918 <filename> $filename </filename>
3928 <!-- The GDML file fragments to be zipped together. -->
3932 foreach $filename (@gdmlFiles)
3935 <filename> $filename </filename>
3950 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3951 #++++++++++++++++++++++++++++++++++++++ place_bars +++++++++++++++++++++++++++++++++++++++
3952 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3959 # for($j=1; $j<$numberofbars+1; $j++)
3962 $pos_ref_name="Bar" . $_[0] . "Pos";
3965 <volumeref ref="volOpDetSensitive_Bar"/>
3966 <positionref ref="$pos_ref_name"/>
3974 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3975 #++++++++++++++++++++++++++++++++++++++ place_plank ++++++++++++++++++++++++++++++++++++++
3976 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3984 $pos_ref_name="PlankPos";
3987 <volumeref ref="volOpDetSensitive_Plank"/>
3988 <positionref ref="$pos_ref_name"/>
3993 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3994 #++++++++++++++++++++++++++++++++++++++ place_fibers +++++++++++++++++++++++++++++++++++++
3995 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4000 <!-- 32 Fiber Module $_[0]-->
4004 ############################# Fiber ##############################
4005 $pos_ref_name="Fiber" . $_[0] . "Pos";
4008 <volumeref ref="volOpDetSensitive_Fiber"/>
4009 <positionref ref="$pos_ref_name"/>