43 void CreateParentTree() {
48 T->
Branch(
"Run",&Run,
"Run/I");
49 T->
Branch(
"Event",&Event,
"Event/I");
54 for (
Int_t i=0;i<10000;i++) {
55 if (i < 5000) Run = 1;
67 void CreateFriendTree() {
76 TFile *ff =
new TFile(
"treefriend.root",
"recreate");
112 if (fRun == Run && fEvent==Event &&
x==fx &&
y==fy &&
z==fz) {
116 if (i <100) printf(
"i=%lld, Run=%d, Event=%d, x=%g, y=%g, z=%g, : fRun=%d, fEvent=%d, fx=%g, fy=%g, fz=%g\n",i,Run,Event,
x,
y,
z,fRun,fEvent,fx,fy,fz);
120 printf(
"nok = %d, fentries=%lld\n",nok,TF->
GetEntries());
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 Print(Option_t *option="") const
Print a summary of the tree contents.
virtual Int_t Fill()
Fill all branches.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
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 TTree * CopyTree(const char *selection, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Copy a tree with selection.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
virtual Int_t GetEntryWithIndex(Int_t major, Int_t minor=0)
Read entry corresponding to major and minor number.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
This is the base class for the ROOT Random number generators.
virtual Int_t BuildIndex(const char *majorname, const char *minorname="0")
Build a Tree Index (default is TTreeIndex).
virtual TFriendElement * AddFriend(const char *treename, const char *filename="")
Add a TFriendElement to the list of friends.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual void Draw(Option_t *opt)
Default Draw method for all objects.
virtual Long64_t GetEntries() const
you should not use this method at all Int_t Int_t z
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.
A TTree object has a header with a name and a title.
virtual Double_t Landau(Double_t mean=0, Double_t sigma=1)
Generate a random number following a Landau distribution with location parameter mu and scale paramet...
virtual void SetName(const char *name)
Change the name of this tree.