Making your own XML

From Nuclear Physics Group Documentation Pages
Revision as of 16:53, 25 October 2007 by Kyle (talk | contribs)
Jump to navigationJump to search

The xml files defining the geometry you want smash particles into is fairly straightforward. I am no expert on the matter but xml is pretty intuitive. The first example is a simple xml file I created/hacked from clas12.xml in order to use just the target and our SVT. It is the full file seperated into chunks with dashed lines. The dashed lines should NOT be in your xml file. Each section seperated by dashed lines is described in it's own area below.


Example 1 - Full file, just SVT 1 & 2

-----------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HDDS [
  <!ENTITY Regions_s   SYSTEM  "Regions_clas12.xml">
  <!ENTITY Material_s  SYSTEM  "Material_HDDS.xml">

  <!-- DETECTORS -->
  <!ENTITY INNER_spec_s       SYSTEM  "inner_detector_HDDS.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 HDDS-1_0.xsd">

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


<section name          = "Kyle's Geometry"
         version       = ".01"
         date          = "2007-10-25"
         author        = "Kyle Snavely"
         top_volume    = "SITE"
         specification = "v1.0"
>

 
 <box name="SITE" X_Y_Z="3000. 3000. 3000." material="Vacuum" comment="Master Volume" >
<!--   <apply region="ihep-solenoid"/>-->
 </box>


<!-- Inner Detector -->
  &INNER_spec_s;

<composition name="centralCLAS" envelope="CENT">
    <posXYZ volume="TARG" X_Y_Z="0. 0. 0."    />
    
    <posXYZ volume="SVT1" X_Y_Z="0. 0. 0."    />
    <posXYZ volume="SVT2" X_Y_Z="0. 0. 0."    />
</composition>



<!--Everything-->
  <composition name="everything" envelope="SITE">
  <posXYZ  volume="centralCLAS" X_Y_Z="0. 0. 0." />
  </composition>

</section>

</HDDS>

XML Decleration and DOCTYPE

The markup below contains the basic information the computer needs to read our XML. The line <?xml version="1.0" encoding="UTF-8"?> is the XML decleration. It tells whatever is using the XML which...well which version and character encoding our document uses. It's nothing to be concerned about but one should include it in his or her documents.

More importantly is the line <!DOCTYPE HDDS [.........]> The word HDDS signifies that our document is coded with tags from the HDDS document type definition; ie it is an HDDS document. The lines <!ENTITY Regions_s SYSTEM "Regions_clas12.xml"> and <!ENTITY Material_s SYSTEM "Material_HDDS.xml"> Basically tell one that any information regarding 'Regions_s' is found in 'Regions_clas12.xml'; the same for Material_s.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HDDS [
  <!ENTITY Regions_s   SYSTEM  "Regions_clas12.xml">
  <!ENTITY Material_s  SYSTEM  "Material_HDDS.xml">

  <!-- DETECTORS -->
  <!ENTITY INNER_spec_s       SYSTEM  "inner_detector_HDDS.xml">
]>