Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
tree114_circular.C File Reference

Detailed Description

View in nbviewer Open in SWAN
Example of a circular Tree

Circular Trees are interesting in online real time environments to store the results of the last maxEntries events. for more info, see TTree::SetCircular. Circular trees must be memory resident.

void tree114_circular()
{
Float_t px,py,pz;
Double_t randomNum;
auto T = new TTree("T", "test circular buffers");
T->Branch("px", &px, "px/F");
T->Branch("py", &py, "px/F");
T->Branch("pz", &pz, "px/F");
T->Branch("random", &randomNum, "random/D");
T->Branch("i", &i, "i/s");
T->SetCircular(20000); // keep a maximum of 20000 entries in memory
for (i = 0; i < 65000; i++) {
r.Rannor(px, py);
pz = px * px + py * py;
randomNum = r.Rndm();
T->Fill();
}
T->Print();
}
ROOT::R::TRInterface & r
Definition Object.C:4
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short).
Definition RtypesCore.h:54
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
A TTree represents a columnar dataset.
Definition TTree.h:89
Author
Rene Brun

Definition in file tree114_circular.C.