ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/TriggerObject.h
Revision: 1.7
Committed: Wed Mar 18 15:44:32 2009 UTC (16 years, 1 month ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.6: +4 -3 lines
Log Message:
Introduced Double32_t [0,0,14] consistently. Updated class descriptions.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.7 // $Id: TriggerObject.h,v 1.6 2009/02/18 15:38:55 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.1
22     namespace mithep
23     {
24     class TriggerObjectBase : public Particle
25     {
26     public:
27 loizides 1.2 TriggerObjectBase() : fId(0) {}
28 loizides 1.4 TriggerObjectBase(Int_t id, const FourVectorM32 &mom) : fId(id), fMom(mom) {}
29 loizides 1.2 TriggerObjectBase(Int_t id, Double_t pt, Double_t eta, Double_t phi, Double_t mass) :
30 loizides 1.4 fId(id), fMom(pt,eta,phi,mass) {}
31 loizides 1.1
32 loizides 1.2 Int_t Id() const { return fId; }
33 loizides 1.5 EObjType ObjType() const { return kTriggerObjectBase; }
34 loizides 1.1
35     protected:
36 loizides 1.6 void GetMom() const;
37    
38 loizides 1.2 Int_t fId; //id or physics type (similar to pdgId)
39 loizides 1.7 Vect4M fMom; //object momentum
40 loizides 1.1
41     ClassDef(TriggerObjectBase, 1) // Trigger object base class
42     };
43    
44     class TriggerObjectRel : public DataObject
45     {
46     public:
47 loizides 1.2 TriggerObjectRel() : fTrgId(0), fType(0), fObjInd(0), fModInd(0), fFilterInd(0) {}
48     TriggerObjectRel(UChar_t id, UChar_t type, Short_t obj, Short_t mod, Short_t fil) :
49     fTrgId(id), fType(type), fObjInd(obj), fModInd(mod), fFilterInd(fil) {}
50 loizides 1.1
51 loizides 1.5 UShort_t FilterInd() const { return fFilterInd; }
52     UShort_t ModInd() const { return fModInd; }
53     UShort_t ObjInd() const { return fObjInd; }
54     EObjType ObjType() const { return kTriggerObjectRef; }
55 loizides 1.2 UChar_t TrgId() const { return fTrgId; }
56 loizides 1.1 UChar_t Type() const { return fType; }
57    
58     protected:
59 loizides 1.2 UChar_t fTrgId; //trigger id
60 loizides 1.1 UChar_t fType; //object type
61 loizides 1.2 Short_t fObjInd; //trigger object index
62 loizides 1.1 Short_t fModInd; //module label index
63     Short_t fFilterInd; //filter label index
64    
65     ClassDef(TriggerObjectRel, 1) // Trigger to trigger object relation class
66     };
67    
68     class TriggerObject : public TriggerObjectBase
69     {
70     public:
71     enum ETriggerObject { // see DataFormats/HLTReco/interface/TriggerTypeDefs.h
72     None = 0,
73     TriggerL1Mu = 81,
74     TriggerL1NoIsoEG = 82,
75     TriggerL1IsoEG = 83,
76     TriggerL1CenJet = 84,
77     TriggerL1ForJet = 85,
78     TriggerL1TauJet = 86,
79     TriggerL1ETM = 87,
80     TriggerL1ETT = 88,
81     TriggerL1HTT = 89,
82     TriggerL1JetCounts = 90,
83     TriggerPhoton = 91,
84     TriggerElectron = 92,
85     TriggerMuon = 93,
86     TriggerTau = 94,
87     TriggerJet = 95,
88     TriggerBJet = 96,
89     TriggerMET = 97,
90     TriggerHT = 98,
91     TriggerTrack = 99,
92     TriggerCluster = 100
93     };
94    
95 loizides 1.2 TriggerObject() : fTrgId(0), fType(None), fTrigName(0), fModName(0), fFilName(0) {}
96     TriggerObject(UChar_t tid, UChar_t type, Int_t id, const FourVectorM32 &mom) :
97     TriggerObjectBase(id,mom), fTrgId(tid), fType(static_cast<ETriggerObject>(type)) {}
98 loizides 1.6 TriggerObject(UChar_t tid, UChar_t type, Int_t id,
99 loizides 1.1 Double_t pt, Double_t eta, Double_t phi, Double_t mass) :
100 loizides 1.2 TriggerObjectBase(id,pt,eta,phi,mass), fTrgId(tid),
101     fType(static_cast<ETriggerObject>(type)) {}
102 loizides 1.1
103 loizides 1.6 ULong_t Hash() const { return fTrgId; }
104     const char *FilterName() const { return fFilName; }
105     const char *ModuleName() const { return fModName; }
106     EObjType ObjType() const { return kTriggerObject; }
107 loizides 1.2 void Print(Option_t *opt="") const;
108 loizides 1.6 const char *TrigName() const { return fTrigName; }
109     UShort_t TrgId() const { return fTrgId; }
110     ETriggerObject Type() const { return fType; }
111     void SetTrigName(const char *n) { fTrigName = n; }
112     void SetModuleName(const char *n) { fModName = n; }
113     void SetFilterName(const char *n) { fFilName = n; }
114 loizides 1.1
115     protected:
116 loizides 1.2 UChar_t fTrgId; //trigger id
117 loizides 1.1 ETriggerObject fType; //object type
118 loizides 1.2 const char *fTrigName; //!trigger name
119     const char *fModName; //!L3 module name
120     const char *fFilName; //!L3 filter name
121 loizides 1.1
122     ClassDef(TriggerObject, 1) // Trigger object class
123     };
124 loizides 1.2
125     //--------------------------------------------------------------------------------------------------
126     // TriggerObjectsTable
127     //
128     // A convenient THashTable for storage of TriggerObjects (not streamable).
129     //
130     // Authors: C.Loizides
131     //--------------------------------------------------------------------------------------------------
132     class TriggerObjectsTable : public THashTable
133     {
134     private:
135     class MyKey : public TObject
136     {
137     public:
138     MyKey(ULong_t hash) : fHash(hash) {}
139     ULong_t Hash() const { return fHash; }
140     protected:
141     ULong_t fHash; //hash value
142     };
143    
144     public:
145     TriggerObjectsTable(const TriggerTable *table,
146     Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0) :
147     THashTable(capacity,rehash), fTriggers(table) {}
148    
149 loizides 1.3 const TList *GetList(const char *name) const;
150     const TList *GetList(ULong_t id) const;
151 loizides 1.2 using TCollection::Print;
152 loizides 1.3 void Print(Option_t *opt="") const;
153 loizides 1.2
154     protected:
155 loizides 1.7 const TriggerTable *fTriggers; //trigger table
156 loizides 1.2 };
157    
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