30 |
|
{ |
31 |
|
public: |
32 |
|
MyTree(const char* name, const char* title, Int_t splitlevel = 99) : |
33 |
< |
TTree(name,title, splitlevel), fAutoFill(1) {} |
33 |
> |
TTree(name,title, splitlevel), fAutoFill(1), fBrRef(0) {} |
34 |
|
Bool_t GetAutoFill() const { return fAutoFill; } |
35 |
|
void SetAutoFill(Bool_t b) { fAutoFill = b; } |
36 |
+ |
|
37 |
|
protected: |
38 |
|
Bool_t fAutoFill; //!=true then fill automatically in TreeWriter (def=1) |
39 |
+ |
Bool_t fBrRef; //!=true then call BranchRef in TreeWriter (def=0) |
40 |
|
}; |
41 |
|
|
42 |
|
class TreeWriter : public TNamed |
67 |
|
void AddBranchToTree(const char *tname, const char *name, void *obj); |
68 |
|
Bool_t BeginEvent(Bool_t doreset=kFALSE); |
69 |
|
Bool_t EndEvent(Bool_t doreset=kFALSE); |
70 |
< |
const char *GetBaseURL() const { |
71 |
< |
return fBaseURL.IsNull() ? "." : fBaseURL; } |
70 |
> |
const char *GetBaseURL() const |
71 |
> |
{ return fBaseURL.IsNull() ? "." : fBaseURL; } |
72 |
|
Int_t GetCompressLevel() const { return fCompressLevel; } |
73 |
+ |
Bool_t GetDoObjNumReset() const { return fDoObjNumReset; } |
74 |
+ |
Bool_t GetDoBranchRef() const { return fDoBranchRef; } |
75 |
|
Long64_t GetEntries(const char *tn=0) const; |
76 |
|
Long64_t GetFileSize() const { |
77 |
|
return fFile != 0 ? fFile->GetEND() : 0; } |
82 |
|
const char *GetFullName() const { |
83 |
|
return Form("%s/%s", GetBaseURL(), GetFileName()); } |
84 |
|
const char *GetPrefix() const { return fPrefix; } |
85 |
< |
const TTree *GetTree(const char *tn) const; |
86 |
< |
TTree *GetTree(const char *tn); |
85 |
> |
const TTree *GetTree(const char *tn=0) const; |
86 |
> |
TTree *GetTree(const char *tn=0); |
87 |
|
void Print(Option_t *option="") const; |
88 |
|
void SetAutoFill(const char *tn, Bool_t b); |
89 |
|
void SetBaseURL(const char *b) { fBaseURL = b; } |
90 |
|
void SetCompressLevel(Int_t l) { fCompressLevel = l; } |
91 |
|
void SetDefaultBrSize(Int_t s) { fDefBrSize=s; } |
92 |
|
void SetDefaultSL(Int_t s) { fDefSL=s;} |
93 |
+ |
void SetDoObjNumReset(Bool_t b) { fDoObjNumReset = b; } |
94 |
+ |
void SetDoBranchRef(Bool_t b) { fDoBranchRef = b; } |
95 |
|
void SetMaxSize(Long64_t s); |
96 |
|
void SetPrefix(const char *p) { fPrefix = p; } |
97 |
|
void StoreObject(const TObject *obj); |
98 |
|
|
99 |
|
protected: |
100 |
< |
TString fBaseURL; // base url for tree storage |
101 |
< |
TString fPrefix; // prefix of file name |
102 |
< |
UShort_t fFileNumber; // current sequence number |
103 |
< |
Int_t fCompressLevel; // compression level used for TFile |
104 |
< |
Int_t fDefBrSize; // default buffer size for branches |
105 |
< |
Int_t fDefSL; // default split level for branches |
106 |
< |
Long64_t fMaxSize; // maximum file size for a file [Bytes] |
107 |
< |
const Long64_t fkMinFreeSpace; // minimum free space required for closing file |
108 |
< |
const Long64_t fkMinAvgSize; // minimum average entry size |
109 |
< |
Long64_t fEvtObjNum; // event object number offset (for TRef) |
110 |
< |
Bool_t fIsInit; // true if OpenFile() was called |
111 |
< |
Bool_t fDoObjNumReset; // true if obj. number resets automatically (def=0) |
112 |
< |
TFile *fFile; // file being written |
113 |
< |
TObjArray fTrees; // array of tree(s) being filled |
100 |
> |
TString fBaseURL; //base url for tree storage |
101 |
> |
TString fPrefix; //prefix of file name |
102 |
> |
UShort_t fFileNumber; //current sequence number |
103 |
> |
Int_t fCompressLevel; //compression level used for TFile |
104 |
> |
Int_t fDefBrSize; //default buffer size for branches |
105 |
> |
Int_t fDefSL; //default split level for branches |
106 |
> |
Long64_t fMaxSize; //maximum file size for a file [Bytes] |
107 |
> |
const Long64_t fkMinFreeSpace; //minimum free space required for closing file |
108 |
> |
const Long64_t fkMinAvgSize; //minimum average entry size |
109 |
> |
Long64_t fEvtObjNum; //event object number offset (for TRef) |
110 |
> |
Bool_t fIsInit; //true if OpenFile() was called |
111 |
> |
Bool_t fDoObjNumReset; //true if obj. number resets automatically (def=0) |
112 |
> |
Bool_t fDoBranchRef; //true if BranchRef is called automatically (def=0) |
113 |
> |
TFile *fFile; //file being written |
114 |
> |
TObjArray fTrees; //array of tree(s) being filled |
115 |
|
|
116 |
|
mithep::MyTree *AddOrGetMyTree(const char *tn); |
117 |
|
mithep::MyTree *GetMyTree(const char *tn); |