Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-19 00:05:08

0001 #include <iostream>
0002 #include "CondTools/L1TriggerExt/interface/L1ObjectKeysOnlineProdBaseExt.h"
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 #include "OnlineDBqueryHelper.h"
0005 
0006 class L1TMuonOverlapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt {
0007 private:
0008   bool transactionSafe;
0009 
0010 public:
0011   void fillObjectKeys(L1TriggerKeyExt* pL1TriggerKey) override;
0012 
0013   L1TMuonOverlapObjectKeysOnlineProd(const edm::ParameterSet&);
0014   ~L1TMuonOverlapObjectKeysOnlineProd(void) override = default;
0015 };
0016 
0017 L1TMuonOverlapObjectKeysOnlineProd::L1TMuonOverlapObjectKeysOnlineProd(const edm::ParameterSet& iConfig)
0018     : L1ObjectKeysOnlineProdBaseExt(iConfig) {
0019   transactionSafe = iConfig.getParameter<bool>("transactionSafe");
0020 }
0021 
0022 void L1TMuonOverlapObjectKeysOnlineProd::fillObjectKeys(L1TriggerKeyExt* pL1TriggerKey) {
0023   std::string OMTFKey = pL1TriggerKey->subsystemKey(L1TriggerKeyExt::kOMTF);
0024 
0025   std::string tscKey = OMTFKey.substr(0, OMTFKey.find(':'));
0026   std::string algo_key, infra_key;
0027 
0028   // L1TMuonOverlapFwVersion and L1TMuonOverlapParams keys to be found from INFRA and ALGO, respectively
0029 
0030   try {
0031     std::map<std::string, std::string> keys =
0032         l1t::OnlineDBqueryHelper::fetch({"ALGO", "INFRA"}, "OMTF_KEYS", tscKey, m_omdsReader);
0033     algo_key = keys["ALGO"];
0034     infra_key = keys["INFRA"];
0035 
0036   } catch (std::runtime_error& e) {
0037     edm::LogError("L1-O2O L1TMuonOverlapObjectKeysOnlineProd") << "Cannot get OMTF_KEYS ";
0038 
0039     if (transactionSafe)
0040       throw std::runtime_error("SummaryForFunctionManager: OMTF  | Faulty  | Broken key");
0041     else {
0042       edm::LogError("L1-O2O: L1TMuonOverlapObjectKeysOnlineProd")
0043           << "forcing L1TMuonOverlapFwVersion key to be = 'OMTF_INFRA_EMPTY' with baseline settings";
0044       pL1TriggerKey->add("L1TMuonOverlapFwVersionO2ORcd", "L1TMuonOverlapFwVersion", "OMTF_INFRA_EMPTY");
0045       edm::LogError("L1-O2O: L1TMuonOverlapObjectKeysOnlineProd")
0046           << "forcing L1TMuonOverlapParams key to be = 'OMTF_ALGO_EMPTY' (known to exist)";
0047       pL1TriggerKey->add("L1TMuonOverlapParamsO2ORcd", "L1TMuonOverlapParams", "OMTF_ALGO_EMPTY");
0048       return;
0049     }
0050   }
0051 
0052   pL1TriggerKey->add("L1TMuonOverlapFwVersionO2ORcd", "L1TMuonOverlapFwVersion", infra_key);
0053 
0054   pL1TriggerKey->add("L1TMuonOverlapParamsO2ORcd", "L1TMuonOverlapParams", algo_key);
0055 }
0056 
0057 //define this as a plug-in
0058 DEFINE_FWK_EVENTSETUP_MODULE(L1TMuonOverlapObjectKeysOnlineProd);