SND@LHC Software
Loading...
Searching...
No Matches
StepLimits.h
Go to the documentation of this file.
1/* Copyright 2008-2014, Technische Universitaet Muenchen,
2 Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
3
4 This file is part of GENFIT.
5
6 GENFIT is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 GENFIT is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18*/
19
24#ifndef genfit_StepLimits_h
25#define genfit_StepLimits_h
26
27#include <vector>
28#include <math.h>
29
30
31namespace genfit {
32
34 // soft limits (only rough estimation, can go beyond safely)
35 stp_noLimit = 0, // only for internal use
36
37 // medium limits (can go a bit further if e.g. plane or boundary will be reached)
38 stp_fieldCurv, // stepsize limited by curvature and magnetic field inhomogenities
39 stp_momLoss, // stepsize limited by stepper because maximum momLoss is reached
40 stp_sMax, // stepsize limited by SMax defined in #estimateStep()
41
42 // hard limits (must stop there at any case!)
43 stp_sMaxArg, // stepsize limited by argument maxStepArg passed to #estimateStep()
44 stp_boundary, // stepsize limited by stepper because material boundary is encountered
45 stp_plane, // stepsize limited because destination plane is reached
46
47 ENUM_NR_ITEMS // only for internal use
48};
49
50
55
56 public:
59
60 StepLimits& operator=(const StepLimits& other);
61
63 double getLimit(StepLimitType type) const {return limits_[type];}
64 double getLimitSigned(StepLimitType type) const {
65 return stepSign_*getLimit(type);
66 }
67
75 std::pair<StepLimitType, double> getLowestLimit(double margin = 1.E-3) const;
76
78 double getLowestLimitVal(double margin = 1.E-3) const;
80 double getLowestLimitSignedVal(double margin = 1.E-3) const {
81 return getLowestLimitVal(margin) * stepSign_;
82 }
83
84 char getStepSign() const {return stepSign_;} // +- 1
85
87 void reduceLimit(StepLimitType type, double value);
89 void setLimit(StepLimitType type, double value) {limits_[type] = fabs(value);}
91 void setStepSign(char signedVal);
93 void setStepSign(double signedVal);
94
96
97 void reset();
98 void Print();
99
100 private:
101 std::vector<double> limits_; // limits are unsigned (i.e. non-negative)
102 signed char stepSign_;
103 static const double maxLimit_;
104
105};
106
107} /* End of namespace genfit */
110#endif // genfit_StepLimits_h
Helper to store different limits on the stepsize for the RKTRackRep.
Definition StepLimits.h:54
void reduceLimit(StepLimitType type, double value)
absolute of value will be taken! If limit is already lower, it will stay.
Definition StepLimits.cc:84
void setLimit(StepLimitType type, double value)
absolute of value will be taken! If limit is already lower, it will be set to value anyway.
Definition StepLimits.h:89
StepLimits & operator=(const StepLimits &other)
Definition StepLimits.cc:33
std::pair< StepLimitType, double > getLowestLimit(double margin=1.E-3) const
Get the lowest limit.
Definition StepLimits.cc:44
double getLowestLimitSignedVal(double margin=1.E-3) const
Get the numerical value of the lowest limit, signed with stepSign_.
Definition StepLimits.h:80
std::vector< double > limits_
Definition StepLimits.h:101
char getStepSign() const
Definition StepLimits.h:84
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
void setStepSign(char signedVal)
sets stepSign_ to sign of signedVal
Definition StepLimits.cc:93
double getLimitSigned(StepLimitType type) const
Definition StepLimits.h:64
signed char stepSign_
Definition StepLimits.h:102
void removeLimit(StepLimitType type)
Definition StepLimits.h:95
double getLowestLimitVal(double margin=1.E-3) const
Get the unsigned numerical value of the lowest limit.
Definition StepLimits.cc:65
static const double maxLimit_
Definition StepLimits.h:103
Matrix inversion tools.
Definition AbsBField.h:29
StepLimitType
Definition StepLimits.h:33
@ stp_noLimit
Definition StepLimits.h:35
@ stp_fieldCurv
Definition StepLimits.h:38
@ stp_boundary
Definition StepLimits.h:44
@ stp_sMax
Definition StepLimits.h:40
@ ENUM_NR_ITEMS
Definition StepLimits.h:47
@ stp_sMaxArg
Definition StepLimits.h:43
@ stp_momLoss
Definition StepLimits.h:39
@ stp_plane
Definition StepLimits.h:45