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 tcl.C
root -b -q tcl.C++
root -b -q "tcl.C(1)"
root -b -q "tcl.C++(1)"
void tclwrite(
Int_t split)
{
TFile f(
"tcl.root",
"recreate");
f.SetCompressionLevel(1);
T.Branch(
"tcl",&arr,256000,split);
for (
Int_t ev=0;ev<10000;ev++) {
if(nlines < 0) nlines = 1;
for (
Int_t i=0;i<nlines;i++) {
}
}
}
void tclread()
{
TH2F *h2 =
new TH2F(
"h2",
"center of lines",40,0,1,40,0,1);
T->GetBranch(
"tcl")->SetAutoDelete(
kFALSE);
T->SetBranchAddress(
"tcl",&arr);
for (
Int_t i=0;i<nlines;i++) {
}
}
}
{
tclwrite(split);
tclread();
}
static const double x2[5]
static const double x1[5]
R__EXTERN TBenchmark * gBenchmark
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.
void BypassStreamer(Bool_t bypass=kTRUE)
When the kBypassStreamer bit is set, the automatically generated Streamer can call directly TClass::W...
virtual void Clear(Option_t *option="")
Clear the clones array.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
2-D histogram with a float per channel (see TH1 documentation)}
Int_t Fill(Double_t)
Invalid Fill method.
Int_t GetEntriesFast() const
TObject * At(Int_t idx) const
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...
virtual Double_t Rndm()
Machine independent random number generator.
A TTree represents a columnar dataset.
- Author
- Rene Brun
Definition in file tcl.C.