Jpp
 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  * Move vertex along this track with given velocity.
101  *
102  * \param step step
103  * \param velocity velocity
104  * \param geane energy loss
105  */
106  void move(const double step, const double velocity, const JGeane& geane)
107  {
108  JTrack3D::move(step, velocity);
109 
110  __E = geane(__E, step);
111  }
112 
113 
114  /**
115  * Read track from input.
116  *
117  * \param in input stream
118  * \param track track
119  * \return input stream
120  */
121  friend inline std::istream& operator>>(std::istream& 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 output stream
134  * \param track track
135  * \return output stream
136  */
137  friend inline std::ostream& operator<<(std::ostream& out, const JTrack3E& track)
138  {
139  const JFormat format(out, getFormat<JTrack3E>(JFormat_t(9, 3, std::ios::fixed | std::ios::showpos)));
140 
141  out << static_cast<const JTrack3D&>(track);
142  out << ' ';
143  out << track.__E;
144 
145  return out;
146  }
147 
148 
149  /**
150  * Read track from input.
151  *
152  * \param in reader
153  * \param track track
154  * \return reader
155  */
156  friend inline JReader& operator>>(JReader& in, JTrack3E& track)
157  {
158  in >> static_cast<JTrack3D&>(track);
159  in >> track.__E;
160 
161  return in;
162  }
163 
164 
165  /**
166  * Write track to output.
167  *
168  * \param out writer
169  * \param track track
170  * \return writer
171  */
172  friend inline JWriter& operator<<(JWriter& out, const JTrack3E& track)
173  {
174  out << static_cast<const JTrack3D&>(track);
175  out << track.__E;
176 
177  return out;
178  }
179 
180  protected:
181  double __E;
182  };
183 }
184 
185 #endif
friend JReader & operator>>(JReader &in, JTrack3E &track)
Read track from input.
Definition: JTrack3E.hh:156
Interface for binary output.
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:172
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:106
Auxiliary class to temporarily define format specifications.
Definition: JManip.hh:631
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
Interface for binary input.
Interface for muon energy loss.
Definition: JGeane.hh:37
I/O manipulators.
friend std::istream & operator>>(std::istream &in, JTrack3E &track)
Read track from input.
Definition: JTrack3E.hh:121
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 source JAcoustics sh $DETECTOR_ID typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:36
Data structure for format specifications.
Definition: JManip.hh:521
friend std::ostream & operator<<(std::ostream &out, const JTrack3E &track)
Write track to output.
Definition: JTrack3E.hh:137
then usage $script[input file[working directory[option]]] nWhere option can be E
Definition: JMuonPostfit.sh:37