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