41 |
|
{ |
42 |
|
// Destructor. |
43 |
|
|
44 |
< |
if (fIsInit) { |
45 |
< |
CloseFile(); |
46 |
< |
} |
47 |
< |
|
48 |
< |
TDirectory::TContext context(0); |
49 |
< |
fTrees.Clear(); |
44 |
> |
Terminate(); |
45 |
|
} |
46 |
|
|
47 |
|
//__________________________________________________________________________________________________ |
174 |
|
} |
175 |
|
|
176 |
|
//-------------------------------------------------------------------------------------------------- |
177 |
+ |
void TreeWriter::AddTree(const char *tname) |
178 |
+ |
{ |
179 |
+ |
// Add tree with name "name" into tree with name "tname". |
180 |
+ |
|
181 |
+ |
AddOrGetMyTree(tname); |
182 |
+ |
} |
183 |
+ |
|
184 |
+ |
//-------------------------------------------------------------------------------------------------- |
185 |
|
MyTree *TreeWriter::AddOrGetMyTree(const char *tn) |
186 |
|
{ |
187 |
|
// Add new tree if not present in array of trees or return |
188 |
|
// present tree. |
189 |
|
|
190 |
< |
MyTree *tree = GetMyTree(tn); //dynamic_cast<MyTree*>(fTrees.FindObject(tn)); |
190 |
> |
MyTree *tree = GetMyTree(tn); |
191 |
|
if (tree) |
192 |
|
return tree; |
193 |
|
|
262 |
|
|
263 |
|
TObject *tobj = dynamic_cast<TObject*>(*(TObject**)obj); |
264 |
|
if (tobj==0) { |
265 |
< |
Fatal("ClassName", "Given void* ptr can not be dereferenced into TObject*"); |
265 |
> |
Fatal("CName", "Given void* ptr can not be dereferenced into TObject*"); |
266 |
|
} |
267 |
|
return tobj->ClassName(); |
268 |
|
} |
269 |
|
|
270 |
|
//-------------------------------------------------------------------------------------------------- |
271 |
+ |
void TreeWriter::DoBranchRef(const char *tn) |
272 |
+ |
{ |
273 |
+ |
// Fill BranchRef for given tree. |
274 |
+ |
|
275 |
+ |
if (fTrees.GetEntries()==0) { |
276 |
+ |
Error("DoBranchRef", "Tree with name %s not found!", tn); |
277 |
+ |
return; |
278 |
+ |
} |
279 |
+ |
|
280 |
+ |
MyTree *mt = GetMyTree(tn); |
281 |
+ |
if (!mt) |
282 |
+ |
return; |
283 |
+ |
|
284 |
+ |
mt->BranchRef(); |
285 |
+ |
} |
286 |
+ |
|
287 |
+ |
//-------------------------------------------------------------------------------------------------- |
288 |
|
Bool_t TreeWriter::EndEvent(Bool_t doreset) |
289 |
|
{ |
290 |
|
// Store the event in the tree. If doreset or fDoObjNumReset is kTRUE |
521 |
|
|
522 |
|
fFile->WriteTObject(obj,obj->GetName(),"WriteDelete"); |
523 |
|
} |
524 |
+ |
|
525 |
+ |
//__________________________________________________________________________________________________ |
526 |
+ |
void TreeWriter::Terminate() |
527 |
+ |
{ |
528 |
+ |
// Terminate tree file writing. |
529 |
+ |
|
530 |
+ |
if (fIsInit) { |
531 |
+ |
CloseFile(); |
532 |
+ |
} |
533 |
+ |
|
534 |
+ |
TDirectory::TContext context(0); |
535 |
+ |
fTrees.Clear(); |
536 |
+ |
} |