Jpp  test_elongated_shower_pde
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 216 of file JSireneToolkit.hh.

Constructor & Destructor Documentation

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

Constructor.

Parameters
pointmuon starting point

Definition at line 224 of file JSireneToolkit.hh.

224  :
225  std::vector<JPoint>(1, point)
226  {}

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

236  {
237  if (!this->empty()) {
238 
239  const_iterator p = lower_bound(this->begin(), this->end(), z, JLANG::make_comparator(&JPoint::getZ));
240 
241  if (p != this->end() && p != this->begin()) {
242 
243  --p;
244 
245  return p->getE() - (z - p->getZ()) * gWater.getA();
246  }
247  }
248 
249  return MASS_MUON;
250  }
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:325
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 259 of file JSireneToolkit.hh.

260  {
261  using namespace JPP;
262 
263  const double precision = 1.0e-2;
264 
265  if (!this->empty()) {
266 
267  const_iterator p = lower_bound(this->begin(), this->end(), z, JLANG::make_comparator(&JPoint::getZ));
268 
269  if (p == this->end()) {
270  --p;
271  }
272 
273  if (p == this->begin()) {
274 
275  return JVector2D(p->getX(),
276  p->getY());
277 
278  } else {
279 
280  JVector3D pos;
281 
282  pos = p->getPosition();
283 
284  --p;
285 
286  pos -= p->getPosition();
287 
288  const double u = (pos.getZ() > precision ? (z - p->getZ()) / pos.getZ() : 0.0);
289 
290  return JVector2D(p->getX() + u * pos.getX(),
291  p->getY() + u * pos.getY());
292  }
293  }
294 
295  return JVector2D(0.0, 0.0);
296  }
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: