StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
storetofGeomAlign.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 #include <iomanip>
19 using namespace std;
20 
21 
22 void storetofGeomAlign()
23 //int main(int argc, char *argv[])
24 
25 {
26 
27 // year8
28 // const Int_t NTRAY = 5;
29 // year9
30  const Int_t NTRAY = 94;
31  const Int_t NVPDTRAY = 2;
32  const Int_t NMAX = 120;
33 
34  //-- load dBase and Table definition libraries
35  gSystem->Load("St_base");
36  gSystem->Load("StChain");
37  gSystem->Load("StUtilities");
38  gSystem->Load("St_Tables.so");
39 
40  gSystem->Load("StDbLib.so");
41  gSystem->Load("libStDb_Tables.so");
42 
43  //-- get the singleton manager
44  StDbManager* dbManager = StDbManager::Instance();
45 
46  //-- connect to the db & get an empty container
47  StDbConfigNode* configNode = dbManager->initConfig("Calibrations_tof");
48 
49  //----------------------------------------
50  TString ZStoreTime = "2007-11-01 00:00:00";
51 // TString ZStoreTime = "2008-11-01 00:00:00";
52 
53  //-- add table to the container with descriptor given by Database
54  StDbTable* tofGeomAlign = configNode->addDbTable("tofGeomAlign");
55 
56  //-- fill structures & store times
57  tofGeomAlign_st *tofAlign = new tofGeomAlign_st[NMAX];
58 
59 // year8
60  for(int i=0;i<NMAX;i++) {
61  int trayId = i+1;
62  tofAlign[i].x0 = 0.;
63  tofAlign[i].phi0 = 0.;
64  tofAlign[i].z0 = 0.;
65  tofAlign[i].angle0 = 0.;
66  if(trayId<76||trayId>80) continue;
67  tofAlign[i].z0 = -0.5;
68  }
69 
70 // year9
71 
72  tofGeomAlign->SetTable((char*)tofAlign, NMAX);
73  //- set store time
74  dbManager->setStoreTime(ZStoreTime.Data());
75  //- store table in dBase
76  cout<<" here "<<endl;
77  dbManager->storeDbTable(tofGeomAlign);
78  cout<<"uploaded"<<endl;
79  // return 0;
80 }
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