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
TFitParticleSpher Class Reference

#include <TFitParticleSpher.h>

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

Constructor & Destructor Documentation

TFitParticleSpher::TFitParticleSpher ( )

Definition at line 27 of file TFitParticleSpher.cc.

References init().

Referenced by clone().

28  :TAbsFitParticle()
29 {
30  init(0, 0);
31 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
TFitParticleSpher::TFitParticleSpher ( const TFitParticleSpher fitParticle)

Definition at line 33 of file TFitParticleSpher.cc.

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

34  :TAbsFitParticle( fitParticle.GetName(), fitParticle.GetTitle() )
35 {
36 
37  _nPar = fitParticle._nPar;
38  _u1 = fitParticle._u1;
39  _u2 = fitParticle._u2;
40  _u3 = fitParticle._u3;
41  _covMatrix.ResizeTo( fitParticle._covMatrix );
42  _covMatrix = fitParticle._covMatrix;
43  _iniparameters.ResizeTo( fitParticle._iniparameters );
44  _iniparameters = fitParticle._iniparameters;
45  _parameters.ResizeTo( fitParticle._parameters );
46  _parameters = fitParticle._parameters;
47  _pini = fitParticle._pini;
48  _pcurr = fitParticle._pcurr;
49 
50 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TFitParticleSpher::TFitParticleSpher ( TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)

Definition at line 52 of file TFitParticleSpher.cc.

References init().

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

Definition at line 58 of file TFitParticleSpher.cc.

References init().

61 {
62  init(pini, theCovMatrix);
63 }
void init(TLorentzVector *pini, const TMatrixD *theCovMatrix)
TFitParticleSpher::~TFitParticleSpher ( )
virtual

Definition at line 77 of file TFitParticleSpher.cc.

77  {
78 
79 }

Member Function Documentation

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

Implements TAbsFitParticle.

Definition at line 92 of file TFitParticleSpher.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, ztail::d, phi, alignCSCRings::r, theta(), X, and Gflash::Z.

92  {
93  // Calculates a 4vector corresponding to the given
94  // parameter values
95 
96  if (params == 0) {
97  return 0;
98  }
99 
100  if ( params->GetNcols() != 1 || params->GetNrows() !=_nPar ) {
101  edm::LogError ("WrongMatrixSize")
102  << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
103  return 0;
104  }
105 
106  Double_t r = (*params)(0,0);
107  Double_t theta = (*params)(1,0);
108  Double_t phi = (*params)(2,0);
109  Double_t d = (*params)(3,0);
110 
111  Double_t X = r*TMath::Cos(phi)*TMath::Sin(theta);
112  Double_t Y = r*TMath::Sin(phi)*TMath::Sin(theta);
113  Double_t Z = r*TMath::Cos(theta);
114  Double_t E = TMath::Sqrt( X*X + Y*Y + Z*Z + d*d*_pini.M2() );
115 
116  TLorentzVector* vec = new TLorentzVector( X, Y, Z, E );
117  return vec;
118 
119 }
const double Z[kNumberCalorimeter]
Geom::Theta< T > theta() const
#define X(str)
Definition: MuonsGrabber.cc:48
TLorentzVector _pini
tuple d
Definition: ztail.py:151
TAbsFitParticle * TFitParticleSpher::clone ( const TString &  newname = TString("")) const
virtual

Implements TAbsFitParticle.

Definition at line 65 of file TFitParticleSpher.cc.

References TFitParticleSpher().

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

Implements TAbsFitParticle.

Definition at line 171 of file TFitParticleSpher.cc.

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

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, ...).
175 
176  TMatrixD* DerivativeMatrix = new TMatrixD(4,4);
177  (*DerivativeMatrix) *= 0.;
178 
179  Double_t r = _parameters(0,0);
180  Double_t theta = _parameters(1,0);
181  Double_t phi = _parameters(2,0);
182  Double_t d = _parameters(3,0);
183 
184  //1st column: dP/dr
185  (*DerivativeMatrix)(0,0) = TMath::Cos(phi)*TMath::Sin(theta);
186  (*DerivativeMatrix)(1,0) = TMath::Sin(phi)*TMath::Sin(theta);
187  (*DerivativeMatrix)(2,0) = TMath::Cos(theta);
188  (*DerivativeMatrix)(3,0) = 0.;
189 
190  //2nd column: dP/dtheta
191  (*DerivativeMatrix)(0,1) = r*TMath::Cos(phi)*TMath::Cos(theta);
192  (*DerivativeMatrix)(1,1) = r*TMath::Sin(phi)*TMath::Cos(theta);
193  (*DerivativeMatrix)(2,1) = -1.*r*TMath::Sin(theta);
194  (*DerivativeMatrix)(3,1) = 0.;
195 
196  //3rd column: dP/dphi
197  (*DerivativeMatrix)(0,2) = -1.*r*TMath::Sin(phi)*TMath::Sin(theta);
198  (*DerivativeMatrix)(1,2) = r*TMath::Cos(phi)*TMath::Sin(theta);;
199  (*DerivativeMatrix)(2,2) = 0.;
200  (*DerivativeMatrix)(3,2) = 0.;
201 
202  //4th column: dP/dm
203  (*DerivativeMatrix)(0,3) = 0.;
204  (*DerivativeMatrix)(1,3) = 0.;
205  (*DerivativeMatrix)(2,3) = 0.;
206  (*DerivativeMatrix)(3,3) = _pini.M()*_pini.M()*d/_pcurr.E();
207 
208  return DerivativeMatrix;
209 
210 }
Geom::Theta< T > theta() const
TLorentzVector _pini
tuple d
Definition: ztail.py:151
TMatrixD _parameters
TLorentzVector _pcurr
void TFitParticleSpher::init ( TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)
protected

Definition at line 84 of file TFitParticleSpher.cc.

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

Referenced by TFitParticleSpher().

84  {
85 
86  _nPar = 4;
87  setIni4Vec(pini);
88  setCovMatrix(theCovMatrix);
89 
90 }
virtual void setIni4Vec(const TLorentzVector *pini)
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
void TFitParticleSpher::setIni4Vec ( const TLorentzVector *  pini)
virtual

Implements TAbsFitParticle.

Definition at line 121 of file TFitParticleSpher.cc.

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

121  {
122  // Set the initial 4vector. Will also set the
123  // inital parameter values
124 
125  if (pini == 0) {
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  _iniparameters(3,0) = 1.;
138 
139  _parameters.ResizeTo(_nPar,1);
140  _parameters(0,0) = 0.;
141  _parameters(1,0) = 0.;
142  _parameters(2,0) = 0.;
143  _parameters(3,0) = 1.;
144 
145  } else {
146 
147  Double_t r = pini->P();
148  Double_t theta = pini->Theta();
149  Double_t phi = pini->Phi();
150 
151  _pini = (*pini);
152  _pcurr = _pini;
153 
154  _iniparameters.ResizeTo(_nPar,1);
155  _iniparameters(0,0) = r;
156  _iniparameters(1,0) = theta;
157  _iniparameters(2,0) = phi;
158  _iniparameters(3,0) = 1.;
159 
160  _parameters.ResizeTo(_nPar,1);
162 
163  _u1.SetXYZ( TMath::Cos(phi)*TMath::Sin(theta), TMath::Sin(phi)*TMath::Sin(theta), TMath::Cos(theta) );
164  _u2.SetXYZ( TMath::Cos(phi)*TMath::Cos(theta), TMath::Sin(phi)*TMath::Cos(theta), -1.*TMath::Sin(theta) );
165  _u3.SetXYZ( -1.*TMath::Sin(phi), TMath::Cos(phi), 0. );
166 
167  }
168 
169 }
Geom::Theta< T > theta() const
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TMatrixD * TFitParticleSpher::transform ( const TLorentzVector &  vec)
virtual

Implements TAbsFitParticle.

Definition at line 212 of file TFitParticleSpher.cc.

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

212  {
213  // Returns the parameters corresponding to the given
214  // 4vector
215 
216  // retrieve parameters
217  TMatrixD* tparams = new TMatrixD( _nPar, 1 );
218  (*tparams)(0,0) = vec.P();
219  (*tparams)(1,0) = vec.Theta();
220  (*tparams)(2,0) = vec.Phi();
221  (*tparams)(3,0) = vec.M()/_pini.M();
222 
223  return tparams;
224 
225 }
TLorentzVector _pini