////////////////////////////////////////////////////////////////////////
//
// $Id: FitResult.h,v 1.6 2006/02/13 03:50:22 avva Exp $
//
// FitResult
//
// Package: CandFitTrackSA
//
// FitResult - represents track fit results
//
// Contact: avva@fnal.gov
//
////////////////////////////////////////////////////////////////////////

#ifndef FITRESULT_H
#define FITRESULT_H

#include "TMatrixD.h"
#include "DataFT.h"

#include "ConstFT.h"

class FitResult {

public:
    FitResult();
    FitResult(const TMatrixD& fitErrMatrix, const TVectorD& fitParams,
                Double_t chi2, Double_t dchi2, Int_t nplanes, Int_t nhits);
                                
    virtual ~FitResult() {};
    
    const TMatrixD&     GetFitErrM() const { return fFitErrM; };
    const TVectorD&     GetTrackOut() const { return ftrackout; };
    
    Double_t    GetFitErrM(int i, int j) const { return fFitErrM(i,j); };
    Double_t    GetTrackOut(int i) const { return ftrackout(i); };

    Double_t    GetFitParameter(int i) const { return ftrackout(i); };
    Double_t    GetFitParameterError(int i) const;
    
    Double_t   GetChi2() const { return fChi2; };
    Double_t   GetdChi2() const { return fdchi2; };
            
    Int_t      GetQ() const;        
    Double_t   GetP()const;
    Double_t   GetEP()const;
    
    int      GetNPlanes() const { return fNPlanes; };
    void     SetNPlanes(Int_t nplanes)  { fNPlanes = nplanes; };
    
    int      GetNHits() const { return fNHits; };
    void     SetNHits(Int_t nhits)  { fNHits = nhits; };
    int      GetNdof() const { return fNHits-5; };
    
    void     SetTrackOut(const TVectorD& fit) { ftrackout = fit; };
    
private:

    ///
    /// error matrix of the fit parameters (inverse of fFitCovM)
    ///
    TMatrixD               fFitErrM;         
    
    ///
    /// solution vector (u, du/dz, v, dv/dz, q/p)
    ///
    TVectorD               ftrackout;        
    
    ///
    /// chisquare of the fit
    ///
    Double_t               fChi2;            
    
    ///
    /// chisquare between trackin and trackout
    ///
    Double_t               fdchi2;           
    
    ///
    /// number of planes
    ///
    Int_t                  fNPlanes;       
    
    ///
    /// number of hit planes  
    ///
    Int_t                  fNHits;           
};

#endif // FITRESULT_H
