|
DAS
3.0
Das Analysis System
|
Go to the documentation of this file. 1 #ifndef DARWIN_LOOPER_H
2 #define DARWIN_LOOPER_H
12 #include <boost/exception/all.hpp>
21 typedef std::pair<unsigned, unsigned>
Slice;
27 Stream << slice.second <<
'/' << slice.first;
44 const std::chrono::time_point<std::chrono::system_clock>
start_t;
54 start_t(std::chrono::system_clock::now())
59 BOOST_THROW_EXCEPTION(invalid_argument(
"The number of slices " + to_string(
slice.first)
60 +
" must be larger than the index of the current slice " + to_string(
slice.second)));
63 BOOST_THROW_EXCEPTION(invalid_argument(
"The number of events cannot be " + to_string(
nEvSlice)));
67 time_t now = chrono::system_clock::to_time_t(
start_t);
68 cerr <<
'\t' << ctime(&now);
77 template<
typename TTreePtr>
80 ) :
Looper(&*t, t->GetEntries(), s)
86 if (root_log.find(
"Error") != string::npos)
87 BOOST_THROW_EXCEPTION(runtime_error(
"Error while loading a TTree entry:\n" + root_log));
94 ) :
Looper(
nullptr, nEvents, s)
101 std::cerr <<
red <<
"Warning: the event loop has stopped at entry "
123 auto now_t = chrono::system_clock::now();
124 auto elapsed_time {now_t -
start_t};
125 time_t now = chrono::system_clock::to_time_t(now_t);
126 auto secs = chrono::duration_cast<chrono::seconds>(elapsed_time);
127 cerr <<
'\t' << secs.count() <<
"s\t" << ctime(&now);
145 using Darwin::Tools::operator<<;
cerr
Definition: Ntupliser_cfg.py:93
static const char * def
Definition: Step.h:36
Handling of exceptions.
Definition: darwin.h:34
static const char * red
Definition: Step.h:34
std::string intercept_printf(std::function< void()> const lambda=[]() { printf(__func__);})
Definition: exceptions.h:25