<?xml version="1.0" ?>
<!DOCTYPE badStrips [
<!--
   $Header: /nfs/slac/g/glast/ground/cvs/calibUtil/xml/badStrips.dtd,v 1.13 2005/03/15 22:01:13 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  NMTOKEN #REQUIRED
   timestamp   NMTOKEN #IMPLIED
   runId       NMTOKEN #IMPLIED
   calType     NMTOKEN #IMPLIED
   DTDVersion  NMTOKEN "v3r2"
   fmtVersion  NMTOKEN #IMPLIED
   creatorName NMTOKEN #IMPLIED
   creatorVersion 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 CDATA #REQUIRED
                       stopTime  CDATA #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

     To mark all strips in a tower as bad in the same way, set
     one or more of the attributes nOnbdCalib, nOnbdTrig, nOnbdData 
     to "true".  These are meant to correspond to similarly named
     bits in the hardware.

     See also <uniplane>, which has the same collection of attributes

     Meanings are:
           nOnbdCalib   - not usable for charge injection calibration
           nOnbdTrig     - not usable by trigger
           nOnbdData     - not usable for recon, data analysis 
-->

<!ELEMENT tower (uniplane*) >
<!ATTLIST tower row NMTOKEN #REQUIRED 
                col NMTOKEN #REQUIRED 
                hwserial NMTOKEN "-1"
                nOnbdCalib  (true | false) "false"
                nOnbdTrig    (true | false) "false"
                nOnbdData    (true | false) "false"  >

<!-- Each uniplane is identified by a tray # (zero based, back-most tray
      is tray 0, according to Steve Ritz convention) and top/bottom
      field.   A uniplane is either all bad or specifies which strips
      are bad.  Within a givin tower, there should be at most one
      instance of a particular uniplane whose strips are a particular
      "badness", but dtd can't enforce this constraint.
  -->
<!--  
    Don't be so fussy
<!ELEMENT uniplane (stripList?, stripSpan*) >
 -->
<!ELEMENT uniplane (stripList?, stripSpan?)* >
<!ATTLIST uniplane tray      NMTOKEN #REQUIRED
                   which       (top | bot) #REQUIRED
                   nOnbdCalib  (true | false) "false"
                   nOnbdTrig   (true | false) "false"
                   nOnbdData   (true | false) "false"  
                   howBad    NMTOKEN          "0"
                   allBad      (true | false) "false" >

<!-- For each plane containing bad strips of a particular badness,
     include a list or span(s)  of affected strips, or mark it
     as all bad.
 -->

<!ELEMENT stripList EMPTY >
<!ATTLIST stripList strips NMTOKENS #REQUIRED >
<!ELEMENT stripSpan EMPTY >
<!ATTLIST stripSpan first NMTOKEN #REQUIRED
                    last  NMTOKEN #REQUIRED >

]>
<badStrips badType="hot">
             
  <generic calType="HotStrips" creatorName="tkrMonitor.py" creatorVersion="1.1" fmtVersion="NA" instrument="TWR" runId="237652163" timestamp="080714223947">
    <inputSample mode="NA" source="EmptyData" startTime="Mon 07/14 2008, 22:39 GMT" stopTime="Mon 07/14 2008, 22:39 GMT" triggers="SolicitedTrigger">
      
 Output from LSR bad strips alg, running on MC data
    </inputSample>
  </generic>
  <tower col="3" hwserial="TkrFM9" row="2">
    <!--Layer Y17, unp 35, CC pair (5,4), RC 8-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="18" which="bot"/>
    <!--Layer X17, unp 34, CC pair (6,7), RC 8-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="17" which="top"/>
    <!--Layer X16, unp 33, CC pair (3,2), RC 8-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="17" which="bot"/>
    <!--Layer Y16, unp 32, CC pair (0,1), RC 8-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="16" which="top"/>
    <!--Layer Y15, unp 31, CC pair (5,4), RC 7-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="16" which="bot"/>
    <!--Layer X15, unp 30, CC pair (6,7), RC 7-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="15" which="top"/>
    <!--Layer X14, unp 29, CC pair (3,2), RC 7-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="15" which="bot"/>
    <!--Layer Y14, unp 28, CC pair (0,1), RC 7-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="14" which="top"/>
    <!--Layer Y13, unp 27, CC pair (5,4), RC 6-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="14" which="bot"/>
    <!--Layer X13, unp 26, CC pair (6,7), RC 6-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="13" which="top"/>
    <!--Layer X12, unp 25, CC pair (3,2), RC 6-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="13" which="bot"/>
    <!--Layer Y12, unp 24, CC pair (0,1), RC 6-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="12" which="top"/>
    <!--Layer Y11, unp 23, CC pair (5,4), RC 5-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="12" which="bot"/>
    <!--Layer X11, unp 22, CC pair (6,7), RC 5-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="11" which="top"/>
    <!--Layer X10, unp 21, CC pair (3,2), RC 5-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="11" which="bot"/>
    <!--Layer Y10, unp 20, CC pair (0,1), RC 5-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="10" which="top"/>
    <!--Layer Y9, unp 19, CC pair (5,4), RC 4-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="10" which="bot"/>
    <!--Layer X9, unp 18, CC pair (6,7), RC 4-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="9" which="top"/>
    <!--Layer X8, unp 17, CC pair (3,2), RC 4-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="9" which="bot"/>
    <!--Layer Y8, unp 16, CC pair (0,1), RC 4-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="8" which="top"/>
    <!--Layer Y7, unp 15, CC pair (5,4), RC 3-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="8" which="bot"/>
    <!--Layer X7, unp 14, CC pair (6,7), RC 3-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="7" which="top"/>
    <!--Layer X6, unp 13, CC pair (3,2), RC 3-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="7" which="bot"/>
    <!--Layer Y6, unp 12, CC pair (0,1), RC 3-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="6" which="top"/>
    <!--Layer Y5, unp 11, CC pair (5,4), RC 2-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="6" which="bot"/>
    <!--Layer X5, unp 10, CC pair (6,7), RC 2-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="5" which="top"/>
    <!--Layer X4, unp 9, CC pair (3,2), RC 2-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="5" which="bot"/>
    <!--Layer Y4, unp 8, CC pair (0,1), RC 2-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="4" which="top"/>
    <!--Layer Y3, unp 7, CC pair (5,4), RC 1-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="4" which="bot"/>
    <!--Layer X3, unp 6, CC pair (6,7), RC 1-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="3" which="top"/>
    <!--Layer X2, unp 5, CC pair (3,2), RC 1-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="3" which="bot"/>
    <!--Layer Y2, unp 4, CC pair (0,1), RC 1-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="2" which="top"/>
    <!--Layer Y1, unp 3, CC pair (5,4), RC 0-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="2" which="bot"/>
    <!--Layer X1, unp 2, CC pair (6,7), RC 0-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="1" which="top"/>
    <!--Layer X0, unp 1, CC pair (3,2), RC 0-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="1" which="bot"/>
    <!--Layer Y0, unp 0, CC pair (0,1), RC 0-->
    <uniplane howBad="1" nOnbdCalib="false" nOnbdData="false" nOnbdTrig="false" tray="0" which="top"/>
  </tower>
</badStrips>
