#ifndef TFitParticleCart_hh
#define TFitParticleCart_hh

#include "PhysicsTools/KinFitter/interface/TAbsFitParticle.h"
#include "TLorentzVector.h"
#include "TMatrixD.h"

class TFitParticleCart : public TAbsFitParticle {
public:
  TFitParticleCart();
  TFitParticleCart(const TFitParticleCart& fitParticle);
  TFitParticleCart(TLorentzVector* pini, const TMatrixD* theCovMatrix);
  TFitParticleCart(const TString& name, const TString& title, TLorentzVector* pini, const TMatrixD* theCovMatrix);
  ~TFitParticleCart() override;
  TAbsFitParticle* clone(const TString& newname = TString("")) const override;

  // returns derivative dP/dy with P=(p,E) and y=(r, theta, phi, ...)
  // the free parameters of the fit. The columns of the matrix contain
  // (dP/dr, dP/dtheta, ...).
  TMatrixD* getDerivative() override;
  TMatrixD* transform(const TLorentzVector& vec) override;
  void setIni4Vec(const TLorentzVector* pini) override;
  TLorentzVector* calc4Vec(const TMatrixD* params) override;

protected:
  void init(TLorentzVector* pini, const TMatrixD* theCovMatrix);

private:
  ClassDefOverride(TFitParticleCart, 0)
};

#endif
