Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
tree114_circular.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_tree
3/// \notebook -nodraw
4/// Example of a circular Tree
5///
6/// Circular Trees are interesting in online real time environments
7/// to store the results of the last maxEntries events.
8/// for more info, see TTree::SetCircular.
9/// Circular trees must be memory resident.
10///
11/// \macro_code
12///
13/// \author Rene Brun
14
15void tree114_circular()
16{
17 TRandom r;
18 Float_t px,py,pz;
19 Double_t randomNum;
20 UShort_t i;
21 auto T = new TTree("T", "test circular buffers");
22 T->Branch("px", &px, "px/F");
23 T->Branch("py", &py, "px/F");
24 T->Branch("pz", &pz, "px/F");
25 T->Branch("random", &randomNum, "random/D");
26 T->Branch("i", &i, "i/s");
27 T->SetCircular(20000); // keep a maximum of 20000 entries in memory
28 for (i = 0; i < 65000; i++) {
29 r.Rannor(px, py);
30 pz = px * px + py * py;
31 randomNum = r.Rndm();
32 T->Fill();
33 }
34 T->Print();
35}
36
unsigned short UShort_t
Definition RtypesCore.h:40
float Float_t
Definition RtypesCore.h:57
double Double_t
Definition RtypesCore.h:59
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
A TTree represents a columnar dataset.
Definition TTree.h:79
double T(double x)