11#include <framework/pcore/Mergeable.h>
12#include <framework/logging/Logger.h>
69 gROOT->GetListOfCleanups()->Add(
this);
74 gROOT->GetListOfCleanups()->Remove(
this);
101 B2ERROR(
"RootMergeable: wrapped object belongs to other file, Write() might crash. Make sure your histogram/ntuple already belongs to the file you want to save it to before filling (e.g. in initialize())");
104 m_wrapped->Write(
nullptr, TObject::kOverwrite);
119 list.SetOwner(
false);
120 list.Add(&otherMergeable->get());
146 gROOT->GetListOfCleanups()->Remove(
this);
Abstract base class for objects that can be merged.
Wrap a root histogram or TNtuple to make it mergeable.
void assign(T *p)
Replace wrapped object with p (takes ownership).
virtual void merge(const Mergeable *other) override
Merge object 'other' into this one.
ClassDefOverride(RootMergeable, 2)
Wrap a root histogram or ntuple to make them mergeable.
virtual void removeSideEffects() override
An ugly little method that is called before event() for input and worker processes.
virtual void RecursiveRemove(TObject *obj) override
Called from ROOT if obj is deleted.
RootMergeable(Args &&... params)
Constructor, forwards all arguments to T constructor.
virtual void clear() override
Clear content of this object (e.g.
const T & get() const
Get the wrapped root object.
void write(TDirectory *file)
Write the wrapped object into 'file', overwriting existing objects of same name.
T * m_wrapped
Wrapped root object.
RootMergeable()
default constructor for root.
T & get()
Get the wrapped root object.
Abstract base class for different kinds of events.