CMS 3D CMS Logo

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

#include <TFitParticleEtEtaPhi.h>

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

Constructor & Destructor Documentation

TFitParticleEtEtaPhi::TFitParticleEtEtaPhi ( )

Definition at line 28 of file TFitParticleEtEtaPhi.cc.

References init().

Referenced by clone().

29  :TAbsFitParticle()
30 {
31  init(nullptr, nullptr);
32 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
TFitParticleEtEtaPhi::TFitParticleEtEtaPhi ( const TFitParticleEtEtaPhi fitParticle)

Definition at line 34 of file TFitParticleEtEtaPhi.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 {
37 
38  _nPar = fitParticle._nPar;
39  _u1 = fitParticle._u1;
40  _u2 = fitParticle._u2;
41  _u3 = fitParticle._u3;
42  _covMatrix.ResizeTo( fitParticle._covMatrix );
43  _covMatrix = fitParticle._covMatrix;
44  _iniparameters.ResizeTo( fitParticle._iniparameters );
45  _iniparameters = fitParticle._iniparameters;
46  _parameters.ResizeTo( fitParticle._parameters );
47  _parameters = fitParticle._parameters;
48  _pini = fitParticle._pini;
49  _pcurr = fitParticle._pcurr;
50 
51 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TFitParticleEtEtaPhi::TFitParticleEtEtaPhi ( TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)

Definition at line 53 of file TFitParticleEtEtaPhi.cc.

References init().

54  :TAbsFitParticle()
55 {
56  init(pini, theCovMatrix);
57 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
TFitParticleEtEtaPhi::TFitParticleEtEtaPhi ( const TString &  name,
const TString &  title,
TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)

Definition at line 59 of file TFitParticleEtEtaPhi.cc.

References init().

62 {
63  init(pini, theCovMatrix);
64 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
TFitParticleEtEtaPhi::~TFitParticleEtEtaPhi ( )
override

Definition at line 78 of file TFitParticleEtEtaPhi.cc.

78  {
79 
80 }

Member Function Documentation

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

Implements TAbsFitParticle.

Definition at line 93 of file TFitParticleEtEtaPhi.cc.

References TAbsFitParticle::_nPar, stringResolutionProvider_cfi::et, PVValHelper::eta, phi, X, DOFs::Y, and DOFs::Z.

93  {
94  // Calculates a 4vector corresponding to the given
95  // parameter values
96 
97  if (params == nullptr) {
98  return nullptr;
99  }
100 
101  if ( params->GetNcols() != 1 || params->GetNrows() !=_nPar ) {
102  edm::LogError ("WrongMatrixSize")
103  << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
104  return nullptr;
105  }
106 
107  Double_t et = (*params)(0,0);
108  Double_t eta = (*params)(1,0);
109  Double_t phi = (*params)(2,0);
110 
111  Double_t X = et*TMath::Cos(phi);
112  Double_t Y = et*TMath::Sin(phi);
113  Double_t Z = et*TMath::SinH(eta);
114  Double_t E = et*TMath::CosH(eta);
115 
116  TLorentzVector* vec = new TLorentzVector( X, Y, Z, E );
117  return vec;
118 
119 }
#define X(str)
Definition: MuonsGrabber.cc:48
et
define resolution functions of each parameter
TAbsFitParticle * TFitParticleEtEtaPhi::clone ( const TString &  newname = "") const
overridevirtual

Implements TAbsFitParticle.

Definition at line 66 of file TFitParticleEtEtaPhi.cc.

References TFitParticleEtEtaPhi().

66  {
67  // Returns a copy of itself
68 
69  TAbsFitParticle* myclone = new TFitParticleEtEtaPhi( *this );
70  if ( newname.Length() > 0 ) myclone->SetName(newname);
71  return myclone;
72 
73 }
TMatrixD * TFitParticleEtEtaPhi::getDerivative ( )
overridevirtual

Implements TAbsFitParticle.

Definition at line 168 of file TFitParticleEtEtaPhi.cc.

References TAbsFitParticle::_parameters, stringResolutionProvider_cfi::et, PVValHelper::eta, and phi.

168  {
169  // returns derivative dP/dy with P=(p,E) and y=(et, eta, phi)
170  // the free parameters of the fit. The columns of the matrix contain
171  // (dP/d(et), dP/d(eta), dP/d(phi)).
172 
173  TMatrixD* DerivativeMatrix = new TMatrixD(4,3);
174  (*DerivativeMatrix) *= 0.;
175 
176  Double_t et = _parameters(0,0);
177  Double_t eta = _parameters(1,0);
178  Double_t phi = _parameters(2,0);
179 
180  //1st column: dP/d(et)
181  (*DerivativeMatrix)(0,0) = TMath::Cos(phi);
182  (*DerivativeMatrix)(1,0) = TMath::Sin(phi);
183  (*DerivativeMatrix)(2,0) = TMath::SinH(eta);
184  (*DerivativeMatrix)(3,0) = TMath::CosH(eta);
185 
186  //2nd column: dP/d(eta)
187  (*DerivativeMatrix)(0,1) = 0.;
188  (*DerivativeMatrix)(1,1) = 0.;
189  (*DerivativeMatrix)(2,1) = et*TMath::CosH(eta);
190  (*DerivativeMatrix)(3,1) = et*TMath::SinH(eta);
191 
192  //3rd column: dP/d(phi)
193  (*DerivativeMatrix)(0,2) = -1.*et*TMath::Sin(phi);
194  (*DerivativeMatrix)(1,2) = et*TMath::Cos(phi);
195  (*DerivativeMatrix)(2,2) = 0.;
196  (*DerivativeMatrix)(3,2) = 0.;
197 
198  return DerivativeMatrix;
199 
200 }
TMatrixD _parameters
et
define resolution functions of each parameter
void TFitParticleEtEtaPhi::init ( TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)
protected

Definition at line 85 of file TFitParticleEtEtaPhi.cc.

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

Referenced by TFitParticleEtEtaPhi().

85  {
86 
87  _nPar = 3;
88  setIni4Vec(pini);
89  setCovMatrix(theCovMatrix);
90 
91 }
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
void setIni4Vec(const TLorentzVector *pini) override
void TFitParticleEtEtaPhi::setIni4Vec ( const TLorentzVector *  pini)
overridevirtual

Implements TAbsFitParticle.

Definition at line 121 of file TFitParticleEtEtaPhi.cc.

References TAbsFitParticle::_iniparameters, TAbsFitParticle::_nPar, TAbsFitParticle::_parameters, TAbsFitParticle::_pcurr, TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, TAbsFitParticle::_u3, stringResolutionProvider_cfi::et, PVValHelper::eta, phi, and funct::sin().

Referenced by init().

121  {
122  // Set the initial 4vector. Will also set the
123  // inital parameter values
124 
125  if (pini == nullptr) {
126 
127  _u1.SetXYZ(0., 0., 0.);
128  _u3.SetXYZ(0., 0., 0.);
129  _u2.SetXYZ(0., 0., 0.);
130  _pini.SetXYZT(0., 0., 0., 0.);
131  _pcurr = _pini;
132 
133  _iniparameters.ResizeTo(_nPar,1);
134  _iniparameters(0,0) = 0.;
135  _iniparameters(1,0) = 0.;
136  _iniparameters(2,0) = 0.;
137 
138  _parameters.ResizeTo(_nPar,1);
139  _parameters(0,0) = 0.;
140  _parameters(1,0) = 0.;
141  _parameters(2,0) = 0.;
142 
143  } else {
144 
145  Double_t et = pini->E()*std::fabs(sin(pini->Theta()));
146  Double_t eta = pini->Eta();
147  Double_t phi = pini->Phi();
148 
149  _pini = (*pini);
150  _pcurr = _pini;
151 
152  _iniparameters.ResizeTo(_nPar,1);
153  _iniparameters(0,0) = et;
154  _iniparameters(1,0) = eta;
155  _iniparameters(2,0) = phi;
156 
157  _parameters.ResizeTo(_nPar,1);
159 
160  _u1.SetXYZ( TMath::Cos(phi), TMath::Sin(phi), 0.); // the base vector of Et
161  _u2.SetXYZ( -1.*TMath::Cos(phi)*TMath::TanH(eta), -1.*TMath::Sin(phi)*TMath::TanH(eta), 1./TMath::CosH(eta) );// the base vector of Eta ( same as the base vector for Theta)
162  _u3.SetXYZ( -1.*TMath::Sin(phi), TMath::Cos(phi), 0. );// the base vector of Phi
163 
164  }
165 
166 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
et
define resolution functions of each parameter
TMatrixD _iniparameters
TMatrixD * TFitParticleEtEtaPhi::transform ( const TLorentzVector &  vec)
overridevirtual

Implements TAbsFitParticle.

Definition at line 202 of file TFitParticleEtEtaPhi.cc.

References TAbsFitParticle::_nPar, and funct::sin().

202  {
203  // Returns the parameters corresponding to the given
204  // 4vector
205 
206  // retrieve parameters
207  TMatrixD* tparams = new TMatrixD( _nPar, 1 );
208  (*tparams)(0,0) = vec.E()*std::fabs(sin(vec.Theta()));
209  (*tparams)(1,0) = vec.Eta();
210  (*tparams)(2,0) = vec.Phi();
211 
212  return tparams;
213 
214 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22