00001 /*------------------------------------------------------------------------------ 00002 | 00003 | checkDbTableList.C 00004 | Macro to compare a list of tables saved on STAR database with 00005 | the source files 00006 | 00007 | First argument is the name of the file with the list of files to be 00008 | checked. 00009 | 00010 | Second argument is the output file name. The output file is a list of 00011 | the files with the results of the checking. 00012 | 00013 | Third argument is the maximum entry time in the database. It means that the 00014 | table had to be *saved* before that time. Do not mistake this as the 00015 | timestamp 00016 | 00017 | Fourth argument is the flavor the tables is save in the database 00018 | 00019 | It calls the macro with funtion checkDbTable. Argument is a file name. 00020 | The file names for tables to be saved on DB include information about 00021 | the kind of table and time stamp. The function gets that information 00022 | to make the comparison. For the table on Db, an object of class StEmcDbHandler 00023 | is created, which returns table in the appropriate format to be compared 00024 | to the one in the file. 00025 | 00026 | author: Marcia Maria de Moura 2005-03-22 00027 | 00028 |-----------------------------------------------------------------------------*/ 00029 00030 checkDbTableList(char* listFile="table.list", char* outName="out.txt", 00031 char* MAXENTRY = "2030-01-01 00:00:00", char* flavor = "ofl") 00032 { 00033 00034 // Loading basic libraries 00035 gROOT->Macro("loadMuDst.C"); 00036 00037 // loading functions macros 00038 gROOT->LoadMacro("$STAR/StRoot/StEmcUtil/macros/checkDbTable.C"); 00039 00040 // Getting file list to be checked 00041 ifstream inputFile(listFile); 00042 ofstream outputFile(outName); 00043 char fileName[200]; 00044 00045 // Looping over the file list 00046 while (!inputFile.eof()) 00047 { 00048 inputFile >> fileName; 00049 if (strcmp(fileName," ")) 00050 if (!checkDbTable(fileName,MAXENTRY,flavor)) 00051 { 00052 outputFile <<"DBTIME = "<<DBTIME<<" FILE = "<< fileName <<" - *** TABLES DON'T MATCH ***"<< endl; 00053 cout <<"DBTIME = "<<DBTIME<<" FILE = "<< fileName <<" - *** TABLES DON'T MATCH ***"<< endl; 00054 } 00055 else 00056 { 00057 outputFile <<"DBTIME = "<<DBTIME<<" FILE = "<< fileName <<" - Tables match"<< endl; 00058 cout <<"DBTIME = "<<DBTIME<<" FILE = "<< fileName <<" - Tables match"<< endl; 00059 } 00060 } 00061 00062 outputFile.close(); 00063 00064 // Printing message on terminal 00065 cout << endl; 00066 cout << "_______ DB Table file list checking is done _______" << endl; 00067 cout << endl; 00068 } 00069 //------------------------------------------------------------------------------ 00070
1.5.9