ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/TriggerObject.h
Revision: 1.8
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_009, Mit_008
Changes since 1.7: +2 -2 lines
Log Message:
Have TriggerTable as a standalone file and cintable.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.8 // $Id: TriggerObject.h,v 1.7 2009/03/18 15:44:32 loizides Exp $
3 loizides 1.1 //
4     // TriggerObject
5     //
6 loizides 1.2 // This class holds the HLT trigger object information, ie
7     // mainly the kinematics and type of trigger.
8     // The other classes TriggerObjectBase, and TriggerObjectRel are only used for
9     // efficient tree storage and should not used in analysis.
10 loizides 1.1 //
11     // Authors: C.Loizides
12     //--------------------------------------------------------------------------------------------------
13    
14     #ifndef MITANA_DATATREE_TRIGGEROBJECT_H
15     #define MITANA_DATATREE_TRIGGEROBJECT_H
16    
17 loizides 1.2 #include <THashTable.h>
18 loizides 1.7 #include "MitCommon/DataFormats/interface/Vect4M.h"
19 loizides 1.1 #include "MitAna/DataTree/interface/Particle.h"
20 loizides 1.2 #include "MitAna/DataTree/interface/TriggerName.h"
21 loizides 1.8 #include "MitAna/DataTree/interface/TriggerTable.h"
22 loizides 1.1
23     namespace mithep
24     {
25     class TriggerObjectBase : public Particle
26     {
27     public:
28 loizides 1.2 TriggerObjectBase() : fId(0) {}
29 loizides 1.4 TriggerObjectBase(Int_t id, const FourVectorM32 &mom) : fId(id), fMom(mom) {}
30 loizides 1.2 TriggerObjectBase(Int_t id, Double_t pt, Double_t eta, Double_t phi, Double_t mass) :
31 loizides 1.4 fId(id), fMom(pt,eta,phi,mass) {}
32 loizides 1.1
33 loizides 1.2 Int_t Id() const { return fId; }
34 loizides 1.5 EObjType ObjType() const { return kTriggerObjectBase; }
35 loizides 1.1
36     protected:
37 loizides 1.6 void GetMom() const;
38    
39 loizides 1.2 Int_t fId; //id or physics type (similar to pdgId)
40 loizides 1.7 Vect4M fMom; //object momentum
41 loizides 1.1
42     ClassDef(TriggerObjectBase, 1) // Trigger object base class
43     };
44    
45     class TriggerObjectRel : public DataObject
46     {
47     public:
48 loizides 1.2 TriggerObjectRel() : fTrgId(0), fType(0), fObjInd(0), fModInd(0), fFilterInd(0) {}
49     TriggerObjectRel(UChar_t id, UChar_t type, Short_t obj, Short_t mod, Short_t fil) :
50     fTrgId(id), fType(type), fObjInd(obj), fModInd(mod), fFilterInd(fil) {}
51 loizides 1.1
52 loizides 1.5 UShort_t FilterInd() const { return fFilterInd; }
53     UShort_t ModInd() const { return fModInd; }
54     UShort_t ObjInd() const { return fObjInd; }
55     EObjType ObjType() const { return kTriggerObjectRef; }
56 loizides 1.2 UChar_t TrgId() const { return fTrgId; }
57 loizides 1.1 UChar_t Type() const { return fType; }
58    
59     protected:
60 loizides 1.2 UChar_t fTrgId; //trigger id
61 loizides 1.1 UChar_t fType; //object type
62 loizides 1.2 Short_t fObjInd; //trigger object index
63 loizides 1.1 Short_t fModInd; //module label index
64     Short_t fFilterInd; //filter label index
65    
66     ClassDef(TriggerObjectRel, 1) // Trigger to trigger object relation class
67     };
68    
69     class TriggerObject : public TriggerObjectBase
70     {
71     public:
72     enum ETriggerObject { // see DataFormats/HLTReco/interface/TriggerTypeDefs.h
73     None = 0,
74     TriggerL1Mu = 81,
75     TriggerL1NoIsoEG = 82,
76     TriggerL1IsoEG = 83,
77     TriggerL1CenJet = 84,
78     TriggerL1ForJet = 85,
79     TriggerL1TauJet = 86,
80     TriggerL1ETM = 87,
81     TriggerL1ETT = 88,
82     TriggerL1HTT = 89,
83     TriggerL1JetCounts = 90,
84     TriggerPhoton = 91,
85     TriggerElectron = 92,
86     TriggerMuon = 93,
87     TriggerTau = 94,
88     TriggerJet = 95,
89     TriggerBJet = 96,
90     TriggerMET = 97,
91     TriggerHT = 98,
92     TriggerTrack = 99,
93     TriggerCluster = 100
94     };
95    
96 loizides 1.2 TriggerObject() : fTrgId(0), fType(None), fTrigName(0), fModName(0), fFilName(0) {}
97     TriggerObject(UChar_t tid, UChar_t type, Int_t id, const FourVectorM32 &mom) :
98     TriggerObjectBase(id,mom), fTrgId(tid), fType(static_cast<ETriggerObject>(type)) {}
99 loizides 1.6 TriggerObject(UChar_t tid, UChar_t type, Int_t id,
100 loizides 1.1 Double_t pt, Double_t eta, Double_t phi, Double_t mass) :
101 loizides 1.2 TriggerObjectBase(id,pt,eta,phi,mass), fTrgId(tid),
102     fType(static_cast<ETriggerObject>(type)) {}
103 loizides 1.1
104 loizides 1.6 ULong_t Hash() const { return fTrgId; }
105     const char *FilterName() const { return fFilName; }
106     const char *ModuleName() const { return fModName; }
107     EObjType ObjType() const { return kTriggerObject; }
108 loizides 1.2 void Print(Option_t *opt="") const;
109 loizides 1.6 const char *TrigName() const { return fTrigName; }
110     UShort_t TrgId() const { return fTrgId; }
111     ETriggerObject Type() const { return fType; }
112     void SetTrigName(const char *n) { fTrigName = n; }
113     void SetModuleName(const char *n) { fModName = n; }
114     void SetFilterName(const char *n) { fFilName = n; }
115 loizides 1.1
116     protected:
117 loizides 1.2 UChar_t fTrgId; //trigger id
118 loizides 1.1 ETriggerObject fType; //object type
119 loizides 1.2 const char *fTrigName; //!trigger name
120     const char *fModName; //!L3 module name
121     const char *fFilName; //!L3 filter name
122 loizides 1.1
123     ClassDef(TriggerObject, 1) // Trigger object class
124     };
125 loizides 1.2
126     //--------------------------------------------------------------------------------------------------
127     // TriggerObjectsTable
128     //
129     // A convenient THashTable for storage of TriggerObjects (not streamable).
130     //
131     // Authors: C.Loizides
132     //--------------------------------------------------------------------------------------------------
133     class TriggerObjectsTable : public THashTable
134     {
135     private:
136     class MyKey : public TObject
137     {
138     public:
139     MyKey(ULong_t hash) : fHash(hash) {}
140     ULong_t Hash() const { return fHash; }
141     protected:
142     ULong_t fHash; //hash value
143     };
144    
145     public:
146     TriggerObjectsTable(const TriggerTable *table,
147     Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0) :
148     THashTable(capacity,rehash), fTriggers(table) {}
149    
150 loizides 1.3 const TList *GetList(const char *name) const;
151     const TList *GetList(ULong_t id) const;
152 loizides 1.2 using TCollection::Print;
153 loizides 1.3 void Print(Option_t *opt="") const;
154 loizides 1.2
155     protected:
156 loizides 1.7 const TriggerTable *fTriggers; //trigger table
157 loizides 1.2 };
158     }
159    
160     //--------------------------------------------------------------------------------------------------
161 loizides 1.6 inline void mithep::TriggerObjectBase::GetMom() const
162     {
163     // Get momentum values from stored values.
164    
165     fCachedMom.SetCoordinates(fMom.Pt(),fMom.Eta(),fMom.Phi(),fMom.M());
166     }
167    
168     //--------------------------------------------------------------------------------------------------
169 loizides 1.3 inline const TList *mithep::TriggerObjectsTable::GetList(const char *name) const
170 loizides 1.2 {
171 loizides 1.3 // Return list of trigger objects for given trigger name.
172 loizides 1.2
173     ULong_t id = fTriggers->GetId(name);
174 loizides 1.3 return GetList(id);
175 loizides 1.2 }
176    
177     //--------------------------------------------------------------------------------------------------
178     inline const TList *mithep::TriggerObjectsTable::GetList(ULong_t id) const
179     {
180     // Return list of trigger objects for given trigger id (bit).
181    
182     MyKey key(id);
183     return const_cast<const TList*>(GetListForObject(&key));
184 loizides 1.1 }
185     #endif