CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
 RunSummaryRead (const std::string &connectionString, const std::string &user, const std::string &pass)
 
virtual ~RunSummaryRead ()
 
- 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 11 of file RunSummaryRead.h.

Constructor & Destructor Documentation

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

Definition at line 34 of file RunSummaryRead.cc.

References m_columnToRead, and m_tableToRead.

38  :
39  TestBase(),
40 
41  m_connectionString( connectionString ),
42  m_user( user ),
43  m_pass( pass )
44 {
45 
46  m_tableToRead="";
47  m_columnToRead="";
48 
49 }
std::string m_tableToRead
std::string m_pass
TestBase()
Definition: TestBase.cc:10
std::string m_columnToRead
std::string m_connectionString
std::string m_user
RunSummaryRead::~RunSummaryRead ( )
virtual

Definition at line 52 of file RunSummaryRead.cc.

53 {}

Member Function Documentation

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 68 of file RunSummaryRead.cc.

References column, TestBase::connect(), gather_cfg::cout, RunSummary::CSC, cond::rpcobgas::day, RunSummary::DT, dt, RunSummary::ECAL, RunSummary::HCAL, 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, RunSummary::PIXEL, RecoTauCleanerPlugins::pt, RunSummary::RPC, python.IdGenerator::schema, edm::second(), python.CommonUtils::session, AlCaHLTBitMon_QueryRunRegistry::string, Sum, table, RunSummary::TRACKER, and create_public_lumi_plots::year.

Referenced by RunSummaryHandler::getNewObjects().

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

Implements TestBase.

Definition at line 58 of file RunSummaryRead.cc.

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

59 {
60 
61 }

Member Data Documentation

std::string RunSummaryRead::m_columnToRead
private

Definition at line 26 of file RunSummaryRead.h.

Referenced by readData(), and RunSummaryRead().

std::string RunSummaryRead::m_connectionString
private

Definition at line 27 of file RunSummaryRead.h.

Referenced by readData().

std::string RunSummaryRead::m_pass
private

Definition at line 29 of file RunSummaryRead.h.

Referenced by readData().

std::string RunSummaryRead::m_tableToRead
private

Definition at line 25 of file RunSummaryRead.h.

Referenced by readData(), and RunSummaryRead().

std::string RunSummaryRead::m_user
private

Definition at line 28 of file RunSummaryRead.h.

Referenced by readData().