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

25 : TAbsFitParticle() { init(nullptr, nullptr); }

References init().

Referenced by clone().

◆ TFitParticleCart() [2/4]

TFitParticleCart::TFitParticleCart ( const TFitParticleCart fitParticle)

Definition at line 27 of file TFitParticleCart.cc.

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 }

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

◆ TFitParticleCart() [3/4]

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

Definition at line 43 of file TFitParticleCart.cc.

43  : TAbsFitParticle() {
44  init(pini, theCovMatrix);
45 }

References init().

◆ TFitParticleCart() [4/4]

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

Definition at line 47 of file TFitParticleCart.cc.

52  init(pini, theCovMatrix);
53 }

References init().

◆ ~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.

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 }

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, CalibrationSummaryClient_cfi::params, X, BeamSpotPI::Y, and BeamSpotPI::Z.

◆ clone()

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

Implements TAbsFitParticle.

Definition at line 55 of file TFitParticleCart.cc.

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 }

References TFitParticleCart().

◆ getDerivative()

TMatrixD * TFitParticleCart::getDerivative ( )
overridevirtual

Implements TAbsFitParticle.

Definition at line 141 of file TFitParticleCart.cc.

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 }

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

◆ init()

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

Definition at line 72 of file TFitParticleCart.cc.

72  {
73  _nPar = 4;
74  setIni4Vec(pini);
75  setCovMatrix(theCovMatrix);
76 }

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

Referenced by TFitParticleCart().

◆ setIni4Vec()

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

Implements TAbsFitParticle.

Definition at line 100 of file TFitParticleCart.cc.

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 }

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

Referenced by init().

◆ transform()

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

Implements TAbsFitParticle.

Definition at line 176 of file TFitParticleCart.cc.

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 }

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

TAbsFitParticle::_iniparameters
TMatrixD _iniparameters
Definition: TAbsFitParticle.h:58
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
TFitParticleCart::TFitParticleCart
TFitParticleCart()
Definition: TFitParticleCart.cc:25
X
#define X(str)
Definition: MuonsGrabber.cc:38
TFitParticleCart::setIni4Vec
void setIni4Vec(const TLorentzVector *pini) override
Definition: TFitParticleCart.cc:100
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
TAbsFitParticle::_parameters
TMatrixD _parameters
Definition: TAbsFitParticle.h:59
TAbsFitParticle::_pcurr
TLorentzVector _pcurr
Definition: TAbsFitParticle.h:61
TAbsFitParticle::_pini
TLorentzVector _pini
Definition: TAbsFitParticle.h:60
TAbsFitParticle::_covMatrix
TMatrixD _covMatrix
Definition: TAbsFitParticle.h:54
TFitParticleCart::init
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
Definition: TFitParticleCart.cc:72
TAbsFitParticle::_u2
TVector3 _u2
Definition: TAbsFitParticle.h:51
TAbsFitParticle::_nPar
Int_t _nPar
Definition: TAbsFitParticle.h:49
TAbsFitParticle
Definition: TAbsFitParticle.h:9
TAbsFitParticle::setCovMatrix
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
Definition: TAbsFitParticle.cc:98
TAbsFitParticle::TAbsFitParticle
TAbsFitParticle()
Definition: TAbsFitParticle.cc:18
TAbsFitParticle::_u3
TVector3 _u3
Definition: TAbsFitParticle.h:52
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
TAbsFitParticle::_u1
TVector3 _u1
Definition: TAbsFitParticle.h:50
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:32
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:33