ROOT logo
// @(#)root/tree:$Id: TTree.h 41101 2011-10-03 16:23:48Z pcanal $
// Author: Rene Brun   12/01/96

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TTree
#define ROOT_TTree

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TTree                                                                //
//                                                                      //
// A TTree object is a list of TBranch.                                 //
//   To Create a TTree object one must:                                 //
//    - Create the TTree header via the TTree constructor               //
//    - Call the TBranch constructor for every branch.                  //
//                                                                      //
//   To Fill this object, use member function Fill with no parameters.  //
//     The Fill function loops on all defined TBranch.                  //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TBranch
#include "TBranch.h"
#endif

#ifndef ROOT_TObjArray
#include "TObjArray.h"
#endif

#ifndef ROOT_TAttLine
#include "TAttLine.h"
#endif

#ifndef ROOT_TAttFill
#include "TAttFill.h"
#endif

#ifndef ROOT_TAttMarker
#include "TAttMarker.h"
#endif

#ifndef ROOT_TArrayD
#include "TArrayD.h"
#endif

#ifndef ROOT_TArrayI
#include "TArrayI.h"
#endif

#ifndef ROOT_TDataType
#include "TDataType.h"
#endif

#ifndef ROOT_TClass
#include "TClass.h"
#endif

#ifndef ROOT_TVirtualTreePlayer
#include "TVirtualTreePlayer.h"
#endif

class TBranch;
class TBrowser;
class TFile;
class TDirectory;
class TLeaf;
class TH1;
class TTreeFormula;
class TPolyMarker;
class TEventList;
class TEntryList;
class TList;
class TSQLResult;
class TSelector;
class TPrincipal;
class TFriendElement;
class TCut;
class TVirtualIndex;
class TBranchRef;
class TBasket;
class TStreamerInfo;
class TTreeCloner;
class TFileMergeInfo;

class TTree : public TNamed, public TAttLine, public TAttFill, public TAttMarker {

protected:
   Long64_t       fEntries;           //  Number of entries
   Long64_t       fTotBytes;          //  Total number of bytes in all branches before compression
   Long64_t       fZipBytes;          //  Total number of bytes in all branches after compression
   Long64_t       fSavedBytes;        //  Number of autosaved bytes
   Long64_t       fFlushedBytes;      //  Number of autoflushed bytes
   Double_t       fWeight;            //  Tree weight (see TTree::SetWeight)
   Int_t          fTimerInterval;     //  Timer interval in milliseconds
   Int_t          fScanField;         //  Number of runs before prompting in Scan
   Int_t          fUpdate;            //  Update frequency for EntryLoop
   Int_t          fDefaultEntryOffsetLen;  //  Initial Length of fEntryOffset table in the basket buffers
   Int_t          fNClusterRange;     //  Number of Cluster range in addition to the one defined by 'AutoFlush'
   Int_t          fMaxClusterRange;   //! Memory allocated for the cluster range.
   Long64_t       fMaxEntries;        //  Maximum number of entries in case of circular buffers
   Long64_t       fMaxEntryLoop;      //  Maximum number of entries to process
   Long64_t       fMaxVirtualSize;    //  Maximum total size of buffers kept in memory
   Long64_t       fAutoSave;          //  Autosave tree when fAutoSave bytes produced
   Long64_t       fAutoFlush;         //  Autoflush tree when fAutoFlush entries written
   Long64_t       fEstimate;          //  Number of entries to estimate histogram limits
   Long64_t      *fClusterRangeEnd;   //[fNClusterRange] Last entry of a cluster range.
   Long64_t      *fClusterSize;       //[fNClusterRange] Number of entries in each cluster for a given range.
   Long64_t       fCacheSize;         //! Maximum size of file buffers
   Long64_t       fChainOffset;       //! Offset of 1st entry of this Tree in a TChain
   Long64_t       fReadEntry;         //! Number of the entry being processed
   Long64_t       fTotalBuffers;      //! Total number of bytes in branch buffers
   Int_t          fPacketSize;        //! Number of entries in one packet for parallel root
   Int_t          fNfill;             //! Local for EntryLoop
   Int_t          fDebug;             //! Debug level
   Long64_t       fDebugMin;          //! First entry number to debug
   Long64_t       fDebugMax;          //! Last entry number to debug
   Int_t          fMakeClass;         //! not zero when processing code generated by MakeClass
   Int_t          fFileNumber;        //! current file number (if file extensions)
   TObject       *fNotify;            //! Object to be notified when loading a Tree
   TDirectory    *fDirectory;         //! Pointer to directory holding this tree
   TObjArray      fBranches;          //  List of Branches
   TObjArray      fLeaves;            //  Direct pointers to individual branch leaves
   TList         *fAliases;           //  List of aliases for expressions based on the tree branches.
   TEventList    *fEventList;         //! Pointer to event selection list (if one)
   TEntryList    *fEntryList;         //! Pointer to event selection list (if one)
   TArrayD        fIndexValues;       //  Sorted index values
   TArrayI        fIndex;             //  Index of sorted values
   TVirtualIndex *fTreeIndex;         //  Pointer to the tree Index (if any)
   TList         *fFriends;           //  pointer to list of friend elements
   TList         *fUserInfo;          //  pointer to a list of user objects associated to this Tree
   TVirtualTreePlayer *fPlayer;       //! Pointer to current Tree player
   TList         *fClones;            //! List of cloned trees which share our addresses
   TBranchRef    *fBranchRef;         //  Branch supporting the TRefTable (if any)
   UInt_t         fFriendLockStatus;  //! Record which method is locking the friend recursion
   TBuffer       *fTransientBuffer;   //! Pointer to the current transient buffer.

   static Int_t     fgBranchStyle;      //  Old/New branch style
   static Long64_t  fgMaxTreeSize;      //  Maximum size of a file containg a Tree

private:
   TTree(const TTree& tt);              // not implemented
   TTree& operator=(const TTree& tt);   // not implemented

protected:
   void             AddClone(TTree*);
   virtual void     KeepCircular();
   virtual TBranch *BranchImp(const char* branchname, const char* classname, TClass* ptrClass, void* addobj, Int_t bufsize, Int_t splitlevel);
   virtual TBranch *BranchImp(const char* branchname, TClass* ptrClass, void* addobj, Int_t bufsize, Int_t splitlevel);
   virtual TBranch *BranchImpRef(const char* branchname, const char* classname, TClass* ptrClass, void* addobj, Int_t bufsize, Int_t splitlevel);
   virtual TBranch *BranchImpRef(const char* branchname, TClass* ptrClass, EDataType datatype, void* addobj, Int_t bufsize, Int_t splitlevel);
   virtual Int_t    CheckBranchAddressType(TBranch* branch, TClass* ptrClass, EDataType datatype, Bool_t ptr);
   virtual TBranch *BronchExec(const char* name, const char* classname, void* addobj, Bool_t isptrptr, Int_t bufsize, Int_t splitlevel);
   friend  TBranch *TTreeBranchImpRef(TTree *tree, const char* branchname, TClass* ptrClass, EDataType datatype, void* addobj, Int_t bufsize, Int_t splitlevel);
   Int_t    SetBranchAddressImp(TBranch *branch, void* addr, TBranch** ptr);
   virtual TLeaf   *GetLeafImpl(const char* branchname, const char* leafname);

   char             GetNewlineValue(istream &inputStream);
   void             ImportClusterRanges(TTree *fromtree);

   class TFriendLock {
      // Helper class to prevent infinite recursion in the
      // usage of TTree Friends. Implemented in TTree.cxx.
      TTree  *fTree;      // Pointer to the locked tree
      UInt_t  fMethodBit; // BIT for the locked method
      Bool_t  fPrevious;  // Previous value of the BIT.

   protected:
      TFriendLock(const TFriendLock&);
      TFriendLock& operator=(const TFriendLock&);

   public:
      TFriendLock(TTree* tree, UInt_t methodbit);
      ~TFriendLock();
   };
   friend class TFriendLock;
   // So that the index class can use TFriendLock:
   friend class TTreeIndex;
   friend class TChainIndex;
   // So that the TTreeCloner can access the protected interfaces
   friend class TTreeCloner;

   // use to update fFriendLockStatus
   enum ELockStatusBits {
      kFindBranch        = BIT(0),
      kFindLeaf          = BIT(1),
      kGetAlias          = BIT(2),
      kGetBranch         = BIT(3),
      kGetEntry          = BIT(4),
      kGetEntryWithIndex = BIT(5),
      kGetFriend         = BIT(6),
      kGetFriendAlias    = BIT(7),
      kGetLeaf           = BIT(8),
      kLoadTree          = BIT(9),
      kPrint             = BIT(10),
      kRemoveFriend      = BIT(11),
      kSetBranchStatus   = BIT(12)
   };
   
   enum SetBranchAddressStatus {
      kMissingBranch = -5,
      kInternalError = -4,
      kMissingCompiledCollectionProxy = -3,
      kMismatch = -2,
      kClassMismatch = -1,
      kMatch = 0,
      kMatchConversion = 1,
      kMatchConversionCollection = 2,
      kMakeClass = 3,
      kVoidPtr = 4,
      kNoCheck = 5
   };

public:
   // TTree status bits
   enum {
      kForceRead   = BIT(11),
      kCircular    = BIT(12)
   };

   // Split level modifier 
   enum {
      kSplitCollectionOfPointers = 100
   };
   
   class TClusterIterator 
   {
   private:
      TTree    *fTree;        // TTree upon which we are iterating.
      Int_t    fClusterRange; // Which cluster range are we looking at.
      Long64_t fStartEntry;   // Where does the cluster start.
      Long64_t fNextEntry;    // Where does the cluster end (exclusive).

      Long64_t GetEstimatedClusterSize();
      
   protected:
      friend class TTree;
      TClusterIterator(TTree *tree, Long64_t firstEntry);

   public:
      // Intentionally used the default copy constructor and default destructor
      // as the TClusterIterator does not own the TTree.
      //  TClusterIterator(const TClusterIterator&);
      // ~TClusterIterator();
      
      // No public constructors, the iterator must be
      // created via TTree::GetClusterIterator

      // Move on to the next cluster and return the starting entry
      // of this next cluster
      Long64_t Next();
      
      // Return the start entry of the current cluster.
      Long64_t GetStartEntry() {
         return fStartEntry;
      }

      // Return the first entry of the next cluster.
      Long64_t GetNextEntry() {
         return fNextEntry;
      }

      Long64_t operator()() { return Next(); }
   };

   TTree();
   TTree(const char* name, const char* title, Int_t splitlevel = 99);
   virtual ~TTree();

   virtual void            AddBranchToCache(const char *bname, Bool_t subbranches = kFALSE);
   virtual void            AddBranchToCache(TBranch *branch,   Bool_t subbranches = kFALSE);
   virtual void            DropBranchFromCache(const char *bname, Bool_t subbranches = kFALSE);
   virtual void            DropBranchFromCache(TBranch *branch,   Bool_t subbranches = kFALSE);
   virtual TFriendElement *AddFriend(const char* treename, const char* filename = "");
   virtual TFriendElement *AddFriend(const char* treename, TFile* file);
   virtual TFriendElement *AddFriend(TTree* tree, const char* alias = "", Bool_t warn = kFALSE);
   virtual void            AddTotBytes(Int_t tot) { fTotBytes += tot; }
   virtual void            AddZipBytes(Int_t zip) { fZipBytes += zip; }
   virtual Long64_t        AutoSave(Option_t* option = "");
   virtual Int_t           Branch(TCollection* list, Int_t bufsize = 32000, Int_t splitlevel = 99, const char* name = "");
   virtual Int_t           Branch(TList* list, Int_t bufsize = 32000, Int_t splitlevel = 99);
   virtual Int_t           Branch(const char* folder, Int_t bufsize = 32000, Int_t splitlevel = 99);
   virtual TBranch        *Branch(const char* name, void* address, const char* leaflist, Int_t bufsize = 32000);
           TBranch        *Branch(const char* name, char* address, const char* leaflist, Int_t bufsize = 32000) 
   {
      // Overload to avoid confusion between this signature and the template instance.
      return Branch(name,(void*)address,leaflist,bufsize);
   }
   TBranch        *Branch(const char* name, long address, const char* leaflist, Int_t bufsize = 32000) 
   {
      // Overload to avoid confusion between this signature and the template instance.
      return Branch(name,(void*)address,leaflist,bufsize);
   }
   TBranch        *Branch(const char* name, int address, const char* leaflist, Int_t bufsize = 32000) 
   {
      // Overload to avoid confusion between this signature and the template instance.
      return Branch(name,(void*)(long)address,leaflist,bufsize);
   }
#if !defined(__CINT__)
   virtual TBranch        *Branch(const char* name, const char* classname, void* addobj, Int_t bufsize = 32000, Int_t splitlevel = 99);
#endif
   template <class T> TBranch *Branch(const char* name, const char* classname, T* obj, Int_t bufsize = 32000, Int_t splitlevel = 99)
   {
      // See BranchImpRed for details. Here we __ignore
      return BranchImpRef(name, classname, TBuffer::GetClass(typeid(T)), obj, bufsize, splitlevel);
   }
   template <class T> TBranch *Branch(const char* name, const char* classname, T** addobj, Int_t bufsize = 32000, Int_t splitlevel = 99)
   {
      // See BranchImp for details
      return BranchImp(name, classname, TBuffer::GetClass(typeid(T)), addobj, bufsize, splitlevel);
   }
   template <class T> TBranch *Branch(const char* name, T** addobj, Int_t bufsize = 32000, Int_t splitlevel = 99)
   {
      // See BranchImp for details
      return BranchImp(name, TBuffer::GetClass(typeid(T)), addobj, bufsize, splitlevel);
   }
   template <class T> TBranch *Branch(const char* name, T* obj, Int_t bufsize = 32000, Int_t splitlevel = 99)
   {
      // See BranchImp for details
      return BranchImpRef(name, TBuffer::GetClass(typeid(T)), TDataType::GetType(typeid(T)), obj, bufsize, splitlevel);
   }
   virtual TBranch        *Bronch(const char* name, const char* classname, void* addobj, Int_t bufsize = 32000, Int_t splitlevel = 99);
   virtual TBranch        *BranchOld(const char* name, const char* classname, void* addobj, Int_t bufsize = 32000, Int_t splitlevel = 1);
   virtual TBranch        *BranchRef();
   virtual void            Browse(TBrowser*);
   virtual Int_t           BuildIndex(const char* majorname, const char* minorname = "0");
   TStreamerInfo          *BuildStreamerInfo(TClass* cl, void* pointer = 0, Bool_t canOptimize = kTRUE);
   virtual TFile          *ChangeFile(TFile* file);
   virtual TTree          *CloneTree(Long64_t nentries = -1, Option_t* option = "");
   virtual void            CopyAddresses(TTree*,Bool_t undo = kFALSE);
   virtual Long64_t        CopyEntries(TTree* tree, Long64_t nentries = -1, Option_t *option = "");
   virtual TTree          *CopyTree(const char* selection, Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0);
   virtual TBasket        *CreateBasket(TBranch*);
   virtual void            DirectoryAutoAdd(TDirectory *);
   Int_t                   Debug() const { return fDebug; }
   virtual void            Delete(Option_t* option = ""); // *MENU*
   virtual void            Draw(Option_t* opt) { Draw(opt, "", "", 1000000000, 0); }
   virtual Long64_t        Draw(const char* varexp, const TCut& selection, Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0);
   virtual Long64_t        Draw(const char* varexp, const char* selection, Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0); // *MENU*
   virtual void            DropBaskets();
   virtual void            DropBuffers(Int_t nbytes);
   virtual Int_t           Fill();
   virtual TBranch        *FindBranch(const char* name);
   virtual TLeaf          *FindLeaf(const char* name);
   virtual Int_t           Fit(const char* funcname, const char* varexp, const char* selection = "", Option_t* option = "", Option_t* goption = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0); // *MENU*
   virtual Int_t           FlushBaskets() const;
   virtual const char     *GetAlias(const char* aliasName) const;
   virtual Long64_t        GetAutoFlush() const {return fAutoFlush;}
   virtual Long64_t        GetAutoSave()  const {return fAutoSave;}
   virtual TBranch        *GetBranch(const char* name);
   virtual TBranchRef     *GetBranchRef() const { return fBranchRef; };
   virtual Bool_t          GetBranchStatus(const char* branchname) const;
   static  Int_t           GetBranchStyle();
   virtual Long64_t        GetCacheSize() const { return fCacheSize; }
   virtual TClusterIterator GetClusterIterator(Long64_t firstentry);
   virtual Long64_t        GetChainEntryNumber(Long64_t entry) const { return entry; }
   virtual Long64_t        GetChainOffset() const { return fChainOffset; }
   TFile                  *GetCurrentFile() const;
           Int_t           GetDefaultEntryOffsetLen() const {return fDefaultEntryOffsetLen;}
           Long64_t        GetDebugMax()  const { return fDebugMax; }
           Long64_t        GetDebugMin()  const { return fDebugMin; }
   TDirectory             *GetDirectory() const { return fDirectory; }
   virtual Long64_t        GetEntries() const   { return fEntries; }
   virtual Long64_t        GetEntries(const char *selection);
   virtual Long64_t        GetEntriesFast() const   { return fEntries; }
   virtual Long64_t        GetEntriesFriend() const;
   virtual Long64_t        GetEstimate() const { return fEstimate; }
   virtual Int_t           GetEntry(Long64_t entry = 0, Int_t getall = 0);
           Int_t           GetEvent(Long64_t entry = 0, Int_t getall = 0) { return GetEntry(entry, getall); }
   virtual Int_t           GetEntryWithIndex(Int_t major, Int_t minor = 0);
   virtual Long64_t        GetEntryNumberWithBestIndex(Int_t major, Int_t minor = 0) const;
   virtual Long64_t        GetEntryNumberWithIndex(Int_t major, Int_t minor = 0) const;
   TEventList             *GetEventList() const { return fEventList; }
   virtual TEntryList     *GetEntryList();
   virtual Long64_t        GetEntryNumber(Long64_t entry) const;
   virtual Int_t           GetFileNumber() const { return fFileNumber; }
   virtual TTree          *GetFriend(const char*) const;
   virtual const char     *GetFriendAlias(TTree*) const;
   TH1                    *GetHistogram() { return GetPlayer()->GetHistogram(); }
   virtual Int_t          *GetIndex() { return &fIndex.fArray[0]; }
   virtual Double_t       *GetIndexValues() { return &fIndexValues.fArray[0]; }
   virtual TIterator      *GetIteratorOnAllLeaves(Bool_t dir = kIterForward);
   virtual TLeaf          *GetLeaf(const char* branchname, const char* leafname);
   virtual TLeaf          *GetLeaf(const char* name);
   virtual TList          *GetListOfClones() { return fClones; }
   virtual TObjArray      *GetListOfBranches() { return &fBranches; }
   virtual TObjArray      *GetListOfLeaves() { return &fLeaves; }
   virtual TList          *GetListOfFriends() const { return fFriends; }
   virtual TList          *GetListOfAliases() const { return fAliases; }

   // GetMakeClass is left non-virtual for efficiency reason.
   // Making it virtual affects the performance of the I/O
           Int_t           GetMakeClass() const { return fMakeClass; }

   virtual Long64_t        GetMaxEntryLoop() const { return fMaxEntryLoop; }
   virtual Double_t        GetMaximum(const char* columname);
   static  Long64_t        GetMaxTreeSize();
   virtual Long64_t        GetMaxVirtualSize() const { return fMaxVirtualSize; }
   virtual Double_t        GetMinimum(const char* columname);
   virtual Int_t           GetNbranches() { return fBranches.GetEntriesFast(); }
   TObject                *GetNotify() const { return fNotify; }
   TVirtualTreePlayer     *GetPlayer();
   virtual Int_t           GetPacketSize() const { return fPacketSize; }
   virtual Long64_t        GetReadEntry()  const { return fReadEntry; }
   virtual Long64_t        GetReadEvent()  const { return fReadEntry; }
   virtual Int_t           GetScanField()  const { return fScanField; }
   TTreeFormula           *GetSelect()    { return GetPlayer()->GetSelect(); }
   virtual Long64_t        GetSelectedRows() { return GetPlayer()->GetSelectedRows(); }
   virtual Int_t           GetTimerInterval() const { return fTimerInterval; }
           TBuffer*        GetTransientBuffer(Int_t size);
   virtual Long64_t        GetTotBytes() const { return fTotBytes; }
   virtual TTree          *GetTree() const { return const_cast<TTree*>(this); }
   virtual TVirtualIndex  *GetTreeIndex() const { return fTreeIndex; }
   virtual Int_t           GetTreeNumber() const { return 0; }
   virtual Int_t           GetUpdate() const { return fUpdate; }
   virtual TList          *GetUserInfo();
   // See TSelectorDraw::GetVar
   TTreeFormula           *GetVar(Int_t i)  { return GetPlayer()->GetVar(i); }
   // See TSelectorDraw::GetVar
   TTreeFormula           *GetVar1() { return GetPlayer()->GetVar1(); }
   // See TSelectorDraw::GetVar
   TTreeFormula           *GetVar2() { return GetPlayer()->GetVar2(); }
   // See TSelectorDraw::GetVar
   TTreeFormula           *GetVar3() { return GetPlayer()->GetVar3(); }
   // See TSelectorDraw::GetVar
   TTreeFormula           *GetVar4() { return GetPlayer()->GetVar4(); }
   // See TSelectorDraw::GetVal
   virtual Double_t       *GetVal(Int_t i)   { return GetPlayer()->GetVal(i); }
   // See TSelectorDraw::GetVal
   virtual Double_t       *GetV1()   { return GetPlayer()->GetV1(); }
   // See TSelectorDraw::GetVal
   virtual Double_t       *GetV2()   { return GetPlayer()->GetV2(); }
   // See TSelectorDraw::GetVal
   virtual Double_t       *GetV3()   { return GetPlayer()->GetV3(); }
   // See TSelectorDraw::GetVal
   virtual Double_t       *GetV4()   { return GetPlayer()->GetV4(); }
   virtual Double_t       *GetW()    { return GetPlayer()->GetW(); }
   virtual Double_t        GetWeight() const   { return fWeight; }
   virtual Long64_t        GetZipBytes() const { return fZipBytes; }
   virtual void            IncrementTotalBuffers(Int_t nbytes) { fTotalBuffers += nbytes; }
   Bool_t                  IsFolder() const { return kTRUE; }
   virtual Int_t           LoadBaskets(Long64_t maxmemory = 2000000000);
   virtual Long64_t        LoadTree(Long64_t entry);
   virtual Long64_t        LoadTreeFriend(Long64_t entry, TTree* T);
   virtual Int_t           MakeClass(const char* classname = 0, Option_t* option = "");
   virtual Int_t           MakeCode(const char* filename = 0);
   virtual Int_t           MakeProxy(const char* classname, const char* macrofilename = 0, const char* cutfilename = 0, const char* option = 0, Int_t maxUnrolling = 3);
   virtual Int_t           MakeSelector(const char* selector = 0);
   Bool_t                  MemoryFull(Int_t nbytes);
   virtual Long64_t        Merge(TCollection* list, Option_t* option = "");
   virtual Long64_t        Merge(TCollection* list, TFileMergeInfo *info);
   static  TTree          *MergeTrees(TList* list, Option_t* option = "");
   virtual Bool_t          Notify();
   virtual void            OptimizeBaskets(ULong64_t maxMemory=10000000, Float_t minComp=1.1, Option_t *option=""); 
   TPrincipal             *Principal(const char* varexp = "", const char* selection = "", Option_t* option = "np", Long64_t nentries = 1000000000, Long64_t firstentry = 0);
   virtual void            Print(Option_t* option = "") const; // *MENU*
   virtual void            PrintCacheStats(Option_t* option = "") const;
   virtual Long64_t        Process(const char* filename, Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0); // *MENU*
#if defined(__CINT__)
#if defined(R__MANUAL_DICT)
   virtual Long64_t        Process(void* selector, Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0);
#endif
#else
   virtual Long64_t        Process(TSelector* selector, Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0);
#endif
   virtual Long64_t        Project(const char* hname, const char* varexp, const char* selection = "", Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0);
   virtual TSQLResult     *Query(const char* varexp = "", const char* selection = "", Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0);
   virtual Long64_t        ReadFile(const char* filename, const char* branchDescriptor = "", char delimiter = ' ');
   virtual Long64_t        ReadStream(istream& inputStream, const char* branchDescriptor = "", char delimiter = ' ');
   virtual void            Refresh();
   virtual void            RecursiveRemove(TObject *obj);
   virtual void            RemoveFriend(TTree*);
   virtual void            Reset(Option_t* option = "");
   virtual void            ResetAfterMerge(TFileMergeInfo *);
   virtual void            ResetBranchAddress(TBranch *);
   virtual void            ResetBranchAddresses();
   virtual Long64_t        Scan(const char* varexp = "", const char* selection = "", Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0); // *MENU*
   virtual Bool_t          SetAlias(const char* aliasName, const char* aliasFormula);
   virtual void            SetAutoSave(Long64_t autos = 300000000);
   virtual void            SetAutoFlush(Long64_t autof = 30000000);
   virtual void            SetBasketSize(const char* bname, Int_t buffsize = 16000);
#if !defined(__CINT__)
   virtual Int_t           SetBranchAddress(const char *bname,void *add, TBranch **ptr = 0);
#endif
   virtual Int_t           SetBranchAddress(const char *bname,void *add, TClass *realClass, EDataType datatype, Bool_t isptr);
   virtual Int_t           SetBranchAddress(const char *bname,void *add, TBranch **ptr, TClass *realClass, EDataType datatype, Bool_t isptr);
   template <class T> Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr = 0) {
      TClass *cl = TClass::GetClass(typeid(T));
      EDataType type = kOther_t;
      if (cl==0) type = TDataType::GetType(typeid(T));
      return SetBranchAddress(bname,add,ptr,cl,type,true);
   }
#ifndef R__NO_CLASS_TEMPLATE_SPECIALIZATION
   // This can only be used when the template overload resolution can distringuish between
   // T* and T**
   template <class T> Int_t SetBranchAddress(const char *bname, T *add, TBranch **ptr = 0) {
      TClass *cl = TClass::GetClass(typeid(T));
      EDataType type = kOther_t;
      if (cl==0) type = TDataType::GetType(typeid(T));
      return SetBranchAddress(bname,add,ptr,cl,type,false);
   }
#endif
   virtual void            SetBranchStatus(const char* bname, Bool_t status = 1, UInt_t* found = 0);
   static  void            SetBranchStyle(Int_t style = 1);  //style=0 for old branch, =1 for new branch style
   virtual void            SetCacheSize(Long64_t cachesize = -1);
   virtual void            SetCacheEntryRange(Long64_t first, Long64_t last);
   virtual void            SetCacheLearnEntries(Int_t n=10);
   virtual void            SetChainOffset(Long64_t offset = 0) { fChainOffset=offset; }
   virtual void            SetCircular(Long64_t maxEntries);
   virtual void            SetDebug(Int_t level = 1, Long64_t min = 0, Long64_t max = 9999999); // *MENU*
   virtual void            SetDefaultEntryOffsetLen(Int_t newdefault, Bool_t updateExisting = kFALSE);
   virtual void            SetDirectory(TDirectory* dir);
   virtual Long64_t        SetEntries(Long64_t n = -1);
   virtual void            SetEstimate(Long64_t nentries = 10000);
   virtual void            SetFileNumber(Int_t number = 0);
   virtual void            SetEventList(TEventList* list);
   virtual void            SetEntryList(TEntryList* list, Option_t *opt="");
   virtual void            SetMakeClass(Int_t make);
   virtual void            SetMaxEntryLoop(Long64_t maxev = 1000000000) { fMaxEntryLoop = maxev; } // *MENU*
   static  void            SetMaxTreeSize(Long64_t maxsize = 1900000000);
   virtual void            SetMaxVirtualSize(Long64_t size = 0) { fMaxVirtualSize = size; } // *MENU*
   virtual void            SetName(const char* name); // *MENU*
   virtual void            SetNotify(TObject* obj) { fNotify = obj; }
   virtual void            SetObject(const char* name, const char* title);
   virtual void            SetParallelUnzip(Bool_t opt=kTRUE, Float_t RelSize=-1);
   virtual void            SetScanField(Int_t n = 50) { fScanField = n; } // *MENU*
   virtual void            SetTimerInterval(Int_t msec = 333) { fTimerInterval=msec; }
   virtual void            SetTreeIndex(TVirtualIndex*index);
   virtual void            SetWeight(Double_t w = 1, Option_t* option = "");
   virtual void            SetUpdate(Int_t freq = 0) { fUpdate = freq; }
   virtual void            Show(Long64_t entry = -1, Int_t lenmax = 20);
   virtual void            StartViewer(); // *MENU*
   virtual void            StopCacheLearningPhase();
   virtual Int_t           UnbinnedFit(const char* funcname, const char* varexp, const char* selection = "", Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0);
   void                    UseCurrentStyle();
   virtual Int_t           Write(const char *name=0, Int_t option=0, Int_t bufsize=0);
   virtual Int_t           Write(const char *name=0, Int_t option=0, Int_t bufsize=0) const;


   ClassDef(TTree,19)  //Tree descriptor (the main ROOT I/O class)
};

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TTreeFriendLeafIter                                                  //
//                                                                      //
// Iterator on all the leaves in a TTree and its friend                 //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

class TTreeFriendLeafIter : public TIterator {

protected:
   TTree             *fTree;         //tree being iterated
   TIterator         *fLeafIter;     //current leaf sub-iterator.
   TIterator         *fTreeIter;     //current tree sub-iterator.
   Bool_t             fDirection;    //iteration direction

   TTreeFriendLeafIter() : fTree(0), fLeafIter(0), fTreeIter(0),
       fDirection(0) { }

public:
   TTreeFriendLeafIter(const TTree* t, Bool_t dir = kIterForward);
   TTreeFriendLeafIter(const TTreeFriendLeafIter &iter);
   ~TTreeFriendLeafIter() { SafeDelete(fLeafIter); SafeDelete(fTreeIter); }
   TIterator &operator=(const TIterator &rhs);
   TTreeFriendLeafIter &operator=(const TTreeFriendLeafIter &rhs);

   const TCollection *GetCollection() const { return 0; }
   Option_t          *GetOption() const;
   TObject           *Next();
   void               Reset() { SafeDelete(fLeafIter); SafeDelete(fTreeIter); }
   bool operator !=(const TIterator&) const {
      // TODO: Implement me
      return false;
   }
   bool operator !=(const TTreeFriendLeafIter&) const {
      // TODO: Implement me
      return false;
   }
   TObject *operator*() const {
      // TODO: Implement me
      return nullptr;
   }
   ClassDef(TTreeFriendLeafIter,0)  //Linked list iterator
 };


#endif
 TTree.h:1
 TTree.h:2
 TTree.h:3
 TTree.h:4
 TTree.h:5
 TTree.h:6
 TTree.h:7
 TTree.h:8
 TTree.h:9
 TTree.h:10
 TTree.h:11
 TTree.h:12
 TTree.h:13
 TTree.h:14
 TTree.h:15
 TTree.h:16
 TTree.h:17
 TTree.h:18
 TTree.h:19
 TTree.h:20
 TTree.h:21
 TTree.h:22
 TTree.h:23
 TTree.h:24
 TTree.h:25
 TTree.h:26
 TTree.h:27
 TTree.h:28
 TTree.h:29
 TTree.h:30
 TTree.h:31
 TTree.h:32
 TTree.h:33
 TTree.h:34
 TTree.h:35
 TTree.h:36
 TTree.h:37
 TTree.h:38
 TTree.h:39
 TTree.h:40
 TTree.h:41
 TTree.h:42
 TTree.h:43
 TTree.h:44
 TTree.h:45
 TTree.h:46
 TTree.h:47
 TTree.h:48
 TTree.h:49
 TTree.h:50
 TTree.h:51
 TTree.h:52
 TTree.h:53
 TTree.h:54
 TTree.h:55
 TTree.h:56
 TTree.h:57
 TTree.h:58
 TTree.h:59
 TTree.h:60
 TTree.h:61
 TTree.h:62
 TTree.h:63
 TTree.h:64
 TTree.h:65
 TTree.h:66
 TTree.h:67
 TTree.h:68
 TTree.h:69
 TTree.h:70
 TTree.h:71
 TTree.h:72
 TTree.h:73
 TTree.h:74
 TTree.h:75
 TTree.h:76
 TTree.h:77
 TTree.h:78
 TTree.h:79
 TTree.h:80
 TTree.h:81
 TTree.h:82
 TTree.h:83
 TTree.h:84
 TTree.h:85
 TTree.h:86
 TTree.h:87
 TTree.h:88
 TTree.h:89
 TTree.h:90
 TTree.h:91
 TTree.h:92
 TTree.h:93
 TTree.h:94
 TTree.h:95
 TTree.h:96
 TTree.h:97
 TTree.h:98
 TTree.h:99
 TTree.h:100
 TTree.h:101
 TTree.h:102
 TTree.h:103
 TTree.h:104
 TTree.h:105
 TTree.h:106
 TTree.h:107
 TTree.h:108
 TTree.h:109
 TTree.h:110
 TTree.h:111
 TTree.h:112
 TTree.h:113
 TTree.h:114
 TTree.h:115
 TTree.h:116
 TTree.h:117
 TTree.h:118
 TTree.h:119
 TTree.h:120
 TTree.h:121
 TTree.h:122
 TTree.h:123
 TTree.h:124
 TTree.h:125
 TTree.h:126
 TTree.h:127
 TTree.h:128
 TTree.h:129
 TTree.h:130
 TTree.h:131
 TTree.h:132
 TTree.h:133
 TTree.h:134
 TTree.h:135
 TTree.h:136
 TTree.h:137
 TTree.h:138
 TTree.h:139
 TTree.h:140
 TTree.h:141
 TTree.h:142
 TTree.h:143
 TTree.h:144
 TTree.h:145
 TTree.h:146
 TTree.h:147
 TTree.h:148
 TTree.h:149
 TTree.h:150
 TTree.h:151
 TTree.h:152
 TTree.h:153
 TTree.h:154
 TTree.h:155
 TTree.h:156
 TTree.h:157
 TTree.h:158
 TTree.h:159
 TTree.h:160
 TTree.h:161
 TTree.h:162
 TTree.h:163
 TTree.h:164
 TTree.h:165
 TTree.h:166
 TTree.h:167
 TTree.h:168
 TTree.h:169
 TTree.h:170
 TTree.h:171
 TTree.h:172
 TTree.h:173
 TTree.h:174
 TTree.h:175
 TTree.h:176
 TTree.h:177
 TTree.h:178
 TTree.h:179
 TTree.h:180
 TTree.h:181
 TTree.h:182
 TTree.h:183
 TTree.h:184
 TTree.h:185
 TTree.h:186
 TTree.h:187
 TTree.h:188
 TTree.h:189
 TTree.h:190
 TTree.h:191
 TTree.h:192
 TTree.h:193
 TTree.h:194
 TTree.h:195
 TTree.h:196
 TTree.h:197
 TTree.h:198
 TTree.h:199
 TTree.h:200
 TTree.h:201
 TTree.h:202
 TTree.h:203
 TTree.h:204
 TTree.h:205
 TTree.h:206
 TTree.h:207
 TTree.h:208
 TTree.h:209
 TTree.h:210
 TTree.h:211
 TTree.h:212
 TTree.h:213
 TTree.h:214
 TTree.h:215
 TTree.h:216
 TTree.h:217
 TTree.h:218
 TTree.h:219
 TTree.h:220
 TTree.h:221
 TTree.h:222
 TTree.h:223
 TTree.h:224
 TTree.h:225
 TTree.h:226
 TTree.h:227
 TTree.h:228
 TTree.h:229
 TTree.h:230
 TTree.h:231
 TTree.h:232
 TTree.h:233
 TTree.h:234
 TTree.h:235
 TTree.h:236
 TTree.h:237
 TTree.h:238
 TTree.h:239
 TTree.h:240
 TTree.h:241
 TTree.h:242
 TTree.h:243
 TTree.h:244
 TTree.h:245
 TTree.h:246
 TTree.h:247
 TTree.h:248
 TTree.h:249
 TTree.h:250
 TTree.h:251
 TTree.h:252
 TTree.h:253
 TTree.h:254
 TTree.h:255
 TTree.h:256
 TTree.h:257
 TTree.h:258
 TTree.h:259
 TTree.h:260
 TTree.h:261
 TTree.h:262
 TTree.h:263
 TTree.h:264
 TTree.h:265
 TTree.h:266
 TTree.h:267
 TTree.h:268
 TTree.h:269
 TTree.h:270
 TTree.h:271
 TTree.h:272
 TTree.h:273
 TTree.h:274
 TTree.h:275
 TTree.h:276
 TTree.h:277
 TTree.h:278
 TTree.h:279
 TTree.h:280
 TTree.h:281
 TTree.h:282
 TTree.h:283
 TTree.h:284
 TTree.h:285
 TTree.h:286
 TTree.h:287
 TTree.h:288
 TTree.h:289
 TTree.h:290
 TTree.h:291
 TTree.h:292
 TTree.h:293
 TTree.h:294
 TTree.h:295
 TTree.h:296
 TTree.h:297
 TTree.h:298
 TTree.h:299
 TTree.h:300
 TTree.h:301
 TTree.h:302
 TTree.h:303
 TTree.h:304
 TTree.h:305
 TTree.h:306
 TTree.h:307
 TTree.h:308
 TTree.h:309
 TTree.h:310
 TTree.h:311
 TTree.h:312
 TTree.h:313
 TTree.h:314
 TTree.h:315
 TTree.h:316
 TTree.h:317
 TTree.h:318
 TTree.h:319
 TTree.h:320
 TTree.h:321
 TTree.h:322
 TTree.h:323
 TTree.h:324
 TTree.h:325
 TTree.h:326
 TTree.h:327
 TTree.h:328
 TTree.h:329
 TTree.h:330
 TTree.h:331
 TTree.h:332
 TTree.h:333
 TTree.h:334
 TTree.h:335
 TTree.h:336
 TTree.h:337
 TTree.h:338
 TTree.h:339
 TTree.h:340
 TTree.h:341
 TTree.h:342
 TTree.h:343
 TTree.h:344
 TTree.h:345
 TTree.h:346
 TTree.h:347
 TTree.h:348
 TTree.h:349
 TTree.h:350
 TTree.h:351
 TTree.h:352
 TTree.h:353
 TTree.h:354
 TTree.h:355
 TTree.h:356
 TTree.h:357
 TTree.h:358
 TTree.h:359
 TTree.h:360
 TTree.h:361
 TTree.h:362
 TTree.h:363
 TTree.h:364
 TTree.h:365
 TTree.h:366
 TTree.h:367
 TTree.h:368
 TTree.h:369
 TTree.h:370
 TTree.h:371
 TTree.h:372
 TTree.h:373
 TTree.h:374
 TTree.h:375
 TTree.h:376
 TTree.h:377
 TTree.h:378
 TTree.h:379
 TTree.h:380
 TTree.h:381
 TTree.h:382
 TTree.h:383
 TTree.h:384
 TTree.h:385
 TTree.h:386
 TTree.h:387
 TTree.h:388
 TTree.h:389
 TTree.h:390
 TTree.h:391
 TTree.h:392
 TTree.h:393
 TTree.h:394
 TTree.h:395
 TTree.h:396
 TTree.h:397
 TTree.h:398
 TTree.h:399
 TTree.h:400
 TTree.h:401
 TTree.h:402
 TTree.h:403
 TTree.h:404
 TTree.h:405
 TTree.h:406
 TTree.h:407
 TTree.h:408
 TTree.h:409
 TTree.h:410
 TTree.h:411
 TTree.h:412
 TTree.h:413
 TTree.h:414
 TTree.h:415
 TTree.h:416
 TTree.h:417
 TTree.h:418
 TTree.h:419
 TTree.h:420
 TTree.h:421
 TTree.h:422
 TTree.h:423
 TTree.h:424
 TTree.h:425
 TTree.h:426
 TTree.h:427
 TTree.h:428
 TTree.h:429
 TTree.h:430
 TTree.h:431
 TTree.h:432
 TTree.h:433
 TTree.h:434
 TTree.h:435
 TTree.h:436
 TTree.h:437
 TTree.h:438
 TTree.h:439
 TTree.h:440
 TTree.h:441
 TTree.h:442
 TTree.h:443
 TTree.h:444
 TTree.h:445
 TTree.h:446
 TTree.h:447
 TTree.h:448
 TTree.h:449
 TTree.h:450
 TTree.h:451
 TTree.h:452
 TTree.h:453
 TTree.h:454
 TTree.h:455
 TTree.h:456
 TTree.h:457
 TTree.h:458
 TTree.h:459
 TTree.h:460
 TTree.h:461
 TTree.h:462
 TTree.h:463
 TTree.h:464
 TTree.h:465
 TTree.h:466
 TTree.h:467
 TTree.h:468
 TTree.h:469
 TTree.h:470
 TTree.h:471
 TTree.h:472
 TTree.h:473
 TTree.h:474
 TTree.h:475
 TTree.h:476
 TTree.h:477
 TTree.h:478
 TTree.h:479
 TTree.h:480
 TTree.h:481
 TTree.h:482
 TTree.h:483
 TTree.h:484
 TTree.h:485
 TTree.h:486
 TTree.h:487
 TTree.h:488
 TTree.h:489
 TTree.h:490
 TTree.h:491
 TTree.h:492
 TTree.h:493
 TTree.h:494
 TTree.h:495
 TTree.h:496
 TTree.h:497
 TTree.h:498
 TTree.h:499
 TTree.h:500
 TTree.h:501
 TTree.h:502
 TTree.h:503
 TTree.h:504
 TTree.h:505
 TTree.h:506
 TTree.h:507
 TTree.h:508
 TTree.h:509
 TTree.h:510
 TTree.h:511
 TTree.h:512
 TTree.h:513
 TTree.h:514
 TTree.h:515
 TTree.h:516
 TTree.h:517
 TTree.h:518
 TTree.h:519
 TTree.h:520
 TTree.h:521
 TTree.h:522
 TTree.h:523
 TTree.h:524
 TTree.h:525
 TTree.h:526
 TTree.h:527
 TTree.h:528
 TTree.h:529
 TTree.h:530
 TTree.h:531
 TTree.h:532
 TTree.h:533
 TTree.h:534
 TTree.h:535
 TTree.h:536
 TTree.h:537
 TTree.h:538
 TTree.h:539
 TTree.h:540
 TTree.h:541
 TTree.h:542
 TTree.h:543
 TTree.h:544
 TTree.h:545
 TTree.h:546
 TTree.h:547
 TTree.h:548
 TTree.h:549
 TTree.h:550
 TTree.h:551
 TTree.h:552
 TTree.h:553
 TTree.h:554
 TTree.h:555
 TTree.h:556
 TTree.h:557
 TTree.h:558
 TTree.h:559
 TTree.h:560
 TTree.h:561
 TTree.h:562
 TTree.h:563
 TTree.h:564
 TTree.h:565
 TTree.h:566
 TTree.h:567
 TTree.h:568
 TTree.h:569
 TTree.h:570
 TTree.h:571
 TTree.h:572
 TTree.h:573
 TTree.h:574
 TTree.h:575
 TTree.h:576
 TTree.h:577
 TTree.h:578
 TTree.h:579
 TTree.h:580
 TTree.h:581
 TTree.h:582
 TTree.h:583
 TTree.h:584
 TTree.h:585
 TTree.h:586
 TTree.h:587
 TTree.h:588
 TTree.h:589
 TTree.h:590
 TTree.h:591
 TTree.h:592
 TTree.h:593
 TTree.h:594
 TTree.h:595