ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/TriggerObject.h
Revision: 1.5
Committed: Tue Dec 9 17:47:00 2008 UTC (16 years, 4 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_006b, Mit_006a
Changes since 1.4: +10 -7 lines
Log Message:
Added ObjType to retrieve type of object.

File Contents

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