CMS 3D CMS Logo

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