library: libTree #include "TDSet.h"

# TDSet

class description - source file - inheritance tree (.pdf)

## class TDSet : public TNamed

| Inheritance Chart:
`TObject`
| <- | `TNamed`
| <- | `TDSet` |

        public:

                                TDSet()
                                TDSet(const char* type, const char* objname = "*", const char* dir = "/")
                                TDSet(const TDSet&)
                        virtual ~TDSet()
                 virtual Bool_t Add(const char* file, const char* objname = "0", const char* dir = "0", Long64_t first = 0, Long64_t num = -1, const char* msd = "0")
                 virtual Bool_t Add(TDSet* set)
                   virtual void AddFriend(TDSet* friendset)
                           void AddInput(TObject* obj)
                 static TClass* Class()
                           void ClearInput()
                  TDSetElement* Current() const
                  virtual Int_t Draw(const char* varexp, const char* selection, Option_t* option = "", Long64_t nentries = -1, Long64_t firstentry = 0)
                  virtual Int_t Draw(const char* varexp, const TCut& selection, Option_t* option = "", Long64_t nentries = -1, Long64_t firstentry = 0)
                   virtual void Draw(Option_t* opt)
                         Bool_t ElementsValid() const
                    const char* GetDirectory() const
                static Long64_t GetEntries(Bool_t isTree, const char* filename, const char* path, const char* objname)
                    TEventList* GetEventList() const
                         TList* GetListOfElements() const
                    const char* GetObjName() const
                       TObject* GetOutput(const char* name)
                         TList* GetOutputList()
                 virtual TTree* GetTreeHeader(TVirtualProof* proof)
                    const char* GetType() const
                virtual TClass* IsA() const
                         Bool_t IsTree() const
                         Bool_t IsValid() const
                  static TDSet* MakeTDSet(TChain* chain)
          virtual TDSetElement* Next()
                         TDSet& operator=(const TDSet&)
                   virtual void Print(Option_t* option = "") const
                  virtual Int_t Process(const char* selector, Option_t* option = "", Long64_t nentries = -1, Long64_t firstentry = 0, TEventList* evl = 0)
                   virtual void Reset()
                           void SetDirectory(const char* dir)
                   virtual void SetEventList(TEventList* evl)
                           void SetObjName(const char* objname)
                   virtual void ShowMembers(TMemberInspector& insp, char* parent)
                   virtual void StartViewer()
                   virtual void Streamer(TBuffer& b)
                           void StreamerNVirtual(TBuffer& b)
                           void Validate()
                           void Validate(TDSet* dset)

### Data Members

        private:

              TString fObjName    name of objects to be analyzed (e.g. TTree name)
               TList* fElements   -> list of TDSetElements
               Bool_t fIsTree     true if type is a TTree (or TTree derived)
               TIter* fIterator   ! iterator on fElements
          TEventList* fEventList  ! event list for processing

        protected:

          TDSetElement* fCurrent  ! current element

## Class Description

     TDSet

     This class implements a data set to be used for PROOF processing.
     The TDSet defines the class of which objects will be processed,
     the directory in the file where the objects of that type can be
     found and the list of files to be processed. The files can be
     specified as logical file names (LFN's) or as physical file names
     (PFN's). In case of LFN's the resolution to PFN's will be done
     according to the currently active GRID interface.
     Examples:
       TDSet treeset("TTree", "AOD");
       treeset.Add("lfn:/alien.cern.ch/alice/prod2002/file1");
       ...
       treeset.AddFriend(friendset);

     or

       TDSet objset("MyEvent", "*", "/events");
       objset.Add("root://cms.cern.ch/user/prod2002/hprod_1.root");
       ...
       objset.Add(set2003);

     Validity of file names will only be checked at processing time
     (typically on the PROOF master server), not at creation time.

TDSet()

     Default ctor.

TDSet(const char *type, const char *objname, const char *dir)

     Create a TDSet object. The "type" defines the class of which objects
     will be processed. The optional "objname" argument specifies the
     name of the objects of the specified class (the name is mandatory
     if the type inherits from a TTree). If the "objname" is not given all
     objects of the class found in the specified directory are processed.
     The "dir" argument specifies in which directory the objects are
     to be found, the top level directory ("/") is the default.
     Directories can be specified using wildcards, e.g. "*" or "/*"
     means to look in all top level directories, "/dir/*" in all
     directories under "/dir", and "/*/*" to look in all directories
     two levels deep.

~TDSet()

     Cleanup.

Int_t Process(const char *selector, Option_t *option, Long64_t nentries, Long64_t first, TEventList *evl)

     Process TDSet on currently active PROOF session.
     Returns -1 in case of error, 0 otherwise.

void AddInput(TObject *obj)

     Add objects that might be needed during the processing of
     the selector (see Process()).

void ClearInput()

     Clear input object list.

TObject* GetOutput(const char *name)

     Get specified object that has been produced during the processing
     (see Process()).

TList* GetOutputList()

     Get list with all object created during processing (see Process()).

void Print(const Option_t *opt) const

     Print TDSet basic or full data. When option="a" print full data.

void SetObjName(const char *objname)

     Set/change object name.

void SetDirectory(const char *dir)

     Set/change directory.

Bool_t Add(const char *file, const char *objname, const char *dir, Long64_t first, Long64_t num, const char *msd)

     Add file to list of files to be analyzed. Optionally with the
     objname and dir arguments the default, TDSet wide, objname and
     dir can be overridden.

Bool_t Add(TDSet *set)

     Add specified data set to the this set.

void AddFriend(TDSet *friendset)

     Add friend dataset to this set. Only possible if the TDSet type is
     a TTree or derived class.

void Reset()

     Reset or initialize access to the elements.

TDSetElement* Next()

     Returns next TDSetElement.

Long64_t GetEntries(Bool_t isTree, const char *filename, const char *path, const char *objname)

     Returns number of entries in tree or objects in file. Returns -1 in
     case of error.

Int_t Draw(const char *varexp, const TCut &selection, Option_t *option, Long64_t nentries, Long64_t firstentry)

     Draw expression varexp for specified entries.
     This function accepts a TCut objects as argument.
     Use the operator+ to concatenate cuts.
     Example:
       dset.Draw("x",cut1+cut2+cut3);

Int_t Draw(const char *varexp, const char *selection, Option_t *option, Long64_t nentries, Long64_t firstentry)

     Draw expression varexp for specified entries.
     See TTree::Draw().

void StartViewer()

     Start the TTreeViewer on this TTree.

TTree* GetTreeHeader(TVirtualProof* proof)

     Returns a tree header containing the branches' structure of the dataset.

TDSet* MakeTDSet(TChain *chain)

     Creates a new TDSet new containing files from te given chain.

Bool_t ElementsValid() const

     Check if all elemnts are valid.

void Validate()

     Validate the TDSet by opening files.

void Validate(TDSet* dset)

     Validate the TDSet against another TDSet.
     Only validates elements in common from input TDSet.

### Inline Functions

                     void Draw(Option_t* opt)
                   Bool_t IsTree() const
                   Bool_t IsValid() const
              const char* GetType() const
              const char* GetObjName() const
              const char* GetDirectory() const
                   TList* GetListOfElements() const
            TDSetElement* Current() const
                     void SetEventList(TEventList* evl)
              TEventList* GetEventList() const
                  TClass* Class()
                  TClass* IsA() const
                     void ShowMembers(TMemberInspector& insp, char* parent)
                     void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
                    TDSet TDSet(const TDSet&)
                   TDSet& operator=(const TDSet&)

Author: Fons Rademakers 11/01/02
Last update: root/tree:$Name: $:$Id: TDSet.cxx,v 1.20 2005/05/13 16:39:50 rdm Exp $
Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *