CMS 3D CMS Logo

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

#include <TFitParticleMCSpher.h>

Inheritance diagram for TFitParticleMCSpher:
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)
 
 TFitParticleMCSpher ()
 
 TFitParticleMCSpher (const TFitParticleMCSpher &fitParticle)
 
 TFitParticleMCSpher (const TString &name, const TString &title, TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
 
 TFitParticleMCSpher (TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
 
TMatrixD * transform (const TLorentzVector &vec) override
 
 ~TFitParticleMCSpher () 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 TFitParticleMCSpher.h.

Constructor & Destructor Documentation

◆ TFitParticleMCSpher() [1/4]

TFitParticleMCSpher::TFitParticleMCSpher ( )

Definition at line 25 of file TFitParticleMCSpher.cc.

25 : TAbsFitParticle() { init(nullptr, 0., nullptr); }

References init().

Referenced by clone().

◆ TFitParticleMCSpher() [2/4]

TFitParticleMCSpher::TFitParticleMCSpher ( const TFitParticleMCSpher fitParticle)

Definition at line 27 of file TFitParticleMCSpher.cc.

28  : TAbsFitParticle(fitParticle.GetName(), fitParticle.GetTitle()) {
29  _nPar = fitParticle._nPar;
30  _u1 = fitParticle._u1;
31  _u2 = fitParticle._u2;
32  _u3 = fitParticle._u3;
33  _covMatrix.ResizeTo(fitParticle._covMatrix);
34  _covMatrix = fitParticle._covMatrix;
35  _iniparameters.ResizeTo(fitParticle._iniparameters);
36  _iniparameters = fitParticle._iniparameters;
37  _parameters.ResizeTo(fitParticle._parameters);
38  _parameters = fitParticle._parameters;
39  _pini = fitParticle._pini;
40  _pcurr = fitParticle._pcurr;
41 }

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

◆ TFitParticleMCSpher() [3/4]

TFitParticleMCSpher::TFitParticleMCSpher ( TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)

Definition at line 43 of file TFitParticleMCSpher.cc.

43  : TAbsFitParticle() {
44  init(p, M, theCovMatrix);
45 }

References init(), and AlCaHLTBitMon_ParallelJobs::p.

◆ TFitParticleMCSpher() [4/4]

TFitParticleMCSpher::TFitParticleMCSpher ( const TString &  name,
const TString &  title,
TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)

Definition at line 47 of file TFitParticleMCSpher.cc.

50  init(p, M, theCovMatrix);
51 }

References init(), and AlCaHLTBitMon_ParallelJobs::p.

◆ ~TFitParticleMCSpher()

TFitParticleMCSpher::~TFitParticleMCSpher ( )
override

Definition at line 65 of file TFitParticleMCSpher.cc.

65 {}

Member Function Documentation

◆ calc4Vec()

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

Implements TAbsFitParticle.

Definition at line 76 of file TFitParticleMCSpher.cc.

76  {
77  // Calculates a 4vector corresponding to the given
78  // parameter values
79 
80  if (params == nullptr) {
81  return nullptr;
82  }
83 
84  if (params->GetNcols() != 1 || params->GetNrows() != _nPar) {
85  edm::LogError("WrongMatrixSize") << GetName() << "::calc4Vec - Parameter matrix has wrong size.";
86  return nullptr;
87  }
88 
89  Double_t r = (*params)(0, 0);
90  Double_t theta = (*params)(1, 0);
91  Double_t phi = (*params)(2, 0);
92 
93  Double_t X = r * TMath::Cos(phi) * TMath::Sin(theta);
94  Double_t Y = r * TMath::Sin(phi) * TMath::Sin(theta);
95  Double_t Z = r * TMath::Cos(theta);
96  Double_t E = TMath::Sqrt(X * X + Y * Y + Z * Z + _pini.M2());
97 
98  TLorentzVector* vec = new TLorentzVector(X, Y, Z, E);
99  return vec;
100 }

References TAbsFitParticle::_nPar, TAbsFitParticle::_pini, CalibrationSummaryClient_cfi::params, phi, alignCSCRings::r, theta(), X, BeamSpotPI::Y, and BeamSpotPI::Z.

◆ clone()

TAbsFitParticle * TFitParticleMCSpher::clone ( const TString &  newname = TString("")) const
overridevirtual

Implements TAbsFitParticle.

Definition at line 53 of file TFitParticleMCSpher.cc.

53  {
54  // Returns a copy of itself
55 
56  TAbsFitParticle* myclone = new TFitParticleMCSpher(*this);
57  if (newname.Length() > 0)
58  myclone->SetName(newname);
59  return myclone;
60 }

References TFitParticleMCSpher().

◆ getDerivative()

TMatrixD * TFitParticleMCSpher::getDerivative ( )
overridevirtual

Implements TAbsFitParticle.

Definition at line 147 of file TFitParticleMCSpher.cc.

147  {
148  // returns derivative dP/dy with P=(p,E) and y=(r, theta, phi)
149  // the free parameters of the fit. The columns of the matrix contain
150  // (dP/dr, dP/dtheta, ...).
151 
152  TMatrixD* DerivativeMatrix = new TMatrixD(4, 3);
153  (*DerivativeMatrix) *= 0.;
154 
155  Double_t r = _parameters(0, 0);
156  Double_t theta = _parameters(1, 0);
157  Double_t phi = _parameters(2, 0);
158 
159  //1st column: dP/dr
160  (*DerivativeMatrix)(0, 0) = TMath::Cos(phi) * TMath::Sin(theta);
161  (*DerivativeMatrix)(1, 0) = TMath::Sin(phi) * TMath::Sin(theta);
162  (*DerivativeMatrix)(2, 0) = TMath::Cos(theta);
163  (*DerivativeMatrix)(3, 0) = r / _pcurr.E();
164 
165  //2nd column: dP/dtheta
166  (*DerivativeMatrix)(0, 1) = r * TMath::Cos(phi) * TMath::Cos(theta);
167  (*DerivativeMatrix)(1, 1) = r * TMath::Sin(phi) * TMath::Cos(theta);
168  (*DerivativeMatrix)(2, 1) = -1. * r * TMath::Sin(theta);
169  (*DerivativeMatrix)(3, 1) = 0.;
170 
171  //3rd column: dP/dphi
172  (*DerivativeMatrix)(0, 2) = -1. * r * TMath::Sin(phi) * TMath::Sin(theta);
173  (*DerivativeMatrix)(1, 2) = r * TMath::Cos(phi) * TMath::Sin(theta);
174  ;
175  (*DerivativeMatrix)(2, 2) = 0.;
176  (*DerivativeMatrix)(3, 2) = 0.;
177 
178  return DerivativeMatrix;
179 }

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

◆ init()

void TFitParticleMCSpher::init ( TVector3 *  p,
Double_t  M,
const TMatrixD *  theCovMatrix 
)
protected

Definition at line 70 of file TFitParticleMCSpher.cc.

70  {
71  _nPar = 3;
72  setIni4Vec(p, M);
73  setCovMatrix(theCovMatrix);
74 }

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

Referenced by TFitParticleMCSpher().

◆ setIni4Vec() [1/2]

void TFitParticleMCSpher::setIni4Vec ( const TLorentzVector *  pini)
overridevirtual

Implements TAbsFitParticle.

Definition at line 102 of file TFitParticleMCSpher.cc.

102  {
103  // Set the initial 4vector. Will also set the
104  // inital parameter values
105 
106  TVector3 vec(pini->Vect());
107  setIni4Vec(&vec, pini->M());
108 }

Referenced by init().

◆ setIni4Vec() [2/2]

void TFitParticleMCSpher::setIni4Vec ( const TVector3 *  p,
Double_t  M 
)

Definition at line 110 of file TFitParticleMCSpher.cc.

110  {
111  // Set the initial 4vector. Will also set the
112  // inital parameter values
113 
114  if (p == nullptr) {
115  _u1.SetXYZ(0., 0., 0.);
116  _u3.SetXYZ(0., 0., 0.);
117  _u2.SetXYZ(0., 0., 0.);
118  _pini.SetXYZM(0., 0., 0., M);
119  _pcurr = _pini;
120 
121  _iniparameters.ResizeTo(_nPar, 1);
122  _iniparameters(0, 0) = 0.;
123  _parameters.ResizeTo(_nPar, 1);
125 
126  } else {
127  _pini.SetXYZM(p->x(), p->y(), p->z(), M);
128  _pcurr = _pini;
129 
130  Double_t r = _pini.P();
131  Double_t theta = _pini.Theta();
132  Double_t phi = _pini.Phi();
133 
134  _iniparameters.ResizeTo(_nPar, 1);
135  _iniparameters(0, 0) = r;
136  _iniparameters(1, 0) = theta;
137  _iniparameters(2, 0) = phi;
138  _parameters.ResizeTo(_nPar, 1);
140 
141  _u1.SetXYZ(TMath::Cos(phi) * TMath::Sin(theta), TMath::Sin(phi) * TMath::Sin(theta), TMath::Cos(theta));
142  _u2.SetXYZ(TMath::Cos(phi) * TMath::Cos(theta), TMath::Sin(phi) * TMath::Cos(theta), -1. * TMath::Sin(theta));
143  _u3.SetXYZ(-1. * TMath::Sin(phi), TMath::Cos(phi), 0.);
144  }
145 }

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

◆ transform()

TMatrixD * TFitParticleMCSpher::transform ( const TLorentzVector &  vec)
overridevirtual

Implements TAbsFitParticle.

Definition at line 181 of file TFitParticleMCSpher.cc.

181  {
182  // Returns the parameters corresponding to the given
183  // 4vector
184 
185  // retrieve parameters
186  TMatrixD* tparams = new TMatrixD(_nPar, 1);
187  (*tparams)(0, 0) = vec.P();
188  (*tparams)(1, 0) = vec.Theta();
189  (*tparams)(2, 0) = vec.Phi();
190 
191  return tparams;
192 }

References TAbsFitParticle::_nPar.

TAbsFitParticle::_iniparameters
TMatrixD _iniparameters
Definition: TAbsFitParticle.h:58
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
X
#define X(str)
Definition: MuonsGrabber.cc:38
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
TAbsFitParticle::_parameters
TMatrixD _parameters
Definition: TAbsFitParticle.h:59
TAbsFitParticle::_pcurr
TLorentzVector _pcurr
Definition: TAbsFitParticle.h:61
TFitParticleMCSpher::init
void init(TVector3 *p, Double_t M, const TMatrixD *theCovMatrix)
Definition: TFitParticleMCSpher.cc:70
TAbsFitParticle::_pini
TLorentzVector _pini
Definition: TAbsFitParticle.h:60
TAbsFitParticle::_covMatrix
TMatrixD _covMatrix
Definition: TAbsFitParticle.h:54
TFitParticleMCSpher::TFitParticleMCSpher
TFitParticleMCSpher()
Definition: TFitParticleMCSpher.cc:25
TAbsFitParticle::_u2
TVector3 _u2
Definition: TAbsFitParticle.h:51
TAbsFitParticle::_nPar
Int_t _nPar
Definition: TAbsFitParticle.h:49
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
TAbsFitParticle
Definition: TAbsFitParticle.h:9
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TAbsFitParticle::setCovMatrix
virtual void setCovMatrix(const TMatrixD *theCovMatrix)
Definition: TAbsFitParticle.cc:98
TAbsFitParticle::TAbsFitParticle
TAbsFitParticle()
Definition: TAbsFitParticle.cc:18
TAbsFitParticle::_u3
TVector3 _u3
Definition: TAbsFitParticle.h:52
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
TFitParticleMCSpher::setIni4Vec
void setIni4Vec(const TLorentzVector *pini) override
Definition: TFitParticleMCSpher.cc:102
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
TAbsFitParticle::_u1
TVector3 _u1
Definition: TAbsFitParticle.h:50
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:32
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:33