CMS 3D CMS Logo

Public Member Functions | Protected Member Functions

TFitParticleMCPInvSpher Class Reference

#include <TFitParticleMCPInvSpher.h>

Inheritance diagram for TFitParticleMCPInvSpher:
TAbsFitParticle TNamed

List of all members.

Public Member Functions

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

Protected Member Functions

void init (TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)

Detailed Description

Definition at line 9 of file TFitParticleMCPInvSpher.h.


Constructor & Destructor Documentation

TFitParticleMCPInvSpher::TFitParticleMCPInvSpher ( )

Definition at line 27 of file TFitParticleMCPInvSpher.cc.

References init().

Referenced by clone().

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

Definition at line 33 of file TFitParticleMCPInvSpher.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;

}
TFitParticleMCPInvSpher::TFitParticleMCPInvSpher ( TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)

Definition at line 52 of file TFitParticleMCPInvSpher.cc.

References init().

  :TAbsFitParticle()
{ 
  init(p, M, theCovMatrix);
}
TFitParticleMCPInvSpher::TFitParticleMCPInvSpher ( const TString &  name,
const TString &  title,
TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)

Definition at line 58 of file TFitParticleMCPInvSpher.cc.

References init().

  :TAbsFitParticle(name, title)
{ 
  init(p, M, theCovMatrix);
}
TFitParticleMCPInvSpher::~TFitParticleMCPInvSpher ( ) [virtual]

Definition at line 77 of file TFitParticleMCPInvSpher.cc.

                                                  {

}

Member Function Documentation

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

Implements TAbsFitParticle.

Definition at line 93 of file TFitParticleMCPInvSpher.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, phi, alignCSCRings::r, theta(), 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 r = (*params)(0,0);
  Double_t theta = (*params)(1,0);
  Double_t phi = (*params)(2,0);

  Double_t X = 1/r*TMath::Cos(phi)*TMath::Sin(theta);
  Double_t Y = 1/r*TMath::Sin(phi)*TMath::Sin(theta);
  Double_t Z = 1/r*TMath::Cos(theta);
  Double_t E = TMath::Sqrt(  X*X + Y*Y + Z*Z + _pini.M2() );

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

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

Implements TAbsFitParticle.

Definition at line 65 of file TFitParticleMCPInvSpher.cc.

References TFitParticleMCPInvSpher().

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

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

Implements TAbsFitParticle.

Definition at line 171 of file TFitParticleMCPInvSpher.cc.

References TAbsFitParticle::_parameters, TAbsFitParticle::_pcurr, AlCaHLTBitMon_ParallelJobs::p, phi, alignCSCRings::r, and theta().

                                                 {
  // 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* DerivativeMatrix = new TMatrixD(4,3);
  (*DerivativeMatrix) *= 0.;

  Double_t r = _parameters(0,0);
  Double_t p = 1./r;
  Double_t theta = _parameters(1,0);
  Double_t phi = _parameters(2,0);

  //1st column: dP/dr
  (*DerivativeMatrix)(0,0) = -1.*p*p*TMath::Cos(phi)*TMath::Sin(theta);
  (*DerivativeMatrix)(1,0) = -1.*p*p*TMath::Sin(phi)*TMath::Sin(theta);
  (*DerivativeMatrix)(2,0) = -1.*p*p*TMath::Cos(theta);
  (*DerivativeMatrix)(3,0) = -1.*p*p*p/_pcurr.E();

  //2nd column: dP/dtheta
  (*DerivativeMatrix)(0,1) = p*TMath::Cos(phi)*TMath::Cos(theta);
  (*DerivativeMatrix)(1,1) = p*TMath::Sin(phi)*TMath::Cos(theta);
  (*DerivativeMatrix)(2,1) = -1.*p*TMath::Sin(theta);
  (*DerivativeMatrix)(3,1) = 0.;

   //3rd column: dP/dphi
  (*DerivativeMatrix)(0,2) = -1.*p*TMath::Sin(phi)*TMath::Sin(theta);
  (*DerivativeMatrix)(1,2) = p*TMath::Cos(phi)*TMath::Sin(theta);;
  (*DerivativeMatrix)(2,2) = 0.;
  (*DerivativeMatrix)(3,2) = 0.;

  return DerivativeMatrix;  

}
void TFitParticleMCPInvSpher::init ( TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
) [protected]

Definition at line 85 of file TFitParticleMCPInvSpher.cc.

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

Referenced by TFitParticleMCPInvSpher().

                                                                                        {

  _nPar = 3;
  setIni4Vec(p, M);
  setCovMatrix(theCovMatrix);
  
}
void TFitParticleMCPInvSpher::setIni4Vec ( const TLorentzVector *  pini) [virtual]

Implements TAbsFitParticle.

Definition at line 121 of file TFitParticleMCPInvSpher.cc.

Referenced by init().

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

  TVector3 vec( pini->Vect() );
  setIni4Vec( &vec, pini->M() );

}
void TFitParticleMCPInvSpher::setIni4Vec ( const TVector3 *  p,
Double_t  M 
)

Definition at line 130 of file TFitParticleMCPInvSpher.cc.

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

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

  if ( p == 0 ) {

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

    _iniparameters.ResizeTo(_nPar,1);
    _iniparameters(0,0) = 0.;
    _parameters.ResizeTo(_nPar,1);
    _parameters = _iniparameters;

  } else {

    _pini.SetXYZM( p->x(), p->y(), p->z(), M);
    _pcurr = _pini;

    Double_t r = 1/_pini.P();
    Double_t theta = _pini.Theta();
    Double_t phi = _pini.Phi();

    _iniparameters.ResizeTo(_nPar,1);
    _iniparameters(0,0) = r;
    _iniparameters(1,0) = theta;
    _iniparameters(2,0) = phi;
    _parameters.ResizeTo(_nPar,1);
    _parameters = _iniparameters;

    _u1.SetXYZ( TMath::Cos(phi)*TMath::Sin(theta), TMath::Sin(phi)*TMath::Sin(theta), TMath::Cos(theta) );
    _u2.SetXYZ( TMath::Cos(phi)*TMath::Cos(theta), TMath::Sin(phi)*TMath::Cos(theta), -1.*TMath::Sin(theta) );
    _u3.SetXYZ( -1.*TMath::Sin(phi), TMath::Cos(phi), 0. );
  
  }

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

Implements TAbsFitParticle.

Definition at line 206 of file TFitParticleMCPInvSpher.cc.

References TAbsFitParticle::_nPar.

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

  // retrieve parameters
  TMatrixD* tparams = new TMatrixD( _nPar, 1 );
  (*tparams)(0,0) = 1./vec.P();
  (*tparams)(1,0) = vec.Theta();
  (*tparams)(2,0) = vec.Phi();

  return tparams;

}