CMS 3D CMS Logo

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