ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataUtil/src/TreeWriter.cc
(Generate patch)

Comparing UserCode/MitAna/DataUtil/src/TreeWriter.cc (file contents):
Revision 1.12 by loizides, Mon Oct 6 16:53:26 2008 UTC vs.
Revision 1.13 by loizides, Mon Dec 1 17:39:20 2008 UTC

# Line 41 | Line 41 | TreeWriter::~TreeWriter()
41   {
42    // Destructor.
43    
44 <  if (fIsInit) {
45 <    CloseFile();
46 <  }
47 <
48 <  TDirectory::TContext context(0);
49 <  fTrees.Clear();
44 >  Terminate();
45   }
46  
47   //__________________________________________________________________________________________________
# Line 179 | Line 174 | void TreeWriter::AddBranchToTree(const c
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  
# Line 259 | Line 262 | const char *TreeWriter::CName(void *obj)
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
# Line 501 | Line 521 | void TreeWriter::StoreObject(const TObje
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 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines