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

  Hall D Geometry Data Base: Start counter
  *****************************************

     version 1.0: Initial version	-rtj

     version 1.1: Fix some problems with the start Detector -cam
                  Length and center were wrong in the previous version.
     version 2.0: template file, start counter parameters calculated
                  DO NOT EDIT THIS FILE !!! W. Boeglin January 09
     version 4.1: updates for compatibility with geant4 -rtj
                  a) Removed useless/redundant z-planes in the container
                     volume STRT.
                  b) Small shift to CircuitBoards (STC1) to eliminate
                     overlaps.
     version 4.2: small tweaks to eliminate overlaps between volumes [rtj]
 
<HDDS specification="v1.0" xmlns="http://www.gluex.org/hdds">
-->

<section name        = "StartCntr"
         version     = "4.2"
         date        = "2012-05-03"
         author      = "W. Boeglin" 
         top_volume  = "STRT" 
         specification = "v1.0">


<!-- Origin of StartCntr is on the axis of the cylinder
     at the upstream limit of the sensitive region.        -->

  <composition name="StartCntr">  
    <posXYZ volume="startCntrCables" X_Y_Z="0. 0. -19. "/>
    <posXYZ volume="startCntr" X_Y_Z="0.044  0.112  0.0"  rot="-0.1026 0.0 0.0"/>   
    <!-- Plastic target at end of start counter -->
    <!--posXYZ volume="CAP2" X_Y_Z="0 0.0 58.89"/-->
  </composition>

  <tubs name="CAP2" Rio_Z="0.0 2.375 0.1" material="Polyethylene" />

  <composition name="startCntrCables" envelope="STCM">
     <mposPhi volume="STCC" ncopy="10" Phi0="18.000000" R_Z="8.3  0.0"
              impliedRot="true">
         <sector value="1" step="1" />
     </mposPhi>
  </composition>

  <composition name="startCntrReadout2" envelope="STCB">
    <mposPhi volume="STC1" ncopy="10" Phi0="18.000000" R_Z="7.5535 -0.25"
             impliedRot="true">
      <sector value="1" step="1" />
    </mposPhi>
    <mposPhi volume="STC2" ncopy="10" Phi0="18.000000" R_Z="7.2525 2.432"
             impliedRot="true">
      <sector value="1" step="1" />
    </mposPhi>
     <mposPhi volume="STC2" ncopy="10" Phi0="18.000000" R_Z="7.2525 -2.432"
             impliedRot="true">
      <sector value="1" step="1" />
    </mposPhi>
  </composition>

 <tubs name="STCM" Rio_Z="8.25 8.5 20.00" material="Air"
                   comment="Start counter cables mother volume" />

 <tubs name="STCB" Rio_Z="7.0 7.9 5.864" material="Air"/> 
 <box name="STC1" X_Y_Z="0.1 3.81 5.364" material="CircuitBoards"/>
 <box name="STC2" X_Y_Z="0.5 3.5 1.0" material="FR-4"/>
 <box name="STCC" X_Y_Z="0.1 2.54 20.00" material="SignalCables"/>

  <composition name="startCntr" envelope="STRT">
     <mposPhi volume="STRC" ncopy="30" Phi0="6.000000" R_Z="0.0  0.0"
              impliedRot="true">
         <sector value="1" step="1"/>
     </mposPhi>
     <posXYZ volume="STIC" />
     <posXYZ volume="STIE" />
     <posXYZ volume="STAI" />
     <posXYZ volume="STIS" />
     <posXYZ volume="STAO" />
     <posXYZ volume="STWR" />
     <posXYZ volume="STSR" />
     <posXYZ volume="STAN" />
     <posXYZ volume="STTD" />
     <posXYZ volume="STT1"/>    
     <posXYZ volume="startCntrReadout" X_Y_Z="0 0 -0.14" />
     <posXYZ volume="startCntrReadout2" X_Y_Z="0.0 0.0 -3.212" />
  </composition>

  <composition name="startCntrReadout" envelope="STRO">
     <posXYZ volume="STSI" X_Y_Z="0.0 0.0 0.09"/> 
     <posXYZ volume="STSS" X_Y_Z="0.0 0.0 -0.01"/> 
     <posXYZ volume="STRB" X_Y_Z="0.0 0.0 -0.1"/>
  </composition> 

  <tubs name="STRO" Rio_Z="7.0 8.32 0.28" material="Air"
                   comment="Start counter readout mother volume"/>
  
  <pcon name="STRT" material="Air" comment="start counter assembly">
    <polyplane Rio_Z="7.79 8.1   -8.67660"/>
    <polyplane Rio_Z="7.79 8.1 -7.3606"/>
    <polyplane Rio_Z="6.667  8.1 -7.3606"/>
    <polyplane Rio_Z="6.667  8.1   -7.0431"/>
    <polyplane Rio_Z="6.667 7.9      -7.0431" />
    <polyplane Rio_Z="6.667 7.9      -0.4"/>
    <polyplane Rio_Z="6.667 8.450000 -0.4"/>
    <polyplane Rio_Z="6.667 8.450000 1.0" />
    <!--polyplane Rio_Z="6.66 8.25 39.465"/> 
    <polyplane Rio_Z="6.2 8.1 42.057375"/>
    <polyplane Rio_Z="2.4637 4.24 53.8226"/>
    <polyplane Rio_Z="1.95 2.39 58.8" /-->
    <polyplane Rio_Z="6.66 8.25 58.8"/> 
  </pcon>
  <pgon name="STAI" segments="30" material="Aluminum"
	comment="Aluminum foil wrapping">
    <polyplane Rio_Z="7.74761 7.74926 0.000000" /> 
    <!--polyplane Rio_Z="7.74761 7.74926 39.465000" />
    <polyplane Rio_Z="7.72483 7.72648 40.176676" />
    <polyplane Rio_Z="7.72324 7.72489 40.194574" />
    <polyplane Rio_Z="7.66153 7.66319 40.885848" />
    <polyplane Rio_Z="7.65618 7.65785 40.921580" />
    <polyplane Rio_Z="7.55628 7.55796 41.590017" />
    <polyplane Rio_Z="7.54497 7.54669 41.643458" />
    <polyplane Rio_Z="7.40945 7.41114 42.286705" />
    <polyplane Rio_Z="7.39000 7.39173 42.357668" />
    <polyplane Rio_Z="7.22153 7.22327 42.973460" />
    <polyplane Rio_Z="7.19587 7.19761 43.057375" />
    <polyplane Rio_Z="1.99826 2.00000 58.594" />
    <polyplane Rio_Z="1.99826 2.00000 58.600"/>
    <polyplane Rio_Z="2.31461 2.31635 58.690" /-->
    <polyplane Rio_Z="7.74761 7.74926 58.690" />
  </pgon>
<pgon name="STAO" segments="30" material="Aluminum"
	comment="Aluminum foil wrapping">
    <polyplane Rio_Z=" 8.04926 8.05091 0.000000" /> 
    <!--polyplane Rio_Z=" 8.04926 8.05091 39.465000" />
    <polyplane Rio_Z=" 8.02827 8.02992 40.176676" />
    <polyplane Rio_Z=" 8.02774 8.02939 40.194574" />
    <polyplane Rio_Z=" 7.96605 7.96771 40.885848" />
    <polyplane Rio_Z=" 7.96286 7.96454 40.921580" />
    <polyplane Rio_Z=" 7.86296 7.86465 41.590017" />
    <polyplane Rio_Z=" 7.85497 7.85666 41.643458" />
    <polyplane Rio_Z=" 7.71942 7.72111 42.286705" />
    <polyplane Rio_Z=" 7.70446 7.70617 42.357668" />
    <polyplane Rio_Z=" 7.53600 7.53774 42.973460" />
    <polyplane Rio_Z=" 7.51305 7.51490 43.057375" />
    <polyplane Rio_Z=" 2.31635 2.31809 58.594" /-->
    <polyplane Rio_Z=" 8.04926 8.05091 58.594" /> 
  </pgon>
  <pgon name="STRC" segments="1" profile="-6.0 12.0" material="Scintillator"
		sensitive="true" comment="start counter scintillator">
    <polyplane Rio_Z="7.74926 8.04926 0.000000" />
    <!--polyplane Rio_Z="7.74926 8.04926 39.465000" />
    <polyplane Rio_Z="7.72648 8.02827 40.176676" />
    <polyplane Rio_Z="7.72489 8.02774 40.194574" />
    <polyplane Rio_Z="7.66319 7.96605 40.885848" />
    <polyplane Rio_Z="7.65785 7.96286 40.921580" />
    <polyplane Rio_Z="7.55796 7.86296 41.590017" />
    <polyplane Rio_Z="7.54669 7.85497 41.643458" />
    <polyplane Rio_Z="7.41114 7.71942 42.286705" />
    <polyplane Rio_Z="7.39173 7.70446 42.357668" />
    <polyplane Rio_Z="7.22327 7.53600 42.973460" />
    <polyplane Rio_Z="7.19761 7.51305 43.057375" />
    <polyplane Rio_Z="2.00000 2.31635 58.594" />
    <polyplane Rio_Z="2.31635 2.31635 58.6892" /-->
    <polyplane Rio_Z="7.74926 8.04926 58.6892" />
  </pgon>
  <pcon name="STIE" material="EpoxyResin">
    <polyplane Rio_Z="6.7691 6.81228 -0.3556"/>
    <polyplane Rio_Z="6.7691 6.81228 37.7444"/>
  </pcon>
  <pcon name="STIC" material="CarbonFiber"
	comment="Carbon fiber support ring">
    <polyplane Rio_Z="6.68528 6.7691 -0.3556"/>
    <polyplane Rio_Z="6.68528 6.7691 37.7444"/>
  </pcon>
  <pcon name="STIS" material="HighDensityROHACELL"
	comment="start counter support cylinder">
    <polyplane Rio_Z="7.60603 7.74603 0.00"/>
    <!--polyplane Rio_Z="7.60603 7.74603 0.2794"/>
    <polyplane Rio_Z="6.81228 7.74603 0.2794"/>
    <polyplane Rio_Z="6.81228 7.74603 37.7444"/>
    <polyplane Rio_Z="6.66753 7.74603 37.7444"/>
    <polyplane Rio_Z="6.66603 7.74403 39.4650" />
    <polyplane Rio_Z="6.64325 7.71325 40.176676" />
    <polyplane Rio_Z="6.51000 7.61996 40.885848" />
    <polyplane Rio_Z="6.36024 7.51473 41.590017" />
    <polyplane Rio_Z="6.21342 7.36791 42.286705" />
    <polyplane Rio_Z="6.19401 7.34850 42.357668" />
    <polyplane Rio_Z="6.02555 7.18004 42.973460" />
    <polyplane Rio_Z="5.99989 7.15438 43.057375" />
    <polyplane Rio_Z="2.46380 3.57000 53.8226" /-->
    <polyplane Rio_Z="7.60603 7.74603 58.5"/>
  </pcon>
  <pgon name="STWR" segments="30" material="Cellulose"
				  comment="start counter wrapping tape">
    <polyplane Rio_Z=" 8.05091 8.10091 0.000000" /> 
    <!--polyplane Rio_Z=" 8.05091 8.10091 39.465000" />
    <polyplane Rio_Z=" 8.02992 8.07992 40.176676" />
    <polyplane Rio_Z=" 8.02939 8.07939 40.194574" />
    <polyplane Rio_Z=" 7.96771 8.01798 40.885848" />
    <polyplane Rio_Z=" 7.96454 8.01487 40.921580" />
    <polyplane Rio_Z=" 7.86465 7.91547 41.590017" />
    <polyplane Rio_Z=" 7.85666 7.90796 41.643458" />
    <polyplane Rio_Z=" 7.72111 7.77329 42.286705" />
    <polyplane Rio_Z=" 7.70617 7.75862 42.357668" />
    <polyplane Rio_Z=" 7.53774 7.59033 42.973460" />
    <polyplane Rio_Z=" 7.51490 7.56763 43.057375" />
    <polyplane Rio_Z=" 2.31809 2.37081 58.594"/-->
    <polyplane Rio_Z=" 8.05091 8.10091 58.594" />
  </pgon>

  <pcon name="STSR" material="Aluminum"
	comment="Support ring for attaching to target flange">
    <polyplane Rio_Z="7.79 8.1 -8.6766"/>
    <polyplane Rio_Z="7.79 8.1 -7.3606"/>
    <polyplane Rio_Z="6.6726 8.1 -7.3606"/>
    <polyplane Rio_Z="6.6726 8.1 -7.0431"/>
    <polyplane Rio_Z="6.6726 6.9726 -7.0431"/>
    <polyplane Rio_Z="6.6726 6.9726 -0.3556"/>
    <polyplane Rio_Z="6.81228 6.9726 -0.3556"/>
    <polyplane Rio_Z="6.81228 6.9726 0.0"/>
    <polyplane Rio_Z="6.81228 7.6060 0.0"/>
    <polyplane Rio_Z="6.81228 7.6060 0.2794"/>
  </pcon>

  <tubs name="STSI" Rio_Z="7.749 8.049 0.10" material="Silicon"
                   comment="Silicon PM for start counter readout" />
  <tubs name="STSS" Rio_Z="7.749 8.049 0.10" material="SiliconDioxide"
                   comment="Silicon PM substrate for start counter readout" />
  <tubs name="STRB" Rio_Z="7.0 8.32 0.08" material="FR-4"
                   comment="Silicon PM readout board" />

  <pcon name="STAN" material="Nylon" 
	comment="Right angle piece for light tightness" >
    <polyplane Rio_Z="7.9 8.42 -0.38"/>
    <polyplane Rio_Z="7.9 8.42 -0.29"/>
    <polyplane Rio_Z="8.32 8.42 -0.29"/>
    <polyplane Rio_Z="8.32 8.42 0.72"/>
  </pcon> 

  <pcon name="STT1" material="Tedlar" comment="Wrapping for light tightness">
    <!--polyplane Rio_Z="3.56 3.565 53.8226"/>
    <polyplane Rio_Z="1.993 1.998 58.594"/-->
    <polyplane Rio_Z="8.150 8.152 53.8226"/>
    <polyplane Rio_Z="8.150 8.152 58.594"/>
  </pcon>

  <pcon name="STTD" material="Tedlar" comment="Wrapping for light tightness">
    <polyplane Rio_Z="8.42 8.425 0." />
    <polyplane Rio_Z="8.42 8.425 1." />
    <polyplane Rio_Z="8.15 8.155 4." />
    <!--polyplane Rio_Z="8.15 8.155 39.465000" />
    <polyplane Rio_Z="8.13 8.135 40.176676" />
    <polyplane Rio_Z="8.124 8.129 40.194574" />
    <polyplane Rio_Z="8.07 8.075 40.885848" />
    <polyplane Rio_Z="8.06 8.065 40.921580" />
    <polyplane Rio_Z="7.96 7.9651 41.590017" />
    <polyplane Rio_Z="7.95 7.9551 41.643458" />
    <polyplane Rio_Z="7.82 7.8252 42.286705" />
    <polyplane Rio_Z="7.81 7.8152 42.357668" />
    <polyplane Rio_Z="7.64 7.6453 42.973460" />
    <polyplane Rio_Z="7.62 7.6253 43.057375" />
    <polyplane Rio_Z="2.38 2.3853 58.75 "/-->
    <polyplane Rio_Z="8.15 8.155 58.75" />
  </pcon>


  <!-- 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="startCntr_pars" type="mcfast">
    <real       name="rmin"	value="10.00"	comment="inner radius"
				unit="cm"	/>
    <real       name="rmax"	value="10.20"	comment="outer radius"
				unit="cm"	/>
    <real       name="z0"	value="72.5"	comment="z of midplane"
				unit="cm"	/>
    <real       name="zlen"	value="50.0"	comment="length of cntr"
				unit="cm"	/>
  </parameters>

  <parameters name="startCntrLayer_pars" type="mcfast">
    <int	name="det"	value="1"	comment="num of mother"   />
    <real	name="zlen"	value="50.0"	comment="length of layer"
				unit="cm"	/>
    <real	name="cell_height" value="0.2"	comment="thickness"
				unit="cm"	/>
    <int	name="nwires"	value="25"	comment="segmentation"	  />
    <int	name="ID_readout" value="-1"	/>
    <int	name="ID_cathode" value="1"	/>
    <real	name="phi0"	value="0."	comment="offset to wire 1"
				unit="cm"	/>
    <real	name="stereo_offset" value="0."	comment="where is phi0"
				unit="cm"	/>
    <real	name="eff_hit"	value="0.96"	comment="hit efficiency"
				unit="cm"	/>
    <real	name="eff_dedx"	value="0.96"	comment="dE/dx efficiency"
				unit="cm"	/>
    <real	name="siga"	value="0.04"	comment="xy resolution"
				unit="cm"	/>
    <real	name="sigb"	value="0.00"	comment="?? resolution"
				unit="cm"	/>
    <real	name="sigc"	value="0.00"	comment="?? resolution"
				unit="cm"	/>
  </parameters>

  <parameters name="startCntrOffset_pars" type="mcfast">
    <int	name="det"	value="1"	comment="num of mother"   />
    <real	name="cell_offset" value="0.0"	comment="offset in phi"
				unit="cm"	/>
    <real	name="sag"	value="0.0"	comment="sagitta of wire"
				unit="cm"	/>
    <real_array	name="offset"	values="0.0 0.0 0.0" comment="not used"
				unit="cm"	/>
    <real_array	name="dircos"	values="0.0 0.0 0.0" comment="not used"
				unit="cm"	/>
  </parameters>


  <mcfast model="Drift" template="db/drift.db" parameters="startCntr_pars">
    <int	name="num"	value="1"	/>
    <string     name="name"	value="STRT"	/>

  <!-- for mcfast model the start counter as a vertex drift chamber -->

    <int	name="num_anode"    value="3"	comment="anode layers" />
    <int	name="num_cathode"  value="0"		 />
    <reference  name="material"	    value="Scintillator" />
    <real_array name="thick_boun"   comment="inner outer upstream downstream
		window thicknesses" values=" 0.20  0.05    0.20     0.20"
				    unit="cm"	/>
    <reference_vector name="mat_boun">
      <reference_data value="Mylar" comment="inner window material"  />
      <reference_data value="Mylar" comment="outer window material"  />
      <reference_data value="Mylar" comment="upstream window matl"   />
      <reference_data value="Mylar" comment="downstream window matl" />
    </reference_vector>

    <mcfast model="LayerDRFAno" template="db/drift_layer.db"
			        parameters="startCntrLayer_pars">
      <int	name="lyr"	value="1"	comment="layer number" 	 />
      <real	name="radius"	value="10.1"	comment="central radius"
				unit="cm"	/>
      <real	name="stereo_tau" value="-0.10"	comment="twist angle tau"
				unit="cm"	/>
    </mcfast>
    <mcfast model="LayerDRFAno" template="db/drift_layer.db"
			        parameters="startCntrLayer_pars">
      <int	name="lyr"	value="2"	comment="layer number" 	 />
      <real	name="radius"	value="10.3"	comment="central radius"
				unit="cm"	/>
      <real	name="stereo_tau" value="0.0"	comment="twist angle tau"
				unit="cm"	/>
    </mcfast>
    <mcfast model="LayerDRFAno" template="db/drift_layer.db"
			        parameters="startCntrLayer_pars">
      <int	name="lyr"	value="3"	comment="layer number" 	 />
      <real	name="radius"	value="10.5"	comment="central radius"
				unit="cm"	/>
      <real	name="stereo_tau" value="+0.10"	comment="twist angle tau"
				unit="cm"	/>
    </mcfast>

    <mcfast model="OffsetDRFAno" template="db/drift_offset.db"
				 parameters="startCntrOffset_pars">
      <int	name="lyr"	value="1"	comment="layer number"	/>
    </mcfast>
    <mcfast model="OffsetDRFAno" template="db/drift_offset.db"
				 parameters="startCntrOffset_pars">
      <int	name="lyr"	value="2"	comment="layer number"	/>
    </mcfast>
    <mcfast model="OffsetDRFAno" template="db/drift_offset.db"
				 parameters="startCntrOffset_pars">
      <int	name="lyr"	value="3"	comment="layer number"	/>
    </mcfast>
  </mcfast>

</section>

<!-- </HDDS> -->
