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 "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  * Constructor.
57  *
58  * \param pos position
59  * \param dir direction
60  * \param t0 time at vertex
61  * \param E energy at vertex
62  */
63  JTrack3E(const JVector3D& pos,
64  const JVersor3D& dir,
65  const JTime& t0,
66  const double E) :
67  JTrack3D(pos, dir, t0),
68  __E(E)
69  {}
70 
71 
72  /**
73  * Constructor.
74  *
75  * \param vertex vertex
76  * \param dir direction
77  * \param E energy at vertex
78  */
79  JTrack3E(const JVertex3D& vertex,
80  const JVersor3D& dir,
81  const double E) :
82  JTrack3D(vertex, dir),
83  __E(E)
84  {}
85 
86 
87  /**
88  * Get energy.
89  *
90  * \return energy
91  */
92  inline double getE() const
93  {
94  return __E;
95  }
96 
97 
98  /**
99  * Move vertex along this track with given velocity.
100  *
101  * \param step step
102  * \param velocity velocity
103  * \param geane energy loss
104  */
105  void move(const double step, const double velocity, const JGeane& geane)
106  {
107  JTrack3D::move(step, velocity);
108 
109  __E = geane(__E, step);
110  }
111 
112 
113  /**
114  * Read track from input.
115  *
116  * \param in input stream
117  * \param track track
118  * \return input stream
119  */
120  friend inline std::istream& operator>>(std::istream& in, JTrack3E& track)
121  {
122  in >> static_cast<JTrack3D&>(track);
123  in >> track.__E;
124 
125  return in;
126  }
127 
128 
129  /**
130  * Write track to output.
131  *
132  * \param out output stream
133  * \param track track
134  * \return output stream
135  */
136  friend inline std::ostream& operator<<(std::ostream& out, const JTrack3E& track)
137  {
138  out << static_cast<const JTrack3D&>(track);
139  out << ' ';
140  out << track.__E;
141 
142  return out;
143  }
144 
145 
146  /**
147  * Read track from input.
148  *
149  * \param in reader
150  * \param track track
151  * \return reader
152  */
153  friend inline JReader& operator>>(JReader& in, JTrack3E& track)
154  {
155  in >> static_cast<JTrack3D&>(track);
156  in >> track.__E;
157 
158  return in;
159  }
160 
161 
162  /**
163  * Write track to output.
164  *
165  * \param out writer
166  * \param track track
167  * \return writer
168  */
169  friend inline JWriter& operator<<(JWriter& out, const JTrack3E& track)
170  {
171  out << static_cast<const JTrack3D&>(track);
172  out << track.__E;
173 
174  return out;
175  }
176 
177  protected:
178  double __E;
179  };
180 }
181 
182 #endif
friend JReader & operator>>(JReader &in, JTrack3E &track)
Read track from input.
Definition: JTrack3E.hh:153
Interface for binary output.
JTrack3E(const JTrack3D &track, const double E)
Constructor.
Definition: JTrack3E.hh:48
JTrack3E()
Default constructor.
Definition: JTrack3E.hh:36
Energy loss of muon.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
friend JWriter & operator<<(JWriter &out, const JTrack3E &track)
Write track to output.
Definition: JTrack3E.hh:169
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:29
void move(const double step, const double velocity, const JGeane &geane)
Move vertex along this track with given velocity.
Definition: JTrack3E.hh:105
double getE() const
Get energy.
Definition: JTrack3E.hh:92
JTrack3E(const JVertex3D &vertex, const JVersor3D &dir, const double E)
Constructor.
Definition: JTrack3E.hh:79
Data structure for vector in three dimensions.
Definition: JVector3D.hh:33
JTrack3E(const JVector3D &pos, const JVersor3D &dir, const JTime &t0, const double E)
Constructor.
Definition: JTrack3E.hh:63
Interface for binary input.
Interface for muon energy loss.
Definition: JGeane.hh:42
friend std::istream & operator>>(std::istream &in, JTrack3E &track)
Read track from input.
Definition: JTrack3E.hh:120
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:23
friend std::ostream & operator<<(std::ostream &out, const JTrack3E &track)
Write track to output.
Definition: JTrack3E.hh:136
then usage $script[input file[working directory[option]]] nWhere option can be E
Definition: JMuonPostfit.sh:37