ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/TriggerTable.h
Revision: 1.1
Committed: Tue Mar 24 16:10:15 2009 UTC (16 years, 1 month ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010, Mit_009c, Mit_009b, Mit_009a, Mit_009, Mit_008
Log Message:
Have TriggerTable as a standalone file and cintable.

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id:$
3 //
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 const TriggerName *Get(const char *name) const;
29 UShort_t GetId(const char *name) const;
30 using TCollection::Print;
31 void Print(Option_t *opt="") const;
32
33 ClassDef(TriggerTable, 0) // A convenient trigger table
34 };
35 }
36
37 //--------------------------------------------------------------------------------------------------
38 inline const mithep::TriggerName *mithep::TriggerTable::Get(const char *name) const
39 {
40 // Return TriggerName pointer for given name.
41
42 return dynamic_cast<const TriggerName *>(FindObject(name));
43 }
44
45 //--------------------------------------------------------------------------------------------------
46 inline UShort_t mithep::TriggerTable::GetId(const char *name) const
47 {
48 // Return trigger id of trigger with given name.
49
50 const mithep::TriggerName *tn = Get(name);
51 if (tn)
52 return tn->Id();
53
54 Error("GetId", "TriggerName for %s not found. Returning 65535.", name);
55 return 65535;
56 }
57 #endif