00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TDSet
00013 #define ROOT_TDSet
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef ROOT_TNamed
00046 #include "TNamed.h"
00047 #endif
00048
00049 class TChain;
00050 class TCollection;
00051 class TCut;
00052 class TDSet;
00053 class TEventList;
00054 class TEntryList;
00055 class TFileInfo;
00056 class THashList;
00057 class TIter;
00058 class TList;
00059 class TProof;
00060 class TProofChain;
00061 class TTree;
00062
00063
00064 #include <set>
00065 #include <list>
00066
00067 class TDSetElement : public TNamed {
00068 public:
00069 typedef std::list<std::pair<TDSetElement*, TString> > FriendsList_t;
00070
00071 enum EStatusBits {
00072 kHasBeenLookedUp = BIT(15),
00073 kWriteV3 = BIT(16),
00074 kEmpty = BIT(17),
00075 kCorrupted = BIT(18),
00076 kNewRun = BIT(19),
00077 kNewPacket = BIT(20)
00078 };
00079
00080 private:
00081 TString fDirectory;
00082 Long64_t fFirst;
00083 Long64_t fNum;
00084 TString fMsd;
00085 Long64_t fTDSetOffset;
00086
00087 TObject *fEntryList;
00088 Bool_t fValid;
00089 Long64_t fEntries;
00090 TList *fFriends;
00091
00092 TString fDataSet;
00093 TList *fAssocObjList;
00094
00095
00096 Bool_t HasBeenLookedUp() const { return TestBit(kHasBeenLookedUp); }
00097
00098 TDSetElement& operator=(const TDSetElement &);
00099
00100 public:
00101 TDSetElement();
00102 TDSetElement(const char *file, const char *objname = 0,
00103 const char *dir = 0, Long64_t first = 0, Long64_t num = -1,
00104 const char *msd = 0, const char *dataset = 0);
00105 TDSetElement(const TDSetElement& elem);
00106 virtual ~TDSetElement();
00107
00108 virtual TList *GetListOfFriends() const { return fFriends; }
00109 virtual void AddFriend(TDSetElement *friendElement, const char *alias);
00110 virtual void DeleteFriends();
00111 const char *GetFileName() const { return GetName(); }
00112 Long64_t GetFirst() const { return fFirst; }
00113 void SetFirst(Long64_t first) { fFirst = first; }
00114 Long64_t GetNum() const { return fNum; }
00115 Long64_t GetEntries(Bool_t istree = kTRUE, Bool_t openfile = kTRUE);
00116 void SetEntries(Long64_t ent) { fEntries = ent; }
00117 const char *GetMsd() const { return fMsd; }
00118 void SetNum(Long64_t num) { fNum = num; }
00119 Bool_t GetValid() const { return fValid; }
00120 const char *GetObjName() const { return GetTitle(); }
00121 const char *GetDirectory() const;
00122 const char *GetDataSet() const { return fDataSet; }
00123 void SetDataSet(const char *dataset) { fDataSet = dataset; }
00124 void AddAssocObj(TObject *assocobj);
00125 TList *GetListOfAssocObjs() const { return fAssocObjList; }
00126 TObject *GetAssocObj(Long64_t i, Bool_t isentry = kFALSE);
00127 void Print(Option_t *options="") const;
00128 Long64_t GetTDSetOffset() const { return fTDSetOffset; }
00129 void SetTDSetOffset(Long64_t offset) { fTDSetOffset = offset; }
00130 void SetEntryList(TObject *aList, Long64_t first = -1, Long64_t num = -1);
00131 TObject *GetEntryList() const { return fEntryList; }
00132 void Validate(Bool_t isTree);
00133 void Validate(TDSetElement *elem);
00134 void Invalidate() { fValid = kFALSE; }
00135 void SetValid() { fValid = kTRUE; }
00136 Int_t Compare(const TObject *obj) const;
00137 Bool_t IsSortable() const { return kTRUE; }
00138 Int_t Lookup(Bool_t force = kFALSE);
00139 void SetLookedUp() { SetBit(kHasBeenLookedUp); }
00140 TFileInfo *GetFileInfo(const char *type = "TTree");
00141
00142 Int_t MergeElement(TDSetElement *elem);
00143
00144 ClassDef(TDSetElement,8)
00145 };
00146
00147
00148 class TDSet : public TNamed {
00149
00150 public:
00151
00152 enum EStatusBits {
00153 kWriteV3 = BIT(16),
00154 kEmpty = BIT(17),
00155 kValidityChecked = BIT(18),
00156 kSomeInvalid = BIT(19),
00157 kMultiDSet = BIT(20)
00158 };
00159
00160 private:
00161 Bool_t fIsTree;
00162 TObject *fEntryList;
00163 TProofChain *fProofChain;
00164
00165 void SplitEntryList();
00166
00167 TDSet(const TDSet &);
00168 void operator=(const TDSet &);
00169
00170 protected:
00171 TString fDir;
00172 TString fType;
00173 TString fObjName;
00174 THashList *fElements;
00175 TIter *fIterator;
00176 TDSetElement *fCurrent;
00177 TList *fSrvMaps;
00178 TIter *fSrvMapsIter;
00179
00180 public:
00181 TDSet();
00182 TDSet(const char *name, const char *objname = "*",
00183 const char *dir = "/", const char *type = 0);
00184 TDSet(const TChain &chain, Bool_t withfriends = kTRUE);
00185 virtual ~TDSet();
00186
00187 virtual Bool_t Add(const char *file, const char *objname = 0,
00188 const char *dir = 0, Long64_t first = 0,
00189 Long64_t num = -1, const char *msd = 0);
00190 virtual Bool_t Add(TDSet *set);
00191 virtual Bool_t Add(TCollection *fileinfo, const char *meta = 0,
00192 Bool_t availableOnly = kFALSE, TCollection *badlist = 0);
00193 virtual Bool_t Add(TFileInfo *fileinfo, const char *meta = 0);
00194 virtual void AddFriend(TDSet *friendset, const char *alias);
00195
00196 virtual Long64_t Process(const char *selector, Option_t *option = "",
00197 Long64_t nentries = -1,
00198 Long64_t firstentry = 0,
00199 TObject *enl = 0);
00200 virtual Long64_t Draw(const char *varexp, const char *selection,
00201 Option_t *option = "", Long64_t nentries = -1,
00202 Long64_t firstentry = 0);
00203 virtual Long64_t Draw(const char *varexp, const TCut &selection,
00204 Option_t *option = "", Long64_t nentries = -1,
00205 Long64_t firstentry = 0);
00206 virtual void Draw(Option_t *opt) { Draw(opt, "", "", 1000000000, 0); }
00207
00208 Int_t ExportFileList(const char *filepath, Option_t *opt = "");
00209
00210 void Print(Option_t *option="") const;
00211
00212 void SetObjName(const char *objname);
00213 void SetDirectory(const char *dir);
00214
00215 Bool_t IsTree() const { return fIsTree; }
00216 Bool_t IsValid() const { return !fType.IsNull(); }
00217 Bool_t ElementsValid();
00218 const char *GetType() const { return fType; }
00219 const char *GetObjName() const { return fObjName; }
00220 const char *GetDirectory() const { return fDir; }
00221 TList *GetListOfElements() const { return (TList *)fElements; }
00222 Int_t GetNumOfFiles();
00223
00224 Int_t Remove(TDSetElement *elem, Bool_t deleteElem = kTRUE);
00225
00226 virtual void Reset();
00227 virtual TDSetElement *Next(Long64_t totalEntries = -1);
00228 TDSetElement *Current() const { return fCurrent; };
00229
00230 static Long64_t GetEntries(Bool_t isTree, const char *filename,
00231 const char *path, TString &objname);
00232
00233 void AddInput(TObject *obj);
00234 void ClearInput();
00235 TObject *GetOutput(const char *name);
00236 TList *GetOutputList();
00237 virtual void StartViewer();
00238
00239 virtual TTree *GetTreeHeader(TProof *proof);
00240 virtual void SetEntryList(TObject *aList);
00241 TObject *GetEntryList() const { return fEntryList; }
00242 void Validate();
00243 void Validate(TDSet *dset);
00244
00245 void Lookup(Bool_t removeMissing = kFALSE, TList **missingFiles = 0);
00246 void SetLookedUp();
00247
00248 void SetSrvMaps(TList *srvmaps = 0);
00249
00250 void SetWriteV3(Bool_t on = kTRUE);
00251
00252 ClassDef(TDSet,8)
00253 };
00254
00255 #endif