test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 }
20 
22 {
23 
24 }
25 
27  edm::LogInfo ("RunSummaryHandler") << "------- " << m_name
28  << " - > getNewObjects\n" <<
29  //check whats already inside of database
30  "got offlineInfo"<<
31  tagInfo().name << ", size " << tagInfo().size
32  << ", last object valid since "
33  << tagInfo().lastInterval.first << " token "
34  << tagInfo().lastPayloadToken << std::endl;
35 
36  /*
37  if (tagInfo().size>0) {
38  Ref payload = lastPayload();
39  //edm::LogInfo ("RunSummaryHandler")<<"size of last payload "<<
40  // payload->..........size()<<std::endl;
41  }
42  */
43  unsigned int snc;
44 
45 
46  std::cerr << "Source implementation test ::getNewObjects : enter runnumber as a first since ! \n";
47  std::cin >> snc;
48 
49 
50  std::cout<<"runnumber/first since = "<< snc <<std::endl;
51 
52 
53 
54 
55  RunSummary * r = new RunSummary();
56 
57 
58  //fill with null runsummary if empty run are found beetween the two last validones
59 
60  size_t n_empty_run=0;
61  if (tagInfo().size>0 && (tagInfo().lastInterval.first+1) < snc){
62  n_empty_run = snc- tagInfo().lastInterval.first - 1;
63  edm::LogInfo ("RunSummaryHandler") << "------- " << "entering fake run from " << tagInfo().lastInterval.first + 1 << "to " << snc -1 << "- > getNewObjects" << std::endl;
64  n_empty_run = snc- tagInfo().lastInterval.first - 1;
65  // for (size_t i=1; i<= n_empty_run ; i++){
66 
67  // r->summary.push_back(empty->fake_Run());
68  // }
69  }
70 
71 
72 
73 
74  // transfer fake run for 1 to since for the first time
75  if (tagInfo().size==0){
76  m_to_transfer.push_back(std::make_pair((RunSummary*) (r->Fake_RunSummary()),1));
77  }
78 
79  // transfer also empty run if tag already existing
80  if (n_empty_run!=0) {
81  m_to_transfer.push_back(std::make_pair((RunSummary*) (r->Fake_RunSummary()),tagInfo().lastInterval.first + 1));
82  }
83 
84 
85  // reading from omds
87 
88 
89  *r = rn.readData("RUNSESSION_PARAMETER", "STRING_VALUE",(int)snc );
90  m_to_transfer.push_back(std::make_pair((RunSummary*)r,snc));
91  std::ostringstream ss;
92  ss << "since =" << snc;
93 
94 
95 
96  m_userTextLog = ss.str()+";";
97 
98 
99  edm::LogInfo ("RunSummaryHandler") << "------- " << m_name << " - > getNewObjects" << std::endl;
100 
101 
102 }
static RunSummary * Fake_RunSummary()
Definition: RunSummary.cc:4
RunSummary readData(const std::string &table, const std::string &column, const int r_number)
size_t size
Definition: Types.h:77
std::string name
Definition: Types.h:73
cond::ValidityInterval lastInterval
Definition: Types.h:75
std::string m_connectionString
std::string lastPayloadToken
Definition: Types.h:76
tuple cout
Definition: gather_cfg.py:121
RunSummaryHandler(const edm::ParameterSet &pset)
tuple size
Write out results.
cond::TagInfo_t const & tagInfo() const