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

#include <TFitParticleEtThetaPhi.h>

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

Constructor & Destructor Documentation

TFitParticleEtThetaPhi::TFitParticleEtThetaPhi ( )

Definition at line 27 of file TFitParticleEtThetaPhi.cc.

References init().

Referenced by clone().

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

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

Definition at line 52 of file TFitParticleEtThetaPhi.cc.

References init().

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

Definition at line 58 of file TFitParticleEtThetaPhi.cc.

References init().

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

Definition at line 77 of file TFitParticleEtThetaPhi.cc.

77  {
78 
79 }

Member Function Documentation

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

Implements TAbsFitParticle.

Definition at line 92 of file TFitParticleEtThetaPhi.cc.

References TAbsFitParticle::_nPar, phi, 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 et = (*params)(0,0);
107  Double_t theta = (*params)(1,0);
108  Double_t phi = (*params)(2,0);
109 
110  Double_t X = et*TMath::Cos(phi);
111  Double_t Y = et*TMath::Sin(phi);
112  Double_t Z = et/TMath::Tan(theta);
113  Double_t E = et/TMath::Sin(theta);
114 
115  TLorentzVector* vec = new TLorentzVector( X, Y, Z, E );
116  return vec;
117 
118 }
const double Z[kNumberCalorimeter]
Geom::Theta< T > theta() const
#define X(str)
Definition: MuonsGrabber.cc:48
TAbsFitParticle * TFitParticleEtThetaPhi::clone ( const TString &  newname = "") const
virtual

Implements TAbsFitParticle.

Definition at line 65 of file TFitParticleEtThetaPhi.cc.

References TFitParticleEtThetaPhi().

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

Implements TAbsFitParticle.

Definition at line 167 of file TFitParticleEtThetaPhi.cc.

References TAbsFitParticle::_parameters, phi, and theta().

167  {
168  // returns derivative dP/dy with P=(p,E) and y=(et, theta, phi)
169  // the free parameters of the fit. The columns of the matrix contain
170  // (dP/d(et), dP/d(theta), dP/d(phi)).
171 
172  TMatrixD* DerivativeMatrix = new TMatrixD(4,3);
173  (*DerivativeMatrix) *= 0.;
174 
175  Double_t et = _parameters(0,0);
176  Double_t theta = _parameters(1,0);
177  Double_t phi = _parameters(2,0);
178 
179  Double_t CotanTheta = 1./TMath::Tan(theta);
180 
181  //1st column: dP/d(et)
182  (*DerivativeMatrix)(0,0) = TMath::Cos(phi);
183  (*DerivativeMatrix)(1,0) = TMath::Sin(phi);
184  (*DerivativeMatrix)(2,0) = CotanTheta;
185  (*DerivativeMatrix)(3,0) = 1./TMath::Sin(theta);
186 
187  //2nd column: dP/d(theta)
188  (*DerivativeMatrix)(0,1) = 0.;
189  (*DerivativeMatrix)(1,1) = 0.;
190  (*DerivativeMatrix)(2,1) = -1.*et*(1.+CotanTheta*CotanTheta);
191  (*DerivativeMatrix)(3,1) = -1.*et*CotanTheta/(TMath::Sin(theta));
192 
193  //3rd column: dP/d(phi)
194  (*DerivativeMatrix)(0,2) = -1.*et*TMath::Sin(phi);
195  (*DerivativeMatrix)(1,2) = et*TMath::Cos(phi);
196  (*DerivativeMatrix)(2,2) = 0.;
197  (*DerivativeMatrix)(3,2) = 0.;
198 
199  return DerivativeMatrix;
200 
201 }
Geom::Theta< T > theta() const
TMatrixD _parameters
void TFitParticleEtThetaPhi::init ( TLorentzVector *  pini,
const TMatrixD *  theCovMatrix 
)
protected

Definition at line 84 of file TFitParticleEtThetaPhi.cc.

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

Referenced by TFitParticleEtThetaPhi().

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

Implements TAbsFitParticle.

Definition at line 120 of file TFitParticleEtThetaPhi.cc.

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

Referenced by init().

120  {
121  // Set the initial 4vector. Will also set the
122  // inital parameter values
123 
124  if (pini == 0) {
125 
126  _u1.SetXYZ(0., 0., 0.);
127  _u3.SetXYZ(0., 0., 0.);
128  _u2.SetXYZ(0., 0., 0.);
129  _pini.SetXYZT(0., 0., 0., 0.);
130  _pcurr = _pini;
131 
132  _iniparameters.ResizeTo(_nPar,1);
133  _iniparameters(0,0) = 0.;
134  _iniparameters(1,0) = 0.;
135  _iniparameters(2,0) = 0.;
136 
137  _parameters.ResizeTo(_nPar,1);
138  _parameters(0,0) = 0.;
139  _parameters(1,0) = 0.;
140  _parameters(2,0) = 0.;
141 
142  } else {
143 
144  Double_t et = pini->E()*std::fabs(sin(pini->Theta()));
145  Double_t theta = pini->Theta();
146  Double_t phi = pini->Phi();
147 
148  _pini = (*pini);
149  _pcurr = _pini;
150 
151  _iniparameters.ResizeTo(_nPar,1);
152  _iniparameters(0,0) = et;
153  _iniparameters(1,0) = theta;
154  _iniparameters(2,0) = phi;
155 
156  _parameters.ResizeTo(_nPar,1);
158 
159  _u1.SetXYZ( TMath::Cos(phi), TMath::Sin(phi), 0.); // the base vector of Et
160  _u2.SetXYZ( TMath::Cos(phi)*TMath::Cos(theta), TMath::Sin(phi)*TMath::Cos(theta), -1.*TMath::Sin(theta) );// the base vector of Eta ( same as the base vector for Theta)
161  _u3.SetXYZ( -1.*TMath::Sin(phi), TMath::Cos(phi), 0. );// the base vector of Phi
162 
163  }
164 
165 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TMatrixD * TFitParticleEtThetaPhi::transform ( const TLorentzVector &  vec)
virtual

Implements TAbsFitParticle.

Definition at line 203 of file TFitParticleEtThetaPhi.cc.

References TAbsFitParticle::_nPar, and funct::sin().

203  {
204  // Returns the parameters corresponding to the given
205  // 4vector
206 
207  // retrieve parameters
208  TMatrixD* tparams = new TMatrixD( _nPar, 1 );
209  (*tparams)(0,0) = vec.E()*std::fabs(sin(vec.Theta()));
210  (*tparams)(1,0) = vec.Theta();
211  (*tparams)(2,0) = vec.Phi();
212 
213  return tparams;
214 
215 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22