test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
InputSort Class Reference

#include <InputSort.h>

Public Member Functions

 InputSort ()
 
std::pair< std::vector
< RefCountedKinematicParticle >
, std::vector
< FreeTrajectoryState > > 
sort (const std::vector< RefCountedKinematicParticle > &particles) const
 
std::vector
< RefCountedKinematicParticle
sort (const std::vector< RefCountedKinematicTree > &trees) 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.

18 {}
InputSort::~InputSort ( )
inline

Definition at line 19 of file InputSort.h.

19 {}

Member Function Documentation

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

Definition at line 6 of file InputSort.cc.

References i.

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

7 {
8  if(particles.size()==0) throw VertexException("Sorting particles for vertex fitter::number of particles = 0");
9  std::vector<RefCountedKinematicParticle> sortedParticles;
10  std::vector<FreeTrajectoryState> sortedStates;
11 
12 //checking that only top particles of the tree are passed by user
13 //correcting them for the top ones otherwise
14  for(std::vector<RefCountedKinematicParticle>::const_iterator i = particles.begin(); i != particles.end(); i++)
15  {
16  if((*i)->correspondingTree() != 0)
17  {
18  sortedParticles.push_back((*i)->correspondingTree()->topParticle());
19  sortedStates.push_back((*i)->correspondingTree()->topParticle()->currentState().freeTrajectoryState());
20  }else{
21  sortedParticles.push_back(*i);
22  sortedStates.push_back((*i)->currentState().freeTrajectoryState());
23  }
24  }
25  return std::pair<std::vector<RefCountedKinematicParticle>, std::vector<FreeTrajectoryState> >(sortedParticles, sortedStates);
26 }
int i
Definition: DBlmapReader.cc:9
Common base class.
std::vector< RefCountedKinematicParticle > InputSort::sort ( const std::vector< RefCountedKinematicTree > &  trees) const

Definition at line 28 of file InputSort.cc.

References i.

29 {
30  if(trees.size() ==0) throw VertexException("Input Sort::Zero vector of trees passed");
31  std::vector<RefCountedKinematicParticle> res;
32  for(std::vector<RefCountedKinematicTree>::const_iterator i = trees.begin(); i!=trees.end(); i++)
33  {
34  (*i)->movePointerToTheTop();
35  res.push_back((*i)->currentParticle());
36  }
37  return res;
38 }
int i
Definition: DBlmapReader.cc:9
Common base class.