Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:16

0001 #include <vector>
0002 #include "CondFormats/L1TObjects/interface/CaloParams.h"
0003 
0004 class CaloParams_PUBLIC : public l1t::CaloParams {
0005 public:
0006   unsigned version_;
0007 
0008   std::vector<Node> pnode_;
0009 
0010   TowerParams towerp_;
0011 
0012   // Region LSB
0013   double regionLsb_;
0014 
0015   EgParams egp_;
0016   TauParams taup_;
0017   JetParams jetp_;
0018 
0019   /* Sums */
0020 
0021   // EtSum LSB
0022   double etSumLsb_;
0023 
0024   // minimum eta for EtSums (index is particular EtSum.  ETT=1, HTT=2, MET=3, MHT=4, other values reserved).
0025   std::vector<int> etSumEtaMin_;
0026 
0027   // maximum eta for EtSums (index is particular EtSum.  ETT=1, HTT=2, MET=3, MHT=4, other values reserved).
0028   std::vector<int> etSumEtaMax_;
0029 
0030   // minimum eta for EtSums (index is particular EtSum.  ETT=1, HTT=2, MET=3, MHT=4, other values reserved).
0031   std::vector<double> etSumEtThreshold_;
0032 
0033   CaloParams_PUBLIC(const l1t::CaloParams& p) : l1t::CaloParams(p) {
0034     version_ = l1t::CaloParams::version_;
0035     pnode_ = l1t::CaloParams::pnode_;
0036     towerp_ = l1t::CaloParams::towerp_;
0037     regionLsb_ = l1t::CaloParams::regionLsb_;
0038     egp_ = l1t::CaloParams::egp_;
0039     taup_ = l1t::CaloParams::taup_;
0040     jetp_ = l1t::CaloParams::jetp_;
0041     etSumLsb_ = l1t::CaloParams::etSumLsb_;
0042     etSumEtaMin_ = l1t::CaloParams::etSumEtaMin_;
0043     etSumEtaMax_ = l1t::CaloParams::etSumEtaMax_;
0044     etSumEtThreshold_ = l1t::CaloParams::etSumEtThreshold_;
0045   }
0046 };
0047 
0048 class LUT_PUBLIC {
0049 public:
0050   unsigned int nrBitsAddress_;  //technically redundant with addressMask
0051   unsigned int nrBitsData_;     //technically redundant with dataMask
0052   unsigned int addressMask_;
0053   unsigned int dataMask_;
0054 
0055   std::vector<int> data_;
0056 };
0057 
0058 bool operator==(const std::vector<int>& a1, const std::vector<int>& a2) {
0059   if (a1.size() != a2.size())
0060     return false;
0061   for (unsigned i = 0; i < a1.size(); i++)
0062     if (a1[i] != a2[i])
0063       return false;
0064   return true;
0065 }
0066 
0067 bool operator==(const l1t::CaloParams::TowerParams& a1, const l1t::CaloParams::TowerParams& a2) {
0068   return (a1.lsbH_ == a2.lsbH_ && a1.lsbE_ == a2.lsbE_ && a1.lsbSum_ == a2.lsbSum_ && a1.nBitsH_ == a2.nBitsH_ &&
0069           a1.nBitsE_ == a2.nBitsE_ && a1.nBitsSum_ == a2.nBitsSum_ && a1.nBitsRatio_ == a2.nBitsRatio_ &&
0070           a1.maskH_ == a2.maskH_ && a1.maskE_ == a2.maskE_ && a1.maskSum_ == a2.maskSum_ &&
0071           a1.maskRatio_ == a2.maskRatio_ && a1.doEncoding_ == a2.doEncoding_);
0072 }
0073 
0074 bool operator==(const l1t::LUT& b1, const l1t::LUT& b2) {
0075   const LUT_PUBLIC& a1 = reinterpret_cast<const LUT_PUBLIC&>(b1);
0076   const LUT_PUBLIC& a2 = reinterpret_cast<const LUT_PUBLIC&>(b2);
0077 
0078   bool a = (a1.nrBitsAddress_ == a2.nrBitsAddress_);
0079   bool d = (a1.nrBitsData_ == a2.nrBitsData_);
0080   bool m = (a1.addressMask_ == a2.addressMask_);
0081   bool mm = (a1.dataMask_ == a2.dataMask_);
0082   bool v = (a1.data_ == a2.data_);
0083   std::cout << "a=" << a << " d=" << d << " m=" << m << " mm=" << mm << " v=" << v << std::endl;
0084   return a && d && m && mm && v;
0085 }
0086 
0087 bool operator==(const l1t::CaloParams::Node& a1, const l1t::CaloParams::Node& a2) {
0088   bool t = (a1.type_ == a2.type_);
0089   bool v = (a1.version_ == a2.version_);
0090   bool l = (a1.LUT_ == a2.LUT_);
0091   bool d = (a1.dparams_ == a2.dparams_);
0092   bool u = (a1.uparams_ == a2.uparams_);
0093   bool i = (a1.iparams_ == a2.iparams_);
0094   bool s = (a1.sparams_ == a2.sparams_);
0095   std::cout << "t=" << t << " v=" << v << " l=" << l << " d=" << d << " u=" << u << " i=" << i << " s=" << s
0096             << std::endl;
0097   return t && v && l && d && u && i && s;
0098 }
0099 
0100 bool operator==(const std::vector<l1t::CaloParams::Node>& a1, const std::vector<l1t::CaloParams::Node>& a2) {
0101   if (a1.size() != a2.size())
0102     return false;
0103   for (unsigned i = 0; i < a1.size(); i++) {
0104     if (!(a1[i] == a2[i]))
0105       return false;
0106   }
0107   return true;
0108 }
0109 
0110 bool operator==(const l1t::CaloParams& b1, const l1t::CaloParams& b2) {
0111   CaloParams_PUBLIC a1(b1);
0112   CaloParams_PUBLIC a2(b2);
0113 
0114   bool v = (a1.version_ == a2.version_);
0115   std::cout << " version_: " << v << std::endl;
0116 
0117   bool pn = (a1.pnode_[1] == a2.pnode_[1]);
0118   std::cout << " pnode_: " << pn << std::endl;
0119 
0120   bool tp = (a1.towerp_ == a2.towerp_);
0121   std::cout << " towerp_: " << tp << std::endl;
0122   bool rlsb = (a1.regionLsb_ == a2.regionLsb_);
0123   std::cout << " regionLsb_: " << rlsb << std::endl;
0124 
0125   bool egp =
0126       ((a1.egp_.lsb_ == a2.egp_.lsb_) && (a1.egp_.seedThreshold_ == a2.egp_.seedThreshold_) &&
0127        (a1.egp_.neighbourThreshold_ == a2.egp_.neighbourThreshold_) &&
0128        (a1.egp_.hcalThreshold_ == a2.egp_.hcalThreshold_) && (a1.egp_.maxHcalEt_ == a2.egp_.maxHcalEt_) &&
0129        (a1.egp_.maxPtHOverE_ == a2.egp_.maxPtHOverE_) && (a1.egp_.minPtJetIsolation_ == a2.egp_.minPtJetIsolation_) &&
0130        (a1.egp_.maxPtJetIsolation_ == a2.egp_.maxPtJetIsolation_) &&
0131        (a1.egp_.isoAreaNrTowersEta_ == a2.egp_.isoAreaNrTowersEta_) &&
0132        (a1.egp_.isoAreaNrTowersPhi_ == a2.egp_.isoAreaNrTowersPhi_) &&
0133        (a1.egp_.isoVetoNrTowersPhi_ == a2.egp_.isoVetoNrTowersPhi_));
0134   std::cout << " egp_: " << egp << std::endl;
0135 
0136   bool taup =
0137       ((a1.taup_.lsb_ == a2.taup_.lsb_) && (a1.taup_.seedThreshold_ == a2.taup_.seedThreshold_) &&
0138        (a1.taup_.neighbourThreshold_ == a2.taup_.neighbourThreshold_) &&
0139        (a1.taup_.maxPtTauVeto_ == a2.taup_.maxPtTauVeto_) &&
0140        (a1.taup_.minPtJetIsolationB_ == a2.taup_.minPtJetIsolationB_) &&
0141        (a1.taup_.maxJetIsolationB_ == a2.taup_.maxJetIsolationB_) &&
0142        (a1.taup_.maxJetIsolationA_ == a2.taup_.maxJetIsolationA_) && (a1.taup_.isoEtaMin_ == a2.taup_.isoEtaMin_) &&
0143        (a1.taup_.isoEtaMax_ == a2.taup_.isoEtaMax_) && (a1.taup_.isoAreaNrTowersEta_ == a2.taup_.isoAreaNrTowersEta_) &&
0144        (a1.taup_.isoAreaNrTowersPhi_ == a2.taup_.isoAreaNrTowersPhi_) &&
0145        (a1.taup_.isoVetoNrTowersPhi_ == a2.taup_.isoVetoNrTowersPhi_));
0146   std::cout << " taup_: " << taup << std::endl;
0147 
0148   bool jetp = ((a1.jetp_.lsb_ == a2.jetp_.lsb_) && (a1.jetp_.seedThreshold_ == a2.jetp_.seedThreshold_) &&
0149                (a1.jetp_.neighbourThreshold_ == a2.jetp_.neighbourThreshold_));
0150   std::cout << " jetp_: " << jetp << std::endl;
0151 
0152   bool etslsb = (a1.etSumLsb_ == a2.etSumLsb_);
0153   std::cout << " etSumLsb_: " << etslsb << std::endl;
0154   bool etsemn = (a1.etSumEtaMin_ == a2.etSumEtaMin_);
0155   std::cout << " etSumEtaMin_: " << etsemn << std::endl;
0156 
0157   bool etsemx = (a1.etSumEtaMax_ == a2.etSumEtaMax_);
0158   std::cout << " etSumEtaMax_: " << etsemx << std::endl;
0159   bool sett = (a1.etSumEtThreshold_ == a2.etSumEtThreshold_);
0160   std::cout << " etSumEtThreshold_: " << sett << std::endl;
0161 
0162   return v && pn && tp && rlsb && egp && taup && jetp && etslsb && etsemn && etsemx && sett;
0163 }