SND@LHC Software
Loading...
Searching...
No Matches
genfit::StepLimits Class Reference

Helper to store different limits on the stepsize for the RKTRackRep. More...

#include <StepLimits.h>

Public Member Functions

 StepLimits ()
 
StepLimitsoperator= (const StepLimits &other)
 
double getLimit (StepLimitType type) const
 Get limit of type. If that limit has not yet been set, return max double value.
 
double getLimitSigned (StepLimitType type) const
 
std::pair< StepLimitType, double > getLowestLimit (double margin=1.E-3) const
 Get the lowest limit.
 
double getLowestLimitVal (double margin=1.E-3) const
 Get the unsigned numerical value of the lowest limit.
 
double getLowestLimitSignedVal (double margin=1.E-3) const
 Get the numerical value of the lowest limit, signed with stepSign_.
 
char getStepSign () const
 
void reduceLimit (StepLimitType type, double value)
 absolute of value will be taken! If limit is already lower, it will stay.
 
void setLimit (StepLimitType type, double value)
 absolute of value will be taken! If limit is already lower, it will be set to value anyway.
 
void setStepSign (char signedVal)
 sets stepSign_ to sign of signedVal
 
void setStepSign (double signedVal)
 sets stepSign_ to sign of signedVal
 
void removeLimit (StepLimitType type)
 
void reset ()
 
void Print ()
 

Private Attributes

std::vector< double > limits_
 
signed char stepSign_
 

Static Private Attributes

static const double maxLimit_ = 99.E99
 

Detailed Description

Helper to store different limits on the stepsize for the RKTRackRep.

Definition at line 54 of file StepLimits.h.

Constructor & Destructor Documentation

◆ StepLimits()

genfit::StepLimits::StepLimits ( )
inline

Definition at line 57 of file StepLimits.h.

std::vector< double > limits_
Definition StepLimits.h:101
signed char stepSign_
Definition StepLimits.h:102
static const double maxLimit_
Definition StepLimits.h:103
@ ENUM_NR_ITEMS
Definition StepLimits.h:47

Member Function Documentation

◆ getLimit()

double genfit::StepLimits::getLimit ( StepLimitType  type) const
inline

Get limit of type. If that limit has not yet been set, return max double value.

Definition at line 63 of file StepLimits.h.

◆ getLimitSigned()

double genfit::StepLimits::getLimitSigned ( StepLimitType  type) const
inline

Definition at line 64 of file StepLimits.h.

64 {
65 return stepSign_*getLimit(type);
66 }
double getLimit(StepLimitType type) const
Get limit of type. If that limit has not yet been set, return max double value.
Definition StepLimits.h:63

◆ getLowestLimit()

std::pair< StepLimitType, double > genfit::StepLimits::getLowestLimit ( double  margin = 1.E-3) const

Get the lowest limit.

If hard limits are there, medium limits can be exceeded by up to margin (default margin is 0.1, i.e. medium limits can be exceeded by up to 10%). If no limit has been set yet, return std::pair<stp_noLimit, std::numeric_limits<double>::max>.

Definition at line 44 of file StepLimits.cc.

44 {
45
46 double lowest(maxLimit_);
47 unsigned int iLowest(0);
48
49 for (unsigned int i=1; i<ENUM_NR_ITEMS; ++i) {
50
51 // lowest hard limit may exceed lowest soft limit by up to #margin
52 if (i == int(stp_sMaxArg))
53 lowest *= (1+margin);
54
55 if (limits_[i] < lowest) {
56 lowest = limits_[i];
57 iLowest = i;
58 }
59 }
60
61 return std::pair<StepLimitType, double>(static_cast<StepLimitType>(iLowest), lowest);
62}
int i
Definition ShipAna.py:86
StepLimitType
Definition StepLimits.h:33
@ stp_sMaxArg
Definition StepLimits.h:43

◆ getLowestLimitSignedVal()

double genfit::StepLimits::getLowestLimitSignedVal ( double  margin = 1.E-3) const
inline

Get the numerical value of the lowest limit, signed with stepSign_.

Definition at line 80 of file StepLimits.h.

80 {
81 return getLowestLimitVal(margin) * stepSign_;
82 }
double getLowestLimitVal(double margin=1.E-3) const
Get the unsigned numerical value of the lowest limit.
Definition StepLimits.cc:65

◆ getLowestLimitVal()

double genfit::StepLimits::getLowestLimitVal ( double  margin = 1.E-3) const

Get the unsigned numerical value of the lowest limit.

Definition at line 65 of file StepLimits.cc.

65 {
66
67 double lowest(maxLimit_);
68
69 for (unsigned int i=1; i<ENUM_NR_ITEMS; ++i) {
70
71 // lowest hard limit may exceed lowest soft limit by up to #margin
72 if (i == int(stp_sMaxArg))
73 lowest *= (1+margin);
74
75 if (limits_[i] < lowest) {
76 lowest = limits_[i];
77 }
78 }
79
80 return lowest;
81}

◆ getStepSign()

char genfit::StepLimits::getStepSign ( ) const
inline

Definition at line 84 of file StepLimits.h.

84{return stepSign_;} // +- 1

◆ operator=()

StepLimits & genfit::StepLimits::operator= ( const StepLimits other)

Definition at line 33 of file StepLimits.cc.

33 {
34 for (unsigned int i=1; i<ENUM_NR_ITEMS; ++i) {
35 limits_[i] = other.limits_[i];
36 }
37
38 stepSign_ = other.stepSign_;
39
40 return *this;
41}

◆ Print()

void genfit::StepLimits::Print ( )

Definition at line 116 of file StepLimits.cc.

116 {
117 for (unsigned int i=0; i<ENUM_NR_ITEMS; ++i) {
118 if (limits_[i] >= maxLimit_)
119 continue;
120
121 std::cout << " | " << limits_[i] << " cm due to ";
122 switch (static_cast<StepLimitType>(i)) {
123 case stp_noLimit:
124 break;
125 case stp_fieldCurv:
126 std::cout << "stp_fieldCurv (medium limit): stepsize limited by curvature and magnetic field inhomogenities";
127 break;
128 case stp_momLoss:
129 std::cout << "stp_momLoss (medium limit): stepsize limited by stepper because maximum momLoss is reached";
130 break;
131 case stp_sMax:
132 std::cout << "stp_sMax (medium limit): stepsize limited by SMax defined in #estimateStep()";
133 break;
134 case stp_sMaxArg:
135 std::cout << "stp_sMaxArg (hard limit): stepsize limited by argument maxStepArg passed to #estimateStep()";
136 break;
137 case stp_boundary:
138 std::cout << "stp_boundary (hard limit): stepsize limited by stepper because material boundary is encountered";
139 break;
140 case stp_plane:
141 std::cout << "stp_plane (hard limit): stepsize limited because destination plane is reached";
142 break;
143 case ENUM_NR_ITEMS:
144 break;
145 }
146 std::cout << "\n";
147 }
148 std::cout << "\n";
149}
@ stp_noLimit
Definition StepLimits.h:35
@ stp_fieldCurv
Definition StepLimits.h:38
@ stp_boundary
Definition StepLimits.h:44
@ stp_sMax
Definition StepLimits.h:40
@ stp_momLoss
Definition StepLimits.h:39
@ stp_plane
Definition StepLimits.h:45

◆ reduceLimit()

void genfit::StepLimits::reduceLimit ( StepLimitType  type,
double  value 
)

absolute of value will be taken! If limit is already lower, it will stay.

Definition at line 84 of file StepLimits.cc.

84 {
85 assert (type != stp_noLimit);
86 value = fabs(value);
87
88 if (limits_[type] > value)
89 limits_[type] = value;
90}

◆ removeLimit()

void genfit::StepLimits::removeLimit ( StepLimitType  type)
inline

Definition at line 95 of file StepLimits.h.

◆ reset()

void genfit::StepLimits::reset ( )

Definition at line 108 of file StepLimits.cc.

108 {
109 for (unsigned int i=1; i<ENUM_NR_ITEMS; ++i) {
111 }
112 stepSign_ = 1;
113}

◆ setLimit()

void genfit::StepLimits::setLimit ( StepLimitType  type,
double  value 
)
inline

absolute of value will be taken! If limit is already lower, it will be set to value anyway.

Definition at line 89 of file StepLimits.h.

89{limits_[type] = fabs(value);}

◆ setStepSign() [1/2]

void genfit::StepLimits::setStepSign ( char  signedVal)

sets stepSign_ to sign of signedVal

Definition at line 93 of file StepLimits.cc.

93 {
94 if (signedVal < 0)
95 stepSign_ = -1;
96 else
97 stepSign_ = 1;
98}

◆ setStepSign() [2/2]

void genfit::StepLimits::setStepSign ( double  signedVal)

sets stepSign_ to sign of signedVal

Definition at line 100 of file StepLimits.cc.

100 {
101 if (signedVal < 0.)
102 stepSign_ = -1;
103 else
104 stepSign_ = 1;
105}

Member Data Documentation

◆ limits_

std::vector<double> genfit::StepLimits::limits_
private

Definition at line 101 of file StepLimits.h.

◆ maxLimit_

const double genfit::StepLimits::maxLimit_ = 99.E99
staticprivate

Definition at line 103 of file StepLimits.h.

◆ stepSign_

signed char genfit::StepLimits::stepSign_
private

Definition at line 102 of file StepLimits.h.


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