CMS 3D CMS Logo

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

#include <TFitParticleEScaledMomDev.h>

Inheritance diagram for TFitParticleEScaledMomDev:
TAbsFitParticle

Public Member Functions

virtual TLorentzVector * calc4Vec (const TMatrixD *params)
 
virtual TAbsFitParticleclone (const TString &newname="") const
 
virtual TMatrixD * getDerivative ()
 
virtual void setIni4Vec (const TLorentzVector *pini)
 
 TFitParticleEScaledMomDev ()
 
 TFitParticleEScaledMomDev (const TFitParticleEScaledMomDev &fitParticle)
 
 TFitParticleEScaledMomDev (TLorentzVector *pini, const TMatrixD *theCovMatrix)
 
 TFitParticleEScaledMomDev (const TString &name, const TString &title, TLorentzVector *pini, const TMatrixD *theCovMatrix)
 
virtual TMatrixD * transform (const TLorentzVector &vec)
 
virtual ~TFitParticleEScaledMomDev ()
 
- 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)
 
virtual ~TAbsFitParticle ()
 

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 9 of file TFitParticleEScaledMomDev.h.

Constructor & Destructor Documentation

TFitParticleEScaledMomDev::TFitParticleEScaledMomDev ( )

Definition at line 34 of file TFitParticleEScaledMomDev.cc.

References init().

Referenced by clone().

36 {
37  init(0, 0);
38 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
TFitParticleEScaledMomDev::TFitParticleEScaledMomDev ( const TFitParticleEScaledMomDev fitParticle)

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

Definition at line 59 of file TFitParticleEScaledMomDev.cc.

References init().

61 {
62  init(pini, theCovMatrix);
63 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
TFitParticleEScaledMomDev::TFitParticleEScaledMomDev ( const TString &  name,
const TString &  title,
TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)

Definition at line 65 of file TFitParticleEScaledMomDev.cc.

References init().

68 {
69  init(pini, theCovMatrix);
70 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
TFitParticleEScaledMomDev::~TFitParticleEScaledMomDev ( )
virtual

Definition at line 84 of file TFitParticleEScaledMomDev.cc.

84  {
85 
86 }

Member Function Documentation

TLorentzVector * TFitParticleEScaledMomDev::calc4Vec ( const TMatrixD *  params)
virtual

Implements TAbsFitParticle.

Definition at line 105 of file TFitParticleEScaledMomDev.cc.

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

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

Implements TAbsFitParticle.

Definition at line 72 of file TFitParticleEScaledMomDev.cc.

References TFitParticleEScaledMomDev().

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

Implements TAbsFitParticle.

Definition at line 167 of file TFitParticleEScaledMomDev.cc.

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

167  {
168  // returns derivative dP/dy with P=(p,E) and y=(r, theta, phi)
169  // the free parameters of the fit. The columns of the matrix contain
170  // (dP/dr, dP/dtheta, dP/dphi).
171 
172  TMatrixD* DerivativeMatrix = new TMatrixD(4,3);
173  (*DerivativeMatrix) *= 0.;
174 
175  //1st column: dP/dr
176  (*DerivativeMatrix)(0,0)=_pini.P()*_u1.X();
177  (*DerivativeMatrix)(1,0)=_pini.P()*_u1.Y();
178  (*DerivativeMatrix)(2,0)=_pini.P()*_u1.Z();
179  (*DerivativeMatrix)(3,0)=_pini.P()*_pini.E()*_parameters(0,0)/_pcurr.P();
180  //2nd column: dP/dtheta
181  (*DerivativeMatrix)(0,1)=_u2.X();
182  (*DerivativeMatrix)(1,1)=_u2.Y();
183  (*DerivativeMatrix)(2,1)=_u2.Z();
184  (*DerivativeMatrix)(3,1)=_pini.E()/_pini.P()/_pcurr.P()*_parameters(1,0);
185  //3rd column: dP/dphi
186  (*DerivativeMatrix)(0,2)=_u3.X();
187  (*DerivativeMatrix)(1,2)=_u3.Y();
188  (*DerivativeMatrix)(2,2)=_u3.Z();;
189  (*DerivativeMatrix)(3,2)=_pini.E()/_pini.P()/_pcurr.P()*_parameters(2,0);
190 
191  return DerivativeMatrix;
192 
193 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
void TFitParticleEScaledMomDev::init ( TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)
protected

Definition at line 91 of file TFitParticleEScaledMomDev.cc.

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

Referenced by TFitParticleEScaledMomDev().

91  {
92 
93  _nPar = 3;
94  setIni4Vec(pini);
95  _iniparameters.ResizeTo(_nPar,1);
96  _iniparameters(0,0)=1.;
97  _iniparameters(1,0)=0.;
98  _iniparameters(2,0)=0.;
99  _parameters.ResizeTo(_nPar,1);
101  setCovMatrix(theCovMatrix);
102 
103 }
TMatrixD _parameters
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
virtual void setIni4Vec(const TLorentzVector *pini)
TMatrixD _iniparameters
void TFitParticleEScaledMomDev::setIni4Vec ( const TLorentzVector *  pini)
virtual

Implements TAbsFitParticle.

Definition at line 136 of file TFitParticleEScaledMomDev.cc.

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

Referenced by init().

136  {
137  // Set the initial 4vector. Will also set the
138  // inital parameter values
139 
140  if (pini == 0) {
141 
142  _u1.SetXYZ(0., 0., 0.);
143  _u3.SetXYZ(0., 0., 0.);
144  _u2.SetXYZ(0., 0., 0.);
145  _pini.SetXYZT(0., 0., 0., 0.);
146 
147  } else {
148 
149  _pini = (*pini);
150  _pcurr = _pini;
151 
152  _u1 = pini->Vect();
153  _u1 *= 1./_u1.Mag();
154 
155  TVector3 uz(0., 0., 1.);
156  _u3 = uz.Cross(_u1);
157  _u3 *= 1./_u3.Mag();
158 
159  _u2 = _u3.Cross(_u1);
160  _u2 *= 1./_u2.Mag();
161  }
162 
164 
165 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TMatrixD * TFitParticleEScaledMomDev::transform ( const TLorentzVector &  vec)
virtual

Implements TAbsFitParticle.

Definition at line 195 of file TFitParticleEScaledMomDev.cc.

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

195  {
196  // Returns the parameters corresponding to the given
197  // 4vector wrt. to the current base vectors u_r, u_theta, and u_phi
198 
199  // construct rotation matrix
200  TRotation rot;
201  rot.RotateAxes( _u1, _u2, _u3 );
202  rot.Invert();
203 
204  // rotate vector
205  TVector3 vec3( vec.Vect() );
206  vec3.Transform( rot );
207 
208  // retrieve parameters
209  TMatrixD* tparams = new TMatrixD( _nPar, 1 );
210  (*tparams)(0,0) = vec3(0)/_pini.P();
211  (*tparams)(1,0) = vec3(1);
212  (*tparams)(2,0) = vec3(2);
213 
214  return tparams;
215 
216 }
TLorentzVector _pini
std::vector< vec2 > vec3
Definition: HCALResponse.h:17