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_user(pset.getUntrackedParameter<std::string>("OnlineDBUser","CMS_RUNINFO_R"))
11  ,m_pass(pset.getUntrackedParameter<std::string>("OnlineDBPass","PASSWORD")) {
12  m_connectionString= "oracle://cms_omds_lb/CMS_RUNINFO";
13 }
14 
16 
18  //check whats already inside of database
19  edm::LogInfo ("RunInfoHandler") << "------- " << m_name
20  << " - > getNewObjects\n"
21  << "got offlineInfo " << tagInfo().name
22  << ", size " << tagInfo().size
23  << ", last object valid since "
24  << tagInfo().lastInterval.first
25  << " token " << tagInfo().lastPayloadToken
26  << std::endl;
27  unsigned int snc;
28  std::cerr << "Source implementation test ::getNewObjects : enter runnumber as a first since !\n";
29  std::cin >> snc;
30  std::cout <<"runnumber/first since = " << snc << std::endl;
31  RunInfo* r = new RunInfo();
32 
33  //fill with null runinfo if empty run are found beetween the two last valid ones
34  size_t n_empty_run = 0;
35  if(tagInfo().size > 0 && (tagInfo().lastInterval.first+1) < snc) {
36  n_empty_run = snc - tagInfo().lastInterval.first - 1;
37  edm::LogInfo ("RunInfoHandler") << "------- " << "entering fake run from "
38  << tagInfo().lastInterval.first + 1
39  << "to " << snc - 1 << "- > getNewObjects"
40  << std::endl;
41  n_empty_run = snc - tagInfo().lastInterval.first - 1;
42  }
43  // transfer fake run for 1 to since for the first time
44  if (tagInfo().size == 0 && snc != 1) {
45  m_to_transfer.push_back(std::make_pair((RunInfo*) (r->Fake_RunInfo()),1));
46  }
47  if (n_empty_run != 0) {
48  m_to_transfer.push_back(std::make_pair((RunInfo*) (r->Fake_RunInfo()),tagInfo().lastInterval.first + 1));
49  }
50 
51  //reading from omds
53  *r = rn.readData("RUNSESSION_PARAMETER", "STRING_VALUE",(int)snc);
54  m_to_transfer.push_back(std::make_pair((RunInfo*)r,snc));
55  std::ostringstream ss;
56  ss << "since =" << snc;
57  m_userTextLog = ss.str() + ";";
58  edm::LogInfo ("RunInfoHandler") << "------- " << m_name << " - > getNewObjects" << std::endl;
59 }
std::string m_user
std::string m_connectionString
std::string lastPayloadToken
Definition: TagInfo.h:12
cond::TagInfo const & tagInfo() const
std::string name
Definition: TagInfo.h:9
RunInfoHandler(const edm::ParameterSet &pset)
tuple pset
Definition: CrabTask.py:85
RunInfo readData(const std::string &table, const std::string &column, const int r_number)
Definition: RunInfoRead.cc:39
size_t size
Definition: TagInfo.h:13
std::string m_name
static RunInfo * Fake_RunInfo()
Definition: RunInfo.cc:4
cond::ValidityInterval lastInterval
Definition: TagInfo.h:11
tuple cout
Definition: gather_cfg.py:41
tuple size
Write out results.
std::string m_pass