CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/RecoVertex/KinematicFitPrimitives/src/TransientTrackKinematicParticle.cc

Go to the documentation of this file.
00001 #include "RecoVertex/KinematicFitPrimitives/interface/TransientTrackKinematicParticle.h"
00002 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00003 
00004 using namespace reco;
00005 
00006 TransientTrackKinematicParticle::TransientTrackKinematicParticle
00007         (const KinematicState& kineState, float& chiSquared,
00008         float& degreesOfFr, KinematicConstraint * lastConstraint,
00009         ReferenceCountingPointer<KinematicParticle> previousParticle,
00010         KinematicStatePropagator * pr, const TransientTrack * initialTrack)
00011 {
00012   theField = kineState.magneticField();
00013  if(previousParticle.get() == 0)
00014  { 
00015   initState = kineState;
00016 }else{initState = previousParticle->initialState();}
00017  cState = kineState;
00018  inTrack = initialTrack;
00019  pState = previousParticle;
00020  chi2 = chiSquared;
00021  ndf = degreesOfFr;
00022  lConstraint = lastConstraint;
00023  if(pr!=0)
00024  {
00025   propagator = pr->clone();
00026  }else{
00027   propagator = new TrackKinematicStatePropagator();
00028  }
00029  tree = 0;
00030 } 
00031 
00032 TransientTrackKinematicParticle::~TransientTrackKinematicParticle()
00033 {delete propagator;}
00034  
00035 bool TransientTrackKinematicParticle::operator==(const KinematicParticle& other)const
00036 {
00037  bool dc = false;
00038  
00039 //first looking if this is an object of the same type
00040  const  KinematicParticle * lp = &other;
00041  const TransientTrackKinematicParticle * lPart = dynamic_cast<const TransientTrackKinematicParticle * >(lp);
00042  if(lPart != 0){
00043  
00044 //then comparing particle with their initial TransientTracks 
00045   if((initialTransientTrack())&&(lPart->initialTransientTrack()))
00046   {
00047    if(initialTransientTrack() == lPart->initialTransientTrack()) dc = true;
00048   }else{if(initialState() == lPart->initialState()) dc = true;} 
00049  }
00050  return dc; 
00051 }
00052 
00053 bool TransientTrackKinematicParticle::operator==(const ReferenceCountingPointer<KinematicParticle>& other) const
00054 {
00055  bool res = false;
00056  if(*this == *other) res = true;
00057  return res;
00058 }
00059 
00060 bool  TransientTrackKinematicParticle::operator!=(const KinematicParticle& other)const
00061 {
00062  if (*this == other){
00063   return false;
00064  }else{return true;} 
00065 }
00066 
00067 KinematicState TransientTrackKinematicParticle::stateAtPoint(const GlobalPoint& point)const
00068 {
00069  GlobalPoint iP = cState.kinematicParameters().position();
00070  if((iP.x() == point.x())&&(iP.y() == point.y())&&(iP.z() == point.z()))
00071  {
00072   return cState ;
00073  }else{return propagator->propagateToTheTransversePCA(cState,point);} 
00074 }
00075 
00076 //FreeTrajectoryState TransientTrackKinematicParticle::initialStateFTS() const
00077 //{return initState.freeTrajectoryState();}
00078 
00079 const TransientTrack * TransientTrackKinematicParticle::initialTransientTrack() const
00080 {return inTrack;}  
00081 
00082 ReferenceCountingPointer<KinematicParticle> TransientTrackKinematicParticle::refittedParticle(const KinematicState& state,
00083                                                              float chi2, float ndf, KinematicConstraint * cons)const
00084 {
00085  TransientTrackKinematicParticle * ncp = const_cast<TransientTrackKinematicParticle * >(this);
00086  return ReferenceCountingPointer<KinematicParticle>(new TransientTrackKinematicParticle(state,chi2,ndf,cons,
00087                           ReferenceCountingPointer<KinematicParticle>(ncp), propagator, initialTransientTrack()));
00088 }
00089 
00090 TransientTrackKinematicParticle::RefCountedLinearizedTrackState
00091 TransientTrackKinematicParticle::particleLinearizedTrackState(const GlobalPoint& point)const    
00092 {
00093  TransientTrackKinematicParticle * cr = const_cast<TransientTrackKinematicParticle * >(this);
00094  RefCountedKinematicParticle lp = ReferenceCountingPointer<KinematicParticle>(cr);
00095  return linFactory.linearizedTrackState(point,lp);
00096 }                     
00097