FairShip
Loading...
Searching...
No Matches
exitHadronAbsorber::WeightHistory Struct Reference

Public Member Functions

Double_t WeightAt (Double_t t) const

Public Attributes

Double_t initial = 1.
std::vector< std::pair< Double_t, Double_t > > splits

Detailed Description

products of those decays, stopped carriers, and their descendants

Definition at line 123 of file exitHadronAbsorber.h.

Member Function Documentation

◆ WeightAt()

Double_t exitHadronAbsorber::WeightHistory::WeightAt ( Double_t t) const

Weight of the track at time t; a secondary made exactly at the end of a split step, e.g. by the interaction that ends the track, survived that step's decay probability and gets the weight after the split.

Definition at line 103 of file exitHadronAbsorber.cxx.

103 {
104 // A secondary made at the end of a step and the split on that step share
105 // the Geant4 post-step time, but geant4_vmc converts it to seconds by
106 // division for the split (TrackPosition) and by multiplication with the
107 // inverse unit for the secondary (stack push), so the two can differ by an
108 // ulp or two. A few ulp of tolerance covers that and stays far below the
109 // time of any real step. Split times increase strictly (a split needs a
110 // step of non-zero length), so the lookup is a binary search.
111 const Double_t tMax =
112 t + 4 * std::numeric_limits<Double_t>::epsilon() * std::abs(t);
113 const auto after = std::upper_bound(
114 splits.begin(), splits.end(), tMax,
115 [](Double_t time, const auto& split) { return time < split.first; });
116 return after == splits.begin() ? initial : std::prev(after)->second;
117}
std::vector< std::pair< Double_t, Double_t > > splits

Member Data Documentation

◆ initial

Double_t exitHadronAbsorber::WeightHistory::initial = 1.

weight before the first split

Definition at line 124 of file exitHadronAbsorber.h.

◆ splits

std::vector<std::pair<Double_t, Double_t> > exitHadronAbsorber::WeightHistory::splits

(time at the end of the split step, weight after the split), in step order and so strictly increasing in time

Definition at line 127 of file exitHadronAbsorber.h.


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