CMS 3D CMS Logo

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< RefCountedKinematicParticlesort (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::InputSort ( )
inline

Definition at line 16 of file InputSort.h.

16 {}

◆ ~InputSort()

InputSort::~InputSort ( )
inline

Definition at line 17 of file InputSort.h.

17 {}

Member Function Documentation

◆ sort() [1/2]

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

Definition at line 5 of file InputSort.cc.

References mps_fire::i, and ecalTrigSettings_cff::particles.

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

6  {
7  if (particles.empty())
8  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  if ((*i)->correspondingTree() != nullptr) {
16  sortedParticles.push_back((*i)->correspondingTree()->topParticle());
17  sortedStates.push_back((*i)->correspondingTree()->topParticle()->currentState().freeTrajectoryState());
18  } else {
19  sortedParticles.push_back(*i);
20  sortedStates.push_back((*i)->currentState().freeTrajectoryState());
21  }
22  }
23  return std::pair<std::vector<RefCountedKinematicParticle>, std::vector<FreeTrajectoryState> >(sortedParticles,
24  sortedStates);
25 }
Common base class.

◆ sort() [2/2]

std::vector< RefCountedKinematicParticle > InputSort::sort ( const std::vector< RefCountedKinematicTree > &  trees) const

Definition at line 27 of file InputSort.cc.

References mps_fire::i, and dqmdumpme::trees.

27  {
28  if (trees.empty())
29  throw VertexException("Input Sort::Zero vector of trees passed");
30  std::vector<RefCountedKinematicParticle> res;
31  for (std::vector<RefCountedKinematicTree>::const_iterator i = trees.begin(); i != trees.end(); i++) {
32  (*i)->movePointerToTheTop();
33  res.push_back((*i)->currentParticle());
34  }
35  return res;
36 }
Common base class.
Definition: Electron.h:6