#include #include #include "ISlowControlDatabase.hxx" #include "gscUtils.hxx" //#include "IMagnetCurrent.hxx" /// Example program shows how to access TPC ODB information. /// Specifically, it retrieves some run numbers and ODB configuration /// information for all the TPC runs taken in the last week. int main(int argc,char **argv){ int utime = gscUtils::GetEncodedPreviousWeek(); bool foundLastRow = false; // We will loop over all the runs taken since last week, starting with first run of last week. while(!foundLastRow){ // Get the row for the tables TPC_editonstart, TPC_DCC_Settings and TPC_Runinfo . ISlowControlMySQLRow* row = ISlowControlDatabase::Get().GetTable(utime,"TPC_editonstart"); ISlowControlMySQLRow* rowSettings = ISlowControlDatabase::Get().GetTable(utime,"TPC_DCC_Settings"); ISlowControlMySQLRow* rowRunInfo = ISlowControlDatabase::Get().GetTable(utime,"TPC_Runinfo"); // If row is not valid, means that we somehow ended up giving a bad timestamp. Shouldn't happen. if(!row){ std::cerr << "Didn't find row at all. Shouldn't happen.. " << std::endl; break; } // Get information and print to screen std::cout << "\n____________________________________________________________________" << std::endl; std::cout << "For TPC partition run number = " << rowRunInfo->GetValueString("Runnumber") << " taken at time " << row->GetValueInteger("_i_time") << std::endl; std::cout << "Comments : " << row->GetValueString("Comments") << std::endl; std::cout << "Purpose : " << row->GetValueString("Purpose") << std::endl; std::cout << "Operators : " << row->GetValueString("Operators") << std::endl; std::cout << "Read command : " << rowSettings->GetValueString("cmdRead") << std::endl; std::cout << "splitAreq: " << rowSettings->GetValueString("splitAreq") << std::endl; // ___________________________ Setup for next table row ____________________ // Make sure that there is another row. If not, then we've found the last valid row if(row->IsLastRow()) foundLastRow = true; // Get the end time of this row, plus 1 second. utime = row->GetEndTime() + 1; } /* // (2700 before 21/03/2010 and 2600 otherwise) IMagnetCurrent mc1( 2010, 03, 19, 07, 00, 00, 2010, 03, 19, 14, 00, 00 ); IMagnetCurrent mc2( 2010, 01, 15, 00, 00, 00, 2010, 04, 20, 00, 00, 00 ); IMagnetCurrent mc3( 2010, 03, 22, 00, 00, 00, 2010, 03, 24, 00, 00, 00 ); for (int i=6; i<=14; i++){ mc1.SetTime( 2010, 03, 19, i, 00, 00 ); std::cout<<"Bfield at "<