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; |
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 |
|
|
289 |
|
if (fEvtObjNum<0) { |
290 |
|
Error("EndEvent", "Object counter is zero. Did you call BeginEvent(kTRUE)?"); |
291 |
|
} else { |
292 |
< |
// Reset the TRef table. keep it from growing with each event (see doc) |
292 |
> |
// Reset the TRef table. Keep it from growing with each event (see doc) |
293 |
|
TProcessID::SetObjectCount(fEvtObjNum); |
294 |
|
} |
295 |
|
} |