CMS 3D CMS Logo

TFitParticleEScaledMomDev Class Reference

#include <PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h>

Inheritance diagram for TFitParticleEScaledMomDev:

TAbsFitParticle

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 (const TString &name, const TString &title, TLorentzVector *pini, const TMatrixD *theCovMatrix)
 TFitParticleEScaledMomDev (TLorentzVector *pini, const TMatrixD *theCovMatrix)
 TFitParticleEScaledMomDev (const TFitParticleEScaledMomDev &fitParticle)
 TFitParticleEScaledMomDev ()
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 (  ) 

Referenced by clone().

TFitParticleEScaledMomDev::TFitParticleEScaledMomDev ( const TFitParticleEScaledMomDev fitParticle  ) 

Definition at line 43 of file TFitParticleEScaledMomDev.cc.

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

00044   :TAbsFitParticle( fitParticle.GetName(), fitParticle.GetTitle() )
00045 {
00046 
00047   _nPar = fitParticle._nPar;
00048   _u1 = fitParticle._u1;
00049   _u2 = fitParticle._u2;
00050   _u3 = fitParticle._u3;
00051   _covMatrix.ResizeTo(  fitParticle._covMatrix );
00052   _covMatrix = fitParticle._covMatrix;
00053   _iniparameters.ResizeTo( fitParticle._iniparameters );
00054   _iniparameters = fitParticle._iniparameters;
00055   _parameters.ResizeTo( fitParticle._parameters );
00056   _parameters = fitParticle._parameters;
00057   _pini = fitParticle._pini;
00058   _pcurr = fitParticle._pcurr;
00059 
00060 }

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

Definition at line 62 of file TFitParticleEScaledMomDev.cc.

References init().

00063   :TAbsFitParticle()
00064 {
00065   init(pini, theCovMatrix);
00066 }

TFitParticleEScaledMomDev::TFitParticleEScaledMomDev ( const TString &  name,
const TString &  title,
TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)

Definition at line 68 of file TFitParticleEScaledMomDev.cc.

References init().

00070   :TAbsFitParticle(name, title)
00071 {
00072   init(pini, theCovMatrix);
00073 }  

TFitParticleEScaledMomDev::~TFitParticleEScaledMomDev (  )  [virtual]

Definition at line 87 of file TFitParticleEScaledMomDev.cc.

00087                                                       {
00088 
00089 }


Member Function Documentation

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

Implements TAbsFitParticle.

Definition at line 108 of file TFitParticleEScaledMomDev.cc.

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

00108                                                                             {
00109   // Calculates a 4vector corresponding to the given
00110   // parameter values
00111 
00112   if (params == 0) {
00113     return 0;
00114   }
00115 
00116   if ( params->GetNcols() != 1 || params->GetNrows() !=_nPar ) {
00117     edm::LogError ("WrongMatrixSize")
00118       << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
00119     return 0;
00120   }
00121   
00122   Double_t X = _pini.P() * (*params)(0,0) *_u1.X() +
00123     (*params)(1,0) * _u2.X()+
00124     (*params)(2,0) * _u3.X();
00125   Double_t Y =  _pini.P() * (*params)(0,0) * _u1.Y() +
00126     (*params)(1,0) * _u2.Y()+
00127     (*params)(2,0) * _u3.Y();
00128   Double_t Z =  _pini.P()*(*params)(0,0)*_u1.Z() +
00129     (*params)(1,0) * _u2.Z()+
00130     (*params)(2,0) * _u3.Z();
00131   Double_t pcurr = TMath::Sqrt( X*X + Y*Y + Z*Z );
00132   Double_t E =  _pini.E()*pcurr/_pini.P();
00133 
00134   TLorentzVector* vec = new TLorentzVector( X, Y, Z, E );
00135   return vec;
00136 
00137 }

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

Implements TAbsFitParticle.

Definition at line 75 of file TFitParticleEScaledMomDev.cc.

References TFitParticleEScaledMomDev().

00075                                                                          {
00076   // Returns a copy of itself
00077   
00078   TAbsFitParticle* myclone = new TFitParticleEScaledMomDev( *this );
00079   if ( newname.Length() > 0 ) myclone->SetName(newname);
00080   return myclone;
00081 
00082 }

TMatrixD * TFitParticleEScaledMomDev::getDerivative (  )  [virtual]

Implements TAbsFitParticle.

Definition at line 170 of file TFitParticleEScaledMomDev.cc.

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

00170                                                     {
00171   // returns derivative dP/dy with P=(p,E) and y=(r, theta, phi) 
00172   // the free parameters of the fit. The columns of the matrix contain 
00173   // (dP/dr, dP/dtheta, dP/dphi).
00174 
00175   TMatrixD* DerivativeMatrix = new TMatrixD(4,3);
00176   (*DerivativeMatrix) *= 0.;
00177 
00178    //1st column: dP/dr
00179   (*DerivativeMatrix)(0,0)=_pini.P()*_u1.X();
00180   (*DerivativeMatrix)(1,0)=_pini.P()*_u1.Y();
00181   (*DerivativeMatrix)(2,0)=_pini.P()*_u1.Z();
00182   (*DerivativeMatrix)(3,0)=_pini.P()*_pini.E()*_parameters(0,0)/_pcurr.P();
00183   //2nd column: dP/dtheta
00184   (*DerivativeMatrix)(0,1)=_u2.X();
00185   (*DerivativeMatrix)(1,1)=_u2.Y();
00186   (*DerivativeMatrix)(2,1)=_u2.Z();
00187   (*DerivativeMatrix)(3,1)=_pini.E()/_pini.P()/_pcurr.P()*_parameters(1,0);
00188   //3rd column: dP/dphi
00189   (*DerivativeMatrix)(0,2)=_u3.X();
00190   (*DerivativeMatrix)(1,2)=_u3.Y();
00191   (*DerivativeMatrix)(2,2)=_u3.Z();;
00192   (*DerivativeMatrix)(3,2)=_pini.E()/_pini.P()/_pcurr.P()*_parameters(2,0);
00193 
00194   return DerivativeMatrix;  
00195 
00196 }

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

Definition at line 94 of file TFitParticleEScaledMomDev.cc.

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

Referenced by TFitParticleEScaledMomDev().

00094                                                                                        {
00095 
00096   _nPar = 3;
00097   setIni4Vec(pini);
00098   _iniparameters.ResizeTo(_nPar,1);
00099   _iniparameters(0,0)=1.;
00100   _iniparameters(1,0)=0.;
00101   _iniparameters(2,0)=0.;
00102   _parameters.ResizeTo(_nPar,1);
00103   _parameters = _iniparameters;
00104   setCovMatrix(theCovMatrix);
00105 
00106 }

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

Implements TAbsFitParticle.

Definition at line 139 of file TFitParticleEScaledMomDev.cc.

References TAbsFitParticle::_iniparameters, TAbsFitParticle::_parameters, TAbsFitParticle::_pcurr, TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, TAbsFitParticle::_u3, and muonGeometry::TVector3().

Referenced by init().

00139                                                                      {
00140   // Set the initial 4vector. Will also set the 
00141   // inital parameter values
00142 
00143   if (pini == 0) {
00144 
00145     _u1.SetXYZ(0., 0., 0.);
00146     _u3.SetXYZ(0., 0., 0.);
00147     _u2.SetXYZ(0., 0., 0.);
00148     _pini.SetXYZT(0., 0., 0., 0.);
00149 
00150   } else {
00151 
00152     _pini = (*pini);
00153     _pcurr = _pini;
00154     
00155     _u1 = pini->Vect();
00156     _u1 *= 1./_u1.Mag();
00157     
00158     TVector3 uz(0., 0., 1.);
00159     _u3 = uz.Cross(_u1);
00160     _u3 *= 1./_u3.Mag();
00161   
00162     _u2 = _u3.Cross(_u1);
00163     _u2 *= 1./_u2.Mag();
00164   }  
00165 
00166   _parameters = _iniparameters;
00167   
00168 }

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

Implements TAbsFitParticle.

Definition at line 198 of file TFitParticleEScaledMomDev.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, TAbsFitParticle::_u3, rot, and muonGeometry::TVector3().

00198                                                                         {
00199   // Returns the parameters corresponding to the given 
00200   // 4vector wrt. to the current base vectors u_r, u_theta, and u_phi
00201 
00202   // construct rotation matrix
00203   TRotation rot;
00204   rot.RotateAxes( _u1, _u2, _u3 );
00205   rot.Invert();
00206 
00207   // rotate vector
00208   TVector3 vec3( vec.Vect() );
00209   vec3.Transform( rot );
00210 
00211   // retrieve parameters
00212   TMatrixD* tparams = new TMatrixD( _nPar, 1 );
00213   (*tparams)(0,0) = vec3(0)/_pini.P();
00214   (*tparams)(1,0) = vec3(1);
00215   (*tparams)(2,0) = vec3(2);
00216 
00217   return tparams;
00218 
00219 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:33:23 2009 for CMSSW by  doxygen 1.5.4