Jpp 21.0.1
the software that should make you happy
Loading...
Searching...
No Matches
JRECONSTRUCTION::JPointing Class Reference

Auxiliary class to compare fit results with respect to a reference direction (e.g. true muon). More...

#include <JEvtToolkit.hh>

Inheritance diagram for JRECONSTRUCTION::JPointing:
JGEOMETRY3D::JDirection3D JGEOMETRY3D::JVersor3D JMATH::JMath< JFirst_t, JSecond_t >

Public Member Functions

 JPointing ()
 Default constructor.
 
 JPointing (const JDirection3D &dir)
 Constructor.
 
 JPointing (const JFit &fit)
 Constructor.
 
double getDot (const JFit &fit) const
 Get dot product.
 
double getAngle (const JFit &fit) const
 Get angle between reference direction and fit result.
 
bool operator() (const JFit &first, const JFit &second) const
 Comparison of fit results.
 
template<class T >
T operator() (T __begin, T __end) const
 Select best fit result.
 
double getDot (const JAngle3D &angle) const
 Get dot product.
 
double getDot (const JVector3D &pos) const
 Get dot product.
 
double getDot (const JVersor3Z &dir) const
 Get dot product.
 
double getDot (const JVersor3D &versor) const
 Get dot product.
 
const JDirection3D & getDirection () const
 Get direction.
 
JDirection3D & getDirection ()
 Get direction.
 
void setDirection (const JDirection3D &dir)
 Set direction.
 
 operator JAngle3D () const
 Type conversion operator.
 
 operator JVector3D () const
 Type conversion operator.
 
JDirection3D & transform (const JMatrix3D &T)
 Transform.
 
JDirection3D & rotate (const JRotation3D &R)
 Rotate.
 
JDirection3D & rotate (const JRotation3X &R)
 Rotate around X-axis.
 
JDirection3D & rotate (const JRotation3Y &R)
 Rotate around Y-axis.
 
JDirection3D & rotate (const JRotation3Z &R)
 Rotate around Z-axis.
 
JDirection3D & rotate (const JQuaternion3D &Q)
 Rotate.
 
JDirection3D & rotate_back (const JRotation3D &R)
 Rotate back.
 
JDirection3D & rotate_back (const JRotation3X &R)
 Rotate back around X-axis.
 
JDirection3D & rotate_back (const JRotation3Y &R)
 Rotate back around Y-axis.
 
JDirection3D & rotate_back (const JRotation3Z &R)
 Rotate back around Z-axis.
 
JDirection3D & rotate_back (const JQuaternion3D &Q)
 Rotate back.
 
JVersor3D & negate ()
 Negate versor.
 
bool equals (const JVersor3D &versor, const double precision=std::numeric_limits< double >::min()) const
 Check equality.
 
double getDX () const
 Get x direction.
 
double getDY () const
 Get y direction.
 
double getDZ () const
 Get z direction.
 
double getTheta () const
 Get theta angle.
 
double getPhi () const
 Get phi angle.
 
JVersor3D & getCross (const JVersor3D &first, const JVersor3D &second)
 Get cross product.
 
JVersor3D & normalise ()
 Normalise versor.
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object.
 

Protected Attributes

double __dx
 
double __dy
 
double __dz
 

Detailed Description

Auxiliary class to compare fit results with respect to a reference direction (e.g. true muon).

The sort operation results in an ordered set of fit results with increasing angle between the reference direction and that of the fit results.

Definition at line 719 of file JReconstruction/JEvtToolkit.hh.

Constructor & Destructor Documentation

◆ JPointing() [1/3]

JRECONSTRUCTION::JPointing::JPointing ( )
inline

Default constructor.

Definition at line 729 of file JReconstruction/JEvtToolkit.hh.

730 {}

◆ JPointing() [2/3]

JRECONSTRUCTION::JPointing::JPointing ( const JDirection3D & dir)
inline

Constructor.

Parameters
dirreference direction

Definition at line 738 of file JReconstruction/JEvtToolkit.hh.

738 :
739 JDirection3D(dir)
740 {}
JDirection3D()
Default constructor.

◆ JPointing() [3/3]

JRECONSTRUCTION::JPointing::JPointing ( const JFit & fit)
inline

Constructor.

Parameters
fitfit

Definition at line 748 of file JReconstruction/JEvtToolkit.hh.

748 :
750 {}
JDirection3D getDirection(const JFit &fit)
Get direction.

Member Function Documentation

◆ getDot() [1/5]

double JRECONSTRUCTION::JPointing::getDot ( const JFit & fit) const
inline

Get dot product.

Parameters
fitfit
Returns
dot product

Definition at line 759 of file JReconstruction/JEvtToolkit.hh.

760 {
761 const double dot = JRECONSTRUCTION::getDot(fit, this->getDirection());
762
763 if (dot >= +1.0)
764 return +1.0;
765 else if (dot <= -1.0)
766 return -1.0;
767 else
768 return dot;
769 }
const JDirection3D & getDirection() const
Get direction.
double getDot(const JFit &first, const JFit &second)
Get dot product.

◆ getAngle()

double JRECONSTRUCTION::JPointing::getAngle ( const JFit & fit) const
inline

Get angle between reference direction and fit result.

Parameters
fitfit
Returns
angle [deg]

Definition at line 778 of file JReconstruction/JEvtToolkit.hh.

779 {
780 return acos(this->getDot(fit)) * 180.0 / JMATH::PI;
781 }
double getDot(const JFit &fit) const
Get dot product.
static const double PI
Mathematical constants.

◆ operator()() [1/2]

bool JRECONSTRUCTION::JPointing::operator() ( const JFit & first,
const JFit & second ) const
inline

Comparison of fit results.

Parameters
firstfirst fit
secondsecond fit
Returns
true if first fit better; else false

Definition at line 791 of file JReconstruction/JEvtToolkit.hh.

792 {
793 return this->getDot(first) > this->getDot(second);
794 }

◆ operator()() [2/2]

template<class T >
T JRECONSTRUCTION::JPointing::operator() ( T __begin,
T __end ) const
inline

Select best fit result.

Parameters
__beginbegin of fit results
__endend of fit results
Returns
best fit result

Definition at line 805 of file JReconstruction/JEvtToolkit.hh.

806 {
807 return std::min_element(__begin, __end, *this);
808 }

◆ getDot() [2/5]

double JGEOMETRY3D::JDirection3D::getDot ( const JAngle3D & angle) const
inline

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 335 of file JDirection3D.hh.

336 {
337 return
338 getDX() * angle.getDX() +
339 getDY() * angle.getDY() +
340 getDZ() * angle.getDZ();
341 }
double getDY() const
Get y direction.
Definition JVersor3D.hh:106
double getDX() const
Get x direction.
Definition JVersor3D.hh:95
double getDZ() const
Get z direction.
Definition JVersor3D.hh:117

◆ getDot() [3/5]

double JGEOMETRY3D::JDirection3D::getDot ( const JVector3D & pos) const
inline

Get dot product.

Parameters
posposition
Returns
dot product

Definition at line 350 of file JDirection3D.hh.

351 {
352 return
353 getDX() * pos.getX() +
354 getDY() * pos.getY() +
355 getDZ() * pos.getZ();
356 }

◆ getDot() [4/5]

double JGEOMETRY3D::JDirection3D::getDot ( const JVersor3Z & dir) const
inline

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 365 of file JDirection3D.hh.

366 {
367 return
368 getDX() * dir.getDX() +
369 getDY() * dir.getDY() +
370 getDZ() * dir.getDZ();
371 }

◆ getDot() [5/5]

double JGEOMETRY3D::JVersor3D::getDot ( const JVersor3D & versor) const
inline

Get dot product.

Parameters
versorversor
Returns
dot product

Definition at line 38 of file JVersor3D.hh.

157 {
158 return
159 getDX() * versor.getDX() +
160 getDY() * versor.getDY() +
161 getDZ() * versor.getDZ();
162 }

◆ getDirection() [1/2]

const JDirection3D & JGEOMETRY3D::JDirection3D::getDirection ( ) const
inlineinherited

Get direction.

Returns
direction

Definition at line 107 of file JDirection3D.hh.

108 {
109 return static_cast<const JDirection3D&>(*this);
110 }

◆ getDirection() [2/2]

JDirection3D & JGEOMETRY3D::JDirection3D::getDirection ( )
inlineinherited

Get direction.

Returns
direction

Definition at line 118 of file JDirection3D.hh.

119 {
120 return static_cast<JDirection3D&>(*this);
121 }

◆ setDirection()

void JGEOMETRY3D::JDirection3D::setDirection ( const JDirection3D & dir)
inlineinherited

Set direction.

Parameters
dirdirection

Definition at line 129 of file JDirection3D.hh.

130 {
131 static_cast<JDirection3D&>(*this) = dir;
132 }

◆ operator JAngle3D()

JGEOMETRY3D::JDirection3D::operator JAngle3D ( ) const
inlineinherited

Type conversion operator.

Returns
angle

Definition at line 140 of file JDirection3D.hh.

141 {
142 return JAngle3D(getDX(), getDY(), getDZ());
143 }

◆ operator JVector3D()

JGEOMETRY3D::JDirection3D::operator JVector3D ( ) const
inlineinherited

Type conversion operator.

Returns
position

Definition at line 151 of file JDirection3D.hh.

152 {
153 return JVector3D(getDX(), getDY(), getDZ());
154 }

◆ transform()

JDirection3D & JGEOMETRY3D::JDirection3D::transform ( const JMatrix3D & T)
inlineinherited

Transform.

Parameters
Tmatrix
Returns
this direction

Definition at line 163 of file JDirection3D.hh.

164 {
165 T.transform(__dx, __dy, __dz);
166
167 normalise();
168
169 return *this;
170 }
JVersor3D & normalise()
Normalise versor.
Definition JVersor3D.hh:192

◆ rotate() [1/5]

JDirection3D & JGEOMETRY3D::JDirection3D::rotate ( const JRotation3D & R)
inlineinherited

Rotate.

Parameters
Rrotation matrix
Returns
this direction

Definition at line 179 of file JDirection3D.hh.

180 {
181 R.rotate(__dx, __dy, __dz);
182
183 normalise();
184
185 return *this;
186 }

◆ rotate() [2/5]

JDirection3D & JGEOMETRY3D::JDirection3D::rotate ( const JRotation3X & R)
inlineinherited

Rotate around X-axis.

Parameters
Rrotation matrix
Returns
this direction

Definition at line 211 of file JDirection3D.hh.

212 {
213 R.rotate(__dy, __dz);
214
215 normalise();
216
217 return *this;
218 }

◆ rotate() [3/5]

JDirection3D & JGEOMETRY3D::JDirection3D::rotate ( const JRotation3Y & R)
inlineinherited

Rotate around Y-axis.

Parameters
Rrotation matrix
Returns
this direction

Definition at line 243 of file JDirection3D.hh.

244 {
245 R.rotate(__dx, __dz);
246
247 normalise();
248
249 return *this;
250 }

◆ rotate() [4/5]

JDirection3D & JGEOMETRY3D::JDirection3D::rotate ( const JRotation3Z & R)
inlineinherited

Rotate around Z-axis.

Parameters
Rrotation matrix
Returns
this direction

Definition at line 275 of file JDirection3D.hh.

276 {
277 R.rotate(__dx, __dy);
278
279 normalise();
280
281 return *this;
282 }

◆ rotate() [5/5]

JDirection3D & JGEOMETRY3D::JDirection3D::rotate ( const JQuaternion3D & Q)
inlineinherited

Rotate.

Parameters
Qquaternion
Returns
this position

Definition at line 307 of file JDirection3D.hh.

308 {
309 Q.rotate(__dx, __dy, __dz);
310
311 return *this;
312 }

◆ rotate_back() [1/5]

JDirection3D & JGEOMETRY3D::JDirection3D::rotate_back ( const JRotation3D & R)
inlineinherited

Rotate back.

Parameters
Rrotation matrix
Returns
this direction

Definition at line 195 of file JDirection3D.hh.

196 {
197 R.rotate_back(__dx, __dy, __dz);
198
199 normalise();
200
201 return *this;
202 }

◆ rotate_back() [2/5]

JDirection3D & JGEOMETRY3D::JDirection3D::rotate_back ( const JRotation3X & R)
inlineinherited

Rotate back around X-axis.

Parameters
Rrotation matrix
Returns
this direction

Definition at line 227 of file JDirection3D.hh.

228 {
229 R.rotate_back(__dy, __dz);
230
231 normalise();
232
233 return *this;
234 }

◆ rotate_back() [3/5]

JDirection3D & JGEOMETRY3D::JDirection3D::rotate_back ( const JRotation3Y & R)
inlineinherited

Rotate back around Y-axis.

Parameters
Rrotation matrix
Returns
this direction

Definition at line 259 of file JDirection3D.hh.

260 {
261 R.rotate_back(__dx, __dz);
262
263 normalise();
264
265 return *this;
266 }

◆ rotate_back() [4/5]

JDirection3D & JGEOMETRY3D::JDirection3D::rotate_back ( const JRotation3Z & R)
inlineinherited

Rotate back around Z-axis.

Parameters
Rrotation matrix
Returns
this direction

Definition at line 291 of file JDirection3D.hh.

292 {
293 R.rotate_back(__dx, __dy);
294
295 normalise();
296
297 return *this;
298 }

◆ rotate_back() [5/5]

JDirection3D & JGEOMETRY3D::JDirection3D::rotate_back ( const JQuaternion3D & Q)
inlineinherited

Rotate back.

Parameters
Qquaternion
Returns
this position

Definition at line 321 of file JDirection3D.hh.

322 {
323 Q.rotate_back(__dx, __dy, __dz);
324
325 return *this;
326 }

◆ negate()

JVersor3D & JGEOMETRY3D::JVersor3D::negate ( )
inlineinherited

Negate versor.

Returns
this versor

Definition at line 64 of file JVersor3D.hh.

65 {
66 __dx = -__dx;
67 __dy = -__dy;
68 __dz = -__dz;
69
70 return *this;
71 }

◆ equals()

bool JGEOMETRY3D::JVersor3D::equals ( const JVersor3D & versor,
const double precision = std::numeric_limits<double>::min() ) const
inlineinherited

Check equality.

Parameters
versorversor
precisionprecision
Returns
true if versors are equal; else false

Definition at line 81 of file JVersor3D.hh.

83 {
84 return (fabs(getDX() - versor.getDX()) <= precision &&
85 fabs(getDY() - versor.getDY()) <= precision &&
86 fabs(getDZ() - versor.getDZ()) <= precision);
87 }

◆ getDX()

double JGEOMETRY3D::JVersor3D::getDX ( ) const
inlineinherited

Get x direction.

Returns
x direction

Definition at line 95 of file JVersor3D.hh.

96 {
97 return __dx;
98 }

◆ getDY()

double JGEOMETRY3D::JVersor3D::getDY ( ) const
inlineinherited

Get y direction.

Returns
y direction

Definition at line 106 of file JVersor3D.hh.

107 {
108 return __dy;
109 }

◆ getDZ()

double JGEOMETRY3D::JVersor3D::getDZ ( ) const
inlineinherited

Get z direction.

Returns
z direction

Definition at line 117 of file JVersor3D.hh.

118 {
119 return __dz;
120 }

◆ getTheta()

double JGEOMETRY3D::JVersor3D::getTheta ( ) const
inlineinherited

Get theta angle.

Returns
theta angle [rad]

Definition at line 128 of file JVersor3D.hh.

129 {
130 if (__dz > +1.0)
131 return 0.0;
132 else if (__dz < -1.0)
133 return JMATH::PI;
134 else
135 return acos(__dz);
136 }

◆ getPhi()

double JGEOMETRY3D::JVersor3D::getPhi ( ) const
inlineinherited

Get phi angle.

Returns
phi angle [rad]

Definition at line 144 of file JVersor3D.hh.

145 {
146 return atan2(__dy, __dx);
147 }

◆ getCross()

JVersor3D & JGEOMETRY3D::JVersor3D::getCross ( const JVersor3D & first,
const JVersor3D & second )
inlineinherited

Get cross product.

Note that this versor should not overlap with the first or second versor,

Parameters
firstfirst versor
secondsecond versor
Returns
this versor

Definition at line 173 of file JVersor3D.hh.

175 {
176 __dx = first .getDY() * second.getDZ() - second.getDY() * first .getDZ();
177 __dy = second.getDX() * first .getDZ() - first .getDX() * second.getDZ();
178 __dz = first .getDX() * second.getDY() - second.getDX() * first .getDY();
179
180 normalise();
181
182 return *this;
183 }

◆ normalise()

JVersor3D & JGEOMETRY3D::JVersor3D::normalise ( )
inlineinherited

Normalise versor.

This operation may set the result to the unit z-vector.

Returns
this versor

Definition at line 192 of file JVersor3D.hh.

193 {
194 const double v = sqrt(getDX()*getDX() + getDY()*getDY() + getDZ()*getDZ());
195
196 if (v != 0.0) {
197 __dx /= v;
198 __dy /= v;
199 __dz /= v;
200 }
201
202 return *this;
203 }

◆ mul()

template<class JFirst_t , class JSecond_t >
JFirst_t & JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t & object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355 {
356 return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357 }

Member Data Documentation

◆ __dx

double JGEOMETRY3D::JVersor3D::__dx
protectedinherited

Definition at line 206 of file JVersor3D.hh.

◆ __dy

double JGEOMETRY3D::JVersor3D::__dy
protectedinherited

Definition at line 207 of file JVersor3D.hh.

◆ __dz

double JGEOMETRY3D::JVersor3D::__dz
protectedinherited

Definition at line 208 of file JVersor3D.hh.


The documentation for this class was generated from the following file: