20 #include "StepLimits.h"
30 const double StepLimits::maxLimit_ = 99.E99;
33 StepLimits& StepLimits::operator=(
const StepLimits& other) {
34 for (
unsigned int i=1; i<ENUM_NR_ITEMS; ++i) {
35 limits_[i] = other.limits_[i];
38 stepSign_ = other.stepSign_;
46 double lowest(maxLimit_);
47 unsigned int iLowest(0);
49 for (
unsigned int i=1; i<ENUM_NR_ITEMS; ++i) {
52 if (i ==
int(stp_sMaxArg))
55 if (limits_[i] < lowest) {
61 return std::pair<StepLimitType, double>(
static_cast<StepLimitType
>(iLowest), lowest);
67 double lowest(maxLimit_);
69 for (
unsigned int i=1; i<ENUM_NR_ITEMS; ++i) {
72 if (i ==
int(stp_sMaxArg))
75 if (limits_[i] < lowest) {
85 assert (type != stp_noLimit);
88 if (limits_[type] > value)
89 limits_[type] = value;
108 void StepLimits::reset() {
109 for (
unsigned int i=1; i<ENUM_NR_ITEMS; ++i) {
110 limits_[i] = maxLimit_;
116 void StepLimits::Print() {
117 for (
unsigned int i=0; i<ENUM_NR_ITEMS; ++i) {
118 if (limits_[i] >= maxLimit_)
121 printOut <<
" | " << limits_[i] <<
" cm due to ";
122 switch (
static_cast<StepLimitType
>(i)) {
126 printOut <<
"stp_fieldCurv (medium limit): stepsize limited by curvature and magnetic field inhomogenities";
129 printOut <<
"stp_momLoss (medium limit): stepsize limited by stepper because maximum momLoss is reached";
132 printOut <<
"stp_sMax (medium limit): stepsize limited by SMax defined in #estimateStep()";
135 printOut <<
"stp_sMaxArg (hard limit): stepsize limited by argument maxStepArg passed to #estimateStep()";
138 printOut <<
"stp_boundary (hard limit): stepsize limited by stepper because material boundary is encountered";
141 printOut <<
"stp_plane (hard limit): stepsize limited because destination plane is reached";
std::pair< StepLimitType, double > getLowestLimit(double margin=1.E-3) const
Get the lowest limit.
void setStepSign(char signedVal)
sets #stepSign_ to sign of signedVal
double getLowestLimitVal(double margin=1.E-3) const
Get the unsigned numerical value of the lowest limit.
void reduceLimit(StepLimitType type, double value)
absolute of value will be taken! If limit is already lower, it will stay.
Defines for I/O streams used for error and debug printing.
std::ostream printOut
Default stream for output of Print calls.