CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CondDBESSource.cc
Go to the documentation of this file.
1 //
2 // Package: CondCore/ESSources
3 // Module: CondDBESSource
4 //
5 // Description: <one line class summary>
6 //
7 // Implementation:
8 // <Notes on implementation>
9 //
10 // Author: Zhen Xie
11 //
12 #include "CondDBESSource.h"
13 
14 #include "boost/shared_ptr.hpp"
20 
23 
29 #include <exception>
30 //#include <cstdlib>
31 //#include <iostream>
32 
33 
35 #include <iomanip>
36 
37 namespace {
38  /* utility ot build the name of the plugin corresponding to a given record
39  se ESSources
40  */
41  std::string
42  buildName( std::string const & iRecordName ) {
43  return iRecordName + std::string( "@NewProxy" );
44  }
45 
46  std::string joinRecordAndLabel( std::string const & iRecordName, std::string const & iLabelName ) {
47  return iRecordName + std::string( "@" ) + iLabelName;
48  }
49 
50  /* utility class to return a IOVs associated to a given "name"
51  This implementation return the IOV associated to a record...
52  It is essentialy a workaround to get the full IOV out of the tag colector
53  that is not accessible as hidden in the ESSource
54  FIXME: need to support label??
55  */
56  class CondGetterFromESSource : public cond::CondGetter {
57  public:
58  CondGetterFromESSource(CondDBESSource::ProxyMap const & ip) : m_proxies(ip){}
59  virtual ~CondGetterFromESSource(){}
60 
61  cond::IOVProxy get(std::string name) const {
62  CondDBESSource::ProxyMap::const_iterator p = m_proxies.find(name);
63  if ( p != m_proxies.end())
64  return (*p).second->proxy()->iov();
65  return cond::IOVProxy();
66  }
67 
68  CondDBESSource::ProxyMap const & m_proxies;
69  };
70 
71  // dump the state of a DataProxy
72  void dumpInfo(std::ostream & out, std::string const & recName, cond::DataProxyWrapperBase const & proxy) {
73  cond::SequenceState state(proxy.proxy()->iov().state());
74  out << recName << " / " << proxy.label() << ": "
75  << proxy.connString() << ", " << proxy.tag() << "\n "
76  << state.size() << ", " << state.revision() << ", "
77  << cond::time::to_boost(state.timestamp()) << "\n "
78  << state.comment()
79  << "\n "
80  << "refresh " << proxy.proxy()->stats.nRefresh
81  << "/" << proxy.proxy()->stats.nArefresh
82  << ", reconnect " << proxy.proxy()->stats.nReconnect
83  << "/" << proxy.proxy()->stats.nAreconnect
84  << ", make " << proxy.proxy()->stats.nMake
85  << ", load " << proxy.proxy()->stats.nLoad
86  ;
87  if ( proxy.proxy()->stats.nLoad>0) {
88  out << "\n oids,sinces:";
89  cond::BasePayloadProxy::ObjIds const & ids = proxy.proxy()->stats.ids;
90  for (cond::BasePayloadProxy::ObjIds::const_iterator id=ids.begin(); id!=ids.end(); ++id)
91  out << " "
92  // << std::ios::hex
93  << (*id).oid1 <<"-"<< (*id).oid2 <<","
94  // << std::ios::dec
95  << (*id).since;
96  }
97  }
98 
99 }
100 
101 
102 /*
103  * config Param
104  * RefreshEachRun: if true will refresh the IOV at each new run (or lumiSection)
105  * DumpStat: if true dump the statistics of all DataProxy (currently on cout)
106  * DBParameters: configuration set of the connection
107  * globaltag: The GlobalTag
108  * toGet: list of record label tag connection-string to add/overwrite the content of the global-tag
109  */
111  m_connection(),
112  m_lastRun(0), // for the stat
113  m_lastLumi(0), // for the stat
114  m_policy( NOREFRESH ),
115  m_doDump( iConfig.getUntrackedParameter<bool>( "DumpStat", false ) )
116 {
117  if( iConfig.getUntrackedParameter<bool>( "RefreshAlways", false ) ) {
119  }
120  if( iConfig.getUntrackedParameter<bool>( "RefreshOpenIOVs", false ) ) {
122  }
123  if( iConfig.getUntrackedParameter<bool>( "RefreshEachRun", false ) ) {
125  }
126  if( iConfig.getUntrackedParameter<bool>( "ReconnectEachRun", false ) ) {
128  }
129 
130  Stats s = {0,0,0,0,0,0,0,0};
131  m_stats = s;
132  //std::cout<<"CondDBESSource::CondDBESSource"<<std::endl;
133  /*parameter set parsing and pool environment setting
134  */
135 
136  // default connection string
137  // inproduction used for the global tag
138  std::string userconnect= iConfig.getParameter<std::string>("connect");
139 
140 
141  // connection configuration
142  edm::ParameterSet connectionPset = iConfig.getParameter<edm::ParameterSet>( "DBParameters" );
143  m_connection.configuration().setParameters( connectionPset );
145 
146 
147  // load additional record/tag info it will overwrite the global tag
148  std::map<std::string,cond::TagMetadata> replacement;
149  if( iConfig.exists( "toGet" ) ) {
150  typedef std::vector< edm::ParameterSet > Parameters;
151  Parameters toGet = iConfig.getParameter<Parameters>( "toGet" );
152  for( Parameters::iterator itToGet = toGet.begin(); itToGet != toGet.end(); ++itToGet ) {
154  nm.recordname = itToGet->getParameter<std::string>( "record" );
155  nm.labelname = itToGet->getUntrackedParameter<std::string>( "label", "" );
156  nm.tag = itToGet->getParameter<std::string>( "tag" );
157  nm.pfn = itToGet->getUntrackedParameter<std::string>( "connect", userconnect );
158  // nm.objectname=itFound->second;
159  std::string recordLabelKey = joinRecordAndLabel( nm.recordname, nm.labelname );
160  replacement.insert( std::pair<std::string,cond::TagMetadata>( recordLabelKey, nm ) );
161  }
162  }
163 
164  // get the global tag, merge with "replacement" store in "tagCollection"
165  std::string globaltag;
166  if( iConfig.exists( "globaltag" ) )
167  globaltag = iConfig.getParameter<std::string>( "globaltag" );
168 
169  fillTagCollectionFromDB(userconnect,
170  iConfig.getUntrackedParameter<std::string>( "pfnPrefix", "" ),
171  iConfig.getUntrackedParameter<std::string>( "pfnPostfix", "" ),
172  globaltag,
173  replacement);
174 
175 
176  TagCollection::iterator it;
177  TagCollection::iterator itBeg = m_tagCollection.begin();
178  TagCollection::iterator itEnd = m_tagCollection.end();
179 
180  std::map<std::string, cond::DbSession> sessions;
181 
182  /* load DataProxy Plugin (it is strongly typed due to EventSetup ideosyncrasis)
183  * construct proxy
184  * contrary to EventSetup the "object-name" is not used as identifier: multiple entries in a record are
185  * dinstinguished only by their label...
186  * done in two step: first create ProxyWrapper loading ALL required dictionaries
187  * this will allow to initialize POOL in one go for each "database"
188  * The real initialization of the Data-Proxies is done in the second loop
189  */
190  std::vector<cond::DataProxyWrapperBase *> proxyWrappers(m_tagCollection.size());
191  size_t ipb=0;
192  for(it=itBeg;it!=itEnd;++it){
193  proxyWrappers[ipb++] =
194  cond::ProxyFactory::get()->create(buildName(it->second.recordname));
195  }
196  // now all required libraries have been loaded
197  // init sessions and DataProxies
198  ipb=0;
199  for(it=itBeg;it!=itEnd;++it){
200  std::map<std::string, cond::DbSession>::iterator p = sessions.find( it->second.pfn );
201  cond::DbSession nsess;
202  if (p==sessions.end()) {
203  //open db get tag info (i.e. the IOV token...)
204  nsess = m_connection.createSession();
205  nsess.openReadOnly( it->second.pfn, "" );
206  sessions.insert(std::make_pair(it->second.pfn,nsess));
207  } else nsess = (*p).second;
208  //cond::MetaData metadata(nsess);
209  //nsess.transaction().start(true);
210  //std::string iovtoken = metadata.getToken(it->tag);
211  // owenship...
212  ProxyP proxy(proxyWrappers[ipb++]);
213  // instert in the map
214  m_proxies.insert(std::make_pair(it->second.recordname, proxy));
215  // initialize
216  //proxy->lateInit(nsess,iovtoken,
217  // it->labelname, it->pfn, it->tag
218  // );
219  proxy->lateInit(nsess,it->second.tag,
220  it->second.labelname, it->second.pfn);
221  //nsess.transaction().commit();
222  }
223 
224  // one loaded expose all other tags to the Proxy!
225  CondGetterFromESSource visitor( m_proxies );
226  ProxyMap::iterator b = m_proxies.begin();
227  ProxyMap::iterator e = m_proxies.end();
228  for ( ;b != e; b++ ) {
229 
230  (*b).second->proxy()->loadMore( visitor );
231 
234  if( recordKey.type() != edm::eventsetup::EventSetupRecordKey::TypeTag() ) {
235  findingRecordWithKey( recordKey );
236  usingRecordWithKey( recordKey );
237  }
238  }
239 
240  m_stats.nData=m_proxies.size();
241 
242 }
243 
244 
246  //dump info FIXME: find a more suitable place...
247  if (m_doDump) {
248  std::cout << "CondDBESSource Statistics" << std::endl
249  << "DataProxy " << m_stats.nData
250  << " setInterval " << m_stats.nSet
251  << " Runs " << m_stats.nRun
252  << " Lumis " << m_stats.nLumi
253  << " Refresh " << m_stats.nRefresh
254  << " Actual Refresh " << m_stats.nActualRefresh
255  << " Reconnect " << m_stats.nReconnect
256  << " Actual Reconnect " << m_stats.nActualReconnect;
257  std::cout << std::endl;
258  std::cout << "Global Proxy Statistics" << std::endl
259  << "proxy " << cond::BasePayloadProxy::gstats.nProxy
260  << " make " << cond::BasePayloadProxy::gstats.nMake
261  << " load " << cond::BasePayloadProxy::gstats.nLoad;
262  std::cout << std::endl;
263 
264 
265  ProxyMap::iterator b= m_proxies.begin();
266  ProxyMap::iterator e= m_proxies.end();
267  for ( ;b != e; b++ ) {
268  dumpInfo( std::cout, (*b).first, *(*b).second );
269  std::cout << "\n" << std::endl;
270  }
271 
272  // FIXME
273  // We shall eventually close transaction and session...
274  }
275 }
276 
277 
278 //
279 // invoked by EventSetUp: for a given record return the smallest IOV for which iTime is valid
280 // limit to next run/lumisection of Refresh is required
281 //
282 void
284 
285  std::string recordname=iKey.name();
286 
287  edm::LogInfo( "CondDBESSource" ) << "Getting data for record \""<< recordname
288  << "\" to be consumed by "<< iTime.eventID() << ", timestamp: " << iTime.time().value()
289  << "; from CondDBESSource::setIntervalFor";
290 
291  m_stats.nSet++;
292  //{
293  // not really required, keep here for the time being
294  if(iTime.eventID().run()!=m_lastRun) {
295  m_lastRun=iTime.eventID().run();
296  m_stats.nRun++;
297  }
298  if(iTime.luminosityBlockNumber()!=m_lastLumi) {
300  m_stats.nLumi++;
301  }
302  //}
303 
304  bool doRefresh = false;
306  // find out the last run number for the proxy of the specified record
307  std::map<std::string,unsigned int>::iterator iRec = m_lastRecordRuns.find( recordname );
308  if( iRec != m_lastRecordRuns.end() ){
309  unsigned int lastRecordRun = iRec->second;
310  if( lastRecordRun != m_lastRun ){
311  // a refresh is required!
312  doRefresh = true;
313  iRec->second = m_lastRun;
314  edm::LogInfo( "CondDBESSource" ) << "Preparing refresh for record \"" << recordname
315  << "\" since there has been a transition from run "
316  << lastRecordRun << " to run " << m_lastRun
317  << "; from CondDBESSource::setIntervalFor";
318  }
319  } else {
320  doRefresh = true;
321  m_lastRecordRuns.insert( std::make_pair( recordname, m_lastRun ) );
322  edm::LogInfo( "CondDBESSource" ) << "Preparing refresh for record \"" << recordname
323  << "\" for " << iTime.eventID() << ", timestamp: " << iTime.time().value()
324  << "; from CondDBESSource::setIntervalFor";
325  }
326  if ( !doRefresh )
327  edm::LogInfo( "CondDBESSource" ) << "Though enabled, refresh not needed for record \"" << recordname
328  << "\" for " << iTime.eventID() << ", timestamp: " << iTime.time().value()
329  << "; from CondDBESSource::setIntervalFor";
330  } else if( m_policy == REFRESH_ALWAYS || m_policy == REFRESH_OPEN_IOVS ) {
331  doRefresh = true;
332  edm::LogInfo( "CondDBESSource" ) << "Forcing refresh for record \"" << recordname
333  << "\" for " << iTime.eventID() << ", timestamp: " << iTime.time().value()
334  << "; from CondDBESSource::setIntervalFor";
335  }
336 
338 
339  // compute the smallest interval (assume all objects have the same timetype....)
340  cond::ValidityInterval recordValidity(1,cond::TIMELIMIT);
342  bool userTime=true;
343 
344  //FIXME use equal_range
345  ProxyMap::const_iterator pmBegin = m_proxies.lower_bound(recordname);
346  ProxyMap::const_iterator pmEnd = m_proxies.upper_bound(recordname);
347  if ( pmBegin == pmEnd ) {
348  edm::LogInfo( "CondDBESSource" ) << "No DataProxy (Pluging) found for record \""<< recordname
349  << "\"; from CondDBESSource::setIntervalFor";
350  return;
351  }
352 
353  for ( ProxyMap::const_iterator pmIter = pmBegin; pmIter != pmEnd; ++pmIter ) {
354 
355  edm::LogInfo( "CondDBESSource" ) << "Processing record \"" << recordname
356  << "\" and label \""<< pmIter->second->label()
357  << "\" for " << iTime.eventID() << ", timestamp: " << iTime.time().value()
358  << "; from CondDBESSource::setIntervalFor";
359 
360  timetype = (*pmIter).second->proxy()->timetype();
361 
362  cond::Time_t abtime = cond::fromIOVSyncValue( iTime, timetype );
363  userTime = ( 0 == abtime );
364 
365  //std::cout<<"abtime "<<abtime<<std::endl;
366 
367  if (userTime) return; // oInterval invalid to avoid that make is called...
368 
369 
370 
371  if( doRefresh ) {
372 
373  std::string recKey = joinRecordAndLabel( recordname, pmIter->second->label() );
374  TagCollection::const_iterator tcIter = m_tagCollection.find( recKey );
375  if ( tcIter == m_tagCollection.end() ) {
376  edm::LogInfo( "CondDBESSource" ) << "No Tag found for record \""<< recordname
377  << "\" and label \""<< pmIter->second->label()
378  << "\"; from CondDBESSource::setIntervalFor";
379  return;
380  }
381 
382  // first reconnect if required
383  if( m_policy == RECONNECT_EACH_RUN ) {
384  edm::LogInfo( "CondDBESSource" ) << "Checking if the session must be closed and re-opened for getting correct conditions"
385  << "; from CondDBESSource::setIntervalFor";
386  std::stringstream transId;
387  //transId << "long" << m_lastRun;
388  transId << m_lastRun;
389  std::map<std::string,std::pair<cond::DbSession,std::string> >::iterator iSess = m_sessionPool.find( tcIter->second.pfn );
390  cond::DbSession theSession;
391  bool reopen = false;
392  if( iSess != m_sessionPool.end() ){
393  if( iSess->second.second != transId.str() ) {
394  // the available session is open for a different run: reopen
395  reopen = true;
396  iSess->second.second = transId.str();
397  }
398  theSession = iSess->second.first;
399  } else {
400  // no available session: probably first run analysed...
401  theSession = m_connection.createSession();
402  m_sessionPool.insert(std::make_pair( tcIter->second.pfn,std::make_pair(theSession,transId.str()) ));
403  reopen = true;
404  }
405  if( reopen ){
406  theSession.openReadOnly( tcIter->second.pfn, transId.str() );
407  edm::LogInfo( "CondDBESSource" ) << "Re-opening the session with connection string " << tcIter->second.pfn
408  << " and new transaction Id " << transId.str()
409  << "; from CondDBESSource::setIntervalFor";
410  }
411 
412  edm::LogInfo( "CondDBESSource" ) << "Reconnecting to \"" << tcIter->second.pfn
413  << "\" for getting new payload for record \"" << recordname
414  << "\" and label \""<< pmIter->second->label()
415  << "\" from IOV tag \"" << tcIter->second.tag
416  << "\" to be consumed by " << iTime.eventID() << ", timestamp: " << iTime.time().value()
417  << "; from CondDBESSource::setIntervalFor";
418  bool isSizeIncreased = pmIter->second->proxy()->refresh( theSession );
419  if( isSizeIncreased )
420  edm::LogInfo( "CondDBESSource" ) << "After reconnecting, an increased size of the IOV sequence labeled by tag \"" << tcIter->second.tag
421  << "\" was found; from CondDBESSource::setIntervalFor";
422  m_stats.nActualReconnect += isSizeIncreased;
424  } else {
425  edm::LogInfo( "CondDBESSource" ) << "Refreshing IOV sequence labeled by tag \"" << tcIter->second.tag
426  << "\" for getting new payload for record \"" << recordname
427  << "\" and label \""<< pmIter->second->label()
428  << "\" to be consumed by " << iTime.eventID() << ", timestamp: " << iTime.time().value()
429  << "; from CondDBESSource::setIntervalFor";
430  bool isSizeIncreased = pmIter->second->proxy()->refresh();
431  if( isSizeIncreased )
432  edm::LogInfo( "CondDBESSource" ) << "After refreshing, an increased size of the IOV sequence labeled by tag \"" << tcIter->second.tag
433  << "\" was found; from CondDBESSource::setIntervalFor";
434  m_stats.nActualRefresh += isSizeIncreased;
435  m_stats.nRefresh++;
436  }
437 
438  }
439 
440  /*
441  // make oInterval valid For Ever
442  {
443  oInterval = edm::ValidityInterval(cond::toIOVSyncValue(recordValidity.first, cond::runnumber, true),
444  cond::toIOVSyncValue(recordValidity.second, cond::runnumber, false));
445  return;
446  }
447  */
448 
449  //query the IOVSequence
450  cond::ValidityInterval validity = (*pmIter).second->proxy()->setIntervalFor( abtime );
451 
452  edm::LogInfo( "CondDBESSource" ) << "Validity coming from IOV sequence for record \"" << recordname
453  << "\" and label \""<< pmIter->second->label()
454  << "\": (" << validity.first << ", " << validity.second
455  << ") for time (type: "<< cond::timeTypeNames( timetype ) << ") " << abtime
456  << "; from CondDBESSource::setIntervalFor";
457 
458  recordValidity.first = std::max(recordValidity.first,validity.first);
459  recordValidity.second = std::min(recordValidity.second,validity.second);
460  }
461 
462  if( m_policy == REFRESH_OPEN_IOVS ) {
463  doRefresh = ( recordValidity.second == cond::timeTypeSpecs[timetype].endValue );
464  edm::LogInfo( "CondDBESSource" ) << "Validity for record \"" << recordname
465  << "\" and the corresponding label(s) coming from Condition DB: (" << recordValidity.first
466  << ", "<< recordValidity.first
467  << ") as the last IOV element in the IOV sequence is infinity"
468  << "; from CondDBESSource::setIntervalFor";
469  }
470 
471  // to force refresh we set end-value to the minimum such an IOV can extend to: current run or lumiblock
472 
473  if ( (!userTime) && recordValidity.second !=0 ) {
474  edm::IOVSyncValue start = cond::toIOVSyncValue(recordValidity.first, timetype, true);
475  edm::IOVSyncValue stop = doRefresh ? cond::limitedIOVSyncValue (iTime, timetype)
476  : cond::toIOVSyncValue(recordValidity.second, timetype, false);
477 
478  oInterval = edm::ValidityInterval( start, stop );
479  }
480 
481  edm::LogInfo( "CondDBESSource" ) << "Setting validity for record \"" << recordname
482  << "\" and corresponding label(s): starting at " << oInterval.first().eventID() << ", timestamp: " << oInterval.first().time().value()
483  << ", ending at "<< oInterval.last().eventID() << ", timestamp: " << oInterval.last().time().value()
484  << ", for "<< iTime.eventID() << ", timestamp: " << iTime.time().value()
485  << "; from CondDBESSource::setIntervalFor";
486 }
487 
488 
489 //required by EventSetup System
490 void
492  std::string recordname=iRecordKey.name();
493 
494  ProxyMap::const_iterator b = m_proxies.lower_bound(recordname);
495  ProxyMap::const_iterator e = m_proxies.upper_bound(recordname);
496  if ( b == e) {
497  edm::LogInfo( "CondDBESSource" ) << "No DataProxy (Pluging) found for record \""<< recordname
498  << "\"; from CondDBESSource::registerProxies";
499  return;
500  }
501 
502  for (ProxyMap::const_iterator p=b;p!=e;++p) {
503  if(0 != (*p).second.get()) {
504  edm::eventsetup::TypeTag type = (*p).second->type();
505  edm::eventsetup::DataKey key( type, edm::eventsetup::IdTags((*p).second->label().c_str()) );
506  aProxyList.push_back(KeyedProxies::value_type(key,(*p).second->edmProxy()));
507  }
508  }
509 }
510 
511 // required by the EventSetup System
512 void
514  const edm::ValidityInterval&)
515 {
516  //LogDebug ("CondDBESSource")<<"newInterval";
517  invalidateProxies(iRecordType);
518 }
519 
520 
521 // fills tagcollection merging with replacement
522 void
523 CondDBESSource::fillTagCollectionFromDB( const std::string & coraldb,
524  const std::string & prefix,
525  const std::string & postfix,
526  const std::string & roottag,
527  std::map<std::string,cond::TagMetadata>& replacement ) {
528 
529  std::set< cond::TagMetadata > tagcoll;
530 
531  if ( !roottag.empty() ) {
532  if ( coraldb.empty() )
533  throw cond::Exception( std::string( "ESSource: requested global tag ") + roottag + std::string( " but not connection string given" ) );
535  session.open( coraldb, cond::Auth::COND_READER_ROLE, true );
536  session.transaction().start( true );
537  cond::TagCollectionRetriever tagRetriever( session, prefix, postfix );
538  tagRetriever.getTagCollection( roottag,tagcoll );
539  session.transaction().commit();
540  }
541 
542  std::set<cond::TagMetadata>::iterator tagCollIter;
543  std::set<cond::TagMetadata>::iterator tagCollBegin = tagcoll.begin();
544  std::set<cond::TagMetadata>::iterator tagCollEnd = tagcoll.end();
545 
546  // FIXME the logic is a bit perverse: can be surely linearized (at least simplified!) ....
547  for( tagCollIter = tagCollBegin; tagCollIter != tagCollEnd; ++tagCollIter ) {
548  std::string recordLabelKey = joinRecordAndLabel( tagCollIter->recordname, tagCollIter->labelname );
549  std::map<std::string,cond::TagMetadata>::iterator fid = replacement.find( recordLabelKey );
550  if( fid != replacement.end() ) {
551  cond::TagMetadata tagMetadata;
552  tagMetadata.recordname = tagCollIter->recordname;
553  tagMetadata.labelname = tagCollIter->labelname;
554  tagMetadata.pfn = fid->second.pfn;
555  tagMetadata.tag = fid->second.tag;
556  tagMetadata.objectname = tagCollIter->objectname;
557  m_tagCollection.insert( std::make_pair( recordLabelKey, tagMetadata ) );
558  replacement.erase( fid );
559  edm::LogInfo( "CondDBESSource" ) << "Replacing connection string \"" << tagCollIter->pfn
560  << "\" and tag \"" << tagCollIter->tag
561  << "\" for record \"" << tagMetadata.recordname
562  << "\" and label \"" << tagMetadata.labelname
563  << "\" with connection string \"" << tagMetadata.pfn
564  << "\" and tag " << tagMetadata.tag
565  << "\"; from CondDBESSource::fillTagCollectionFromDB";
566  } else {
567  m_tagCollection.insert( std::make_pair( recordLabelKey, *tagCollIter) );
568  }
569  }
570  std::map<std::string,cond::TagMetadata>::iterator replacementIter;
571  std::map<std::string,cond::TagMetadata>::iterator replacementBegin = replacement.begin();
572  std::map<std::string,cond::TagMetadata>::iterator replacementEnd = replacement.end();
573  for( replacementIter = replacementBegin; replacementIter != replacementEnd; ++replacementIter ){
574  //std::cout<<"appending"<<std::endl;
575  //std::cout<<"pfn "<<replacementIter->second.pfn<<std::endl;
576  //std::cout<<"objectname "<<replacementIter->second.objectname<<std::endl;
577  //std::cout<<"tag "<<replacementIter->second.tag<<std::endl;
578  //std::cout<<"recordname "<<replacementIter->second.recordname<<std::endl;
579  m_tagCollection.insert( *replacementIter );
580  }
581 }
582 
583 
584 // backward compatibility for configuration files
586 public:
587  explicit PoolDBESSource( const edm::ParameterSet& ps) :
588  CondDBESSource(ps){}
589 };
590 
592 //define this as a plug-in
594 
RunNumber_t run() const
Definition: EventID.h:42
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
type
Definition: HCALResponse.h:22
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::IOVSyncValue limitedIOVSyncValue(cond::Time_t time, cond::TimeType timetype)
list globaltag
Definition: align_cfg.py:7
const EventID & eventID() const
Definition: IOVSyncValue.h:42
DbTransaction & transaction()
Definition: DbSession.cc:189
void open(const std::string &connectionString, bool readOnly=false)
Definition: DbSession.cc:144
std::map< std::string, std::pair< cond::DbSession, std::string > > m_sessionPool
virtual void registerProxies(const edm::eventsetup::EventSetupRecordKey &iRecordKey, KeyedProxies &aProxyList)
void getTagCollection(const std::string &globaltag, std::set< cond::TagMetadata > &result)
int commit()
commit transaction.
void openReadOnly(const std::string &connectionString, const std::string &id)
Definition: DbSession.cc:155
DbConnectionConfiguration & configuration()
Definition: DbConnection.cc:89
std::string objectname
Definition: TagMetadata.h:12
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
#define min(a, b)
Definition: mlp_lapack.h:161
void usingRecordWithKey(const EventSetupRecordKey &)
virtual ProxyP proxy() const =0
cond::DbConnection m_connection
RefreshPolicy m_policy
void setParameters(const edm::ParameterSet &connectionPset)
TimeType
Definition: Time.h:21
void fillTagCollectionFromDB(const std::string &coraldb, const std::string &prefix, const std::string &postfix, const std::string &roottag, std::map< std::string, cond::TagMetadata > &replacement)
const IOVSyncValue & last() const
std::string labelname
Definition: TagMetadata.h:11
std::string const & timeTypeNames(int)
Definition: Time.cc:15
int start(bool readOnly=false)
start transaction
std::string const & label() const
Definition: DataProxy.h:81
edm::IOVSyncValue toIOVSyncValue(cond::Time_t time, cond::TimeType timetype, bool startOrStop)
unsigned long long Time_t
Definition: Time.h:16
std::string tag
Definition: TagMetadata.h:8
void invalidateProxies(const EventSetupRecordKey &iRecordKey)
vector< ParameterSet > Parameters
const T & max(const T &a, const T &b)
std::map< std::string, unsigned int > m_lastRecordRuns
std::vector< std::pair< DataKey, boost::shared_ptr< DataProxy > > > KeyedProxies
LuminosityBlockNumber_t luminosityBlockNumber() const
Definition: IOVSyncValue.h:43
virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
Container::value_type value_type
static const std::string COND_READER_ROLE
Definition: Auth.h:19
tuple out
Definition: dbtoconf.py:99
std::vector< ObjId > ObjIds
Definition: PayloadProxy.h:31
std::multimap< std::string, ProxyP > ProxyMap
std::string const & connString() const
Definition: DataProxy.h:83
TimeValue_t value() const
Definition: Timestamp.cc:72
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:82
PoolDBESSource(const edm::ParameterSet &ps)
TagCollection m_tagCollection
DbSession createSession() const
Definition: DbConnection.cc:72
const Time_t TIMELIMIT(std::numeric_limits< Time_t >::max())
double b
Definition: hdecay.h:120
std::string const & tag() const
Definition: DataProxy.h:84
std::string pfn
Definition: TagMetadata.h:9
char state
Definition: procUtils.cc:75
heterocontainer::HCTypeTag TypeTag
ProxyMap m_proxies
unsigned int m_lastRun
list key
Definition: combine.py:13
static const ValidityInterval & invalidInterval()
const Timestamp & time() const
Definition: IOVSyncValue.h:44
tuple cout
Definition: gather_cfg.py:121
virtual void newInterval(const edm::eventsetup::EventSetupRecordKey &iRecordType, const edm::ValidityInterval &iInterval)
called when a new interval of validity occurs for iRecordType
cond::Time_t fromIOVSyncValue(edm::IOVSyncValue const &time, cond::TimeType timetype)
const IOVSyncValue & first() const
Time_t endValue
Definition: Time.h:46
CondDBESSource(const edm::ParameterSet &)
std::string recordname
Definition: TagMetadata.h:10
list fid
Definition: NewTree.py:51
unsigned int m_lastLumi
boost::shared_ptr< cond::DataProxyWrapperBase > ProxyP
boost::posix_time::ptime to_boost(Time_t iValue)
T get(const Candidate &c)
Definition: component.h:56
void findingRecordWithKey(const eventsetup::EventSetupRecordKey &)
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:129