CMS 3D CMS Logo

Public Member Functions

InputSort Class Reference

#include <InputSort.h>

List of all members.

Public Member Functions

 InputSort ()
std::vector
< RefCountedKinematicParticle
sort (std::vector< RefCountedKinematicTree > trees) const
std::pair< std::vector
< RefCountedKinematicParticle >
, std::vector
< FreeTrajectoryState > > 
sort (std::vector< RefCountedKinematicParticle > particles) const
 ~InputSort ()

Detailed Description

Helper class checking the input of Kinematic Vertex Fitters If some of particles provided have trees after them, makes sure that only top tree particles are used in the fit.

Definition at line 14 of file InputSort.h.


Constructor & Destructor Documentation

InputSort::InputSort ( ) [inline]

Definition at line 18 of file InputSort.h.

{}
InputSort::~InputSort ( ) [inline]

Definition at line 19 of file InputSort.h.

{}

Member Function Documentation

std::pair< std::vector< RefCountedKinematicParticle >, std::vector< FreeTrajectoryState > > InputSort::sort ( std::vector< RefCountedKinematicParticle particles) const

Definition at line 6 of file InputSort.cc.

References i.

Referenced by KinematicConstrainedVertexFitterT< nTrk, nConstraint >::fit(), KinematicConstrainedVertexFitter::fit(), LagrangeParentParticleFitter::fit(), and KinematicParticleVertexFitter::fit().

{
 if(particles.size()==0) throw VertexException("Sorting particles for vertex fitter::number of particles = 0");
 std::vector<RefCountedKinematicParticle> sortedParticles;
 std::vector<FreeTrajectoryState> sortedStates;

//checking that only top particles of the tree are passed by user
//correcting them for the top ones otherwise 
 for(std::vector<RefCountedKinematicParticle>::const_iterator i = particles.begin(); i != particles.end(); i++)
 {
  if((*i)->correspondingTree() != 0)
  {
   sortedParticles.push_back((*i)->correspondingTree()->topParticle());
   sortedStates.push_back((*i)->correspondingTree()->topParticle()->currentState().freeTrajectoryState());
  }else{
   sortedParticles.push_back(*i);
   sortedStates.push_back((*i)->currentState().freeTrajectoryState());
  }
 }
 return std::pair<std::vector<RefCountedKinematicParticle>, std::vector<FreeTrajectoryState> >(sortedParticles, sortedStates);
}
std::vector< RefCountedKinematicParticle > InputSort::sort ( std::vector< RefCountedKinematicTree trees) const

Definition at line 28 of file InputSort.cc.

References i.

{
 if(trees.size() ==0) throw VertexException("Input Sort::Zero vector of trees passed"); 
 std::vector<RefCountedKinematicParticle> res;
 for(std::vector<RefCountedKinematicTree>::const_iterator i = trees.begin(); i!=trees.end(); i++)
 {
  (*i)->movePointerToTheTop();
  res.push_back((*i)->currentParticle());
 }
 return res;
}