Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JTrack3E.hh
Go to the documentation of this file.
1#ifndef __JTRACK3E__
2#define __JTRACK3E__
3
4#include <istream>
5#include <ostream>
6
9#include "JLang/JManip.hh"
10#include "JPhysics/JGeane.hh"
11
12
13/**
14 * \author mdejong
15 */
16
17namespace JGEOMETRY3D {}
18namespace JPP { using namespace JGEOMETRY3D; }
19
20namespace JGEOMETRY3D {
21
22 using JIO::JReader;
23 using JIO::JWriter;
24 using JPHYSICS::JGeane;
25
26
27 /**
28 * 3D track with energy.
29 */
30 class JTrack3E :
31 public JTrack3D
32 {
33 public:
34 /**
35 * Default constructor.
36 */
38 JTrack3D(),
39 __E(0.0)
40 {}
41
42
43 /**
44 * Constructor.
45 *
46 * \param track track
47 * \param E energy at vertex
48 */
49 JTrack3E(const JTrack3D& track,
50 const double E) :
51 JTrack3D(track),
52 __E(E)
53 {}
54
55
56 /**
57 * Constructor.
58 *
59 * \param pos position
60 * \param dir direction
61 * \param t0 time at vertex
62 * \param E energy at vertex
63 */
64 JTrack3E(const JVector3D& pos,
65 const JVersor3D& dir,
66 const JTime& t0,
67 const double E) :
68 JTrack3D(pos, dir, t0),
69 __E(E)
70 {}
71
72
73 /**
74 * Constructor.
75 *
76 * \param vertex vertex
77 * \param dir direction
78 * \param E energy at vertex
79 */
80 JTrack3E(const JVertex3D& vertex,
81 const JVersor3D& dir,
82 const double E) :
83 JTrack3D(vertex, dir),
84 __E(E)
85 {}
86
87
88 /**
89 * Get energy.
90 *
91 * \return energy
92 */
93 inline double getE() const
94 {
95 return __E;
96 }
97
98
99 /**
100 * Set energy.
101 *
102 * \param E energy
103 */
104 inline void setE(const double E)
105 {
106 __E = E;
107 }
108
109
110 /**
111 * Move vertex along this track with given velocity.
112 *
113 * \param step step
114 * \param velocity velocity
115 * \param geane energy loss
116 */
117 void move(const double step, const double velocity, const JGeane& geane)
118 {
119 JTrack3D::move(step, velocity);
120
121 __E = geane(__E, step);
122 }
123
124
125 /**
126 * Read track from input.
127 *
128 * \param in input stream
129 * \param track track
130 * \return input stream
131 */
132 friend inline std::istream& operator>>(std::istream& in, JTrack3E& track)
133 {
134 in >> static_cast<JTrack3D&>(track);
135 in >> track.__E;
136
137 return in;
138 }
139
140
141 /**
142 * Write track to output.
143 *
144 * \param out output stream
145 * \param track track
146 * \return output stream
147 */
148 friend inline std::ostream& operator<<(std::ostream& out, const JTrack3E& track)
149 {
150 const JFormat format(out, getFormat<JTrack3E>(JFormat_t(9, 3, std::ios::fixed | std::ios::showpos)));
151
152 out << static_cast<const JTrack3D&>(track);
153 out << ' ';
154 out << track.__E;
155
156 return out;
157 }
158
159
160 /**
161 * Read track from input.
162 *
163 * \param in reader
164 * \param track track
165 * \return reader
166 */
167 friend inline JReader& operator>>(JReader& in, JTrack3E& track)
168 {
169 in >> static_cast<JTrack3D&>(track);
170 in >> track.__E;
171
172 return in;
173 }
174
175
176 /**
177 * Write track to output.
178 *
179 * \param out writer
180 * \param track track
181 * \return writer
182 */
183 friend inline JWriter& operator<<(JWriter& out, const JTrack3E& track)
184 {
185 out << static_cast<const JTrack3D&>(track);
186 out << track.__E;
187
188 return out;
189 }
190
191 protected:
192 double __E;
193 };
194}
195
196#endif
Energy loss of muon.
I/O manipulators.
JFormat_t & getFormat()
Get format for given type.
Definition JManip.hh:682
void move(const double step, const double velocity)
Move vertex along this track with given velocity.
Definition JTrack3D.hh:112
3D track with energy.
Definition JTrack3E.hh:32
JTrack3E(const JTrack3D &track, const double E)
Constructor.
Definition JTrack3E.hh:49
void move(const double step, const double velocity, const JGeane &geane)
Move vertex along this track with given velocity.
Definition JTrack3E.hh:117
friend std::istream & operator>>(std::istream &in, JTrack3E &track)
Read track from input.
Definition JTrack3E.hh:132
friend std::ostream & operator<<(std::ostream &out, const JTrack3E &track)
Write track to output.
Definition JTrack3E.hh:148
JTrack3E()
Default constructor.
Definition JTrack3E.hh:37
JTrack3E(const JVertex3D &vertex, const JVersor3D &dir, const double E)
Constructor.
Definition JTrack3E.hh:80
JTrack3E(const JVector3D &pos, const JVersor3D &dir, const JTime &t0, const double E)
Constructor.
Definition JTrack3E.hh:64
friend JWriter & operator<<(JWriter &out, const JTrack3E &track)
Write track to output.
Definition JTrack3E.hh:183
void setE(const double E)
Set energy.
Definition JTrack3E.hh:104
double getE() const
Get energy.
Definition JTrack3E.hh:93
friend JReader & operator>>(JReader &in, JTrack3E &track)
Read track from input.
Definition JTrack3E.hh:167
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
Data structure for normalised vector in three dimensions.
Definition JVersor3D.hh:28
Interface for binary input.
Interface for binary output.
Interface for muon energy loss.
Definition JGeane.hh:39
Auxiliary classes and methods for 3D geometrical objects and operations.
Definition JAngle3D.hh:19
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Data structure for format specifications.
Definition JManip.hh:524
Auxiliary class to temporarily define format specifications.
Definition JManip.hh:636