THbookBranch.cxx

Go to the documentation of this file.
00001 // @(#)root/hbook:$Id: THbookBranch.cxx 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Rene Brun   18/02/2002
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #include "THbookBranch.h"
00013 #include "THbookTree.h"
00014 
00015 ClassImp(THbookBranch)
00016 
00017 
00018 //______________________________________________________________________________
00019 THbookBranch::THbookBranch(TTree *tree, const char *name, void *address, const char *leaflist, Int_t basketsize, Int_t compress)
00020             :TBranch(tree, name,address,leaflist,basketsize,compress)
00021 {
00022 }
00023 
00024 //______________________________________________________________________________
00025 THbookBranch::THbookBranch(TBranch *branch, const char *name, void *address, const char *leaflist, Int_t basketsize, Int_t compress)
00026             :TBranch(branch,name,address,leaflist,basketsize,compress)
00027 {
00028 }
00029 
00030 //______________________________________________________________________________
00031 THbookBranch::~THbookBranch()
00032 {
00033 }
00034 
00035 
00036 //______________________________________________________________________________
00037 void THbookBranch::Browse(TBrowser *b)
00038 {
00039    // Browser interface.
00040    THbookTree *tree = (THbookTree*)GetTree();
00041    THbookFile *file = tree->GetHbookFile();
00042    file->cd();
00043 
00044    TBranch::Browse(b);
00045 }
00046 
00047 //______________________________________________________________________________
00048 Int_t THbookBranch::GetEntry(Long64_t entry, Int_t /*getall*/)
00049 {
00050    //get one entry from hbook ntuple
00051    THbookTree *tree = (THbookTree*)GetTree();
00052    THbookFile *file = tree->GetHbookFile();
00053    if (tree->GetType() == 0) {
00054       return file->GetEntry(entry,tree->GetID(),0,tree->GetX());
00055    } else {
00056       tree->InitBranches(entry);
00057       return file->GetEntryBranch(entry,tree->GetID());
00058    }
00059 }
00060 
00061 //______________________________________________________________________________
00062 void THbookBranch::SetAddress(void *add)
00063 {
00064 // Set address of this branch
00065 // See important remark in the header of THbookTree
00066 
00067    TBranch::SetAddress(add);
00068 
00069    if (GetUniqueID() != 0) return; //only for first variable of the block
00070    THbookTree *tree = (THbookTree*)GetTree();
00071    THbookFile *file = tree->GetHbookFile();
00072    if (tree->GetType() != 0) {
00073       file->SetBranchAddress(tree->GetID(),GetBlockName(),add);
00074    }
00075 }

Generated on Tue Jul 5 14:22:46 2011 for ROOT_528-00b_version by  doxygen 1.5.1