CMS 3D CMS Logo

Public Member Functions | Protected Member Functions

TFitParticleEScaledMomDev Class Reference

#include <TFitParticleEScaledMomDev.h>

Inheritance diagram for TFitParticleEScaledMomDev:
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)
 TFitParticleEScaledMomDev ()
 TFitParticleEScaledMomDev (TLorentzVector *pini, const TMatrixD *theCovMatrix)
 TFitParticleEScaledMomDev (const TFitParticleEScaledMomDev &fitParticle)
 TFitParticleEScaledMomDev (const TString &name, const TString &title, TLorentzVector *pini, const TMatrixD *theCovMatrix)
virtual TMatrixD * transform (const TLorentzVector &vec)
virtual ~TFitParticleEScaledMomDev ()

Protected Member Functions

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

Detailed Description

Definition at line 9 of file TFitParticleEScaledMomDev.h.


Constructor & Destructor Documentation

TFitParticleEScaledMomDev::TFitParticleEScaledMomDev ( )

Definition at line 34 of file TFitParticleEScaledMomDev.cc.

References init().

Referenced by clone().

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

Definition at line 40 of file TFitParticleEScaledMomDev.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;

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

Definition at line 59 of file TFitParticleEScaledMomDev.cc.

References init().

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

Definition at line 65 of file TFitParticleEScaledMomDev.cc.

References init().

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

Definition at line 84 of file TFitParticleEScaledMomDev.cc.

                                                      {

}

Member Function Documentation

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

Implements TAbsFitParticle.

Definition at line 105 of file TFitParticleEScaledMomDev.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, TAbsFitParticle::_u3, 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 = _pini.P() * (*params)(0,0) *_u1.X() +
    (*params)(1,0) * _u2.X()+
    (*params)(2,0) * _u3.X();
  Double_t Y =  _pini.P() * (*params)(0,0) * _u1.Y() +
    (*params)(1,0) * _u2.Y()+
    (*params)(2,0) * _u3.Y();
  Double_t Z =  _pini.P()*(*params)(0,0)*_u1.Z() +
    (*params)(1,0) * _u2.Z()+
    (*params)(2,0) * _u3.Z();
  Double_t pcurr = TMath::Sqrt( X*X + Y*Y + Z*Z );
  Double_t E =  _pini.E()*pcurr/_pini.P();

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

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

Implements TAbsFitParticle.

Definition at line 72 of file TFitParticleEScaledMomDev.cc.

References TFitParticleEScaledMomDev().

                                                                         {
  // Returns a copy of itself
  
  TAbsFitParticle* myclone = new TFitParticleEScaledMomDev( *this );
  if ( newname.Length() > 0 ) myclone->SetName(newname);
  return myclone;

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

Implements TAbsFitParticle.

Definition at line 167 of file TFitParticleEScaledMomDev.cc.

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

                                                    {
  // 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, dP/dphi).

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

   //1st column: dP/dr
  (*DerivativeMatrix)(0,0)=_pini.P()*_u1.X();
  (*DerivativeMatrix)(1,0)=_pini.P()*_u1.Y();
  (*DerivativeMatrix)(2,0)=_pini.P()*_u1.Z();
  (*DerivativeMatrix)(3,0)=_pini.P()*_pini.E()*_parameters(0,0)/_pcurr.P();
  //2nd column: dP/dtheta
  (*DerivativeMatrix)(0,1)=_u2.X();
  (*DerivativeMatrix)(1,1)=_u2.Y();
  (*DerivativeMatrix)(2,1)=_u2.Z();
  (*DerivativeMatrix)(3,1)=_pini.E()/_pini.P()/_pcurr.P()*_parameters(1,0);
  //3rd column: dP/dphi
  (*DerivativeMatrix)(0,2)=_u3.X();
  (*DerivativeMatrix)(1,2)=_u3.Y();
  (*DerivativeMatrix)(2,2)=_u3.Z();;
  (*DerivativeMatrix)(3,2)=_pini.E()/_pini.P()/_pcurr.P()*_parameters(2,0);

  return DerivativeMatrix;  

}
void TFitParticleEScaledMomDev::init ( TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
) [protected]
void TFitParticleEScaledMomDev::setIni4Vec ( const TLorentzVector *  pini) [virtual]

Implements TAbsFitParticle.

Definition at line 136 of file TFitParticleEScaledMomDev.cc.

References TAbsFitParticle::_iniparameters, 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.);

  } else {

    _pini = (*pini);
    _pcurr = _pini;
    
    _u1 = pini->Vect();
    _u1 *= 1./_u1.Mag();
    
    TVector3 uz(0., 0., 1.);
    _u3 = uz.Cross(_u1);
    _u3 *= 1./_u3.Mag();
  
    _u2 = _u3.Cross(_u1);
    _u2 *= 1./_u2.Mag();
  }  

  _parameters = _iniparameters;
  
}
TMatrixD * TFitParticleEScaledMomDev::transform ( const TLorentzVector &  vec) [virtual]

Implements TAbsFitParticle.

Definition at line 195 of file TFitParticleEScaledMomDev.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, and TAbsFitParticle::_u3.

                                                                        {
  // Returns the parameters corresponding to the given 
  // 4vector wrt. to the current base vectors u_r, u_theta, and u_phi

  // construct rotation matrix
  TRotation rot;
  rot.RotateAxes( _u1, _u2, _u3 );
  rot.Invert();

  // rotate vector
  TVector3 vec3( vec.Vect() );
  vec3.Transform( rot );

  // retrieve parameters
  TMatrixD* tparams = new TMatrixD( _nPar, 1 );
  (*tparams)(0,0) = vec3(0)/_pini.P();
  (*tparams)(1,0) = vec3(1);
  (*tparams)(2,0) = vec3(2);

  return tparams;

}