Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooAbsDataFiller.h
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * Stephan Hageboeck, CERN 2021
5 *
6 * Copyright (c) 2024, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
13#ifndef RooFit_RooFitCore_RooAbsDataFiller_h
14#define RooFit_RooFitCore_RooAbsDataFiller_h
15
16#include <RooArgSet.h>
17#include <RooDataHist.h>
18#include <RooDataSet.h>
19#include <RooRealVar.h>
20
21#include <vector>
22#include <mutex>
23#include <cstddef>
24#include <string>
25
26class TTreeReader;
27
28namespace RooFit {
29namespace Detail {
30
32public:
34
35 /// Move constructor. It transfers ownership of the internal RooAbsData object.
36 RooAbsDataFiller(RooAbsDataFiller &&other) : _events{std::move(other._events)}, _eventSize{other._eventSize} {}
37
38 /// Copy is discouraged.
39 /// Use `rdataframe.Book<...>(std::move(absDataHelper), ...)` instead.
41 /// RDataFrame interface method.
42 void Initialize();
43 /// RDataFrame interface method. No tasks.
44 void InitTask(TTreeReader *, unsigned int) {}
45 /// RDataFrame interface method.
46 std::string GetActionName() { return "RooDataSetHelper"; }
47
48 void ExecImpl(std::size_t nValues, std::vector<double>& vector);
49 void Finalize();
50
51 virtual RooAbsData &GetAbsData() = 0;
52
53protected:
54 void FillAbsData(const std::vector<double> &events, unsigned int eventSize);
55
56 std::mutex _mutexDataset;
57 std::size_t _numInvalid = 0;
58
59 std::vector<std::vector<double>> _events; // One vector of values per data-processing slot
60 std::size_t _eventSize; // Number of variables in dataset
61 std::size_t _nValues; // Number of variables in dataframe
62
63 bool _isWeighted = false;
64 bool _isDataHist = false;
65};
66
67} // namespace Detail
68} // namespace RooFit
69
70
71#endif
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
RooAbsDataFiller(RooAbsDataFiller &&other)
Move constructor. It transfers ownership of the internal RooAbsData object.
virtual RooAbsData & GetAbsData()=0
void Initialize()
RDataFrame interface method.
void FillAbsData(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...
std::vector< std::vector< double > > _events
void Finalize()
Empty all buffers into the dataset/hist to finish processing.
void InitTask(TTreeReader *, unsigned int)
RDataFrame interface method. No tasks.
std::string GetActionName()
RDataFrame interface method.
void ExecImpl(std::size_t nValues, std::vector< double > &vector)
RooAbsDataFiller(const RooAbsDataFiller &)=delete
Copy is discouraged.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
Definition TTreeReader.h:44
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26