Jpp
JTrack3E.hh
Go to the documentation of this file.
1 #ifndef __JTRACK3E__
2 #define __JTRACK3E__
3 
4 #include <istream>
5 #include <ostream>
6 
8 #include "JIO/JSerialisable.hh"
9 #include "JPhysics/JGeane.hh"
10 
11 
12 /**
13  * \author mdejong
14  */
15 
16 namespace JGEOMETRY3D {}
17 namespace JPP { using namespace JGEOMETRY3D; }
18 
19 namespace JGEOMETRY3D {
20 
21  using JIO::JReader;
22  using JIO::JWriter;
23  using JPHYSICS::JGeane;
24 
25 
26  /**
27  * 3D track with energy.
28  */
29  class JTrack3E :
30  public JTrack3D
31  {
32  public:
33  /**
34  * Default constructor.
35  */
37  JTrack3D(),
38  __E(0.0)
39  {}
40 
41 
42  /**
43  * Constructor.
44  *
45  * \param track track
46  * \param E energy at vertex
47  */
48  JTrack3E(const JTrack3D& track,
49  const double E) :
50  JTrack3D(track),
51  __E(E)
52  {}
53 
54 
55  /**
56  * Get energy.
57  *
58  * \return energy
59  */
60  inline double getE() const
61  {
62  return __E;
63  }
64 
65 
66  /**
67  * Move vertex along this track with given velocity.
68  *
69  * \param step step
70  * \param velocity velocity
71  * \param geane energy loss
72  */
73  void move(const double step, const double velocity, const JGeane& geane)
74  {
75  JTrack3D::move(step, velocity);
76 
77  __E = geane(__E, step);
78  }
79 
80 
81  /**
82  * Read track from input.
83  *
84  * \param in input stream
85  * \param track track
86  * \return input stream
87  */
88  friend inline std::istream& operator>>(std::istream& in, JTrack3E& track)
89  {
90  in >> static_cast<JTrack3D&>(track);
91  in >> track.__E;
92 
93  return in;
94  }
95 
96 
97  /**
98  * Write track to output.
99  *
100  * \param out output stream
101  * \param track track
102  * \return output stream
103  */
104  friend inline std::ostream& operator<<(std::ostream& out, const JTrack3E& track)
105  {
106  out << static_cast<const JTrack3D&>(track);
107  out << ' ';
108  out << track.__E;
109 
110  return out;
111  }
112 
113 
114  /**
115  * Read track from input.
116  *
117  * \param in reader
118  * \param track track
119  * \return reader
120  */
121  friend inline JReader& operator>>(JReader& in, JTrack3E& track)
122  {
123  in >> static_cast<JTrack3D&>(track);
124  in >> track.__E;
125 
126  return in;
127  }
128 
129 
130  /**
131  * Write track to output.
132  *
133  * \param out writer
134  * \param track track
135  * \return writer
136  */
137  friend inline JWriter& operator<<(JWriter& out, const JTrack3E& track)
138  {
139  out << static_cast<const JTrack3D&>(track);
140  out << track.__E;
141 
142  return out;
143  }
144 
145  protected:
146  double __E;
147  };
148 }
149 
150 #endif
JGEOMETRY3D::JTrack3E::operator>>
friend std::istream & operator>>(std::istream &in, JTrack3E &track)
Read track from input.
Definition: JTrack3E.hh:88
JGEOMETRY3D::JTrack3E::__E
double __E
Definition: JTrack3E.hh:146
JGEOMETRY3D::JTrack3E::operator>>
friend JReader & operator>>(JReader &in, JTrack3E &track)
Read track from input.
Definition: JTrack3E.hh:121
JIO::JReader
Interface for binary input.
Definition: JSerialisable.hh:62
JGeane.hh
JGEOMETRY3D::JTrack3D::move
void move(const double step, const double velocity)
Move vertex along this track with given velocity.
Definition: JTrack3D.hh:112
JGEOMETRY3D::JTrack3E::JTrack3E
JTrack3E()
Default constructor.
Definition: JTrack3E.hh:36
JGEOMETRY3D::JTrack3E::operator<<
friend std::ostream & operator<<(std::ostream &out, const JTrack3E &track)
Write track to output.
Definition: JTrack3E.hh:104
JTrack3D.hh
JGEOMETRY3D::JTrack3E::operator<<
friend JWriter & operator<<(JWriter &out, const JTrack3E &track)
Write track to output.
Definition: JTrack3E.hh:137
JGEOMETRY3D::JTrack3E::JTrack3E
JTrack3E(const JTrack3D &track, const double E)
Constructor.
Definition: JTrack3E.hh:48
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JSerialisable.hh
JGEOMETRY3D::JTrack3E::move
void move(const double step, const double velocity, const JGeane &geane)
Move vertex along this track with given velocity.
Definition: JTrack3E.hh:73
JIO::JWriter
Interface for binary output.
Definition: JSerialisable.hh:131
JGEOMETRY3D::JTrack3E
3D track with energy.
Definition: JTrack3E.hh:29
JPHYSICS::JGeane
Interface for muon energy loss.
Definition: JGeane.hh:42
JGEOMETRY3D::JTrack3D
3D track.
Definition: JTrack3D.hh:30
JGEOMETRY3D
Auxiliary classes and methods for 3D geometrical objects and operations.
Definition: JAngle3D.hh:18
JGEOMETRY3D::JTrack3E::getE
double getE() const
Get energy.
Definition: JTrack3E.hh:60