ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/TriggerTable.h
Revision: 1.3
Committed: Fri Nov 18 00:02:02 2011 UTC (13 years, 5 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, HEAD
Branch point for: Mit_025c_branch
Changes since 1.2: +24 -1 lines
Log Message:
Photon vertex probability and partial hlt wildcard support

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: TriggerTable.h,v 1.2 2009/11/24 15:57:37 loizides Exp $
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 const TriggerName *GetWildcard(const char *name) const;
30 const TriggerName *Get(const std::string &s) const { return Get(s.c_str()); }
31 UShort_t GetId(const char *name) const;
32 using TCollection::Print;
33 void Print(Option_t *opt="") const;
34
35 ClassDef(TriggerTable, 0) // A convenient trigger table
36 };
37 }
38
39 //--------------------------------------------------------------------------------------------------
40 inline const mithep::TriggerName *mithep::TriggerTable::Get(const char *name) const
41 {
42 // Return TriggerName pointer for given name.
43
44 return dynamic_cast<const TriggerName *>(FindObject(name));
45 }
46
47 //--------------------------------------------------------------------------------------------------
48 inline const mithep::TriggerName *mithep::TriggerTable::GetWildcard(const char *name) const
49 {
50 // Return TriggerName pointer for given name.
51
52 TIterator *it = MakeIterator();
53
54 TObject* tempObj=0;
55
56 while((tempObj=it->Next())) {
57 TString tmpstr(tempObj->GetName());
58 if (tmpstr.BeginsWith(name)) {
59 delete it;
60 printf("returning wildcard trigger %s\n",tempObj->GetName());
61 return dynamic_cast<const TriggerName *>(tempObj);
62 }
63 }
64
65 return 0;
66
67 }
68
69 //--------------------------------------------------------------------------------------------------
70 inline UShort_t mithep::TriggerTable::GetId(const char *name) const
71 {
72 // Return trigger id of trigger with given name.
73
74 const mithep::TriggerName *tn = Get(name);
75 if (tn)
76 return tn->Id();
77
78 Error("GetId", "TriggerName for %s not found. Returning 65535.", name);
79 return 65535;
80 }
81 #endif