CMS 3D CMS Logo

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

#include <TFitParticleEMomDev.h>

Inheritance diagram for TFitParticleEMomDev:
TAbsFitParticle

Public Member Functions

TLorentzVector * calc4Vec (const TMatrixD *params) override
 
TAbsFitParticleclone (const TString &newname="") const override
 
TMatrixD * getDerivative () override
 
void setIni4Vec (const TLorentzVector *pini) override
 
 TFitParticleEMomDev ()
 
 TFitParticleEMomDev (const TFitParticleEMomDev &fitParticle)
 
 TFitParticleEMomDev (TLorentzVector *pini, const TMatrixD *theCovMatrix)
 
 TFitParticleEMomDev (const TString &name, const TString &title, TLorentzVector *pini, const TMatrixD *theCovMatrix)
 
TMatrixD * transform (const TLorentzVector &vec) override
 
 ~TFitParticleEMomDev () 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 TFitParticleEMomDev.h.

Constructor & Destructor Documentation

◆ TFitParticleEMomDev() [1/4]

TFitParticleEMomDev::TFitParticleEMomDev ( )

Definition at line 31 of file TFitParticleEMomDev.cc.

References init().

Referenced by clone().

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

◆ TFitParticleEMomDev() [2/4]

TFitParticleEMomDev::TFitParticleEMomDev ( const TFitParticleEMomDev fitParticle)

Definition at line 33 of file TFitParticleEMomDev.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  _nPar = fitParticle._nPar;
36  _u1 = fitParticle._u1;
37  _u2 = fitParticle._u2;
38  _u3 = fitParticle._u3;
39  _covMatrix.ResizeTo(fitParticle._covMatrix);
40  _covMatrix = fitParticle._covMatrix;
41  _iniparameters.ResizeTo(fitParticle._iniparameters);
42  _iniparameters = fitParticle._iniparameters;
43  _parameters.ResizeTo(fitParticle._parameters);
44  _parameters = fitParticle._parameters;
45  _pini = fitParticle._pini;
46  _pcurr = fitParticle._pcurr;
47 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters

◆ TFitParticleEMomDev() [3/4]

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

Definition at line 49 of file TFitParticleEMomDev.cc.

References init().

49  : TAbsFitParticle() {
50  init(pini, theCovMatrix);
51 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)

◆ TFitParticleEMomDev() [4/4]

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

Definition at line 53 of file TFitParticleEMomDev.cc.

References init().

58  init(pini, theCovMatrix);
59 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)

◆ ~TFitParticleEMomDev()

TFitParticleEMomDev::~TFitParticleEMomDev ( )
override

Definition at line 73 of file TFitParticleEMomDev.cc.

73 {}

Member Function Documentation

◆ calc4Vec()

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

Implements TAbsFitParticle.

Definition at line 126 of file TFitParticleEMomDev.cc.

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

126  {
127  // Calculates a 4vector corresponding to the given
128  // parameter values
129 
130  if (params == nullptr) {
131  return nullptr;
132  }
133 
134  if (params->GetNcols() != 1 || params->GetNrows() != _nPar) {
135  edm::LogError("WrongMatrixSize") << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
136  return nullptr;
137  }
138 
139  Double_t X = _pini.P() * (*params)(0, 0) * _u1.X() + (*params)(1, 0) * _u2.X() + (*params)(2, 0) * _u3.X();
140  Double_t Y = _pini.P() * (*params)(0, 0) * _u1.Y() + (*params)(1, 0) * _u2.Y() + (*params)(2, 0) * _u3.Y();
141  Double_t Z = _pini.P() * (*params)(0, 0) * _u1.Z() + (*params)(1, 0) * _u2.Z() + (*params)(2, 0) * _u3.Z();
142  Double_t E = _pini.E() * (*params)(3, 0);
143 
144  TLorentzVector* vec = new TLorentzVector(X, Y, Z, E);
145  return vec;
146 }
#define X(str)
Definition: MuonsGrabber.cc:38
Log< level::Error, false > LogError
TLorentzVector _pini

◆ clone()

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

Implements TAbsFitParticle.

Definition at line 61 of file TFitParticleEMomDev.cc.

References TFitParticleEMomDev().

61  {
62  // Returns a copy of itself
63 
64  TAbsFitParticle* myclone = new TFitParticleEMomDev(*this);
65  if (newname.Length() > 0)
66  myclone->SetName(newname);
67  return myclone;
68 }

◆ getDerivative()

TMatrixD * TFitParticleEMomDev::getDerivative ( )
overridevirtual

Implements TAbsFitParticle.

Definition at line 148 of file TFitParticleEMomDev.cc.

References TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, and TAbsFitParticle::_u3.

148  {
149  // returns derivative dP/dy with P=(p,E) and y=(r, theta, phi, d)
150  // the free parameters of the fit. The columns of the matrix contain
151  // (dP/dr, dP/dtheta, dP/dphi, dP/dd).
152 
153  TMatrixD* DerivativeMatrix = new TMatrixD(4, 4);
154  (*DerivativeMatrix) *= 0.;
155 
156  //1st column: dP/dr
157  (*DerivativeMatrix)(0, 0) = _pini.P() * _u1.X();
158  (*DerivativeMatrix)(1, 0) = _pini.P() * _u1.Y();
159  (*DerivativeMatrix)(2, 0) = _pini.P() * _u1.Z();
160  (*DerivativeMatrix)(3, 0) = 0.;
161 
162  //2nd column: dP/dtheta
163  (*DerivativeMatrix)(0, 1) = _u2.X();
164  (*DerivativeMatrix)(1, 1) = _u2.Y();
165  (*DerivativeMatrix)(2, 1) = _u2.Z();
166  (*DerivativeMatrix)(3, 1) = 0.;
167 
168  //3rd column: dP/dphi
169  (*DerivativeMatrix)(0, 2) = _u3.X();
170  (*DerivativeMatrix)(1, 2) = _u3.Y();
171  (*DerivativeMatrix)(2, 2) = _u3.Z();
172  (*DerivativeMatrix)(3, 2) = 0.;
173 
174  //4th column: dP/dm
175  (*DerivativeMatrix)(0, 3) = 0.;
176  (*DerivativeMatrix)(1, 3) = 0.;
177  (*DerivativeMatrix)(2, 3) = 0.;
178  (*DerivativeMatrix)(3, 3) = _pini.E();
179 
180  return DerivativeMatrix;
181 }
TLorentzVector _pini

◆ init()

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

Definition at line 78 of file TFitParticleEMomDev.cc.

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

Referenced by TFitParticleEMomDev().

78  {
79  _nPar = 4;
80  setIni4Vec(pini);
81  setCovMatrix(theCovMatrix);
82 }
void setIni4Vec(const TLorentzVector *pini) override
virtual void setCovMatrix(const TMatrixD *theCovMatrix)

◆ setIni4Vec()

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

Implements TAbsFitParticle.

Definition at line 84 of file TFitParticleEMomDev.cc.

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

Referenced by init().

84  {
85  // Set the initial 4vector. Will also set the
86  // inital parameter values
87  _iniparameters.ResizeTo(_nPar, 1);
88  _parameters.ResizeTo(_nPar, 1);
89 
90  if (pini == nullptr) {
91  _iniparameters(0, 0) = 0.;
92  _iniparameters(1, 0) = 0.;
93  _iniparameters(2, 0) = 0.;
94  _iniparameters(3, 0) = 0.;
95 
96  _u1.SetXYZ(0., 0., 0.);
97  _u3.SetXYZ(0., 0., 0.);
98  _u2.SetXYZ(0., 0., 0.);
99  _pini.SetXYZT(0., 0., 0., 0.);
100  _pcurr = _pini;
101 
102  } else {
103  _iniparameters(0, 0) = 1.;
104  _iniparameters(1, 0) = 0.;
105  _iniparameters(2, 0) = 0.;
106  _iniparameters(3, 0) = 1.;
107 
108  _pini = (*pini);
109  _pcurr = _pini;
110 
111  _u1 = pini->Vect();
112  _u1 *= 1. / _u1.Mag();
113 
114  TVector3 uz(0., 0., 1.);
115  _u3 = uz.Cross(_u1);
116  _u3 *= 1. / _u3.Mag();
117 
118  _u2 = _u3.Cross(_u1);
119  _u2 *= 1. / _u2.Mag();
120  }
121 
122  // reset parameters
124 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters

◆ transform()

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

Implements TAbsFitParticle.

Definition at line 183 of file TFitParticleEMomDev.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, TAbsFitParticle::_u3, and makeMuonMisalignmentScenario::rot.

183  {
184  // Returns the parameters corresponding to the given
185  // 4vector wrt. to the current base vectors u_r, u_theta, and u_phi
186 
187  // construct rotation matrix
188  TRotation rot;
189  rot.RotateAxes(_u1, _u2, _u3);
190  rot.Invert();
191 
192  // rotate vector
193  TVector3 vec3(vec.Vect());
194  vec3.Transform(rot);
195 
196  // retrieve parameters
197  TMatrixD* tparams = new TMatrixD(_nPar, 1);
198  (*tparams)(0, 0) = vec3.x() / _pini.P();
199  (*tparams)(1, 0) = vec3.y();
200  (*tparams)(2, 0) = vec3.z();
201  (*tparams)(3, 0) = vec.E() / _pini.E();
202 
203  return tparams;
204 }
TLorentzVector _pini
std::vector< vec2 > vec3
Definition: HCALResponse.h:17