Belle II Software  release-05-02-19
MCParticleTrajectory.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef MCPARTICLETRAJECTORY_H
12 #define MCPARTICLETRAJECTORY_H
13 
14 #include <framework/datastore/RelationsObject.h>
15 #include <simulation/dataobjects/MCTrajectoryPoint.h>
16 #include <vector>
17 
18 namespace Belle2 {
24  class MCParticleTrajectory: public RelationsObject {
25  public:
28 
30  typedef std::vector<MCTrajectoryPoint>::iterator iterator;
32  typedef std::vector<MCTrajectoryPoint>::const_iterator const_iterator;
34  iterator begin() { return m_points.begin(); }
36  iterator end() { return m_points.end(); }
38  const_iterator begin() const { return m_points.begin(); }
40  const_iterator end() const { return m_points.end(); }
42  size_t size() const { return m_points.size(); }
44  bool empty() const { return m_points.empty(); }
46  const MCTrajectoryPoint& operator[](size_t index) const { return m_points[index]; }
48  const MCTrajectoryPoint& front() const { return m_points.front(); }
50  const MCTrajectoryPoint& back() const { return m_points.back(); }
56  void addPoint(float x, float y, float z, float px, float py, float pz)
57  {
58  //Reserve a decent amount of space to avoid lots of relocations
59  m_points.emplace_back(x, y, z, px, py, pz);
60  }
61 
66  void simplify(float distanceTolerance);
67 
68  private:
70  std::vector<MCTrajectoryPoint> m_points;
71 
74  };
75 
77 } //Belle2 namespace
78 #endif
Belle2::MCParticleTrajectory::iterator
std::vector< MCTrajectoryPoint >::iterator iterator
iterator definition to allow iteration
Definition: MCParticleTrajectory.h:38
Belle2::MCParticleTrajectory::ClassDef
ClassDef(MCParticleTrajectory, 1)
Needed to make the ROOT object storable.
Belle2::MCTrajectoryPoint
Small struct to encode a position/momentum without additional overhead.
Definition: MCTrajectoryPoint.h:21
Belle2::MCParticleTrajectory::addPoint
void addPoint(float x, float y, float z, float px, float py, float pz)
Add a point to the trajectory.
Definition: MCParticleTrajectory.h:64
Belle2::MCParticleTrajectory::back
const MCTrajectoryPoint & back() const
return reference to the last point
Definition: MCParticleTrajectory.h:58
Belle2::MCParticleTrajectory::begin
iterator begin()
return iterator to the first point
Definition: MCParticleTrajectory.h:42
Belle2::MCParticleTrajectory::size
size_t size() const
return number of points
Definition: MCParticleTrajectory.h:50
Belle2::MCParticleTrajectory::front
const MCTrajectoryPoint & front() const
return reference to the first point
Definition: MCParticleTrajectory.h:56
Belle2::MCParticleTrajectory::MCParticleTrajectory
MCParticleTrajectory()
Default constructor.
Definition: MCParticleTrajectory.h:35
Belle2::MCParticleTrajectory
Class to save the full simulated trajectory of a particle.
Definition: MCParticleTrajectory.h:32
Belle2::MCParticleTrajectory::simplify
void simplify(float distanceTolerance)
Simplify the trajectory using the Ramer-Douglas-Peuker algorithm.
Definition: MCParticleTrajectory.cc:35
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::MCParticleTrajectory::end
iterator end()
return iterator beyond the last point
Definition: MCParticleTrajectory.h:44
Belle2::MCParticleTrajectory::m_points
std::vector< MCTrajectoryPoint > m_points
Collection of points along the trajectory.
Definition: MCParticleTrajectory.h:78
Belle2::RelationsObject
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Definition: RelationsObject.h:443
Belle2::MCParticleTrajectory::const_iterator
std::vector< MCTrajectoryPoint >::const_iterator const_iterator
const iterator definition to allow iteration
Definition: MCParticleTrajectory.h:40
Belle2::MCParticleTrajectory::operator[]
const MCTrajectoryPoint & operator[](size_t index) const
return a point
Definition: MCParticleTrajectory.h:54
Belle2::MCParticleTrajectory::empty
bool empty() const
return true if size()==0
Definition: MCParticleTrajectory.h:52