CMS 3D CMS Logo

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 LumiCorrectionParamReturnParamType
 
- 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
 

Public Member Functions

 LumiCorrectionSource (const edm::ParameterSet &)
 
ReturnParamType produceLumiCorrectionParam (const LumiCorrectionParamRcd &)
 
 ~LumiCorrectionSource () 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)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
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
 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 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 LumiCorrectionParamm_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 &)
 

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 173 of file LumiCorrectionSource.cc.

References dataDML::authpath, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), download_sqlite_cfg::globaltag, m_authfilename, m_cachesize, m_connectStr, m_datatag, m_globaltag, m_normtag, m_siteconfpath, callgraph::path, produceLumiCorrectionParam(), edm::ESProducer::setWhatProduced(), AlCaHLTBitMon_QueryRunRegistry::string, and translateFrontierConnect().

175  findingRecord<LumiCorrectionParamRcd>();
176  std::string connectStr=iConfig.getParameter<std::string>("connect");
178  if(iConfig.exists("globaltag")){
179  m_globaltag=iConfig.getUntrackedParameter<std::string>("globaltag","");
180  }else{
181  m_normtag=iConfig.getUntrackedParameter<std::string>("normtag","");
182  }
183  m_datatag=iConfig.getUntrackedParameter<std::string>("datatag","");
184  m_cachesize=iConfig.getUntrackedParameter<unsigned int>("ncacheEntries",3);
185  m_siteconfpath=iConfig.getUntrackedParameter<std::string>("siteconfpath","");
186  const std::string fproto("frontier://");
187  if(connectStr.substr(0,fproto.length())==fproto){
189  }else if(connectStr.substr(0,11)=="sqlite_file"){
190  m_connectStr=connectStr;
191  }else{
192  m_connectStr=connectStr;
193  std::string authpath=iConfig.getUntrackedParameter<std::string>("authpath","");
194  boost::filesystem::path boostAuthPath( authpath );
195  if(boost::filesystem::is_directory(boostAuthPath)){
196  boostAuthPath /= boost::filesystem::path("authentication.xml");
197  }
198  m_authfilename = boostAuthPath.string();
199  }
200 }
std::string translateFrontierConnect(const std::string &connectStr)
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
T getUntrackedParameter(std::string const &, T const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
ReturnParamType produceLumiCorrectionParam(const LumiCorrectionParamRcd &)
LumiCorrectionSource::~LumiCorrectionSource ( )
override

Definition at line 413 of file LumiCorrectionSource.cc.

References DEFINE_FWK_EVENTSETUP_SOURCE.

413 {}

Member Function Documentation

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

Definition at line 389 of file LumiCorrectionSource.cc.

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

Referenced by fillparamcache().

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

Definition at line 244 of file LumiCorrectionSource.cc.

References lumi::RevisionDML::currentHFDataTagId(), lumi::RevisionDML::dataIDForRun(), Exception, fetchIntglumi(), plotBeamSpotDB::first, LumiCorrectionParam::HF, lumi::NormDML::HF, lumi::RevisionDML::HFDataTagIdByName(), instance, normFunctors::intglumi, 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(), lumiCalc2::normid, lumi::NormDML::normIdByName(), lumi::NormDML::normIdByType(), parseGlobaltagForLumi(), reloadAuth(), mps_fire::result, cond::runnumber, dataDML::schema, dataDML::session, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produceLumiCorrectionParam().

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

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

Referenced by fillparamcache().

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

Definition at line 203 of file LumiCorrectionSource.cc.

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

Referenced by LumiCorrectionSource().

204 {
205  unsigned int currentrun=m_pcurrentTime->eventID().run();
206  if(currentrun==0||currentrun==4294967295){
207  return std::make_shared<const LumiCorrectionParam>();
208  }
209  if(m_paramcachedrun!=currentrun){//i'm in a new run
210  fillparamcache(currentrun);//fill cache
211  }else{ //i'm in an old run
212  if(m_paramcache.find(currentrun)==m_paramcache.end()){//i'm not cached
213  fillparamcache(currentrun);//
214  }
215  }
216  if(m_paramcache.empty()){
217  return std::make_shared<const LumiCorrectionParam>();
218  }
219  m_paramresult=m_paramcache[currentrun];
220  if(m_paramresult.get()==nullptr){
221  return std::make_shared<const LumiCorrectionParam>();
222  }
223  return m_paramresult;
224 }
RunNumber_t run() const
Definition: EventID.h:39
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 237 of file LumiCorrectionSource.cc.

References instance, and m_authfilename.

Referenced by fillparamcache().

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

Definition at line 74 of file LumiCorrectionSource.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by servletTranslation().

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

Definition at line 107 of file LumiCorrectionSource.cc.

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

Referenced by translateFrontierConnect().

107  {
108  std::string frontierConnect;
109  std::string realconnect;
111  std::unique_ptr< xercesc::XercesDOMParser > parser(new xercesc::XercesDOMParser);
112  try{
113  parser->setValidationScheme(xercesc::XercesDOMParser::Val_Auto);
114  parser->setDoNamespaces(false);
115  parser->parse(m_siteconfpath.c_str());
116  xercesc::DOMDocument* doc=parser->getDocument();
117  if(!doc){
118  return "";
119  }
120 
121  xercesc::DOMNodeList *frontierConnectList=doc->getElementsByTagName(s2x("frontier-connect"));
122  if (frontierConnectList->getLength()>0){
123  xercesc::DOMElement *frontierConnectElement=static_cast < xercesc::DOMElement *> (frontierConnectList->item (0));
124  frontierConnect = toParentString(*frontierConnectElement);
125  }
126  // Replace the last component of every "serverurl=" piece (up to the
127  // next close-paren) with the servlet
128  std::string::size_type nextparen = 0;
129  std::string::size_type serverurl, lastslash;
130  std::string complexstr = "";
131  while ((serverurl=frontierConnect.find("(serverurl=", nextparen)) != std::string::npos){
132  realconnect.append(frontierConnect, nextparen, serverurl - nextparen);
133  nextparen=frontierConnect.find(')', serverurl);
134  lastslash=frontierConnect.rfind('/', nextparen);
135  realconnect.append(frontierConnect,serverurl,lastslash-serverurl+1);
136  realconnect.append(servlet);
137  }
138  realconnect.append(frontierConnect, nextparen,frontierConnect.length()-nextparen);
139  }catch(xercesc::DOMException &e){
140  }
141  return realconnect;
142 }
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 227 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 80 of file LumiCorrectionSource.cc.

References mps_fire::i, AlCaHLTBitMon_QueryRunRegistry::string, and x2s().

Referenced by servletTranslation().

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

Definition at line 145 of file LumiCorrectionSource.cc.

References Exception, m_siteconfpath, callgraph::path, mps_fire::result, servletTranslation(), AlCaHLTBitMon_QueryRunRegistry::string, tmp, and relmon_authenticated_wget::url.

Referenced by LumiCorrectionSource(), and parseGlobaltagForLumi().

145  {
147  const std::string fproto("frontier://");
148  std::string::size_type startservlet=fproto.length();
149  std::string::size_type endservlet=connectStr.find("(",startservlet);
150  if(endservlet==std::string::npos){
151  endservlet=connectStr.rfind('/',connectStr.length());
152  }
153  std::string servlet=connectStr.substr(startservlet,endservlet-startservlet);
154  if( (!servlet.empty())&& (servlet.find_first_of(":/)[]")==std::string::npos)){
155  if(servlet=="cms_conditions_data") servlet="";
156  if(m_siteconfpath.length()==0){
157  std::string url=(boost::filesystem::path("SITECONF")/boost::filesystem::path("local")/boost::filesystem::path("JobConfig")/boost::filesystem::path("site-local-config.xml")).string();
158  char * tmp = getenv ("CMS_PATH");
159  if(tmp){
161  }
162  }else{
163  if(!boost::filesystem::exists(boost::filesystem::path(m_siteconfpath))){
164  throw cms::Exception("Non existing path ")<<m_siteconfpath;
165  }
166  m_siteconfpath = (boost::filesystem::path(m_siteconfpath)/boost::filesystem::path("site-local-config.xml")).string();
167  }
168  result=fproto+servletTranslation(servlet)+connectStr.substr(endservlet);
169  }
170  return result;
171 }
const std::string servletTranslation(const std::string &servlet) const
uint16_t size_type
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::string LumiCorrectionSource::x2s ( const XMLCh *  input) const
private

Definition at line 68 of file LumiCorrectionSource.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and tmp.

Referenced by toParentString().

68  {
69  std::string tmp(xercesc::XMLString::transcode(toTranscode));
70  return tmp;
71 }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100

Member Data Documentation

std::string LumiCorrectionSource::m_authfilename
private

Definition at line 44 of file LumiCorrectionSource.h.

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

unsigned int LumiCorrectionSource::m_cachesize
private

Definition at line 52 of file LumiCorrectionSource.h.

Referenced by LumiCorrectionSource().

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

Definition at line 45 of file LumiCorrectionSource.h.

Referenced by fillparamcache(), and LumiCorrectionSource().

std::string LumiCorrectionSource::m_globaltag
private

Definition at line 46 of file LumiCorrectionSource.h.

Referenced by fillparamcache(), and LumiCorrectionSource().

bool LumiCorrectionSource::m_isNullRun
private

Definition at line 50 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 49 of file LumiCorrectionSource.h.

Referenced by fillparamcache(), and produceLumiCorrectionParam().

unsigned int LumiCorrectionSource::m_paramcachedrun
private

Definition at line 51 of file LumiCorrectionSource.h.

Referenced by fillparamcache(), and produceLumiCorrectionParam().

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

Definition at line 53 of file LumiCorrectionSource.h.

Referenced by produceLumiCorrectionParam().

const edm::IOVSyncValue* LumiCorrectionSource::m_pcurrentTime
private

Definition at line 54 of file LumiCorrectionSource.h.

Referenced by produceLumiCorrectionParam(), and setIntervalFor().

std::string LumiCorrectionSource::m_siteconfpath
private