ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/TriggerObject.h
Revision: 1.11
Committed: Mon Jul 13 06:37:34 2009 UTC (15 years, 9 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.10: +38 -29 lines
Log Message:
Have fType and name index in TriggerBase.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.11 // $Id: TriggerObject.h,v 1.10 2009/07/10 13:49:39 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.11 TriggerObjectBase() : fId(0), fType(0), fNameInd(-1) {}
29     TriggerObjectBase(Int_t id, Char_t type, const FourVectorM32 &mom) :
30     fId(id), fMom(mom), fType(type), fNameInd(-1) {}
31     TriggerObjectBase(Int_t id, Char_t type,
32     Double_t pt, Double_t eta, Double_t phi, Double_t mass) :
33     fId(id), fMom(pt,eta,phi,mass), fType(type), fNameInd(-1) {}
34    
35     Int_t Id() const { return fId; }
36     Bool_t IsHLT() { return fType>0; }
37     Bool_t IsL1() { return fType<0; }
38     EObjType ObjType() const { return kTriggerObjectBase; }
39     Short_t NameInd() const { return fNameInd; }
40     Int_t Type() const { return fType; }
41     void SetType(Char_t t) { fType = t; }
42     void SetNameInd(Short_t i) { fNameInd = i; }
43    
44 loizides 1.1 protected:
45 loizides 1.11 void GetMom() const;
46 loizides 1.6
47 loizides 1.2 Int_t fId; //id or physics type (similar to pdgId)
48 loizides 1.7 Vect4M fMom; //object momentum
49 loizides 1.11 Char_t fType; //trigger type
50     Short_t fNameInd; //name index of original input tag
51 loizides 1.1
52 loizides 1.11 ClassDef(TriggerObjectBase, 2) // Trigger object base class
53 loizides 1.1 };
54    
55     class TriggerObjectRel : public DataObject
56     {
57     public:
58 loizides 1.11 TriggerObjectRel() : fTrgId(0), fType(0), fObjInd(-1), fModInd(-1), fFilterInd(-1) {}
59 loizides 1.2 TriggerObjectRel(UChar_t id, UChar_t type, Short_t obj, Short_t mod, Short_t fil) :
60     fTrgId(id), fType(type), fObjInd(obj), fModInd(mod), fFilterInd(fil) {}
61 loizides 1.1
62 loizides 1.11 Short_t FilterInd() const { return fFilterInd; }
63     Short_t ModInd() const { return fModInd; }
64     Short_t ObjInd() const { return fObjInd; }
65     EObjType ObjType() const { return kTriggerObjectRel; }
66 loizides 1.9 UChar_t TrgId() const { return fTrgId; }
67     UChar_t Type() const { return fType; }
68 loizides 1.1
69     protected:
70 loizides 1.2 UChar_t fTrgId; //trigger id
71 loizides 1.11 Char_t fType; //trigger type
72 loizides 1.2 Short_t fObjInd; //trigger object index
73 loizides 1.1 Short_t fModInd; //module label index
74     Short_t fFilterInd; //filter label index
75    
76 loizides 1.11 ClassDef(TriggerObjectRel, 2) // Trigger to trigger object relation class
77 loizides 1.1 };
78    
79     class TriggerObject : public TriggerObjectBase
80     {
81     public:
82     enum ETriggerObject { // see DataFormats/HLTReco/interface/TriggerTypeDefs.h
83 loizides 1.10 None = 0,
84     TriggerL1Mu = -81,
85     TriggerL1NoIsoEG = -82,
86     TriggerL1IsoEG = -83,
87     TriggerL1CenJet = -84,
88     TriggerL1ForJet = -85,
89     TriggerL1TauJet = -86,
90     TriggerL1ETM = -87,
91     TriggerL1ETT = -88,
92     TriggerL1HTT = -89,
93     TriggerL1HTM = -90,
94     TriggerL1JetCounts = -91,
95     TriggerL1HfBitCounts = -92,
96     TriggerL1HfRingEtSums = -93,
97     TriggerL1TechTrig = -94,
98     TriggerL1Castor = -95,
99     TriggerL1BPTX = -96,
100     TriggerPhoton = +81,
101     TriggerElectron = +82,
102     TriggerMuon = +83,
103     TriggerTau = +84,
104     TriggerJet = +85,
105     TriggerBJet = +86,
106     TriggerMET = +87,
107     TriggerTET = +88,
108     TriggerTHT = +89,
109     TriggerMHT = +90,
110     TriggerTrack = +91,
111     TriggerCluster = +92,
112     TriggerMETSig = +93,
113     TriggerELongit = +94,
114     TriggerMHTSig = +95,
115     TriggerHLongit = +96
116 loizides 1.1 };
117    
118 loizides 1.11 TriggerObject() : fTrgId(0), fTrigName(0), fModName(0), fFilName(0) {}
119     TriggerObject(UChar_t tid, Char_t type, Int_t id, const FourVectorM32 &mom) :
120     TriggerObjectBase(id,type,mom), fTrgId(tid),
121     fTrigName(0), fModName(0), fFilName(0) {}
122     TriggerObject(UChar_t tid, Char_t type, Int_t id,
123 loizides 1.1 Double_t pt, Double_t eta, Double_t phi, Double_t mass) :
124 loizides 1.11 TriggerObjectBase(id,type,pt,eta,phi,mass),
125     fTrgId(tid), fTrigName(0), fModName(0), fFilName(0) {}
126 loizides 1.1
127 loizides 1.10 const char *FilterName() const { return fFilName; }
128 loizides 1.9 ULong_t Hash() const { return fTrgId; }
129     const char *ModuleName() const { return fModName; }
130 loizides 1.6 EObjType ObjType() const { return kTriggerObject; }
131 loizides 1.2 void Print(Option_t *opt="") const;
132 loizides 1.9 const char *TrigName() const { return fTrigName; }
133 loizides 1.11 UChar_t TrgId() const { return fTrgId; }
134     ETriggerObject TriggerType() const
135     { return static_cast<ETriggerObject>(Type()); }
136 loizides 1.6 void SetTrigName(const char *n) { fTrigName = n; }
137 loizides 1.9 void SetModuleName(const char *n) { fModName = n; }
138     void SetFilterName(const char *n) { fFilName = n; }
139 loizides 1.1
140     protected:
141 loizides 1.2 UChar_t fTrgId; //trigger id
142     const char *fTrigName; //!trigger name
143     const char *fModName; //!L3 module name
144     const char *fFilName; //!L3 filter name
145 loizides 1.1
146 loizides 1.10 ClassDef(TriggerObject, 2) // Trigger object class
147 loizides 1.1 };
148 loizides 1.2
149     //--------------------------------------------------------------------------------------------------
150     // TriggerObjectsTable
151     //
152     // A convenient THashTable for storage of TriggerObjects (not streamable).
153     //
154     // Authors: C.Loizides
155     //--------------------------------------------------------------------------------------------------
156     class TriggerObjectsTable : public THashTable
157     {
158     private:
159     class MyKey : public TObject
160     {
161     public:
162     MyKey(ULong_t hash) : fHash(hash) {}
163     ULong_t Hash() const { return fHash; }
164     protected:
165     ULong_t fHash; //hash value
166     };
167    
168     public:
169     TriggerObjectsTable(const TriggerTable *table,
170     Int_t capacity = TCollection::kInitHashTableCapacity, Int_t rehash = 0) :
171     THashTable(capacity,rehash), fTriggers(table) {}
172    
173 loizides 1.3 const TList *GetList(const char *name) const;
174     const TList *GetList(ULong_t id) const;
175 loizides 1.2 using TCollection::Print;
176 loizides 1.3 void Print(Option_t *opt="") const;
177 loizides 1.2
178     protected:
179 loizides 1.7 const TriggerTable *fTriggers; //trigger table
180 loizides 1.2 };
181     }
182    
183     //--------------------------------------------------------------------------------------------------
184 loizides 1.6 inline void mithep::TriggerObjectBase::GetMom() const
185     {
186     // Get momentum values from stored values.
187    
188     fCachedMom.SetCoordinates(fMom.Pt(),fMom.Eta(),fMom.Phi(),fMom.M());
189     }
190    
191     //--------------------------------------------------------------------------------------------------
192 loizides 1.3 inline const TList *mithep::TriggerObjectsTable::GetList(const char *name) const
193 loizides 1.2 {
194 loizides 1.3 // Return list of trigger objects for given trigger name.
195 loizides 1.2
196     ULong_t id = fTriggers->GetId(name);
197 loizides 1.3 return GetList(id);
198 loizides 1.2 }
199    
200     //--------------------------------------------------------------------------------------------------
201     inline const TList *mithep::TriggerObjectsTable::GetList(ULong_t id) const
202     {
203     // Return list of trigger objects for given trigger id (bit).
204    
205     MyKey key(id);
206     return const_cast<const TList*>(GetListForObject(&key));
207 loizides 1.1 }
208     #endif