File indexing completed on 2025-01-18 10:11:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TFileCollection
0013 #define ROOT_TFileCollection
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include "TNamed.h"
0027
0028 #include "TString.h"
0029
0030 class THashList;
0031 class TMap;
0032 class TList;
0033 class TCollection;
0034 class TFileInfo;
0035 class TFileInfoMeta;
0036 class TObjString;
0037
0038
0039 class TFileCollection : public TNamed {
0040
0041 private:
0042 THashList *fList;
0043 TList *fMetaDataList;
0044
0045 TString fDefaultTree;
0046 Long64_t fTotalSize;
0047 Long64_t fNFiles;
0048
0049 Long64_t fNStagedFiles;
0050 Long64_t fNCorruptFiles;
0051
0052 TFileCollection(const TFileCollection&) = delete;
0053 TFileCollection& operator=(const TFileCollection&) = delete;
0054
0055 void PrintDetailed(TString &showOnly) const;
0056 void FormatSize(Long64_t bytes, TString &um, Double_t &size) const;
0057
0058 public:
0059 enum EStatusBits {
0060 kRemoteCollection = BIT(15)
0061 };
0062 TFileCollection(const char *name = nullptr, const char *title = nullptr,
0063 const char *file = nullptr, Int_t nfiles = -1, Int_t firstfile = 1);
0064 virtual ~TFileCollection();
0065
0066 Int_t Add(TFileInfo *info);
0067 Int_t Add(TFileCollection *coll);
0068 Int_t AddFromFile(const char *file, Int_t nfiles = -1, Int_t firstfile = 1);
0069 Int_t Add(const char *path);
0070 THashList *GetList() { return fList; }
0071 void SetList(THashList* list) { fList = list; }
0072
0073 TObjString *ExportInfo(const char *name = nullptr, Int_t popt = 0);
0074
0075 Long64_t Merge(TCollection* list);
0076 Int_t RemoveDuplicates();
0077 Int_t Update(Long64_t avgsize = -1);
0078 void Sort(Bool_t useindex = kFALSE);
0079 void SetAnchor(const char *anchor);
0080 void Print(Option_t *option = "") const override;
0081
0082 void SetBitAll(UInt_t f);
0083 void ResetBitAll(UInt_t f);
0084
0085 Long64_t GetTotalSize() const { return fTotalSize; }
0086 Long64_t GetNFiles() const { return fNFiles; }
0087 Long64_t GetNStagedFiles() const { return fNStagedFiles; }
0088 Long64_t GetNCorruptFiles() const { return fNCorruptFiles; }
0089 Float_t GetStagedPercentage() const
0090 { return (fNFiles > 0) ? 100. * fNStagedFiles / fNFiles : 0; }
0091 Float_t GetCorruptedPercentage() const
0092 { return (fNFiles > 0) ? 100. * fNCorruptFiles / fNFiles : 0; }
0093
0094 const char *GetDefaultTreeName() const;
0095 void SetDefaultTreeName(const char* treeName) { fDefaultTree = treeName; }
0096 Long64_t GetTotalEntries(const char *tree) const;
0097
0098 TFileInfoMeta *GetMetaData(const char *meta = nullptr) const;
0099 void SetDefaultMetaData(const char *meta);
0100 Bool_t AddMetaData(TObject *meta);
0101 void RemoveMetaData(const char *meta = nullptr);
0102
0103 TFileCollection *GetStagedSubset();
0104
0105 TFileCollection *GetFilesOnServer(const char *server);
0106 TMap *GetFilesPerServer(const char *exclude = nullptr, Bool_t curronly = kFALSE);
0107
0108 ClassDefOverride(TFileCollection, 3)
0109 };
0110
0111 #endif