Logo ROOT   6.14/05
Reference Guide
THbookBranch.cxx
Go to the documentation of this file.
1 // @(#)root/hbook:$Id$
2 // Author: Rene Brun 18/02/2002
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "THbookBranch.h"
13 #include "THbookTree.h"
14 
16 
17 ////////////////////////////////////////////////////////////////////////////////
18 /** \class THbookBranch
19  \ingroup Hist
20  \brief HBOOK Branch
21 */
22 
23 ////////////////////////////////////////////////////////////////////////////////
24 
25 THbookBranch::THbookBranch(TTree *tree, const char *name, void *address, const char *leaflist, Int_t basketsize, Int_t compress)
26  :TBranch(tree, name,address,leaflist,basketsize,compress)
27 {
28 }
29 
30 ////////////////////////////////////////////////////////////////////////////////
31 
32 THbookBranch::THbookBranch(TBranch *branch, const char *name, void *address, const char *leaflist, Int_t basketsize, Int_t compress)
33  :TBranch(branch,name,address,leaflist,basketsize,compress)
34 {
35 }
36 
37 ////////////////////////////////////////////////////////////////////////////////
38 
40 {
41 }
42 
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 /// Browser interface.
46 
48 {
50  THbookFile *file = tree->GetHbookFile();
51  file->cd();
52 
53  TBranch::Browse(b);
54 }
55 
56 ////////////////////////////////////////////////////////////////////////////////
57 ///get one entry from hbook ntuple
58 
60 {
62  THbookFile *file = tree->GetHbookFile();
63  if (tree->GetType() == 0) {
64  return file->GetEntry(entry,tree->GetID(),0,tree->GetX());
65  } else {
66  tree->InitBranches(entry);
67  return file->GetEntryBranch(entry,tree->GetID());
68  }
69 }
70 
71 ////////////////////////////////////////////////////////////////////////////////
72 /// Set address of this branch
73 /// See important remark in the header of THbookTree
74 
75 void THbookBranch::SetAddress(void *add)
76 {
78 
79  if (GetUniqueID() != 0) return; //only for first variable of the block
81  THbookFile *file = tree->GetHbookFile();
82  if (tree->GetType() != 0) {
83  file->SetBranchAddress(tree->GetID(),GetBlockName(),add);
84  }
85 }
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition: TObject.cxx:375
virtual void SetAddress(void *add)
Set address of this branch.
Definition: TBranch.cxx:2258
long long Long64_t
Definition: RtypesCore.h:69
THbookFile * GetHbookFile()
Definition: THbookTree.h:44
virtual void Browse(TBrowser *b)
Browser interface.
virtual Int_t GetType()
Definition: THbookTree.h:46
int Int_t
Definition: RtypesCore.h:41
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
get one entry from hbook ntuple
virtual void Browse(TBrowser *b)
Browser interface.
Definition: TBranch.cxx:661
Int_t GetEntry(Int_t entry, Int_t id, Int_t atype, Float_t *x)
Read in memory all columns of entry number of ntuple id from the Hbook file.
Definition: THbookFile.cxx:515
virtual void SetAddress(void *addobj)
Set address of this branch See important remark in the header of THbookTree.
HBOOK Branch.
Definition: THbookBranch.h:26
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
virtual Int_t GetID()
Definition: THbookTree.h:45
const char * GetBlockName() const
Definition: THbookBranch.h:38
virtual void InitBranches(Long64_t entry)
Initialize the branch addresses.
Definition: THbookTree.cxx:107
Int_t GetEntryBranch(Int_t entry, Int_t id)
Read in memory only the branch bname.
Definition: THbookFile.cxx:529
virtual void SetBranchAddress(Int_t id, const char *bname, void *add)
Set branch address.
Definition: THbookFile.cxx:585
#define ClassImp(name)
Definition: Rtypes.h:359
A wrapper class supporting Hbook ntuples (CWN and RWN).
Definition: THbookTree.h:30
virtual ~THbookBranch()
virtual Bool_t cd(const char *dirname="")
change directory to dirname
Definition: THbookFile.cxx:360
Definition: file.py:1
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
TTree * GetTree() const
Definition: TBranch.h:207
Float_t * GetX()
Definition: THbookTree.h:47
This class is an interface to the Hbook objects in Hbook files.
Definition: THbookFile.h:29
Definition: tree.py:1
A TTree object has a header with a name and a title.
Definition: TTree.h:70
A TTree is a list of TBranches.
Definition: TBranch.h:62
char name[80]
Definition: TGX11.cxx:109