26 throw std::runtime_error(
27 "A systematic variation was requested for a custom Fill action, but the type of the object to be filled does "
28 "not implement a Reset method, so we cannot safely re-initialize variations of the result. Aborting.");
33 h->SetDirectory(
nullptr);
37CountHelper::CountHelper(
const std::shared_ptr<ULong64_t> &
resultCount,
const unsigned int nSlots)
42void CountHelper::Exec(
unsigned int slot)
47void CountHelper::Finalize()
50 for (
auto &
c : fCounts) {
60void BufferedFillHelper::UpdateMinMax(
unsigned int slot,
double v)
68BufferedFillHelper::BufferedFillHelper(
const std::shared_ptr<Hist_t> &
h,
const unsigned int nSlots)
73 fBuffers.reserve(fNSlots);
75 for (
unsigned int i = 0; i < fNSlots; ++i) {
78 fBuffers.emplace_back(
v);
83void BufferedFillHelper::Exec(
unsigned int slot,
double v)
86 fBuffers[
slot].emplace_back(
v);
89void BufferedFillHelper::Exec(
unsigned int slot,
double v,
double w)
92 fBuffers[
slot].emplace_back(
v);
96Hist_t &BufferedFillHelper::PartialUpdate(
unsigned int slot)
107void BufferedFillHelper::Finalize()
109 for (
unsigned int i = 0; i < fNSlots; ++i) {
111 throw std::runtime_error(
"Cannot fill weighted histogram with values in containers of different sizes.");
119 globalMax != std::numeric_limits<BufEl_t>::lowest()) {
123 for (
unsigned int i = 0; i < fNSlots; ++i) {
129MeanHelper::MeanHelper(
const std::shared_ptr<double> &
meanVPtr,
const unsigned int nSlots)
134void MeanHelper::Exec(
unsigned int slot,
double v)
144void MeanHelper::Finalize()
158 for (
auto &
c : fCounts)
163double &MeanHelper::PartialUpdate(
unsigned int slot)
169StdDevHelper::StdDevHelper(
const std::shared_ptr<double> &
meanVPtr,
const unsigned int nSlots)
174void StdDevHelper::Exec(
unsigned int slot,
double v)
177 auto count = ++fCounts[
slot];
178 auto delta =
v - fMeans[
slot];
179 auto mean = fMeans[
slot] + delta / count;
183 fCounts[
slot] = count;
188void StdDevHelper::Finalize()
192 for (
auto c : fCounts) {
202 for (
unsigned int i = 0; i < fNSlots; ++i) {
208 for (
unsigned int i = 0; i < fNSlots; ++i) {
209 if (fCounts[i] == 0) {
234 const std::string &fileName)
244 throw std::invalid_argument(
"Snapshot: cannot open file \"" + fileName +
"\" in update mode");
251 if (
opts.fOverwriteIfExists) {
252 if (
outTree->InheritsFrom(
"TTree")) {
258 const std::string
msg =
"Snapshot: tree \"" +
treeName +
"\" already present in file \"" + fileName +
259 "\". If you want to delete the original tree and write another, please set "
260 "RSnapshotOptions::fOverwriteIfExists to true.";
261 throw std::invalid_argument(
msg);
266 const std::string &fileName)
276 throw std::invalid_argument(
"Snapshot: cannot open file \"" + fileName +
"\" in update mode");
281 if (
opts.fOverwriteIfExists) {
285 const std::string
msg =
"Snapshot: RNTuple \"" +
ntupleName +
"\" already present in file \"" + fileName +
286 "\". If you want to delete the original ntuple and write another, please set "
287 "the 'fOverwriteIfExists' option to true in RSnapshotOptions.";
288 throw std::invalid_argument(
msg);
299 if (
opts.fOverwriteIfExists) {
306 const std::string
msg =
"Snapshot: object \"" +
ntupleName +
"\" already present in file \"" + fileName +
307 "\". If you want to delete the original object and write a new RNTuple, please set "
308 "the 'fOverwriteIfExists' option to true in RSnapshotOptions.";
309 throw std::invalid_argument(
msg);
336 const auto bname =
leaf->GetName();
354 const auto btype =
leaf->GetTypeName();
358 "RDataFrame::Snapshot: could not correctly construct a leaflist for C-style array in column %s. The "
359 "leaf is of type '%s'. This column will not be written out.",
392 "RDataFrame::Snapshot: could not correctly construct a leaflist for fundamental type in column %s. This "
393 "column will not be written out.",
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned long long ULong64_t
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Representation of an RNTuple data set in a ROOT file.
A TTree is a list of TBranches.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
TH1 is the base class of all histogram classes in ROOT.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
Mother of all ROOT objects.
Statistical variable, defined by its mean and variance (RMS).
A TTree represents a columnar dataset.
char TypeName2ROOTTypeName(const std::string &b)
Convert type name (e.g.
void ResetIfPossible(TStatistic *h)
std::string TypeID2TypeName(const std::type_info &id)
Returns the name of a type starting from its type_info An empty string is returned in case of failure...
constexpr std::size_t CacheLineStep()
Stepping through CacheLineStep<T> values in a vector<T> brings you to a new cache line.
void EnsureValidSnapshotRNTupleOutput(const RSnapshotOptions &opts, const std::string &ntupleName, const std::string &fileName)
void EnsureValidSnapshotTTreeOutput(const RSnapshotOptions &opts, const std::string &treeName, const std::string &fileName)
void UnsetDirectoryIfPossible(TH1 *h)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
ROOT::ESTLType IsSTLCont(std::string_view type)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of cont...
A collection of options to steer the creation of the dataset on file.