CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1GObject.h
Go to the documentation of this file.
1 #ifndef L1GObject_h
2 #define L1GObject_h
3 
4 #include <iostream>
5 
6 #include <string>
7 
10 
19 public:
20  // Constructors
21 
22  //L1GObject() : myEt(0), myEta(999), myPhi(999), myName("L1GObject") {initialize();}
23  L1GObject() {}
24 
25  L1GObject(unsigned int et, unsigned int eta, unsigned int phi)
26  : myEt(et), myEta(eta), myPhi(phi), myName("L1GObject") {
27  initialize();
28  }
29 
30  L1GObject(unsigned int et, unsigned int eta, unsigned int phi, std::string name)
31  : myEt(et), myEta(eta), myPhi(phi), myName(name) {
32  initialize();
33  }
34 
35  L1GObject(unsigned int packedObject, std::string name = "L1GObject") {
36  myEt = (packedObject & 0xFFFF0000) >> 16;
37  myEta = (packedObject & 0x0000FF00) >> 8;
38  myPhi = (packedObject & 0x000000FF);
39  myName = name;
40  initialize();
41  }
42 
43  unsigned int packedObject() {
44  if (myEt > 0xFFFF)
45  myEt = 0xFFFF;
46  unsigned int etBits = (myEt << 16);
47  if (myEta < 0xFF) {
48  unsigned int etaBits = (myEta << 8);
49  if (myPhi < 0xFF) {
50  return (etBits + etaBits + myPhi);
51  }
52  }
53  std::cerr << "L1GObject: Cannot pack content - fatal error: " << myEt << ", " << myEta << ", " << myPhi
54  << std::endl;
55  return (etBits);
56  }
57 
59  myName = t.myName;
60  myPhi = t.myPhi;
61  myEta = t.myEta;
62  myEt = t.myEt;
66  puLevel_ = t.puLevel_;
67  tauVeto_ = t.tauVeto_;
68  mipBit_ = t.mipBit_;
69  initialize();
70  }
71 
73  if (this != &t) {
74  myName = t.myName;
75  myPhi = t.myPhi;
76  myEta = t.myEta;
77  myEt = t.myEt;
81  puLevel_ = t.puLevel_;
82  tauVeto_ = t.tauVeto_;
83  mipBit_ = t.mipBit_;
84  initialize();
85  }
86  return *this;
87  }
88 
89  // Destructor
90 
91  ~L1GObject() override {}
92 
93  // Access functions
94 
95  std::string name() const { return myName; }
96 
97  bool empty() const { return false; }
98 
99  double ptValue() const { return myLSB * myEt; }
100 
101  double etaValue() const {
102  if (myEta < 11) {
103  return -etaValues[-(myEta - 10)]; // 0-10 are negative eta values
104  } else if (myEta < 22) {
105  return etaValues[myEta - 11]; // 11-21 are positive eta values
106  }
107  return 999.;
108  }
109 
110  double phiValue() const {
111  if (myPhi < 18)
112  return phiValues[myPhi];
113  else
114  return 999.;
115  }
116 
117  unsigned int ptCode() const { return myEt; }
118 
119  unsigned int etaIndex() const { return myEta; }
120 
121  unsigned int phiIndex() const { return myPhi; }
122 
123  // Operators required for sorting lists of these objects
124 
125  bool operator==(const L1GObject& t) const {
126  if (myEt == t.myEt)
127  return true;
128  else
129  return false;
130  }
131 
132  bool operator<(const L1GObject& t) const {
133  if (myEt < t.myEt)
134  return true;
135  else
136  return false;
137  }
138 
139  bool operator>(const L1GObject& t) const {
140  if (myEt > t.myEt)
141  return true;
142  else
143  return false;
144  }
145 
146  bool operator<=(const L1GObject& t) const {
147  if (myEt <= t.myEt)
148  return true;
149  else
150  return false;
151  }
152 
153  bool operator>=(const L1GObject& t) const {
154  if (myEt >= t.myEt)
155  return true;
156  else
157  return false;
158  }
159 
160  friend std::ostream& operator<<(std::ostream& os, const L1GObject& t) {
161  os << "L1GObject : Name = " << t.name() << "(Et, Eta, Phi) = (" << t.myEt << ", " << t.myEta << ", " << t.myPhi
162  << ") (" << t.ptValue() << ", " << t.etaValue() << ", " << t.phiValue() << ")";
163  return os;
164  }
165 
166  void setEt(unsigned int et) { myEt = et; }
167  void setEta(unsigned int eta) { myEta = eta; }
168  void setPhi(unsigned int phi) { myPhi = phi; }
170  void setLSB(double lsb) { myLSB = lsb; }
171 
172  void initialize() {
173  for (unsigned int i = 0; i < 10; i++) {
174  phiValues[i] = 2. * 3.1415927 * i / 18;
175  }
176  for (unsigned int j = 10; j < 18; j++) {
177  phiValues[j] = -3.1415927 + 2. * 3.1415927 * (j - 9) / 18;
178  }
179  etaValues[0] = 0.174; // HB and inner HE bins are 0.348 wide
180  etaValues[1] = 0.522;
181  etaValues[2] = 0.870;
182  etaValues[3] = 1.218;
183  etaValues[4] = 1.566;
184  etaValues[5] = 1.956; // Last two HE bins are 0.432 and 0.828 wide
185  etaValues[6] = 2.586;
186  etaValues[7] = 3.250; // HF bins are 0.5 wide
187  etaValues[8] = 3.750;
188  etaValues[9] = 4.250;
189  etaValues[10] = 4.750;
190  myLSB = 1.0;
191 
192  // Initialize tuning parameters
193  //associatedRegionEt = -1;
194  //associatedJetPt = -1;
195  //puLevel = -1;
196 
197  // Setup the reco::Candidate (physics) 4-vector
198  math::PtEtaPhiMLorentzVector myP4(this->ptValue(), this->etaValue(), this->phiValue(), 0);
199  this->setP4(myP4);
200  }
201 
202  // Extra values for tuning UCT parameters - just public members, to
203  // eventually be removed
204  double associatedJetPt() const { return associatedJetPt_; }
205  unsigned int puLevel() const { return puLevel_; }
206  double associatedRegionEt() const { return associatedRegionEt_; }
207  bool ellIsolation() const { return ellIsolation_; };
208  bool tauVeto() const { return tauVeto_; }
209  bool mipBit() const { return mipBit_; }
210 
212  unsigned int puLevel_;
215 
216  // For the EG objects, don't require this to build the object, just embed it.
217  bool tauVeto_;
218  bool mipBit_;
219 
220 private:
221  unsigned int myEt;
222  unsigned int myEta;
223  unsigned int myPhi;
225 
226  double myLSB;
227  double etaValues[11];
228  double phiValues[18];
229 };
230 
231 #endif
double etaValues[11]
Definition: L1GObject.h:227
bool ellIsolation_
Definition: L1GObject.h:214
~L1GObject() override
Definition: L1GObject.h:91
unsigned int ptCode() const
Definition: L1GObject.h:117
bool operator>(const L1GObject &t) const
Definition: L1GObject.h:139
void setEt(unsigned int et)
Definition: L1GObject.h:166
bool operator>=(const L1GObject &t) const
Definition: L1GObject.h:153
bool tauVeto() const
Definition: L1GObject.h:208
double phiValues[18]
Definition: L1GObject.h:228
bool ellIsolation() const
Definition: L1GObject.h:207
unsigned int myPhi
Definition: L1GObject.h:223
unsigned int puLevel() const
Definition: L1GObject.h:205
unsigned int packedObject()
Definition: L1GObject.h:43
bool operator==(const L1GObject &t) const
Definition: L1GObject.h:125
L1GObject(unsigned int et, unsigned int eta, unsigned int phi, std::string name)
Definition: L1GObject.h:30
L1GObject(const L1GObject &t)
Definition: L1GObject.h:58
double etaValue() const
Definition: L1GObject.h:101
unsigned int myEta
Definition: L1GObject.h:222
double associatedRegionEt_
Definition: L1GObject.h:213
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
L1GObject & operator=(const L1GObject &t)
Definition: L1GObject.h:72
L1GObject(unsigned int packedObject, std::string name="L1GObject")
Definition: L1GObject.h:35
void setLSB(double lsb)
Definition: L1GObject.h:170
std::string myName
Definition: L1GObject.h:224
void setPhi(unsigned int phi)
Definition: L1GObject.h:168
bool operator<(const L1GObject &t) const
Definition: L1GObject.h:132
double associatedRegionEt() const
Definition: L1GObject.h:206
unsigned int etaIndex() const
Definition: L1GObject.h:119
bool tauVeto_
Definition: L1GObject.h:217
double associatedJetPt_
Definition: L1GObject.h:211
unsigned int myEt
Definition: L1GObject.h:221
std::string name() const
Definition: L1GObject.h:95
void initialize()
Definition: L1GObject.h:172
bool mipBit() const
Definition: L1GObject.h:209
friend std::ostream & operator<<(std::ostream &os, const L1GObject &t)
Definition: L1GObject.h:160
void setName(std::string name)
Definition: L1GObject.h:169
bool empty() const
Definition: L1GObject.h:97
unsigned int puLevel_
Definition: L1GObject.h:212
L1GObject(unsigned int et, unsigned int eta, unsigned int phi)
Definition: L1GObject.h:25
bool operator<=(const L1GObject &t) const
Definition: L1GObject.h:146
double et() const final
transverse energy
double phiValue() const
Definition: L1GObject.h:110
double ptValue() const
Definition: L1GObject.h:99
double phi() const final
momentum azimuthal angle
unsigned int phiIndex() const
Definition: L1GObject.h:121
void setEta(unsigned int eta)
Definition: L1GObject.h:167
bool mipBit_
Definition: L1GObject.h:218
void setP4(const LorentzVector &p4) final
set 4-momentum
L1GObject()
Definition: L1GObject.h:23
double myLSB
Definition: L1GObject.h:226
double associatedJetPt() const
Definition: L1GObject.h:204
double eta() const final
momentum pseudorapidity