Circular

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.

Author: Rene Brun
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Monday, May 25, 2020 at 04:42 AM.

In [1]:
auto T = new TTree("T","test circular buffers");
TRandom r;
Float_t px,py,pz;
Double_t randomNum;
UShort_t i;
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();
******************************************************************************
*Tree    :T         : test circular buffers                                  *
*Entries :    18977 : Total =          420932 bytes  File  Size =          0 *
*        :          : Tree compression factor =   1.00                       *
******************************************************************************
*Br    0 :px        : px/F                                                   *
*Entries :    18977 : Total  Size=      76529 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      32000 bytes  Compression=   1.00     *
*............................................................................*
*Br    1 :py        : px/F                                                   *
*Entries :    18977 : Total  Size=      76529 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      32000 bytes  Compression=   1.00     *
*............................................................................*
*Br    2 :pz        : px/F                                                   *
*Entries :    18977 : Total  Size=      76529 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      32000 bytes  Compression=   1.00     *
*............................................................................*
*Br    3 :random    : random/D                                               *
*Entries :    18977 : Total  Size=     152469 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      32000 bytes  Compression=   1.00     *
*............................................................................*
*Br    4 :i         : i/s                                                    *
*Entries :    18977 : Total  Size=      38565 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      32000 bytes  Compression=   1.00     *
*............................................................................*