<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE gdd SYSTEM 'gdd.dtd'>
<gdd>
  <package name = 'TbEvent'>
    <class name = 'TbState'
           author = 'Panagiotis Tsopelas, Wouter Hulsbergen'
           desc = '4D state vector with z position'>
      
      <location name = "Default" place = "Rec/Tb/TbStates"/>
      <import name = "GaudiKernel/MsgStream" />
      <import name = "GaudiKernel/Point3DTypes"/>
      <import name = "GaudiKernel/Vector3DTypes"/>
      <import name = "GaudiKernel/GenericVectorTypes"/>
      <import name = "GaudiKernel/SymmetricMatrixTypes"/>
      &StlPtrVector;
      
      <constructor desc = 'Default constructor'
                   initList = "m_parameters(), m_covariance(), m_z(0.), m_plane(0)">
      </constructor>
      
      <constructor desc = "Constructor with arguments"
                   argList = "const Gaudi::Vector4&amp; state, 
                              const Gaudi::SymMatrix4x4&amp; cov, 
                              const double&amp; z, const unsigned int&amp; plane"
                   initList = "m_parameters(state), m_covariance(cov), m_z(z), m_plane(plane)">
      </constructor>
      
      <attribute type = 'Gaudi::Vector4'
                 name = 'parameters'
                 desc = 'the parameter vector'
                 setMeth = 'FALSE'
                 access  = 'PRIVATE'
                 nonconstaccessor = 'TRUE'/>
      
      <attribute type = 'Gaudi::SymMatrix4x4'
                 name = 'covariance'
                 desc = 'covariance matrix (indices 0 ... 3 for x, y, tx, ty)'
                 setMeth = 'FALSE'
                 access  = 'PRIVATE'
                 nonconstaccessor = 'TRUE'/>
      
      <attribute type = 'double'
                 name = 'z'
                 desc = 'the z-position of the state'
                 setMeth = 'FALSE'
                 access = 'PRIVATE'/>

      <attribute type = 'unsigned int'
                 name = 'plane'
                 desc = 'the plane of the state'/>

      <method type = 'double'
              name = 'errX2'
              desc = 'Retrieve the squared error on the x-position of the state'
              const = 'TRUE'>
        <code>
  return m_covariance(0, 0);
        </code>
      </method>
      
      <method type = 'double'
              name = 'errY2'
              desc = 'Retrieve the squared error on the y-position of the state'
              const = 'TRUE'>
        <code>
  return m_covariance(1, 1);
        </code>
      </method>
      
      <method type = 'double'
              name = 'errTx2'
              desc = 'Retrieve the squared error on the x-slope of the state'
              const = 'TRUE'>
        <code>
  return m_covariance(2, 2);
        </code>
      </method>
      
      <method type = 'double'
              name = 'errTy2'
              desc = 'Retrieve the squared error on the y-slope of the state'
              const = 'TRUE'>
        <code>
  return m_covariance(3, 3);
        </code>
      </method>

      <method type = 'LHCb::TbState*'
              name = 'clone'
              desc = 'Clone the TbState (you then own the pointer)'
              virtual = 'TRUE'
              const = 'TRUE'>
      </method>
      
      <method type = 'Gaudi::XYZPoint'
              name = 'position'
              desc = 'Retrieve the 3D-position vector (x,y,z) of the state'
              const = 'TRUE'>
        <code>
  return Gaudi::XYZPoint(m_parameters[0], m_parameters[1], m_z);
        </code>
      </method>
      
      <method type = 'double'
              name = 'x'
              desc = 'Retrieve the x-position of the state'
              const = 'TRUE'>
        <code>
  return m_parameters[0];
        </code>
      </method>
      
      <method type = 'double'
              name = 'y'
              desc = 'Retrieve the y-position of the state'
              const = 'TRUE'>
        <code>
  return m_parameters[1];
        </code>
      </method>
      
      <method type = 'Gaudi::XYZVector'
              name = 'slopes'
              desc = 'Retrieve the slopes (dx/dz, dy/dz, 1.) of the state'
              const = 'TRUE'>
        <code>
  return Gaudi::XYZVector(m_parameters[2], m_parameters[3], 1.);
        </code>
      </method>
      
      <method type = 'double'
              name = 'tx'
              desc = 'Retrieve the Tx=dx/dz slope of the state'
              const = 'TRUE'>
        <code>
  return m_parameters[2];
        </code>
      </method>
      
      <method type = 'double'
              name = 'ty'
              desc = 'Retrieve the Ty=dy/dz slope of the state'
              const = 'TRUE'>
        <code>
  return m_parameters[3];
        </code>
      </method>
      
      <method name = 'setX'
              argList = 'const double value'
              desc = 'Update the x-position of the state'>
        <code>
  m_parameters[0] = value;
        </code>
      </method>
      
      <method name = 'setY'
              argList = 'const double value'
              desc    = 'Update the y-position of the state'>
        <code>
  m_parameters[1] = value;
        </code>
      </method>
      
      <method name = 'setZ'
              argList = 'const double value'
              desc = 'Update the z-position of the state'>
        <code>
  m_z = value;
        </code>
      </method>
      
      <method name = 'setTx'
              argList = 'const double value'
              desc = 'Update the x-slope tx = dx/dz of the state'>
        <code>
  m_parameters[2] = value;
        </code>
      </method>
      
      <method name = 'setTy'
              argList = 'const double value'
              desc = 'Update the y-slope ty = dy/dz of the state'>
        <code>
  m_parameters[3] = value;
        </code>
      </method>
      
      <method name = 'setState'
              argList = 'double x, double y, double tx, double ty, double z'
              desc = 'Update the state vector'/>
      
      <method name = 'setCovariance'
             argList = 'Gaudi::SymMatrix4x4 value'
             desc = 'Update the covariance matrix'>
        <code>
  m_covariance = value;
        </code>
      </method>
  
      <method name = "fillStream"
              desc = "Print to message stream"
              type = "MsgStream&amp;"
              const = "TRUE">
        <arg name = "os" type = "MsgStream" inout = "BOTH"/>
        <code>
          os &lt;&lt; "{ " 
          &lt;&lt; "parameters: " &lt;&lt; m_parameters &lt;&lt; std::endl
          &lt;&lt; "z:          " &lt;&lt; m_z &lt;&lt; std::endl
          &lt;&lt; " }";
          return os;
        </code>
      </method>
      
    </class>
    
  </package>
</gdd>

