<!--
   $Header: /nfs/slac/g/glast/ground/cvs/calibUtil/xml/badStrips.dtd,v 1.4 2002/05/02 21:01:32 jrb Exp $

   /**  @file       badStrips.dtd
        @authors    J. Bogart

        dtd for bad strips data file

    */

    Would be good to switch to schema so that common header elements
    could be included easily in schema for different calibration types.
 -->
       
<!-- Container for all the header/metadata type information to be
     included here.  Complete metadata will be found in the calibration
     MySQL database. 

     Description of attributes:

            instrument    - one of "flight", "EM", etc.  Could also
                            be implemented as enumeration rather than
                            NMTOKEN
            timestamp     - when the file was written (date and time)
            calType       - one of "TKRBadStrips", "CALLightAttenuation",
                            etc.
            formatVersion - sufficient versioning information so that
                            software attempting to read the file can
                            determine if it supports this version. 
                            [Might get rid of this here and just keep
                            it in the MySQL metadata table]
 -->

<!ELEMENT badStrips (generic, cuts, tower*) >
<!ATTLIST badStrips badType (hot | dead) #REQUIRED >

<!ELEMENT  generic  (inputSample) >
<!ATTLIST generic  
   instrument  (flight | BFEM | BTEM | EM | CU) #REQUIRED
   timestamp   NMTOKEN #REQUIRED
   calType     NMTOKEN #REQUIRED
   fmtVersion  NMTOKEN #IMPLIED >

<!-- Description of events used as input to the procedure 
     Start- and stop-times should be timestamps of earliest and
     latest events included in sample
-->
<!ELEMENT inputSample (#PCDATA) >
<!ATTLIST inputSample  startTime NMTOKEN #REQUIRED
                       stopTime  NMTOKEN #REQUIRED
                       triggers  NMTOKENS #REQUIRED 
                       source    NMTOKENS #REQUIRED
                       mode      NMTOKEN  #REQUIRED>

<!-- "tight", "loose" and "expected" are all expressed as percentage
     of events for which a strip is hit, and all are affected by the
     kind of event sample.

     "expected" is the percentage expected for a healthy channel.
     "tight" will be somewhat more than "expected" if we're looking
     for hot channels, less than "expected" if we're looking for
     dead.
     "loose" will be further from "expected" than "tight", but in the
     same direction.    
 -->
<!ELEMENT cuts EMPTY>
<!ATTLIST cuts  tight       NMTOKEN #REQUIRED
                loose       NMTOKEN #REQUIRED
                expected    NMTOKEN #REQUIRED >

<!-- Towers are identified by row and column (least subject
     to misinterpretation for different instruments 
     Only include towers for which there is at least one
     tray with bad strips
-->
<!ELEMENT tower (tray+) >
<!ATTLIST tower row NMTOKEN #REQUIRED 
                col NMTOKEN #REQUIRED >

<!--  Tray is identified by a number (zero based, back-most tray
      is tray 0, according to Steve Ritz convention).  Don't
      mention a tray unless at least one of its two planes
      has bad strips.
  -->
<!ELEMENT tray (unilayer, unilayer?) >
<!ATTLIST tray trayNum NMTOKEN #REQUIRED >

<!-- For each plane containing bad strips, include a list or span(s) 
     for barely bad and very bad strips in that plane -->

<!ELEMENT unilayer ((bad, veryBad?) | (veryBad, bad?) ) >
<!ATTLIST unilayer which  (top | bot) #REQUIRED >

<!ELEMENT bad (stripList?, stripSpan*) >
<!ELEMENT veryBad (stripList?, stripSpan*) >
<!ELEMENT stripList EMPTY >
<!ATTLIST stripList strips NMTOKENS #REQUIRED >
<!ELEMENT stripSpan EMPTY >
<!ATTLIST stripSpan first NMTOKEN #REQUIRED
                    last  NMTOKEN #REQUIRED >