CMS 3D CMS Logo

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