23 void storetofTOffset(
const Bool_t mTest = 1)
26 const Int_t mNTray = 120;
27 const Int_t mNTOF = 192;
28 const Int_t mNModule = 32;
29 const Int_t mNCell = 6;
32 gSystem->Load(
"St_base");
33 gSystem->Load(
"StChain");
34 gSystem->Load(
"StUtilities");
35 gSystem->Load(
"St_Tables.so");
37 gSystem->Load(
"StDbLib.so");
38 gSystem->Load(
"libStDb_Tables.so");
44 StDbConfigNode* configNode = dbManager->initConfig(
"Calibrations_tof");
54 inTime.open(
"input/timestamp");
56 if (inTime.is_open()) {
57 getline(inTime, time);
60 cout <<
" Unable to open the TimeStamp file! EXIT! " << endl;
63 TString StoreTime = time;
64 cout <<
" Store Time " << StoreTime.Data() << endl;
67 StDbTable* tofTOffset = configNode->addDbTable(
"tofTOffset");
70 tofTOffset_st *tZero =
new tofTOffset_st[mNTray];
75 inData.open(
"input/t0_4DB.dat");
76 if (!inData.is_open()){
77 cerr <<
" unable to open input/t0_4DB.dat; bailing out ..." << endl;
81 for (Int_t i=0;i<mNTray;i++) {
82 for (Int_t j=0;j<mNModule;j++) {
83 for (Int_t k=0;k<mNCell;k++) {
84 short trayId, moduleId, cellId;
85 inData>>trayId>>moduleId>>cellId;
89 tZero[i].trayId = (Short_t)trayId;
90 tZero[i].T0[j*mNCell+k] = (Float_t)t0;
98 outData.open(
"TOffset_test.dat");
99 for(
int i=0;i<mNTray;i++) {
100 for(
int j=0;j<mNModule;j++) {
101 for(
int k=0;k<mNCell;k++) {
102 short trayId, moduleId, cellId;
103 trayId = tZero[i].trayId;
106 int index = j*mNCell+k;
107 outData <<
" " << trayId <<
" " << moduleId <<
" " << cellId << endl;
108 outData << tZero[i].T0[index] << endl;
115 cout<<
" prepare to upload data to DB"<<endl;
117 tofTOffset->
SetTable((
char*)tZero, mNTray);
119 dbManager->setStoreTime(StoreTime.Data());
121 cout<<
" here "<<endl;
122 dbManager->storeDbTable(tofTOffset);
123 cout<<
"uploaded"<<endl;
virtual void SetTable(char *data, int nrows, int *idList=0)
calloc'd version of data for StRoot
static StDbManager * Instance()
strdup(..) is not ANSI