How to write a TClonesArray to a TTree
The following tests can be run Interactive tests
Batch tests: same as above but with no graphics
root -b -q tree123_clonesarray.C
root -b -q tree123_clonesarray.C++
root -b -q "tree123_clonesarray.C(1)"
root -b -q "tree123_clonesarray.C++(1)"
{
TFile f(
"clonesarray.root",
"recreate");
f.SetCompressionLevel(1);
TTree T(
"T",
"test clonesarray");
T.Branch(
"tcl", &
arr, 256000, split);
}
T.Fill();
}
T.Write();
}
{
auto f =
new TFile(
"clonesarray.root");
auto TH2F("h2", "center of lines", 40, 0, 1, 40, 0, 1);
T->GetBranch(
"tcl")->SetAutoDelete(
kFALSE);
T->SetBranchAddress(
"tcl", &
arr);
GetY2()));
}
}
h2->Draw("lego");
}
{
}
R__EXTERN TBenchmark * gBenchmark
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
R__EXTERN TRandom * gRandom
virtual void Start(const char *name)
Starts Benchmark with the specified name.
virtual void Show(const char *name)
Stops Benchmark name and Prints results.
An array of clone (identical) objects.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
2-D histogram with a float per channel (see TH1 documentation)
Use the TLine constructor to create a simple line.
void Print(Option_t *option="") const override
Dump this line with its attributes.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
Double_t Rndm() override
Machine independent random number generator.
A TTree represents a columnar dataset.
- Author
- Rene Brun
Definition in file tree123_clonesarray.C.