RooParticle
Particle scattering simulator with ROOT
Loading...
Searching...
No Matches
recorder.hpp
Go to the documentation of this file.
1
3
4#ifndef H_RECORDER
5#define H_RECORDER 1;
6
7#include "TROOT.h"
8#include "TString.h"
9#include "iostream"
10
27template<typename Element>
29 public:
31 recorder(){return;}
34 recorder(Element data_){data=data_;}
37 recorder(Element * addr_){addr=addr_;}
41 void SetAddress(Element * addr_){ addr = addr_; }
43 Element GetData(){return data;}
45 void Save(){ if(!addr){return;} Save(*addr); }
48 void Save(const Element data_){data=data_;}
52 Bool_t MaxSave();
56 Bool_t MaxSave(const Element data_);
60 Bool_t MinSave();
64 Bool_t MinSave(const Element data_);
66 void Print();
67 protected:
71 Bool_t CMPSave(const Bool_t sgn);
76 Bool_t CMPSave(const Bool_t sgn, const Element data_);
77 private:
78 Element data;
79 Element * addr = nullptr;
80};
81
87#endif
Remembers one value of type Element, optionally pulled from a watched variable.
Definition recorder.hpp:28
recorder(Element *addr_)
Recorder watching a variable; the stored value is left uninitialised until Save().
Definition recorder.hpp:37
Element GetData()
The stored value.
Definition recorder.hpp:43
Element data
stored value
Definition recorder.hpp:78
Element * addr
watched variable, not owned
Definition recorder.hpp:79
Bool_t MaxSave()
Store the watched variable if it is larger than the stored value.
Definition recorder.cpp:41
Bool_t MinSave()
Store the watched variable if it is smaller than the stored value.
Definition recorder.cpp:51
void Save(const Element data_)
Store the given value unconditionally.
Definition recorder.hpp:48
Bool_t CMPSave(const Bool_t sgn)
Compare the watched variable with the stored value and save it (shared by MaxSave and MinSave).
Definition recorder.cpp:31
void Print()
Print the watched variable's value and the stored value on std::cout (a note is printed if no address...
Definition recorder.cpp:7
recorder()
Empty recorder: no watched variable, stored value uninitialised (for built-in types).
Definition recorder.hpp:31
void Save()
Store the current value of the watched variable unconditionally; does nothing if no address is set.
Definition recorder.hpp:45
void SetAddress(Element *addr_)
Set or change the watched variable.
Definition recorder.hpp:41
recorder(Element data_)
Recorder with an initial stored value.
Definition recorder.hpp:34
recorder< Double_t > recorderD
recorder of Double_t
Definition recorder.hpp:86
recorder< Int_t > recorderI
recorder of Int_t
Definition recorder.hpp:83
recorder< Long_t > recorderL
recorder of Long_t
Definition recorder.hpp:84
recorder< Float_t > recorderF
recorder of Float_t
Definition recorder.hpp:85
recorder< Bool_t > recorderB
recorder of Bool_t
Definition recorder.hpp:82