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, std::vector< TAbsFitParticle * > *particles, TFitConstraintEp::component thecomponent, Double_t constraint=0.)
 
 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 () 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.

11 { pX, pY, pZ, E };

Constructor & Destructor Documentation

◆ TFitConstraintEp() [1/4]

TFitConstraintEp::TFitConstraintEp ( )

◆ 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.

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 }

References _particles, and ecalTrigSettings_cff::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.

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 }

References _particles, and ecalTrigSettings_cff::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.

72  {
73  // Add one particles to list of constrained particles
74 
75  _particles.push_back(particle);
76 }

References _particles.

Referenced by addParticles().

◆ 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.

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 }

References addParticle(), p1, p2, p3, and p4.

Referenced by TtSemiLepKinFitter::setupConstraints().

◆ getCurrentValue()

Double_t TFitConstraintEp::getCurrentValue ( )
overridevirtual

Implements TAbsFitConstraint.

Definition at line 138 of file TFitConstraintEp.cc.

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 }

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

Referenced by getInfoString().

◆ getDerivative()

TMatrixD * TFitConstraintEp::getDerivative ( TAbsFitParticle particle)
overridevirtual

Implements TAbsFitConstraint.

Definition at line 115 of file TFitConstraintEp.cc.

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 }

References _component, and createfilelist::int.

◆ getInfoString()

TString TFitConstraintEp::getInfoString ( )
overridevirtual

Reimplemented from TAbsFitConstraint.

Definition at line 151 of file TFitConstraintEp.cc.

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 }

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

Referenced by print().

◆ getInitValue()

Double_t TFitConstraintEp::getInitValue ( )
overridevirtual

Implements TAbsFitConstraint.

Definition at line 125 of file TFitConstraintEp.cc.

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 }

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

Referenced by getInfoString().

◆ print()

void TFitConstraintEp::print ( void  )
overridevirtual

Reimplemented from TAbsFitConstraint.

Definition at line 168 of file TFitConstraintEp.cc.

168  {
169  // Print constraint contents
170 
171  edm::LogVerbatim("KinFitter") << this->getInfoString();
172 }

References getInfoString().

◆ setConstraint()

void TFitConstraintEp::setConstraint ( Double_t  constraint)
inline

Definition at line 42 of file TFitConstraintEp.h.

42 { _constraint = constraint; };

References _constraint, and HLT_FULL_cff::constraint.

Referenced by TtSemiLepKinFitter::fit().

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().

runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.constraint
constraint
Definition: HLT_FULL_cff.py:51999
TFitConstraintEp::getInfoString
TString getInfoString() override
Definition: TFitConstraintEp.cc:151
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
TFitConstraintEp::_component
TFitConstraintEp::component _component
Definition: TFitConstraintEp.h:57
ecalTrigSettings_cff.particles
particles
Definition: ecalTrigSettings_cff.py:11
TFitConstraintEp::pX
Definition: TFitConstraintEp.h:11
TFitConstraintEp::_particles
std::vector< TAbsFitParticle * > _particles
Definition: TFitConstraintEp.h:55
TFitConstraintEp::pY
Definition: TFitConstraintEp.h:11
p2
double p2[4]
Definition: TauolaWrapper.h:90
TFitConstraintEp::E
Definition: TFitConstraintEp.h:11
TAbsFitConstraint::TAbsFitConstraint
TAbsFitConstraint()
Definition: TAbsFitConstraint.cc:18
TFitConstraintEp::getInitValue
Double_t getInitValue() override
Definition: TFitConstraintEp.cc:125
TFitConstraintEp::_constraint
Double_t _constraint
Definition: TFitConstraintEp.h:56
createfilelist.int
int
Definition: createfilelist.py:10
p4
double p4[4]
Definition: TauolaWrapper.h:92
p1
double p1[4]
Definition: TauolaWrapper.h:89
TFitConstraintEp::pZ
Definition: TFitConstraintEp.h:11
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
p3
double p3[4]
Definition: TauolaWrapper.h:91
TFitConstraintEp::addParticle
void addParticle(TAbsFitParticle *particle)
Definition: TFitConstraintEp.cc:72
TFitConstraintEp::getCurrentValue
Double_t getCurrentValue() override
Definition: TFitConstraintEp.cc:138