CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions
TFitParticleCart Class Reference

#include <TFitParticleCart.h>

Inheritance diagram for TFitParticleCart:
TAbsFitParticle

Public Member Functions

TLorentzVector * calc4Vec (const TMatrixD *params) override
 
TAbsFitParticleclone (const TString &newname=TString("")) const override
 
TMatrixD * getDerivative () override
 
void setIni4Vec (const TLorentzVector *pini) override
 
 TFitParticleCart ()
 
 TFitParticleCart (const TFitParticleCart &fitParticle)
 
 TFitParticleCart (TLorentzVector *pini, const TMatrixD *theCovMatrix)
 
 TFitParticleCart (const TString &name, const TString &title, TLorentzVector *pini, const TMatrixD *theCovMatrix)
 
TMatrixD * transform (const TLorentzVector &vec) override
 
 ~TFitParticleCart () override
 
- Public Member Functions inherited from TAbsFitParticle
virtual void applycorr (TMatrixD *corrMatrix)
 
virtual const TMatrixD * getCovMatrix () const
 
virtual const TMatrixD * getCovMatrixDeltaY ()
 
virtual const TMatrixD * getCovMatrixFit () const
 
const TLorentzVector * getCurr4Vec ()
 
TString getInfoString ()
 
const TLorentzVector * getIni4Vec ()
 
Int_t getNPar () const
 
const TMatrixD * getParCurr ()
 
const TMatrixD * getParIni ()
 
virtual const TMatrixD * getPull ()
 
const TVector3 * getu1 ()
 
const TVector3 * getu2 ()
 
const TVector3 * getu3 ()
 
virtual void print ()
 
virtual void reset ()
 
virtual void setCovMatrix (const TMatrixD *theCovMatrix)
 
virtual void setCovMatrixFit (const TMatrixD *theCovMatrixFit)
 
void setParIni (const TMatrixD *parini)
 
 TAbsFitParticle ()
 
 TAbsFitParticle (const TString &name, const TString &title)
 
 ~TAbsFitParticle () override
 

Protected Member Functions

void init (TLorentzVector *pini, const TMatrixD *theCovMatrix)
 
- Protected Member Functions inherited from TAbsFitParticle
void calcCovMatrixDeltaY ()
 

Additional Inherited Members

- Protected Attributes inherited from TAbsFitParticle
TMatrixD _covMatrix
 
TMatrixD _covMatrixDeltaY
 
TMatrixD _covMatrixFit
 
TMatrixD _iniparameters
 
Int_t _nPar
 
TMatrixD _parameters
 
TLorentzVector _pcurr
 
TLorentzVector _pini
 
TMatrixD _pull
 
TVector3 _u1
 
TVector3 _u2
 
TVector3 _u3
 

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().

28  :TAbsFitParticle()
29 {
30  init(nullptr, nullptr);
31 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
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.

34  :TAbsFitParticle( fitParticle.GetName(), fitParticle.GetTitle() )
35 {
36 
37  _nPar = fitParticle._nPar;
38  _u1 = fitParticle._u1;
39  _u2 = fitParticle._u2;
40  _u3 = fitParticle._u3;
41  _covMatrix.ResizeTo( fitParticle._covMatrix );
42  _covMatrix = fitParticle._covMatrix;
43  _iniparameters.ResizeTo( fitParticle._iniparameters );
44  _iniparameters = fitParticle._iniparameters;
45  _parameters.ResizeTo( fitParticle._parameters );
46  _parameters = fitParticle._parameters;
47  _pini = fitParticle._pini;
48  _pcurr = fitParticle._pcurr;
49 
50 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TFitParticleCart::TFitParticleCart ( TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)

Definition at line 52 of file TFitParticleCart.cc.

References init().

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

Definition at line 58 of file TFitParticleCart.cc.

References init().

61 {
62  init(pini, theCovMatrix);
63 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
TFitParticleCart::~TFitParticleCart ( )
override

Definition at line 77 of file TFitParticleCart.cc.

77  {
78 
79 }

Member Function Documentation

TLorentzVector * TFitParticleCart::calc4Vec ( const TMatrixD *  params)
overridevirtual

Implements TAbsFitParticle.

Definition at line 92 of file TFitParticleCart.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, X, DOFs::Y, and DOFs::Z.

92  {
93  // Calculates a 4vector corresponding to the given
94  // parameter values
95 
96  if (params == nullptr) {
97  return nullptr;
98  }
99 
100  if ( params->GetNcols() != 1 || params->GetNrows() !=_nPar ) {
101  edm::LogError ("WrongMatrixSize")
102  << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
103  return nullptr;
104  }
105 
106  Double_t X = (*params)(0,0);
107  Double_t Y = (*params)(1,0);
108  Double_t Z = (*params)(2,0);
109  Double_t E = TMath::Sqrt( X*X + Y*Y + Z*Z + (*params)(3,0)*(*params)(3,0)*_pini.M2() );
110 
111  TLorentzVector* vec = new TLorentzVector( X, Y, Z, E );
112  return vec;
113 
114 }
#define X(str)
Definition: MuonsGrabber.cc:48
TLorentzVector _pini
TAbsFitParticle * TFitParticleCart::clone ( const TString &  newname = TString("")) const
overridevirtual

Implements TAbsFitParticle.

Definition at line 65 of file TFitParticleCart.cc.

References TFitParticleCart().

65  {
66  // Returns a copy of itself
67 
68  TAbsFitParticle* myclone = new TFitParticleCart( *this );
69  if ( newname.Length() > 0 ) myclone->SetName(newname);
70  return myclone;
71 
72 }
TMatrixD * TFitParticleCart::getDerivative ( )
overridevirtual

Implements TAbsFitParticle.

Definition at line 161 of file TFitParticleCart.cc.

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

161  {
162  // returns derivative dP/dy with P=(p,E) and y=(px, py, pz, d)
163  // the free parameters of the fit. The columns of the matrix contain
164  // (dP/dpx, dP/dpy, ...).
165 
166  TMatrixD* DerivativeMatrix = new TMatrixD(4,4);
167  (*DerivativeMatrix) *= 0.;
168 
169  //1st column: dP/dx
170  (*DerivativeMatrix)(0,0)=1.;
171  (*DerivativeMatrix)(1,0)=0.;
172  (*DerivativeMatrix)(2,0)=0.;
173  (*DerivativeMatrix)(3,0)=0.;
174 
175  //2nd column: dP/dy
176  (*DerivativeMatrix)(0,1)=0;
177  (*DerivativeMatrix)(1,1)=1;
178  (*DerivativeMatrix)(2,1)=0;
179  (*DerivativeMatrix)(3,1)=0.;
180 
181  //3rd column: dP/dz
182  (*DerivativeMatrix)(0,2)=0.;
183  (*DerivativeMatrix)(1,2)=0.;
184  (*DerivativeMatrix)(2,2)=1.;
185  (*DerivativeMatrix)(3,2)=0.;
186 
187  //4th column: dP/dm
188  (*DerivativeMatrix)(0,3)=0.;
189  (*DerivativeMatrix)(1,3)=0.;
190  (*DerivativeMatrix)(2,3)=0.;
191  (*DerivativeMatrix)(3,3)=_pini.M()*_pini.M()*_parameters(3,0)/_pcurr.E();
192 
193  return DerivativeMatrix;
194 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
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().

84  {
85 
86  _nPar = 4;
87  setIni4Vec(pini);
88  setCovMatrix(theCovMatrix);
89 
90 }
void setIni4Vec(const TLorentzVector *pini) override
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
void TFitParticleCart::setIni4Vec ( const TLorentzVector *  pini)
overridevirtual

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().

116  {
117  // Set the initial 4vector. Will also set the
118  // inital parameter values
119 
120  if (pini == nullptr) {
121 
122  _u1.SetXYZ(0., 0., 0.);
123  _u3.SetXYZ(0., 0., 0.);
124  _u2.SetXYZ(0., 0., 0.);
125  _pini.SetXYZT(0., 0., 0., 0.);
126  _pcurr = _pini;
127 
128  _iniparameters.ResizeTo(_nPar,1);
129  _iniparameters(0,0)=0;
130  _iniparameters(1,0)=0;
131  _iniparameters(2,0)=0;
132  _iniparameters(3,0)=0.;
133 
134  _parameters.ResizeTo(_nPar,1);
135  _parameters(0,0)=0.;
136  _parameters(1,0)=0.;
137  _parameters(2,0)=0.;
138  _parameters(3,0)=0.;
139 
140  } else {
141 
142  _pini = (*pini);
143  _pcurr = _pini;
144 
145  _u1.SetXYZ( 1., 0., 0. );
146  _u2.SetXYZ( 0., 1., 0. );
147  _u3.SetXYZ( 0., 0., 1. );
148 
149  _iniparameters.ResizeTo(_nPar,1);
150  _iniparameters(0,0)=_pini.X();
151  _iniparameters(1,0)=_pini.Y();
152  _iniparameters(2,0)=_pini.Z();
153  _iniparameters(3,0)=1.;
154  _parameters.ResizeTo(_nPar,1);
156 
157  }
158 
159 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TMatrixD * TFitParticleCart::transform ( const TLorentzVector &  vec)
overridevirtual

Implements TAbsFitParticle.

Definition at line 196 of file TFitParticleCart.cc.

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

196  {
197  // Returns the parameters corresponding to the given
198  // 4vector
199 
200  TMatrixD* tparams = new TMatrixD( _nPar, 1 );
201  (*tparams)(0,0) = vec.X();
202  (*tparams)(1,0) = vec.Y();
203  (*tparams)(2,0) = vec.Z();
204  (*tparams)(3,0) = vec.M()/_pini.M();
205 
206  return tparams;
207 
208 }
TLorentzVector _pini