CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RunSummaryHandler.cc
Go to the documentation of this file.
5 
6 #include <iostream>
7 #include <vector>
8 
10  : m_name(pset.getUntrackedParameter<std::string>("name", "RunSummaryHandler")),
11  // m_connect(pset.getUntrackedParameter<std::string>("OnlineConn","")),
12 
13  m_user(pset.getUntrackedParameter<std::string>("OnlineDBUser", "CMS_RUNINFO")),
14  m_pass(pset.getUntrackedParameter<std::string>("OnlineDBPass", "********"))
15 
16 {
17  m_connectionString = "oracle://cms_omds_lb/CMS_RUNINFO";
18 }
19 
21 
23  edm::LogInfo("RunSummaryHandler") << "------- " << m_name << " - > getNewObjects\n"
24  <<
25  //check whats already inside of database
26  "got offlineInfo" << tagInfo().name << ", size " << tagInfo().size << ", last object valid since "
28  << std::endl;
29 
30  /*
31  if (tagInfo().size>0) {
32  Ref payload = lastPayload();
33  //edm::LogInfo ("RunSummaryHandler")<<"size of last payload "<<
34  // payload->..........size()<<std::endl;
35  }
36  */
37  unsigned int snc;
38 
39  std::cerr << "Source implementation test ::getNewObjects : enter runnumber as a first since ! \n";
40  std::cin >> snc;
41 
42  std::cout << "runnumber/first since = " << snc << std::endl;
43 
44  RunSummary* r = new RunSummary();
45 
46  //fill with null runsummary if empty run are found beetween the two last validones
47 
48  size_t n_empty_run = 0;
49  if (tagInfo().size > 0 && (tagInfo().lastInterval.since + 1) < snc) {
50  edm::LogInfo("RunSummaryHandler") << "------- "
51  << "entering fake run from " << tagInfo().lastInterval.since + 1 << "to "
52  << snc - 1 << "- > getNewObjects" << std::endl;
53  n_empty_run = snc - tagInfo().lastInterval.since - 1;
54  // for (size_t i=1; i<= n_empty_run ; i++){
55 
56  // r->summary.push_back(empty->fake_Run());
57  // }
58  }
59 
60  // transfer fake run for 1 to since for the first time
61  if (tagInfo().size == 0) {
62  m_to_transfer.push_back(std::make_pair((RunSummary*)(r->Fake_RunSummary()), 1));
63  }
64 
65  // transfer also empty run if tag already existing
66  if (n_empty_run != 0) {
67  m_to_transfer.push_back(std::make_pair((RunSummary*)(r->Fake_RunSummary()), tagInfo().lastInterval.since + 1));
68  }
69 
70  // reading from omds
72 
73  *r = rn.readData("RUNSESSION_PARAMETER", "STRING_VALUE", (int)snc);
74  m_to_transfer.push_back(std::make_pair((RunSummary*)r, snc));
75  std::ostringstream ss;
76  ss << "since =" << snc;
77 
78  m_userTextLog = ss.str() + ";";
79 
80  edm::LogInfo("RunSummaryHandler") << "------- " << m_name << " - > getNewObjects" << std::endl;
81 }
static RunSummary * Fake_RunSummary()
Definition: RunSummary.cc:4
RunSummary readData(const std::string &table, const std::string &column, const int r_number)
Iov_t lastInterval
Definition: Types.h:73
Time_t since
Definition: Types.h:53
size_t size
Definition: Types.h:74
std::string name
Definition: Types.h:72
std::string m_connectionString
void getNewObjects() override
std::vector< std::pair< RunSummary *, Time_t > > m_to_transfer
Hash payloadId
Definition: Types.h:55
Log< level::Info, false > LogInfo
tuple cout
Definition: gather_cfg.py:144
~RunSummaryHandler() override
RunSummaryHandler(const edm::ParameterSet &pset)
tuple size
Write out results.
cond::TagInfo_t const & tagInfo() const