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
|