ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/TriggerTable.h
Revision: 1.2
Committed: Tue Nov 24 15:57:37 2009 UTC (15 years, 5 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012h, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c
Changes since 1.1: +5 -4 lines
Log Message:
Get function

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.2 // $Id: TriggerTable.h,v 1.1 2009/03/24 16:10:15 loizides Exp $
3 loizides 1.1 //
4     // TriggerTable
5     //
6     // A convenient THashTable for storage of TriggerNames (not streamable).
7     //
8     // Authors: C.Loizides
9     //--------------------------------------------------------------------------------------------------
10    
11     #ifndef MITANA_DATATREE_TRIGGERTABLE_H
12     #define MITANA_DATATREE_TRIGGERTABLE_H
13    
14     #include <string>
15     #include <TObject.h>
16     #include <TString.h>
17     #include <THashTable.h>
18     #include "MitAna/DataTree/interface/TriggerName.h"
19    
20     namespace mithep
21     {
22     class TriggerTable : public THashTable
23     {
24     public:
25     TriggerTable(Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0) :
26     THashTable(capacity,rehash) {}
27    
28 loizides 1.2 const TriggerName *Get(const char *name) const;
29     const TriggerName *Get(const std::string &s) const { return Get(s.c_str()); }
30     UShort_t GetId(const char *name) const;
31 loizides 1.1 using TCollection::Print;
32 loizides 1.2 void Print(Option_t *opt="") const;
33 loizides 1.1
34     ClassDef(TriggerTable, 0) // A convenient trigger table
35     };
36     }
37    
38     //--------------------------------------------------------------------------------------------------
39     inline const mithep::TriggerName *mithep::TriggerTable::Get(const char *name) const
40     {
41     // Return TriggerName pointer for given name.
42    
43     return dynamic_cast<const TriggerName *>(FindObject(name));
44     }
45    
46     //--------------------------------------------------------------------------------------------------
47     inline UShort_t mithep::TriggerTable::GetId(const char *name) const
48     {
49     // Return trigger id of trigger with given name.
50    
51     const mithep::TriggerName *tn = Get(name);
52     if (tn)
53     return tn->Id();
54    
55     Error("GetId", "TriggerName for %s not found. Returning 65535.", name);
56     return 65535;
57     }
58     #endif