Jpp  18.2.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 "JLang/JManip.hh"
10 #include "JPhysics/JGeane.hh"
11 
12 
13 /**
14  * \author mdejong
15  */
16 
17 namespace JGEOMETRY3D {}
18 namespace JPP { using namespace JGEOMETRY3D; }
19 
20 namespace 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
friend JReader & operator>>(JReader &in, JTrack3E &track)
Read track from input.
Definition: JTrack3E.hh:167
Interface for binary output.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
Definition: JMuonPostfit.sh:40
JTrack3E(const JTrack3D &track, const double E)
Constructor.
Definition: JTrack3E.hh:49
JTrack3E()
Default constructor.
Definition: JTrack3E.hh:37
Energy loss of muon.
friend JWriter & operator<<(JWriter &out, const JTrack3E &track)
Write track to output.
Definition: JTrack3E.hh:183
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:30
void move(const double step, const double velocity, const JGeane &geane)
Move vertex along this track with given velocity.
Definition: JTrack3E.hh:117
Auxiliary class to temporarily define format specifications.
Definition: JManip.hh:632
double getE() const
Get energy.
Definition: JTrack3E.hh:93
JTrack3E(const JVertex3D &vertex, const JVersor3D &dir, const double E)
Constructor.
Definition: JTrack3E.hh:80
Data structure for vector in three dimensions.
Definition: JVector3D.hh:34
JTrack3E(const JVector3D &pos, const JVersor3D &dir, const JTime &t0, const double E)
Constructor.
Definition: JTrack3E.hh:64
void setE(const double E)
Set energy.
Definition: JTrack3E.hh:104
Interface for binary input.
Interface for muon energy loss.
Definition: JGeane.hh:39
I/O manipulators.
friend std::istream & operator>>(std::istream &in, JTrack3E &track)
Read track from input.
Definition: JTrack3E.hh:132
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:26
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
Data structure for format specifications.
Definition: JManip.hh:522
friend std::ostream & operator<<(std::ostream &out, const JTrack3E &track)
Write track to output.
Definition: JTrack3E.hh:148