00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TTreeCloner
00013 #define ROOT_TTreeCloner
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef ROOT_TObjArray
00024 #include "TObjArray.h"
00025 #endif
00026
00027 #include <vector>
00028
00029 #ifdef R__OLDHPACC
00030 namespace std {
00031 using ::string;
00032 using ::vector;
00033 }
00034 #endif
00035
00036 class TBranch;
00037 class TTree;
00038
00039 class TTreeCloner {
00040 TString fWarningMsg;
00041
00042 Bool_t fIsValid;
00043 Bool_t fNeedConversion;
00044 UInt_t fOptions;
00045 TTree *fFromTree;
00046 TTree *fToTree;
00047 Option_t *fMethod;
00048 TObjArray fFromBranches;
00049 TObjArray fToBranches;
00050
00051 UInt_t fMaxBaskets;
00052 UInt_t *fBasketBranchNum;
00053 UInt_t *fBasketNum;
00054
00055 Long64_t *fBasketSeek;
00056 Long64_t *fBasketEntry;
00057 UInt_t *fBasketIndex;
00058
00059 UShort_t fPidOffset;
00060
00061 UInt_t fCloneMethod;
00062 Long64_t fToStartEntries;
00063
00064 enum ECloneMethod {
00065 kDefault = 0,
00066 kSortBasketsByBranch = 1,
00067 kSortBasketsByOffset = 2,
00068 kSortBasketsByEntry = 3
00069 };
00070
00071 class CompareSeek {
00072 TTreeCloner *fObject;
00073 public:
00074 CompareSeek(TTreeCloner *obj) : fObject(obj) {}
00075 bool operator()(UInt_t i1, UInt_t i2);
00076 };
00077
00078 class CompareEntry {
00079 TTreeCloner *fObject;
00080 public:
00081 CompareEntry(TTreeCloner *obj) : fObject(obj) {}
00082 bool operator()(UInt_t i1, UInt_t i2);
00083 };
00084
00085 friend class CompareSeek;
00086 friend class CompareEntry;
00087
00088 public:
00089 enum EClonerOptions {
00090 kNone = 0,
00091 kNoWarnings = BIT(1),
00092 kIgnoreMissingTopLevel = BIT(2)
00093 };
00094
00095 TTreeCloner(TTree *from, TTree *to, Option_t *method, UInt_t options = kNone);
00096 virtual ~TTreeCloner();
00097
00098 void CloseOutWriteBaskets();
00099 UInt_t CollectBranches(TBranch *from, TBranch *to);
00100 UInt_t CollectBranches(TObjArray *from, TObjArray *to);
00101 UInt_t CollectBranches();
00102 void CollectBaskets();
00103 void CopyMemoryBaskets();
00104 void CopyStreamerInfos();
00105 void CopyProcessIds();
00106 const char *GetWarning() const { return fWarningMsg; }
00107 Bool_t Exec();
00108 Bool_t IsValid() { return fIsValid; }
00109 Bool_t NeedConversion() { return fNeedConversion; }
00110 void SortBaskets();
00111 void WriteBaskets();
00112
00113 ClassDef(TTreeCloner,0);
00114 };
00115
00116 #endif