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.9 by loizides, Thu Jul 3 08:22:18 2008 UTC vs.
Revision 1.10 by bendavid, Tue Sep 23 16:58:56 2008 UTC

# Line 5 | Line 5
5   #include <TObject.h>
6   #include <TSystem.h>
7   #include <TProcessID.h>
8 + #include <TBranchRef.h>
9   #include "MitAna/DataUtil/interface/Debug.h"
10  
11   using namespace mithep;
# Line 228 | Line 229 | void TreeWriter::CloseFile()
229    for (Int_t i=0;i<fTrees.GetEntries();++i) {
230      MyTree *mt = static_cast<MyTree*>(fTrees.At(i));
231      mt->Write(mt->GetName(),TObject::kOverwrite);
232 <    mt->Reset();
232 >    //backup and restore list of branch pointers from TRefTable (needed for autoloading)
233 >    if (mt->GetBranchRef()) {
234 >      TObjArray *parents = mt->GetBranchRef()->GetRefTable()->GetParents();
235 >      TObjArray parentsBak(*parents);
236 >      mt->Reset();
237 >      for (Int_t j=0; j<parentsBak.GetEntries(); ++j)
238 >        parents->Add(parentsBak.At(j));
239 >    }
240 >    else
241 >      mt->Reset();
242      mt->SetDirectory(0);  
243    }
244  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines