ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/TriggerName.h
(Generate patch)

Comparing UserCode/MitAna/DataTree/interface/TriggerName.h (file contents):
Revision 1.3 by loizides, Tue Dec 2 09:30:11 2008 UTC vs.
Revision 1.6 by loizides, Tue Mar 24 16:10:15 2009 UTC

# Line 14 | Line 14
14   #include <string>
15   #include <TObject.h>
16   #include <TString.h>
17 #include <THashTable.h>
17   #include "MitAna/DataTree/interface/DataBase.h"
18  
19   namespace mithep
# Line 22 | Line 21 | namespace mithep
21    class TriggerName : public DataBase
22    {
23      public:
24 <      TriggerName() : fId(0) {}
24 >      TriggerName() : fId(0), fHash(0) {}
25        TriggerName(const char *name, UShort_t id) :
26          fName(name), fId(id), fHash(fName.Hash()) {}
27        TriggerName(const std::string &name, UShort_t id) :
28          fName(name), fId(id), fHash(fName.Hash()) {}
29        TriggerName(const TString &name, UShort_t id) :
30          fName(name), fId(id), fHash(fName.Hash()) {}
32      ~TriggerName() {}
31  
32        UShort_t              Id()      const { return fId; }
33        const char           *GetName() const { return fName; }
34        ULong_t               Hash()    const { return fHash; }
35        const char           *Name()    const { return fName; }
36 +      EObjType              ObjType() const { return kTriggerName; }      
37        void                  Print(Option_t *opt="") const;
38  
39      protected:
# Line 42 | Line 41 | namespace mithep
41        UShort_t              fId;          //id
42        UInt_t                fHash;        //hash
43  
44 <    ClassDef(TriggerName, 2) // Trigger name class
46 <  };
47 <
48 < //--------------------------------------------------------------------------------------------------
49 < // TriggerTable
50 < //
51 < // A convenient THashTable for storage of TriggerNames (not streamable).
52 < //
53 < // Authors: C.Loizides
54 < //--------------------------------------------------------------------------------------------------
55 <  class TriggerTable : public THashTable
56 <  {
57 <    public:
58 <      TriggerTable(Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0) :
59 <        THashTable(capacity,rehash) {}
60 <      ~TriggerTable() {}
61 <
62 <      const TriggerName *Get(const char *name)   const;
63 <      UShort_t           GetId(const char *name) const;
64 <      using TCollection::Print;
65 <      void               Print(Option_t *opt="") const;
44 >    ClassDef(TriggerName, 1) // Trigger name class
45    };
46   }
68
69 //--------------------------------------------------------------------------------------------------
70 inline const mithep::TriggerName *mithep::TriggerTable::Get(const char *name) const
71 {
72  // Return TriggerName pointer for given name.
73
74  return dynamic_cast<const TriggerName *>(FindObject(name));
75 }
76
77 //--------------------------------------------------------------------------------------------------
78 inline UShort_t mithep::TriggerTable::GetId(const char *name) const
79 {
80  // Return trigger id of trigger with given name.
81
82  const mithep::TriggerName *tn = Get(name);
83  if (tn)
84    return tn->Id();
85  
86  Error("GetId", "TriggerName for %s not found. Returning 65535.", name);
87  return 65535;
88 }
89
47   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines