test
CMS 3D CMS Logo

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

#include <TFitParticleMomDev.h>

Inheritance diagram for TFitParticleMomDev:
TAbsFitParticle

Public Member Functions

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

Constructor & Destructor Documentation

TFitParticleMomDev::TFitParticleMomDev ( )

Definition at line 34 of file TFitParticleMomDev.cc.

References init().

Referenced by clone().

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

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

Definition at line 59 of file TFitParticleMomDev.cc.

References init().

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

Definition at line 65 of file TFitParticleMomDev.cc.

References init().

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

Definition at line 84 of file TFitParticleMomDev.cc.

84  {
85 
86 }

Member Function Documentation

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

Implements TAbsFitParticle.

Definition at line 141 of file TFitParticleMomDev.cc.

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

141  {
142  // Calculates a 4vector corresponding to the given
143  // parameter values
144 
145  if (params == 0) {
146  return 0;
147  }
148 
149  if ( params->GetNcols() != 1 || params->GetNrows() !=_nPar ) {
150  edm::LogError ("WrongMatrixSize")
151  << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
152  return 0;
153  }
154 
155  Double_t X = _pini.P() * (*params)(0,0) *_u1.X() +
156  (*params)(1,0) * _u2.X()+
157  (*params)(2,0) * _u3.X();
158  Double_t Y = _pini.P() * (*params)(0,0) *_u1.Y() +
159  (*params)(1,0) * _u2.Y()+
160  (*params)(2,0) * _u3.Y();
161  Double_t Z = _pini.P() * (*params)(0,0) *_u1.Z() +
162  (*params)(1,0) * _u2.Z()+
163  (*params)(2,0) * _u3.Z();
164  Double_t E = TMath::Sqrt( X*X + Y*Y + Z*Z + (*params)(3,0)*(*params)(3,0)*_pini.M2() );
165 
166  TLorentzVector* vec = new TLorentzVector( X, Y, Z, E );
167  return vec;
168 
169 }
const double Z[kNumberCalorimeter]
#define X(str)
Definition: MuonsGrabber.cc:48
TLorentzVector _pini
TAbsFitParticle * TFitParticleMomDev::clone ( const TString &  newname = TString("")) const
virtual

Implements TAbsFitParticle.

Definition at line 72 of file TFitParticleMomDev.cc.

References TFitParticleMomDev().

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

Implements TAbsFitParticle.

Definition at line 171 of file TFitParticleMomDev.cc.

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

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

Definition at line 91 of file TFitParticleMomDev.cc.

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

Referenced by TFitParticleMomDev().

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

Implements TAbsFitParticle.

Definition at line 107 of file TFitParticleMomDev.cc.

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

Referenced by init().

107  {
108  // Set the initial 4vector. Will also set the
109  // inital parameter values
110 
111  if (pini == 0) {
112 
113  _u1.SetXYZ(0., 0., 0.);
114  _u3.SetXYZ(0., 0., 0.);
115  _u2.SetXYZ(0., 0., 0.);
116  _pini.SetXYZT(0., 0., 0., 0.);
117  _pcurr = _pini;
118 
119  } else {
120 
121  _pini = (*pini);
122  _pcurr = _pini;
123 
124  _u1 = pini->Vect();
125  _u1 *= 1./_u1.Mag();
126 
127  TVector3 uz(0., 0., 1.);
128  _u3 = uz.Cross(_u1);
129  _u3 *= 1./_u3.Mag();
130 
131  _u2 = _u3.Cross(_u1);
132  _u2 *= 1./_u2.Mag();
133 
134  }
135 
136  // reset parameters
138 
139 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TMatrixD * TFitParticleMomDev::transform ( const TLorentzVector &  vec)
virtual

Implements TAbsFitParticle.

Definition at line 206 of file TFitParticleMomDev.cc.

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

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