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 8 of file TFitParticleCart.h.

Constructor & Destructor Documentation

◆ TFitParticleCart() [1/4]

TFitParticleCart::TFitParticleCart ( )

Definition at line 25 of file TFitParticleCart.cc.

References init().

Referenced by clone().

25 : TAbsFitParticle() { init(nullptr, nullptr); }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)

◆ TFitParticleCart() [2/4]

TFitParticleCart::TFitParticleCart ( const TFitParticleCart fitParticle)

Definition at line 27 of file TFitParticleCart.cc.

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

28  : TAbsFitParticle(fitParticle.GetName(), fitParticle.GetTitle()) {
29  _nPar = fitParticle._nPar;
30  _u1 = fitParticle._u1;
31  _u2 = fitParticle._u2;
32  _u3 = fitParticle._u3;
33  _covMatrix.ResizeTo(fitParticle._covMatrix);
34  _covMatrix = fitParticle._covMatrix;
35  _iniparameters.ResizeTo(fitParticle._iniparameters);
36  _iniparameters = fitParticle._iniparameters;
37  _parameters.ResizeTo(fitParticle._parameters);
38  _parameters = fitParticle._parameters;
39  _pini = fitParticle._pini;
40  _pcurr = fitParticle._pcurr;
41 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters

◆ TFitParticleCart() [3/4]

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

Definition at line 43 of file TFitParticleCart.cc.

References init().

43  : TAbsFitParticle() {
44  init(pini, theCovMatrix);
45 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)

◆ TFitParticleCart() [4/4]

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

Definition at line 47 of file TFitParticleCart.cc.

References init().

52  init(pini, theCovMatrix);
53 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)

◆ ~TFitParticleCart()

TFitParticleCart::~TFitParticleCart ( )
override

Definition at line 67 of file TFitParticleCart.cc.

67 {}

Member Function Documentation

◆ calc4Vec()

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

Implements TAbsFitParticle.

Definition at line 78 of file TFitParticleCart.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, submitPVValidationJobs::params, X, beamSpotPI::Y, and beamSpotPI::Z.

78  {
79  // Calculates a 4vector corresponding to the given
80  // parameter values
81 
82  if (params == nullptr) {
83  return nullptr;
84  }
85 
86  if (params->GetNcols() != 1 || params->GetNrows() != _nPar) {
87  edm::LogError("WrongMatrixSize") << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
88  return nullptr;
89  }
90 
91  Double_t X = (*params)(0, 0);
92  Double_t Y = (*params)(1, 0);
93  Double_t Z = (*params)(2, 0);
94  Double_t E = TMath::Sqrt(X * X + Y * Y + Z * Z + (*params)(3, 0) * (*params)(3, 0) * _pini.M2());
95 
96  TLorentzVector* vec = new TLorentzVector(X, Y, Z, E);
97  return vec;
98 }
#define X(str)
Definition: MuonsGrabber.cc:38
Log< level::Error, false > LogError
TLorentzVector _pini

◆ clone()

TAbsFitParticle * TFitParticleCart::clone ( const TString &  newname = TString("")) const
overridevirtual

Implements TAbsFitParticle.

Definition at line 55 of file TFitParticleCart.cc.

References TFitParticleCart().

55  {
56  // Returns a copy of itself
57 
58  TAbsFitParticle* myclone = new TFitParticleCart(*this);
59  if (newname.Length() > 0)
60  myclone->SetName(newname);
61  return myclone;
62 }

◆ getDerivative()

TMatrixD * TFitParticleCart::getDerivative ( )
overridevirtual

Implements TAbsFitParticle.

Definition at line 141 of file TFitParticleCart.cc.

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

141  {
142  // returns derivative dP/dy with P=(p,E) and y=(px, py, pz, d)
143  // the free parameters of the fit. The columns of the matrix contain
144  // (dP/dpx, dP/dpy, ...).
145 
146  TMatrixD* DerivativeMatrix = new TMatrixD(4, 4);
147  (*DerivativeMatrix) *= 0.;
148 
149  //1st column: dP/dx
150  (*DerivativeMatrix)(0, 0) = 1.;
151  (*DerivativeMatrix)(1, 0) = 0.;
152  (*DerivativeMatrix)(2, 0) = 0.;
153  (*DerivativeMatrix)(3, 0) = 0.;
154 
155  //2nd column: dP/dy
156  (*DerivativeMatrix)(0, 1) = 0;
157  (*DerivativeMatrix)(1, 1) = 1;
158  (*DerivativeMatrix)(2, 1) = 0;
159  (*DerivativeMatrix)(3, 1) = 0.;
160 
161  //3rd column: dP/dz
162  (*DerivativeMatrix)(0, 2) = 0.;
163  (*DerivativeMatrix)(1, 2) = 0.;
164  (*DerivativeMatrix)(2, 2) = 1.;
165  (*DerivativeMatrix)(3, 2) = 0.;
166 
167  //4th column: dP/dm
168  (*DerivativeMatrix)(0, 3) = 0.;
169  (*DerivativeMatrix)(1, 3) = 0.;
170  (*DerivativeMatrix)(2, 3) = 0.;
171  (*DerivativeMatrix)(3, 3) = _pini.M() * _pini.M() * _parameters(3, 0) / _pcurr.E();
172 
173  return DerivativeMatrix;
174 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr

◆ init()

void TFitParticleCart::init ( TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)
protected

Definition at line 72 of file TFitParticleCart.cc.

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

Referenced by TFitParticleCart().

72  {
73  _nPar = 4;
74  setIni4Vec(pini);
75  setCovMatrix(theCovMatrix);
76 }
void setIni4Vec(const TLorentzVector *pini) override
virtual void setCovMatrix(const TMatrixD *theCovMatrix)

◆ setIni4Vec()

void TFitParticleCart::setIni4Vec ( const TLorentzVector *  pini)
overridevirtual

Implements TAbsFitParticle.

Definition at line 100 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().

100  {
101  // Set the initial 4vector. Will also set the
102  // inital parameter values
103 
104  if (pini == nullptr) {
105  _u1.SetXYZ(0., 0., 0.);
106  _u3.SetXYZ(0., 0., 0.);
107  _u2.SetXYZ(0., 0., 0.);
108  _pini.SetXYZT(0., 0., 0., 0.);
109  _pcurr = _pini;
110 
111  _iniparameters.ResizeTo(_nPar, 1);
112  _iniparameters(0, 0) = 0;
113  _iniparameters(1, 0) = 0;
114  _iniparameters(2, 0) = 0;
115  _iniparameters(3, 0) = 0.;
116 
117  _parameters.ResizeTo(_nPar, 1);
118  _parameters(0, 0) = 0.;
119  _parameters(1, 0) = 0.;
120  _parameters(2, 0) = 0.;
121  _parameters(3, 0) = 0.;
122 
123  } else {
124  _pini = (*pini);
125  _pcurr = _pini;
126 
127  _u1.SetXYZ(1., 0., 0.);
128  _u2.SetXYZ(0., 1., 0.);
129  _u3.SetXYZ(0., 0., 1.);
130 
131  _iniparameters.ResizeTo(_nPar, 1);
132  _iniparameters(0, 0) = _pini.X();
133  _iniparameters(1, 0) = _pini.Y();
134  _iniparameters(2, 0) = _pini.Z();
135  _iniparameters(3, 0) = 1.;
136  _parameters.ResizeTo(_nPar, 1);
138  }
139 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters

◆ transform()

TMatrixD * TFitParticleCart::transform ( const TLorentzVector &  vec)
overridevirtual

Implements TAbsFitParticle.

Definition at line 176 of file TFitParticleCart.cc.

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

176  {
177  // Returns the parameters corresponding to the given
178  // 4vector
179 
180  TMatrixD* tparams = new TMatrixD(_nPar, 1);
181  (*tparams)(0, 0) = vec.X();
182  (*tparams)(1, 0) = vec.Y();
183  (*tparams)(2, 0) = vec.Z();
184  (*tparams)(3, 0) = vec.M() / _pini.M();
185 
186  return tparams;
187 }
TLorentzVector _pini