LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
GeoTrajectory.h
Go to the documentation of this file.
1 
14 #ifndef BASICTOOL_GEOTRAJECTORY_H
15 #define BASICTOOL_GEOTRAJECTORY_H
16 
17 #include "GeoVector.h"
18 
19 namespace geoalgo {
20 
27  class Trajectory : public std::vector<geoalgo::Vector> {
28 
29  public:
30 
32  Trajectory(size_t npoints=0, size_t ndimension=0);
33 
35  virtual ~Trajectory(){}
36 
38  Trajectory(const std::vector<std::vector<double> > &obj);
39 
41  Trajectory(const std::vector<geoalgo::Point_t> &obj);
42 
43  //
44  // Getters
45  //
46  double Length(size_t start_step=0,size_t end_step=0) const;
47  bool IsLonger(double) const;
48  Vector Dir(size_t i=0) const;
49 
50  //
51  // Setters
52  //
53  void push_back(const Point_t& obj);
54 
55  inline Trajectory& operator+=(const Point_t& rhs)
56  { push_back(rhs); return *this; }
57 
58  //
59  // utility
60  //
61  void compat(const Point_t& obj) const;
62  void compat(const Trajectory &obj) const;
63 
64  protected:
65 
67  Vector _Dir_(size_t i) const;
68 
69  public:
70 
71  //
72  // templates
73  //
75  template <class T>
76  void push_back(const T& obj)
77  { Point_t pt(obj); push_back(pt); }
78 
79  public:
80 
82 #ifndef __CINT__
83  friend std::ostream& operator << (std::ostream &o, Trajectory const& a)
84  { o << "Trajectory with " << a.size() << " points " << std::endl;
85  for(auto const& p : a )
86  o << " " << p << std::endl;
87  return o;
88  }
89 #endif
90 
91  };
92 
94 
95 }
96 
97 #endif
98  // end of doxygen group
99 
void push_back(const T &obj)
push_back template
Definition: GeoTrajectory.h:76
void compat(const Point_t &obj) const
Dimensionality check function w/ Trajectory.
virtual ~Trajectory()
Default dtor.
Definition: GeoTrajectory.h:35
Trajectory & operator+=(const Point_t &rhs)
Definition: GeoTrajectory.h:55
Trajectory(size_t npoints=0, size_t ndimension=0)
Default ctor to specify # points and dimension of each point.
void push_back(const Point_t &obj)
push_back overrie w/ dimensionality check
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
Class def header for a class Point and Vector.
TMarker * pt
Definition: egs.C:25
friend std::ostream & operator<<(std::ostream &o, Trajectory const &a)
Streamer.
Definition: GeoTrajectory.h:83
double Length(size_t start_step=0, size_t end_step=0) const
The summed-length along all trajectory points.
Vector Dir(size_t i=0) const
The direction at a specified trajectory point.
Trajectory Trajectory_t
Definition: GeoTrajectory.h:93
bool IsLonger(double) const
Check if the trajectory is longer than specified value.
Vector _Dir_(size_t i) const
Returns a direction vector at a specified trajectory point w/o size check.