|
RooParticle
Particle scattering simulator with ROOT
|
Remembers one value of type Element, optionally pulled from a watched variable.
More...
#include <recorder.hpp>
Public Member Functions | |
| recorder () | |
| Empty recorder: no watched variable, stored value uninitialised (for built-in types). | |
| recorder (Element data_) | |
| Recorder with an initial stored value. | |
| recorder (Element *addr_) | |
| Recorder watching a variable; the stored value is left uninitialised until Save(). | |
| ~recorder () | |
| void | SetAddress (Element *addr_) |
| Set or change the watched variable. | |
| Element | GetData () |
| The stored value. | |
| void | Save () |
| Store the current value of the watched variable unconditionally; does nothing if no address is set. | |
| void | Save (const Element data_) |
| Store the given value unconditionally. | |
| Bool_t | MaxSave () |
| Store the watched variable if it is larger than the stored value. | |
| Bool_t | MaxSave (const Element data_) |
| Same as MaxSave() for a given value, not the watched variable. | |
| Bool_t | MinSave () |
| Store the watched variable if it is smaller than the stored value. | |
| Bool_t | MinSave (const Element data_) |
Store data_ if it is smaller than the stored value. | |
| void | Print () |
Print the watched variable's value and the stored value on std::cout (a note is printed if no address is set). | |
Protected Member Functions | |
| Bool_t | CMPSave (const Bool_t sgn) |
| Compare the watched variable with the stored value and save it (shared by MaxSave and MinSave). | |
| Bool_t | CMPSave (const Bool_t sgn, const Element data_) |
Compare data_ with the stored value and save it if the test passes. | |
Private Attributes | |
| Element | data |
| stored value | |
| Element * | addr = nullptr |
| watched variable, not owned | |
Remembers one value of type Element, optionally pulled from a watched variable.
Intended use: keep the extreme of a quantity over a run (for example the minimum distance of closest approach). The member functions are defined in recorder.cpp and instantiated there only for the typedefs recorderB (Bool_t), recorderI (Int_t), recorderL (Long_t), recorderF (Float_t) and recorderD (Double_t); other element types fail to link. All declared members are defined. The recorder does not own the watched variable.
For a minimum search start the recorder with the largest possible value (std::numeric_limits<Double_t>::max()) and feed it with MinSave(), as test/main_3body_oneline.cpp and test/main_rutherford_recorder.cpp do.
Definition at line 28 of file recorder.hpp.
|
inline |
Empty recorder: no watched variable, stored value uninitialised (for built-in types).
Definition at line 31 of file recorder.hpp.
|
inline |
Recorder with an initial stored value.
| data_ | initial value (for a minimum search use the largest possible value) |
Definition at line 34 of file recorder.hpp.
|
inline |
Recorder watching a variable; the stored value is left uninitialised until Save().
| addr_ | address of the variable (not owned; must stay valid) |
Definition at line 37 of file recorder.hpp.
Definition at line 38 of file recorder.hpp.
|
protected |
Compare the watched variable with the stored value and save it (shared by MaxSave and MinSave).
| sgn | true for the maximum variant, false for the minimum variant |
Definition at line 31 of file recorder.cpp.
|
protected |
Compare data_ with the stored value and save it if the test passes.
| sgn | true for the maximum variant, false for the minimum variant |
| data_ | candidate value |
Definition at line 21 of file recorder.cpp.
|
inline |
The stored value.
Definition at line 43 of file recorder.hpp.
| Bool_t recorder< Element >::MaxSave | ( | ) |
Store the watched variable if it is larger than the stored value.
Definition at line 41 of file recorder.cpp.
| Bool_t recorder< Element >::MaxSave | ( | const Element | data_ | ) |
Same as MaxSave() for a given value, not the watched variable.
| data_ | candidate value |
Definition at line 36 of file recorder.cpp.
| Bool_t recorder< Element >::MinSave | ( | ) |
Store the watched variable if it is smaller than the stored value.
Definition at line 51 of file recorder.cpp.
| Bool_t recorder< Element >::MinSave | ( | const Element | data_ | ) |
Store data_ if it is smaller than the stored value.
| data_ | candidate value |
Definition at line 46 of file recorder.cpp.
| void recorder< Element >::Print | ( | ) |
Print the watched variable's value and the stored value on std::cout (a note is printed if no address is set).
Definition at line 7 of file recorder.cpp.
|
inline |
Store the current value of the watched variable unconditionally; does nothing if no address is set.
Definition at line 45 of file recorder.hpp.
|
inline |
Store the given value unconditionally.
| data_ | value to store |
Definition at line 48 of file recorder.hpp.
|
inline |
Set or change the watched variable.
| addr_ | address of the variable (not owned) |
Definition at line 41 of file recorder.hpp.
|
private |
watched variable, not owned
Definition at line 79 of file recorder.hpp.
|
private |
stored value
Definition at line 78 of file recorder.hpp.