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

Member Data Documentation

bool L1TMuonBarrelParamsOnlineProd::transactionSafe
private

Definition at line 18 of file L1TMuonBarrelParamsOnlineProd.cc.

Referenced by L1TMuonBarrelParamsOnlineProd(), and newObject().