Jpp  18.3.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
JSIRENE::JTrack Struct Reference

Muon trajectory. More...

#include <JSireneToolkit.hh>

Inheritance diagram for JSIRENE::JTrack:
std::vector< JPoint >

Public Member Functions

 JTrack (const JPoint &point)
 Constructor. More...
 
double getE (const double z) const
 Get muon energy at given position along trajectory. More...
 
JVector2D getPosition (const double z) const
 Get muon position at given position along trajectory. More...
 

Detailed Description

Muon trajectory.

Definition at line 247 of file JSireneToolkit.hh.

Constructor & Destructor Documentation

JSIRENE::JTrack::JTrack ( const JPoint point)
inline

Constructor.

Parameters
pointmuon starting point

Definition at line 255 of file JSireneToolkit.hh.

255  :
256  std::vector<JPoint>(1, point)
257  {}

Member Function Documentation

double JSIRENE::JTrack::getE ( const double  z) const
inline

Get muon energy at given position along trajectory.

Parameters
zposition [m]
Returns
energy [GeV]

Definition at line 266 of file JSireneToolkit.hh.

267  {
268  if (!this->empty()) {
269 
270  const_iterator p = lower_bound(this->begin(), this->end(), z, JLANG::make_comparator(&JPoint::getZ));
271 
272  if (p != this->end() && p != this->begin()) {
273 
274  --p;
275 
276  return p->getE() - (z - p->getZ()) * gWater.getA();
277  }
278  }
279 
280  return MASS_MUON;
281  }
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
static const double MASS_MUON
muon mass [GeV]
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
Definition: JGeane.hh:381
double getZ() const
Get z position.
Definition: JVector3D.hh:115
virtual double getA() const override
Get energy loss constant.
Definition: JGeane.hh:231
JVector2D JSIRENE::JTrack::getPosition ( const double  z) const
inline

Get muon position at given position along trajectory.

Parameters
zposition [m]
Returns
position

Definition at line 290 of file JSireneToolkit.hh.

291  {
292  using namespace JPP;
293 
294  const double precision = 1.0e-2;
295 
296  if (!this->empty()) {
297 
298  const_iterator p = lower_bound(this->begin(), this->end(), z, JLANG::make_comparator(&JPoint::getZ));
299 
300  if (p == this->end()) {
301  --p;
302  }
303 
304  if (p == this->begin()) {
305 
306  return JVector2D(p->getX(),
307  p->getY());
308 
309  } else {
310 
311  JVector3D pos;
312 
313  pos = p->getPosition();
314 
315  --p;
316 
317  pos -= p->getPosition();
318 
319  const double u = (pos.getZ() > precision ? (z - p->getZ()) / pos.getZ() : 0.0);
320 
321  return JVector2D(p->getX() + u * pos.getX(),
322  p->getY() + u * pos.getY());
323  }
324  }
325 
326  return JVector2D(0.0, 0.0);
327  }
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
double u[N+1]
Definition: JPolint.hh:865
double getZ() const
Get z position.
Definition: JVector3D.hh:115

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