#include "TFile.h"
#include "../test/Event.h"
void tree4w()
{
TFile f(
"tree4.root",
"RECREATE");
TTree t4(
"t4",
"A Tree with Events");
Event *event = new Event();
t4.Branch("event_split", &event,16000,99);
t4.Branch("event_not_split", &event,16000,0);
char etype[20];
for (
Int_t ev = 0; ev <100; ev++) {
sprintf(etype,"type%d",ev%5);
event->SetType(etype);
event->SetHeader(ev, 200, 960312, random);
event->SetNseg(
Int_t(10*ntrack+20*sigmas));
event->SetFlag(
UInt_t(random+0.5));
event->SetTemperature(random+20.);
}
for(
UChar_t i0 = 0; i0 < 4; i0++) {
for(
UChar_t i1 = 0; i1 < 4; i1++) {
}
}
for (
Int_t t = 0; t < ntrack; t++) event->AddTrack(random);
t4.Fill();
event->Clear();
}
t4.Print();
}
void tree4r()
{
Event *event = new Event();
if (event->GetNtrack() > 587)continue;
nselected++;
if (nselected == 1) t4->
Show();
event->Clear();
}
if (
gROOT->IsBatch())
return;
}
void tree4() {
Event::Reset();
tree4w();
Event::Reset();
tree4r();
}
#define R__LOAD_LIBRARY(LIBRARY)
R__EXTERN TRandom * gRandom
A TTree is a list of TBranches.
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all leaves of entry and return total number of bytes read.
virtual void SetAddress(void *add)
Set address of this branch.
Using a TBrowser one can browse all ROOT objects.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
virtual Double_t Rndm()
Machine independent random number generator.
A TTree represents a columnar dataset.
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
virtual void Show(Long64_t entry=-1, Int_t lenmax=20)
Print values of all active leaves for entry.
virtual Long64_t GetEntries() const
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
virtual void StartViewer()
Start the TTreeViewer on this tree.