StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
checkDbTableList.C
1 /*------------------------------------------------------------------------------
2 |
3 | checkDbTableList.C
4 | Macro to compare a list of tables saved on STAR database with
5 | the source files
6 |
7 | First argument is the name of the file with the list of files to be
8 | checked.
9 |
10 | Second argument is the output file name. The output file is a list of
11 | the files with the results of the checking.
12 |
13 | Third argument is the maximum entry time in the database. It means that the
14 | table had to be *saved* before that time. Do not mistake this as the
15 | timestamp
16 |
17 | Fourth argument is the flavor the tables is save in the database
18 |
19 | It calls the macro with funtion checkDbTable. Argument is a file name.
20 | The file names for tables to be saved on DB include information about
21 | the kind of table and time stamp. The function gets that information
22 | to make the comparison. For the table on Db, an object of class StEmcDbHandler
23 | is created, which returns table in the appropriate format to be compared
24 | to the one in the file.
25 |
26 | author: Marcia Maria de Moura 2005-03-22
27 |
28 |-----------------------------------------------------------------------------*/
29 
30 checkDbTableList(char* listFile="table.list", char* outName="out.txt",
31  char* MAXENTRY = "2030-01-01 00:00:00", char* flavor = "ofl")
32 {
33 
34  // Loading basic libraries
35  gROOT->Macro("loadMuDst.C");
36 
37  // loading functions macros
38  gROOT->LoadMacro("$STAR/StRoot/StEmcUtil/macros/checkDbTable.C");
39 
40  // Getting file list to be checked
41  ifstream inputFile(listFile);
42  ofstream outputFile(outName);
43  char fileName[200];
44 
45  // Looping over the file list
46  while (!inputFile.eof())
47  {
48  inputFile >> fileName;
49  if (strcmp(fileName," "))
50  if (!checkDbTable(fileName,MAXENTRY,flavor))
51  {
52  outputFile <<"DBTIME = "<<DBTIME<<" FILE = "<< fileName <<" - *** TABLES DON'T MATCH ***"<< endl;
53  cout <<"DBTIME = "<<DBTIME<<" FILE = "<< fileName <<" - *** TABLES DON'T MATCH ***"<< endl;
54  }
55  else
56  {
57  outputFile <<"DBTIME = "<<DBTIME<<" FILE = "<< fileName <<" - Tables match"<< endl;
58  cout <<"DBTIME = "<<DBTIME<<" FILE = "<< fileName <<" - Tables match"<< endl;
59  }
60  }
61 
62  outputFile.close();
63 
64  // Printing message on terminal
65  cout << endl;
66  cout << "_______ DB Table file list checking is done _______" << endl;
67  cout << endl;
68 }
69 //------------------------------------------------------------------------------
70