Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:13

0001 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicParticleFactoryFromTransientTrack.h"
0002 
0003 KinematicParticleFactoryFromTransientTrack::KinematicParticleFactoryFromTransientTrack() {
0004   propagator = new TrackKinematicStatePropagator();
0005 }
0006 
0007 KinematicParticleFactoryFromTransientTrack::KinematicParticleFactoryFromTransientTrack(KinematicStatePropagator* pr) {
0008   if (pr != nullptr) {
0009     propagator = pr->clone();
0010   } else {
0011     propagator = new TrackKinematicStatePropagator();
0012   }
0013 }
0014 
0015 RefCountedKinematicParticle KinematicParticleFactoryFromTransientTrack::particle(
0016     const reco::TransientTrack& initialTrack,
0017     const ParticleMass& massGuess,
0018     float chiSquared,
0019     float degreesOfFr,
0020     float& m_sigma) const {
0021   // cout<<"calling the state builder"<<endl;
0022   KinematicState initState = builder(initialTrack, massGuess, m_sigma);
0023   const reco::TransientTrack* track = &initialTrack;
0024   KinematicConstraint* lastConstraint = nullptr;
0025   ReferenceCountingPointer<KinematicParticle> previousParticle = nullptr;
0026   return ReferenceCountingPointer<KinematicParticle>(new TransientTrackKinematicParticle(
0027       initState, chiSquared, degreesOfFr, lastConstraint, previousParticle, propagator, track));
0028 }
0029 
0030 RefCountedKinematicParticle KinematicParticleFactoryFromTransientTrack::particle(
0031     const reco::TransientTrack& initialTrack,
0032     const ParticleMass& massGuess,
0033     float chiSquared,
0034     float degreesOfFr,
0035     float& m_sigma,
0036     const FreeTrajectoryState& freestate) const {
0037   // cout<<"calling the state builder"<<endl;
0038   KinematicState initState = builder(freestate, massGuess, m_sigma);
0039   const reco::TransientTrack* track = &initialTrack;
0040   KinematicConstraint* lastConstraint = nullptr;
0041   ReferenceCountingPointer<KinematicParticle> previousParticle = nullptr;
0042   return ReferenceCountingPointer<KinematicParticle>(new TransientTrackKinematicParticle(
0043       initState, chiSquared, degreesOfFr, lastConstraint, previousParticle, propagator, track));
0044 }
0045 
0046 RefCountedKinematicParticle KinematicParticleFactoryFromTransientTrack::particle(
0047     const reco::TransientTrack& initialTrack,
0048     const ParticleMass& massGuess,
0049     float chiSquared,
0050     float degreesOfFr,
0051     const GlobalPoint& expPoint,
0052     float m_sigma) const {
0053   //  FreeTrajectoryState st(initialTrack.impactPointTSCP().theState());
0054   KinematicState initState = builder(initialTrack.impactPointTSCP().theState(), massGuess, m_sigma, expPoint);
0055   const reco::TransientTrack* track = &initialTrack;
0056   KinematicConstraint* lastConstraint = nullptr;
0057   ReferenceCountingPointer<KinematicParticle> previousParticle = nullptr;
0058   return ReferenceCountingPointer<KinematicParticle>(new TransientTrackKinematicParticle(
0059       initState, chiSquared, degreesOfFr, lastConstraint, previousParticle, propagator, track));
0060 }
0061 
0062 RefCountedKinematicParticle KinematicParticleFactoryFromTransientTrack::particle(
0063     const KinematicState& kineState,
0064     float& chiSquared,
0065     float& degreesOfFr,
0066     ReferenceCountingPointer<KinematicParticle> previousParticle,
0067     KinematicConstraint* lastConstraint) const {
0068   const reco::TransientTrack* track;
0069   KinematicParticle* prp = &(*previousParticle);
0070   // FIXME
0071   //  if(previousParticle.isValid()){
0072   TransientTrackKinematicParticle* pr = dynamic_cast<TransientTrackKinematicParticle*>(prp);
0073   if (pr == nullptr) {
0074     throw VertexException(
0075         "KinematicParticleFactoryFromTransientTrack::Previous particle passed is not TransientTrack based!");
0076   } else {
0077     track = pr->initialTransientTrack();
0078   }
0079   //  }else{track = 0;}
0080   return ReferenceCountingPointer<KinematicParticle>(new TransientTrackKinematicParticle(
0081       kineState, chiSquared, degreesOfFr, lastConstraint, previousParticle, propagator, track));
0082 }