1 |
loizides |
1.2 |
// $Id: TreeBranchLoader.cc,v 1.1 2008/07/02 16:34:06 loizides Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#include "MitAna/TreeMod/interface/TreeBranchLoader.h"
|
4 |
|
|
#include <Riostream.h>
|
5 |
|
|
#include <TBranch.h>
|
6 |
|
|
#include <TTree.h>
|
7 |
|
|
#include <TClass.h>
|
8 |
|
|
#include <TFile.h>
|
9 |
|
|
#include "MitAna/DataTree/interface/BaseCollection.h"
|
10 |
|
|
#include "MitAna/TreeMod/interface/TreeBranchLoader.h"
|
11 |
|
|
#include "MitAna/TAM/interface/TAMTreeBranchLoader.h"
|
12 |
|
|
|
13 |
|
|
ClassImp(mithep::TreeBranchLoader)
|
14 |
|
|
|
15 |
|
|
using namespace mithep;
|
16 |
|
|
|
17 |
loizides |
1.2 |
//--------------------------------------------------------------------------------------------------
|
18 |
loizides |
1.1 |
TreeBranchLoader::TreeBranchLoader(TAMBranchInfo *binfo) :
|
19 |
|
|
TAMTreeBranchLoader(binfo),
|
20 |
|
|
fDoReset(kFALSE)
|
21 |
|
|
{
|
22 |
|
|
// Default constructor.
|
23 |
|
|
}
|
24 |
|
|
|
25 |
loizides |
1.2 |
//--------------------------------------------------------------------------------------------------
|
26 |
loizides |
1.1 |
void TreeBranchLoader::Clear(Option_t *option)
|
27 |
|
|
{
|
28 |
|
|
// Clear objects in Objects that allocated memory on the heap.
|
29 |
|
|
|
30 |
|
|
if(!fIsClass || !fBAddr)
|
31 |
|
|
return;
|
32 |
|
|
|
33 |
|
|
if(fDoReset) {
|
34 |
|
|
BaseCollection *c = static_cast<BaseCollection*>(fBAddr);
|
35 |
|
|
c->Reset();
|
36 |
|
|
return;
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
TAMTreeBranchLoader::Clear(option);
|
40 |
|
|
}
|
41 |
|
|
|
42 |
loizides |
1.2 |
//--------------------------------------------------------------------------------------------------
|
43 |
loizides |
1.1 |
Bool_t TreeBranchLoader::Notify(TTree* tree)
|
44 |
|
|
{
|
45 |
|
|
// Notify via TAMSelector that is being connected to a (new) file.
|
46 |
|
|
// First call base class to perform type checking,
|
47 |
|
|
// then check whether we have HIROOT specific collection
|
48 |
|
|
// in branch.
|
49 |
|
|
|
50 |
|
|
fDoReset = kFALSE;
|
51 |
|
|
|
52 |
|
|
Bool_t ret = TAMTreeBranchLoader::Notify(tree);
|
53 |
|
|
if(ret && fIsClass) {
|
54 |
|
|
fDoReset = fClass->InheritsFrom("BaseCollection");
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
return ret;
|
58 |
|
|
}
|