StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
readtofTDIGOnTray.C
1 // macro to read tofr5 MAP table from database
2 //
3 // based on
4 // http://www.star.bnl.gov/STAR/comp/db/StoreDbTable.cc.html
5 //
6 // Jing Liu, 03/10/2005
7 //
8 
9 
10 // #include "StDbLib/StDbManager.hh"
11 // #include "StDbLib/StDbConfigNode.hh"
12 // #include "StDbLib/StDbTable.h"
13 // #include "StDbLib/StDbDefs.hh"
14 
15 #include <iostream>
16 #include <fstream>
17 using namespace std;
18 
19 void readtofTDIGOnTray(string ZReadTime = "2029-12-31 23:59:59")
20 {
21  //-- load dBase and Table definition libraries
22  gSystem->Load("St_base");
23  gSystem->Load("StChain");
24  gSystem->Load("StUtilities");
25  gSystem->Load("St_Tables.so");
26 
27  gSystem->Load("StDbLib.so");
28  gSystem->Load("libStDb_Tables.so");
29 
30  //-- get the singleton manager
31  StDbManager* dbManager = StDbManager::Instance();
32 
33  //-- connect to the db & get an empty container
34  StDbConfigNode* configNode = dbManager->initConfig("Calibrations_tof");
35 
36  dbManager->setRequestTime(ZReadTime.c_str());
37 
38  StDbTable* tofmaptable = configNode->addDbTable("tofTDIGOnTray");
39 
40  dbManager->fetchDbTable(tofmaptable);
41 
42  cout<<tofmaptable->getVersion()<<endl;
43  //cout<<tofmaptable->getTableName()<<endl;
44  cout<<tofmaptable->getBeginDateTime()<<endl;
45  cout<<tofmaptable->getEndDateTime()<<endl;
46 
47  tofTDIGOnTray_st* maptable = static_cast<tofTDIGOnTray_st*>(tofmaptable->GetTable());
48 
49  cout<<"Read out from DataBase-------------->"<<endl;
50  Int_t nRows = tofmaptable->GetNRows();
51  cout << " nRows = " << nRows << endl;
52  for(int i=0;i<nRows;i++) {
53  short trayId = maptable[i].trayId;
54  for(int j=0;j<8;j++) {
55  cout << maptable[i].tdigId[j] << " ";
56  }
57  cout << endl;
58  }
59 
60 }
static StDbManager * Instance()
strdup(..) is not ANSI
Definition: StDbManager.cc:155