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.1 by loizides, Fri Mar 13 20:24:51 2009 UTC vs.
Revision 1.2 by loizides, Mon Mar 16 19:31:14 2009 UTC

# Line 1 | Line 1
1   // $Id$
2  
3   #include "MitAna/DataTree/interface/BranchTable.h"
4 + #include <TObjString.h>
5   #include <TList.h>
6  
7   ClassImp(mithep::BranchTable)
# Line 36 | Line 37 | Bool_t BranchTable::Find(const BranchNam
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines