Jpp
JLine1Z.hh
Go to the documentation of this file.
1 #ifndef __JLINE1Z__
2 #define __JLINE1Z__
3 
6 #include "JGeometry3D/JAxis3D.hh"
7 #include "JTools/JConstants.hh"
8 
9 
10 /**
11  * \author mdejong
12  */
13 
14 namespace JFIT {}
15 namespace JPP { using namespace JFIT; }
16 
17 namespace JFIT {
18 
22 
23 
24  /**
25  * Data structure for fit of straight line paralel to z-axis.
26  */
27  class JLine1Z :
28  public JVertex3D
29  {
30  public:
31 
32  using JVertex3D::getZ;
33  using JVertex3D::getT;
34 
35 
36  /**
37  * Default constructor.
38  */
39  JLine1Z() :
40  JVertex3D()
41  {}
42 
43 
44  /**
45  * Constructor.
46  *
47  * \param pos position
48  * \param t time at position
49  */
50  JLine1Z(const JVector3D& pos,
51  const double t) :
52  JVertex3D(pos, t)
53  {}
54 
55 
56  /**
57  * Move vertex along this line with given velocity.
58  *
59  * \param step step
60  * \param velocity velocity
61  */
62  void move(const double step, const double velocity)
63  {
64  __z += step;
65  __t += step / velocity;
66  }
67 
68 
69  /**
70  * Set z-position of vertex.
71  *
72  * \param z z-position
73  * \param velocity velocity
74  */
75  void setZ(const double z, const double velocity)
76  {
77  move(z - getZ(), velocity);
78  }
79 
80 
81  /**
82  * Get distance squared.
83  *
84  * \param pos position
85  * \return square of distance
86  */
87  inline double getDistanceSquared(const JVector3D& pos) const
88  {
89  const double dx = pos.getX() - this->getX();
90  const double dy = pos.getY() - this->getY();
91 
92  return dx*dx + dy*dy;
93  }
94 
95 
96  /**
97  * Get distance.
98  *
99  * \param pos position
100  * \return distance
101  */
102  inline double getDistance(const JVector3D& pos) const
103  {
104  return sqrt(this->getDistanceSquared(pos));
105  }
106 
107 
108  /**
109  * Get arrival time of Cherenkov light at given position.
110  *
111  * \param pos position [m]
112  * \return time [ns]
113  */
114  inline double getT(const JVector3D& pos) const
115  {
116  using namespace JTOOLS;
117 
118  const double dx = pos.getX() - this->getX();
119  const double dy = pos.getY() - this->getY();
120  const double dz = pos.getZ() - this->getZ();
121 
122  const double R = sqrt(dx*dx + dy*dy);
123 
124  return this->getT() + (dz + R * getKappaC()) * getInverseSpeedOfLight();
125  }
126 
127 
128  /**
129  * Get point of emission of Cherenkov light along muon path.
130  *
131  * \param pos position
132  * \return position along muon path
133  */
134  double getZ(const JPosition3D& pos) const
135  {
136  using namespace JTOOLS;
137 
138  return pos.getZ() - this->getDistance(pos) / getTanThetaC();
139  }
140 
141 
142  /**
143  * Get photon direction of Cherenkov light on PMT.
144  *
145  * \param pos PMT position
146  * \return direction
147  */
148  inline JVersor3D getDirection(const JVector3D& pos) const
149  {
150  using namespace JTOOLS;
151 
152  double dx = pos.getX() - this->getX();
153  double dy = pos.getY() - this->getY();
154 
155  const double R = sqrt(dx*dx + dy*dy);
156 
157  dx *= getSinThetaC() / R;
158  dy *= getSinThetaC() / R;
159 
160  const double dz = getCosThetaC();
161 
162  return JVersor3D(dx,dy,dz);
163  }
164 
165 
166  /**
167  * Get cosine angle of impact of Cherenkov light on PMT.
168  *
169  * \param axis PMT axis
170  * \return cosine angle of impact
171  */
172  inline double getDot(const JAxis3D& axis) const
173  {
174  return getDirection(axis.getPosition()).getDot(axis.getDirection());
175  }
176 
177 
178  typedef double JLine1Z::*parameter_type;
179 
180  static parameter_type pX() { return &JLine1Z::__x; }
181  static parameter_type pY() { return &JLine1Z::__y; }
182  static parameter_type pT() { return &JLine1Z::__t; }
183  };
184 }
185 
186 #endif
JFIT::JLine1Z::getDirection
JVersor3D getDirection(const JVector3D &pos) const
Get photon direction of Cherenkov light on PMT.
Definition: JLine1Z.hh:148
JTOOLS::getSinThetaC
double getSinThetaC()
Get average sine of Cherenkov angle of water.
Definition: JConstants.hh:155
JFIT::JLine1Z::getT
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition: JLine1Z.hh:114
JFIT::JLine1Z::JLine1Z
JLine1Z(const JVector3D &pos, const double t)
Constructor.
Definition: JLine1Z.hh:50
JVertex3D.hh
JFIT
Auxiliary classes and methods for linear and iterative data regression.
Definition: JEnergy.hh:15
JGEOMETRY3D::JVector3D::__y
double __y
Definition: JVector3D.hh:310
JGEOMETRY3D::JVertex3D
3D vertex.
Definition: JVertex3D.hh:31
JGEOMETRY3D::JDirection3D::getDirection
const JDirection3D & getDirection() const
Get direction.
Definition: JDirection3D.hh:106
JGEOMETRY3D::JVector3D::getZ
double getZ() const
Get z position.
Definition: JVector3D.hh:114
JGEOMETRY3D::JAxis3D
Axis object.
Definition: JAxis3D.hh:38
JGEOMETRY3D::JTime::getT
double getT() const
Get time.
Definition: JGeometry3D/JTime.hh:121
JTOOLS::getCosThetaC
double getCosThetaC()
Get average cosine of Cherenkov angle of water.
Definition: JConstants.hh:144
JGEOMETRY3D::JVersor3D
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:23
JFIT::JLine1Z::pY
static parameter_type pY()
Definition: JLine1Z.hh:181
JFIT::JLine1Z::getDistanceSquared
double getDistanceSquared(const JVector3D &pos) const
Get distance squared.
Definition: JLine1Z.hh:87
JAxis3D.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JFIT::JLine1Z::pT
static parameter_type pT()
Definition: JLine1Z.hh:182
JGEOMETRY3D::JVector3D
Data structure for vector in three dimensions.
Definition: JVector3D.hh:33
JTOOLS::getInverseSpeedOfLight
const double getInverseSpeedOfLight()
Get inverse speed of light.
Definition: JConstants.hh:100
JGEOMETRY3D::JTime::__t
double __t
Definition: JGeometry3D/JTime.hh:188
JConstants.hh
JGEOMETRY3D::JPosition3D
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JFIT::JLine1Z
Data structure for fit of straight line paralel to z-axis.
Definition: JLine1Z.hh:27
JFIT::JLine1Z::parameter_type
double JLine1Z::* parameter_type
Definition: JLine1Z.hh:178
JTOOLS::getTanThetaC
double getTanThetaC()
Get average tangent of Cherenkov angle of water.
Definition: JConstants.hh:133
JFIT::JLine1Z::getDot
double getDot(const JAxis3D &axis) const
Get cosine angle of impact of Cherenkov light on PMT.
Definition: JLine1Z.hh:172
JFIT::JLine1Z::JLine1Z
JLine1Z()
Default constructor.
Definition: JLine1Z.hh:39
JTOOLS::getKappaC
double getKappaC()
Get average kappa of Cherenkov light in water.
Definition: JConstants.hh:166
JGEOMETRY3D::JPosition3D::getPosition
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
JFIT::JLine1Z::getZ
double getZ(const JPosition3D &pos) const
Get point of emission of Cherenkov light along muon path.
Definition: JLine1Z.hh:134
JGEOMETRY3D::JVector3D::getY
double getY() const
Get y position.
Definition: JVector3D.hh:103
JFIT::JLine1Z::move
void move(const double step, const double velocity)
Move vertex along this line with given velocity.
Definition: JLine1Z.hh:62
JGEOMETRY3D::JVector3D::__z
double __z
Definition: JVector3D.hh:311
JFIT::JLine1Z::pX
static parameter_type pX()
Definition: JLine1Z.hh:180
JGEOMETRY3D::JVector3D::__x
double __x
Definition: JVector3D.hh:309
JGEOMETRY3D::JVector3D::getX
double getX() const
Get x position.
Definition: JVector3D.hh:93
JVersor3D.hh
JTOOLS
Auxiliary classes and methods for multi-dimensional interpolations and histograms.
Definition: JAbstractCollection.hh:9
JFIT::JLine1Z::getDistance
double getDistance(const JVector3D &pos) const
Get distance.
Definition: JLine1Z.hh:102
JFIT::JLine1Z::setZ
void setZ(const double z, const double velocity)
Set z-position of vertex.
Definition: JLine1Z.hh:75