ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/TriggerObject.h
Revision: 1.6
Committed: Wed Feb 18 15:38:55 2009 UTC (16 years, 2 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_008pre2, Mit_008pre1
Changes since 1.5: +22 -31 lines
Log Message:
Reworked particle interface to cache FourVectorM

File Contents

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