<?xml version="1.0" ?>
<!DOCTYPE config [
  <!ELEMENT config (notes, modes, delegates, outfiles) >

  <!ELEMENT modes (notes?, mode*) >
  <!ELEMENT delegates (notes?, delegate*) >
  <!ELEMENT FSWinputs  (notes?, FSWinputs*) >

  <!ELEMENT notes (#PCDATA) >

  <!ELEMENT mode (delegateRef+) >
  <!ATTLIST mode name CDATA #REQUIRED >

  <!ELEMENT delegateRef EMPTY>
  <!ATTLIST delegateRef ref IDREF #REQUIRED>

  <!ELEMENT delegate (notes, (parm | parmGroup)+) >
  <!ATTLIST delegate name CDATA #REQUIRED
                     id   ID    #REQUIRED
                     TLA  NMTOKEN #IMPLIED
                     out   IDREF     #IMPLIED>

  <!ELEMENT parm (notes?) >
  <!ATTLIST parm    name    CDATA #REQUIRED
                    TLA     NMTOKEN #IMPLIED
                    out     IDREF     #IMPLIED>

  <!ELEMENT parmGroup (notes?, parm+) >
  <!ATTLIST parmGroup    name    CDATA #REQUIRED
                         TLA     NMTOKEN #IMPLIED
                         out     IDREF     #IMPLIED>

  <!ELEMENT FSWinput (notes?)>
  <!ATTLIST FSWinput service (LATC | LCI | CDM) #REQUIRED
                     id   ID #REQUIRED>

] >

<config>
  <notes>Information on the whiteboard after morning meeting of Aug. 8.  
         File contains a list of operating modes, followed by a list
         of &lt;delegates&gt; (in the MOOT sense;
         see e.g. http://www.slac.stanford.edu/exp/glast/ground/notes/moot/moot21july05.shtml) 
         and a list of &lt;FSWinputs&gt;.

  </notes>
  <modes>
    <mode name="Physics">
       <delegateRef ref="HSK" />
       <delegateRef ref="LTC" />
       <delegateRef ref="EBM" />
       <delegateRef ref="Timing" />
       <delegateRef ref="GEMdelegate" />
       <delegateRef ref="EFC" />
       <delegateRef ref="ACD" />
       <delegateRef ref="CAL" />
       <delegateRef ref="TKR" />
       <delegateRef ref="Power"  />
     </mode>
    <mode name="CI">
       <delegateRef ref="HSK" />
       <delegateRef ref="LTC" />
       <delegateRef ref="EBM" />
       <delegateRef ref="Timing" />
       <delegateRef ref="GEMdelegate" />
       <delegateRef ref="EFC" />
       <delegateRef ref="ACD" />
       <delegateRef ref="CAL" />
       <delegateRef ref="TKR" />
       <delegateRef ref="Power"  />
       <delegateRef ref="LCI"  />
     </mode>
  </modes>
  <delegates>
    <notes>A &lt;delegate&gt; may have arbitrary collections of &lt;parm&gt; 
         and &lt;parmGroup&gt; children; a &lt;parmGroup&gt; may also have
         &lt;parm&gt; and &lt;parmGroup&gt; children, so the hierarchy
         under a &lt;delegate&gt; may be to arbitrary depth. 

         The smallest possible number of &lt;parm&gt;s should be used,
         subject to the following conditions: 1)
 information belonging to
         a single &lt;parm&gt; must all be destined for the same FSW
         input and 2) validity lifetime of all information encompassed 
         in a single &lt;parm&gt; should be approximately the same
         3) all information belonging to a single &lt;parm&gt; should
         come from "the same place".
    </notes>
    <delegate name="Housekeeping" TLA="HSK"  id="HSK" out="LHKout">
      <notes>Configuration parameters for LAT housekeeping</notes>
      <parm name="schedule" />
    </delegate>

    <delegate name="LAT Charge Injection" id="LCI" TLA="LCI">
      <notes>Configuration for charge injection calibrations.  May also 
           be enhanced to handle timing scans. This is the only delegate
           which allows registers to be set dynamically and
           repeatedly under program control.  Other delegates concerned
           with registers ask to set them once.</notes>
      <parm name="CAL_calib" out="LCI_CALout" >
        <notes>Can concatenate descriptions of multiple scans in
               a single calibration, but there is no easy way to 
               express that here.  If calibrations are typically done
               by running several scans in sequence, it may be a lost
               cause to try to specify it all here.  Would be better
               to just let CAL_calib take a single value, which is a
               reference to a file containing all the details.  
               Same would go for ACD and TKR calibrations.
        </notes>
      </parm>
      <parm name="TKR_calib" out="LCI_TKRout"  />
      <parm name="ACD_calib" out="LCI_ACDout" />
    </delegate>

    <delegate name="LAT Thermal Control" TLA="LTC" id="LTC" out="LTCout" >
      <notes>Thermal control parameters.  
           Since input values all go into the same
           FSW file and probably tend to have the same lifetime,
           just need one &lt;parm&gt; element</notes>
      <parm name="thermal" />
<!--  More detailed description might be something like
      <parm name="sampling" />
      <parm name="conversion constants" />
      <parm name="mappings" />
      <parm name="limits" />
-->
    </delegate>

    <delegate name="Event Builder Module" TLA="EBM" id="EBM" out="EBMout" >
      <notes>Does EBM really stand for 'Event Buffer Manager' ?
           In any case, there isn't much here and it should
           hardly change.</notes>
      <parm name="cpumask">
        <notes>Not sure this belongs here; may belong under PIG</notes>
      </parm>
      <parm name="SSR prefix" />
    </delegate>

    <delegate name="Timing" id="Timing">
      <notes>Output for this one will be scattered among different LATC 
           output files.
      </notes>
      <parmGroup name="TKR timing" >
        <parm name="OR stretch" />
      </parmGroup>
      <parm name="CAL timing" />
      <parm name="GEM timing" />
      <parm name="ACD timing" >
        <notes>Is this contained within a single LATC output, or is it
               split, e.g., between AEMout and ARCout?</notes>
      </parm>
    </delegate>

    <delegate name="GEM" id="GEMdelegate" out="GEMout" >
      <notes>Should check that everything here really does end up in 
           GEMout</notes>
      <parm name="Regions Of Interest" TLA="ROI" />
      <parm name="window enable">
        <notes>this one was questionable (paranthesized)</notes>
      </parm>
      <parmGroup name="res ??" >
        <notes>Couldn't make out the word on the whiteboard</notes>
        <parm name="TAMs" />
        <parm name="mappings" />
      </parmGroup>
    </delegate>

    <delegate name="Physics parameters (event filter, others)" TLA="EFC" >
      <notes>Output must be handled by CDM.  How many pieces are there? </notes>
      <parm name="cal gains" />
      <parm name="cal peds" />
      <parm name="acd gains" />
      <parm name="acd peds" />
      <parmGroup name="filters" >
        <notes>n instances of the parms below. </notes>
        <parm name="filter parms" />
        <parm name="sampling parms" />
        <parm name="status parms" />
      </parmGroup>
      <parm name="GRB parms" />
    </delegate>

    <delegate name="Anti-coincidence Detector" id="ACD" TLA="ACD" >
      <notes>Output for this one will be split among different
           LATC files; needs to be understood and specified
           in detail.</notes>
      <parm name="membership" >
        <notes>
         This was paranthesized. Was it because it's handled by PIG?
      </notes>
      </parm>
      <parm name="masks" >
        <notes>Will need to change over time. 
               Need to change this to a parmGroup with individual
               values for readout controller masks
               (out='ARCout') and FE masks (out='AFEout').</notes>
      </parm>
      <parmGroup name="thresholds" >
        <parm name="lo" out="AFEout">
          <notes>Veto DAC register and veto vernier register?</notes>
        </parm>
        <parm name="hi (CNO)" TLA="CNO" />
        <parm name="data" out="ARCout">
          <notes>PHA threshold registers</notes>
        </parm>
      </parmGroup>
      <parmGroup name="bias voltages" out="ARCout">
        <parm name="Operating" TLA="Op" />
        <parm name="SSA" />
      </parmGroup>
      <parm name="RC trimming" out="ARCout">
        <notes>Seems to correspond to Max PHA enable register</notes>
      </parm>
    </delegate>

    <delegate name="Calorimeter" id="CAL" TLA="CAL" >
      <notes>Output for this one will be split among different
           LATC files; needs to be understood and specified
           in detail.</notes>
      <parm name="membership" >
        <notes>
         This was paranthesized. Was it because it's handled by PIG?
      </notes>
      </parm>
      <parm name="masks" >
        <notes>Will need to change over time.  Should change to 
               a parmGroup with individual &lt;parm&gt; children
               for  </notes>
      </parm>
      <parm name="FIFO depths" />
      <parmGroup name="thresholds" >
        <parm name="lo" />
        <parm name="hi" />
        <parm name="data" />
      </parmGroup>
      <parm name="bias voltages" />
      <parm name="RC trimming" />
    </delegate>

    <delegate name="Tracker" id="TKR" TLA="TKR" >
      <notes>Output for this one will be split among different
           LATC files; needs to be understood and specified
           in detail.</notes>
      <parm name="membership" >
        <notes>
         This was paranthesized. Was it because it's handled by PIG?
      </notes>
      </parm>
      <parm name="masks" >
        <notes>Will need to change over time</notes>
      </parm>
      <parm name="splits" out="SPTout" >
        <notes>Will need to change over time</notes>
      </parm>
      <parm name="FIFO depths" />
      <parm name="thresholds" />
      <parm name="bias voltages" />
      <parm name="RC trimming" />
      <parm name="Three-in-a-row" TLA="TIR" />
    </delegate>

    <delegate name="Power" id="Power" >
      <notes>This delegate is different from the others in that it is
            not handled by FMX; hence there is no associated &lt;FSWinput&gt;. 
            MOOT probably will not be involved in establishing a 
            particular state, but it might be involved in tracking 
            the state.
            </notes>
      <parmGroup name="primaryRedundant" >
         <notes>For several objects a choice must be made whether to
               use the primary or redundant unit (or neither or both,
                if it makes sense). List below is not
               exhaustive.</notes>
         <parm name="mainfeed" />
         <parm name="PDU" />
         <parm name="SIU" />
      </parmGroup>
      <parm name="TEMSpower" >
        <notes>Which ones are on.  Maybe should have a separate
              parameter for each</notes>
      </parm>
      <parm name="ACDpower" />
      <parm name="EPUSpower" >
         <notes>Same comments as for TEMSpower: keep track of which
             are on.  May want separate parameter for each EPU.</notes>
      </parm>

    </delegate>

  </delegates>

  <FSWinputs>
    <notes>  An &lt;FSWinput&gt; represents one
         of the kinds of files to be input to a FSW service. These
         should almost map 1-1 to files output by FSW. LATC
         outputs 15 different kinds of files, by last count. LCI outputs
         one kind, and CDM will ultimately transform all other kinds
         of input (housekeeping, event filter parameters,...)
    </notes>
    <FSWinput id="LHKout" service="CDM">
      <notes>Single output for LAT Housekeeping parameters</notes>
    </FSWinput>



    <FSWinput id="GEMout" service="LATC">
    </FSWinput>


    <FSWinput id="AEMout" service="LATC">
    </FSWinput>

    <FSWinput id="ARCout" service="LATC">
      <notes>For ACD readout controller registers</notes>
    </FSWinput>

    <FSWinput id="AFEout" service="LATC">
      <notes>For ACD front-end registers</notes>
    </FSWinput>

    <FSWinput id="TEMout" service="LATC">
    </FSWinput>
    <FSWinput id="TICout" service="LATC">
      <notes>For Trigger Interface Control registers</notes>
    </FSWinput>

    <FSWinput id="CCCout" service="LATC">
      <notes>For Calorimeter Cable Controller registers</notes>
    </FSWinput>

    <FSWinput id="CRCout" service="LATC">
      <notes>For Calorimeter Readout Controller registers</notes>
    </FSWinput>

    <FSWinput id="CFEout" service="LATC">
      <notes>For Calorimeter Front-End registers</notes>
    </FSWinput>

  
    <FSWinput id="TCCout" service="LATC">
      <notes>For Tracker Cable Controller registers</notes>

    </FSWinput>

    <FSWinput id="TRCout" service="LATC">
      <notes>For Tracker Readout Controller registers</notes>

    </FSWinput>

    <FSWinput id="SPTout" service="LATC">
      <notes>Guessing this is for Tracker splits </notes>
    </FSWinput>

    <FSWinput id="TFEout" service="LATC">
      <notes>For Tracker Front-End registers</notes>

    </FSWinput>

    <FSWinput id="TDCout" service="LATC">
      <notes>For Tracker Digital Converter registers</notes>

    </FSWinput>

    <FSWinput id="Default" service="LATC">
      <notes>FSW output binary contains values for one each of the 
             register classes (GEM,
             AEB, ARC, AFE,...)  This has no corresponding MOOT source file;
             it is created when LATC is asked to make a (LATC) master
             config file, so perhaps should change name to master
      </notes>
    </FSWinput>

    <FSWinput id="LCI_CALout" service="LCI">
      <notes>CAL charge injection config. </notes>
    </FSWinput>
    <FSWinput id="LCI_TKRout" service="LCI">
      <notes>TKR charge injection config. </notes>
    </FSWinput>
    <FSWinput id="LCI_ACDout" service="LCI">
      <notes>ACD charge injection config. </notes>
    </FSWinput>

    <FSWinput id="LTCout" service="CDM">
      <notes>Single output for Thermal Control parameters</notes>
    </FSWinput>

    <FSWinput id="EBMout" service="CDM">
      <notes>Need to check that there really is such a thing as an output
           file dedicated to EBM</notes>
    </FSWinput>

  </FSWinputs>
</config>

  




  
