CMS 3D CMS Logo

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 (const TString &name, const TString &title, TLorentzVector *pini, const TMatrixD *theCovMatrix)
 
 TFitParticleESpher (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() [1/4]

TFitParticleESpher::TFitParticleESpher ( )

Definition at line 25 of file TFitParticleESpher.cc.

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

References init().

Referenced by clone().

◆ TFitParticleESpher() [2/4]

TFitParticleESpher::TFitParticleESpher ( const TFitParticleESpher fitParticle)

Definition at line 27 of file TFitParticleESpher.cc.

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 }

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

◆ TFitParticleESpher() [3/4]

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

Definition at line 43 of file TFitParticleESpher.cc.

43  : TAbsFitParticle() {
44  init(pini, theCovMatrix);
45 }

References init().

◆ TFitParticleESpher() [4/4]

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

Definition at line 47 of file TFitParticleESpher.cc.

52  init(pini, theCovMatrix);
53 }

References init().

◆ ~TFitParticleESpher()

TFitParticleESpher::~TFitParticleESpher ( )
override

Definition at line 67 of file TFitParticleESpher.cc.

67 {}

Member Function Documentation

◆ calc4Vec()

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

Implements TAbsFitParticle.

Definition at line 78 of file TFitParticleESpher.cc.

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 }

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

◆ clone()

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

Implements TAbsFitParticle.

Definition at line 55 of file TFitParticleESpher.cc.

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 }

References TFitParticleESpher().

◆ getDerivative()

TMatrixD * TFitParticleESpher::getDerivative ( )
overridevirtual

Implements TAbsFitParticle.

Definition at line 151 of file TFitParticleESpher.cc.

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 }

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

◆ init()

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

Definition at line 72 of file TFitParticleESpher.cc.

72  {
73  _nPar = 4;
74  setIni4Vec(pini);
75  setCovMatrix(theCovMatrix);
76 }

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

Referenced by TFitParticleESpher().

◆ setIni4Vec()

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

Implements TAbsFitParticle.

Definition at line 105 of file TFitParticleESpher.cc.

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 }

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().

◆ transform()

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

Implements TAbsFitParticle.

Definition at line 192 of file TFitParticleESpher.cc.

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 }

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

TAbsFitParticle::_iniparameters
TMatrixD _iniparameters
Definition: TAbsFitParticle.h:58
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
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
TFitParticleESpher::setIni4Vec
void setIni4Vec(const TLorentzVector *pini) override
Definition: TFitParticleESpher.cc:105
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
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
TAbsFitParticle
Definition: TAbsFitParticle.h:9
TAbsFitParticle::setCovMatrix
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
Definition: TAbsFitParticle.cc:98
TAbsFitParticle::TAbsFitParticle
TAbsFitParticle()
Definition: TAbsFitParticle.cc:18
TAbsFitParticle::_u3
TVector3 _u3
Definition: TAbsFitParticle.h:52
TFitParticleESpher::init
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
Definition: TFitParticleESpher.cc:72
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
TAbsFitParticle::_u1
TVector3 _u1
Definition: TAbsFitParticle.h:50
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:31
ztail.d
d
Definition: ztail.py:151
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:32
TFitParticleESpher::TFitParticleESpher
TFitParticleESpher()
Definition: TFitParticleESpher.cc:25