18#ifndef ROOABSDATAHELPER
19#define ROOABSDATAHELPER
67template<
class DataSet_t>
86 template<
typename... Args_t>
88 _dataset{ new DataSet_t(std::forward<Args_t>(args)...) },
122 template <
typename... ColumnTypes>
123 void Exec(
unsigned int slot, ColumnTypes... values)
126 throw std::invalid_argument(std::string(
"RooDataSet can hold ")
128 +
" variables per event, but RDataFrame passed "
129 + std::to_string(
sizeof...(values))
134 for (
auto&& val : {values...}) {
135 vector.push_back(val);
139 const std::lock_guard<std::mutex> guard(
_mutex_dataset, std::adopt_lock_t());
153 const auto prefix = std::string(
_dataset->ClassName()) +
"Helper::Finalize(" +
_dataset->GetName() +
") ";
154 oocoutW(
nullptr, DataHandling) << prefix <<
"Ignored " <<
_numInvalid <<
" out-of-range events\n";
166 void FillDataSet(
const std::vector<double>& events,
unsigned int eventSize) {
172 for (std::size_t i = 0; i < events.size(); i += eventSize) {
180 for (std::size_t j=0; j < eventSize; ++j) {
182 double sourceVal = events[i+j];
184 if (!destArg->inRange(sourceVal,
nullptr)) {
187 const auto prefix = std::string(
_dataset->ClassName()) +
"Helper::FillDataSet(" +
_dataset->GetName() +
") ";
192 oocoutI(
nullptr, DataHandling) << prefix <<
"Skipping event because " << destArg->GetName()
193 <<
" cannot accommodate the value " << sourceVal <<
"\n";
195 oocoutI(
nullptr, DataHandling) << prefix <<
"Skipping ...\n";
199 destArg->setVal(sourceVal);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Base class for action helpers, see RInterface::Book() for more information.
Storage_t const & get() const
Const access to the underlying stl container.
This is a helper for an RDataFrame action, which fills RooFit data classes.
void Exec(unsigned int slot, ColumnTypes... values)
Method that RDataFrame calls to pass a new event.
const std::size_t _eventSize
void Initialize()
RDataFrame interface method. Nothing has to be initialised.
std::mutex _mutex_dataset
std::shared_ptr< DataSet_t > GetResultPtr() const
Return internal dataset/hist.
std::string GetActionName()
RDataFrame interface method.
std::vector< std::vector< double > > _events
RooAbsDataHelper(Args_t &&... args)
Construct a helper to create RooDataSet/RooDataHist.
void Finalize()
Empty all buffers into the dataset/hist to finish processing.
RooAbsDataHelper(const RooAbsDataHelper &)=delete
Copy is discouraged.
void FillDataSet(const std::vector< double > &events, unsigned int eventSize)
Append all events to the internal RooDataSet or increment the bins of a RooDataHist at the given loca...
void InitTask(TTreeReader *, unsigned int)
RDataFrame interface method. No tasks.
std::shared_ptr< DataSet_t > _dataset
RooAbsDataHelper(RooAbsDataHelper &&other)
Move constructor. It transfers ownership of the internal RooAbsData object.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
UInt_t GetThreadPoolSize()
Returns the size of ROOT's thread pool.