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.
4 #include<iostream>
5 #include<vector>
6 
8  m_since( pset.getParameter<unsigned long long>( "runNumber" ) )
9  ,m_name( pset.getUntrackedParameter<std::string>( "name", "RunInfoHandler" ) )
10  ,m_runinfo_schema( pset.getUntrackedParameter<std::string>( "RunInfoSchema", "CMS_RUNINFO" ) )
11  ,m_dcsenv_schema( pset.getUntrackedParameter<std::string>( "DCSEnvSchema", "CMS_DCS_ENV_PVSS_COND") )
12  ,m_connectionString( pset.getParameter<std::string>( "connect" ) )
13  ,m_connectionPset( pset.getParameter<edm::ParameterSet>( "DBParameters" ) ) {
14 }
15 
17 
19  //check whats already inside of database
20  edm::LogInfo( "RunInfoHandler" ) << "[" << "RunInfoHandler::" << __func__ << "]:" << m_name << ": "
21  << "Destination Tag Info: name " << tagInfo().name
22  << ", size " << tagInfo().size
23  << ", last object valid since " << tagInfo().lastInterval.first
24  << ", hash " << tagInfo().lastPayloadToken << std::endl;
25  edm::LogInfo( "RunInfoHandler" ) << "[" << "RunInfoHandler::" << __func__ << "]:" << m_name << ": runnumber/first since = " << m_since << std::endl;
26 
27  //check if a transfer is needed:
28  //if the new run number is smaller than or equal to the latest IOV, exit.
29  //This is needed as now the IOV Editor does not always protect for insertions:
30  //ANY and VALIDATION sychronizations are allowed to write in the past.
31  if( tagInfo().size > 0 && tagInfo().lastInterval.first >= m_since ) {
32  edm::LogWarning( "RunInfoHandler" ) << "[" << "RunInfoHandler::" << __func__ << "]:" << m_name << ": "
33  << "last IOV " << tagInfo().lastInterval.first
34  << ( tagInfo().lastInterval.first == m_since ? " is equal to" : " is larger than" )
35  << " the run proposed for insertion " << m_since
36  << ". No transfer needed." << std::endl;
37  return;
38  }
39 
40  RunInfo* r = new RunInfo();
41 
42  //fill with null runinfo if empty run are found beetween the two last valid ones
43  size_t n_empty_run = 0;
44  if( tagInfo().size > 0 && (tagInfo().lastInterval.first + 1) < m_since ) {
45  n_empty_run = m_since - tagInfo().lastInterval.first - 1;
46  edm::LogInfo( "RunInfoHandler" ) << "[" << "RunInfoHandler::" << __func__ << "]:" << m_name << ": "
47  << "entering fake run from "
48  << tagInfo().lastInterval.first + 1
49  << " to " << m_since - 1
50  << std::endl;
51  }
52  std::ostringstream ss;
53  // transfer fake run for 1 to since for the first time
54  if( tagInfo().size == 0 && m_since != 1 ) {
55  m_to_transfer.push_back( std::make_pair( (RunInfo*)(r->Fake_RunInfo()), 1 ) );
56  ss << "fake run number: " << 1 << ", ";
57  }
58  if ( n_empty_run != 0 ) {
59  m_to_transfer.push_back(std::make_pair( (RunInfo*)(r->Fake_RunInfo()), tagInfo().lastInterval.first + 1 ) );
60  ss << "fake run number: " << tagInfo().lastInterval.first + 1 << ", ";
61  }
62 
63  //reading from omds
66  m_to_transfer.push_back( std::make_pair( (RunInfo*)r, m_since) );
67  ss << "run number: " << m_since << ";";
68  m_userTextLog = ss.str();
69  edm::LogInfo( "RunInfoHandler" ) << "[" << "RunInfoHandler::" << __func__ << "]:" << m_name << ": END." << std::endl;
70 }
unsigned long long m_since
std::string m_connectionString
size_t size
Definition: Types.h:75
edm::ParameterSet m_connectionPset
RunInfo readData(const std::string &runinfo_schema, const std::string &dcsenv_schema, const int r_number)
Definition: RunInfoRead.cc:56
std::string name
Definition: Types.h:71
cond::ValidityInterval lastInterval
Definition: Types.h:73
RunInfoHandler(const edm::ParameterSet &pset)
std::string lastPayloadToken
Definition: Types.h:74
std::string m_name
static RunInfo * Fake_RunInfo()
Definition: RunInfo.cc:4
std::string m_dcsenv_schema
tuple size
Write out results.
std::string m_runinfo_schema
cond::TagInfo_t const & tagInfo() const