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

#include <TFitParticleMCSpher.h>

Inheritance diagram for TFitParticleMCSpher:
TAbsFitParticle

Public Member Functions

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

Constructor & Destructor Documentation

TFitParticleMCSpher::TFitParticleMCSpher ( )

Definition at line 27 of file TFitParticleMCSpher.cc.

References init().

Referenced by clone().

29 {
30  init( 0, 0., 0);
31 }
void init(TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
TFitParticleMCSpher::TFitParticleMCSpher ( const TFitParticleMCSpher fitParticle)

Definition at line 33 of file TFitParticleMCSpher.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
TFitParticleMCSpher::TFitParticleMCSpher ( TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)

Definition at line 52 of file TFitParticleMCSpher.cc.

References init().

54 {
55  init(p, M, theCovMatrix);
56 }
void init(TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
TFitParticleMCSpher::TFitParticleMCSpher ( const TString &  name,
const TString &  title,
TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)

Definition at line 58 of file TFitParticleMCSpher.cc.

References init().

61 {
62  init(p, M, theCovMatrix);
63 }
void init(TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
TFitParticleMCSpher::~TFitParticleMCSpher ( )
virtual

Definition at line 77 of file TFitParticleMCSpher.cc.

77  {
78 
79 }

Member Function Documentation

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

Implements TAbsFitParticle.

Definition at line 93 of file TFitParticleMCSpher.cc.

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

93  {
94  // Calculates a 4vector corresponding to the given
95  // parameter values
96 
97  if (params == 0) {
98  return 0;
99  }
100 
101  if ( params->GetNcols() != 1 || params->GetNrows() !=_nPar ) {
102  edm::LogError ("WrongMatrixSize")
103  << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
104  return 0;
105  }
106 
107  Double_t r = (*params)(0,0);
108  Double_t theta = (*params)(1,0);
109  Double_t phi = (*params)(2,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 + _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:49
TLorentzVector _pini
Definition: DDAxes.h:10
TAbsFitParticle * TFitParticleMCSpher::clone ( TString  newname = "") const
virtual

Implements TAbsFitParticle.

Definition at line 65 of file TFitParticleMCSpher.cc.

References TFitParticleMCSpher().

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

Implements TAbsFitParticle.

Definition at line 171 of file TFitParticleMCSpher.cc.

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

171  {
172  // returns derivative dP/dy with P=(p,E) and y=(r, theta, phi)
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,3);
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 
183  //1st column: dP/dr
184  (*DerivativeMatrix)(0,0) = TMath::Cos(phi)*TMath::Sin(theta);
185  (*DerivativeMatrix)(1,0) = TMath::Sin(phi)*TMath::Sin(theta);
186  (*DerivativeMatrix)(2,0) = TMath::Cos(theta);
187  (*DerivativeMatrix)(3,0) = r/_pcurr.E();
188 
189  //2nd column: dP/dtheta
190  (*DerivativeMatrix)(0,1) = r*TMath::Cos(phi)*TMath::Cos(theta);
191  (*DerivativeMatrix)(1,1) = r*TMath::Sin(phi)*TMath::Cos(theta);
192  (*DerivativeMatrix)(2,1) = -1.*r*TMath::Sin(theta);
193  (*DerivativeMatrix)(3,1) = 0.;
194 
195  //3rd column: dP/dphi
196  (*DerivativeMatrix)(0,2) = -1.*r*TMath::Sin(phi)*TMath::Sin(theta);
197  (*DerivativeMatrix)(1,2) = r*TMath::Cos(phi)*TMath::Sin(theta);;
198  (*DerivativeMatrix)(2,2) = 0.;
199  (*DerivativeMatrix)(3,2) = 0.;
200 
201  return DerivativeMatrix;
202 
203 }
Geom::Theta< T > theta() const
TMatrixD _parameters
TLorentzVector _pcurr
Definition: DDAxes.h:10
void TFitParticleMCSpher::init ( TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)
protected

Definition at line 85 of file TFitParticleMCSpher.cc.

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

Referenced by TFitParticleMCSpher().

85  {
86 
87  _nPar = 3;
88  setIni4Vec(p, M);
89  setCovMatrix(theCovMatrix);
90 
91 }
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
virtual void setIni4Vec(const TLorentzVector *pini)
void TFitParticleMCSpher::setIni4Vec ( const TLorentzVector *  pini)
virtual

Implements TAbsFitParticle.

Definition at line 121 of file TFitParticleMCSpher.cc.

Referenced by init().

121  {
122  // Set the initial 4vector. Will also set the
123  // inital parameter values
124 
125  TVector3 vec( pini->Vect() );
126  setIni4Vec( &vec, pini->M() );
127 
128 }
virtual void setIni4Vec(const TLorentzVector *pini)
void TFitParticleMCSpher::setIni4Vec ( const TVector3 *  p,
Double_t  M 
)

Definition at line 130 of file TFitParticleMCSpher.cc.

References TAbsFitParticle::_iniparameters, TAbsFitParticle::_nPar, TAbsFitParticle::_parameters, TAbsFitParticle::_pcurr, TAbsFitParticle::_pini, TAbsFitParticle::_u1, TAbsFitParticle::_u2, TAbsFitParticle::_u3, phi, alignCSCRings::r, and theta().

130  {
131  // Set the initial 4vector. Will also set the
132  // inital parameter values
133 
134  if ( p == 0 ) {
135 
136  _u1.SetXYZ(0., 0., 0.);
137  _u3.SetXYZ(0., 0., 0.);
138  _u2.SetXYZ(0., 0., 0.);
139  _pini.SetXYZM(0., 0., 0., M);
140  _pcurr = _pini;
141 
142  _iniparameters.ResizeTo(_nPar,1);
143  _iniparameters(0,0) = 0.;
144  _parameters.ResizeTo(_nPar,1);
146 
147  } else {
148 
149  _pini.SetXYZM( p->x(), p->y(), p->z(), M);
150  _pcurr = _pini;
151 
152  Double_t r = _pini.P();
153  Double_t theta = _pini.Theta();
154  Double_t phi = _pini.Phi();
155 
156  _iniparameters.ResizeTo(_nPar,1);
157  _iniparameters(0,0) = r;
158  _iniparameters(1,0) = theta;
159  _iniparameters(2,0) = phi;
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
Definition: DDAxes.h:10
TMatrixD * TFitParticleMCSpher::transform ( const TLorentzVector &  vec)
virtual

Implements TAbsFitParticle.

Definition at line 205 of file TFitParticleMCSpher.cc.

References TAbsFitParticle::_nPar.

205  {
206  // Returns the parameters corresponding to the given
207  // 4vector
208 
209  // retrieve parameters
210  TMatrixD* tparams = new TMatrixD( _nPar, 1 );
211  (*tparams)(0,0) = vec.P();
212  (*tparams)(1,0) = vec.Theta();
213  (*tparams)(2,0) = vec.Phi();
214 
215  return tparams;
216 
217 }