CMS 3D CMS Logo

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

#include <TFitParticleMCCart.h>

Inheritance diagram for TFitParticleMCCart:
TAbsFitParticle

Public Member Functions

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

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 TFitParticleMCCart.h.

Constructor & Destructor Documentation

TFitParticleMCCart::TFitParticleMCCart ( )

Definition at line 27 of file TFitParticleMCCart.cc.

References init().

Referenced by clone().

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

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

Definition at line 52 of file TFitParticleMCCart.cc.

References init().

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

Definition at line 58 of file TFitParticleMCCart.cc.

References init().

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

Definition at line 77 of file TFitParticleMCCart.cc.

77  {
78 
79 }

Member Function Documentation

TLorentzVector * TFitParticleMCCart::calc4Vec ( const TMatrixD *  params)
overridevirtual

Implements TAbsFitParticle.

Definition at line 94 of file TFitParticleMCCart.cc.

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, X, DOFs::Y, and DOFs::Z.

94  {
95  // Calculates a 4vector corresponding to the given
96  // parameter values
97 
98  if (params == nullptr) {
99  return nullptr;
100  }
101 
102  if ( params->GetNcols() != 1 || params->GetNrows() !=_nPar ) {
103  edm::LogError ("WrongMatrixSize")
104  << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
105  return nullptr;
106  }
107 
108  Double_t X = (*params)(0,0);
109  Double_t Y = (*params)(1,0);
110  Double_t Z = (*params)(2,0);
111  Double_t E = TMath::Sqrt( X*X + Y*Y + Z*Z + _pini.M2() );
112 
113  TLorentzVector* vec = new TLorentzVector( X, Y, Z, E );
114  return vec;
115 
116 }
#define X(str)
Definition: MuonsGrabber.cc:48
TLorentzVector _pini
TAbsFitParticle * TFitParticleMCCart::clone ( const TString &  newname = TString("")) const
overridevirtual

Implements TAbsFitParticle.

Definition at line 65 of file TFitParticleMCCart.cc.

References TFitParticleMCCart().

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

Implements TAbsFitParticle.

Definition at line 163 of file TFitParticleMCCart.cc.

References TAbsFitParticle::_parameters, and TAbsFitParticle::_pcurr.

163  {
164  // returns derivative dP/dy with P=(p,E) and y=(px, py, pz)
165  // the free parameters of the fit. The columns of the matrix contain
166  // (dP/dpx, dP/dpy, ...).
167 
168  TMatrixD* DerivativeMatrix = new TMatrixD(4,3);
169  (*DerivativeMatrix) *= 0.;
170 
171  //1st column: dP/dx
172  (*DerivativeMatrix)(0,0) = 1.;
173  (*DerivativeMatrix)(1,0) = 0.;
174  (*DerivativeMatrix)(2,0) = 0.;
175  (*DerivativeMatrix)(3,0) = _parameters(0,0)/_pcurr.E();
176 
177  //2nd column: dP/dy
178  (*DerivativeMatrix)(0,1) = 0.;
179  (*DerivativeMatrix)(1,1) = 1.;
180  (*DerivativeMatrix)(2,1) = 0.;
181  (*DerivativeMatrix)(3,1) = _parameters(1,0)/_pcurr.E();
182 
183  //3rd column: dP/dz
184  (*DerivativeMatrix)(0,2) = 0.;
185  (*DerivativeMatrix)(1,2) = 0.;
186  (*DerivativeMatrix)(2,2) = 1.;
187  (*DerivativeMatrix)(3,2) = _parameters(2,0)/_pcurr.E();
188 
189  return DerivativeMatrix;
190 
191 }
TMatrixD _parameters
TLorentzVector _pcurr
void TFitParticleMCCart::init ( TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)
protected

Definition at line 85 of file TFitParticleMCCart.cc.

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

Referenced by TFitParticleMCCart().

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

Implements TAbsFitParticle.

Definition at line 118 of file TFitParticleMCCart.cc.

Referenced by init().

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

Definition at line 127 of file TFitParticleMCCart.cc.

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

127  {
128  // Set the initial 4vector. Will also set the
129  // inital parameter values
130 
131  if ( p == nullptr ) {
132 
133  _iniparameters.ResizeTo(_nPar,1);
134  _iniparameters(0,0) = 0.;
135  _iniparameters(1,0) = 0.;
136  _iniparameters(2,0) = 0.;
137  _parameters.ResizeTo(_nPar,1);
139 
140  _pini.SetXYZM( 0., 0., 0., M);
141  _pcurr = _pini;
142 
143  } else {
144 
145  _iniparameters.ResizeTo(_nPar,1);
146  _iniparameters(0,0) = p->x();
147  _iniparameters(1,0) = p->y();
148  _iniparameters(2,0) = p->z();
149  _parameters.ResizeTo(_nPar,1);
151 
152  _pini.SetXYZM( p->x(), p->y(), p->z(), M);
153  _pcurr = _pini;
154 
155  _u1.SetXYZ( 1., 0., 0. );
156  _u2.SetXYZ( 0., 1., 0. );
157  _u3.SetXYZ( 0., 0., 1. );
158 
159  }
160 
161 }
TLorentzVector _pini
TMatrixD _parameters
TLorentzVector _pcurr
TMatrixD _iniparameters
TMatrixD * TFitParticleMCCart::transform ( const TLorentzVector &  vec)
overridevirtual

Implements TAbsFitParticle.

Definition at line 193 of file TFitParticleMCCart.cc.

References TAbsFitParticle::_nPar.

193  {
194  // Returns the parameters corresponding to the given
195  // 4vector
196 
197  TVector3 vec3( vec.Vect() );
198 
199  // retrieve parameters
200  TMatrixD* tparams = new TMatrixD( _nPar, 1 );
201  (*tparams)(0,0) = vec3.x();
202  (*tparams)(1,0) = vec3.y();
203  (*tparams)(2,0) = vec3.z();
204 
205  return tparams;
206 
207 }
std::vector< vec2 > vec3
Definition: HCALResponse.h:17