ROOT
v6-20
Reference Guide
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
15
void
circular() {
16
auto
T
=
new
TTree
(
"T"
,
"test circular buffers"
);
17
TRandom
r
;
18
Float_t
px,py,pz;
19
Double_t
randomNum;
20
UShort_t
i;
21
T
->Branch(
"px"
,&px,
"px/F"
);
22
T
->Branch(
"py"
,&py,
"px/F"
);
23
T
->Branch(
"pz"
,&pz,
"px/F"
);
24
T
->Branch(
"random"
,&randomNum,
"random/D"
);
25
T
->Branch(
"i"
,&i,
"i/s"
);
26
T
->SetCircular(20000);
//keep a maximum of 20000 entries in memory
27
for
(i = 0; i < 65000; i++) {
28
r
.Rannor(px,py);
29
pz = px*px + py*py;
30
randomNum =
r
.Rndm();
31
T
->Fill();
32
}
33
T
->Print();
34
}
35
r
ROOT::R::TRInterface & r
Definition:
Object.C:4
UShort_t
unsigned short UShort_t
Definition:
RtypesCore.h:36
Double_t
double Double_t
Definition:
RtypesCore.h:55
Float_t
float Float_t
Definition:
RtypesCore.h:53
TRandom
This is the base class for the ROOT Random number generators.
Definition:
TRandom.h:27
TTree
A TTree represents a columnar dataset.
Definition:
TTree.h:72
ROOT::Math::Chebyshev::T
double T(double x)
Definition:
ChebyshevPol.h:34
tutorials
tree
circular.C
ROOT v6-20 - Reference Guide Generated on Fri Apr 1 2022 00:23:54 (GVA Time) using Doxygen 1.9.4