<?xml version="1.0" encoding="UTF-8"?>
<!--DOCTYPE HDDS>

  Hall D Geometry Data Base: Forward EM calorimeter
  **************************************************

     version 1.0: Initial version	-rtj
 
<HDDS specification="v1.0" xmlns="http://www.gluex.org/hdds">
-->

<section name        = "ForwardEMcal"
         version     = "2.1"
         date        = "2006-11-25"
         author      = "R.T. Jones"
         top_volume  = "FCAL"
         specification = "v1.0">

<!-- Origin of ForwardEMcal is center of upstream face of LGD -->

<!-- Thr Jan 29 08:14:30 EST 2009                                  -->
<!-- changed order of counting columns: 0-58 from south to north   -->

<!-- July 7, 2017, Richard Jones                                   -->
<!-- Added front steel frame and side straps to the LGD blocks.    -->
<!-- Added mylar wrapping around the blocks.                       -->
<!-- Increased the size of the FCAL block unit cell to account for
     the space needed for wrapping, strips, and front frame.       -->
<!-- Added plexiglass sheet (0.5") in front of the LGD.            -->
<!-- Extended the stainless tube around the beam hole to the full 
     length (32.75") shown in the drawings, with front flush with
     the front of the wrapped blocks.                              -->

<!-- July 7, 2017, Richard Jones                                   -->
<!-- Added light cover in front of entrance face to the FCal       -->

<!-- version 2.1, January 8, 2019, Richard Jones                   -->
<!-- Small tweaks to eliminate overlaps between volumnes.          -->

  <composition name="ForwardEMcal">
    <posXYZ volume="forwardEMcal" X_Y_Z="0.0  0.0  25.4" />
    <posXYZ volume="plexiSheet" X_Y_Z="0.0  0.0  -1.0" />
    <posXYZ volume="FCLC" X_Y_Z="0.0  0.0  -2.0" />
    <posXYZ volume="FCBX" X_Y_Z="0.0  0.0  50.8" />
  </composition>

  <composition name="forwardEMcal" envelope="FCAL">
    <apply region="nullBfield"/>
    <posXYZ volume="LGDlower" X_Y_Z="  0.0 -62.24335  0.0" />
    <posXYZ volume="LGDsouth" X_Y_Z="-62.24335   0.0  0.0" />
    <posXYZ volume="LGDnorth" X_Y_Z="+62.24335   0.0  0.0" />
    <posXYZ volume="LGDupper" X_Y_Z="  0.0 +62.24335  0.0" />
    <posXYZ volume="FCBI" X_Y_Z="0.0  0.0  0.0" />
  </composition>

  <composition name="LGDlower" envelope="LGDB">
    <mposY volume="LGDfullRow" ncopy="28" Z_X="0.0 0.0" Y0="-54.21195" dY="4.0157">
      <row value="0" step="1" />
    </mposY>
  </composition>

  <composition name="LGDnorth" envelope="LGDN">
    <mposY volume="LGDhalfRowNorth" ncopy="3" Y0="-4.0157" dY="4.0157">
      <row value="28" step="1" />
    </mposY>
  </composition>

  <composition name="LGDsouth" envelope="LGDS">
    <mposY volume="LGDhalfRowSouth" ncopy="3" Y0="-4.0157" dY="4.0157">
      <row value="28" step="1" />
    </mposY>
  </composition>

  <composition name="LGDupper" envelope="LGDT">
    <mposY volume="LGDfullRow" ncopy="28" Z_X="0.0 0.0" Y0="-54.21195" dY="4.0157">
      <row value="31" step="1" />
    </mposY>
  </composition>
  <composition name="LGDfullRow">
    <mposX volume="LGDblock" ncopy="59" Y_Z="0.0 0.0" X0="-116.4553" dX="4.0157">
      <column value="0" step="1" />
    </mposX>
  </composition>

  <composition name="LGDhalfRowNorth">
    <mposX volume="LGDblock" ncopy="28" Y_Z="0.0 0.0" X0="-54.21195" dX="4.0157">
      <column value="31" step="1" />
    </mposX>
  </composition>

  <composition name="LGDhalfRowSouth">
    <mposX volume="LGDblock" ncopy="28" Y_Z="0.0 0.0" X0="-54.21195" dX="4.0157">
      <column value="0" step="1" />
    </mposX>
  </composition>

  <composition name="LGDblock" envelope="LGBU">
    <posXYZ volume="LGBLwrapped" X_Y_Z="-0.0038 -0.0038 -2.600"/>
    <posXYZ volume="LGBS" X_Y_Z="2.00405 0 0"/>
    <posXYZ volume="LGBS" X_Y_Z="0 2.00405 0" rot="0 0 90"/>
    <posXYZ volume="LGBF" X_Y_Z="-0.0038 -0.0038 -25.100"/>
    <posXYZ volume="LGLG" X_Y_Z="-0.0038 -0.0038  22.450"/>
  </composition>

  <composition name="LGBLwrapped" envelope="LGBW">
    <posXYZ volume="LGBL"/>
  </composition>

  <box name="FCAL" X_Y_Z="236.9263  236.9263  50.8"  material="Air"
	                              	comment="forward EMcal mother" />
  <box name="LGDB" X_Y_Z="236.9263  112.4396  50.8"  material="Air"
					comment="LGD bottom section"   />
  <box name="LGDT" X_Y_Z="236.9263  112.4396  50.8"  material="Air"
					comment="LGD top section"      />
  <box name="LGDN" X_Y_Z="112.4396   12.0471  50.8"  material="Air"
					comment="LGD north section"     />
  <box name="LGDS" X_Y_Z="112.4396   12.0471  50.8"  material="Air"
					comment="LGD south section"    />
  <box name="LGBU" X_Y_Z="4.0157  4.0157  50.8"  material="Air"
		            comment="lead glass block stacking unit cell"/>
  <box name="LGBL" X_Y_Z="4.0030  4.0030  45.0"  material="leadGlassF800"
		sensitive="true" comment="lead glass block" />
  <tubs name="LGLG" Rio_Z="0.0  1.5875  5.08" material="Plexiglas"
		sensitive="true" comment="lead glass block plexiglass light guide" />
  <box name="LGBW" X_Y_Z="4.0081  4.0081  45.0"  material="Mylar"
		            comment="aluminized mylar wrapping around the block"/>
  <box name="LGBS" X_Y_Z="0.0076 2.8575 50.8" material="StainlessSteel"
		            comment="SS strap holding the tube assy to the block"/>
  <pgon name="LGBF" segments="4" profile="-45 360" material="StainlessSteel"
		            comment="SS frame fixing the straps to the front of the block">
   <polyplane Rio_Z="1.5875 2.0015 -0.300"/>
   <polyplane Rio_Z="1.5875 2.0015 0.000"/>
  </pgon>
  <pgon name="FCBI" segments="4" profile="-45 360" material="StainlessSteel"
                    comment="FCal beam hole support insert">
   <polyplane Rio_Z="4.7536 6.0235  -25.400"/>
   <polyplane Rio_Z="4.7536 6.0235  +25.400"/>
  </pgon>
  <pgon name="FCBX" segments="4" profile="-45 360" material="StainlessSteel"
                    comment="FCal beam hole support extension">
   <polyplane Rio_Z="4.7536 6.0236   0.000"/>
   <polyplane Rio_Z="4.7536 6.0236  32.385"/>
  </pgon>

  <composition name="plexiSheet" envelope="LGPS">
    <posXYZ volume="LGPH"/>
  </composition>
  <tubs name="LGPS" Rio_Z="0.0  123.190  1.270" material="Plexiglas"/>
  <box name="LGPH" X_Y_Z="9.500 9.500 1.270" material="Air"/>
  <box name="FCLC" X_Y_Z="243.8 243.8 0.3175" material="ABS-PVC"/>


  <!-- The following elements describe an early rendition of the GlueX
       detector simulated using a fast Monte Carlo program MCFast.  They
       are retained for future reference, do not rely on their values. -->

  <parameters name="forwardEMcal_pars" type="mcfast">
    <real_array	name="xlimit"	comment="xmin  xmax limits of box"
				values="-106.0  106.0"
				unit="cm"	/>
    <real_array	name="ylimit"	comment="ymin  ymax limits of box"
				values="-106.0  106.0"
				unit="cm"	/>
    <real_array	name="xlimit_gap" comment="xmin  xmax of beam hole aperture"
				values="   -6.0   6.0"
				unit="cm"	/>
    <real_array	name="ylimit_gap" comment="ymin  ymax of beam hole aperture"
				values="   -6.0   6.0"
				unit="cm"	/>
    <real	name="z0"	value="620.07"	comment="z of midplane"
				unit="cm"	/>
    <real	name="zlen"	value="45.0"	comment="length of blocks"
				unit="cm"	/>
    <reference	name="material"	value="leadGlassF800" />
    <reference	name="active"	value="leadGlassF800" />
    <int	name="ncr1"	value="58"	comment="x segmentation"     />
    <int	name="ncr2"	value="58"	comment="y segmentation"     />
    <int	name="nlayers"	value="1"	comment="z segmentation"     />
    <real	name="siga_em"	value="0.06"	comment="root-E coefficient"
				unit="cm"	/>
    <real	name="sigb_em"	value="0.01"	comment="floor term"
				unit="cm"	/>
    <real	name="siga_had"	value="0.0"	comment="root-E coefficient"
				unit="cm"	/>
    <real	name="sigb_had"	value="0.0"	comment="floor term"
				unit="cm"	/>
    <real	name="em_had_ratio" value="4.0"	comment="response ratio"
				unit="cm"	/>
  </parameters>

<!-- The forward calorimeter is hard coded into HDFast at present

  <mcfast model="CalorBox" template="db/calorbox.db"
                           parameters="forwardEMcal_pars">
    <string	name="name"	value="FCAL"
    <string	name="shape"	value="BOX"
    <int	name="type"	value="2"
  </mcfast>
-->

</section>

<!-- </HDDS> -->
