CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

TFitConstraintEp Class Reference

#include <TFitConstraintEp.h>

Inheritance diagram for TFitConstraintEp:
TAbsFitConstraint TNamed

List of all members.

Public Types

enum  component { pX, pY, pZ, E }

Public Member Functions

void addParticle (TAbsFitParticle *particle)
void addParticles (TAbsFitParticle *p1, TAbsFitParticle *p2=0, TAbsFitParticle *p3=0, TAbsFitParticle *p4=0, TAbsFitParticle *p5=0, TAbsFitParticle *p6=0, TAbsFitParticle *p7=0, TAbsFitParticle *p8=0, TAbsFitParticle *p9=0, TAbsFitParticle *p10=0)
virtual Double_t getCurrentValue ()
virtual TMatrixD * getDerivative (TAbsFitParticle *particle)
virtual TString getInfoString ()
virtual Double_t getInitValue ()
virtual void print ()
void setConstraint (Double_t constraint)
 TFitConstraintEp ()
 TFitConstraintEp (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 (const TString &name, const TString &title, std::vector< TAbsFitParticle * > *particles, TFitConstraintEp::component thecomponent, Double_t constraint=0.)
virtual ~TFitConstraintEp ()

Private Attributes

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

Detailed Description

Definition at line 9 of file TFitConstraintEp.h.


Member Enumeration Documentation

Enumerator:
pX 
pY 
pZ 
E 

Definition at line 13 of file TFitConstraintEp.h.

                 {
    pX,
    pY,
    pZ,
    E
  };

Constructor & Destructor Documentation

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

Definition at line 32 of file TFitConstraintEp.cc.

  :TAbsFitConstraint(name, title)
  ,_constraint(constraint)
  ,_component(thecomponent)
{
}
TFitConstraintEp::TFitConstraintEp ( std::vector< TAbsFitParticle * > *  particles,
TFitConstraintEp::component  thecomponent,
Double_t  constraint = 0. 
)

Definition at line 41 of file TFitConstraintEp.cc.

References _particles.

  :TAbsFitConstraint()
  ,_particles(0)
  ,_constraint(constraint)
  ,_component(thecomponent)
{
  // particles: vector containing pointer to TAbsFitParticle objects. 
  //            Energy or momentum conservation will be calculated for
  //            those particles.
  // thecomponent: conserved 4vector component ( pX, pY, pZ, E ). For
  //            full 4vector conservation four objects of type TFitConstraintEp
  //            are needed (four constraints)
  // constraint:value of energy or momentum constraint ( e.g. sum[ pX_i ] = constraint )

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

Definition at line 62 of file TFitConstraintEp.cc.

References _particles.

  :TAbsFitConstraint(name, title)
  ,_particles(0)
  ,_constraint(constraint)
  ,_component(thecomponent)
{
  // particles: vector containing pointer to TAbsFitParticle objects. 
  //            Energy or momentum conservation will be calculated for
  //            those particles.
  // thecomponent: conserved 4vector component ( pX, pY, pZ, E ). For
  //            full 4vector conservation four objects of type TFitConstraintEp
  //            are needed (four constraints)
  // constraint:value of energy or momentum constraint ( e.g. sum[ pX_i ] = constraint )

  if (particles) {
    _particles = (*particles);
  }
}
TFitConstraintEp::~TFitConstraintEp ( ) [virtual]

Definition at line 87 of file TFitConstraintEp.cc.

                                    {

}

Member Function Documentation

void TFitConstraintEp::addParticle ( TAbsFitParticle particle)

Definition at line 91 of file TFitConstraintEp.cc.

References _particles.

Referenced by addParticles().

                                                              {
  // Add one particles to list of constrained particles

  _particles.push_back( particle );

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

Definition at line 98 of file TFitConstraintEp.cc.

References addParticle().

Referenced by TtSemiLepKinFitter::setupConstraints().

                                                                                {
  // Add many particles to list of constrained particles

  if (p1) addParticle( p1 );
  if (p2) addParticle( p2 );
  if (p3) addParticle( p3 );
  if (p4) addParticle( p4 );
  if (p5) addParticle( p5 );
  if (p6) addParticle( p6 );
  if (p7) addParticle( p7 );
  if (p8) addParticle( p8 );
  if (p9) addParticle( p9 );
  if (p10) addParticle( p10 );

}
Double_t TFitConstraintEp::getCurrentValue ( ) [virtual]

Implements TAbsFitConstraint.

Definition at line 143 of file TFitConstraintEp.cc.

References _component, _constraint, _particles, and i.

Referenced by getInfoString().

                                           {
  // Get value of constraint after the fit

  Double_t CurrentValue(0);
  UInt_t Npart = _particles.size();
  for (unsigned int i=0;i<Npart;i++) {
    const TLorentzVector* FourVec = _particles[i]->getCurr4Vec();
    CurrentValue += (*FourVec)[(int) _component];
  }
  CurrentValue -= _constraint;
  return CurrentValue;
}
TMatrixD * TFitConstraintEp::getDerivative ( TAbsFitParticle particle) [virtual]

Implements TAbsFitConstraint.

Definition at line 119 of file TFitConstraintEp.cc.

References _component.

                                                                     {
  // returns derivative df/dP with P=(p,E) and f the constraint (f=0).
  // The matrix contains one row (df/dp, df/dE).

  TMatrixD* DerivativeMatrix = new TMatrixD(1,4);
  (*DerivativeMatrix) *= 0.;
  (*DerivativeMatrix)(0,(int) _component) = 1.;
  return DerivativeMatrix;
}
TString TFitConstraintEp::getInfoString ( ) [virtual]

Reimplemented from TAbsFitConstraint.

Definition at line 156 of file TFitConstraintEp.cc.

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

Referenced by print().

                                        {
  // Collect information to be used for printout

  std::stringstream info;
  info << std::scientific << std::setprecision(6);

  info << "__________________________" << std::endl
       << std::endl;
  info << "OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << std::endl;

  info << "initial value: " << getInitValue() << std::endl;
  info << "current value: " << getCurrentValue() << std::endl;
  info << "component: " << _component << std::endl;
  info << "constraint: " << _constraint << std::endl;

  return info.str();

}
Double_t TFitConstraintEp::getInitValue ( ) [virtual]

Implements TAbsFitConstraint.

Definition at line 130 of file TFitConstraintEp.cc.

References _component, _constraint, _particles, and i.

Referenced by getInfoString().

                                        {
  // Get initial value of constraint (before the fit)

  Double_t InitValue(0) ; 
  UInt_t Npart = _particles.size();
  for (unsigned int i=0;i<Npart;i++) {
    const TLorentzVector* FourVec = _particles[i]->getIni4Vec();
    InitValue += (*FourVec)[(int) _component];
  }
  InitValue -= _constraint;
  return InitValue;
}
void TFitConstraintEp::print ( void  ) [virtual]

Reimplemented from TAbsFitConstraint.

Definition at line 175 of file TFitConstraintEp.cc.

References getInfoString().

                             {
  // Print constraint contents

  edm::LogVerbatim("KinFitter") << this->getInfoString();

}
void TFitConstraintEp::setConstraint ( Double_t  constraint) [inline]

Definition at line 40 of file TFitConstraintEp.h.

References _constraint.

Referenced by TtSemiLepKinFitter::fit().

{_constraint = constraint;};

Member Data Documentation

Definition at line 57 of file TFitConstraintEp.h.

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

Double_t TFitConstraintEp::_constraint [private]

Definition at line 56 of file TFitConstraintEp.h.

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

Definition at line 55 of file TFitConstraintEp.h.

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