CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
L1TMuonBarrelParamsOnlineProd Class Reference
Inheritance diagram for L1TMuonBarrelParamsOnlineProd:
L1ConfigOnlineProdBaseExt< L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 L1TMuonBarrelParamsOnlineProd (const edm::ParameterSet &)
 
std::shared_ptr< L1TMuonBarrelParamsnewObject (const std::string &objectKey, const L1TMuonBarrelParamsO2ORcd &record) override
 
 ~L1TMuonBarrelParamsOnlineProd (void) override
 
- Public Member Functions inherited from L1ConfigOnlineProdBaseExt< L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams >
 L1ConfigOnlineProdBaseExt (const edm::ParameterSet &)
 
std::shared_ptr< L1TMuonBarrelParamsproduce (const L1TMuonBarrelParamsO2ORcd &iRecord)
 
 ~L1ConfigOnlineProdBaseExt () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Private Attributes

bool transactionSafe
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from L1ConfigOnlineProdBaseExt< L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams >
bool getObjectKey (const L1TMuonBarrelParamsO2ORcd &record, std::shared_ptr< L1TMuonBarrelParams > data, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollector setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- Protected Attributes inherited from L1ConfigOnlineProdBaseExt< L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams >
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Definition at line 16 of file L1TMuonBarrelParamsOnlineProd.cc.

Constructor & Destructor Documentation

L1TMuonBarrelParamsOnlineProd::L1TMuonBarrelParamsOnlineProd ( const edm::ParameterSet iConfig)
L1TMuonBarrelParamsOnlineProd::~L1TMuonBarrelParamsOnlineProd ( void  )
inlineoverride

Definition at line 23 of file L1TMuonBarrelParamsOnlineProd.cc.

23 {}

Member Function Documentation

std::shared_ptr< L1TMuonBarrelParams > L1TMuonBarrelParamsOnlineProd::newObject ( const std::string &  objectKey,
const L1TMuonBarrelParamsO2ORcd record 
)
overridevirtual

Implements L1ConfigOnlineProdBaseExt< L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams >.

Definition at line 30 of file L1TMuonBarrelParamsOnlineProd.cc.

References mps_setup::append, L1TMuonBarrelParamsHelper::configFromDB(), DEFINE_FWK_EVENTSETUP_MODULE, MillePedeFileConverter_cfg::e, l1t::OnlineDBqueryHelper::fetch(), edm::eventsetup::EventSetupRecord::get(), relativeConstraints::keys, L1ConfigOnlineProdBaseExt< L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams >::m_omdsReader, convertSQLitetoXML_cfg::output, l1t::XmlConfigParser::readDOMFromString(), l1t::XmlConfigParser::readRootElement(), l1t::TriggerSystem::setConfigured(), AlCaHLTBitMon_QueryRunRegistry::string, and transactionSafe.

30  {
31  using namespace edm::es;
32 
33  const L1TMuonBarrelParamsRcd& baseRcd = record.template getRecord< L1TMuonBarrelParamsRcd >() ;
35  baseRcd.get( baseSettings ) ;
36 
37  if (objectKey.empty()) {
38  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "Key is empty, returning empty L1TMuonBarrelParams";
39  if( transactionSafe )
40  throw std::runtime_error("SummaryForFunctionManager: BMTF | Faulty | Empty objectKey");
41  else {
42  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams";
43  return std::make_shared< L1TMuonBarrelParams >( *(baseSettings.product()) ) ;
44  }
45  }
46 
47  std::string tscKey = objectKey.substr(0, objectKey.find(":") );
48  std::string rsKey = objectKey.substr( objectKey.find(":")+1, std::string::npos );
49 
50 
51  edm::LogInfo( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "Producing L1TMuonBarrelParams with TSC key = " << tscKey << " and RS key = " << rsKey ;
52 
53  std::string algo_key, hw_key;
54  std::string mp7_key, amc13_key;
55  std::string hw_payload, algo_payload, mp7_payload, amc13_payload;
56  try {
57  std::map<std::string,std::string> keys =
58  l1t::OnlineDBqueryHelper::fetch( {"ALGO","HW"},
59  "BMTF_KEYS",
60  tscKey,
62  );
63  algo_key = keys["ALGO"];
64  hw_key = keys["HW"];
65 
66  hw_payload =
68  "BMTF_CLOBS",
69  hw_key,
71  ) ["CONF"];
72 
73  algo_payload =
75  "BMTF_CLOBS",
76  algo_key,
78  ) ["CONF"];
79 
80  std::map<std::string,std::string> rsKeys =
81  l1t::OnlineDBqueryHelper::fetch( {"MP7","AMC13"},
82  "BMTF_RS_KEYS",
83  rsKey,
85  );
86  mp7_key = rsKeys["MP7"];
87  amc13_key = rsKeys["AMC13"];
88 
89  mp7_payload =
91  "BMTF_CLOBS",
92  mp7_key,
94  ) ["CONF"];
95  amc13_payload =
97  "BMTF_CLOBS",
98  amc13_key,
100  ) ["CONF"];
101 
102  } catch ( std::runtime_error &e ) {
103  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << e.what();
104  if( transactionSafe )
105  throw std::runtime_error(std::string("SummaryForFunctionManager: BMTF | Faulty | ") + e.what());
106  else {
107  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams";
108  return std::make_shared< L1TMuonBarrelParams >( *(baseSettings.product()) ) ;
109  }
110  }
111 
112 
113  // for debugging dump the configs to local files
114  {
115  std::ofstream output(std::string("/tmp/").append(hw_key.substr(0,hw_key.find("/"))).append(".xml"));
116  output << hw_payload;
117  output.close();
118  }
119  {
120  std::ofstream output(std::string("/tmp/").append(algo_key.substr(0,algo_key.find("/"))).append(".xml"));
121  output << algo_payload;
122  output.close();
123  }
124  {
125  std::ofstream output(std::string("/tmp/").append(mp7_key.substr(0,mp7_key.find("/"))).append(".xml"));
126  output << mp7_payload;
127  output.close();
128  }
129  {
130  std::ofstream output(std::string("/tmp/").append(amc13_key.substr(0,amc13_key.find("/"))).append(".xml"));
131  output << amc13_payload;
132  output.close();
133  }
134 
135  // finally, push all payloads to the XML parser and construct the TrigSystem objects with each of those
136  l1t::XmlConfigParser xmlRdr;
137  l1t::TriggerSystem parsedXMLs;
138  try {
139  // HW settings should always go first
140  xmlRdr.readDOMFromString( hw_payload );
141  xmlRdr.readRootElement ( parsedXMLs );
142 
143  // now let's parse ALGO settings
144  xmlRdr.readDOMFromString( algo_payload );
145  xmlRdr.readRootElement ( parsedXMLs );
146 
147  // remaining RS settings
148  xmlRdr.readDOMFromString( mp7_payload );
149  xmlRdr.readRootElement ( parsedXMLs );
150 
151  xmlRdr.readDOMFromString( amc13_payload );
152  xmlRdr.readRootElement ( parsedXMLs );
153  parsedXMLs.setConfigured();
154 
155  } catch ( std::runtime_error &e ) {
156  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << e.what();
157  if( transactionSafe )
158  throw std::runtime_error(std::string("SummaryForFunctionManager: BMTF | Faulty | ") + e.what());
159  else {
160  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams";
161  return std::make_shared< L1TMuonBarrelParams >( *(baseSettings.product()) ) ;
162  }
163  }
164 
165  L1TMuonBarrelParamsHelper m_params_helper( *(baseSettings.product()) );
166  try {
167  m_params_helper.configFromDB( parsedXMLs );
168  } catch ( std::runtime_error &e ) {
169  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << e.what();
170  if( transactionSafe )
171  throw std::runtime_error(std::string("SummaryForFunctionManager: BMTF | Faulty | ") + e.what());
172  else {
173  edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams";
174  return std::make_shared< L1TMuonBarrelParams >( *(baseSettings.product()) ) ;
175  }
176  }
177 
178  std::shared_ptr< L1TMuonBarrelParams > retval = std::make_shared< L1TMuonBarrelParams>( m_params_helper );
179 
180  edm::LogInfo( "L1-O2O: L1TCaloParamsOnlineProd" ) << "SummaryForFunctionManager: BMTF | OK | All looks good";
181  return retval;
182 }
void setConfigured(bool state=true) noexcept
Definition: TriggerSystem.h:73
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)
void readRootElement(TriggerSystem &aTriggerSystem, const std::string &sysId="")
bool get(HolderT &iHolder) const

Member Data Documentation

bool L1TMuonBarrelParamsOnlineProd::transactionSafe
private

Definition at line 18 of file L1TMuonBarrelParamsOnlineProd.cc.

Referenced by L1TMuonBarrelParamsOnlineProd(), and newObject().