Belle II Software development
MCParticleTrajectory.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <framework/datastore/RelationsObject.h>
12#include <simulation/dataobjects/MCTrajectoryPoint.h>
13#include <vector>
14
15namespace Belle2 {
22 public:
25
27 typedef std::vector<MCTrajectoryPoint>::iterator iterator;
29 typedef std::vector<MCTrajectoryPoint>::const_iterator const_iterator;
31 iterator begin() { return m_points.begin(); }
33 iterator end() { return m_points.end(); }
35 const_iterator begin() const { return m_points.begin(); }
37 const_iterator end() const { return m_points.end(); }
39 size_t size() const { return m_points.size(); }
41 bool empty() const { return m_points.empty(); }
43 const MCTrajectoryPoint& operator[](size_t index) const { return m_points[index]; }
45 const MCTrajectoryPoint& front() const { return m_points.front(); }
47 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
Class to save the full simulated trajectory of a particle.
MCParticleTrajectory()
Default constructor.
const MCTrajectoryPoint & operator[](size_t index) const
return a point
const MCTrajectoryPoint & back() const
return reference to the last point
size_t size() const
return number of points
const_iterator begin() const
return const iterator to the first point
const MCTrajectoryPoint & front() const
return reference to the first point
std::vector< MCTrajectoryPoint >::const_iterator const_iterator
const iterator definition to allow iteration
void addPoint(float x, float y, float z, float px, float py, float pz)
Add a point to the trajectory.
bool empty() const
return true if size()==0
std::vector< MCTrajectoryPoint >::iterator iterator
iterator definition to allow iteration
ClassDef(MCParticleTrajectory, 1)
Needed to make the ROOT object storable.
iterator end()
return iterator beyond the last point
const_iterator end() const
return const iterator beyond the last point
iterator begin()
return iterator to the first point
void simplify(float distanceTolerance)
Simplify the trajectory using the Ramer-Douglas-Peuker algorithm.
std::vector< MCTrajectoryPoint > m_points
Collection of points along the trajectory.
Defines interface for accessing relations of objects in StoreArray.
Abstract base class for different kinds of events.
Small struct to encode a position/momentum without additional overhead.