circular.C

Go to the documentation of this file.
00001 //  Example of a circular Tree
00002 //  Circular Trees are interesting in online real time environments
00003 //  to store the results of the last maxEntries events.
00004 //  for more info, see TTree::SetCircular
00005 // Author: Rene Brun
00006 void circular() {
00007    gROOT->cd(); //make sure that the Tree is memory resident
00008    TTree *T = new TTree("T","test circular buffers");
00009    TRandom r;
00010    Float_t px,py,pz;
00011    Double_t random;
00012    UShort_t i;
00013    T->Branch("px",&px,"px/F");
00014    T->Branch("py",&py,"px/F");
00015    T->Branch("pz",&pz,"px/F");
00016    T->Branch("random",&random,"random/D");
00017    T->Branch("i",&i,"i/s");
00018    T->SetCircular(20000); //keep a maximum of 20000 entries in memory
00019    for (i = 0; i < 65000; i++) {
00020       r.Rannor(px,py);
00021       pz = px*px + py*py;
00022       random = r.Rndm();
00023       T->Fill();
00024    }
00025    T->Print();
00026 }
00027 

Generated on Tue Jul 5 15:45:11 2011 for ROOT_528-00b_version by  doxygen 1.5.1