CMS 3D CMS Logo

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

#include <TFitParticleMCMomDev.h>

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

Constructor & Destructor Documentation

TFitParticleMCMomDev::TFitParticleMCMomDev ( )

Definition at line 34 of file TFitParticleMCMomDev.cc.

References init().

Referenced by clone().

36 {
37  init( nullptr, 0., nullptr);
38 }
void init(TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
TFitParticleMCMomDev::TFitParticleMCMomDev ( const TFitParticleMCMomDev fitParticle)

Definition at line 40 of file TFitParticleMCMomDev.cc.

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

41  :TAbsFitParticle( fitParticle.GetName(), fitParticle.GetTitle() )
42 {
43 
44  _nPar = fitParticle._nPar;
45  _u1 = fitParticle._u1;
46  _u2 = fitParticle._u2;
47  _u3 = fitParticle._u3;
48  _covMatrix.ResizeTo( fitParticle._covMatrix );
49  _covMatrix = fitParticle._covMatrix;
50  _iniparameters.ResizeTo( fitParticle._iniparameters );
51  _iniparameters = fitParticle._iniparameters;
52  _parameters.ResizeTo( fitParticle._parameters );
53  _parameters = fitParticle._parameters;
54  _pini = fitParticle._pini;
55  _pcurr = fitParticle._pcurr;
56 
57 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TFitParticleMCMomDev::TFitParticleMCMomDev ( TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)

Definition at line 59 of file TFitParticleMCMomDev.cc.

References init().

61 {
62  init(p, M, theCovMatrix);
63 }
void init(TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
TFitParticleMCMomDev::TFitParticleMCMomDev ( const TString &  name,
const TString &  title,
TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)

Definition at line 65 of file TFitParticleMCMomDev.cc.

References init().

68 {
69  init(p, M, theCovMatrix);
70 }
void init(TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
TFitParticleMCMomDev::~TFitParticleMCMomDev ( )
override

Definition at line 84 of file TFitParticleMCMomDev.cc.

84  {
85 
86 }

Member Function Documentation

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

Implements TAbsFitParticle.

Definition at line 106 of file TFitParticleMCMomDev.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, TAbsFitParticle::_u3, X, DOFs::Y, and DOFs::Z.

106  {
107  // Calculates a 4vector corresponding to the given
108  // parameter values
109 
110  if (params == nullptr) {
111  return nullptr;
112  }
113 
114  if ( params->GetNcols() != 1 || params->GetNrows() !=_nPar ) {
115  edm::LogError ("WrongMatrixSize")
116  << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
117  return nullptr;
118  }
119 
120  Double_t X = _pini.P() * (*params)(0,0) *_u1.X()+
121  (*params)(1,0) * _u2.X()+
122  (*params)(2,0) * _u3.X() ;
123  Double_t Y = _pini.P() * (*params)(0,0) *_u1.Y()+
124  (*params)(1,0) * _u2.Y()+
125  (*params)(2,0) * _u3.Y() ;
126  Double_t Z = _pini.P() * (*params)(0,0) *_u1.Z()+
127  (*params)(1,0) * _u2.Z()+
128  (*params)(2,0) * _u3.Z() ;
129  Double_t E = TMath::Sqrt( X*X + Y*Y + Z*Z + _pini.M2() );
130 
131  TLorentzVector* vec = new TLorentzVector( X, Y, Z, E );
132  return vec;
133 
134 }
#define X(str)
Definition: MuonsGrabber.cc:48
TLorentzVector _pini
TAbsFitParticle * TFitParticleMCMomDev::clone ( const TString &  newname = TString("")) const
overridevirtual

Implements TAbsFitParticle.

Definition at line 72 of file TFitParticleMCMomDev.cc.

References TFitParticleMCMomDev().

72  {
73  // Returns a copy of itself
74 
75  TAbsFitParticle* myclone = new TFitParticleMCMomDev( *this );
76  if ( newname.Length() > 0 ) myclone->SetName(newname);
77  return myclone;
78 
79 }
TMatrixD * TFitParticleMCMomDev::getDerivative ( )
overridevirtual

Implements TAbsFitParticle.

Definition at line 175 of file TFitParticleMCMomDev.cc.

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

175  {
176  // returns derivative dP/dy with P=(p,E) and y=(r, theta, phi)
177  // the free parameters of the fit. The columns of the matrix contain
178  // (dP/dr, dP/dtheta, dP/dphi).
179 
180  TMatrixD* DerivativeMatrix = new TMatrixD(4,3);
181  (*DerivativeMatrix) *= 0.;
182  //1st column: dP/dr
183  (*DerivativeMatrix)(0,0)=_pini.P()*_u1.X();
184  (*DerivativeMatrix)(1,0)=_pini.P()*_u1.Y();
185  (*DerivativeMatrix)(2,0)=_pini.P()*_u1.Z();
186  (*DerivativeMatrix)(3,0)=_pini.P()*_pini.P()*_parameters(0,0)/_pcurr.E();
187 
188 // (*DerivativeMatrix)(3,0)=0.;
189 
190  //2nd column: dP/dtheta
191  (*DerivativeMatrix)(0,1)=_u2.X();
192  (*DerivativeMatrix)(1,1)=_u2.Y();
193  (*DerivativeMatrix)(2,1)=_u2.Z();
194  (*DerivativeMatrix)(3,1)=_parameters(1,0)/_pcurr.E();
195 
196  //(*DerivativeMatrix)(3,1)=0.;
197 
198  //3rd column: dP/dphi
199  (*DerivativeMatrix)(0,2)=_u3.X();
200  (*DerivativeMatrix)(1,2)=_u3.Y();
201  (*DerivativeMatrix)(2,2)=_u3.Z();
202  (*DerivativeMatrix)(3,2)=_parameters(2,0)/_pcurr.E();
203 
204  //(*DerivativeMatrix)(3,2)=0.;
205 
206  return DerivativeMatrix;
207 
208 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
void TFitParticleMCMomDev::init ( TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)
protected

Definition at line 92 of file TFitParticleMCMomDev.cc.

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

Referenced by TFitParticleMCMomDev().

92  {
93 
94  _nPar = 3;
95  setIni4Vec(p, M);
96  _iniparameters.ResizeTo(_nPar,1);
97  _iniparameters(0,0)=1.;
98  _iniparameters(1,0)=0.;
99  _iniparameters(2,0)=0.;
100  _parameters.ResizeTo(_nPar, 1);
102  setCovMatrix(theCovMatrix);
103 
104 }
TMatrixD _parameters
void setIni4Vec(const TLorentzVector *pini) override
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
TMatrixD _iniparameters
void TFitParticleMCMomDev::setIni4Vec ( const TLorentzVector *  pini)
overridevirtual

Implements TAbsFitParticle.

Definition at line 136 of file TFitParticleMCMomDev.cc.

Referenced by init().

136  {
137  // Set the initial 4vector. Will also set the
138  // inital parameter values
139 
140  TVector3 vec( pini->Vect() );
141  setIni4Vec( &vec, pini->M() );
142 
143 }
void setIni4Vec(const TLorentzVector *pini) override
void TFitParticleMCMomDev::setIni4Vec ( const TVector3 *  p,
Double_t  M 
)

Definition at line 145 of file TFitParticleMCMomDev.cc.

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

145  {
146  // Set the initial 4vector. Will also set the
147  // inital parameter values
148 
149  if ( p == nullptr ) {
150 
151  _pini.SetXYZM( 0., 0., 0., M);
152  _pcurr = _pini;
153 
154  } else {
155 
156  _pini.SetXYZM( p->x(), p->y(), p->z(), M);
157  _pcurr = _pini;
158 
159  _u1 = (*p);
160  _u1 *= 1./_u1.Mag();
161 
162  TVector3 uz(0., 0., 1.);
163  _u3 = uz.Cross(_u1);
164  _u3 *= 1./_u3.Mag();
165 
166  _u2 = _u3.Cross(_u1);
167  _u2 *= 1./_u2.Mag();
168 
169  }
170 
172 
173 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TMatrixD * TFitParticleMCMomDev::transform ( const TLorentzVector &  vec)
overridevirtual

Implements TAbsFitParticle.

Definition at line 210 of file TFitParticleMCMomDev.cc.

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

210  {
211  // Returns the parameters corresponding to the given
212  // 4vector wrt. to the current base vectors u_r, u_theta, and u_phi
213 
214  // construct rotation matrix
215  TRotation rot;
216  rot.RotateAxes( _u1, _u2, _u3 );
217  rot.Invert();
218 
219  // rotate vector
220  TVector3 vec3( vec.Vect() );
221  vec3.Transform( rot );
222 
223  // retrieve parameters
224  TMatrixD* tparams = new TMatrixD( _nPar, 1 );
225  (*tparams)(0,0) = vec3(0)/_pini.P();
226  (*tparams)(1,0) = vec3(1);
227  (*tparams)(2,0) = vec3(2);
228 
229  return tparams;
230 
231 }
TLorentzVector _pini
std::vector< vec2 > vec3
Definition: HCALResponse.h:17