StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
storetofPhaseOffsetdAu.C
1 // macro to upload tofr5 INL tables to database
2 //
3 // based on
4 // http://www.star.bnl.gov/STAR/comp/db/StoreDbTable.cc.html
5 //
6 // Jing Liu, 02/18/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 #include <string>
18 using namespace std;
19 
20 
21 void storetofPhaseOffsetdAu()
22 //int main(int argc, char *argv[])
23 
24 {
25 
26  //-- load dBase and Table definition libraries
27  gSystem->Load("St_base");
28  gSystem->Load("StChain");
29  gSystem->Load("StUtilities");
30  gSystem->Load("St_Tables.so");
31 
32  gSystem->Load("StDbLib.so");
33  gSystem->Load("libStDb_Tables.so");
34 
35  //-- get the singleton manager
36  StDbManager* dbManager = StDbManager::Instance();
37 
38  //-- connect to the db & get an empty container
39  StDbConfigNode* configNode = dbManager->initConfig("Calibrations_tof");
40 
41  //----------------------------------------
42  TString ZStoreTime = "2008-01-25 00:00:00";
43 
44  //-- add table to the container with descriptor given by Database
45  StDbTable* tofPhaseOffset = configNode->addDbTable("tofPhaseOffset");
46 
47  //-- fill structures & store times
48  tofPhaseOffset_st *phaseDiff = new tofPhaseOffset_st[1];
49 
50  phaseDiff[0].T0[0] = -14722.;
51  phaseDiff[0].T0[1] = -0.9196;
52 
53  //- store data in table
54  tofPhaseOffset->SetTable((char*)phaseDiff, 1);
55  //- set store time
56  dbManager->setStoreTime(ZStoreTime.Data());
57  //- store table in dBase
58  cout<<" here "<<endl;
59  dbManager->storeDbTable(tofPhaseOffset);
60  cout<<"uploaded"<<endl;
61  // return 0;
62 }
63 
virtual void SetTable(char *data, int nrows, int *idList=0)
calloc&#39;d version of data for StRoot
Definition: StDbTable.cc:550
static StDbManager * Instance()
strdup(..) is not ANSI
Definition: StDbManager.cc:155