Jpp 20.0.0-rc.2
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
8
9#include "JPhysics/JGeane.hh"
10
13
14
15/**
16 * \author mdejong
17 */
18
19namespace JGEOMETRY3D {}
20namespace JPP { using namespace JGEOMETRY3D; }
21
22namespace JGEOMETRY3D {
23
24 using JIO::JReader;
25 using JIO::JWriter;
26 using JPHYSICS::JGeane;
27
28 /**
29 * 3D track with energy.
30 */
31 class JTrack3E :
32 public JTrack3D,
33 public JEnergy
34 {
35 public:
36 /**
37 * Default constructor.
38 */
40 JTrack3D(),
41 JEnergy()
42 {}
43
44
45 /**
46 * Constructor.
47 *
48 * \param track track
49 * \param E energy at position
50 */
51 JTrack3E(const JTrack3D& track,
52 const JEnergy& E) :
53 JTrack3D(track),
54 JEnergy(E)
55 {}
56
57
58 /**
59 * Move position along this track with given velocity.
60 *
61 * \param step step
62 * \param velocity velocity
63 * \param geane energy loss
64 */
65 void move(const double step, const double velocity, const JGeane& geane)
66 {
67 JTrack3D::move(step, velocity);
68
69 setE(geane(getE(), step));
70 }
71
72
73 /**
74 * Read track from input.
75 *
76 * \param in input stream
77 * \param track track
78 * \return input stream
79 */
80 friend inline std::istream& operator>>(std::istream& in, JTrack3E& track)
81 {
82 in >> static_cast<JTrack3D&>(track);
83 in >> static_cast<JEnergy&> (track);
84
85 return in;
86 }
87
88
89 /**
90 * Write track to output.
91 *
92 * \param out output stream
93 * \param track track
94 * \return output stream
95 */
96 friend inline std::ostream& operator<<(std::ostream& out, const JTrack3E& track)
97 {
98 out << static_cast<const JTrack3D&>(track);
99 out << ' ';
100 out << static_cast<const JEnergy&> (track);
101
102 return out;
103 }
104
105
106 /**
107 * Read track from input.
108 *
109 * \param in reader
110 * \param track track
111 * \return reader
112 */
113 friend inline JReader& operator>>(JReader& in, JTrack3E& track)
114 {
115 in >> static_cast<JTrack3D&>(track);
116 in >> static_cast<JEnergy&> (track);
117
118 return in;
119 }
120
121
122 /**
123 * Write track to output.
124 *
125 * \param out writer
126 * \param track track
127 * \return writer
128 */
129 friend inline JWriter& operator<<(JWriter& out, const JTrack3E& track)
130 {
131 out << static_cast<const JTrack3D&>(track);
132 out << static_cast<const JEnergy&> (track);
133
134 return out;
135 }
136 };
137}
138
139#endif
Energy loss of muon.
void setE(const double energy)
Set energy.
double getE() const
Get energy.
void move(const double step, const double velocity)
Move position along this track with given velocity.
Definition JTrack3D.hh:73
3D track with energy.
Definition JTrack3E.hh:34
void move(const double step, const double velocity, const JGeane &geane)
Move position along this track with given velocity.
Definition JTrack3E.hh:65
friend std::istream & operator>>(std::istream &in, JTrack3E &track)
Read track from input.
Definition JTrack3E.hh:80
JTrack3E(const JTrack3D &track, const JEnergy &E)
Constructor.
Definition JTrack3E.hh:51
friend std::ostream & operator<<(std::ostream &out, const JTrack3E &track)
Write track to output.
Definition JTrack3E.hh:96
JTrack3E()
Default constructor.
Definition JTrack3E.hh:39
friend JWriter & operator<<(JWriter &out, const JTrack3E &track)
Write track to output.
Definition JTrack3E.hh:129
friend JReader & operator>>(JReader &in, JTrack3E &track)
Read track from input.
Definition JTrack3E.hh:113
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).