CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions
TFitParticleESpher Class Reference

#include <TFitParticleESpher.h>

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

Constructor & Destructor Documentation

TFitParticleESpher::TFitParticleESpher ( )

Definition at line 25 of file TFitParticleESpher.cc.

References init().

Referenced by clone().

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

Definition at line 27 of file TFitParticleESpher.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
TFitParticleESpher::TFitParticleESpher ( TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)

Definition at line 43 of file TFitParticleESpher.cc.

References init().

43  : TAbsFitParticle() {
44  init(pini, theCovMatrix);
45 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
TFitParticleESpher::TFitParticleESpher ( const TString &  name,
const TString &  title,
TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)

Definition at line 47 of file TFitParticleESpher.cc.

References init().

52  init(pini, theCovMatrix);
53 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
TFitParticleESpher::~TFitParticleESpher ( )
override

Definition at line 67 of file TFitParticleESpher.cc.

67 {}

Member Function Documentation

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

Implements TAbsFitParticle.

Definition at line 78 of file TFitParticleESpher.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, ztail::d, phi, alignCSCRings::r, theta(), X, BeamSpotPI::Y, and BeamSpotPI::Z.

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 r = (*params)(0, 0);
92  Double_t theta = (*params)(1, 0);
93  Double_t phi = (*params)(2, 0);
94  Double_t d = (*params)(3, 0);
95 
96  Double_t X = r * TMath::Cos(phi) * TMath::Sin(theta);
97  Double_t Y = r * TMath::Sin(phi) * TMath::Sin(theta);
98  Double_t Z = r * TMath::Cos(theta);
99  Double_t E = d * _pini.E();
100 
101  TLorentzVector* vec = new TLorentzVector(X, Y, Z, E);
102  return vec;
103 }
Geom::Theta< T > theta() const
#define X(str)
Definition: MuonsGrabber.cc:38
Log< level::Error, false > LogError
TLorentzVector _pini
tuple d
Definition: ztail.py:151
TAbsFitParticle * TFitParticleESpher::clone ( const TString &  newname = TString("")) const
overridevirtual

Implements TAbsFitParticle.

Definition at line 55 of file TFitParticleESpher.cc.

References TFitParticleESpher().

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

Implements TAbsFitParticle.

Definition at line 151 of file TFitParticleESpher.cc.

References TAbsFitParticle::_parameters, TAbsFitParticle::_pini, phi, alignCSCRings::r, and theta().

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

Definition at line 72 of file TFitParticleESpher.cc.

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

Referenced by TFitParticleESpher().

72  {
73  _nPar = 4;
74  setIni4Vec(pini);
75  setCovMatrix(theCovMatrix);
76 }
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
void setIni4Vec(const TLorentzVector *pini) override
void TFitParticleESpher::setIni4Vec ( const TLorentzVector *  pini)
overridevirtual

Implements TAbsFitParticle.

Definition at line 105 of file TFitParticleESpher.cc.

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

Referenced by init().

105  {
106  // Set the initial 4vector. Will also set the
107  // inital parameter values
108 
109  if (pini == nullptr) {
110  _u1.SetXYZ(0., 0., 0.);
111  _u3.SetXYZ(0., 0., 0.);
112  _u2.SetXYZ(0., 0., 0.);
113  _pini.SetXYZT(0., 0., 0., 0.);
114  _pcurr = _pini;
115 
116  _iniparameters.ResizeTo(_nPar, 1);
117  _iniparameters(0, 0) = 0.;
118  _iniparameters(1, 0) = 0.;
119  _iniparameters(2, 0) = 0.;
120  _iniparameters(3, 0) = 1.;
121 
122  _parameters.ResizeTo(_nPar, 1);
123  _parameters(0, 0) = 0.;
124  _parameters(1, 0) = 0.;
125  _parameters(2, 0) = 0.;
126  _parameters(3, 0) = 1.;
127 
128  } else {
129  Double_t r = pini->P();
130  Double_t theta = pini->Theta();
131  Double_t phi = pini->Phi();
132 
133  _pini = (*pini);
134  _pcurr = _pini;
135 
136  _iniparameters.ResizeTo(_nPar, 1);
137  _iniparameters(0, 0) = r;
138  _iniparameters(1, 0) = theta;
139  _iniparameters(2, 0) = phi;
140  _iniparameters(3, 0) = 1.;
141 
142  _parameters.ResizeTo(_nPar, 1);
144 
145  _u1.SetXYZ(TMath::Cos(phi) * TMath::Sin(theta), TMath::Sin(phi) * TMath::Sin(theta), TMath::Cos(theta));
146  _u2.SetXYZ(TMath::Cos(phi) * TMath::Cos(theta), TMath::Sin(phi) * TMath::Cos(theta), -1. * TMath::Sin(theta));
147  _u3.SetXYZ(-1. * TMath::Sin(phi), TMath::Cos(phi), 0.);
148  }
149 }
Geom::Theta< T > theta() const
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TMatrixD * TFitParticleESpher::transform ( const TLorentzVector &  vec)
overridevirtual

Implements TAbsFitParticle.

Definition at line 192 of file TFitParticleESpher.cc.

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

192  {
193  // Returns the parameters corresponding to the given
194  // 4vector
195 
196  // retrieve parameters
197  TMatrixD* tparams = new TMatrixD(_nPar, 1);
198  (*tparams)(0, 0) = vec.P();
199  (*tparams)(1, 0) = vec.Theta();
200  (*tparams)(2, 0) = vec.Phi();
201  (*tparams)(3, 0) = vec.E() / _pini.E();
202 
203  return tparams;
204 }
TLorentzVector _pini