CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
LumiCorrectionSource Class Reference

#include <RecoLuminosity/LumiProducer/src/LumiCorrectionSource.cc>

Inheritance diagram for LumiCorrectionSource:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

typedef std::shared_ptr< const
LumiCorrectionParam
ReturnParamType
 

Public Member Functions

 LumiCorrectionSource (const edm::ParameterSet &)
 
ReturnParamType produceLumiCorrectionParam (const LumiCorrectionParamRcd &)
 
 ~LumiCorrectionSource () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector
< ESProxyIndex > > 
updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
bool concurrentFinder () const
 
const
eventsetup::ComponentDescription
descriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set
< eventsetup::EventSetupRecordKey
findingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const
EventSetupRecordIntervalFinder
operator= (const EventSetupRecordIntervalFinder &)=delete
 
void resetInterval (const eventsetup::EventSetupRecordKey &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Protected Member Functions

void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
 
- Protected Member Functions inherited from edm::ESProducer
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={})
 
void usesResources (std::vector< std::string > const &)
 
- 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 EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Private Member Functions

float fetchIntglumi (coral::ISchema &schema, unsigned int runnumber)
 
void fillparamcache (unsigned int runnumber)
 
void parseGlobaltagForLumi (coral::ISchema &schema, const std::string &globaltag)
 
void reloadAuth ()
 
XMLCh * s2x (const std::string &input) const
 
const std::string servletTranslation (const std::string &servlet) const
 
std::string toParentString (const xercesc::DOMNode &nodeToConvert) const
 
std::string translateFrontierConnect (const std::string &connectStr)
 
std::string x2s (const XMLCh *input) const
 

Private Attributes

std::string m_authfilename
 
unsigned int m_cachesize
 
std::string m_connectStr
 
std::string m_datatag
 
std::string m_globaltag
 
bool m_isNullRun
 
std::string m_normtag
 
std::map< unsigned int,
std::shared_ptr< const
LumiCorrectionParam > > 
m_paramcache
 
unsigned int m_paramcachedrun
 
std::shared_ptr< const
LumiCorrectionParam
m_paramresult
 
const edm::IOVSyncValuem_pcurrentTime
 
std::string m_siteconfpath
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy >>>
 

Detailed Description

retrieve lumi corrections and perrun parameters needed by the correction funcs

Description: A essource/esproducer for lumi correction factor and run parameters needed to deduce the corrections Author: Zhen Xie

Definition at line 25 of file LumiCorrectionSource.h.

Member Typedef Documentation

Definition at line 28 of file LumiCorrectionSource.h.

Constructor & Destructor Documentation

LumiCorrectionSource::LumiCorrectionSource ( const edm::ParameterSet iConfig)

Definition at line 170 of file LumiCorrectionSource.cc.

References EcalCondDB::authpath, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), align_cfg::globaltag, m_authfilename, m_cachesize, m_connectStr, m_datatag, m_globaltag, m_normtag, m_siteconfpath, fed_dqm_sourceclient-live_cfg::path, produceLumiCorrectionParam(), edm::ESProducer::setWhatProduced(), AlCaHLTBitMon_QueryRunRegistry::string, and translateFrontierConnect().

171  : m_connectStr(""),
172  m_authfilename(""),
173  m_datatag(""),
174  m_globaltag(""),
175  m_normtag(""),
176  m_paramcachedrun(0),
177  m_cachesize(0) {
179  findingRecord<LumiCorrectionParamRcd>();
180  std::string connectStr = iConfig.getParameter<std::string>("connect");
182  if (iConfig.exists("globaltag")) {
183  m_globaltag = iConfig.getUntrackedParameter<std::string>("globaltag", "");
184  } else {
185  m_normtag = iConfig.getUntrackedParameter<std::string>("normtag", "");
186  }
187  m_datatag = iConfig.getUntrackedParameter<std::string>("datatag", "");
188  m_cachesize = iConfig.getUntrackedParameter<unsigned int>("ncacheEntries", 3);
189  m_siteconfpath = iConfig.getUntrackedParameter<std::string>("siteconfpath", "");
190  const std::string fproto("frontier://");
191  if (connectStr.substr(0, fproto.length()) == fproto) {
193  } else if (connectStr.substr(0, 11) == "sqlite_file") {
194  m_connectStr = connectStr;
195  } else {
196  m_connectStr = connectStr;
197  std::string authpath = iConfig.getUntrackedParameter<std::string>("authpath", "");
198  std::filesystem::path boostAuthPath(authpath);
199  if (std::filesystem::is_directory(boostAuthPath)) {
200  boostAuthPath /= std::filesystem::path("authentication.xml");
201  }
202  m_authfilename = boostAuthPath.string();
203  }
204 }
std::string translateFrontierConnect(const std::string &connectStr)
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getUntrackedParameter(std::string const &, T const &) const
list globaltag
Definition: align_cfg.py:7
bool exists(std::string const &parameterName) const
checks if a parameter exists
string authpath
Definition: EcalCondDB.py:79
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ReturnParamType produceLumiCorrectionParam(const LumiCorrectionParamRcd &)
LumiCorrectionSource::~LumiCorrectionSource ( )
override

Definition at line 410 of file LumiCorrectionSource.cc.

410 {}

Member Function Documentation

float LumiCorrectionSource::fetchIntglumi ( coral::ISchema &  schema,
unsigned int  runnumber 
)
private

Definition at line 386 of file LumiCorrectionSource.cc.

References lumi::LumiNames::intglumiv2TableName(), mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fillparamcache().

386  {
387  float result = 0.;
388  coral::IQuery* qHandle = schema.newQuery();
389  qHandle->addToTableList(lumi::LumiNames::intglumiv2TableName());
390  coral::AttributeList qResult;
391  qResult.extend("INTGLUMI", typeid(float));
392  std::string conditionStr("RUNNUM=:runnumber");
393  coral::AttributeList qCondition;
394  qCondition.extend("runnumber", typeid(unsigned int));
395  qCondition["runnumber"].data<unsigned int>() = runnumber;
396  qHandle->setCondition(conditionStr, qCondition);
397  qHandle->addToOutputList("INTGLUMI");
398  qHandle->defineOutput(qResult);
399  coral::ICursor& intglumiCursor = qHandle->execute();
400  while (intglumiCursor.next()) {
401  const coral::AttributeList& row = intglumiCursor.currentRow();
402  if (!row["INTGLUMI"].isNull()) {
403  result = row["INTGLUMI"].data<float>();
404  }
405  }
406  delete qHandle;
407  return result;
408 }
static const std::string intglumiv2TableName()
Definition: LumiNames.cc:21
tuple result
Definition: mps_fire.py:311
void LumiCorrectionSource::fillparamcache ( unsigned int  runnumber)
private

Definition at line 242 of file LumiCorrectionSource.cc.

References lumi::RevisionDML::currentHFDataTagId(), lumi::RevisionDML::dataIDForRun(), Exception, fetchIntglumi(), first, LumiCorrectionParam::HF, lumi::NormDML::HF, lumi::RevisionDML::HFDataTagIdByName(), instance, lumi::RevisionDML::DataID::lumi_id, cond::lumiid, m_authfilename, m_connectStr, m_datatag, m_globaltag, m_normtag, m_paramcache, m_paramcachedrun, eostools::move(), lumi::NormDML::normById(), lumi::NormDML::normIdByName(), lumi::NormDML::normIdByType(), parseGlobaltagForLumi(), reloadAuth(), mps_fire::result, cond::runnumber, run_AlCaRecoTriggerBitsUpdateWorkflow::session, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produceLumiCorrectionParam().

242  {
243  m_paramcache.clear();
245  if (!m_authfilename.empty()) {
246  coral::IHandle<coral::IAuthenticationService> authSvc =
247  coral::Context::instance().query<coral::IAuthenticationService>();
248  if (authSvc.isValid()) {
249  try {
250  authSvc->credentials(m_connectStr);
251  } catch (const coral::UnknownConnectionException& er) {
252  reloadAuth();
253  }
254  } else {
255  reloadAuth();
256  }
257  }
258  coral::ConnectionService* mydbservice = new coral::ConnectionService;
259  if (!m_globaltag.empty()) {
260  coral::ISessionProxy* gsession = mydbservice->connect(m_connectStr, coral::ReadOnly);
261  gsession->transaction().start(true);
262  parseGlobaltagForLumi(gsession->nominalSchema(), m_globaltag);
263  gsession->transaction().commit();
264  delete gsession;
265  }
266  coral::ISessionProxy* session = mydbservice->connect(m_connectStr, coral::ReadOnly);
267  coral::ITypeConverter& tconverter = session->typeConverter();
268  tconverter.setCppTypeForSqlType(std::string("float"), std::string("FLOAT(63)"));
269  tconverter.setCppTypeForSqlType(std::string("unsigned int"), std::string("NUMBER(10)"));
270  tconverter.setCppTypeForSqlType(std::string("unsigned short"), std::string("NUMBER(1)"));
271  auto result = std::make_unique<LumiCorrectionParam>(LumiCorrectionParam::HF);
272  try {
273  session->transaction().start(true);
274  coral::ISchema& schema = session->nominalSchema();
275  lumi::RevisionDML dml;
276  unsigned long long tagid = 0;
277  if (m_datatag.empty()) {
278  tagid = dml.currentHFDataTagId(schema); //get datatag id
279  } else {
280  tagid = dml.HFDataTagIdByName(schema, m_datatag);
281  }
282  lumi::RevisionDML::DataID dataid = dml.dataIDForRun(schema, runnumber, tagid); //get data id
283  unsigned int lumiid = dataid.lumi_id;
284  if (lumiid == 0) {
285  result->setNBX(0);
286  std::shared_ptr<const LumiCorrectionParam> const_result = std::move(result);
287  m_paramcache.insert(std::make_pair(runnumber, const_result));
288  session->transaction().commit();
289  delete session;
290  delete mydbservice;
291  return;
292  }
293 
294  coral::AttributeList lumidataBindVariables;
295  lumidataBindVariables.extend("dataid", typeid(unsigned long long));
296  lumidataBindVariables["dataid"].data<unsigned long long>() = lumiid;
297  std::string conditionStr("DATA_ID=:dataid");
298  coral::AttributeList lumiparamOutput;
299  lumiparamOutput.extend("NCOLLIDINGBUNCHES", typeid(unsigned int));
300  coral::IQuery* lumiparamQuery = schema.newQuery();
301  lumiparamQuery->addToTableList(std::string("LUMIDATA"));
302  lumiparamQuery->setCondition(conditionStr, lumidataBindVariables);
303  lumiparamQuery->addToOutputList("NCOLLIDINGBUNCHES");
304  lumiparamQuery->defineOutput(lumiparamOutput);
305  coral::ICursor& lumiparamcursor = lumiparamQuery->execute();
306  unsigned int ncollidingbx = 0;
307  while (lumiparamcursor.next()) {
308  const coral::AttributeList& row = lumiparamcursor.currentRow();
309  if (!row["NCOLLIDINGBUNCHES"].isNull()) {
310  ncollidingbx = row["NCOLLIDINGBUNCHES"].data<unsigned int>();
311  }
312  result->setNBX(ncollidingbx);
313  }
314  delete lumiparamQuery;
315  lumi::NormDML normdml;
316  unsigned long long normid = 0;
317  std::map<std::string, unsigned long long> normidmap;
318  if (m_normtag.empty()) {
319  normdml.normIdByType(schema, normidmap, lumi::NormDML::HF, true);
320  m_normtag = normidmap.begin()->first;
321  normid = normidmap.begin()->second;
322  } else {
323  normid = normdml.normIdByName(schema, m_normtag);
324  }
325 
326  std::map<unsigned int, lumi::NormDML::normData> normDataMap;
327  normdml.normById(schema, normid, normDataMap);
328 
329  std::map<unsigned int, lumi::NormDML::normData>::iterator normIt = --normDataMap.end();
330  if (runnumber < normIt->first) {
331  normIt = normDataMap.upper_bound(runnumber);
332  --normIt;
333  }
334  result->setNormtag(m_normtag);
335  result->setcorrFunc(normIt->second.corrfunc);
336  result->setnonlinearCoeff(normIt->second.coefficientmap);
337  result->setafterglows(normIt->second.afterglows);
338  result->setdescription(normIt->second.amodetag, normIt->second.beamegev);
339  if (normIt->second.coefficientmap["DRIFT"] != 0.) {
340  float intglumi = fetchIntglumi(schema, runnumber);
341  result->setintglumi(intglumi);
342  }
343  m_paramcache.insert(std::make_pair(runnumber, std::shared_ptr<LumiCorrectionParam>(std::move(result))));
344  session->transaction().commit();
345  } catch (const coral::Exception& er) {
346  session->transaction().rollback();
347  delete session;
348  delete mydbservice;
349  throw cms::Exception("DatabaseError ") << er.what();
350  }
351  delete session;
352  delete mydbservice;
353 }
static PFTauRenderPlugin instance
std::map< unsigned int, std::shared_ptr< const LumiCorrectionParam > > m_paramcache
DataID dataIDForRun(coral::ISchema &schema, unsigned int runnum, unsigned long long tagid)
Definition: RevisionDML.cc:255
void parseGlobaltagForLumi(coral::ISchema &schema, const std::string &globaltag)
float fetchIntglumi(coral::ISchema &schema, unsigned int runnumber)
tuple result
Definition: mps_fire.py:311
def move
Definition: eostools.py:511
unsigned long long HFDataTagIdByName(coral::ISchema &schema, const std::string &datatagname)
Definition: RevisionDML.cc:201
void normById(const coral::ISchema &schema, unsigned long long normid, std::map< unsigned int, normData > &result)
Definition: NormDML.cc:97
unsigned long long currentHFDataTagId(coral::ISchema &schema)
Definition: RevisionDML.cc:178
void normIdByType(const coral::ISchema &schema, std::map< std::string, unsigned long long > &resultMap, LumiType=HF, bool defaultonly=true)
Definition: NormDML.cc:47
unsigned long long lumi_id
Definition: RevisionDML.h:22
unsigned long long normIdByName(const coral::ISchema &schema, const std::string &normtagname)
Definition: NormDML.cc:16
void LumiCorrectionSource::parseGlobaltagForLumi ( coral::ISchema &  schema,
const std::string &  globaltag 
)
private

select i.pfn,i.tagname from TAGINVENTORY_TABLE i,TAGTREE_TABLE_GLOBALTAG v from i.tagid=v.tagid and i.recordname='LumiCorrectionParamRcd'

Definition at line 354 of file LumiCorrectionSource.cc.

References m_connectStr, m_normtag, AlCaHLTBitMon_QueryRunRegistry::string, and translateFrontierConnect().

Referenced by fillparamcache().

354  {
356  std::string tagtreetabname("TAGTREE_TABLE_");
357  tagtreetabname += std::string(globaltag);
358  coral::IQuery* qHandle = schema.newQuery();
359  qHandle->addToTableList("TAGINVENTORY_TABLE", "i");
360  qHandle->addToTableList(tagtreetabname, "v");
361  coral::AttributeList qResult;
362  qResult.extend("pfn", typeid(std::string));
363  qResult.extend("tagname", typeid(std::string));
364  std::string conditionStr("v.tagid=i.tagid and i.recordname=:recordname");
365  coral::AttributeList qCondition;
366  qCondition.extend("recordname", typeid(std::string));
367  qCondition["recordname"].data<std::string>() = std::string("LumiCorrectionParamRcd");
368  qHandle->setCondition(conditionStr, qCondition);
369  qHandle->addToOutputList("i.pfn");
370  qHandle->addToOutputList("i.tagname");
371  qHandle->defineOutput(qResult);
372  coral::ICursor& iCursor = qHandle->execute();
373  while (iCursor.next()) {
374  const coral::AttributeList& row = iCursor.currentRow();
375  std::string connectStr = row["pfn"].data<std::string>();
376  const std::string fproto("frontier://");
377  if (connectStr.substr(0, fproto.length()) == fproto) {
379  } else {
380  m_connectStr = connectStr;
381  }
382  m_normtag = row["tagname"].data<std::string>();
383  }
384  delete qHandle;
385 }
std::string translateFrontierConnect(const std::string &connectStr)
list globaltag
Definition: align_cfg.py:7
LumiCorrectionSource::ReturnParamType LumiCorrectionSource::produceLumiCorrectionParam ( const LumiCorrectionParamRcd )

Definition at line 206 of file LumiCorrectionSource.cc.

References edm::IOVSyncValue::eventID(), fillparamcache(), m_paramcache, m_paramcachedrun, m_paramresult, m_pcurrentTime, and edm::EventID::run().

Referenced by LumiCorrectionSource().

206  {
207  unsigned int currentrun = m_pcurrentTime->eventID().run();
208  if (currentrun == 0 || currentrun == 4294967295) {
209  return std::make_shared<const LumiCorrectionParam>();
210  }
211  if (m_paramcachedrun != currentrun) { //i'm in a new run
212  fillparamcache(currentrun); //fill cache
213  } else { //i'm in an old run
214  if (m_paramcache.find(currentrun) == m_paramcache.end()) { //i'm not cached
215  fillparamcache(currentrun); //
216  }
217  }
218  if (m_paramcache.empty()) {
219  return std::make_shared<const LumiCorrectionParam>();
220  }
221  m_paramresult = m_paramcache[currentrun];
222  if (m_paramresult.get() == nullptr) {
223  return std::make_shared<const LumiCorrectionParam>();
224  }
225  return m_paramresult;
226 }
RunNumber_t run() const
Definition: EventID.h:38
const EventID & eventID() const
Definition: IOVSyncValue.h:40
std::map< unsigned int, std::shared_ptr< const LumiCorrectionParam > > m_paramcache
const edm::IOVSyncValue * m_pcurrentTime
std::shared_ptr< const LumiCorrectionParam > m_paramresult
void fillparamcache(unsigned int runnumber)
void LumiCorrectionSource::reloadAuth ( )
private

Definition at line 236 of file LumiCorrectionSource.cc.

References instance, and m_authfilename.

Referenced by fillparamcache().

236  {
237  //std::cout<<"old authfile "<<coral::Context::instance().PropertyManager().property("AuthenticationFile")->get()<<std::endl;
238  coral::Context::instance().PropertyManager().property("AuthenticationFile")->set(m_authfilename);
239  coral::Context::instance().loadComponent("CORAL/Services/XMLAuthenticationService");
240 }
static PFTauRenderPlugin instance
XMLCh * LumiCorrectionSource::s2x ( const std::string &  input) const
private

Definition at line 72 of file LumiCorrectionSource.cc.

Referenced by servletTranslation().

72  {
73  XMLCh* buff = xercesc::XMLString::transcode(temp.c_str());
74  return buff;
75 }
const std::string LumiCorrectionSource::servletTranslation ( const std::string &  servlet) const
private

Definition at line 101 of file LumiCorrectionSource.cc.

References alignCSCRings::e, m_siteconfpath, writedatasetfile::parser, s2x(), AlCaHLTBitMon_QueryRunRegistry::string, toParentString(), and cms::concurrency::xercesInitialize().

Referenced by translateFrontierConnect().

101  {
102  std::string frontierConnect;
103  std::string realconnect;
105  std::unique_ptr<xercesc::XercesDOMParser> parser(new xercesc::XercesDOMParser);
106  try {
107  parser->setValidationScheme(xercesc::XercesDOMParser::Val_Auto);
108  parser->setDoNamespaces(false);
109  parser->parse(m_siteconfpath.c_str());
110  xercesc::DOMDocument* doc = parser->getDocument();
111  if (!doc) {
112  return "";
113  }
114 
115  xercesc::DOMNodeList* frontierConnectList = doc->getElementsByTagName(s2x("frontier-connect"));
116  if (frontierConnectList->getLength() > 0) {
117  xercesc::DOMElement* frontierConnectElement = static_cast<xercesc::DOMElement*>(frontierConnectList->item(0));
118  frontierConnect = toParentString(*frontierConnectElement);
119  }
120  // Replace the last component of every "serverurl=" piece (up to the
121  // next close-paren) with the servlet
122  std::string::size_type nextparen = 0;
123  std::string::size_type serverurl, lastslash;
124  std::string complexstr = "";
125  while ((serverurl = frontierConnect.find("(serverurl=", nextparen)) != std::string::npos) {
126  realconnect.append(frontierConnect, nextparen, serverurl - nextparen);
127  nextparen = frontierConnect.find(')', serverurl);
128  lastslash = frontierConnect.rfind('/', nextparen);
129  realconnect.append(frontierConnect, serverurl, lastslash - serverurl + 1);
130  realconnect.append(servlet);
131  }
132  realconnect.append(frontierConnect, nextparen, frontierConnect.length() - nextparen);
133  } catch (xercesc::DOMException& e) {
134  }
135  return realconnect;
136 }
void xercesInitialize()
Definition: Xerces.cc:18
uint16_t size_type
std::string toParentString(const xercesc::DOMNode &nodeToConvert) const
XMLCh * s2x(const std::string &input) const
void LumiCorrectionSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey iKey,
const edm::IOVSyncValue iTime,
edm::ValidityInterval oValidity 
)
overrideprotectedvirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 228 of file LumiCorrectionSource.cc.

References m_pcurrentTime, edm::ValidityInterval::setFirst(), and edm::ValidityInterval::setLast().

230  {
231  m_pcurrentTime = &iTime;
232  oValidity.setFirst(iTime);
233  oValidity.setLast(iTime);
234 }
void setFirst(const IOVSyncValue &iTime)
const edm::IOVSyncValue * m_pcurrentTime
void setLast(const IOVSyncValue &iTime)
std::string LumiCorrectionSource::toParentString ( const xercesc::DOMNode &  nodeToConvert) const
private

Definition at line 77 of file LumiCorrectionSource.cc.

References mps_fire::i, dqmiolumiharvest::j, and x2s().

Referenced by servletTranslation().

77  {
78  std::ostringstream oss;
79  xercesc::DOMNodeList* childList = nodeToConvert.getChildNodes();
80 
81  unsigned int numNodes = childList->getLength();
82  for (unsigned int i = 0; i < numNodes; ++i) {
83  xercesc::DOMNode* childNode = childList->item(i);
84  if (childNode->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
85  continue;
86  xercesc::DOMElement* child = static_cast<xercesc::DOMElement*>(childNode);
87  xercesc::DOMNamedNodeMap* attributes = child->getAttributes();
88  unsigned int numAttributes = attributes->getLength();
89  for (unsigned int j = 0; j < numAttributes; ++j) {
90  xercesc::DOMNode* attributeNode = attributes->item(j);
91  if (attributeNode->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
92  continue;
93  xercesc::DOMAttr* attribute = static_cast<xercesc::DOMAttr*>(attributeNode);
94 
95  oss << "(" << x2s(child->getTagName()) << x2s(attribute->getName()) << "=" << x2s(attribute->getValue()) << ")";
96  }
97  }
98  return oss.str();
99 }
std::string x2s(const XMLCh *input) const
std::string LumiCorrectionSource::translateFrontierConnect ( const std::string &  connectStr)
private

Definition at line 138 of file LumiCorrectionSource.cc.

References Exception, m_siteconfpath, fed_dqm_sourceclient-live_cfg::path, mps_fire::result, servletTranslation(), AlCaHLTBitMon_QueryRunRegistry::string, createJobs::tmp, and relmon_authenticated_wget::url.

Referenced by LumiCorrectionSource(), and parseGlobaltagForLumi().

138  {
140  const std::string fproto("frontier://");
141  std::string::size_type startservlet = fproto.length();
142  std::string::size_type endservlet = connectStr.find('(', startservlet);
143  if (endservlet == std::string::npos) {
144  endservlet = connectStr.rfind('/', connectStr.length());
145  }
146  std::string servlet = connectStr.substr(startservlet, endservlet - startservlet);
147  if ((!servlet.empty()) && (servlet.find_first_of(":/)[]") == std::string::npos)) {
148  if (servlet == "cms_conditions_data")
149  servlet = "";
150  if (m_siteconfpath.length() == 0) {
151  std::string url = (std::filesystem::path("SITECONF") / std::filesystem::path("local") /
152  std::filesystem::path("JobConfig") / std::filesystem::path("site-local-config.xml"))
153  .string();
154  char* tmp = std::getenv("CMS_PATH");
155  if (tmp) {
157  }
158  } else {
159  if (!std::filesystem::exists(std::filesystem::path(m_siteconfpath))) {
160  throw cms::Exception("Non existing path ") << m_siteconfpath;
161  }
163  (std::filesystem::path(m_siteconfpath) / std::filesystem::path("site-local-config.xml")).string();
164  }
165  result = fproto + servletTranslation(servlet) + connectStr.substr(endservlet);
166  }
167  return result;
168 }
const std::string servletTranslation(const std::string &servlet) const
uint16_t size_type
tuple result
Definition: mps_fire.py:311
tmp
align.sh
Definition: createJobs.py:716
std::string LumiCorrectionSource::x2s ( const XMLCh *  input) const
private

Definition at line 67 of file LumiCorrectionSource.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

Referenced by toParentString().

67  {
68  std::string tmp(xercesc::XMLString::transcode(toTranscode));
69  return tmp;
70 }
tmp
align.sh
Definition: createJobs.py:716

Member Data Documentation

std::string LumiCorrectionSource::m_authfilename
private

Definition at line 47 of file LumiCorrectionSource.h.

Referenced by fillparamcache(), LumiCorrectionSource(), and reloadAuth().

unsigned int LumiCorrectionSource::m_cachesize
private

Definition at line 55 of file LumiCorrectionSource.h.

Referenced by LumiCorrectionSource().

std::string LumiCorrectionSource::m_connectStr
private
std::string LumiCorrectionSource::m_datatag
private

Definition at line 48 of file LumiCorrectionSource.h.

Referenced by fillparamcache(), and LumiCorrectionSource().

std::string LumiCorrectionSource::m_globaltag
private

Definition at line 49 of file LumiCorrectionSource.h.

Referenced by fillparamcache(), and LumiCorrectionSource().

bool LumiCorrectionSource::m_isNullRun
private

Definition at line 53 of file LumiCorrectionSource.h.

std::string LumiCorrectionSource::m_normtag
private
std::map<unsigned int, std::shared_ptr<const LumiCorrectionParam> > LumiCorrectionSource::m_paramcache
private

Definition at line 52 of file LumiCorrectionSource.h.

Referenced by fillparamcache(), and produceLumiCorrectionParam().

unsigned int LumiCorrectionSource::m_paramcachedrun
private

Definition at line 54 of file LumiCorrectionSource.h.

Referenced by fillparamcache(), and produceLumiCorrectionParam().

std::shared_ptr<const LumiCorrectionParam> LumiCorrectionSource::m_paramresult
private

Definition at line 56 of file LumiCorrectionSource.h.

Referenced by produceLumiCorrectionParam().

const edm::IOVSyncValue* LumiCorrectionSource::m_pcurrentTime
private

Definition at line 57 of file LumiCorrectionSource.h.

Referenced by produceLumiCorrectionParam(), and setIntervalFor().

std::string LumiCorrectionSource::m_siteconfpath
private