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 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;
63  associatedRegionEt_ = t.associatedRegionEt_;
64  associatedJetPt_ = t.associatedJetPt_;
65  ellIsolation_ = t.ellIsolation_;
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;
78  associatedRegionEt_ = t.associatedRegionEt_;
79  associatedJetPt_ = t.associatedJetPt_;
80  ellIsolation_ = t.ellIsolation_;
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
L1GObject::setName
void setName(std::string name)
Definition: L1GObject.h:169
L1GObject::name
std::string name() const
Definition: L1GObject.h:95
L1GObject::associatedRegionEt_
double associatedRegionEt_
Definition: L1GObject.h:213
mps_fire.i
i
Definition: mps_fire.py:428
L1GObject::mipBit_
bool mipBit_
Definition: L1GObject.h:218
L1GObject::tauVeto
bool tauVeto() const
Definition: L1GObject.h:208
L1GObject::phiValue
double phiValue() const
Definition: L1GObject.h:110
L1GObject::associatedJetPt_
double associatedJetPt_
Definition: L1GObject.h:211
L1GObject::L1GObject
L1GObject(unsigned int packedObject, std::string name="L1GObject")
Definition: L1GObject.h:35
L1GObject::setLSB
void setLSB(double lsb)
Definition: L1GObject.h:170
L1GObject::ptCode
unsigned int ptCode() const
Definition: L1GObject.h:117
L1GObject::operator<
bool operator<(const L1GObject &t) const
Definition: L1GObject.h:132
L1GObject::etaIndex
unsigned int etaIndex() const
Definition: L1GObject.h:119
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
L1GObject::associatedJetPt
double associatedJetPt() const
Definition: L1GObject.h:204
hgcalVFEProducer_cfi.lsb
lsb
Definition: hgcalVFEProducer_cfi.py:80
L1GObject::etaValues
double etaValues[11]
Definition: L1GObject.h:227
L1GObject::puLevel_
unsigned int puLevel_
Definition: L1GObject.h:212
L1GObject::L1GObject
L1GObject(unsigned int et, unsigned int eta, unsigned int phi)
Definition: L1GObject.h:25
L1GObject::myEt
unsigned int myEt
Definition: L1GObject.h:221
L1GObject::setPhi
void setPhi(unsigned int phi)
Definition: L1GObject.h:168
L1GObject::mipBit
bool mipBit() const
Definition: L1GObject.h:209
L1GObject::initialize
void initialize()
Definition: L1GObject.h:172
L1GObject::setEt
void setEt(unsigned int et)
Definition: L1GObject.h:166
LeafCandidate.h
L1GObject::operator<<
friend std::ostream & operator<<(std::ostream &os, const L1GObject &t)
Definition: L1GObject.h:160
L1GObject::~L1GObject
~L1GObject() override
Definition: L1GObject.h:91
L1GObject::setEta
void setEta(unsigned int eta)
Definition: L1GObject.h:167
L1GObject
Definition: L1GObject.h:18
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1GObject::packedObject
unsigned int packedObject()
Definition: L1GObject.h:43
L1GObject::etaValue
double etaValue() const
Definition: L1GObject.h:101
L1GObject::myPhi
unsigned int myPhi
Definition: L1GObject.h:223
L1GObject::operator>=
bool operator>=(const L1GObject &t) const
Definition: L1GObject.h:153
L1GObject::empty
bool empty() const
Definition: L1GObject.h:97
L1GObject::operator==
bool operator==(const L1GObject &t) const
Definition: L1GObject.h:125
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
L1GObject::ellIsolation
bool ellIsolation() const
Definition: L1GObject.h:207
L1GObject::ellIsolation_
bool ellIsolation_
Definition: L1GObject.h:214
L1GObject::puLevel
unsigned int puLevel() const
Definition: L1GObject.h:205
LorentzVector.h
L1GObject::myEta
unsigned int myEta
Definition: L1GObject.h:222
L1GObject::myName
std::string myName
Definition: L1GObject.h:224
L1GObject::operator=
L1GObject & operator=(const L1GObject &t)
Definition: L1GObject.h:72
L1GObject::phiValues
double phiValues[18]
Definition: L1GObject.h:228
L1GObject::L1GObject
L1GObject()
Definition: L1GObject.h:23
L1GObject::myLSB
double myLSB
Definition: L1GObject.h:226
L1GObject::L1GObject
L1GObject(const L1GObject &t)
Definition: L1GObject.h:58
reco::LeafCandidate::LeafCandidate
LeafCandidate()
Definition: LeafCandidate.h:33
L1GObject::operator>
bool operator>(const L1GObject &t) const
Definition: L1GObject.h:139
L1GObject::phiIndex
unsigned int phiIndex() const
Definition: L1GObject.h:121
L1GObject::associatedRegionEt
double associatedRegionEt() const
Definition: L1GObject.h:206
reco::LeafCandidate::et
double et() const final
transverse energy
Definition: LeafCandidate.h:127
reco::LeafCandidate::setP4
void setP4(const LorentzVector &p4) final
set 4-momentum
Definition: LeafCandidate.h:158
L1GObject::tauVeto_
bool tauVeto_
Definition: L1GObject.h:217
L1GObject::operator<=
bool operator<=(const L1GObject &t) const
Definition: L1GObject.h:146
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
L1GObject::ptValue
double ptValue() const
Definition: L1GObject.h:99
L1GObject::L1GObject
L1GObject(unsigned int et, unsigned int eta, unsigned int phi, std::string name)
Definition: L1GObject.h:30
reco::LeafCandidate
Definition: LeafCandidate.h:16
math::PtEtaPhiMLorentzVector
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8