Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h"
0002 #include "CondFormats/L1TObjects/interface/L1MuGMTChannelMask.h"
0003 #include "CondFormats/DataRecord/interface/L1MuGMTChannelMaskRcd.h"
0004 
0005 class L1MuGMTChannelMaskOnlineProducer : public L1ConfigOnlineProdBase<L1MuGMTChannelMaskRcd, L1MuGMTChannelMask> {
0006 public:
0007   L1MuGMTChannelMaskOnlineProducer(const edm::ParameterSet& iConfig)
0008       : L1ConfigOnlineProdBase<L1MuGMTChannelMaskRcd, L1MuGMTChannelMask>(iConfig) {}
0009   ~L1MuGMTChannelMaskOnlineProducer() override {}
0010 
0011   std::unique_ptr<L1MuGMTChannelMask> newObject(const std::string& objectKey) override;
0012 
0013 private:
0014 };
0015 
0016 std::unique_ptr<L1MuGMTChannelMask> L1MuGMTChannelMaskOnlineProducer::newObject(const std::string& objectKey) {
0017   std::vector<std::string> columns;
0018   columns.push_back("ENABLE_RPCB");
0019   columns.push_back("ENABLE_CSC");
0020   columns.push_back("ENABLE_DT");
0021   columns.push_back("ENABLE_RPCF");
0022 
0023   // Execute SQL queries to get data from OMDS (using key) and make C++ object
0024   // Example: SELECT A_PARAMETER FROM CMS_XXX.XXX_CONF WHERE XXX_CONF.XXX_KEY = objectKey
0025   l1t::OMDSReader::QueryResults results = m_omdsReader.basicQuery(
0026       columns, "CMS_GMT", "GMT_RUN_SETTINGS", "GMT_RUN_SETTINGS.ID", m_omdsReader.singleAttribute(objectKey));
0027 
0028   if (results.queryFailed())  // check if query was successful
0029   {
0030     edm::LogError("L1-O2O") << "L1MuGMTChannelMaskOnlineProducer: Problem getting " << objectKey
0031                             << " key from GMT_RUN_SETTING.";
0032     return std::unique_ptr<L1MuGMTChannelMask>();
0033   }
0034 
0035   unsigned mask = 0;
0036   bool maskaux;
0037   results.fillVariable("ENABLE_RPCB", maskaux);
0038   if (!maskaux)
0039     mask |= 2;
0040   results.fillVariable("ENABLE_CSC", maskaux);
0041   if (!maskaux)
0042     mask |= 4;
0043   results.fillVariable("ENABLE_DT", maskaux);
0044   if (!maskaux)
0045     mask |= 1;
0046   results.fillVariable("ENABLE_RPCF", maskaux);
0047   if (!maskaux)
0048     mask |= 8;
0049 
0050   auto gmtchanmask = std::make_unique<L1MuGMTChannelMask>();
0051 
0052   gmtchanmask->setSubsystemMask(mask);
0053 
0054   return gmtchanmask;
0055 }
0056 
0057 DEFINE_FWK_EVENTSETUP_MODULE(L1MuGMTChannelMaskOnlineProducer);