CMS 3D CMS Logo

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

#include <TFitParticleMCMomDev.h>

Inheritance diagram for TFitParticleMCMomDev:
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
 
void setIni4Vec (const TVector3 *p, Double_t M)
 
 TFitParticleMCMomDev ()
 
 TFitParticleMCMomDev (const TFitParticleMCMomDev &fitParticle)
 
 TFitParticleMCMomDev (TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
 
 TFitParticleMCMomDev (const TString &name, const TString &title, TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
 
TMatrixD * transform (const TLorentzVector &vec) override
 
 ~TFitParticleMCMomDev () 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 (TVector3 *p, Double_t M, 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 TFitParticleMCMomDev.h.

Constructor & Destructor Documentation

TFitParticleMCMomDev::TFitParticleMCMomDev ( )

Definition at line 32 of file TFitParticleMCMomDev.cc.

References init().

Referenced by clone().

32 : TAbsFitParticle() { init(nullptr, 0., nullptr); }
void init(TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
TFitParticleMCMomDev::TFitParticleMCMomDev ( const TFitParticleMCMomDev fitParticle)

Definition at line 34 of file TFitParticleMCMomDev.cc.

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

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

Definition at line 50 of file TFitParticleMCMomDev.cc.

References init().

50  : TAbsFitParticle() {
51  init(p, M, theCovMatrix);
52 }
void init(TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
TFitParticleMCMomDev::TFitParticleMCMomDev ( const TString &  name,
const TString &  title,
TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)

Definition at line 54 of file TFitParticleMCMomDev.cc.

References init().

57  init(p, M, theCovMatrix);
58 }
void init(TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
TFitParticleMCMomDev::~TFitParticleMCMomDev ( )
override

Definition at line 72 of file TFitParticleMCMomDev.cc.

72 {}

Member Function Documentation

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

Implements TAbsFitParticle.

Definition at line 89 of file TFitParticleMCMomDev.cc.

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

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

Implements TAbsFitParticle.

Definition at line 60 of file TFitParticleMCMomDev.cc.

References TFitParticleMCMomDev().

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

Implements TAbsFitParticle.

Definition at line 145 of file TFitParticleMCMomDev.cc.

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

145  {
146  // returns derivative dP/dy with P=(p,E) and y=(r, theta, phi)
147  // the free parameters of the fit. The columns of the matrix contain
148  // (dP/dr, dP/dtheta, dP/dphi).
149 
150  TMatrixD* DerivativeMatrix = new TMatrixD(4, 3);
151  (*DerivativeMatrix) *= 0.;
152  //1st column: dP/dr
153  (*DerivativeMatrix)(0, 0) = _pini.P() * _u1.X();
154  (*DerivativeMatrix)(1, 0) = _pini.P() * _u1.Y();
155  (*DerivativeMatrix)(2, 0) = _pini.P() * _u1.Z();
156  (*DerivativeMatrix)(3, 0) = _pini.P() * _pini.P() * _parameters(0, 0) / _pcurr.E();
157 
158  // (*DerivativeMatrix)(3,0)=0.;
159 
160  //2nd column: dP/dtheta
161  (*DerivativeMatrix)(0, 1) = _u2.X();
162  (*DerivativeMatrix)(1, 1) = _u2.Y();
163  (*DerivativeMatrix)(2, 1) = _u2.Z();
164  (*DerivativeMatrix)(3, 1) = _parameters(1, 0) / _pcurr.E();
165 
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) = _parameters(2, 0) / _pcurr.E();
173 
174  //(*DerivativeMatrix)(3,2)=0.;
175 
176  return DerivativeMatrix;
177 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
void TFitParticleMCMomDev::init ( TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)
protected

Definition at line 77 of file TFitParticleMCMomDev.cc.

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

Referenced by TFitParticleMCMomDev().

77  {
78  _nPar = 3;
79  setIni4Vec(p, M);
80  _iniparameters.ResizeTo(_nPar, 1);
81  _iniparameters(0, 0) = 1.;
82  _iniparameters(1, 0) = 0.;
83  _iniparameters(2, 0) = 0.;
84  _parameters.ResizeTo(_nPar, 1);
86  setCovMatrix(theCovMatrix);
87 }
TMatrixD _parameters
void setIni4Vec(const TLorentzVector *pini) override
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
TMatrixD _iniparameters
void TFitParticleMCMomDev::setIni4Vec ( const TLorentzVector *  pini)
overridevirtual

Implements TAbsFitParticle.

Definition at line 111 of file TFitParticleMCMomDev.cc.

Referenced by init().

111  {
112  // Set the initial 4vector. Will also set the
113  // inital parameter values
114 
115  TVector3 vec(pini->Vect());
116  setIni4Vec(&vec, pini->M());
117 }
void setIni4Vec(const TLorentzVector *pini) override
void TFitParticleMCMomDev::setIni4Vec ( const TVector3 *  p,
Double_t  M 
)

Definition at line 119 of file TFitParticleMCMomDev.cc.

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

119  {
120  // Set the initial 4vector. Will also set the
121  // inital parameter values
122 
123  if (p == nullptr) {
124  _pini.SetXYZM(0., 0., 0., M);
125  _pcurr = _pini;
126 
127  } else {
128  _pini.SetXYZM(p->x(), p->y(), p->z(), M);
129  _pcurr = _pini;
130 
131  _u1 = (*p);
132  _u1 *= 1. / _u1.Mag();
133 
134  TVector3 uz(0., 0., 1.);
135  _u3 = uz.Cross(_u1);
136  _u3 *= 1. / _u3.Mag();
137 
138  _u2 = _u3.Cross(_u1);
139  _u2 *= 1. / _u2.Mag();
140  }
141 
143 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TMatrixD * TFitParticleMCMomDev::transform ( const TLorentzVector &  vec)
overridevirtual

Implements TAbsFitParticle.

Definition at line 179 of file TFitParticleMCMomDev.cc.

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

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