CMS 3D CMS Logo

Public Member Functions | Private Attributes

MultiTrackMassKinematicConstraint Class Reference

#include <MultiTrackMassKinematicConstraint.h>

Inheritance diagram for MultiTrackMassKinematicConstraint:
MultiTrackKinematicConstraint

List of all members.

Public Member Functions

virtual
MultiTrackMassKinematicConstraint
clone () const
 MultiTrackMassKinematicConstraint (const ParticleMass &theMass, const unsigned int nbrParticles)
virtual int numberOfEquations () const
virtual AlgebraicMatrix parametersDerivative (const std::vector< KinematicState > states, const GlobalPoint &point) const
virtual AlgebraicMatrix positionDerivative (const std::vector< KinematicState > states, const GlobalPoint &point) const
virtual AlgebraicVector value (const std::vector< KinematicState > states, const GlobalPoint &point) const

Private Attributes

const ParticleMass mass
const unsigned int nPart

Detailed Description

Constraint to force some of the particles in the fit to have a certain invariant mass.

Definition at line 13 of file MultiTrackMassKinematicConstraint.h.


Constructor & Destructor Documentation

MultiTrackMassKinematicConstraint::MultiTrackMassKinematicConstraint ( const ParticleMass theMass,
const unsigned int  nbrParticles 
) [inline]

Constructor

Parameters:
theMassthe mass to constrain the states
nbrParticlesthe number of particles to use (in case more than that number are present in the fit, the first will be used)

Definition at line 22 of file MultiTrackMassKinematicConstraint.h.

Referenced by clone().

        : mass(theMass), nPart(nbrParticles)
  {}

Member Function Documentation

virtual MultiTrackMassKinematicConstraint* MultiTrackMassKinematicConstraint::clone ( void  ) const [inline, virtual]
virtual int MultiTrackMassKinematicConstraint::numberOfEquations ( ) const [inline, virtual]

Number of equations per track used for the fit

Implements MultiTrackKinematicConstraint.

Definition at line 55 of file MultiTrackMassKinematicConstraint.h.

{return 1;}
AlgebraicMatrix MultiTrackMassKinematicConstraint::parametersDerivative ( const std::vector< KinematicState states,
const GlobalPoint point 
) const [virtual]

Returns a matrix of derivatives of constraint equations w.r.t. particle parameters

Implements MultiTrackKinematicConstraint.

Definition at line 29 of file MultiTrackMassKinematicConstraint.cc.

References a, i, nPart, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

{
  if(states.size()<nPart) throw VertexException("MultiTrackMassKinematicConstraint::not enough states given");

  AlgebraicMatrix res(1,states.size()*7,0);

  double sumEnergy = 0, sumPx=0, sumPy=0., sumPz=0.;

 double a;
  for (unsigned int i=0;i<nPart;++i) {
    a = -states[i].particleCharge() * states[i].magneticField()->inInverseGeV(states[i].globalPosition()).z();

    sumEnergy += states[i].kinematicParameters().energy();
    sumPx += states[i].kinematicParameters()(3) - a*(point.y() - states[i].kinematicParameters()(1));
    sumPy += states[i].kinematicParameters()(4) + a*(point.x() - states[i].kinematicParameters()(0));
    sumPz += states[i].kinematicParameters()(5);
  }

  for (unsigned int i=0;i<nPart;++i) {
    a = -states[i].particleCharge() * states[i].magneticField()->inInverseGeV(states[i].globalPosition()).z();

 //x derivatives:
    res(1,1+i*7) = 2*a*sumPy;

 //y derivatives:
    res(1,2+i*7) = -2*a*sumPx;

 //z components:
    res(1,3+i*7)  = 0.;

 //px components:
    res(1,4+i*7)  = 2*sumEnergy/states[i].kinematicParameters().energy()*states[i].kinematicParameters()(3) - 2*sumPx;

 //py components:
    res(1,5+i*7)  = 2*sumEnergy/states[i].kinematicParameters().energy()*states[i].kinematicParameters()(4) - 2*sumPy;

 //pz1 components:
    res(1,6+i*7)  = 2*sumEnergy/states[i].kinematicParameters().energy()*states[i].kinematicParameters()(5) - 2*sumPz;

 //mass components:
    res(1,7+i*7)  = 2*states[i].kinematicParameters().mass()*sumEnergy/states[i].kinematicParameters().energy();
  }
  return res;
}
AlgebraicMatrix MultiTrackMassKinematicConstraint::positionDerivative ( const std::vector< KinematicState states,
const GlobalPoint point 
) const [virtual]

Returns a matrix of derivatives of constraint equations w.r.t. vertex position

Implements MultiTrackKinematicConstraint.

Definition at line 75 of file MultiTrackMassKinematicConstraint.cc.

References a, i, nPart, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

{
  AlgebraicMatrix res(1,3,0);
  if(states.size()<nPart) throw VertexException("MultiTrackMassKinematicConstraint::not enough states given");

  double sumA = 0, sumPx=0, sumPy=0.;

  double a;
  for (unsigned int i=0;i<nPart;++i) {
    a = -states[i].particleCharge() * states[i].magneticField()->inInverseGeV(states[i].globalPosition()).z();
    sumA += a;

    sumPx += states[i].kinematicParameters()(3) - a*(point.y() - states[i].kinematicParameters()(1));
    sumPy += states[i].kinematicParameters()(4) + a*(point.x() - states[i].kinematicParameters()(0));
  }

 //xv component
  res(1,1) = - 2 * sumPy * sumA;

 //yv component
  res(1,2) =   2 * sumPx * sumA;

 //zv component
  res(1,3) = 0.;

  return res;
}
AlgebraicVector MultiTrackMassKinematicConstraint::value ( const std::vector< KinematicState states,
const GlobalPoint point 
) const [virtual]

Returns a vector of values of constraint equations at the point where the input particles are defined.

Implements MultiTrackKinematicConstraint.

Definition at line 5 of file MultiTrackMassKinematicConstraint.cc.

References a, i, mass, nPart, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

{
 if(states.size()<nPart) throw VertexException("MultiTrackMassKinematicConstraint::not enough states given");

 double sumEnergy = 0, sumPx=0, sumPy=0., sumPz=0.;

 double a;
 for (unsigned int i=0;i<nPart;++i) {
    a = -states[i].particleCharge() * states[i].magneticField()->inInverseGeV(states[i].globalPosition()).z();

    sumEnergy += states[i].kinematicParameters().energy();
    sumPx += states[i].kinematicParameters()(3) - a*(point.y() - states[i].kinematicParameters()(1));
    sumPy += states[i].kinematicParameters()(4) + a*(point.x() - states[i].kinematicParameters()(0));
    sumPz += states[i].kinematicParameters()(5);
 }

 double j_m = sumPx*sumPx + sumPy*sumPy + sumPz*sumPz;

 AlgebraicVector res(1,0);
 res(1)  = sumEnergy*sumEnergy - j_m - mass*mass;
 return res;
}

Member Data Documentation

Definition at line 62 of file MultiTrackMassKinematicConstraint.h.

Referenced by value().

const unsigned int MultiTrackMassKinematicConstraint::nPart [private]