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

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

     version 1.0: Initial version	-rtj
     version 2.0: Changes by A.Somov
       - change the calorimeter size to 10x10 blocks
       - change Z-position of the CCAL
       - add PWO material
     version 3.0: Adjustments for PrimEx - A.S.
       - ahange the size of the calorimeter to 12x12 blocks
       - add absorber
     version 4.0:  - A.S.
       - change the crystal size, PWO size 20.55 mm
       - module assembly size: 20.9 mm, average size according
         to survey group. Currently assyme Tedlar as a wrapping 
         material. 
         We will need to add positions of each individual module


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

<section name          = "ComptonEMcal"
         version       = "1.0"
         date          = "2018-12-05"
         author        = "A. Somov"
         top_volume    = "CCAL"
         specification = "v1.0" >

<!-- Origin of ComptonEMcal is center of upstream face of LTD (Lead Tungstate Detector) -->

  <composition name="ComptonEMcal">
    <apply region="nullBfield"/>
    <posXYZ volume="comptonEMcal" X_Y_Z="0.0  0.0  10.0" />
  </composition>


  <composition name="comptonEMcal" envelope="CCAL">
    <posXYZ volume="Absorber" X_Y_Z="0.0      0.0     -13.03" />
    <posXYZ volume="LTDlower" X_Y_Z="0.0     -7.315    0.0" />
    <posXYZ volume="LTDeast" X_Y_Z="-7.315    0.0      0.0" />
    <posXYZ volume="LTDwest" X_Y_Z="+7.315    0.0      0.0" />
    <posXYZ volume="LTDupper" X_Y_Z="0.0     +7.315    0.0" /> 
  </composition> 
  
  <composition name="Absorber" envelope="ABDO">
    <posXYZ volume="ABSI" X_Y_Z="0.0 0.0 0.0"/>
  </composition>

  <box name="ABDO" X_Y_Z="8.315  8.315  6.05" material="Tungsten" />
  <tubs name="ABSI" Rio_Z="0  1.86   6.05" material="Air" />




  <composition name="LTDlower" envelope="LTDB">
    <mposY volume="LTDfullRow" ncopy="5" Z_X="0.0 0.0" Y0="-4.18" dY="2.09">
      <row value="0" step="1" />
    </mposY>
  </composition>
  

  <composition name="LTDupper" envelope="LTDT">
    <mposY volume="LTDfullRow" ncopy="5" Z_X="0.0 0.0" Y0="-4.18" dY="2.09">
      <row value="7" step="1" />
    </mposY>
  </composition>
  
  
 <composition name="LTDwest" envelope="LTDW">
    <mposY volume="LTDhalfRowWest" ncopy="2" Y0="-1.045" dY="2.09">
      <row value="5 " step="1" />
    </mposY>
  </composition>
  

  <composition name="LTDeast" envelope="LTDE">
    <mposY volume="LTDhalfRowEast" ncopy="2" Y0="-1.045" dY="2.09">
      <row value="5" step="1" />
    </mposY>
  </composition>





  <composition name="LTDfullRow">
    <mposX volume="Module" ncopy="12" Y_Z="0.0 0.0" X0="-11.495" dX="2.09">
      <column value="0" step="1" />
    </mposX>
  </composition>


  <composition name="LTDhalfRowWest">
    <mposX volume="Module" ncopy="5" Y_Z="0.0 0.0" X0="-4.18" dX="2.09">
      <column value="7" step="1" />
    </mposX>
  </composition> 


  <composition name="LTDhalfRowEast">
    <mposX volume="Module" ncopy="5" Y_Z="0.0 0.0" X0="-4.18" dX="2.09">
      <column value="0" step="1" />
    </mposX>
  </composition>   

 




  <box name="CCAL" X_Y_Z="25.08  25.08  34.0"  material="Air"
       comment="Compton EMcal mother" />



  <box name="LTDB" X_Y_Z="25.08  10.45  20.0"  material="Air"
       comment="LTD bottom section"   />


  <box name="LTDT" X_Y_Z="25.08  10.45  20.0"  material="Air"
       comment="LTD top section"      />


  <box name="LTDW" X_Y_Z="10.45   4.18  20.0"  material="Air"
       comment="LTD west section"     />


  <box name="LTDE" X_Y_Z="10.45   4.18  20.0"  material="Air"
       comment="LTD east section"    />



  <composition name="Module" envelope="LTMD">
    <posXYZ volume="LTBL" X_Y_Z="0.0 0.0 0.0"/>
  </composition>



  <box name="LTMD" X_Y_Z="  2.09    2.09   20.0"  material="Tedlar"
       comment="lead tungstate module assembly"     />


  <box name="LTBL" X_Y_Z="  2.055    2.055  20.0"  material="PWO"
       sensitive="true"	 comment="lead tungstate block"     />





  <!-- 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="18.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="CCAL"
    <string	name="shape"	value="BOX"
    <int	name="type"	value="2"
  </mcfast>
-->

</section>

<!-- </HDDS> -->
