CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RunInfoHandler.cc
Go to the documentation of this file.
5 #include<iostream>
6 #include<vector>
7 
9  m_name( pset.getUntrackedParameter<std::string>( "name", "RunInfoHandler") )
10  ,m_since( pset.getParameter<unsigned long long>( "runNumber" ) )
11  ,m_connectionString( pset.getUntrackedParameter<std::string>( "connectionString", "oracle://cms_omds_adg/CMS_RUNINFO") )
12  ,m_authpath( pset.getUntrackedParameter<std::string>( "authenticationPath", "." ) )
13  ,m_user( pset.getUntrackedParameter<std::string>( "OnlineDBUser", "CMS_RUNINFO_R" ) )
14  ,m_pass( pset.getUntrackedParameter<std::string>( "OnlineDBPass", "PASSWORD") ) {
15 }
16 
18 
20  //check whats already inside of database
21  edm::LogInfo( "RunInfoHandler" ) << "------- " << m_name
22  << " - > getNewObjects\n"
23  << "got offlineInfo " << tagInfo().name
24  << ", size " << tagInfo().size
25  << ", last object valid since " << tagInfo().lastInterval.first
26  << " token " << tagInfo().lastPayloadToken << std::endl;
27  edm::LogInfo( "RunInfoHandler" ) << "runnumber/first since = " << m_since << std::endl;
28  RunInfo* r = new RunInfo();
29 
30  //fill with null runinfo if empty run are found beetween the two last valid ones
31  size_t n_empty_run = 0;
32  if( tagInfo().size > 0 && (tagInfo().lastInterval.first + 1) < m_since ) {
33  n_empty_run = m_since - tagInfo().lastInterval.first - 1;
34  edm::LogInfo( "RunInfoHandler" ) << "------- " << "entering fake run from "
35  << tagInfo().lastInterval.first + 1
36  << "to " << m_since - 1 << "- > getNewObjects"
37  << std::endl;
38  }
39  // transfer fake run for 1 to since for the first time
40  if( tagInfo().size == 0 && m_since != 1 ) {
41  m_to_transfer.push_back( std::make_pair( (RunInfo*)(r->Fake_RunInfo()), 1 ) );
42  }
43  if ( n_empty_run != 0 ) {
44  m_to_transfer.push_back(std::make_pair( (RunInfo*)(r->Fake_RunInfo()), tagInfo().lastInterval.first + 1 ) );
45  }
46 
47  //reading from omds
49  *r = rn.readData( "RUNSESSION_PARAMETER", "STRING_VALUE",(int)m_since );
50  m_to_transfer.push_back( std::make_pair( (RunInfo*)r, m_since) );
51  std::ostringstream ss;
52  ss << "since =" << m_since;
53  m_userTextLog = ss.str() + ";";
54  edm::LogInfo( "RunInfoHandler" ) << "------- " << m_name << " - > getNewObjects" << std::endl;
55 }
std::string m_user
unsigned long long m_since
std::string m_connectionString
size_t size
Definition: Types.h:72
std::string name
Definition: Types.h:68
cond::ValidityInterval lastInterval
Definition: Types.h:70
RunInfoHandler(const edm::ParameterSet &pset)
RunInfo readData(const std::string &table, const std::string &column, const int r_number)
Definition: RunInfoRead.cc:51
std::string lastPayloadToken
Definition: Types.h:71
std::string m_name
static RunInfo * Fake_RunInfo()
Definition: RunInfo.cc:4
tuple size
Write out results.
std::string m_pass
cond::TagInfo_t const & tagInfo() const