<lccdd>
  <info name="solid" title="SoLID"
        author="W.Armstrong,C.Peng"
        url=""
        status="development"
        version="$Id: compact.xml v1.0 2016-12-21$">
    <comment>SoLID detector</comment>
  </info>

  <includes>
    <gdmlFile  ref="solid/elements.xml" />
    <gdmlFile  ref="solid/materials.xml" />
  </includes>

  <define>
    <constant name="world_side" value="10*m"/>
    <constant name="world_x" value="world_side"/>
    <constant name="world_y" value="world_side"/>
    <constant name="world_z" value="world_side"/>

    <constant name="tracker_region_zmax" value="3*m"/>
    <constant name="tracker_region_rmax" value="2*m"/>

    <constant name="PhotMomWaveConv" value="1243.125*eV"/>

  </define>

  <properties>
    <matrix name="RINDEX__N2" coldim="2" values="  
      1.0*eV 1.00033
      4.0*eV 1.00033
      5.1*eV 1.00033
      "/>
    <matrix name="RINDEX__Pyrex" coldim="2" values="  
      1.0*eV 1.5
      4.0*eV 1.5
      5.1*eV 1.5
      "/>
    <matrix name= "REFLECTIVITY_mirror" coldim="2" values="  
      1.0*eV  0.9
      4.0*eV  0.9
      5.1*eV  0.9
    "/>

  </properties>
  
  <materials>
    <material name="N2cherenkov">
      <D type="density" value="0.00125" unit="g/cm3"/>
      <composite n="1" ref="N"/>
      <property name="RINDEX"   ref="RINDEX__N2"/>
    </material>
    <material name="PyrexCherenkov">
      <D type="density" value="2.23" unit="g/cm3"/>
      <fraction n="0.806" ref="SiliconOxide"/>
      <fraction n="0.130" ref="BoronOxide"/>
      <fraction n="0.040" ref="SodiumOxide"/>
      <fraction n="0.023" ref="AluminumOxide"/>
      <property name="RINDEX"   ref="RINDEX__Pyrex"/>
    </material>
  </materials>

  <surfaces>
    <comment> For the values of "finish", model and type, see TGeoOpticalSurface.h !  </comment>
    <opticalsurface name="MirrorOpticalSurface" finish="polished" model="glisur" type="dielectric_metal" value="0">
      <property name="REFLECTIVITY" ref="REFLECTIVITY_mirror"/>
      <property name="RINDEX"       coldim="2" values="1.034*eV  1.5   4.136*eV  1.5"/>
      <!--<property name="EFFICIENCY"   ref="EFFICIENCY0x8b77240"/>-->
    </opticalsurface>
    <opticalsurface name="PMTOpticalSurface" finish="polished" model="glisur" type="dielectric_dielectric" value="0">
      <property name="RINDEX"       coldim="2" values="1.034*eV  1.5   4.136*eV  1.5"/>
      <!--<property name="EFFICIENCY"   ref="EFFICIENCY0x8b77240"/>-->
    </opticalsurface>
    <opticalsurface name="mirror2" finish="polished" model="glisur" type="dielectric_dielectric">
      <property name="REFLECTIVITY"            coldim="2" values="1.034*eV  0.8   4.136*eV  0.9"/>
      <property name="EFFICIENCY"              coldim="2" values="2.034*eV  0.8   4.136*eV  1.0"/>
      <property name="RINDEX"                  coldim="2" values="1.034*eV  1.5   4.136*eV  1.5"/>
    </opticalsurface>
  </surfaces>

  <limits>
    <limitset name="cal_limits">
      <limit name="step_length_max" particles="*" value="5.0" unit="mm" />
    </limitset>
    <limitset name="SiTrackerBarrelRegionLimitSet">
      <limit name="step_length_max" particles="*" value="5.0" unit="mm" />
      <limit name="track_length_max" particles="*" value="5.0" unit="mm" />
      <limit name="time_max" particles="*" value="5.0" unit="ns" />
      <limit name="ekin_min" particles="*" value="0.01" unit="MeV" />
      <limit name="range_min" particles="*" value="5.0" unit="mm" />
    </limitset>
  </limits>
  <regions>
    <region name="SiTrackerBarrelRegion" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001">
      <limitsetref name="SiTrackerBarrelRegionLimitSet"/>
    </region>
  </regions>

  <comment>Common Generic visualization attributes</comment>
  <display>
    <vis name="InvisibleNoDaughters"      showDaughters="false" visible="false"/>
    <vis name="InvisibleWithDaughters"    showDaughters="true" visible="false"/>
    <vis name="GreenVisNoDaughters"   alpha="0.3"  r= "0.0" g="1.0" b="0.0" showDaughters="false" visible="true"/>
    <vis name="GreenVis"       alpha="1.0"  r= "0.0" g="1.0" b="0.0" showDaughters="true" visible="true"/>
    <vis name="RedVis"         alpha="0.5"  r= "1.0" g="0.0" b="0.0" showDaughters="true" visible="true"/>
    <vis name="BlueVis"        alpha="0.5"  r= "0.0" g="0.0" b="1.0" showDaughters="true" visible="true"/>
    <vis name="OrangeVis"      alpha="1.0"  r= "1.0" g="0.45" b="0.0" showDaughters="true" visible="true"/>
    <vis name="RedGreenVis"    alpha="0.5"  r= "1.0" g="1.0" b="0.0" showDaughters="true" visible="true"/>
    <vis name="BlueGreenVis"   alpha="0.5"  r= "0.0" g="1.0" b="1.0" showDaughters="true" visible="true"/>
    <vis name="PurpleVis"      alpha="0.5"  r= "1.0" g="0.0" b="1.0" showDaughters="true" visible="true"/>
    <vis name="DoubleRedG"     alpha="0.5"  r= "2.0" g=".10" b="0.0" showDaughters="true" visible="true"/>
    <vis name="RBG015"         alpha="0.5"  r= "0.0" g=".2"  b="1.0" showDaughters="true" visible="true"/>
    <vis name="RBG510"         alpha="0.5"  r= "1.0" g=".2"  b="0.0" showDaughters="true" visible="true"/>
    <vis name="RBG"            alpha="0.5"  r= "1.0" g="1.0" b="1.0" showDaughters="true" visible="true"/>
    <vis name="SteelVis"       alpha="0.05"  r= "0.75" g="0.75" b="0.75" showDaughters="true" visible="true"/>
    <vis name="GrayVis"        alpha="0.5"  r= "0.75" g="0.75" b="0.75" showDaughters="true" visible="true"/>
  </display>

  <comment>Additional design specific material definitions</comment>
  <!--<include ref="SiD/SiD_Materials.xml"/>-->

  <detectors>
    <detector id="10" name="StandInVolumes" vis="GreenVis" type="StandInGeometrySOLID" > </detector>

    <detector id="1" name="SIDIS_NH3Target" vis="GreenVis" type="NH3Target" > </detector>

    <!-- GEM Tracker
    ids = 2
    -->
    <include ref="solid/GEM_sidis.xml"/>

    <!-- Large Angle Electromagnetic Calorimeter 
    ids = 3,4  => PS,EC
    -->
    <include ref="solid/LAEC.xml"/>

    <!-- Forward Angle Electromagnetic Calorimeter 
    ids = 5,6  => PS,EC
    -->
    <include ref="solid/FAEC.xml"/>

    <!-- Light Gas Cherenkov
    id = 7 
    -->
    <include ref="solid/LGC.xml"/>

    <!-- Heavy Gas Cherenkov
    id = 8 
    -->
    <include ref="solid/HGC.xml"/>


  </detectors>

  <!--  Definition of the readout segmentation/definition  -->
  <readouts>
    <readout name="LAEC_PrShHits">
      <segmentation type="NoSegmentation" />
      <id>system:6,module:20,layer:10,slice:5,x:48:-8,y:-8</id>
    </readout>
    <readout name="LAEC_ShHits">
      <segmentation type="NoSegmentation" />
      <id>system:6,module:20,layer:10,slice:5,x:48:-8,y:-8</id>
    </readout>
    <readout name="FAEC_PrShHits">
      <segmentation type="NoSegmentation" />
      <id>system:6,module:20,layer:10,slice:5,x:48:-8,y:-8</id>
    </readout>
    <readout name="FAEC_ShHits">
      <segmentation type="NoSegmentation" />
      <id>system:6,module:20,layer:10,slice:5,x:48:-8,y:-8</id>
    </readout>
    <readout name="GEMTrackerHits">
      <segmentation type="CartesianGridXY" grid_size_x="1*mm" grid_size_y="1*mm" />
      <id>system:6,layer:5,module:16,slice:5,x:32:-16,y:-16</id>
      <!--
      <segmentation type="StereoStrip" strip_angle="15.0*degree" strip_size="0.5*mm" />
      <id>system:6,layer:5,module:16,slice:5,u:32:-32</id>
      -->
    </readout>
    <readout name="LightGasCherenkovHits">
      <segmentation type="CartesianGridXY" grid_size_x="3*mm" grid_size_y="3*mm" />
      <id>system:6,sector:11,mirror:4,module:10,x:32:-16,y:-16</id>
    </readout>
    <readout name="HeavyGasCherenkovHits">
      <segmentation type="CartesianGridXY" grid_size_x="3*mm" grid_size_y="3*mm" />
      <id>system:6,sector:11,mirror:4,module:10,x:32:-16,y:-16</id>
    </readout>

  </readouts>
    <!--
    <readout name="LAECalHits">
      <id>system:6,module:24,layer:6,slice:5</id>
    </readout>
    <readout name="SiTrackerBarrelHits">
      <id>system:8,barrel:3,layer:4,module:14,sensor:2,side:32:-2,strip:24</id>
    </readout>
    <readout name="SiTrackerEndcapHits">
      <id>system:8,barrel:3,layer:4,module:14,sensor:2,side:32:-2,strip:24</id>
    </readout>
    <readout name="SiVertexEndcapHits">
      <id>system:8,barrel:3,layer:4,wedge:6,module:6,sensor:1,side:32:-2,strip:26</id>
    </readout>
-->

  <plugins>
    <!--
    <plugin name="DD4hep_SiTrackerBarrelSurfacePlugin">
      <argument value="SiVertexBarrel" />
      <argument value="dimension=2" />
    </plugin>

    <plugin name="DD4hep_SiTrackerEndcapSurfacePlugin">
      <argument value="SiVertexEndcap"/>
      <argument value="dimension=1"/>
    </plugin>

    <plugin name="DD4hep_SiTrackerBarrelSurfacePlugin">
      <argument value="SiTrackerBarrel"/>
      <argument value="dimension=2"/>
    </plugin>
    -->
    <plugin name="DD4hepVolumeManager" />
    <plugin name="InstallSurfaceManager" />
  </plugins>

  <fields>
    <field name="CLEO_field" type="FieldMapBrBz" field_type="magnetic"
           field_map="fieldmaps/solenoid_CLEOv8.dat" 
           url="https://jlabsvn.jlab.org/svnroot/solid/solid_gemc2/field/solenoid_CLEOv9.dat">
      <dimensions>
        <transverse step="1.0*cm" rmin="0*cm" rmax="500*cm" />
        <longitudinal step="1.0*cm" zmin="-600*cm" zmax="600*cm" />
        <translation x="100.0*cm" y="0.0*cm" z="0.0*cm" />
        <rotation x="0" y="0" z="0" />
      </dimensions>
    </field>
  </fields>
</lccdd>
