CMS 3D CMS Logo

L1TCaloParamsCompare.cc
Go to the documentation of this file.
1 #include <vector>
3 
5 public:
6  unsigned version_;
7 
8  std::vector<Node> pnode_;
9 
10  TowerParams towerp_;
11 
12  // Region LSB
13  double regionLsb_;
14 
16  TauParams taup_;
18 
19  /* Sums */
20 
21  // EtSum LSB
22  double etSumLsb_;
23 
24  // minimum eta for EtSums (index is particular EtSum. ETT=1, HTT=2, MET=3, MHT=4, other values reserved).
25  std::vector<int> etSumEtaMin_;
26 
27  // maximum eta for EtSums (index is particular EtSum. ETT=1, HTT=2, MET=3, MHT=4, other values reserved).
28  std::vector<int> etSumEtaMax_;
29 
30  // minimum eta for EtSums (index is particular EtSum. ETT=1, HTT=2, MET=3, MHT=4, other values reserved).
31  std::vector<double> etSumEtThreshold_;
32 
34  version_ = l1t::CaloParams::version_;
35  pnode_ = l1t::CaloParams::pnode_;
36  towerp_ = l1t::CaloParams::towerp_;
37  regionLsb_ = l1t::CaloParams::regionLsb_;
38  egp_ = l1t::CaloParams::egp_;
39  taup_ = l1t::CaloParams::taup_;
40  jetp_ = l1t::CaloParams::jetp_;
41  etSumLsb_ = l1t::CaloParams::etSumLsb_;
42  etSumEtaMin_ = l1t::CaloParams::etSumEtaMin_;
43  etSumEtaMax_ = l1t::CaloParams::etSumEtaMax_;
44  etSumEtThreshold_ = l1t::CaloParams::etSumEtThreshold_;
45  }
46 };
47 
48 class LUT_PUBLIC {
49 public:
50  unsigned int nrBitsAddress_; //technically redundant with addressMask
51  unsigned int nrBitsData_; //technically redundant with dataMask
52  unsigned int addressMask_;
53  unsigned int dataMask_;
54 
55  std::vector<int> data_;
56 };
57 
58 bool operator==(const std::vector<int>& a1, const std::vector<int>& a2) {
59  if (a1.size() != a2.size())
60  return false;
61  for (unsigned i = 0; i < a1.size(); i++)
62  if (a1[i] != a2[i])
63  return false;
64  return true;
65 }
66 
68  return (a1.lsbH_ == a2.lsbH_ && a1.lsbE_ == a2.lsbE_ && a1.lsbSum_ == a2.lsbSum_ && a1.nBitsH_ == a2.nBitsH_ &&
69  a1.nBitsE_ == a2.nBitsE_ && a1.nBitsSum_ == a2.nBitsSum_ && a1.nBitsRatio_ == a2.nBitsRatio_ &&
70  a1.maskH_ == a2.maskH_ && a1.maskE_ == a2.maskE_ && a1.maskSum_ == a2.maskSum_ &&
71  a1.maskRatio_ == a2.maskRatio_ && a1.doEncoding_ == a2.doEncoding_);
72 }
73 
74 bool operator==(const l1t::LUT& b1, const l1t::LUT& b2) {
75  const LUT_PUBLIC& a1 = reinterpret_cast<const LUT_PUBLIC&>(b1);
76  const LUT_PUBLIC& a2 = reinterpret_cast<const LUT_PUBLIC&>(b2);
77 
78  bool a = (a1.nrBitsAddress_ == a2.nrBitsAddress_);
79  bool d = (a1.nrBitsData_ == a2.nrBitsData_);
80  bool m = (a1.addressMask_ == a2.addressMask_);
81  bool mm = (a1.dataMask_ == a2.dataMask_);
82  bool v = (a1.data_ == a2.data_);
83  std::cout << "a=" << a << " d=" << d << " m=" << m << " mm=" << mm << " v=" << v << std::endl;
84  return a && d && m && mm && v;
85 }
86 
88  bool t = (a1.type_ == a2.type_);
89  bool v = (a1.version_ == a2.version_);
90  bool l = (a1.LUT_ == a2.LUT_);
91  bool d = (a1.dparams_ == a2.dparams_);
92  bool u = (a1.uparams_ == a2.uparams_);
93  bool i = (a1.iparams_ == a2.iparams_);
94  bool s = (a1.sparams_ == a2.sparams_);
95  std::cout << "t=" << t << " v=" << v << " l=" << l << " d=" << d << " u=" << u << " i=" << i << " s=" << s
96  << std::endl;
97  return t && v && l && d && u && i && s;
98 }
99 
100 bool operator==(const std::vector<l1t::CaloParams::Node>& a1, const std::vector<l1t::CaloParams::Node>& a2) {
101  if (a1.size() != a2.size())
102  return false;
103  for (unsigned i = 0; i < a1.size(); i++) {
104  if (!(a1[i] == a2[i]))
105  return false;
106  }
107  return true;
108 }
109 
110 bool operator==(const l1t::CaloParams& b1, const l1t::CaloParams& b2) {
111  CaloParams_PUBLIC a1(b1);
112  CaloParams_PUBLIC a2(b2);
113 
114  bool v = (a1.version_ == a2.version_);
115  std::cout << " version_: " << v << std::endl;
116 
117  bool pn = (a1.pnode_[1] == a2.pnode_[1]);
118  std::cout << " pnode_: " << pn << std::endl;
119 
120  bool tp = (a1.towerp_ == a2.towerp_);
121  std::cout << " towerp_: " << tp << std::endl;
122  bool rlsb = (a1.regionLsb_ == a2.regionLsb_);
123  std::cout << " regionLsb_: " << rlsb << std::endl;
124 
125  bool egp =
126  ((a1.egp_.lsb_ == a2.egp_.lsb_) && (a1.egp_.seedThreshold_ == a2.egp_.seedThreshold_) &&
134  std::cout << " egp_: " << egp << std::endl;
135 
136  bool taup =
137  ((a1.taup_.lsb_ == a2.taup_.lsb_) && (a1.taup_.seedThreshold_ == a2.taup_.seedThreshold_) &&
138  (a1.taup_.neighbourThreshold_ == a2.taup_.neighbourThreshold_) &&
139  (a1.taup_.maxPtTauVeto_ == a2.taup_.maxPtTauVeto_) &&
140  (a1.taup_.minPtJetIsolationB_ == a2.taup_.minPtJetIsolationB_) &&
141  (a1.taup_.maxJetIsolationB_ == a2.taup_.maxJetIsolationB_) &&
142  (a1.taup_.maxJetIsolationA_ == a2.taup_.maxJetIsolationA_) && (a1.taup_.isoEtaMin_ == a2.taup_.isoEtaMin_) &&
143  (a1.taup_.isoEtaMax_ == a2.taup_.isoEtaMax_) && (a1.taup_.isoAreaNrTowersEta_ == a2.taup_.isoAreaNrTowersEta_) &&
144  (a1.taup_.isoAreaNrTowersPhi_ == a2.taup_.isoAreaNrTowersPhi_) &&
145  (a1.taup_.isoVetoNrTowersPhi_ == a2.taup_.isoVetoNrTowersPhi_));
146  std::cout << " taup_: " << taup << std::endl;
147 
148  bool jetp = ((a1.jetp_.lsb_ == a2.jetp_.lsb_) && (a1.jetp_.seedThreshold_ == a2.jetp_.seedThreshold_) &&
150  std::cout << " jetp_: " << jetp << std::endl;
151 
152  bool etslsb = (a1.etSumLsb_ == a2.etSumLsb_);
153  std::cout << " etSumLsb_: " << etslsb << std::endl;
154  bool etsemn = (a1.etSumEtaMin_ == a2.etSumEtaMin_);
155  std::cout << " etSumEtaMin_: " << etsemn << std::endl;
156 
157  bool etsemx = (a1.etSumEtaMax_ == a2.etSumEtaMax_);
158  std::cout << " etSumEtaMax_: " << etsemx << std::endl;
159  bool sett = (a1.etSumEtThreshold_ == a2.etSumEtThreshold_);
160  std::cout << " etSumEtThreshold_: " << sett << std::endl;
161 
162  return v && pn && tp && rlsb && egp && taup && jetp && etslsb && etsemn && etsemx && sett;
163 }
unsigned int dataMask_
std::string type_
Definition: CaloParams.h:31
EgParams egp_
Definition: CaloParams.h:243
std::vector< double > etSumEtThreshold_
Definition: CaloParams.h:259
std::vector< Node > pnode_
Definition: CaloParams.h:236
std::vector< int > data_
TowerParams towerp_
Definition: CaloParams.h:238
delete x;
Definition: CaloConfig.h:22
double regionLsb_
Definition: CaloParams.h:241
bool operator==(const std::vector< int > &a1, const std::vector< int > &a2)
unsigned int nrBitsData_
unsigned int nrBitsAddress_
std::vector< double > dparams_
Definition: CaloParams.h:34
std::vector< int > etSumEtaMin_
Definition: CaloParams.h:253
std::vector< Node > pnode_
std::vector< std::string > sparams_
Definition: CaloParams.h:37
CaloParams_PUBLIC(const l1t::CaloParams &p)
JetParams jetp_
Definition: CaloParams.h:245
unsigned int addressMask_
std::vector< int > etSumEtaMax_
std::vector< int > etSumEtaMax_
Definition: CaloParams.h:256
d
Definition: ztail.py:151
std::vector< double > etSumEtThreshold_
unsigned version_
Definition: CaloParams.h:234
std::vector< unsigned > uparams_
Definition: CaloParams.h:35
Definition: LUT.h:29
TauParams taup_
Definition: CaloParams.h:244
double etSumLsb_
Definition: CaloParams.h:250
std::vector< int > etSumEtaMin_
std::vector< int > iparams_
Definition: CaloParams.h:36
double a
Definition: hdecay.h:119