CMS 3D CMS Logo

L1TMuonEndcapObjectKeysOnlineProd.cc
Go to the documentation of this file.
1 #include <iostream>
6 #include "OnlineDBqueryHelper.h"
7 
9 private:
10 
11 public:
12  void fillObjectKeys( ReturnType pL1TriggerKey ) override ;
13 
16 };
17 
19  : L1ObjectKeysOnlineProdBaseExt( iConfig ){
20 }
21 
22 
24 
25  std::string EMTFKey = pL1TriggerKey->subsystemKey( L1TriggerKeyExt::kEMTF ) ;
26 
27  // simply assign the algo key to the record
28  pL1TriggerKey->add( "L1TMuonEndCapParamsO2ORcd",
29  "L1TMuonEndCapParams",
30  EMTFKey) ;
31 
32  std::string tscKey = EMTFKey.substr(0, EMTFKey.find(":") );
33  std::string rsKey = EMTFKey.substr( EMTFKey.find(":")+1, std::string::npos );
34 
36 // the block below reproduces L1TMuonEndCapParamsOnlineProd identically
37 
38  std::string algo_key, hw_key;
39  std::string algo_payload, hw_payload;
40  try {
41  std::map<std::string,std::string> keys =
42  l1t::OnlineDBqueryHelper::fetch( {"HW","ALGO"},
43  "EMTF_KEYS",
44  tscKey,
46  );
47 
48  hw_key = keys["HW"];
49  algo_key = keys["ALGO"];
50 
51  hw_payload = l1t::OnlineDBqueryHelper::fetch( {"CONF"},
52  "EMTF_CLOBS",
53  hw_key,
55  ) ["CONF"];
56 
57  algo_payload = l1t::OnlineDBqueryHelper::fetch( {"CONF"},
58  "EMTF_CLOBS",
59  algo_key,
61  ) ["CONF"];
62 
63  } catch ( std::runtime_error &e ) {
64  edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << e.what();
65  throw std::runtime_error("Broken key");
66  }
67 
68  l1t::XmlConfigParser xmlRdr;
69  l1t::TriggerSystem trgSys;
70 
71  xmlRdr.readDOMFromString( hw_payload );
72  xmlRdr.readRootElement ( trgSys );
73 
74  xmlRdr.readDOMFromString( algo_payload );
75  xmlRdr.readRootElement ( trgSys );
76 
77  trgSys.setConfigured();
78 
79  std::map<std::string, l1t::Parameter> conf = trgSys.getParameters("EMTF-1"); // any processor will do
80 
82 
83  // simply assign the algo key to the record
84  pL1TriggerKey->add( "L1TMuonEndCapForestO2ORcd",
85  "L1TMuonEndCapForest",
86  conf["pt_lut_version"].getValueAsStr()) ;
87 }
88 
89 
90 //define this as a plug-in
void setConfigured(bool state=true) noexcept
Definition: TriggerSystem.h:73
void fillObjectKeys(ReturnType pL1TriggerKey) override
std::shared_ptr< L1TriggerKeyExt > ReturnType
void readDOMFromString(const std::string &str, xercesc::DOMDocument *&doc)
static std::map< std::string, std::string > fetch(const std::vector< std::string > &queryColumns, const std::string &table, const std::string &key, l1t::OMDSReader &m_omdsReader)
L1TMuonEndcapObjectKeysOnlineProd(const edm::ParameterSet &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
const std::map< std::string, Parameter > & getParameters(const char *processor) const
void readRootElement(TriggerSystem &aTriggerSystem, const std::string &sysId="")