Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:24

0001 #include "CondFormats/L1TObjects/interface/L1RPCHsbConfig.h"
0002 #include "FWCore/Utilities/interface/Exception.h"
0003 
0004 L1RPCHsbConfig::L1RPCHsbConfig() {}
0005 
0006 L1RPCHsbConfig::~L1RPCHsbConfig() {}
0007 
0008 void L1RPCHsbConfig::setHsbMask(int hsb, const std::vector<int>& mask) {
0009   if (getMaskSize() != int(mask.size())) {
0010     throw cms::Exception("L1RPCHsbConfig::setHsbMask")
0011         << "Wrong size of hsb mask " << mask.size() << " " << getMaskSize() << "\n";
0012   }
0013 
0014   if (hsb != 0 && hsb != 1) {
0015     throw cms::Exception("L1RPCHsbConfig::getHsbMask") << "Wrong hsb index: " << hsb << "\n";
0016   }
0017   if (hsb == 0) {
0018     for (int i = 0; i < getMaskSize(); ++i) {
0019       m_hsb0[i] = mask[i];
0020     }
0021   }
0022 
0023   if (hsb == 1) {
0024     for (int i = 0; i < getMaskSize(); ++i) {
0025       m_hsb1[i] = mask[i];
0026     }
0027   }
0028 }
0029 
0030 int L1RPCHsbConfig::getHsbMask(int hsb, int input) const {
0031   if (input < 0 || input >= int(sizeof(m_hsb0) / (sizeof(m_hsb0[0])))) {
0032     throw cms::Exception("L1RPCHsbConfig::getHsbMask") << "Wrong hsb input index: " << input << "\n";
0033   }
0034   if (hsb == 0) {
0035     return m_hsb0[input];
0036   } else if (hsb == 1) {
0037     return m_hsb1[input];
0038   } else {
0039     throw cms::Exception("L1RPCHsbConfig::getHsbMask") << "Wrong hsb index: " << hsb << "\n";
0040   }
0041 
0042   return -1;
0043 }