CMS 3D CMS Logo

Public Member Functions | Protected Member Functions

TFitParticleCart Class Reference

#include <TFitParticleCart.h>

Inheritance diagram for TFitParticleCart:
TAbsFitParticle TNamed

List of all members.

Public Member Functions

virtual TLorentzVector * calc4Vec (const TMatrixD *params)
virtual TAbsFitParticleclone (TString newname="") const
virtual TMatrixD * getDerivative ()
virtual void setIni4Vec (const TLorentzVector *pini)
 TFitParticleCart ()
 TFitParticleCart (TLorentzVector *pini, const TMatrixD *theCovMatrix)
 TFitParticleCart (const TFitParticleCart &fitParticle)
 TFitParticleCart (const TString &name, const TString &title, TLorentzVector *pini, const TMatrixD *theCovMatrix)
virtual TMatrixD * transform (const TLorentzVector &vec)
virtual ~TFitParticleCart ()

Protected Member Functions

void init (TLorentzVector *pini, const TMatrixD *theCovMatrix)

Detailed Description

Definition at line 10 of file TFitParticleCart.h.


Constructor & Destructor Documentation

TFitParticleCart::TFitParticleCart ( )

Definition at line 27 of file TFitParticleCart.cc.

References init().

Referenced by clone().

  :TAbsFitParticle()  
{
  init(0, 0);
}
TFitParticleCart::TFitParticleCart ( const TFitParticleCart fitParticle)

Definition at line 33 of file TFitParticleCart.cc.

References TAbsFitParticle::_covMatrix, TAbsFitParticle::_iniparameters, TAbsFitParticle::_nPar, TAbsFitParticle::_parameters, TAbsFitParticle::_pcurr, TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, and TAbsFitParticle::_u3.

  :TAbsFitParticle( fitParticle.GetName(), fitParticle.GetTitle() )
{

  _nPar = fitParticle._nPar;
  _u1 = fitParticle._u1;
  _u2 = fitParticle._u2;
  _u3 = fitParticle._u3;
  _covMatrix.ResizeTo(  fitParticle._covMatrix );
  _covMatrix = fitParticle._covMatrix;
  _iniparameters.ResizeTo( fitParticle._iniparameters );
  _iniparameters = fitParticle._iniparameters;
  _parameters.ResizeTo( fitParticle._parameters );
  _parameters = fitParticle._parameters;
  _pini = fitParticle._pini;
  _pcurr = fitParticle._pcurr;

}
TFitParticleCart::TFitParticleCart ( TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)

Definition at line 52 of file TFitParticleCart.cc.

References init().

  :TAbsFitParticle()  
{
  init(pini, theCovMatrix);
}
TFitParticleCart::TFitParticleCart ( const TString &  name,
const TString &  title,
TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)

Definition at line 58 of file TFitParticleCart.cc.

References init().

  :TAbsFitParticle(name, title)  
{
  init(pini, theCovMatrix);
}
TFitParticleCart::~TFitParticleCart ( ) [virtual]

Definition at line 77 of file TFitParticleCart.cc.

                                    {

}

Member Function Documentation

TLorentzVector * TFitParticleCart::calc4Vec ( const TMatrixD *  params) [virtual]

Implements TAbsFitParticle.

Definition at line 92 of file TFitParticleCart.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, X, and Gflash::Z.

                                                                   {
  // Calculates a 4vector corresponding to the given
  // parameter values

  if (params == 0) {
    return 0;
  }

  if ( params->GetNcols() != 1 || params->GetNrows() !=_nPar ) {
    edm::LogError ("WrongMatrixSize")
      << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
    return 0;
  }
  
  Double_t X = (*params)(0,0);
  Double_t Y = (*params)(1,0);
  Double_t Z = (*params)(2,0);
  Double_t E =  TMath::Sqrt( X*X + Y*Y + Z*Z + (*params)(3,0)*(*params)(3,0)*_pini.M2() );

  TLorentzVector* vec = new TLorentzVector( X, Y, Z, E );
  return vec;

}
TAbsFitParticle * TFitParticleCart::clone ( TString  newname = "") const [virtual]

Implements TAbsFitParticle.

Definition at line 65 of file TFitParticleCart.cc.

References TFitParticleCart().

                                                                {
  // Returns a copy of itself

  TAbsFitParticle* myclone = new TFitParticleCart( *this );
  if ( newname.Length() > 0 ) myclone->SetName(newname);
  return myclone;

}
TMatrixD * TFitParticleCart::getDerivative ( ) [virtual]

Implements TAbsFitParticle.

Definition at line 161 of file TFitParticleCart.cc.

References TAbsFitParticle::_parameters, TAbsFitParticle::_pcurr, and TAbsFitParticle::_pini.

                                          {
  // returns derivative dP/dy with P=(p,E) and y=(px, py, pz, d) 
  // the free parameters of the fit. The columns of the matrix contain 
  // (dP/dpx, dP/dpy, ...).

  TMatrixD* DerivativeMatrix = new TMatrixD(4,4);
  (*DerivativeMatrix) *= 0.;

  //1st column: dP/dx
  (*DerivativeMatrix)(0,0)=1.;
  (*DerivativeMatrix)(1,0)=0.;
  (*DerivativeMatrix)(2,0)=0.;
  (*DerivativeMatrix)(3,0)=0.;

  //2nd column: dP/dy
  (*DerivativeMatrix)(0,1)=0;
  (*DerivativeMatrix)(1,1)=1;
  (*DerivativeMatrix)(2,1)=0;
  (*DerivativeMatrix)(3,1)=0.;

   //3rd column: dP/dz
  (*DerivativeMatrix)(0,2)=0.;
  (*DerivativeMatrix)(1,2)=0.;
  (*DerivativeMatrix)(2,2)=1.;
  (*DerivativeMatrix)(3,2)=0.;

   //4th column: dP/dm
  (*DerivativeMatrix)(0,3)=0.;
  (*DerivativeMatrix)(1,3)=0.;
  (*DerivativeMatrix)(2,3)=0.;
  (*DerivativeMatrix)(3,3)=_pini.M()*_pini.M()*_parameters(3,0)/_pcurr.E();

  return DerivativeMatrix;  
}
void TFitParticleCart::init ( TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
) [protected]

Definition at line 84 of file TFitParticleCart.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::setCovMatrix(), and setIni4Vec().

Referenced by TFitParticleCart().

                                                                               {

  _nPar = 4;
  setIni4Vec(pini);
  setCovMatrix(theCovMatrix);

}
void TFitParticleCart::setIni4Vec ( const TLorentzVector *  pini) [virtual]

Implements TAbsFitParticle.

Definition at line 116 of file TFitParticleCart.cc.

References TAbsFitParticle::_iniparameters, TAbsFitParticle::_nPar, TAbsFitParticle::_parameters, TAbsFitParticle::_pcurr, TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, and TAbsFitParticle::_u3.

Referenced by init().

                                                            {
  // Set the initial 4vector. Will also set the 
  // inital parameter values

  if (pini == 0) {

    _u1.SetXYZ(0., 0., 0.);
    _u3.SetXYZ(0., 0., 0.);
    _u2.SetXYZ(0., 0., 0.);
    _pini.SetXYZT(0., 0., 0., 0.);
    _pcurr = _pini;

    _iniparameters.ResizeTo(_nPar,1);
    _iniparameters(0,0)=0;
    _iniparameters(1,0)=0;
    _iniparameters(2,0)=0;
    _iniparameters(3,0)=0.;

    _parameters.ResizeTo(_nPar,1);
    _parameters(0,0)=0.;
    _parameters(1,0)=0.;
    _parameters(2,0)=0.;   
    _parameters(3,0)=0.;   
    
  } else {
    
    _pini = (*pini);
    _pcurr = _pini;

    _u1.SetXYZ( 1., 0., 0. );
    _u2.SetXYZ( 0., 1., 0. );
    _u3.SetXYZ( 0., 0., 1. );
  
    _iniparameters.ResizeTo(_nPar,1);
    _iniparameters(0,0)=_pini.X();
    _iniparameters(1,0)=_pini.Y();
    _iniparameters(2,0)=_pini.Z();
    _iniparameters(3,0)=1.;
    _parameters.ResizeTo(_nPar,1);
    _parameters = _iniparameters;

  }

}
TMatrixD * TFitParticleCart::transform ( const TLorentzVector &  vec) [virtual]

Implements TAbsFitParticle.

Definition at line 196 of file TFitParticleCart.cc.

References TAbsFitParticle::_nPar, and TAbsFitParticle::_pini.

                                                               {
  // Returns the parameters corresponding to the given 
  // 4vector

  TMatrixD* tparams = new TMatrixD( _nPar, 1 );
  (*tparams)(0,0) = vec.X();
  (*tparams)(1,0) = vec.Y();
  (*tparams)(2,0) = vec.Z();
  (*tparams)(3,0) = vec.M()/_pini.M();

  return tparams;

}