CMS 3D CMS Logo

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

ColinearityKinematicConstraintT< Dim > Class Template Reference

#include <ColinearityKinematicConstraintT.h>

Inheritance diagram for ColinearityKinematicConstraintT< Dim >:
MultiTrackKinematicConstraintT< 2, int(Dim)> MultiTrackKinematicConstraintBaseT

List of all members.

Public Types

typedef
MultiTrackKinematicConstraintT
< 2, int(Dim)> 
super

Public Member Functions

virtual
ColinearityKinematicConstraintT
< Dim > * 
clone () const
 ColinearityKinematicConstraintT ()
void init (const std::vector< KinematicState > &states, const GlobalPoint &ipoint, const GlobalVector &fieldValue)
virtual int numberOfEquations () const

Private Member Functions

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

Private Attributes

double a_1
double a_2
AlgebraicVector7 p1
AlgebraicVector7 p2
GlobalPoint point

Detailed Description

template<enum colinearityKinematic::ConstraintDim Dim>
class ColinearityKinematicConstraintT< Dim >

Definition at line 24 of file ColinearityKinematicConstraintT.h.


Member Typedef Documentation

template<enum colinearityKinematic::ConstraintDim Dim>
typedef MultiTrackKinematicConstraintT<2,int(Dim)> ColinearityKinematicConstraintT< Dim >::super

Definition at line 37 of file ColinearityKinematicConstraintT.h.


Constructor & Destructor Documentation

template<enum colinearityKinematic::ConstraintDim Dim>
ColinearityKinematicConstraintT< Dim >::ColinearityKinematicConstraintT ( ) [inline]

Definition at line 39 of file ColinearityKinematicConstraintT.h.

{}

Member Function Documentation

template<enum colinearityKinematic::ConstraintDim Dim>
virtual ColinearityKinematicConstraintT<Dim>* ColinearityKinematicConstraintT< Dim >::clone ( void  ) const [inline, virtual]
template<enum colinearityKinematic::ConstraintDim Dim>
void ColinearityKinematicConstraintT< Dim >::fillParametersDerivative ( ) const [private, virtual]

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

Implements MultiTrackKinematicConstraintT< 2, int(Dim)>.

Definition at line 119 of file ColinearityKinematicConstraintT.h.

References p1, p2, colinearityKinematic::PhiTheta, point, and mathSSE::sqrt().

                                                                          {


  typename super::parametersDerivativeType & jac_d = super::jac_d(); 

  double p1vx = p1(3) - a_1*(point.y() - p1(1));
  double p1vy = p1(4) + a_1*(point.x() - p1(0));
  double k1 = 1.0/(p1vx*p1vx + p1vy*p1vy);

  double p2vx = p2(3) - a_2*(point.y() - p2(1));
  double p2vy = p2(4) + a_2*(point.x() - p2(0));
  double k2 = 1.0/(p2vx*p2vx + p2vy*p2vy);

  // H_phi:

  //x1 and x2 derivatives: 1st and 8th elements
  jac_d(0,0) =  -k1*a_1*p1vx;
  jac_d(0,7) =   k2*a_2*p2vx;

  //y1 and y2 derivatives: 2nd and 9th elements:
  jac_d(0,1) = -k1*a_1*p1vy;
  jac_d(0,8) =  k2*a_2*p2vy;

  //z1 and z2 components: 3d and 10th elmnets stay 0:
  jac_d(0,2)  = 0.; jac_d(0,9) = 0.;

  //px1 and px2 components: 4th and 11th elements:
  jac_d(0,3)  = -k1*p1vy;
  jac_d(0,10) =  k2*p2vy;

  //py1 and py2 components: 5th and 12 elements:
  jac_d(0,4)  =  k1*p1vx;
  jac_d(0,11) = -k2*p2vx;


  //pz1 and pz2 components: 6th and 13 elements:
  jac_d(0,5)  = 0.; jac_d(0,12) = 0.;
  //mass components: 7th and 14th elements:
  jac_d(0,6)  = 0.; jac_d(0,13) = 0.;

  if (Dim==colinearityKinematic::PhiTheta)  {
    double pt1 = sqrt(p1(3)*p1(3)+p1(4)*p1(4));
    double pTot1  = p1(3)*p1(3)+p1(4)*p1(4)+p1(5)*p1(5);
    double pt2  = sqrt(p2(3)*p2(3)+p2(4)*p2(4));
    double pTot2 = p2(3)*p2(3)+p2(4)*p2(4)+p2(5)*p2(5);
    
    // H_theta:
    //x1 and x2 derivatives: 1st and 8th elements
    jac_d(1,0) =  0.; jac_d(1,7) = 0.;

    //y1 and y2 derivatives: 2nd and 9th elements:
    jac_d(1,1) = 0.; jac_d(1,8) = 0.;

    //z1 and z2 components: 3d and 10th elmnets stay 0:
    jac_d(1,2) = 0.; jac_d(1,9) = 0.;

    jac_d(1,3)  =  p1(3) * (p1(5)/(pTot1*pt1));
    jac_d(1,10) =  p2(3) * (-p2(5)/(pTot2*pt2));

    //py1 and py2 components: 5th and 12 elements:
    jac_d(1,4)  =  p1(4)  * (p1(5)/(pTot1*pt1));
    jac_d(1,11) =  p2(4)  * (-p2(5)/(pTot2*pt2));

    //pz1 and pz2 components: 6th and 13 elements:
    jac_d(1,5)  = - pt1/pTot1;
    jac_d(1,12) =   pt2/pTot2;

    //mass components: 7th and 14th elements:
    jac_d(1,6)  = 0.; jac_d(1,13) = 0.;
  }
}
template<enum colinearityKinematic::ConstraintDim Dim>
void ColinearityKinematicConstraintT< Dim >::fillPositionDerivative ( ) const [private, virtual]

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

Implements MultiTrackKinematicConstraintT< 2, int(Dim)>.

Definition at line 192 of file ColinearityKinematicConstraintT.h.

References p1, p2, colinearityKinematic::PhiTheta, and point.

{

  typename super::positionDerivativeType & jac_e = super::jac_e(); 

  double p1vx = p1(3) - a_1*(point.y() - p1(1));
  double p1vy = p1(4) + a_1*(point.x() - p1(0));
  double k1 = 1.0/(p1vx*p1vx + p1vy*p1vy);

  double p2vx = p2(3) - a_2*(point.y() - p2(1));
  double p2vy = p2(4) + a_2*(point.x() - p2(0));
  double k2 = 1.0/(p2vx*p2vx + p2vy*p2vy);
 
  // H_phi:

  // xv component
  jac_e(0,0) = k1*a_1*p1vx - k2*a_2*p2vx;

  //yv component
  jac_e(0,1) =  k1*a_1*p1vy - k2*a_2*p2vy;

  //zv component
  jac_e(0,2) = 0.;

  // H_theta: no correlation with vertex position
  if (Dim==colinearityKinematic::PhiTheta) {
    jac_e(1,0) = 0.;
    jac_e(1,1) = 0.;
    jac_e(1,2) = 0.;
  }
}
template<enum colinearityKinematic::ConstraintDim Dim>
void ColinearityKinematicConstraintT< Dim >::fillValue ( ) const [private, virtual]

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

Implements MultiTrackKinematicConstraintT< 2, int(Dim)>.

Definition at line 93 of file ColinearityKinematicConstraintT.h.

References M_PI, p1, p2, colinearityKinematic::PhiTheta, point, and mathSSE::sqrt().

                                                           {

  typename super::valueType & vl = super::vl();
 
  double p1vx = p1(3) - a_1*(point.y() - p1(1));
  double p1vy = p1(4) + a_1*(point.x() - p1(0));
 
  double p2vx = p2(3) - a_2*(point.y() - p2(1));
  double p2vy = p2(4) + a_2*(point.x() - p2(0));
  

  // H_phi:
  vl(0)  = atan2(p1vy,p1vx) - atan2(p2vy,p2vx);
  if ( vl(0) >  M_PI ) vl(0) -= 2.0*M_PI;
  if ( vl(0) <= -M_PI ) vl(0) += 2.0*M_PI;
  // H_theta:
  if (Dim==colinearityKinematic::PhiTheta) {  
    double pt1  = sqrt(p1(3)*p1(3)+p1(4)*p1(4));
    double pt2  = sqrt(p2(3)*p2(3)+p2(4)*p2(4));
    vl(1)  = atan2(pt1,p1(5)) - atan2(pt2,p2(5));
    if ( vl(1) >  M_PI ) vl(1) -= 2.0*M_PI;
    if ( vl(1) <= -M_PI ) vl(1) += 2.0*M_PI;
  }
}
template<enum colinearityKinematic::ConstraintDim Dim>
void ColinearityKinematicConstraintT< Dim >::init ( const std::vector< KinematicState > &  states,
const GlobalPoint ipoint,
const GlobalVector fieldValue 
) [inline, virtual]

Implements MultiTrackKinematicConstraintBaseT.

Definition at line 43 of file ColinearityKinematicConstraintT.h.

References ColinearityKinematicConstraintT< Dim >::a_1, ColinearityKinematicConstraintT< Dim >::a_2, plotBeamSpotDB::ipoint, ColinearityKinematicConstraintT< Dim >::p1, ColinearityKinematicConstraintT< Dim >::p2, ColinearityKinematicConstraintT< Dim >::point, and PV3DBase< T, PVType, FrameType >::z().

                                                                        {
    if(states.size()!=2) throw VertexException("ColinearityKinematicConstraint::<2 states passed");

    point = ipoint;

    a_1 = -states[0].particleCharge()*fieldValue.z();
    a_2 = -states[1].particleCharge()*fieldValue.z();

    p1 = states[0].kinematicParameters().vector();
    p2 = states[1].kinematicParameters().vector();
  }
template<enum colinearityKinematic::ConstraintDim Dim>
virtual int ColinearityKinematicConstraintT< Dim >::numberOfEquations ( ) const [inline, virtual]

Number of equations per track used for the fit

Implements MultiTrackKinematicConstraintBaseT.

Definition at line 59 of file ColinearityKinematicConstraintT.h.

References colinearityKinematic::Phi.

{return Dim == colinearityKinematic::Phi ? 1 :2;}

Member Data Documentation

template<enum colinearityKinematic::ConstraintDim Dim>
double ColinearityKinematicConstraintT< Dim >::a_1 [private]
template<enum colinearityKinematic::ConstraintDim Dim>
double ColinearityKinematicConstraintT< Dim >::a_2 [private]
template<enum colinearityKinematic::ConstraintDim Dim>
AlgebraicVector7 ColinearityKinematicConstraintT< Dim >::p1 [private]
template<enum colinearityKinematic::ConstraintDim Dim>
AlgebraicVector7 ColinearityKinematicConstraintT< Dim >::p2 [private]
template<enum colinearityKinematic::ConstraintDim Dim>
GlobalPoint ColinearityKinematicConstraintT< Dim >::point [private]