![]() |
|
|||
File indexing completed on 2025-08-05 08:18:28
0001 /* Copyright 2008-2014, Technische Universitaet Muenchen, 0002 Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch 0003 0004 This file is part of GENFIT. 0005 0006 GENFIT is free software: you can redistribute it and/or modify 0007 it under the terms of the GNU Lesser General Public License as published 0008 by the Free Software Foundation, either version 3 of the License, or 0009 (at your option) any later version. 0010 0011 GENFIT is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 GNU Lesser General Public License for more details. 0015 0016 You should have received a copy of the GNU Lesser General Public License 0017 along with GENFIT. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 /** @addtogroup RKTrackRep 0021 * @{ 0022 */ 0023 0024 #ifndef genfit_StepLimits_h 0025 #define genfit_StepLimits_h 0026 0027 #include <vector> 0028 #include <math.h> 0029 0030 0031 namespace genfit { 0032 0033 enum StepLimitType { 0034 // soft limits (only rough estimation, can go beyond safely) 0035 stp_noLimit = 0, // only for internal use 0036 0037 // medium limits (can go a bit further if e.g. plane or boundary will be reached) 0038 stp_fieldCurv, // stepsize limited by curvature and magnetic field inhomogenities 0039 stp_momLoss, // stepsize limited by stepper because maximum momLoss is reached 0040 stp_sMax, // stepsize limited by SMax defined in #estimateStep() 0041 0042 // hard limits (must stop there at any case!) 0043 stp_sMaxArg, // stepsize limited by argument maxStepArg passed to #estimateStep() 0044 stp_boundary, // stepsize limited by stepper because material boundary is encountered 0045 stp_plane, // stepsize limited because destination plane is reached 0046 0047 ENUM_NR_ITEMS // only for internal use 0048 }; 0049 0050 0051 /** 0052 * @brief Helper to store different limits on the stepsize for the RKTRackRep. 0053 */ 0054 class StepLimits { 0055 0056 public: 0057 StepLimits() 0058 : limits_(ENUM_NR_ITEMS, maxLimit_), stepSign_(1) {;} 0059 0060 StepLimits(const StepLimits&) = default; 0061 0062 StepLimits& operator=(const StepLimits& other); 0063 0064 //! Get limit of type. If that limit has not yet been set, return max double value. 0065 double getLimit(StepLimitType type) const {return limits_[type];} 0066 double getLimitSigned(StepLimitType type) const { 0067 return stepSign_*getLimit(type); 0068 } 0069 0070 /** 0071 * @brief Get the lowest limit. 0072 * 0073 * If hard limits are there, medium limits can be exceeded by up to margin 0074 * (default margin is 0.1, i.e. medium limits can be exceeded by up to 10%). 0075 * If no limit has been set yet, return std::pair<stp_noLimit, std::numeric_limits<double>::max>. 0076 */ 0077 std::pair<StepLimitType, double> getLowestLimit(double margin = 1.E-3) const; 0078 0079 //! Get the unsigned numerical value of the lowest limit. 0080 double getLowestLimitVal(double margin = 1.E-3) const; 0081 //! Get the numerical value of the lowest limit, signed with #stepSign_. 0082 double getLowestLimitSignedVal(double margin = 1.E-3) const { 0083 return getLowestLimitVal(margin) * stepSign_; 0084 } 0085 0086 char getStepSign() const {return stepSign_;} // +- 1 0087 0088 //! absolute of value will be taken! If limit is already lower, it will stay. 0089 void reduceLimit(StepLimitType type, double value); 0090 //! absolute of value will be taken! If limit is already lower, it will be set to value anyway. 0091 void setLimit(StepLimitType type, double value) {limits_[type] = fabs(value);} 0092 //! sets #stepSign_ to sign of signedVal 0093 void setStepSign(char signedVal); 0094 //! sets #stepSign_ to sign of signedVal 0095 void setStepSign(double signedVal); 0096 0097 void removeLimit(StepLimitType type) {limits_[type] = maxLimit_;} 0098 0099 void reset(); 0100 void Print(); 0101 0102 private: 0103 std::vector<double> limits_; // limits are unsigned (i.e. non-negative) 0104 signed char stepSign_; 0105 static const double maxLimit_; 0106 0107 }; 0108 0109 } /* End of namespace genfit */ 0110 /** @} */ 0111 0112 #endif // genfit_StepLimits_h
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |