CMS 3D CMS Logo

RunSummaryRead Class Reference

#include <CondTools/RunInfo/interface/RunSummaryRead.h>

Inheritance diagram for RunSummaryRead:

TestBase

List of all members.

Public Member Functions

RunSummary::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 ()

Private Attributes

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


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.

00038                                     :
00039   TestBase(),
00040   
00041   m_connectionString( connectionString ),
00042   m_user( user ),
00043   m_pass( pass )
00044 {
00045 
00046   m_tableToRead="";
00047   m_columnToRead="";
00048 
00049 }

RunSummaryRead::~RunSummaryRead (  )  [virtual]

Definition at line 52 of file RunSummaryRead.cc.

00053 {}


Member Function Documentation

RunSummary::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 TestBase::connect(), GenMuonPlsPt100GeV_cfg::cout, RunSummary::CSC, RunSummary::DT, RunSummary::ECAL, lat::endl(), RunSummary::HCAL, m_columnToRead, m_connectionString, m_pass, m_tableToRead, m_user, RunSummary::PIXEL, row, RunSummary::RPC, RunSummary::RunSummary(), python::listobjects::schema, edm::second(), python::TagTree::session, sum(), getDQMSummary::td, and RunSummary::TRACKER.

Referenced by RunSummaryHandler::getNewObjects().

00069 {
00070   m_tableToRead = table; // to be  cms_runinfo.runsession_parameter
00071   m_columnToRead= column;  // to be string_value;
00072   
00073   /* query to execute:
00074      1) to extract the seq_name 
00075      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'
00076      
00077 
00078 3) to extract the start_time 
00079 
00080 select id from cms_runinfo.runsession_parameter where runnumber=45903 and cms_runinfo.runsession_parameter.name='CMS.LVL0:START_TIME_T';
00081 
00082 and then 
00083 select value from  runsession_date where runsession_parameter_id=1647783
00084 
00085 
00086 4) the same for stop_time
00087  
00088 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'
00089 
00090 5) to extract the lumisections number for the run
00091 select MAX(lsnumber)   FROM cms_runinfo.hlt_supervisor_lumisections where cms_runinfo.hlt_supervisor_lumisections.runnr=runnumber
00092 
00093 6) for extract subdt_joined:
00094 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,....
00095   */  
00096   
00097   RunSummary::RunSummary  sum;
00098   RunSummary::RunSummary temp_sum;
00099   RunSummary Sum; 
00100 
00101 
00102 
00103   // if cursor is null  setting null values  
00104   temp_sum.m_run = r_number;
00105 
00106   std::cout<< "entering readData" << std::endl;
00107   coral::ISession* session = this->connect( m_connectionString,
00108                                             m_user, m_pass );
00109   session->transaction().start( );
00110   std::cout<< "starting session " << std::endl;
00111   coral::ISchema& schema = session->nominalSchema();
00112   std::cout<< " accessing schema " << std::endl;
00113   std::cout<< " trying to handle table ::  " << m_tableToRead << std::endl;
00114   // coral::IQuery* queryI = schema.newQuery();
00115   coral::IQuery* queryI = schema.tableHandle( m_tableToRead).newQuery();
00116 
00117  queryI->addToOutputList( m_tableToRead + "." +  m_columnToRead, m_columnToRead  );
00118   //  condition 
00119  
00120  coral::AttributeList conditionData;
00121   conditionData.extend<int>( "n_run" );
00122  conditionData[0].data<int>() = r_number;
00123 
00124 
00125   //  condition 
00126   std::string condition1 = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.LVL0:SEQ_NAME'";
00127   queryI->setCondition( condition1, conditionData );
00128   coral::ICursor& cursorI = queryI->execute();
00129   
00130   if ( cursorI.next()!=0  ) {
00131     const coral::AttributeList& row = cursorI.currentRow();
00132      temp_sum.m_name = row[m_columnToRead].data<std::string>();
00133     std::cout<< " name extracted == " << temp_sum.m_name   << std::endl;
00134   }
00135   else{
00136      temp_sum.m_name = "null";
00137     std::cout<< " name extracted == " << temp_sum.m_name   << std::endl;
00138   }
00139    delete queryI;
00140    
00141    
00142    std::string m_columnToRead_id = "ID";
00143    long long id_start=0;
00144    // new query to obtain the start_time, fist obtaining the id
00145    coral::IQuery* queryII = schema.tableHandle( m_tableToRead).newQuery();  
00146    //queryIII->addToTableList( m_tableToRead );
00147    // implemating the query here....... 
00148    queryII->addToOutputList( m_tableToRead + "." +  m_columnToRead_id, m_columnToRead_id    );
00149    //  condition 
00150    std::string condition2 = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.LVL0:START_TIME_T'";
00151    queryII->setCondition( condition2, conditionData );
00152    coral::ICursor& cursorII = queryII->execute();
00153    
00154  if ( cursorII.next()!=0 ) {
00155    const coral::AttributeList& row = cursorII.currentRow();
00156    id_start= row[m_columnToRead_id].data<long long>();
00157    std::cout<< " id for  start time time extracted == " <<id_start   << std::endl;
00158  }
00159  else{
00160    id_start=-1;
00161    std::cout<< " id for  start time time extracted == " <<id_start   << std::endl;
00162  }
00163  
00164  delete queryII;
00165  
00166  // now exctracting the start time
00167  std::string m_tableToRead_date= "RUNSESSION_DATE";
00168  std::string m_columnToRead_val= "VALUE";
00169  // new query to obtain the start_time, fist obtaining the id
00170  coral::IQuery* queryIII = schema.tableHandle( m_tableToRead_date).newQuery();  
00171  //queryIII->addToTableList( m_tableToRead );
00172  // implemating the query here....... 
00173  queryIII->addToOutputList( m_tableToRead_date + "." +  m_columnToRead_val, m_columnToRead_val    );
00174   //  condition 
00175  coral::AttributeList conditionData3;
00176  conditionData3.extend<long long>( "n_id" );
00177  conditionData3[0].data<long long>() = id_start;
00178  std::string condition3 = m_tableToRead_date + ".runsession_parameter_id=:n_id";
00179  queryIII->setCondition( condition3, conditionData3 );
00180  coral::ICursor& cursorIII = queryIII->execute();
00181  
00182  if ( cursorIII.next()!=0 ) {
00183    const coral::AttributeList& row = cursorIII.currentRow();
00184    coral::TimeStamp ts =  row[m_columnToRead_val].data<coral::TimeStamp>();    
00185    int  year= ts.year();
00186    int  month= ts.month();
00187    int  day= ts.day();
00188    int  hour= ts.hour();
00189    int  minute= ts.minute();
00190    int  second = ts.second();
00191    long nanosecond =  ts.nanosecond();
00192    //const std::string toString= ts.toString() ;    
00194    //const signed long long int  total_nanoseconds=ts.total_nanoseconds() ;
00195    
00196    
00197    std::cout<< "  start time time extracted == " << "-->year " << year
00198             << "-- month " << month
00199             << "-- day " << day
00200             << "-- hour " << hour 
00201             << "-- minute " << minute 
00202             << "-- second " << second
00203             << "-- nanosecond " << nanosecond<<std::endl;
00204    boost::gregorian::date dt(year,month,day);
00205    // td in microsecond
00206    boost::posix_time::time_duration td(hour,minute,second,nanosecond/1000);  
00207    
00208    boost::posix_time::ptime pt( dt, td); 
00209    //boost::gregorian::date(year,month,day),
00210    //boost::posix_time::hours(hour)+boost::posix_time::minutes(minute)+ 
00211    //boost::posix_time::seconds(second)+ 
00212    //nanosec(nanosecond));
00213    // boost::posix_time::ptime pt(ts);
00214    std::cout<<"ptime == "<< pt <<std::endl;          
00215    
00216    temp_sum.m_start_time_str = boost::posix_time::to_iso_extended_string(pt);
00217    std::cout<<"start time string  extracted  == "<<temp_sum.m_start_time_str   <<std::endl;   
00218    boost::posix_time::ptime time_at_epoch( boost::gregorian::date( 1970, 1, 1 ) ) ;
00219    // Subtract time_at_epoch from current time to get the required value.
00220    boost::posix_time::time_duration time_diff = ( pt - time_at_epoch ) ;
00221    temp_sum.m_start_time_ll = time_diff.total_microseconds();
00222    std::cout << "microsecond since Epoch (UTC) : " <<temp_sum.m_start_time_ll  <<std::endl;    
00223  }
00224  else 
00225    {
00226      temp_sum.m_start_time_str = "null";
00227      temp_sum.m_start_time_ll = -1;
00228    }
00229  delete queryIII;
00230  
00231  
00232  // new query to obtain the stop_time, fist obtaining the id
00233  coral::IQuery* queryIV = schema.tableHandle( m_tableToRead).newQuery();  
00234  //queryIII->addToTableList( m_tableToRead );
00235  // implemating the query here....... 
00236  queryIV->addToOutputList( m_tableToRead + "." +  m_columnToRead_id, m_columnToRead_id    );
00237  //  condition 
00238  std::string condition4 = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.LVL0:STOP_TIME_T'";
00239  
00240  queryIV->setCondition( condition4, conditionData );
00241  
00242  coral::ICursor& cursorIV = queryIV->execute();
00243  
00244  
00245  long long id_stop=0;
00246  if ( cursorIV.next()!=0 ) {
00247    const coral::AttributeList& row = cursorIV.currentRow();
00248         
00249    id_stop= row[m_columnToRead_id].data<long long>();
00250    std::cout<< " id for  stop time time extracted == " <<id_stop   << std::endl;
00251  }
00252  else{
00253   id_stop=-1;
00254  }
00255  delete queryIV;
00256  
00257  // now exctracting the start time
00258  // new query to obtain the start_time, fist obtaining the id
00259  coral::IQuery* queryIVbis = schema.tableHandle( m_tableToRead_date).newQuery(); 
00260  //queryIII->addToTableList( m_tableToRead );
00261  // implemating the query here....... 
00262  queryIVbis->addToOutputList( m_tableToRead_date + "." +  m_columnToRead_val, m_columnToRead_val    );
00263  //  condition 
00264  coral::AttributeList conditionData4bis;
00265  conditionData4bis.extend<long long>( "n_id" );
00266  conditionData4bis[0].data<long long>() = id_stop;
00267  std::string condition4bis = m_tableToRead_date + ".runsession_parameter_id=:n_id";
00268  queryIVbis->setCondition( condition4bis, conditionData4bis );
00269  coral::ICursor& cursorIVbis = queryIVbis->execute();
00270  if ( cursorIVbis.next()!=0 ) {
00271    const coral::AttributeList& row = cursorIVbis.currentRow();
00272    coral::TimeStamp ts =  row[m_columnToRead_val].data<coral::TimeStamp>(); 
00273    int  year= ts.year();
00274    int  month= ts.month();
00275    int  day= ts.day();
00276    int  hour= ts.hour();
00277    int  minute= ts.minute();
00278    int  second = ts.second();
00279    long nanosecond =  ts.nanosecond();
00280    std::cout<< "  stop time time extracted == " << "-->year " << year
00281             << "-- month " << month
00282             << "-- day " << day
00283             << "-- hour " << hour 
00284             << "-- minute " << minute 
00285             << "-- second " << second
00286             << "-- nanosecond " << nanosecond<<std::endl;
00287    boost::gregorian::date dt(year,month,day);
00288    boost::posix_time::time_duration td(hour,minute,second,nanosecond/1000);  
00289    boost::posix_time::ptime pt( dt, td); 
00290    std::cout<<"ptime == "<< pt <<std::endl;          
00291    temp_sum.m_stop_time_str = boost::posix_time::to_iso_extended_string(pt);
00292    std::cout<<"stop time string  extracted  == "<<temp_sum.m_stop_time_str   <<std::endl;   
00293    boost::posix_time::ptime time_at_epoch( boost::gregorian::date( 1970, 1, 1 ) ) ;
00294    // Subtract time_at_epoch from current time to get the required value.
00295    boost::posix_time::time_duration time_diff = ( pt - time_at_epoch ) ;
00296    temp_sum.m_stop_time_ll = time_diff.total_microseconds();
00297    std::cout << "microsecond since Epoch (UTC) : " <<temp_sum.m_stop_time_ll  <<std::endl;    
00298  }
00299  else{
00300    temp_sum.m_stop_time_str="null";
00301    temp_sum.m_stop_time_ll=-1;
00302  }
00303  delete queryIVbis;
00304  
00305  // new query to obtain the lumisections number
00306  const std::string m_tableToRead_ls="HLT_SUPERVISOR_LUMISECTIONS_V2";
00307  const std::string m_columnToRead_ls = "LSNUMBER";
00308  
00309  coral::IQuery* queryV = schema.tableHandle( m_tableToRead_ls ).newQuery(); 
00310  queryV->addToOutputList( "MAX(" + m_tableToRead_ls + "." +  m_columnToRead_ls +")", m_columnToRead_ls  );
00311  std::string condition5 = m_tableToRead_ls + ".runnr=:n_run " ;
00312  //coral::AttributeList conditionData5;
00313  //conditionData5.extend<double>( "n_run" );
00314  queryV->setCondition( condition5, conditionData );
00315  // queryV->setCondition(std::string("max_lsnumber"),coral::AttributeList() );
00316  // queryV->defineOutputType( m_columnToRead_ls, "double" );
00317  coral::ICursor& cursorV = queryV->execute();
00318  if ( cursorV.next()!=0  ) {
00319    const coral::AttributeList& row = cursorV.currentRow();
00320    double lumisections =  row[m_columnToRead_ls].data<double>();
00321    temp_sum.m_lumisections = static_cast<int>(lumisections);
00322    std::cout<<" lumisections number extracted == "<<temp_sum.m_lumisections  << std::endl;  
00323  }
00324  else{
00325    temp_sum.m_lumisections=-1; 
00326  }
00327  std::cout<<" leaving the query  "<< std::endl;  
00328  delete queryV;
00329 
00330 
00331 
00332 
00333 
00334  
00335  // new queries to obtain the subdetector joining or not
00336 
00337 coral::IQuery* queryVIPIXEL = schema.tableHandle( m_tableToRead).newQuery();  
00338   queryVIPIXEL->addToOutputList( m_tableToRead + "." +  m_columnToRead, m_columnToRead  );
00339   //  condition 
00340   std::string condition6PIXEL = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.LVL0:PIXEL'";
00341   queryVIPIXEL->setCondition( condition6PIXEL, conditionData );
00342   coral::ICursor& cursorVIPIXEL = queryVIPIXEL->execute();
00343   
00344   if ( cursorVIPIXEL.next()!=0  ) {
00345     const coral::AttributeList& row = cursorVIPIXEL.currentRow();
00346     //      temp_sum.m_subdt_joining.push_back("PIXEL:" + row[m_columnToRead].data<std::string>());
00347     if (row[m_columnToRead].data<std::string>()=="In") temp_sum.m_subdt_in.push_back(Sum.PIXEL) ;
00348       }
00349    else{
00350     //   temp_sum.m_subdt_joining.push_back("PIXEL:null");
00351     
00352    }
00353    delete queryVIPIXEL;
00354 
00355 coral::IQuery* queryVITRACKER = schema.tableHandle( m_tableToRead).newQuery();  
00356   queryVITRACKER->addToOutputList( m_tableToRead + "." +  m_columnToRead, m_columnToRead  );
00357   //  condition 
00358   std::string condition6TRACKER = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.LVL0:TRACKER'";
00359   queryVITRACKER->setCondition( condition6TRACKER, conditionData );
00360   coral::ICursor& cursorVITRACKER = queryVITRACKER->execute();
00361   
00362   if ( cursorVITRACKER.next()!=0  ) {
00363     const coral::AttributeList& row = cursorVITRACKER.currentRow();
00364     
00365     //  temp_sum.m_subdt_joining.push_back("TRACKER:" + row[m_columnToRead].data<std::string>());
00366     if (row[m_columnToRead].data<std::string>()=="In") temp_sum.m_subdt_in.push_back(Sum.TRACKER) ;
00367   }
00368   else{
00369     // temp_sum.m_subdt_joining.push_back("TRACKER:null");
00370     
00371   }
00372    delete queryVITRACKER;
00373 
00374 coral::IQuery* queryVIECAL = schema.tableHandle( m_tableToRead).newQuery();  
00375   queryVIECAL->addToOutputList( m_tableToRead + "." +  m_columnToRead, m_columnToRead  );
00376   //  condition 
00377   std::string condition6ECAL = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.LVL0:ECAL'";
00378   queryVIECAL->setCondition( condition6ECAL, conditionData );
00379   coral::ICursor& cursorVIECAL = queryVIECAL->execute();
00380   
00381   if ( cursorVIECAL.next()!=0  ) {
00382     const coral::AttributeList& row = cursorVIECAL.currentRow();
00383     
00384     // temp_sum.m_subdt_joining.push_back("ECAL:" + row[m_columnToRead].data<std::string>());
00385     if (row[m_columnToRead].data<std::string>()=="In") temp_sum.m_subdt_in.push_back(Sum.ECAL) ;
00386   }
00387   else{
00388     // temp_sum.m_subdt_joining.push_back("ECAL:null");
00389     
00390   }
00391    delete queryVIECAL;
00392 
00393 coral::IQuery* queryVIHCAL = schema.tableHandle( m_tableToRead).newQuery();  
00394   queryVIHCAL->addToOutputList( m_tableToRead + "." +  m_columnToRead, m_columnToRead  );
00395   //  condition 
00396   std::string condition6HCAL = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.LVL0:HCAL'";
00397   queryVIHCAL->setCondition( condition6HCAL, conditionData );
00398   coral::ICursor& cursorVIHCAL = queryVIHCAL->execute();
00399   
00400   if ( cursorVIHCAL.next()!=0  ) {
00401     const coral::AttributeList& row = cursorVIHCAL.currentRow();
00402     
00403     //temp_sum.m_subdt_joining.push_back("HCAL:" + row[m_columnToRead].data<std::string>());
00404     if (row[m_columnToRead].data<std::string>()=="In") temp_sum.m_subdt_in.push_back(Sum.HCAL) ;
00405   }
00406   else{
00407     // temp_sum.m_subdt_joining.push_back("HCAL:null");
00408     
00409   }
00410    delete queryVIHCAL;
00411 
00412 
00413 coral::IQuery* queryVIDT = schema.tableHandle( m_tableToRead).newQuery();  
00414   queryVIDT->addToOutputList( m_tableToRead + "." +  m_columnToRead, m_columnToRead  );
00415   //  condition 
00416   std::string condition6DT = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.LVL0:DT'";
00417   queryVIDT->setCondition( condition6DT, conditionData );
00418   coral::ICursor& cursorVIDT = queryVIDT->execute();
00419   
00420   if ( cursorVIDT.next()!=0  ) {
00421     const coral::AttributeList& row = cursorVIDT.currentRow();
00422     
00423     //  temp_sum.m_subdt_joining.push_back("DT:" + row[m_columnToRead].data<std::string>());
00424     if (row[m_columnToRead].data<std::string>()=="In") temp_sum.m_subdt_in.push_back(Sum.DT) ;
00425   }
00426   else{
00427     //   temp_sum.m_subdt_joining.push_back("DT:null");
00428     
00429   }
00430    delete queryVIDT;
00431 
00432 coral::IQuery* queryVICSC = schema.tableHandle( m_tableToRead).newQuery();  
00433   queryVICSC->addToOutputList( m_tableToRead + "." +  m_columnToRead, m_columnToRead  );
00434   //  condition 
00435   std::string condition6CSC = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.LVL0:CSC'";
00436   queryVICSC->setCondition( condition6CSC, conditionData );
00437   coral::ICursor& cursorVICSC = queryVICSC->execute();
00438   
00439   if ( cursorVICSC.next()!=0  ) {
00440     const coral::AttributeList& row = cursorVICSC.currentRow();
00441     
00442     //  temp_sum.m_subdt_joining.push_back("CSC:" + row[m_columnToRead].data<std::string>());
00443     if (row[m_columnToRead].data<std::string>()=="In") temp_sum.m_subdt_in.push_back(Sum.CSC) ;
00444   }
00445   else{
00446     //   temp_sum.m_subdt_joining.push_back("CSC:null");
00447     
00448   }
00449    delete queryVICSC;
00450 
00451 coral::IQuery* queryVIRPC = schema.tableHandle( m_tableToRead).newQuery();  
00452   queryVIRPC->addToOutputList( m_tableToRead + "." +  m_columnToRead, m_columnToRead  );
00453   //  condition 
00454   std::string condition6RPC = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.LVL0:RPC'";
00455   queryVIRPC->setCondition( condition6RPC, conditionData );
00456   coral::ICursor& cursorVIRPC = queryVIRPC->execute();
00457   
00458   if ( cursorVIRPC.next()!=0  ) {
00459     const coral::AttributeList& row = cursorVIRPC.currentRow();
00460     
00461     //  temp_sum.m_subdt_joining.push_back("RPC:" + row[m_columnToRead].data<std::string>());
00462     if (row[m_columnToRead].data<std::string>()=="In") temp_sum.m_subdt_in.push_back(Sum.RPC) ;
00463   }
00464   else{
00465     //   temp_sum.m_subdt_joining.push_back("RPC:null");
00466     
00467   }
00468    delete queryVIRPC;
00469 
00470  
00471    //  for (size_t pos=0; pos<  temp_sum.m_subdt_joining.size(); ++pos){ 
00472    //   std::cout <<" value for subdetector joined extracted " <<temp_sum.m_subdt_joining[pos] << std::endl;
00473    //   }
00474 
00475    // new query to catch hlt key
00476    coral::IQuery* queryVII = schema.tableHandle( m_tableToRead).newQuery();
00477 
00478  queryVII->addToOutputList( m_tableToRead + "." +  m_columnToRead, m_columnToRead  );
00479   //  condition 
00480  
00481  coral::AttributeList conditionData7;
00482   conditionData7.extend<int>( "n_run" );
00483  conditionData7[0].data<int>() = r_number;
00484 
00485 
00486   //  condition 
00487   std::string condition7 = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.LVL0:HLT_KEY_DESCRIPTION'";
00488   queryVII->setCondition( condition7, conditionData7 );
00489   coral::ICursor& cursorVII = queryVII->execute();
00490   
00491   if ( cursorVII.next()!=0  ) {
00492     const coral::AttributeList& row = cursorVII.currentRow();
00493      temp_sum.m_hltkey = row[m_columnToRead].data<std::string>();
00494     std::cout<< " hlt key extracted == " << temp_sum.m_hltkey   << std::endl;
00495   }
00496   else{
00497     temp_sum.m_hltkey = "null";
00498     std::cout<< " hlt key extracted == " << temp_sum.m_hltkey   << std::endl;
00499   }
00500    delete queryVII;
00501   
00502    // new query to catch event number
00503    coral::IQuery* queryVIII = schema.tableHandle( m_tableToRead).newQuery();
00504 
00505  queryVIII->addToOutputList( m_tableToRead + "." +  m_columnToRead, m_columnToRead  );
00506   //  condition 
00507  
00508  coral::AttributeList conditionData8;
00509   conditionData8.extend<int>( "n_run" );
00510  conditionData8[0].data<int>() = r_number;
00511 
00512 
00513   //  condition 
00514   std::string condition8 = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.TRG:EVNR' ORDER BY TIME DESC";
00515   queryVIII->setCondition( condition8, conditionData8 );
00516   coral::ICursor& cursorVIII = queryVIII->execute();
00517   
00518   if ( cursorVIII.next()!=0  ) {
00519     const coral::AttributeList& row = cursorVIII.currentRow();
00520 
00521     temp_sum.m_nevents=atoll(row[m_columnToRead].data<std::string>().c_str());
00522      
00523    
00524     std::cout<< " number of events extracted == " << temp_sum.m_nevents   << std::endl;
00525   }
00526   else{
00527     temp_sum.m_nevents = -1;
00528     std::cout<< " number of events extracted == " << temp_sum.m_nevents   << std::endl;
00529   }
00530    delete queryVIII;
00531     
00532  // new query to catch event number
00533    coral::IQuery* queryIX = schema.tableHandle( m_tableToRead).newQuery();
00534 
00535  queryIX->addToOutputList( "AVG(" + m_tableToRead + "." +  m_columnToRead + ")", m_columnToRead );
00536   //  condition 
00537  
00538 
00539  coral::AttributeList conditionData9;
00540   conditionData9.extend<int>( "n_run" );
00541  conditionData9[0].data<int>() = r_number;
00542 
00543 
00544   //  condition 
00545   std::string condition9 = m_tableToRead + ".runnumber=:n_run AND " +  m_tableToRead +  ".name='CMS.TRG:Rate' ORDER BY TIME";
00546 
00547   queryIX->setCondition( condition9, conditionData9 );
00548    coral::ICursor& cursorIX = queryIX->execute();
00549   
00550   if ( cursorIX.next()!=0  ) {
00551     const coral::AttributeList& row = cursorIX.currentRow();
00552      
00553     temp_sum.m_rate=(float)row[m_columnToRead].data<double>();
00554      
00555    
00556     std::cout<< " rate extracted == " << temp_sum.m_rate   << std::endl;
00557   }
00558   else{
00559     temp_sum.m_rate = -1;
00560     std::cout<< " rate  extracted == " << temp_sum.m_rate   << std::endl;
00561   }
00562    delete queryIX;
00563 
00564 
00565 
00566 
00567  session->transaction().commit();
00568  delete session;
00569  
00570  
00571  sum= temp_sum;
00572  return sum;
00573 }

void RunSummaryRead::run (  )  [virtual]

Implements TestBase.

Definition at line 58 of file RunSummaryRead.cc.

00059 {
00060   
00061 }


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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:31:14 2009 for CMSSW by  doxygen 1.5.4