Jpp  17.0.0-rc.1
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 218 of file JSireneToolkit.hh.

Constructor & Destructor Documentation

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

Constructor.

Parameters
pointmuon starting point

Definition at line 226 of file JSireneToolkit.hh.

226  :
227  std::vector<JPoint>(1, point)
228  {}

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 237 of file JSireneToolkit.hh.

238  {
239  if (!this->empty()) {
240 
241  const_iterator p = lower_bound(this->begin(), this->end(), z, JLANG::make_comparator(&JPoint::getZ));
242 
243  if (p != this->end() && p != this->begin()) {
244 
245  --p;
246 
247  return p->getE() - (z - p->getZ()) * gWater.getA();
248  }
249  }
250 
251  return MASS_MUON;
252  }
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
Definition: JComparator.hh:185
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 261 of file JSireneToolkit.hh.

262  {
263  using namespace JPP;
264 
265  const double precision = 1.0e-2;
266 
267  if (!this->empty()) {
268 
269  const_iterator p = lower_bound(this->begin(), this->end(), z, JLANG::make_comparator(&JPoint::getZ));
270 
271  if (p == this->end()) {
272  --p;
273  }
274 
275  if (p == this->begin()) {
276 
277  return JVector2D(p->getX(),
278  p->getY());
279 
280  } else {
281 
282  JVector3D pos;
283 
284  pos = p->getPosition();
285 
286  --p;
287 
288  pos -= p->getPosition();
289 
290  const double u = (pos.getZ() > precision ? (z - p->getZ()) / pos.getZ() : 0.0);
291 
292  return JVector2D(p->getX() + u * pos.getX(),
293  p->getY() + u * pos.getY());
294  }
295  }
296 
297  return JVector2D(0.0, 0.0);
298  }
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
Definition: JComparator.hh:185
double u[N+1]
Definition: JPolint.hh:755
double getZ() const
Get z position.
Definition: JVector3D.hh:115

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