1 |
|
// $Id$ |
2 |
|
|
3 |
|
#include "MitAna/DataTree/interface/BranchTable.h" |
4 |
+ |
#include <TObjString.h> |
5 |
|
#include <TList.h> |
6 |
|
|
7 |
|
ClassImp(mithep::BranchTable) |
37 |
|
} |
38 |
|
|
39 |
|
//-------------------------------------------------------------------------------------------------- |
40 |
< |
void BranchTable::Print(Option_t *opt) const |
40 |
> |
TList *BranchTable::GetBranches() const |
41 |
|
{ |
42 |
< |
// Print trigger table content (not ordered!) |
42 |
> |
// Get list of branches. This list has to be deleted by the user of this function. |
43 |
> |
|
44 |
> |
TList *l = new TList; |
45 |
> |
l->SetOwner(1); |
46 |
|
|
47 |
|
TIter iter(MakeIterator()); |
48 |
|
const BranchName *bn = dynamic_cast<const BranchName*>(iter.Next()); |
49 |
|
while (bn) { |
50 |
< |
bn->Print(); |
50 |
> |
if (!l->FindObject(bn->Name())) { |
51 |
> |
l->Add(new TObjString(bn->Name())); |
52 |
> |
} |
53 |
|
bn = dynamic_cast<const BranchName*>(iter.Next()); |
54 |
|
} |
55 |
+ |
return l; |
56 |
+ |
} |
57 |
+ |
|
58 |
+ |
//-------------------------------------------------------------------------------------------------- |
59 |
+ |
void BranchTable::Print(Option_t *opt) const |
60 |
+ |
{ |
61 |
+ |
// Print trigger table content (not ordered!) |
62 |
+ |
|
63 |
+ |
TList *br = GetBranches(); |
64 |
+ |
if (!br) |
65 |
+ |
return; |
66 |
+ |
|
67 |
+ |
TIter iter(br->MakeIterator()); |
68 |
+ |
const TObjString *n = dynamic_cast<const TObjString*>(iter.Next()); |
69 |
+ |
while (n) { |
70 |
+ |
TList *bl = GetListForObject(n->GetName()); |
71 |
+ |
if (bl) { |
72 |
+ |
TIter iter2(bl->MakeIterator()); |
73 |
+ |
const BranchName *bn = dynamic_cast<const BranchName*>(iter2.Next()); |
74 |
+ |
printf("%s -> ", n->GetName()); |
75 |
+ |
while (bn) { |
76 |
+ |
printf("%s ", bn->Dep()); |
77 |
+ |
bn = dynamic_cast<const BranchName*>(iter2.Next()); |
78 |
+ |
} |
79 |
+ |
printf("\n"); |
80 |
+ |
} |
81 |
+ |
n = dynamic_cast<const TObjString*>(iter.Next()); |
82 |
+ |
} |
83 |
+ |
delete br; |
84 |
|
} |