CMS 3D CMS Logo

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

#include <TFitParticleEScaledMomDev.h>

Inheritance diagram for TFitParticleEScaledMomDev:
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
 
 TFitParticleEScaledMomDev ()
 
 TFitParticleEScaledMomDev (const TFitParticleEScaledMomDev &fitParticle)
 
 TFitParticleEScaledMomDev (const TString &name, const TString &title, TLorentzVector *pini, const TMatrixD *theCovMatrix)
 
 TFitParticleEScaledMomDev (TLorentzVector *pini, const TMatrixD *theCovMatrix)
 
TMatrixD * transform (const TLorentzVector &vec) override
 
 ~TFitParticleEScaledMomDev () 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 TFitParticleEScaledMomDev.h.

Constructor & Destructor Documentation

◆ TFitParticleEScaledMomDev() [1/4]

TFitParticleEScaledMomDev::TFitParticleEScaledMomDev ( )

Definition at line 32 of file TFitParticleEScaledMomDev.cc.

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

References init().

Referenced by clone().

◆ TFitParticleEScaledMomDev() [2/4]

TFitParticleEScaledMomDev::TFitParticleEScaledMomDev ( const TFitParticleEScaledMomDev fitParticle)

Definition at line 34 of file TFitParticleEScaledMomDev.cc.

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 }

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

◆ TFitParticleEScaledMomDev() [3/4]

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

Definition at line 50 of file TFitParticleEScaledMomDev.cc.

51  : TAbsFitParticle() {
52  init(pini, theCovMatrix);
53 }

References init().

◆ TFitParticleEScaledMomDev() [4/4]

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

Definition at line 55 of file TFitParticleEScaledMomDev.cc.

60  init(pini, theCovMatrix);
61 }

References init().

◆ ~TFitParticleEScaledMomDev()

TFitParticleEScaledMomDev::~TFitParticleEScaledMomDev ( )
override

Definition at line 75 of file TFitParticleEScaledMomDev.cc.

75 {}

Member Function Documentation

◆ calc4Vec()

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

Implements TAbsFitParticle.

Definition at line 92 of file TFitParticleEScaledMomDev.cc.

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") << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
102  return nullptr;
103  }
104 
105  Double_t X = _pini.P() * (*params)(0, 0) * _u1.X() + (*params)(1, 0) * _u2.X() + (*params)(2, 0) * _u3.X();
106  Double_t Y = _pini.P() * (*params)(0, 0) * _u1.Y() + (*params)(1, 0) * _u2.Y() + (*params)(2, 0) * _u3.Y();
107  Double_t Z = _pini.P() * (*params)(0, 0) * _u1.Z() + (*params)(1, 0) * _u2.Z() + (*params)(2, 0) * _u3.Z();
108  Double_t pcurr = TMath::Sqrt(X * X + Y * Y + Z * Z);
109  Double_t E = _pini.E() * pcurr / _pini.P();
110 
111  TLorentzVector* vec = new TLorentzVector(X, Y, Z, E);
112  return vec;
113 }

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

◆ clone()

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

Implements TAbsFitParticle.

Definition at line 63 of file TFitParticleEScaledMomDev.cc.

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

References TFitParticleEScaledMomDev().

◆ getDerivative()

TMatrixD * TFitParticleEScaledMomDev::getDerivative ( )
overridevirtual

Implements TAbsFitParticle.

Definition at line 143 of file TFitParticleEScaledMomDev.cc.

143  {
144  // returns derivative dP/dy with P=(p,E) and y=(r, theta, phi)
145  // the free parameters of the fit. The columns of the matrix contain
146  // (dP/dr, dP/dtheta, dP/dphi).
147 
148  TMatrixD* DerivativeMatrix = new TMatrixD(4, 3);
149  (*DerivativeMatrix) *= 0.;
150 
151  //1st column: dP/dr
152  (*DerivativeMatrix)(0, 0) = _pini.P() * _u1.X();
153  (*DerivativeMatrix)(1, 0) = _pini.P() * _u1.Y();
154  (*DerivativeMatrix)(2, 0) = _pini.P() * _u1.Z();
155  (*DerivativeMatrix)(3, 0) = _pini.P() * _pini.E() * _parameters(0, 0) / _pcurr.P();
156  //2nd column: dP/dtheta
157  (*DerivativeMatrix)(0, 1) = _u2.X();
158  (*DerivativeMatrix)(1, 1) = _u2.Y();
159  (*DerivativeMatrix)(2, 1) = _u2.Z();
160  (*DerivativeMatrix)(3, 1) = _pini.E() / _pini.P() / _pcurr.P() * _parameters(1, 0);
161  //3rd column: dP/dphi
162  (*DerivativeMatrix)(0, 2) = _u3.X();
163  (*DerivativeMatrix)(1, 2) = _u3.Y();
164  (*DerivativeMatrix)(2, 2) = _u3.Z();
165  ;
166  (*DerivativeMatrix)(3, 2) = _pini.E() / _pini.P() / _pcurr.P() * _parameters(2, 0);
167 
168  return DerivativeMatrix;
169 }

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

◆ init()

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

Definition at line 80 of file TFitParticleEScaledMomDev.cc.

80  {
81  _nPar = 3;
82  setIni4Vec(pini);
83  _iniparameters.ResizeTo(_nPar, 1);
84  _iniparameters(0, 0) = 1.;
85  _iniparameters(1, 0) = 0.;
86  _iniparameters(2, 0) = 0.;
87  _parameters.ResizeTo(_nPar, 1);
89  setCovMatrix(theCovMatrix);
90 }

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

Referenced by TFitParticleEScaledMomDev().

◆ setIni4Vec()

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

Implements TAbsFitParticle.

Definition at line 115 of file TFitParticleEScaledMomDev.cc.

115  {
116  // Set the initial 4vector. Will also set the
117  // inital parameter values
118 
119  if (pini == nullptr) {
120  _u1.SetXYZ(0., 0., 0.);
121  _u3.SetXYZ(0., 0., 0.);
122  _u2.SetXYZ(0., 0., 0.);
123  _pini.SetXYZT(0., 0., 0., 0.);
124 
125  } else {
126  _pini = (*pini);
127  _pcurr = _pini;
128 
129  _u1 = pini->Vect();
130  _u1 *= 1. / _u1.Mag();
131 
132  TVector3 uz(0., 0., 1.);
133  _u3 = uz.Cross(_u1);
134  _u3 *= 1. / _u3.Mag();
135 
136  _u2 = _u3.Cross(_u1);
137  _u2 *= 1. / _u2.Mag();
138  }
139 
141 }

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

Referenced by init().

◆ transform()

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

Implements TAbsFitParticle.

Definition at line 171 of file TFitParticleEScaledMomDev.cc.

171  {
172  // Returns the parameters corresponding to the given
173  // 4vector wrt. to the current base vectors u_r, u_theta, and u_phi
174 
175  // construct rotation matrix
176  TRotation rot;
177  rot.RotateAxes(_u1, _u2, _u3);
178  rot.Invert();
179 
180  // rotate vector
181  TVector3 vec3(vec.Vect());
182  vec3.Transform(rot);
183 
184  // retrieve parameters
185  TMatrixD* tparams = new TMatrixD(_nPar, 1);
186  (*tparams)(0, 0) = vec3(0) / _pini.P();
187  (*tparams)(1, 0) = vec3(1);
188  (*tparams)(2, 0) = vec3(2);
189 
190  return tparams;
191 }

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

TAbsFitParticle::_iniparameters
TMatrixD _iniparameters
Definition: TAbsFitParticle.h:58
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
vec3
std::vector< vec2 > vec3
Definition: HCALResponse.h:17
X
#define X(str)
Definition: MuonsGrabber.cc:38
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
TAbsFitParticle::_u2
TVector3 _u2
Definition: TAbsFitParticle.h:51
TAbsFitParticle::_nPar
Int_t _nPar
Definition: TAbsFitParticle.h:49
TAbsFitParticle
Definition: TAbsFitParticle.h:9
TFitParticleEScaledMomDev::init
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
Definition: TFitParticleEScaledMomDev.cc:80
TAbsFitParticle::setCovMatrix
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
Definition: TAbsFitParticle.cc:98
TAbsFitParticle::TAbsFitParticle
TAbsFitParticle()
Definition: TAbsFitParticle.cc:18
TFitParticleEScaledMomDev::setIni4Vec
void setIni4Vec(const TLorentzVector *pini) override
Definition: TFitParticleEScaledMomDev.cc:115
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
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:31
TFitParticleEScaledMomDev::TFitParticleEScaledMomDev
TFitParticleEScaledMomDev()
Definition: TFitParticleEScaledMomDev.cc:32
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:32