ROOT logo
// @(#)root/tree:$Id: TChain.h 26399 2008-11-24 01:44:18Z rdm $
// Author: Rene Brun   03/02/97

/*************************************************************************
 * 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_TChain
#define ROOT_TChain


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TChain                                                               //
//                                                                      //
// A chain of TTrees.                                                   //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TTree
#include "TTree.h"
#endif

class TFile;
class TBrowser;
class TCut;
class TEntryList;
class TEventList;
class TCollection;

class TChain : public TTree {

protected:
   Int_t        fTreeOffsetLen;    //  Current size of fTreeOffset array
   Int_t        fNtrees;           //  Number of trees
   Int_t        fTreeNumber;       //! Current Tree number in fTreeOffset table
   Long64_t    *fTreeOffset;       //[fTreeOffsetLen] Array of variables
   Bool_t       fCanDeleteRefs;    //! If true, TProcessIDs are deleted when closing a file
   TTree       *fTree;             //! Pointer to current tree (Note: We do *not* own this tree.)
   TFile       *fFile;             //! Pointer to current file (We own the file).
   TObjArray   *fFiles;            //-> List of file names containing the trees (TChainElement, owned)
   TList       *fStatus;           //-> List of active/inactive branches (TChainElement, owned)
   TChain      *fProofChain;       //! chain proxy when going to be processed by PROOF

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

protected:
   void ReleaseChainProof();

public:
   // TChain constants
   enum {
      kGlobalWeight   = BIT(15),
      kAutoDelete     = BIT(16),
      kProofUptodate  = BIT(17),
      kProofLite      = BIT(18),
      kBigNumber      = 1234567890
   };

public:
   TChain();
   TChain(const char* name, const char* title = "");
   virtual ~TChain();

   virtual Int_t     Add(TChain* chain);
   virtual Int_t     Add(const char* name, Long64_t nentries = kBigNumber);
   virtual Int_t     AddFile(const char* name, Long64_t nentries = kBigNumber, const char* tname = "");
   virtual Int_t     AddFileInfoList(TCollection* list, Long64_t nfiles = kBigNumber);
   virtual TFriendElement *AddFriend(const char* chainname, const char* dummy = "");
   virtual TFriendElement *AddFriend(const char* chainname, TFile* dummy);
   virtual TFriendElement *AddFriend(TTree* chain, const char* alias = "", Bool_t warn = kFALSE);
   virtual void      Browse(TBrowser*);
   virtual void      CanDeleteRefs(Bool_t flag = kTRUE);
   virtual void      CreatePackets();
   virtual void      DirectoryAutoAdd(TDirectory *);
   virtual Long64_t  Draw(const char* varexp, const TCut& selection, Option_t* option = "", Long64_t nentries = kBigNumber, Long64_t firstentry = 0);
   virtual Long64_t  Draw(const char* varexp, const char* selection, Option_t* option = "", Long64_t nentries = kBigNumber, Long64_t firstentry = 0); // *MENU*
   virtual void      Draw(Option_t* opt) { Draw(opt, "", "", 1000000000, 0); }
   virtual Int_t     Fill() { MayNotUse("Fill()"); return -1; }
   virtual TBranch  *FindBranch(const char* name);
   virtual TLeaf    *FindLeaf(const char* name);
   virtual TBranch  *GetBranch(const char* name);
   virtual Bool_t    GetBranchStatus(const char* branchname) const;
   virtual Long64_t  GetChainEntryNumber(Long64_t entry) const;
           Int_t     GetNtrees() const { return fNtrees; }
   virtual Long64_t  GetEntries() const;
   virtual Long64_t  GetEntries(const char *sel) { return TTree::GetEntries(sel); }
   virtual Int_t     GetEntry(Long64_t entry=0, Int_t getall=0);
   virtual Long64_t  GetEntryNumber(Long64_t entry) const;
   virtual Int_t     GetEntryWithIndex(Int_t major, Int_t minor=0);
   TFile            *GetFile() const;
   virtual TLeaf    *GetLeaf(const char* name);
   virtual TObjArray *GetListOfBranches();
   //                Warning, GetListOfFiles returns the list of TChainElements (not the list of files)
   //                see TChain::AddFile to see how to get the corresponding TFile objects
   TObjArray        *GetListOfFiles() const {return fFiles;}
   virtual TObjArray *GetListOfLeaves();
   virtual const char *GetAlias(const char *aliasName) const;
   virtual Double_t  GetMaximum(const char *columname);
   virtual Double_t  GetMinimum(const char *columname);
   virtual Int_t     GetNbranches();
   virtual Long64_t  GetReadEntry() const;
   TList            *GetStatus() const { return fStatus; }
   virtual TTree    *GetTree() const { return fTree; }
   virtual Int_t     GetTreeNumber() const { return fTreeNumber; }
           Long64_t *GetTreeOffset() const { return fTreeOffset; }
           Int_t     GetTreeOffsetLen() const { return fTreeOffsetLen; }
   virtual Double_t  GetWeight() const;
   virtual Int_t     LoadBaskets(Long64_t maxmemory);
   virtual Long64_t  LoadTree(Long64_t entry);
           void      Lookup(Bool_t force = kFALSE);
   virtual void      Loop(Option_t *option="", Long64_t nentries=kBigNumber, Long64_t firstentry=0); // *MENU*
   virtual void      ls(Option_t *option="") const;
   virtual Long64_t  Merge(const char *name, Option_t *option = "");
   virtual Long64_t  Merge(TCollection *list, Option_t *option = "");
   virtual Long64_t  Merge(TFile *file, Int_t basketsize, Option_t *option="");
   virtual void      Print(Option_t *option="") const;
   virtual Long64_t  Process(const char *filename, Option_t *option="", Long64_t nentries=kBigNumber, Long64_t firstentry=0); // *MENU*
#ifndef __CINT__
   virtual Long64_t  Process(TSelector *selector, Option_t *option="",  Long64_t nentries=kBigNumber, Long64_t firstentry=0);
#endif
   virtual void      Reset(Option_t *option="");
   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 void      SetAutoDelete(Bool_t autodel=kTRUE);
   virtual void      SetBranchAddress(const char *bname,void *add, TBranch **ptr = 0);
   virtual void      SetBranchAddress(const char *bname,void *add, TBranch **ptr, TClass *realClass, EDataType datatype, Bool_t isptr);
   virtual void      SetBranchAddress(const char *bname,void *add, TClass *realClass, EDataType datatype, Bool_t isptr);

   virtual void      SetBranchStatus(const char *bname, Bool_t status=1, UInt_t *found=0);
   virtual void      SetDirectory(TDirectory *dir);
   virtual void      SetEntryList(TEntryList *elist, Option_t *opt="");
   virtual void      SetEntryListFile(const char *filename="", Option_t *opt="");
   virtual void      SetEventList(TEventList *evlist);
   virtual void      SetMakeClass(Int_t make) { TTree::SetMakeClass(make); if (fTree) fTree->SetMakeClass(make);}
   virtual void      SetPacketSize(Int_t size = 100);
   virtual void      SetProof(Bool_t on = kTRUE, Bool_t refresh = kFALSE, Bool_t gettreeheader = kFALSE);
   virtual void      SetWeight(Double_t w=1, Option_t *option="");
   virtual void      UseCache(Int_t maxCacheSize = 10, Int_t pageSize = 0);

   ClassDef(TChain,5)  //A chain of TTrees
};

#endif // ROOT_TChain
 TChain.h:1
 TChain.h:2
 TChain.h:3
 TChain.h:4
 TChain.h:5
 TChain.h:6
 TChain.h:7
 TChain.h:8
 TChain.h:9
 TChain.h:10
 TChain.h:11
 TChain.h:12
 TChain.h:13
 TChain.h:14
 TChain.h:15
 TChain.h:16
 TChain.h:17
 TChain.h:18
 TChain.h:19
 TChain.h:20
 TChain.h:21
 TChain.h:22
 TChain.h:23
 TChain.h:24
 TChain.h:25
 TChain.h:26
 TChain.h:27
 TChain.h:28
 TChain.h:29
 TChain.h:30
 TChain.h:31
 TChain.h:32
 TChain.h:33
 TChain.h:34
 TChain.h:35
 TChain.h:36
 TChain.h:37
 TChain.h:38
 TChain.h:39
 TChain.h:40
 TChain.h:41
 TChain.h:42
 TChain.h:43
 TChain.h:44
 TChain.h:45
 TChain.h:46
 TChain.h:47
 TChain.h:48
 TChain.h:49
 TChain.h:50
 TChain.h:51
 TChain.h:52
 TChain.h:53
 TChain.h:54
 TChain.h:55
 TChain.h:56
 TChain.h:57
 TChain.h:58
 TChain.h:59
 TChain.h:60
 TChain.h:61
 TChain.h:62
 TChain.h:63
 TChain.h:64
 TChain.h:65
 TChain.h:66
 TChain.h:67
 TChain.h:68
 TChain.h:69
 TChain.h:70
 TChain.h:71
 TChain.h:72
 TChain.h:73
 TChain.h:74
 TChain.h:75
 TChain.h:76
 TChain.h:77
 TChain.h:78
 TChain.h:79
 TChain.h:80
 TChain.h:81
 TChain.h:82
 TChain.h:83
 TChain.h:84
 TChain.h:85
 TChain.h:86
 TChain.h:87
 TChain.h:88
 TChain.h:89
 TChain.h:90
 TChain.h:91
 TChain.h:92
 TChain.h:93
 TChain.h:94
 TChain.h:95
 TChain.h:96
 TChain.h:97
 TChain.h:98
 TChain.h:99
 TChain.h:100
 TChain.h:101
 TChain.h:102
 TChain.h:103
 TChain.h:104
 TChain.h:105
 TChain.h:106
 TChain.h:107
 TChain.h:108
 TChain.h:109
 TChain.h:110
 TChain.h:111
 TChain.h:112
 TChain.h:113
 TChain.h:114
 TChain.h:115
 TChain.h:116
 TChain.h:117
 TChain.h:118
 TChain.h:119
 TChain.h:120
 TChain.h:121
 TChain.h:122
 TChain.h:123
 TChain.h:124
 TChain.h:125
 TChain.h:126
 TChain.h:127
 TChain.h:128
 TChain.h:129
 TChain.h:130
 TChain.h:131
 TChain.h:132
 TChain.h:133
 TChain.h:134
 TChain.h:135
 TChain.h:136
 TChain.h:137
 TChain.h:138
 TChain.h:139
 TChain.h:140
 TChain.h:141
 TChain.h:142
 TChain.h:143
 TChain.h:144
 TChain.h:145
 TChain.h:146
 TChain.h:147
 TChain.h:148
 TChain.h:149
 TChain.h:150
 TChain.h:151