5 #define NUMBER_OF_HYBRIDS 432
7 #include "/afs/rhic/star/packages/DEV/StRoot/StDbLib/StDbDefs.hh"
9 void insertBadAnodes(
char* unixTime = 0, Bool_t write = kFALSE)
14 gSystem->Load(
"libStDb_Tables.so");
15 gSystem->Load(
"StDbLib");
16 gSystem->Load(
"StDbBroker");
17 gSystem->Load(
"St_base");
18 gSystem->Load(
"StUtilities");
19 gSystem->Load(
"StSvtClassLibrary");
22 ifstream fileBad(
"badAnodes_01_21_04.txt");
26 ofstream fileout(
"outBadAnodesTest.txt");
28 int barrel, ladder, wafer, hybrid;
32 int* rowIDs=
new int[NUMBER_OF_HYBRIDS];
35 config->setConfiguration(
"FULL");
38 svtBadAnodes_st *badAnodes =
new svtBadAnodes_st[NUMBER_OF_HYBRIDS];
40 for (
int i=0;i<432;i++) {
42 for (
int j=0;j<240;j++)
43 badAnodes[i].isBadAnode[j] = 0;
49 fileBad >> barrel >> ladder >> wafer >> hybrid >> anode;
51 index = config->getHybridIndex(barrel, ladder, wafer, hybrid);
53 if (fileBad.eof())
break;
55 badAnodes[index].isBadAnode[anode-1] = 1;
59 for (
int i=0;i<432;i++)
60 for (
int j=0;j<240;j++) {
61 if (badAnodes[i].isBadAnode[j])
62 fileout << i <<
" " << j+1 << endl;
67 StDbConfigNode* svtCalibNode = mgr->initConfig(dbCalibrations,dbSvt);
StDbTable* svtCalibTable = svtCalibNode->addDbTable(
"svtBadAnodes");
68 svtCalibTable->
SetTable((
char*)badAnodes,NUMBER_OF_HYBRIDS,rowIDs);
69 mgr->setStoreTime(unixTime);
70 cout<<
" Will attempt store with timestamp="<<mgr->getDateStoreTime()<<endl; mgr->storeDbTable(svtCalibTable);
virtual void SetTable(char *data, int nrows, int *idList=0)
calloc'd version of data for StRoot
static StDbManager * Instance()
strdup(..) is not ANSI