ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/BranchName.h
Revision: 1.1
Committed: Fri Mar 13 08:40:01 2009 UTC (16 years, 1 month ago) by loizides
Content type: text/plain
Branch: MAIN
Log Message:
Added BranchName class.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2     // $Id: TriggerName.h,v 1.5 2009/02/18 15:38:55 loizides Exp $
3     //
4     // BranchName
5     //
6     // A class to hold a name and a number, ie the trigger name and trigger bit.
7     //
8     // Authors: C.Loizides
9     //--------------------------------------------------------------------------------------------------
10    
11     #ifndef MITANA_DATATREE_BRANCHNAME_H
12     #define MITANA_DATATREE_BRANCHNAME_H
13    
14     #include <string>
15     #include <TObject.h>
16     #include <TString.h>
17     #include <THashTable.h>
18     #include "MitAna/DataTree/interface/DataBase.h"
19    
20     namespace mithep
21     {
22     class BranchName : public DataBase
23     {
24     public:
25     BranchName() {}
26     BranchName(const char *brname, const char *brdep) :
27     fBrName(brname), fBrDep(brdep) {}
28    
29     const char *Name() const { return fBrName; }
30     const char *Dep() const { return fBrDep; }
31     // EObjType ObjType() const { return kBranchName; }
32     void Print(Option_t *opt="") const;
33    
34     protected:
35     TString fBrName; //name
36     TString fBrDep; //name
37    
38     ClassDef(BranchName, 1) // Branch name class
39     };
40     #if 0
41     //--------------------------------------------------------------------------------------------------
42     // BranchTable
43     //
44     // A convenient THashTable for storage of BranchNames (not streamable).
45     //
46     // Authors: C.Loizides
47     //--------------------------------------------------------------------------------------------------
48     class BranchTable : public THashTable
49     {
50     public:
51     BranchTable(Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0) :
52     THashTable(capacity,rehash) {}
53    
54     const BranchName *Get(const char *name) const;
55     UShort_t GetId(const char *name) const;
56     using TCollection::Print;
57     void Print(Option_t *opt="") const;
58     };
59     #endif
60     }
61    
62     #if 0
63     //--------------------------------------------------------------------------------------------------
64     inline const mithep::BranchName *mithep::BranchTable::Get(const char *name) const
65     {
66     // Return BranchName pointer for given name.
67    
68     return dynamic_cast<const BranchName *>(FindObject(name));
69     }
70    
71     //--------------------------------------------------------------------------------------------------
72     inline UShort_t mithep::BranchTable::GetId(const char *name) const
73     {
74     // Return trigger id of trigger with given name.
75    
76     const mithep::BranchName *tn = Get(name);
77     if (tn)
78     return tn->Id();
79    
80     Error("GetId", "BranchName for %s not found. Returning 65535.", name);
81     return 65535;
82     }
83     #endif
84     #endif