CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

VertexKinematicConstraintT Class Reference

#include <VertexKinematicConstraintT.h>

Inheritance diagram for VertexKinematicConstraintT:
MultiTrackKinematicConstraintT< 2, 4 > MultiTrackKinematicConstraintBaseT

List of all members.

Public Member Functions

virtual
VertexKinematicConstraintT
clone () const
virtual void init (const std::vector< KinematicState > &states, const GlobalPoint &point, const GlobalVector &mf)
virtual int numberOfEquations () const
 VertexKinematicConstraintT ()
virtual ~VertexKinematicConstraintT ()

Private Types

typedef
MultiTrackKinematicConstraintT< 2, 4 > 
super

Private Member Functions

virtual void fillParametersDerivative () const
virtual void fillPositionDerivative () const
virtual void fillValue () const

Private Attributes

double a_i [2]
double delta [2]
GlobalVector dpos [2]
double k [2]
double m [2]
GlobalVector mom [2]
double n [2]
double novera [2]

Detailed Description

Class implementing the vertexing constraint for extended cartesian parametrization (x,y,z,p_x,p_y,p_z,m). The equations and derivatives in general follow the P.Avery's "Applied Fitting Theory-VI" CBX 98-37

Definition at line 14 of file VertexKinematicConstraintT.h.


Member Typedef Documentation

Definition at line 19 of file VertexKinematicConstraintT.h.


Constructor & Destructor Documentation

VertexKinematicConstraintT::VertexKinematicConstraintT ( )

Definition at line 5 of file VertexKinematicConstraintT.cc.

Referenced by clone().

{}
VertexKinematicConstraintT::~VertexKinematicConstraintT ( ) [virtual]

Definition at line 8 of file VertexKinematicConstraintT.cc.

{}

Member Function Documentation

virtual VertexKinematicConstraintT* VertexKinematicConstraintT::clone ( void  ) const [inline, virtual]

Implements MultiTrackKinematicConstraintBaseT.

Definition at line 45 of file VertexKinematicConstraintT.h.

References VertexKinematicConstraintT().

{return new VertexKinematicConstraintT(*this);}
void VertexKinematicConstraintT::fillParametersDerivative ( ) const [private, virtual]

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

Implements MultiTrackKinematicConstraintT< 2, 4 >.

Definition at line 58 of file VertexKinematicConstraintT.cc.

References a_i, delta, dpos, j, MultiTrackKinematicConstraintT< 2, 4 >::jac_d(), k, m, mom, n, novera, PV3DBase< T, PVType, FrameType >::perp2(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::y, and PV3DBase< T, PVType, FrameType >::z().

                                                                {
  ROOT::Math::SMatrix<double,2,7> el_part_d;
  for(int j = 0; j!=2; ++j) {
    
    if(a_i[j] !=0) {
      
      //charged particle
            
      //D Jacobian matrix
      el_part_d(0,0) =  mom[j].y() + a_i[j]*dpos[j].x();
      el_part_d(0,1) = -mom[j].x() + a_i[j]*dpos[j].y();
      el_part_d(1,0) =  -k[j]*(m[j]*mom[j].x() - n[j]*mom[j].y());
      el_part_d(1,1) =  -k[j]*(m[j]*mom[j].y() + n[j]*mom[j].x());
      el_part_d(1,2) = -1.;
      el_part_d(0,3) = dpos[j].y();
      el_part_d(0,4) = -dpos[j].x();
      el_part_d(1,3) = k[j]*(m[j]*dpos[j].x() - novera[j]*(2*mom[j].x() - a_i[j]*dpos[j].y()));
      el_part_d(1,4) = k[j]*(m[j]*dpos[j].y() - novera[j]*(2*mom[j].y() + a_i[j]*dpos[j].x()));
      el_part_d(1,5) = -delta[j] /a_i[j];
      super::jac_d().Place_at(el_part_d,j*2, j*7);
    }else{
      //neutral particle
      double pt2Inverse = 1./mom[j].perp2();
      el_part_d(0,0) =  mom[j].y();
      el_part_d(0,1) = -mom[j].x();
      el_part_d(1,0) =  mom[j].x() * (mom[j].z()*pt2Inverse);
      el_part_d(1,1) =  mom[j].y() * (mom[j].z()*pt2Inverse);
      el_part_d(1,2) = -1.;
      el_part_d(0,3) = dpos[j].y();
      el_part_d(0,4) = -dpos[j].x();
      el_part_d(1,3) = 2*(dpos[j].x()*mom[j].x()+dpos[j].y()*mom[j].y())*pt2Inverse*mom[j].x()*(mom[j].z()*pt2Inverse) - dpos[j].x()*(mom[j].z()*pt2Inverse);
      el_part_d(1,4) = 2*(dpos[j].x()*mom[j].x()+dpos[j].y()*mom[j].y())*pt2Inverse*mom[j].y()*(mom[j].z()*pt2Inverse) - dpos[j].x()*(mom[j].z()*pt2Inverse);
      el_part_d(1,5) = - (dpos[j].x()*mom[j].x()+dpos[j].y()*mom[j].y())*pt2Inverse;
      super::jac_d().Place_at(el_part_d,j*2, j*7);
    }
  }
}
void VertexKinematicConstraintT::fillPositionDerivative ( ) const [private, virtual]

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

Implements MultiTrackKinematicConstraintT< 2, 4 >.

Definition at line 96 of file VertexKinematicConstraintT.cc.

References a_i, dpos, j, MultiTrackKinematicConstraintT< 2, 4 >::jac_e(), k, m, mom, n, PV3DBase< T, PVType, FrameType >::perp2(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

                                                              {

  ROOT::Math::SMatrix<double,2,3>  el_part_e;
  for(int j = 0; j!=2; ++j) {

    if(a_i[j] !=0) {
      
      //charged particle

      //E jacobian matrix
      el_part_e(0,0) = -(mom[j].y() + a_i[j]*dpos[j].x());
      el_part_e(0,1) =   mom[j].x() - a_i[j]*dpos[j].y();
      el_part_e(1,0) = k[j]*(m[j]*mom[j].x() - n[j]*mom[j].y());
      el_part_e(1,1) = k[j]*(m[j]*mom[j].y() + n[j]*mom[j].x());
      el_part_e(1,2) = 1;
      super::jac_e().Place_at(el_part_e,2*j,0);
    }else{      
      //neutral particle
      double pt2Inverse = 1./mom[j].perp2();
      el_part_e(0,0) = - mom[j].y();
      el_part_e(0,1) = mom[j].x();
      el_part_e(1,0) = -mom[j].x()*mom[j].z()*pt2Inverse;
      el_part_e(1,1) = -mom[j].y()*mom[j].z()*pt2Inverse;
      el_part_e(1,2) = 1;
      super::jac_e().Place_at(el_part_e,2*j,0);
    }
  }
}
void VertexKinematicConstraintT::fillValue ( ) const [private, virtual]

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

Implements MultiTrackKinematicConstraintT< 2, 4 >.

Definition at line 40 of file VertexKinematicConstraintT.cc.

References a_i, delta, dpos, j, mom, PV3DBase< T, PVType, FrameType >::perp2(), MultiTrackKinematicConstraintT< 2, 4 >::vl(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

{
  //it is 2 equations per track
  for(int j = 0; j!=2; ++j) {

    if(a_i[j] !=0) {
      //vector of values
      super::vl(j*2) = dpos[j].y()*mom[j].x() - dpos[j].x()*mom[j].y() -a_i[j]*(dpos[j].x()*dpos[j].x() + dpos[j].y()*dpos[j].y())*0.5;
      super::vl(j*2 +1) = dpos[j].z() - mom[j].z()*delta[j]/a_i[j];
    }else{      
      //neutral particle
      double pt2Inverse = 1./mom[j].perp2();
      super::vl(j*2) = dpos[j].y()*mom[j].x() - dpos[j].x()*mom[j].y();
      super::vl(j*2 +1) = dpos[j].z() - mom[j].z()*(dpos[j].x() * mom[j].x() + dpos[j].y() * mom[j].y())*pt2Inverse;
    }
  }
}
void VertexKinematicConstraintT::init ( const std::vector< KinematicState > &  states,
const GlobalPoint point,
const GlobalVector mf 
) [virtual]

Implements MultiTrackKinematicConstraintBaseT.

Definition at line 12 of file VertexKinematicConstraintT.cc.

References a_i, delta, dpos, i, j, k, m, mom, n, novera, PV3DBase< T, PVType, FrameType >::perp2(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

                                                                                                  {
  int num = states.size();
  if(num!=2) throw VertexException("VertexKinematicConstraintT !=2 states passed");
  double mfz = fieldValue.z();
  
  int j=0;
  for(std::vector<KinematicState>::const_iterator i = states.begin(); i != states.end(); i++)
    {
      mom[j] = i->globalMomentum();
      dpos[j] = ipoint - i->globalPosition();
      a_i[j] = - i->particleCharge() * mfz;

      double pvx = mom[j].x() - a_i[j]*dpos[j].y();
      double pvy = mom[j].y() + a_i[j]*dpos[j].x();
      double pvt2 = pvx*pvx+pvy*pvy;
      novera[j] = (dpos[j].x() * mom[j].x() + dpos[j].y()*mom[j].y());
      n[j] = a_i[j]*novera[j];
      m[j] = (pvx*mom[j].x() + pvy*mom[j].y());
      k[j] = -mom[j].z()/(mom[j].perp2()*pvt2);
      delta[j] = std::atan2(n[j],m[j]);

      ++j;
    }
}
int VertexKinematicConstraintT::numberOfEquations ( ) const [virtual]

Number of equations per track used for the fit

Implements MultiTrackKinematicConstraintBaseT.

Definition at line 125 of file VertexKinematicConstraintT.cc.

{return 2;}

Member Data Documentation

double VertexKinematicConstraintT::a_i[2] [private]
double VertexKinematicConstraintT::delta[2] [private]

Definition at line 24 of file VertexKinematicConstraintT.h.

Referenced by fillParametersDerivative(), fillValue(), and init().

double VertexKinematicConstraintT::k[2] [private]
double VertexKinematicConstraintT::m[2] [private]
double VertexKinematicConstraintT::n[2] [private]

Definition at line 24 of file VertexKinematicConstraintT.h.

Referenced by fillParametersDerivative(), and init().