Jpp  17.3.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JLine1Z.hh
Go to the documentation of this file.
1 #ifndef __JLINE1Z__
2 #define __JLINE1Z__
3 
6 #include "JGeometry3D/JAxis3D.hh"
7 #include "JPhysics/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 JPP;
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 JPP;
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 JPP;
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
double getDistance(const JVector3D &pos) const
Get distance.
Definition: JLine1Z.hh:102
double getT() const
Get time.
double getKappaC()
Get average R-dependence of arrival time of Cherenkov light (a.k.a.
const JDirection3D & getDirection() const
Get direction.
double getZ(const JPosition3D &pos) const
Get point of emission of Cherenkov light along muon path.
Definition: JLine1Z.hh:134
static parameter_type pT()
Definition: JLine1Z.hh:182
double getDistanceSquared(const JVector3D &pos) const
Get distance squared.
Definition: JLine1Z.hh:87
Axis object.
Definition: JAxis3D.hh:38
double getCosThetaC()
Get average cosine of Cherenkov angle of water corresponding to group velocity.
JLine1Z(const JVector3D &pos, const double t)
Constructor.
Definition: JLine1Z.hh:50
Data structure for vector in three dimensions.
Definition: JVector3D.hh:34
double JLine1Z::* parameter_type
Definition: JLine1Z.hh:178
void move(const double step, const double velocity)
Move vertex along this line with given velocity.
Definition: JLine1Z.hh:62
Physics constants.
double getY() const
Get y position.
Definition: JVector3D.hh:104
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:130
static parameter_type pY()
Definition: JLine1Z.hh:181
JLine1Z()
Default constructor.
Definition: JLine1Z.hh:39
static parameter_type pX()
Definition: JLine1Z.hh:180
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition: JDataQuality.sh:41
double getDot(const JAxis3D &axis) const
Get cosine angle of impact of Cherenkov light on PMT.
Definition: JLine1Z.hh:172
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition: JLine1Z.hh:114
const double getInverseSpeedOfLight()
Get inverse speed of light.
void setZ(const double z, const double velocity)
Set z-position of vertex.
Definition: JLine1Z.hh:75
Data structure for fit of straight line paralel to z-axis.
Definition: JLine1Z.hh:27
double getX() const
Get x position.
Definition: JVector3D.hh:94
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
JVersor3D getDirection(const JVector3D &pos) const
Get photon direction of Cherenkov light on PMT.
Definition: JLine1Z.hh:148
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:26
double getZ() const
Get z position.
Definition: JVector3D.hh:115
double getSinThetaC()
Get average sine of Cherenkov angle of water corresponding to group velocity.