5 #define NUMBER_OF_HYBRIDS 432
6 #define MEAN_VELOC 695934
8 #include "/afs/rhic/star/packages/DEV/StRoot/StDbLib/StDbDefs.hh"
10 void insertDriftVelocity(
char* unixTime = 0, Bool_t write = kFALSE)
13 gSystem->Load(
"libStDb_Tables.so");
14 gSystem->Load(
"StDbLib");
15 gSystem->Load(
"StDbBroker");
17 ifstream file(
"driftVeloc_01_23_04.txt");
18 ofstream fileout(
"outTest.txt");
20 float veloc, time, sum;
23 int* rowIDs=
new int[NUMBER_OF_HYBRIDS];
25 svtDriftVelAvg_st *driftVelocity =
new svtDriftVelAvg_st[NUMBER_OF_HYBRIDS];
30 file >> index >> veloc >> time;
32 if (file.eof())
break;
34 fileout << index <<
" " << veloc <<
" " << time << endl;
36 if ((veloc > MEAN_VELOC*1.50) || (veloc < MEAN_VELOC*0.50)) {
37 cout <<
"Bad drift velocity : " << veloc << endl;
45 driftVelocity[index].averageDriftVelocity = veloc;
56 cout <<
"Mean drift velocity : " << sum/i << endl;
60 StDbConfigNode* svtCalibNode = mgr->initConfig(dbCalibrations,dbSvt);
StDbTable* svtCalibTable = svtCalibNode->addDbTable(
"svtDriftVelAvg");
61 svtCalibTable->
SetTable((
char*)driftVelocity,NUMBER_OF_HYBRIDS,rowIDs);
62 mgr->setStoreTime(unixTime);
63 cout<<
" Will attempt store with timestamp="<<mgr->getDateStoreTime()<<endl; mgr->storeDbTable(svtCalibTable);
64 delete [] driftVelocity;
virtual void SetTable(char *data, int nrows, int *idList=0)
calloc'd version of data for StRoot
static StDbManager * Instance()
strdup(..) is not ANSI