RooParticle
Particle scattering simulator with ROOT
Loading...
Searching...
No Matches
recorder.cpp
Go to the documentation of this file.
1#include "recorder.hpp"
2
3
4
5
6template <typename Element>
8 TString prt;
9 if(addr == nullptr){
10 std::cout<<"recorderT::Print : Target variable address is not saved."<<std::endl;
11 prt = "nullptr";
12 }else{
13 prt = *addr;
14 }
15
16 std::cout << "RecorderT | data_addr: " << prt << " | data_saved " << data << std::endl;
17 return;
18}
19
20template <typename Element>
21Bool_t recorder<Element>::CMPSave(const Bool_t sgn, const Element data_){
22// if sgn kTRUE, save higher value. if kFALSE, save lower value.
23 if((sgn && data_>data) || (!sgn && data_<data)){
24 Save(data_);
25 return kTRUE; //If saved, return kTRUE
26 }
27 return kFALSE; //If NOT saved, return kFALSE
28}
29
30template <typename Element>
31Bool_t recorder<Element>::CMPSave(const Bool_t sgn){
32 return CMPSave(sgn, *addr);
33}
34
35template <typename Element>
36Bool_t recorder<Element>::MaxSave(const Element data_){
37 return CMPSave(kTRUE, data_);
38}
39
40template <typename Element>
42 return CMPSave(kTRUE);
43}
44
45template <typename Element>
46Bool_t recorder<Element>::MinSave(const Element data_){
47 return CMPSave(kFALSE, data_);
48}
49
50template <typename Element>
52 return CMPSave(kFALSE);
53}
54
55
56template class recorder<Bool_t>;
57template class recorder<Int_t>;
58template class recorder<Long_t>;
59template class recorder<Float_t>;
60template class recorder<Double_t>;
61
62
63
64
Remembers one value of type Element, optionally pulled from a watched variable.
Definition recorder.hpp:28
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
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
Small value holder that remembers one number, optionally read from a variable (recorder).