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

Comparing UserCode/MitAna/DataTree/src/BranchTable.cc (file contents):
Revision 1.2 by loizides, Mon Mar 16 19:31:14 2009 UTC vs.
Revision 1.3 by loizides, Thu Mar 19 22:17:17 2009 UTC

# Line 41 | Line 41 | TList *BranchTable::GetBranches() const
41   {
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 <
44 >  TList *l = 0;
45    TIter iter(MakeIterator());
46    const BranchName *bn = dynamic_cast<const BranchName*>(iter.Next());
47 +  if (bn) {
48 +    l = new TList;
49 +    l->SetOwner(1);
50 +  }
51    while (bn) {
52      if (!l->FindObject(bn->Name())) {
53        l->Add(new TObjString(bn->Name()));
# Line 56 | Line 58 | TList *BranchTable::GetBranches() const
58   }
59  
60   //--------------------------------------------------------------------------------------------------
61 + TList *BranchTable::GetDepBranches(const char *brname) const
62 + {
63 +  // Get list of dependent branches for given branch name.
64 +  // This list has to be deleted by the user of this function.
65 +
66 +  TList *bl = GetListForObject(brname);
67 +  if (!bl)
68 +    return 0;
69 +
70 +  TList *l = 0;
71 +  TIter iter(bl->MakeIterator());
72 +  const BranchName *bn = dynamic_cast<const BranchName*>(iter.Next());
73 +  if (bn) {
74 +    l = new TList;
75 +    l->SetOwner(1);
76 +  }
77 +  while (bn) {
78 +    if ((strcmp(brname,bn->Name())==0) && (!l->FindObject(bn->Dep()))) {
79 +      l->Add(new TObjString(bn->Dep()));
80 +    }
81 +    bn = dynamic_cast<const BranchName*>(iter.Next());
82 +  }
83 +  return l;
84 + }
85 +
86 + //--------------------------------------------------------------------------------------------------
87   void BranchTable::Print(Option_t *opt) const
88   {
89    // Print trigger table content (not ordered!)
# Line 67 | Line 95 | void BranchTable::Print(Option_t *opt) c
95    TIter iter(br->MakeIterator());
96    const TObjString *n = dynamic_cast<const TObjString*>(iter.Next());
97    while (n) {
98 <    TList *bl = GetListForObject(n->GetName());
98 >    TList *bl = GetDepBranches(n->GetName());
99      if (bl) {
100        TIter iter2(bl->MakeIterator());
101 <      const BranchName *bn = dynamic_cast<const BranchName*>(iter2.Next());
101 >      const TObjString *d = dynamic_cast<const TObjString*>(iter2.Next());
102        printf("%s -> ", n->GetName());
103 <      while (bn) {
104 <        printf("%s ", bn->Dep());
105 <        bn = dynamic_cast<const BranchName*>(iter2.Next());
103 >      while (d) {
104 >        printf("%s ", d->GetName());
105 >        d = dynamic_cast<const TObjString*>(iter2.Next());
106        }
107        printf("\n");
108 +      delete bl;
109      }
110      n = dynamic_cast<const TObjString*>(iter.Next());
111    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines