26 template<
class... Ts>
struct VisitOverload : Ts... {
using Ts::operator()...; };
35 T
reduceTBranch(TBranch* branch,
const std::function<T(T, T)>& f, T reduced = T())
38 branch->SetAddress(&
object);
39 int nevents = branch->GetEntries();
40 for (
int i = 0; i < nevents; ++i) {
42 reduced = f(reduced,
object);
82 explicit Timer(std::string text =
"");
92 std::string
getCommandOutput(
const std::string& command,
const std::vector<std::string>& arguments = {},
bool searchPath =
true);
102#define B2INFO_MEASURE_TIME(txt, ...) {\
103 std::stringstream __b2_timer_str__;\
104 __b2_timer_str__ << txt;\
105 ::Belle2::Utils::Timer __b2_timer__(__b2_timer_str__.str());\
129#if defined(__GNUC__) || defined(__ICL) || defined(__clang__)
130#define branch_likely(x) __builtin_expect(!!(x), 1)
131#define branch_unlikely(x) __builtin_expect(!!(x), 0)
133#define branch_likely(x) (x)
134#define branch_unlikely(x) (x)
Small helper class that prints its lifetime when destroyed.
double m_startTime
time at start (in ns).
std::string m_text
identifying text (printed at end).
std::string getCommandOutput(const std::string &command, const std::vector< std::string > &arguments={}, bool searchPath=true)
Execute a shell command and return its output.
T reduceTBranch(TBranch *branch, const std::function< T(T, T)> &f, T reduced=T())
Reduce a branch of a TTree.
double getCPUClock()
Return current value of the per-thread CPU clock.
double getClock()
Return current value of the real-time clock.
unsigned long getRssMemoryKB()
Returns the amount of memory the process actually occupies in the physical RAM of the machine.
unsigned long getVirtualMemoryKB()
Returns currently used virtual memory in KB, includes swapped and not occupied memory pages and memor...
Abstract base class for different kinds of events.
Helper struct for the C++17 std::visit overload pattern to allow simple use of variants.