CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
TFitConstraintEp Class Reference

#include <TFitConstraintEp.h>

Inheritance diagram for TFitConstraintEp:
TAbsFitConstraint

Public Types

enum  component { pX, pY, pZ, E }
 

Public Member Functions

void addParticle (TAbsFitParticle *particle)
 
void addParticles (TAbsFitParticle *p1, TAbsFitParticle *p2=nullptr, TAbsFitParticle *p3=nullptr, TAbsFitParticle *p4=nullptr, TAbsFitParticle *p5=nullptr, TAbsFitParticle *p6=nullptr, TAbsFitParticle *p7=nullptr, TAbsFitParticle *p8=nullptr, TAbsFitParticle *p9=nullptr, TAbsFitParticle *p10=nullptr)
 
Double_t getCurrentValue () override
 
TMatrixD * getDerivative (TAbsFitParticle *particle) override
 
TString getInfoString () override
 
Double_t getInitValue () override
 
void print () override
 
void setConstraint (Double_t constraint)
 
 TFitConstraintEp ()
 
 TFitConstraintEp (const TString &name, const TString &title, TFitConstraintEp::component thecomponent, Double_t constraint=0.)
 
 TFitConstraintEp (std::vector< TAbsFitParticle *> *particles, TFitConstraintEp::component thecomponent, Double_t constraint=0.)
 
 TFitConstraintEp (const TString &name, const TString &title, std::vector< TAbsFitParticle *> *particles, TFitConstraintEp::component thecomponent, Double_t constraint=0.)
 
 ~TFitConstraintEp () override
 
- Public Member Functions inherited from TAbsFitConstraint
virtual void applyDeltaAlpha (TMatrixD *corrMatrix)
 
virtual const TMatrixD * getCovMatrix () const
 
virtual const TMatrixD * getCovMatrixDeltaAlpha ()
 
virtual const TMatrixD * getCovMatrixFit () const
 
virtual TMatrixD * getDerivativeAlpha ()
 
Int_t getNPar ()
 
const TMatrixD * getParCurr ()
 
const TMatrixD * getParIni ()
 
virtual void reset ()
 
virtual void setCovMatrix (const TMatrixD *theCovMatrix)
 
virtual void setCovMatrixFit (const TMatrixD *theCovMatrixFit)
 
void setParIni (const TMatrixD *parini)
 
 TAbsFitConstraint ()
 
 TAbsFitConstraint (const TString &name, const TString &title)
 
 ~TAbsFitConstraint () override
 

Private Attributes

TFitConstraintEp::component _component
 
Double_t _constraint
 
std::vector< TAbsFitParticle * > _particles
 

Additional Inherited Members

- Protected Member Functions inherited from TAbsFitConstraint
void calcCovMatrixDeltaAlpha ()
 
- Protected Attributes inherited from TAbsFitConstraint
TMatrixD _covMatrix
 
TMatrixD _covMatrixDeltaAlpha
 
TMatrixD _covMatrixFit
 
TMatrixD _iniparameters
 
Int_t _nPar
 
TMatrixD _parameters
 

Detailed Description

Definition at line 9 of file TFitConstraintEp.h.

Member Enumeration Documentation

◆ component

Enumerator
pX 
pY 
pZ 

Definition at line 11 of file TFitConstraintEp.h.

Constructor & Destructor Documentation

◆ TFitConstraintEp() [1/4]

TFitConstraintEp::TFitConstraintEp ( )

Definition at line 22 of file TFitConstraintEp.cc.

TFitConstraintEp::component _component
std::vector< TAbsFitParticle * > _particles

◆ TFitConstraintEp() [2/4]

TFitConstraintEp::TFitConstraintEp ( const TString &  name,
const TString &  title,
TFitConstraintEp::component  thecomponent,
Double_t  constraint = 0. 
)

Definition at line 25 of file TFitConstraintEp.cc.

◆ TFitConstraintEp() [3/4]

TFitConstraintEp::TFitConstraintEp ( std::vector< TAbsFitParticle *> *  particles,
TFitConstraintEp::component  thecomponent,
Double_t  constraint = 0. 
)

Definition at line 31 of file TFitConstraintEp.cc.

References _particles, and ecalTrigSettings_cff::particles.

35  // particles: vector containing pointer to TAbsFitParticle objects.
36  // Energy or momentum conservation will be calculated for
37  // those particles.
38  // thecomponent: conserved 4vector component ( pX, pY, pZ, E ). For
39  // full 4vector conservation four objects of type TFitConstraintEp
40  // are needed (four constraints)
41  // constraint:value of energy or momentum constraint ( e.g. sum[ pX_i ] = constraint )
42 
43  if (particles) {
44  _particles = (*particles);
45  }
46 }
TFitConstraintEp::component _component
std::vector< TAbsFitParticle * > _particles

◆ TFitConstraintEp() [4/4]

TFitConstraintEp::TFitConstraintEp ( const TString &  name,
const TString &  title,
std::vector< TAbsFitParticle *> *  particles,
TFitConstraintEp::component  thecomponent,
Double_t  constraint = 0. 
)

Definition at line 48 of file TFitConstraintEp.cc.

References _particles, and ecalTrigSettings_cff::particles.

54  // particles: vector containing pointer to TAbsFitParticle objects.
55  // Energy or momentum conservation will be calculated for
56  // those particles.
57  // thecomponent: conserved 4vector component ( pX, pY, pZ, E ). For
58  // full 4vector conservation four objects of type TFitConstraintEp
59  // are needed (four constraints)
60  // constraint:value of energy or momentum constraint ( e.g. sum[ pX_i ] = constraint )
61 
62  if (particles) {
63  _particles = (*particles);
64  }
65 }
TFitConstraintEp::component _component
std::vector< TAbsFitParticle * > _particles

◆ ~TFitConstraintEp()

TFitConstraintEp::~TFitConstraintEp ( )
override

Definition at line 70 of file TFitConstraintEp.cc.

70 {}

Member Function Documentation

◆ addParticle()

void TFitConstraintEp::addParticle ( TAbsFitParticle particle)

Definition at line 72 of file TFitConstraintEp.cc.

References _particles.

Referenced by addParticles().

72  {
73  // Add one particles to list of constrained particles
74 
75  _particles.push_back(particle);
76 }
std::vector< TAbsFitParticle * > _particles

◆ addParticles()

void TFitConstraintEp::addParticles ( TAbsFitParticle p1,
TAbsFitParticle p2 = nullptr,
TAbsFitParticle p3 = nullptr,
TAbsFitParticle p4 = nullptr,
TAbsFitParticle p5 = nullptr,
TAbsFitParticle p6 = nullptr,
TAbsFitParticle p7 = nullptr,
TAbsFitParticle p8 = nullptr,
TAbsFitParticle p9 = nullptr,
TAbsFitParticle p10 = nullptr 
)

Definition at line 78 of file TFitConstraintEp.cc.

References addParticle(), LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, and chargedHadronTrackResolutionFilter_cfi::p3.

87  {
88  // Add many particles to list of constrained particles
89 
90  if (p1)
91  addParticle(p1);
92  if (p2)
93  addParticle(p2);
94  if (p3)
95  addParticle(p3);
96  if (p4)
97  addParticle(p4);
98  if (p5)
99  addParticle(p5);
100  if (p6)
101  addParticle(p6);
102  if (p7)
103  addParticle(p7);
104  if (p8)
105  addParticle(p8);
106  if (p9)
107  addParticle(p9);
108  if (p10)
109  addParticle(p10);
110 }
void addParticle(TAbsFitParticle *particle)

◆ getCurrentValue()

Double_t TFitConstraintEp::getCurrentValue ( )
overridevirtual

Implements TAbsFitConstraint.

Definition at line 138 of file TFitConstraintEp.cc.

References _component, _constraint, _particles, mps_fire::i, and createfilelist::int.

Referenced by getInfoString().

138  {
139  // Get value of constraint after the fit
140 
141  Double_t CurrentValue(0);
142  UInt_t Npart = _particles.size();
143  for (unsigned int i = 0; i < Npart; i++) {
144  const TLorentzVector* FourVec = _particles[i]->getCurr4Vec();
145  CurrentValue += (*FourVec)[(int)_component];
146  }
147  CurrentValue -= _constraint;
148  return CurrentValue;
149 }
TFitConstraintEp::component _component
std::vector< TAbsFitParticle * > _particles

◆ getDerivative()

TMatrixD * TFitConstraintEp::getDerivative ( TAbsFitParticle particle)
overridevirtual

Implements TAbsFitConstraint.

Definition at line 115 of file TFitConstraintEp.cc.

References _component, and createfilelist::int.

115  {
116  // returns derivative df/dP with P=(p,E) and f the constraint (f=0).
117  // The matrix contains one row (df/dp, df/dE).
118 
119  TMatrixD* DerivativeMatrix = new TMatrixD(1, 4);
120  (*DerivativeMatrix) *= 0.;
121  (*DerivativeMatrix)(0, (int)_component) = 1.;
122  return DerivativeMatrix;
123 }
TFitConstraintEp::component _component

◆ getInfoString()

TString TFitConstraintEp::getInfoString ( )
overridevirtual

Reimplemented from TAbsFitConstraint.

Definition at line 151 of file TFitConstraintEp.cc.

References _component, _constraint, getCurrentValue(), getInitValue(), and info().

Referenced by print().

151  {
152  // Collect information to be used for printout
153 
154  std::stringstream info;
155  info << std::scientific << std::setprecision(6);
156 
157  info << "__________________________" << std::endl << std::endl;
158  info << "OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << std::endl;
159 
160  info << "initial value: " << getInitValue() << std::endl;
161  info << "current value: " << getCurrentValue() << std::endl;
162  info << "component: " << _component << std::endl;
163  info << "constraint: " << _constraint << std::endl;
164 
165  return info.str();
166 }
static const TGPicture * info(bool iBackgroundIsBlack)
Double_t getInitValue() override
Double_t getCurrentValue() override
TFitConstraintEp::component _component

◆ getInitValue()

Double_t TFitConstraintEp::getInitValue ( )
overridevirtual

Implements TAbsFitConstraint.

Definition at line 125 of file TFitConstraintEp.cc.

References _component, _constraint, _particles, mps_fire::i, and createfilelist::int.

Referenced by getInfoString().

125  {
126  // Get initial value of constraint (before the fit)
127 
128  Double_t InitValue(0);
129  UInt_t Npart = _particles.size();
130  for (unsigned int i = 0; i < Npart; i++) {
131  const TLorentzVector* FourVec = _particles[i]->getIni4Vec();
132  InitValue += (*FourVec)[(int)_component];
133  }
134  InitValue -= _constraint;
135  return InitValue;
136 }
TFitConstraintEp::component _component
std::vector< TAbsFitParticle * > _particles

◆ print()

void TFitConstraintEp::print ( void  )
overridevirtual

Reimplemented from TAbsFitConstraint.

Definition at line 168 of file TFitConstraintEp.cc.

References getInfoString().

168  {
169  // Print constraint contents
170 
171  edm::LogVerbatim("KinFitter") << this->getInfoString();
172 }
Log< level::Info, true > LogVerbatim
TString getInfoString() override

◆ setConstraint()

void TFitConstraintEp::setConstraint ( Double_t  constraint)
inline

Member Data Documentation

◆ _component

TFitConstraintEp::component TFitConstraintEp::_component
private

Definition at line 57 of file TFitConstraintEp.h.

Referenced by getCurrentValue(), getDerivative(), getInfoString(), and getInitValue().

◆ _constraint

Double_t TFitConstraintEp::_constraint
private

Definition at line 56 of file TFitConstraintEp.h.

Referenced by getCurrentValue(), getInfoString(), getInitValue(), and setConstraint().

◆ _particles

std::vector<TAbsFitParticle*> TFitConstraintEp::_particles
private

Definition at line 55 of file TFitConstraintEp.h.

Referenced by addParticle(), getCurrentValue(), getInitValue(), and TFitConstraintEp().