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

  <!ENTITY Regions_s SYSTEM "Regions.xml">
  <!ENTITY Material_s SYSTEM "Materials.xml">
  <!ENTITY PhotonPipe_s SYSTEM "PhotonPipe.xml">
  <!ENTITY Spectrometer_s SYSTEM "Spectrometer.xml">
  <!ENTITY FocalPlane_s SYSTEM "FocalPlane.xml">
  <!ENTITY ElectronDump_s SYSTEM "ElectronDump.xml">

]>

<HDDS specification="v1.0" xmlns="http://www.gluex.org/hdds"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.gluex.org/hdds 
          http://zeus.phys.uconn.edu/halld/schemas/HDDS-1_0.xsd">

<!-- Include materials -->
     &Material_s;

<!-- Include magnetic fields -->
     &Regions_s;

<!-- Include spec files -->
     &PhotonPipe_s;
     &Spectrometer_s;
     &FocalPlane_s;
     &ElectronDump_s;
<!-- End of include    -->


<!-- GlueX Tagging Spectrometer Specification : top volume
     ******************************************************
-->
<section name        = "GlueXTagger"
         version     = "1.1"
         date        = "2005-01-25"
         author      = "R.T. Jones"
         top_volume  = "AREA"
         specification = "v1.0">

<!-- The master coordinate system for the geometry is as follows:
       1. the y axis points vertically up
       2. the z axis is coincident with the nominal electron beam
          direction at the crystal (horizontal by design) and points
          along the direction of electron beam motion.
       3. the x axis is defined by the requirement that x,y,z form
          a right-handed coordinate system.
      The origin is the intersection of the electron beam axis with
      the crystal plane at the goniometer.                           -->

  <box name="HILL" X_Y_Z="5000. 5000. 10000." material="Concrete"
       				comment="master volume for description" />
  <box name="AREA" X_Y_Z="750. 450. 2626." material="Air"
       				comment="main tagger enclosure">
    <apply region="taggerBfield" origin="75.0 -45.0 -1213.0" />
  </box>

  <composition name="everything" envelope="HILL">
    <posXYZ volume="taggerArea" X_Y_Z="-75.0 45.0 1213.0"/>
    <posXYZ volume="electronDump" X_Y_Z="0.0 0.0 633.0" rot="0 -13.4 0"/>
  </composition>
  <composition name="taggerArea" envelope="AREA">
    <posXYZ volume="taggerAssembly" X_Y_Z="75.0 -45.0 -1213.0" />
    <posXYZ volume="electronDump" X_Y_Z="75.0 -45.0 -580.0" rot="0 -13.4 0"/>
  </composition>

<!-- The origin of the electron and photon arms is defined to be
     the intersection of the nominal beam axis with the entrance
     plane to the first spectrometer dipole.  Note that the edge of
     the pole pieces is not perpendicular to the beam direction when
     it enters, but this does not interfere with the defining it this
     way.  This definition has the advantage that it refers to objects
     that can be accurately located by surveyers and are not likely to
     move around very much after the initial setup is complete.       -->
      
  <composition name="taggerAssembly">
    <posXYZ volume="goniometer" X_Y_Z="0.0 0.0 0.0" />
    <posXYZ volume="electronArm" X_Y_Z="0.0 0.0 302.5154" />
    <posXYZ volume="photonArm" X_Y_Z="0.0 0.0 302.5154" />
  </composition>
  <composition name="electronArm">
    <posXYZ volume="quadrupoleAsy" X_Y_Z="0.0 0.0 -1.50" />
    <posXYZ volume="taggerDipole1" X_Y_Z="-10.1846 0.0 152.9947"
                                   rot="0 -5.900 0" unit_angle="deg" />
    <posXYZ volume="taggerDipole2" X_Y_Z="-57.557 0.0 500.7876"
                                   rot="0 -6.792 0" unit_angle="deg" />
    <posXYZ volume="vacuumBox" X_Y_Z="0 0 0" />
    <posXYZ volume="electronExitTube" X_Y_Z="-250.737 0.0 1376.759"
                                   rot="0 -13.4 0" unit_angle="deg" />
    <posXYZ volume="taggerFocalPlane" X_Y_Z="-48.535 0.0 -5.015"
                                   rot="0 -9.944 0" unit_angle="deg" />
  </composition>

  <composition name="photonArm">
    <posXYZ volume="photonInsertPipe" X_Y_Z="0 0 325.400"/>
    <posXYZ volume="photonExitPipe" X_Y_Z="0 0 1761.930"/>
  </composition>

  <composition name="goniometer" envelope="GONI">
    <posXYZ volume="GOBX" />
    <posXYZ volume="GOBE" X_Y_Z="0 0 -29.7"/>
    <posXYZ volume="GOBE" X_Y_Z="0 0 +29.7"/>
    <posXYZ volume="XTAL" X_Y_Z="0 0 10e-4"/>
    <posXYZ volume="XFRA" X_Y_Z="0 0 10e-4"/>
  </composition>

  <pgon name="GOBX" segments="4" profile="-45 360" material="Iron"
                                 comment="goniometer vacuum box sides">
    <polyplane Rio_Z="29.4 30.0 -30.0"/>
    <polyplane Rio_Z="29.4 30.0 +30.0"/>
  </pgon>
  <pgon name="GOBE" segments="4" profile="-45 360" material="Iron"
                                 comment="goniometer vacuum box ends">
    <polyplane Rio_Z="2.0 30.0 -0.3"/>
    <polyplane Rio_Z="2.0 30.0 +0.3"/>
  </pgon>

  <box name="GONI" X_Y_Z="60 60 60" material="TaggerVacuum"
                                 comment="goniometer vacuum box"/>
  <box name="XTAL" X_Y_Z="0.5 0.5 20e-4" material="Carbon" sensitive="true"
                                        comment="goniometer crystal"/>
  <pgon name="XFRA" segments="4" profile="-45 360" material="Aluminum"
                                 comment="goniometer crystal mount">
    <polyplane Rio_Z="0.75 1.5 0.0"/>
    <polyplane Rio_Z="0.75 1.5 0.3"/>
  </pgon>
</section>
</HDDS>
