CMS 3D CMS Logo

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

#include <TFitParticleMCPInvSpher.h>

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

Constructor & Destructor Documentation

◆ TFitParticleMCPInvSpher() [1/4]

TFitParticleMCPInvSpher::TFitParticleMCPInvSpher ( )

Definition at line 25 of file TFitParticleMCPInvSpher.cc.

References init().

Referenced by clone().

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

◆ TFitParticleMCPInvSpher() [2/4]

TFitParticleMCPInvSpher::TFitParticleMCPInvSpher ( const TFitParticleMCPInvSpher fitParticle)

Definition at line 27 of file TFitParticleMCPInvSpher.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

◆ TFitParticleMCPInvSpher() [3/4]

TFitParticleMCPInvSpher::TFitParticleMCPInvSpher ( TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)

Definition at line 43 of file TFitParticleMCPInvSpher.cc.

References init(), and AlCaHLTBitMon_ParallelJobs::p.

44  : TAbsFitParticle() {
45  init(p, M, theCovMatrix);
46 }
void init(TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)

◆ TFitParticleMCPInvSpher() [4/4]

TFitParticleMCPInvSpher::TFitParticleMCPInvSpher ( const TString &  name,
const TString &  title,
TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)

Definition at line 48 of file TFitParticleMCPInvSpher.cc.

References init(), and AlCaHLTBitMon_ParallelJobs::p.

51  init(p, M, theCovMatrix);
52 }
void init(TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)

◆ ~TFitParticleMCPInvSpher()

TFitParticleMCPInvSpher::~TFitParticleMCPInvSpher ( )
override

Definition at line 66 of file TFitParticleMCPInvSpher.cc.

66 {}

Member Function Documentation

◆ calc4Vec()

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

Implements TAbsFitParticle.

Definition at line 77 of file TFitParticleMCPInvSpher.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, submitPVValidationJobs::params, phi, alignCSCRings::r, theta(), X, beamSpotPI::Y, and beamSpotPI::Z.

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

◆ clone()

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

Implements TAbsFitParticle.

Definition at line 54 of file TFitParticleMCPInvSpher.cc.

References TFitParticleMCPInvSpher().

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

◆ getDerivative()

TMatrixD * TFitParticleMCPInvSpher::getDerivative ( )
overridevirtual

Implements TAbsFitParticle.

Definition at line 148 of file TFitParticleMCPInvSpher.cc.

References TAbsFitParticle::_parameters, TAbsFitParticle::_pcurr, AlCaHLTBitMon_ParallelJobs::p, phi, alignCSCRings::r, and theta().

148  {
149  // returns derivative dP/dy with P=(p,E) and y=(r, theta, phi)
150  // the free parameters of the fit. The columns of the matrix contain
151  // (dP/dr, dP/dtheta, ...).
152 
153  TMatrixD* DerivativeMatrix = new TMatrixD(4, 3);
154  (*DerivativeMatrix) *= 0.;
155 
156  Double_t r = _parameters(0, 0);
157  Double_t p = 1. / r;
158  Double_t theta = _parameters(1, 0);
159  Double_t phi = _parameters(2, 0);
160 
161  //1st column: dP/dr
162  (*DerivativeMatrix)(0, 0) = -1. * p * p * TMath::Cos(phi) * TMath::Sin(theta);
163  (*DerivativeMatrix)(1, 0) = -1. * p * p * TMath::Sin(phi) * TMath::Sin(theta);
164  (*DerivativeMatrix)(2, 0) = -1. * p * p * TMath::Cos(theta);
165  (*DerivativeMatrix)(3, 0) = -1. * p * p * p / _pcurr.E();
166 
167  //2nd column: dP/dtheta
168  (*DerivativeMatrix)(0, 1) = p * TMath::Cos(phi) * TMath::Cos(theta);
169  (*DerivativeMatrix)(1, 1) = p * TMath::Sin(phi) * TMath::Cos(theta);
170  (*DerivativeMatrix)(2, 1) = -1. * p * TMath::Sin(theta);
171  (*DerivativeMatrix)(3, 1) = 0.;
172 
173  //3rd column: dP/dphi
174  (*DerivativeMatrix)(0, 2) = -1. * p * TMath::Sin(phi) * TMath::Sin(theta);
175  (*DerivativeMatrix)(1, 2) = p * TMath::Cos(phi) * TMath::Sin(theta);
176  ;
177  (*DerivativeMatrix)(2, 2) = 0.;
178  (*DerivativeMatrix)(3, 2) = 0.;
179 
180  return DerivativeMatrix;
181 }
TMatrixD _parameters
TLorentzVector _pcurr
Geom::Theta< T > theta() const

◆ init()

void TFitParticleMCPInvSpher::init ( TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)
protected

Definition at line 71 of file TFitParticleMCPInvSpher.cc.

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

Referenced by TFitParticleMCPInvSpher().

71  {
72  _nPar = 3;
73  setIni4Vec(p, M);
74  setCovMatrix(theCovMatrix);
75 }
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
void setIni4Vec(const TLorentzVector *pini) override

◆ setIni4Vec() [1/2]

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

Implements TAbsFitParticle.

Definition at line 103 of file TFitParticleMCPInvSpher.cc.

Referenced by init().

103  {
104  // Set the initial 4vector. Will also set the
105  // inital parameter values
106 
107  TVector3 vec(pini->Vect());
108  setIni4Vec(&vec, pini->M());
109 }
void setIni4Vec(const TLorentzVector *pini) override

◆ setIni4Vec() [2/2]

void TFitParticleMCPInvSpher::setIni4Vec ( const TVector3 *  p,
Double_t  M 
)

Definition at line 111 of file TFitParticleMCPInvSpher.cc.

References TAbsFitParticle::_iniparameters, TAbsFitParticle::_nPar, TAbsFitParticle::_parameters, TAbsFitParticle::_pcurr, TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, TAbsFitParticle::_u3, AlCaHLTBitMon_ParallelJobs::p, phi, alignCSCRings::r, and theta().

111  {
112  // Set the initial 4vector. Will also set the
113  // inital parameter values
114 
115  if (p == nullptr) {
116  _u1.SetXYZ(0., 0., 0.);
117  _u3.SetXYZ(0., 0., 0.);
118  _u2.SetXYZ(0., 0., 0.);
119  _pini.SetXYZM(0., 0., 0., M);
120  _pcurr = _pini;
121 
122  _iniparameters.ResizeTo(_nPar, 1);
123  _iniparameters(0, 0) = 0.;
124  _parameters.ResizeTo(_nPar, 1);
126 
127  } else {
128  _pini.SetXYZM(p->x(), p->y(), p->z(), M);
129  _pcurr = _pini;
130 
131  Double_t r = 1 / _pini.P();
132  Double_t theta = _pini.Theta();
133  Double_t phi = _pini.Phi();
134 
135  _iniparameters.ResizeTo(_nPar, 1);
136  _iniparameters(0, 0) = r;
137  _iniparameters(1, 0) = theta;
138  _iniparameters(2, 0) = phi;
139  _parameters.ResizeTo(_nPar, 1);
141 
142  _u1.SetXYZ(TMath::Cos(phi) * TMath::Sin(theta), TMath::Sin(phi) * TMath::Sin(theta), TMath::Cos(theta));
143  _u2.SetXYZ(TMath::Cos(phi) * TMath::Cos(theta), TMath::Sin(phi) * TMath::Cos(theta), -1. * TMath::Sin(theta));
144  _u3.SetXYZ(-1. * TMath::Sin(phi), TMath::Cos(phi), 0.);
145  }
146 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
Geom::Theta< T > theta() const

◆ transform()

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

Implements TAbsFitParticle.

Definition at line 183 of file TFitParticleMCPInvSpher.cc.

References TAbsFitParticle::_nPar.

183  {
184  // Returns the parameters corresponding to the given
185  // 4vector
186 
187  // retrieve parameters
188  TMatrixD* tparams = new TMatrixD(_nPar, 1);
189  (*tparams)(0, 0) = 1. / vec.P();
190  (*tparams)(1, 0) = vec.Theta();
191  (*tparams)(2, 0) = vec.Phi();
192 
193  return tparams;
194 }