CMS 3D CMS Logo

TFitParticleEtThetaPhi Class Reference

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

Inheritance diagram for TFitParticleEtThetaPhi:

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

Protected Member Functions

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


Detailed Description

Definition at line 10 of file TFitParticleEtThetaPhi.h.


Constructor & Destructor Documentation

TFitParticleEtThetaPhi::TFitParticleEtThetaPhi (  ) 

Referenced by clone().

TFitParticleEtThetaPhi::TFitParticleEtThetaPhi ( const TFitParticleEtThetaPhi fitParticle  ) 

Definition at line 36 of file TFitParticleEtThetaPhi.cc.

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

00037   :TAbsFitParticle( fitParticle.GetName(), fitParticle.GetTitle() )
00038 {
00039 
00040   _nPar = fitParticle._nPar;
00041   _u1 = fitParticle._u1;
00042   _u2 = fitParticle._u2;
00043   _u3 = fitParticle._u3;
00044   _covMatrix.ResizeTo(  fitParticle._covMatrix );
00045   _covMatrix = fitParticle._covMatrix;
00046   _iniparameters.ResizeTo( fitParticle._iniparameters );
00047   _iniparameters = fitParticle._iniparameters;
00048   _parameters.ResizeTo( fitParticle._parameters );
00049   _parameters = fitParticle._parameters;
00050   _pini = fitParticle._pini;
00051   _pcurr = fitParticle._pcurr;
00052 
00053 }

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

Definition at line 55 of file TFitParticleEtThetaPhi.cc.

References init().

00056   :TAbsFitParticle()  
00057 {
00058   init(pini, theCovMatrix);
00059 }

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

Definition at line 61 of file TFitParticleEtThetaPhi.cc.

References init().

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

TFitParticleEtThetaPhi::~TFitParticleEtThetaPhi (  )  [virtual]

Definition at line 80 of file TFitParticleEtThetaPhi.cc.

00080                                                 {
00081 
00082 }


Member Function Documentation

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

Implements TAbsFitParticle.

Definition at line 95 of file TFitParticleEtThetaPhi.cc.

References TAbsFitParticle::_nPar, phi, theta, and X.

00095                                                                          {
00096   // Calculates a 4vector corresponding to the given
00097   // parameter values
00098 
00099   if (params == 0) {
00100     return 0;
00101   }
00102 
00103   if ( params->GetNcols() != 1 || params->GetNrows() !=_nPar ) {
00104     edm::LogError ("WrongMatrixSize")
00105       << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
00106     return 0;
00107   }
00108 
00109   Double_t et = (*params)(0,0);
00110   Double_t theta = (*params)(1,0);
00111   Double_t phi = (*params)(2,0);
00112 
00113   Double_t X = et*TMath::Cos(phi);
00114   Double_t Y = et*TMath::Sin(phi);
00115   Double_t Z = et/TMath::Tan(theta);
00116   Double_t E = et/TMath::Sin(theta);
00117                 
00118   TLorentzVector* vec = new TLorentzVector( X, Y, Z, E );
00119   return vec;
00120 
00121 }

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

Implements TAbsFitParticle.

Definition at line 68 of file TFitParticleEtThetaPhi.cc.

References TFitParticleEtThetaPhi().

00068                                                                       {
00069   // Returns a copy of itself
00070   
00071   TAbsFitParticle* myclone = new TFitParticleEtThetaPhi( *this );
00072   if ( newname.Length() > 0 ) myclone->SetName(newname);
00073   return myclone;
00074 
00075 }

TMatrixD * TFitParticleEtThetaPhi::getDerivative (  )  [virtual]

Implements TAbsFitParticle.

Definition at line 170 of file TFitParticleEtThetaPhi.cc.

References TAbsFitParticle::_parameters, phi, and theta.

00170                                                 {
00171   // returns derivative dP/dy with P=(p,E) and y=(et, theta, phi) 
00172   // the free parameters of the fit. The columns of the matrix contain 
00173   // (dP/d(et), dP/d(theta), dP/d(phi)).
00174 
00175   TMatrixD* DerivativeMatrix = new TMatrixD(4,3);
00176   (*DerivativeMatrix) *= 0.;
00177 
00178   Double_t et = _parameters(0,0);
00179   Double_t theta = _parameters(1,0);
00180   Double_t phi = _parameters(2,0);
00181 
00182   Double_t CotanTheta = 1./TMath::Tan(theta);
00183 
00184   //1st column: dP/d(et)
00185   (*DerivativeMatrix)(0,0) = TMath::Cos(phi);
00186   (*DerivativeMatrix)(1,0) = TMath::Sin(phi);
00187   (*DerivativeMatrix)(2,0) = CotanTheta;
00188   (*DerivativeMatrix)(3,0) = 1./TMath::Sin(theta);
00189 
00190   //2nd column: dP/d(theta)
00191   (*DerivativeMatrix)(0,1) = 0.;
00192   (*DerivativeMatrix)(1,1) = 0.;
00193   (*DerivativeMatrix)(2,1) = -1.*et*(1.+CotanTheta*CotanTheta);
00194   (*DerivativeMatrix)(3,1) = -1.*et*CotanTheta/(TMath::Sin(theta));
00195 
00196    //3rd column: dP/d(phi)
00197   (*DerivativeMatrix)(0,2) = -1.*et*TMath::Sin(phi);
00198   (*DerivativeMatrix)(1,2) = et*TMath::Cos(phi);
00199   (*DerivativeMatrix)(2,2) = 0.;
00200   (*DerivativeMatrix)(3,2) = 0.;
00201 
00202   return DerivativeMatrix;
00203 
00204 }

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

Definition at line 87 of file TFitParticleEtThetaPhi.cc.

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

Referenced by TFitParticleEtThetaPhi().

00087                                                                                      {
00088 
00089   _nPar = 3;
00090   setIni4Vec(pini);
00091   setCovMatrix(theCovMatrix);
00092 
00093 }

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

Implements TAbsFitParticle.

Definition at line 123 of file TFitParticleEtThetaPhi.cc.

References TAbsFitParticle::_iniparameters, TAbsFitParticle::_nPar, TAbsFitParticle::_parameters, TAbsFitParticle::_pcurr, TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, TAbsFitParticle::_u3, phi, funct::sin(), and theta.

Referenced by init().

00123                                                                   {
00124   // Set the initial 4vector. Will also set the 
00125   // inital parameter values 
00126 
00127   if (pini == 0) {
00128 
00129     _u1.SetXYZ(0., 0., 0.);
00130     _u3.SetXYZ(0., 0., 0.);
00131     _u2.SetXYZ(0., 0., 0.);
00132     _pini.SetXYZT(0., 0., 0., 0.);
00133     _pcurr = _pini;
00134 
00135     _iniparameters.ResizeTo(_nPar,1);
00136     _iniparameters(0,0) = 0.;
00137     _iniparameters(1,0) = 0.;
00138     _iniparameters(2,0) = 0.;
00139     
00140     _parameters.ResizeTo(_nPar,1);
00141     _parameters(0,0) = 0.;
00142     _parameters(1,0) = 0.;
00143     _parameters(2,0) = 0.;   
00144     
00145   } else {
00146     
00147     Double_t et = pini->E()*fabs(sin(pini->Theta()));
00148     Double_t theta = pini->Theta();
00149     Double_t phi = pini->Phi();
00150     
00151     _pini = (*pini);
00152     _pcurr = _pini;
00153     
00154     _iniparameters.ResizeTo(_nPar,1);
00155     _iniparameters(0,0) = et;
00156     _iniparameters(1,0) = theta;
00157     _iniparameters(2,0) = phi;
00158     
00159     _parameters.ResizeTo(_nPar,1);
00160     _parameters = _iniparameters;
00161 
00162     _u1.SetXYZ( TMath::Cos(phi), TMath::Sin(phi), 0.); // the base vector of Et
00163     _u2.SetXYZ( TMath::Cos(phi)*TMath::Cos(theta), TMath::Sin(phi)*TMath::Cos(theta), -1.*TMath::Sin(theta) );// the base vector of Eta ( same as the base vector for Theta)
00164     _u3.SetXYZ( -1.*TMath::Sin(phi), TMath::Cos(phi), 0. );// the base vector of Phi
00165 
00166   }
00167 
00168 }

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

Implements TAbsFitParticle.

Definition at line 206 of file TFitParticleEtThetaPhi.cc.

References TAbsFitParticle::_nPar, and funct::sin().

00206                                                                      {
00207   // Returns the parameters corresponding to the given 
00208   // 4vector
00209 
00210   // retrieve parameters
00211   TMatrixD* tparams = new TMatrixD( _nPar, 1 );
00212   (*tparams)(0,0) = vec.E()*fabs(sin(vec.Theta()));
00213   (*tparams)(1,0) = vec.Theta();
00214   (*tparams)(2,0) = vec.Phi();
00215 
00216   return tparams;
00217 
00218 }


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