Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JShower3D.hh
Go to the documentation of this file.
1#ifndef __JSHOWER3D__
2#define __JSHOWER3D__
3
4#include <istream>
5#include <ostream>
6
8
10#include "JGeometry3D/JTime.hh"
12
14
15#include "JMath/JMathToolkit.hh"
16
17
18/**
19 * \author mdejong
20 */
21
22namespace JGEOMETRY3D {}
23namespace JPP { using namespace JGEOMETRY3D; }
24
25namespace JGEOMETRY3D {
26
27 using JIO::JReader;
28 using JIO::JWriter;
29
30 /**
31 * 3D shower.
32 */
33 class JShower3D :
34 public JAxis3D,
35 public JTime
36 {
37 public:
38
39 using JTime::getT;
40 using JTime::add;
41 using JTime::sub;
42 using JPosition3D::add;
43 using JPosition3D::sub;
45
46
47 /**
48 * Default constructor.
49 */
51 JAxis3D(),
52 JTime()
53 {}
54
55
56 /**
57 * Constructor.
58 *
59 * \param vertex vertex
60 * \param dir direction
61 */
62 JShower3D(const JVertex3D& vertex,
63 const JVersor3D& dir) :
64 JAxis3D(vertex.getPosition(), dir),
65 JTime(vertex.getT())
66 {}
67
68
69 /**
70 * Get vertex of this track.
71 *
72 * \return vertex
73 */
75 {
76 return JVertex3D(getPosition(), getT());
77 }
78
79
80 /**
81 * Type conversion operator.
82 *
83 * \return vertex
84 */
85 operator JVertex3D() const
86 {
87 return getVertex();
88 }
89
90
91 /**
92 * Get arrival time of Cherenkov light at given position.
93 *
94 * \param pos position [m]
95 * \return time [ns]
96 */
97 inline double getT(const JVector3D& pos) const
98 {
99 using namespace JPHYSICS;
100
101 return this->getT() + JMATH::getDistance(this->getPosition(), pos) * getIndexOfRefraction() * getInverseSpeedOfLight();
102 }
103
104
105 /**
106 * Get photon direction of Cherenkov light on PMT.
107 *
108 * \param pos PMT position
109 * \return direction
110 */
111 inline JVersor3D getDirection(const JVector3D& pos) const
112 {
113 JPosition3D D(pos);
114
115 D.sub(this->getPosition());
116
117 return JDirection3D(D);
118 }
119
120
121 /**
122 * Get cosine angle of impact of Cherenkov light on PMT.
123 *
124 * \param axis PMT axis
125 * \return cosine angle of impact
126 */
127 inline double getDot(const JAxis3D& axis) const
128 {
129 return getDirection(axis.getPosition()).getDot(axis.getDirection());
130 }
131
132
133 /**
134 * Get cosine angle of emission of Cherenkov light on PMT.
135 *
136 * \param pos PMT position
137 * \return cosine angle of impact
138 */
139 inline double getDot(const JVector3D& pos) const
140 {
141 return JDirection3D(pos - getPosition()).getDot(getDirection());
142 }
143
144
145 /**
146 * Read shower from input.
147 *
148 * \param in input stream
149 * \param shower shower
150 * \return input stream
151 */
152 friend inline std::istream& operator>>(std::istream& in, JShower3D& shower)
153 {
154 in >> static_cast<JAxis3D&>(shower);
155 in >> static_cast<JTime&> (shower);
156
157 return in;
158 }
159
160
161 /**
162 * Write shower to output.
163 *
164 * \param out output stream
165 * \param shower shower
166 * \return output stream
167 */
168 friend inline std::ostream& operator<<(std::ostream& out, const JShower3D& shower)
169 {
170 out << static_cast<const JAxis3D&>(shower);
171 out << ' ';
172 out << static_cast<const JTime&> (shower);
173
174 return out;
175 }
176
177
178 /**
179 * Read shower from input.
180 *
181 * \param in reader
182 * \param shower shower
183 * \return reader
184 */
185 friend inline JReader& operator>>(JReader& in, JShower3D& shower)
186 {
187 in >> static_cast<JAxis3D&>(shower);
188 in >> static_cast<JTime&> (shower);
189
190 return in;
191 }
192
193
194 /**
195 * Write shower to output.
196 *
197 * \param out writer
198 * \param shower shower
199 * \return writer
200 */
201 friend inline JWriter& operator<<(JWriter& out, const JShower3D& shower)
202 {
203 out << static_cast<const JAxis3D&>(shower);
204 out << static_cast<const JTime&> (shower);
205
206 return out;
207 }
208 };
209}
210
211#endif
Binary methods for member methods.
Physics constants.
Axis object.
Definition JAxis3D.hh:41
JDirection3D()
Default constructor.
const JDirection3D & getDirection() const
Get direction.
double getDot(const JAngle3D &angle) const
Get dot product.
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
JShower3D(const JVertex3D &vertex, const JVersor3D &dir)
Constructor.
Definition JShower3D.hh:62
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition JShower3D.hh:97
friend std::istream & operator>>(std::istream &in, JShower3D &shower)
Read shower from input.
Definition JShower3D.hh:152
JVertex3D getVertex() const
Get vertex of this track.
Definition JShower3D.hh:74
friend std::ostream & operator<<(std::ostream &out, const JShower3D &shower)
Write shower to output.
Definition JShower3D.hh:168
double getDot(const JVector3D &pos) const
Get cosine angle of emission of Cherenkov light on PMT.
Definition JShower3D.hh:139
JVersor3D getDirection(const JVector3D &pos) const
Get photon direction of Cherenkov light on PMT.
Definition JShower3D.hh:111
JShower3D()
Default constructor.
Definition JShower3D.hh:50
const JDirection3D & getDirection() const
Get direction.
double getT() const
Get time.
double getDot(const JAxis3D &axis) const
Get cosine angle of impact of Cherenkov light on PMT.
Definition JShower3D.hh:127
friend JWriter & operator<<(JWriter &out, const JShower3D &shower)
Write shower to output.
Definition JShower3D.hh:201
friend JReader & operator>>(JReader &in, JShower3D &shower)
Read shower from input.
Definition JShower3D.hh:185
JTime & add(const JTime &value)
Addition operator.
double getT() const
Get time.
JTime & sub(const JTime &value)
Subtraction operator.
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
JVector3D & add(const JVector3D &vector)
Add vector.
Definition JVector3D.hh:142
JVector3D & sub(const JVector3D &vector)
Subtract vector.
Definition JVector3D.hh:158
Data structure for normalised vector in three dimensions.
Definition JVersor3D.hh:28
Interface for binary input.
Interface for binary output.
Auxiliary classes and methods for 3D geometrical objects and operations.
Definition JAngle3D.hh:19
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
Auxiliary methods for light properties of deep-sea water.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).