Copy a subset of a Tree to a new Tree
The input file has been generated by the program in $ROOTSYS/test/Event with Event 1000 1 1 1.
#ifdef ACTUAL_RUN
void run()
{
TFile oldfile(
"tree108.root");
oldfile.GetObject("t4", oldtree);
for (auto activeBranchName : {"event_split", "fNtrack", "fNseg", "fH"})
TFile newfile(
"tree110.root",
"recreate");
newfile.Write();
}
#else
void tree110_copy()
{
gROOT->ProcessLine(
".L " + tutdir +
"/io/tree/Event.cxx+");
gROOT->ProcessLine(
"#define ACTUAL_RUN yes");
gROOT->ProcessLine(
"#include \"" __FILE__
"\"");
gROOT->ProcessLine(
"run()");
}
#endif
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
A TTree represents a columnar dataset.
virtual void SetBranchStatus(const char *bname, bool status=true, UInt_t *found=nullptr)
Set branch status to Process or DoNotProcess.
void Print(Option_t *option="") const override
Print a summary of the tree contents.
virtual TTree * CloneTree(Long64_t nentries=-1, Option_t *option="")
Create a clone of this tree and copy nentries.
- Author
- Rene Brun
Definition in file tree110_copy.C.