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