\section{Track\-Constraint Class Reference}
\label{classTrackConstraint}\index{Track\-Constraint@{Track\-Constraint}}


Abstract base class for constraints of kinematic fits.  




{\ttfamily \#include $<$Track\-Constraint.\-h$>$}

Inheritance diagram for Track\-Constraint\-:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classTrackConstraint}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\bf Track\-Constraint} ()\label{classTrackConstraint_a49f9d6870d097fcf8570783158f40a9c}

\begin{DoxyCompactList}\small\item\em Creates an empty \doxyref{Track\-Constraint}{p.}{classTrackConstraint} object. \end{DoxyCompactList}\item 
virtual {\bf $\sim$\-Track\-Constraint} ()\label{classTrackConstraint_abdee732454b776956158133f1da63abe}

\begin{DoxyCompactList}\small\item\em Virtual destructor. \end{DoxyCompactList}\item 
virtual void {\bf set\-F\-O\-List} (std\-::vector$<$ Track\-Fit\-Object $\ast$ $>$ $\ast$fitobjects\-\_\-)
\begin{DoxyCompactList}\small\item\em Adds several Track\-Fit\-Object objects to the list. \end{DoxyCompactList}\item 
virtual void {\bf add\-To\-F\-O\-List} (Track\-Fit\-Object \&fitobject, int flag=1)\label{classTrackConstraint_a2bcc1e795a87173e4bf9871fae5d00f0}

\begin{DoxyCompactList}\small\item\em Adds one Track\-Fit\-Object objects to the list. \end{DoxyCompactList}\item 
virtual double {\bf get\-Value} () const =0\label{classTrackConstraint_a79a7d37dfac9e58097919506bbe72950}

\begin{DoxyCompactList}\small\item\em Returns the value of the constraint. \end{DoxyCompactList}\item 
virtual void {\bf get\-Derivatives} (int idim, double der[$\,$]) const =0
\begin{DoxyCompactList}\small\item\em Get first order derivatives. \end{DoxyCompactList}\item 
virtual void {\bf add1st\-Derivatives\-To\-Matrix} (double $\ast$M, int idim) const 
\begin{DoxyCompactList}\small\item\em Adds first order derivatives to global covariance matrix M. \end{DoxyCompactList}\item 
virtual void {\bf add2nd\-Derivatives\-To\-Matrix} (double $\ast$M, int idim, double lambda) const 
\begin{DoxyCompactList}\small\item\em Adds second order derivatives to global covariance matrix M. \end{DoxyCompactList}\item 
virtual void {\bf add\-To\-Global\-Chi2\-Der\-Vector} (double $\ast$y, int idim, double lambda) const 
\begin{DoxyCompactList}\small\item\em Add lambda times derivatives of chi squared to global derivative matrix. \end{DoxyCompactList}\item 
virtual int {\bf get\-Global\-Num} () const \label{classTrackConstraint_a0e49ad29ef9a9200832a56eecd8d458b}

\begin{DoxyCompactList}\small\item\em Accesses position of constraint in global constraint list. \end{DoxyCompactList}\item 
virtual void {\bf set\-Global\-Num} (int iglobal)\label{classTrackConstraint_af5fafdec530acdf752f855e212c09147}

\begin{DoxyCompactList}\small\item\em Sets position of constraint in global constraint list. \end{DoxyCompactList}\item 
virtual void {\bf invalidate\-Cache} () const \label{classTrackConstraint_ad8f921cb3eb9e8605f79f1c1b47d8250}

\begin{DoxyCompactList}\small\item\em Invalidates any cached values for the next event. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Types}
\begin{DoxyCompactItemize}
\item 
typedef std\-::vector\\*
$<$ Track\-Fit\-Object $\ast$ $>$ {\bf Fit\-Object\-Container}\label{classTrackConstraint_aafef2f3abd4b46267dc01bc25801dc23}

\begin{DoxyCompactList}\small\item\em Vector of pointers to Track\-Fit\-Objects. \end{DoxyCompactList}\item 
typedef \\*
Fit\-Object\-Container\-::iterator {\bf Fit\-Object\-Iterator}\label{classTrackConstraint_a389c9f9643ec870c1e28d5fe318c9ccc}

\begin{DoxyCompactList}\small\item\em Iterator through vector of pointers to Track\-Fit\-Objects. \end{DoxyCompactList}\item 
typedef \\*
Fit\-Object\-Container\-::const\-\_\-iterator {\bf Const\-Fit\-Object\-Iterator}\label{classTrackConstraint_a2b26080de0d15d7ed75541aa992fc7d7}

\begin{DoxyCompactList}\small\item\em Constant iterator through vector of pointers to Track\-Fit\-Objects. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
{\bf Fit\-Object\-Container} {\bf fitobjects}\label{classTrackConstraint_aeda6748939e8e3566571a5feeb7d1017}

\begin{DoxyCompactList}\small\item\em The Fit\-Object\-Container. \end{DoxyCompactList}\item 
std\-::vector$<$ double $>$ {\bf derivatives}\label{classTrackConstraint_a09edc7bec4895db6ddb159989675cb27}

\begin{DoxyCompactList}\small\item\em The derivatives. \end{DoxyCompactList}\item 
std\-::vector$<$ int $>$ {\bf flags}
\begin{DoxyCompactList}\small\item\em The flags can be used to divide the Fit\-Object\-Container into several subsets used for example to implement an equal mass constraint (see \doxyref{Mass\-Constraint}{p.}{classMassConstraint}). \end{DoxyCompactList}\item 
std\-::vector$<$ double $>$ {\bfseries sign}\label{classTrackConstraint_a75a2f3dcd9936dc9ceffcb77fe79d297}

\item 
int {\bf global\-Num}\label{classTrackConstraint_a317cf0e239a949ff60eb9c7edbb1ebfc}

\begin{DoxyCompactList}\small\item\em Position of constraint in global constraint list. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Additional Inherited Members}


\subsection{Detailed Description}
Abstract base class for constraints of kinematic fits. 

This class defines the minimal functionality any constraint class must provide. First of all a constraint should know on with particles (or Fit\-Object) it is applied. Where as for example a constraint on the total transvese momentum takes into account all particles in the event, an invariant mass constraint usually applies only to a subset of particles.

The particle list is implemented as a vector containing pointers to objects derived from Track\-Fit\-Object and can be either set a whole (set\-F\-O\-List) or enlarged by adding a single Track\-Fit\-Object (add\-To\-F\-O\-List).

From the four--momenta of all concerned fit objects the constraint has to be able to calculate its current value (get\-Value). Constraints should be formulated such that a value of zero corresponds to a perfectly fulfilled constraint.

In order to find a solution to the constrained minimisation problem, fit algorithms usually need the first order derivatives of the constraint with respect to the fit parameters. Since many constraints can be most easily expressed in terms of E, px, py, pz, the constraints supply their derivatives w.\-r.\-t. these parameters. If a Fit\-Object uses a different parametrisation, it is its own task to provide the additional derivatives of E, px, py, pz w.\-r.\-t. the parameters of the Fit\-Object. Thus it is easily possible to use Fit\-Objects with different kinds of parametrisations under the same constraint. Some fit algorithms also need the second derivatives of the constraint, i.\-e. the Newton\-Fitter.

First and second order derivatives of each constraint can be added directly to the global covariance matrix containing the derivatives of all constraints w.\-r.\-t. to all parameters (add1st\-Derivatives\-To\-Matrix, add2nd\-Derivatives\-To\-Matrix). This requires the constraint to know its position in the overall list of constraints (global\-Num).

Author\-: Benno List, Jenny List \begin{DoxyParagraph}{Date\-:}
2008/01/30 09\-:14\-:54 
\end{DoxyParagraph}
\begin{DoxyParagraph}{Author\-:}
blist 
\end{DoxyParagraph}


\subsection{Member Function Documentation}
\index{Track\-Constraint@{Track\-Constraint}!add1st\-Derivatives\-To\-Matrix@{add1st\-Derivatives\-To\-Matrix}}
\index{add1st\-Derivatives\-To\-Matrix@{add1st\-Derivatives\-To\-Matrix}!TrackConstraint@{Track\-Constraint}}
\subsubsection[{add1st\-Derivatives\-To\-Matrix}]{\setlength{\rightskip}{0pt plus 5cm}virtual void Track\-Constraint\-::add1st\-Derivatives\-To\-Matrix (
\begin{DoxyParamCaption}
\item[{double $\ast$}]{M, }
\item[{int}]{idim}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}\label{classTrackConstraint_ae22e1f906236de37c4baf9ce89414aab}


Adds first order derivatives to global covariance matrix M. 


\begin{DoxyParams}{Parameters}
{\em M} & Covariance matrix, at least idim x idim \\
\hline
{\em idim} & First dimension of the array \\
\hline
\end{DoxyParams}
\index{Track\-Constraint@{Track\-Constraint}!add2nd\-Derivatives\-To\-Matrix@{add2nd\-Derivatives\-To\-Matrix}}
\index{add2nd\-Derivatives\-To\-Matrix@{add2nd\-Derivatives\-To\-Matrix}!TrackConstraint@{Track\-Constraint}}
\subsubsection[{add2nd\-Derivatives\-To\-Matrix}]{\setlength{\rightskip}{0pt plus 5cm}virtual void Track\-Constraint\-::add2nd\-Derivatives\-To\-Matrix (
\begin{DoxyParamCaption}
\item[{double $\ast$}]{M, }
\item[{int}]{idim, }
\item[{double}]{lambda}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}\label{classTrackConstraint_af21c9c95c33cb2e0139fcfeaf94389dd}


Adds second order derivatives to global covariance matrix M. 


\begin{DoxyParams}{Parameters}
{\em M} & Global covariance matrix, dimension at least idim x idim \\
\hline
{\em idim} & First dimension of array der \\
\hline
{\em lambda} & Lagrange multiplier for this constraint \\
\hline
\end{DoxyParams}
\index{Track\-Constraint@{Track\-Constraint}!add\-To\-Global\-Chi2\-Der\-Vector@{add\-To\-Global\-Chi2\-Der\-Vector}}
\index{add\-To\-Global\-Chi2\-Der\-Vector@{add\-To\-Global\-Chi2\-Der\-Vector}!TrackConstraint@{Track\-Constraint}}
\subsubsection[{add\-To\-Global\-Chi2\-Der\-Vector}]{\setlength{\rightskip}{0pt plus 5cm}virtual void Track\-Constraint\-::add\-To\-Global\-Chi2\-Der\-Vector (
\begin{DoxyParamCaption}
\item[{double $\ast$}]{y, }
\item[{int}]{idim, }
\item[{double}]{lambda}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}\label{classTrackConstraint_a0dbd095fd3d36c8ff0008145d5587faf}


Add lambda times derivatives of chi squared to global derivative matrix. 


\begin{DoxyParams}{Parameters}
{\em y} & Vector of chi2 derivatives \\
\hline
{\em idim} & Vector size \\
\hline
\end{DoxyParams}
\index{Track\-Constraint@{Track\-Constraint}!get\-Derivatives@{get\-Derivatives}}
\index{get\-Derivatives@{get\-Derivatives}!TrackConstraint@{Track\-Constraint}}
\subsubsection[{get\-Derivatives}]{\setlength{\rightskip}{0pt plus 5cm}virtual void Track\-Constraint\-::get\-Derivatives (
\begin{DoxyParamCaption}
\item[{int}]{idim, }
\item[{double}]{der[$\,$]}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [pure virtual]}}\label{classTrackConstraint_aaae5f0d6c4ff039fa55c4242fddeacc0}


Get first order derivatives. 

Call this with a predefined array \char`\"{}der\char`\"{} with the necessary number of entries! 

Implements {\bf Base\-Constraint} \doxyref{}{p.}{classBaseConstraint_a01d60bff974a2926521838c640373d7f}.

\index{Track\-Constraint@{Track\-Constraint}!set\-F\-O\-List@{set\-F\-O\-List}}
\index{set\-F\-O\-List@{set\-F\-O\-List}!TrackConstraint@{Track\-Constraint}}
\subsubsection[{set\-F\-O\-List}]{\setlength{\rightskip}{0pt plus 5cm}virtual void Track\-Constraint\-::set\-F\-O\-List (
\begin{DoxyParamCaption}
\item[{std\-::vector$<$ Track\-Fit\-Object $\ast$ $>$ $\ast$}]{fitobjects\-\_\-}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}\label{classTrackConstraint_a6de02be05c8a9e72b4049551a1474d40}


Adds several Track\-Fit\-Object objects to the list. 


\begin{DoxyParams}{Parameters}
{\em fitobjects\-\_\-} & A list of \doxyref{Base\-Fit\-Object}{p.}{classBaseFitObject} objects \\
\hline
\end{DoxyParams}


References fitobjects, and flags.



\subsection{Member Data Documentation}
\index{Track\-Constraint@{Track\-Constraint}!flags@{flags}}
\index{flags@{flags}!TrackConstraint@{Track\-Constraint}}
\subsubsection[{flags}]{\setlength{\rightskip}{0pt plus 5cm}std\-::vector$<$int$>$ Track\-Constraint\-::flags\hspace{0.3cm}{\ttfamily [protected]}}\label{classTrackConstraint_aea5cf6f14289a0db58d548a0c8d669e4}


The flags can be used to divide the Fit\-Object\-Container into several subsets used for example to implement an equal mass constraint (see \doxyref{Mass\-Constraint}{p.}{classMassConstraint}). 



Referenced by add\-To\-F\-O\-List(), and set\-F\-O\-List().



The documentation for this class was generated from the following file\-:\begin{DoxyCompactItemize}
\item 
{\bf Track\-Constraint.\-h}\end{DoxyCompactItemize}
