CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
RunSummaryRead Class Reference

#include <RunSummaryRead.h>

Inheritance diagram for RunSummaryRead:
TestBase

Public Member Functions

RunSummary readData (const std::string &table, const std::string &column, const int r_number)
 
void run () override
 
 RunSummaryRead (const std::string &connectionString, const std::string &user, const std::string &pass)
 
 ~RunSummaryRead () override
 
- Public Member Functions inherited from TestBase
void setVerbosityLevel (coral::MsgLevel level)
 
void setVerbosityLevel (coral::MsgLevel level)
 
 TestBase ()
 
 TestBase ()
 
virtual ~TestBase ()
 
virtual ~TestBase ()
 

Private Attributes

std::string m_columnToRead
 
std::string m_connectionString
 
std::string m_pass
 
std::string m_tableToRead
 
std::string m_user
 

Additional Inherited Members

- Protected Member Functions inherited from TestBase
coral::ISession * connect (const std::string &connectionString, const std::string &user, const std::string &password)
 
coral::ISession * connect (const std::string &connectionString, const std::string &user, const std::string &password)
 

Detailed Description

Definition at line 8 of file RunSummaryRead.h.

Constructor & Destructor Documentation

◆ RunSummaryRead()

RunSummaryRead::RunSummaryRead ( const std::string &  connectionString,
const std::string &  user,
const std::string &  pass 
)

Definition at line 28 of file RunSummaryRead.cc.

References m_columnToRead, and m_tableToRead.

31  : TestBase(),
32 
34  m_user(user),
35  m_pass(pass) {
36  m_tableToRead = "";
37  m_columnToRead = "";
38 }
std::string m_tableToRead
std::string m_pass
TestBase()
Definition: TestBase.cc:9
std::string m_columnToRead
std::string m_connectionString
std::string m_user

◆ ~RunSummaryRead()

RunSummaryRead::~RunSummaryRead ( )
override

Definition at line 40 of file RunSummaryRead.cc.

40 {}

Member Function Documentation

◆ readData()

RunSummary RunSummaryRead::readData ( const std::string &  table,
const std::string &  column,
const int  r_number 
)

The number of nanoseconds from epoch 01/01/1970 UTC, normally should fit into 64bit signed integer, depends on the BOOST installation

Definition at line 44 of file RunSummaryRead.cc.

References TestBase::connect(), gather_cfg::cout, util.getRunInfo::day(), dt, nano_mu_digi_cff::float, m_columnToRead, m_connectionString, RunSummary::m_hltkey, RunSummary::m_lumisections, RunSummary::m_name, RunSummary::m_nevents, m_pass, RunSummary::m_rate, RunSummary::m_run, RunSummary::m_start_time_ll, RunSummary::m_start_time_str, RunSummary::m_stop_time_ll, RunSummary::m_stop_time_str, RunSummary::m_subdt_in, m_tableToRead, m_user, DiDispStaMuonMonitor_cfi::pt, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, Sum, TableParser::table, and HLT_2023v12_cff::year.

Referenced by RunSummaryHandler::getNewObjects().

44  {
45  m_tableToRead = table; // to be cms_runinfo.runsession_parameter
46  m_columnToRead = column; // to be string_value;
47 
48  /* query to execute:
49  1) to extract the seq_name
50  select string_value from cms_runinfo.runsession_parameter where cms_runinfo.runsession_parameter.runnumber=r_number AND cms_runinfo.runsession_parameter.name='CMS.LVL0:SEQ_NAME'
51 
52 
53 3) to extract the start_time
54 
55 select id from cms_runinfo.runsession_parameter where runnumber=45903 and cms_runinfo.runsession_parameter.name='CMS.LVL0:START_TIME_T';
56 
57 and then
58 select value from runsession_date where runsession_parameter_id=1647783
59 
60 
61 4) the same for stop_time
62 
63 select string_value from cms_runinfo.runsession_parameter where cms_runinfo.runsession_parameter.runnumber=runnumber AND cms_runinfo.runsession_parameter.name='CMS.LVL0:STOP_TIME_T'
64 
65 5) to extract the lumisections number for the run
66 select MAX(lsnumber) FROM cms_runinfo.hlt_supervisor_lumisections where cms_runinfo.hlt_supervisor_lumisections.runnr=runnumber
67 
68 6) for extract subdt_joined:
69 select string_value from cms_runinfo.runsession_parameter where cms_runinfo.runsession_parameter.runnumber=51770 AND cms_runinfo.runsession_parameter.name LIKE 'CMS.LVL0%' RPC, ECAL,....
70  */
71 
72  RunSummary sum;
73  RunSummary temp_sum;
75 
76  // if cursor is null setting null values
77  temp_sum.m_run = r_number;
78 
79  std::cout << "entering readData" << std::endl;
80  coral::ISession* session = this->connect(m_connectionString, m_user, m_pass);
81  session->transaction().start();
82  std::cout << "starting session " << std::endl;
83  coral::ISchema& schema = session->nominalSchema();
84  std::cout << " accessing schema " << std::endl;
85  std::cout << " trying to handle table :: " << m_tableToRead << std::endl;
86  // coral::IQuery* queryI = schema.newQuery();
87  coral::IQuery* queryI = schema.tableHandle(m_tableToRead).newQuery();
88 
89  queryI->addToOutputList(m_tableToRead + "." + m_columnToRead, m_columnToRead);
90  // condition
91 
92  coral::AttributeList conditionData;
93  conditionData.extend<int>("n_run");
94  conditionData[0].data<int>() = r_number;
95 
96  // condition
97  std::string condition1 = m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.LVL0:SEQ_NAME'";
98  queryI->setCondition(condition1, conditionData);
99  coral::ICursor& cursorI = queryI->execute();
100 
101  if (cursorI.next() != 0) {
102  const coral::AttributeList& row = cursorI.currentRow();
103  temp_sum.m_name = row[m_columnToRead].data<std::string>();
104  std::cout << " name extracted == " << temp_sum.m_name << std::endl;
105  } else {
106  temp_sum.m_name = "null";
107  std::cout << " name extracted == " << temp_sum.m_name << std::endl;
108  }
109  delete queryI;
110 
111  std::string m_columnToRead_id = "ID";
112  long long id_start = 0;
113  // new query to obtain the start_time, fist obtaining the id
114  coral::IQuery* queryII = schema.tableHandle(m_tableToRead).newQuery();
115  //queryIII->addToTableList( m_tableToRead );
116  // implemating the query here.......
117  queryII->addToOutputList(m_tableToRead + "." + m_columnToRead_id, m_columnToRead_id);
118  // condition
119  std::string condition2 = m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.LVL0:START_TIME_T'";
120  queryII->setCondition(condition2, conditionData);
121  coral::ICursor& cursorII = queryII->execute();
122 
123  if (cursorII.next() != 0) {
124  const coral::AttributeList& row = cursorII.currentRow();
125  id_start = row[m_columnToRead_id].data<long long>();
126  std::cout << " id for start time time extracted == " << id_start << std::endl;
127  } else {
128  id_start = -1;
129  std::cout << " id for start time time extracted == " << id_start << std::endl;
130  }
131 
132  delete queryII;
133 
134  // now exctracting the start time
135  std::string m_tableToRead_date = "RUNSESSION_DATE";
136  std::string m_columnToRead_val = "VALUE";
137  // new query to obtain the start_time, fist obtaining the id
138  coral::IQuery* queryIII = schema.tableHandle(m_tableToRead_date).newQuery();
139  //queryIII->addToTableList( m_tableToRead );
140  // implemating the query here.......
141  queryIII->addToOutputList(m_tableToRead_date + "." + m_columnToRead_val, m_columnToRead_val);
142  // condition
143  coral::AttributeList conditionData3;
144  conditionData3.extend<long long>("n_id");
145  conditionData3[0].data<long long>() = id_start;
146  std::string condition3 = m_tableToRead_date + ".runsession_parameter_id=:n_id";
147  queryIII->setCondition(condition3, conditionData3);
148  coral::ICursor& cursorIII = queryIII->execute();
149 
150  if (cursorIII.next() != 0) {
151  const coral::AttributeList& row = cursorIII.currentRow();
152  coral::TimeStamp ts = row[m_columnToRead_val].data<coral::TimeStamp>();
153  int year = ts.year();
154  int month = ts.month();
155  int day = ts.day();
156  int hour = ts.hour();
157  int minute = ts.minute();
158  int second = ts.second();
159  long nanosecond = ts.nanosecond();
160  //const std::string toString= ts.toString() ;
162  //const signed long long int total_nanoseconds=ts.total_nanoseconds() ;
163 
164  std::cout << " start time time extracted == "
165  << "-->year " << year << "-- month " << month << "-- day " << day << "-- hour " << hour << "-- minute "
166  << minute << "-- second " << second << "-- nanosecond " << nanosecond << std::endl;
167  boost::gregorian::date dt(year, month, day);
168  // td in microsecond, fix to utc.....
169  boost::posix_time::time_duration td(hour - 1, minute, second, nanosecond / 1000);
170 
171  boost::posix_time::ptime pt(dt, td);
172  //boost::gregorian::date(year,month,day),
173  //boost::posix_time::hours(hour)+boost::posix_time::minutes(minute)+
174  //boost::posix_time::seconds(second)+
175  //nanosec(nanosecond));
176  // boost::posix_time::ptime pt(ts);
177  std::cout << "ptime == " << pt << std::endl;
178 
179  temp_sum.m_start_time_str = boost::posix_time::to_iso_extended_string(pt);
180  std::cout << "start time string extracted == " << temp_sum.m_start_time_str << std::endl;
181  boost::posix_time::ptime time_at_epoch(boost::gregorian::date(1970, 1, 1));
182  // Subtract time_at_epoch from current time to get the required value.
183  boost::posix_time::time_duration time_diff = (pt - time_at_epoch);
184  temp_sum.m_start_time_ll = time_diff.total_microseconds();
185  std::cout << "microsecond since Epoch (UTC) : " << temp_sum.m_start_time_ll << std::endl;
186  } else {
187  temp_sum.m_start_time_str = "null";
188  temp_sum.m_start_time_ll = -1;
189  }
190  delete queryIII;
191 
192  // new query to obtain the stop_time, fist obtaining the id
193  coral::IQuery* queryIV = schema.tableHandle(m_tableToRead).newQuery();
194  //queryIII->addToTableList( m_tableToRead );
195  // implemating the query here.......
196  queryIV->addToOutputList(m_tableToRead + "." + m_columnToRead_id, m_columnToRead_id);
197  // condition
198  std::string condition4 = m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.LVL0:STOP_TIME_T'";
199 
200  queryIV->setCondition(condition4, conditionData);
201 
202  coral::ICursor& cursorIV = queryIV->execute();
203 
204  long long id_stop = 0;
205  if (cursorIV.next() != 0) {
206  const coral::AttributeList& row = cursorIV.currentRow();
207 
208  id_stop = row[m_columnToRead_id].data<long long>();
209  std::cout << " id for stop time time extracted == " << id_stop << std::endl;
210  } else {
211  id_stop = -1;
212  }
213  delete queryIV;
214 
215  // now exctracting the start time
216  // new query to obtain the start_time, fist obtaining the id
217  coral::IQuery* queryIVbis = schema.tableHandle(m_tableToRead_date).newQuery();
218  //queryIII->addToTableList( m_tableToRead );
219  // implemating the query here.......
220  queryIVbis->addToOutputList(m_tableToRead_date + "." + m_columnToRead_val, m_columnToRead_val);
221  // condition
222  coral::AttributeList conditionData4bis;
223  conditionData4bis.extend<long long>("n_id");
224  conditionData4bis[0].data<long long>() = id_stop;
225  std::string condition4bis = m_tableToRead_date + ".runsession_parameter_id=:n_id";
226  queryIVbis->setCondition(condition4bis, conditionData4bis);
227  coral::ICursor& cursorIVbis = queryIVbis->execute();
228  if (cursorIVbis.next() != 0) {
229  const coral::AttributeList& row = cursorIVbis.currentRow();
230  coral::TimeStamp ts = row[m_columnToRead_val].data<coral::TimeStamp>();
231  int year = ts.year();
232  int month = ts.month();
233  int day = ts.day();
234  int hour = ts.hour();
235  int minute = ts.minute();
236  int second = ts.second();
237  long nanosecond = ts.nanosecond();
238  std::cout << " stop time time extracted == "
239  << "-->year " << year << "-- month " << month << "-- day " << day << "-- hour " << hour << "-- minute "
240  << minute << "-- second " << second << "-- nanosecond " << nanosecond << std::endl;
241  boost::gregorian::date dt(year, month, day);
242  // fix to utc....
243  boost::posix_time::time_duration td(hour - 1, minute, second, nanosecond / 1000);
244  boost::posix_time::ptime pt(dt, td);
245  std::cout << "ptime == " << pt << std::endl;
246  temp_sum.m_stop_time_str = boost::posix_time::to_iso_extended_string(pt);
247  std::cout << "stop time string extracted == " << temp_sum.m_stop_time_str << std::endl;
248  boost::posix_time::ptime time_at_epoch(boost::gregorian::date(1970, 1, 1));
249  // Subtract time_at_epoch from current time to get the required value.
250  boost::posix_time::time_duration time_diff = (pt - time_at_epoch);
251  temp_sum.m_stop_time_ll = time_diff.total_microseconds();
252  std::cout << "microsecond since Epoch (UTC) : " << temp_sum.m_stop_time_ll << std::endl;
253  } else {
254  temp_sum.m_stop_time_str = "null";
255  temp_sum.m_stop_time_ll = -1;
256  }
257  delete queryIVbis;
258 
259  // new query to obtain the lumisections number
260  const std::string m_tableToRead_ls = "HLT_SUPERVISOR_LUMISECTIONS_V2";
261  const std::string m_columnToRead_ls = "LSNUMBER";
262 
263  coral::IQuery* queryV = schema.tableHandle(m_tableToRead_ls).newQuery();
264  queryV->addToOutputList("MAX(" + m_tableToRead_ls + "." + m_columnToRead_ls + ")", m_columnToRead_ls);
265  std::string condition5 = m_tableToRead_ls + ".runnr=:n_run ";
266  //coral::AttributeList conditionData5;
267  //conditionData5.extend<double>( "n_run" );
268  queryV->setCondition(condition5, conditionData);
269  // queryV->setCondition(std::string("max_lsnumber"),coral::AttributeList() );
270  // queryV->defineOutputType( m_columnToRead_ls, "double" );
271  coral::ICursor& cursorV = queryV->execute();
272  if (cursorV.next() != 0) {
273  const coral::AttributeList& row = cursorV.currentRow();
274  double lumisections = row[m_columnToRead_ls].data<double>();
275  temp_sum.m_lumisections = static_cast<int>(lumisections);
276  std::cout << " lumisections number extracted == " << temp_sum.m_lumisections << std::endl;
277  } else {
278  temp_sum.m_lumisections = -1;
279  }
280  std::cout << " leaving the query " << std::endl;
281  delete queryV;
282 
283  // new queries to obtain the subdetector joining or not
284 
285  coral::IQuery* queryVIPIXEL = schema.tableHandle(m_tableToRead).newQuery();
286  queryVIPIXEL->addToOutputList(m_tableToRead + "." + m_columnToRead, m_columnToRead);
287  // condition
288  std::string condition6PIXEL = m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.LVL0:PIXEL'";
289  queryVIPIXEL->setCondition(condition6PIXEL, conditionData);
290  coral::ICursor& cursorVIPIXEL = queryVIPIXEL->execute();
291 
292  if (cursorVIPIXEL.next() != 0) {
293  const coral::AttributeList& row = cursorVIPIXEL.currentRow();
294  // temp_sum.m_subdt_joining.push_back("PIXEL:" + row[m_columnToRead].data<std::string>());
295  if (row[m_columnToRead].data<std::string>() == "In")
296  temp_sum.m_subdt_in.push_back(Sum.PIXEL);
297  } else {
298  // temp_sum.m_subdt_joining.push_back("PIXEL:null");
299  }
300  delete queryVIPIXEL;
301 
302  coral::IQuery* queryVITRACKER = schema.tableHandle(m_tableToRead).newQuery();
303  queryVITRACKER->addToOutputList(m_tableToRead + "." + m_columnToRead, m_columnToRead);
304  // condition
305  std::string condition6TRACKER = m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.LVL0:TRACKER'";
306  queryVITRACKER->setCondition(condition6TRACKER, conditionData);
307  coral::ICursor& cursorVITRACKER = queryVITRACKER->execute();
308 
309  if (cursorVITRACKER.next() != 0) {
310  const coral::AttributeList& row = cursorVITRACKER.currentRow();
311 
312  // temp_sum.m_subdt_joining.push_back("TRACKER:" + row[m_columnToRead].data<std::string>());
313  if (row[m_columnToRead].data<std::string>() == "In")
314  temp_sum.m_subdt_in.push_back(Sum.TRACKER);
315  } else {
316  // temp_sum.m_subdt_joining.push_back("TRACKER:null");
317  }
318  delete queryVITRACKER;
319 
320  coral::IQuery* queryVIECAL = schema.tableHandle(m_tableToRead).newQuery();
321  queryVIECAL->addToOutputList(m_tableToRead + "." + m_columnToRead, m_columnToRead);
322  // condition
323  std::string condition6ECAL = m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.LVL0:ECAL'";
324  queryVIECAL->setCondition(condition6ECAL, conditionData);
325  coral::ICursor& cursorVIECAL = queryVIECAL->execute();
326 
327  if (cursorVIECAL.next() != 0) {
328  const coral::AttributeList& row = cursorVIECAL.currentRow();
329 
330  // temp_sum.m_subdt_joining.push_back("ECAL:" + row[m_columnToRead].data<std::string>());
331  if (row[m_columnToRead].data<std::string>() == "In")
332  temp_sum.m_subdt_in.push_back(Sum.ECAL);
333  } else {
334  // temp_sum.m_subdt_joining.push_back("ECAL:null");
335  }
336  delete queryVIECAL;
337 
338  coral::IQuery* queryVIHCAL = schema.tableHandle(m_tableToRead).newQuery();
339  queryVIHCAL->addToOutputList(m_tableToRead + "." + m_columnToRead, m_columnToRead);
340  // condition
341  std::string condition6HCAL = m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.LVL0:HCAL'";
342  queryVIHCAL->setCondition(condition6HCAL, conditionData);
343  coral::ICursor& cursorVIHCAL = queryVIHCAL->execute();
344 
345  if (cursorVIHCAL.next() != 0) {
346  const coral::AttributeList& row = cursorVIHCAL.currentRow();
347 
348  //temp_sum.m_subdt_joining.push_back("HCAL:" + row[m_columnToRead].data<std::string>());
349  if (row[m_columnToRead].data<std::string>() == "In")
350  temp_sum.m_subdt_in.push_back(Sum.HCAL);
351  } else {
352  // temp_sum.m_subdt_joining.push_back("HCAL:null");
353  }
354  delete queryVIHCAL;
355 
356  coral::IQuery* queryVIDT = schema.tableHandle(m_tableToRead).newQuery();
357  queryVIDT->addToOutputList(m_tableToRead + "." + m_columnToRead, m_columnToRead);
358  // condition
359  std::string condition6DT = m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.LVL0:DT'";
360  queryVIDT->setCondition(condition6DT, conditionData);
361  coral::ICursor& cursorVIDT = queryVIDT->execute();
362 
363  if (cursorVIDT.next() != 0) {
364  const coral::AttributeList& row = cursorVIDT.currentRow();
365 
366  // temp_sum.m_subdt_joining.push_back("DT:" + row[m_columnToRead].data<std::string>());
367  if (row[m_columnToRead].data<std::string>() == "In")
368  temp_sum.m_subdt_in.push_back(Sum.DT);
369  } else {
370  // temp_sum.m_subdt_joining.push_back("DT:null");
371  }
372  delete queryVIDT;
373 
374  coral::IQuery* queryVICSC = schema.tableHandle(m_tableToRead).newQuery();
375  queryVICSC->addToOutputList(m_tableToRead + "." + m_columnToRead, m_columnToRead);
376  // condition
377  std::string condition6CSC = m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.LVL0:CSC'";
378  queryVICSC->setCondition(condition6CSC, conditionData);
379  coral::ICursor& cursorVICSC = queryVICSC->execute();
380 
381  if (cursorVICSC.next() != 0) {
382  const coral::AttributeList& row = cursorVICSC.currentRow();
383 
384  // temp_sum.m_subdt_joining.push_back("CSC:" + row[m_columnToRead].data<std::string>());
385  if (row[m_columnToRead].data<std::string>() == "In")
386  temp_sum.m_subdt_in.push_back(Sum.CSC);
387  } else {
388  // temp_sum.m_subdt_joining.push_back("CSC:null");
389  }
390  delete queryVICSC;
391 
392  coral::IQuery* queryVIRPC = schema.tableHandle(m_tableToRead).newQuery();
393  queryVIRPC->addToOutputList(m_tableToRead + "." + m_columnToRead, m_columnToRead);
394  // condition
395  std::string condition6RPC = m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.LVL0:RPC'";
396  queryVIRPC->setCondition(condition6RPC, conditionData);
397  coral::ICursor& cursorVIRPC = queryVIRPC->execute();
398 
399  if (cursorVIRPC.next() != 0) {
400  const coral::AttributeList& row = cursorVIRPC.currentRow();
401 
402  // temp_sum.m_subdt_joining.push_back("RPC:" + row[m_columnToRead].data<std::string>());
403  if (row[m_columnToRead].data<std::string>() == "In")
404  temp_sum.m_subdt_in.push_back(Sum.RPC);
405  } else {
406  // temp_sum.m_subdt_joining.push_back("RPC:null");
407  }
408  delete queryVIRPC;
409 
410  // for (size_t pos=0; pos< temp_sum.m_subdt_joining.size(); ++pos){
411  // std::cout <<" value for subdetector joined extracted " <<temp_sum.m_subdt_joining[pos] << std::endl;
412  // }
413 
414  // new query to catch hlt key
415  coral::IQuery* queryVII = schema.tableHandle(m_tableToRead).newQuery();
416 
417  queryVII->addToOutputList(m_tableToRead + "." + m_columnToRead, m_columnToRead);
418  // condition
419 
420  coral::AttributeList conditionData7;
421  conditionData7.extend<int>("n_run");
422  conditionData7[0].data<int>() = r_number;
423 
424  // condition
425  std::string condition7 =
426  m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.LVL0:HLT_KEY_DESCRIPTION'";
427  queryVII->setCondition(condition7, conditionData7);
428  coral::ICursor& cursorVII = queryVII->execute();
429 
430  if (cursorVII.next() != 0) {
431  const coral::AttributeList& row = cursorVII.currentRow();
432  temp_sum.m_hltkey = row[m_columnToRead].data<std::string>();
433  std::cout << " hlt key extracted == " << temp_sum.m_hltkey << std::endl;
434  } else {
435  temp_sum.m_hltkey = "null";
436  std::cout << " hlt key extracted == " << temp_sum.m_hltkey << std::endl;
437  }
438  delete queryVII;
439 
440  // new query to catch event number
441  coral::IQuery* queryVIII = schema.tableHandle(m_tableToRead).newQuery();
442 
443  queryVIII->addToOutputList(m_tableToRead + "." + m_columnToRead, m_columnToRead);
444  // condition
445 
446  coral::AttributeList conditionData8;
447  conditionData8.extend<int>("n_run");
448  conditionData8[0].data<int>() = r_number;
449 
450  // condition
451  std::string condition8 =
452  m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.TRG:EVNR' ORDER BY TIME DESC";
453  queryVIII->setCondition(condition8, conditionData8);
454  coral::ICursor& cursorVIII = queryVIII->execute();
455 
456  if (cursorVIII.next() != 0) {
457  const coral::AttributeList& row = cursorVIII.currentRow();
458 
459  temp_sum.m_nevents = atoll(row[m_columnToRead].data<std::string>().c_str());
460 
461  std::cout << " number of events extracted == " << temp_sum.m_nevents << std::endl;
462  } else {
463  temp_sum.m_nevents = -1;
464  std::cout << " number of events extracted == " << temp_sum.m_nevents << std::endl;
465  }
466  delete queryVIII;
467 
468  // new query to catch event number
469  coral::IQuery* queryIX = schema.tableHandle(m_tableToRead).newQuery();
470 
471  queryIX->addToOutputList("AVG(" + m_tableToRead + "." + m_columnToRead + ")", m_columnToRead);
472  // condition
473 
474  coral::AttributeList conditionData9;
475  conditionData9.extend<int>("n_run");
476  conditionData9[0].data<int>() = r_number;
477 
478  // condition
479  std::string condition9 =
480  m_tableToRead + ".runnumber=:n_run AND " + m_tableToRead + ".name='CMS.TRG:Rate' ORDER BY TIME";
481 
482  queryIX->setCondition(condition9, conditionData9);
483  coral::ICursor& cursorIX = queryIX->execute();
484 
485  if (cursorIX.next() != 0) {
486  const coral::AttributeList& row = cursorIX.currentRow();
487 
488  temp_sum.m_rate = (float)row[m_columnToRead].data<double>();
489 
490  std::cout << " rate extracted == " << temp_sum.m_rate << std::endl;
491  } else {
492  temp_sum.m_rate = -1;
493  std::cout << " rate extracted == " << temp_sum.m_rate << std::endl;
494  }
495  delete queryIX;
496 
497  session->transaction().commit();
498  delete session;
499 
500  sum = temp_sum;
501  return sum;
502 }
float dt
Definition: AMPTWrapper.h:136
float m_rate
Definition: RunSummary.h:30
std::vector< int > m_subdt_in
Definition: RunSummary.h:27
std::string m_tableToRead
std::string m_stop_time_str
Definition: RunSummary.h:25
long long m_stop_time_ll
Definition: RunSummary.h:24
std::string m_hltkey
Definition: RunSummary.h:28
std::string m_pass
U second(std::pair< T, U > const &p)
long long m_nevents
Definition: RunSummary.h:29
std::string m_columnToRead
int m_lumisections
Definition: RunSummary.h:26
std::string m_connectionString
long long m_start_time_ll
Definition: RunSummary.h:22
def day(string)
Definition: getRunInfo.py:11
std::string m_name
Definition: RunSummary.h:21
std::string m_start_time_str
Definition: RunSummary.h:23
std::string m_user
coral::ISession * connect(const std::string &connectionString, const std::string &user, const std::string &password)
Definition: TestBase.cc:23

◆ run()

void RunSummaryRead::run ( )
overridevirtual

Implements TestBase.

Definition at line 42 of file RunSummaryRead.cc.

Referenced by Types.EventID::cppID(), and Types.LuminosityBlockID::cppID().

42 {}

Member Data Documentation

◆ m_columnToRead

std::string RunSummaryRead::m_columnToRead
private

Definition at line 19 of file RunSummaryRead.h.

Referenced by readData(), and RunSummaryRead().

◆ m_connectionString

std::string RunSummaryRead::m_connectionString
private

Definition at line 20 of file RunSummaryRead.h.

Referenced by readData().

◆ m_pass

std::string RunSummaryRead::m_pass
private

Definition at line 22 of file RunSummaryRead.h.

Referenced by readData().

◆ m_tableToRead

std::string RunSummaryRead::m_tableToRead
private

Definition at line 18 of file RunSummaryRead.h.

Referenced by readData(), and RunSummaryRead().

◆ m_user

std::string RunSummaryRead::m_user
private

Definition at line 21 of file RunSummaryRead.h.

Referenced by readData().