22 void storetofTDIGOnTray()
27 const Int_t NBOARD = 8;
31 const Int_t NTRAY = 94;
32 const Int_t NVPDTRAY = 2;
33 const Int_t NMAX = 120;
36 gSystem->Load(
"St_base");
37 gSystem->Load(
"StChain");
38 gSystem->Load(
"StUtilities");
39 gSystem->Load(
"St_Tables.so");
41 gSystem->Load(
"StDbLib.so");
42 gSystem->Load(
"libStDb_Tables.so");
48 StDbConfigNode* configNode = dbManager->initConfig(
"Calibrations_tof");
52 TString ZStoreTime =
"2008-11-01 00:00:00";
55 StDbTable* tofTDIGOnTray = configNode->addDbTable(
"tofTDIGOnTray");
58 tofTDIGOnTray_st *tdig =
new tofTDIGOnTray_st[NMAX+NVPDTRAY];
74 Short_t validtrayId[NTRAY+NVPDTRAY] =
75 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
76 11, 12, 15, 16, 17, 18, 19, 20,
77 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
78 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
79 41, 44, 45, 46, 47, 48, 49, 50,
80 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
81 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
82 71, 72, 75, 76, 77, 78,
85 101, 104, 105, 106, 107, 108, 109, 110,
86 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
88 Short_t trayId[NMAX] = { 68, 58, 63, 6, 71, 67, 61, 50, 57, 60,
89 47, 46, 0, 0, 64, 72, 62, 42, 14, 11,
90 28, 7, 25, 33, 19, 17, 37, 21, 30, 35,
91 8, 20, 31, 27, 12, 9, 10, 29, 34, 13,
92 16, 0, 0, 36, 39, 23, 32, 15, 24, 18,
93 59, 66, 70, 38, 41, 45, 52, 54, 53, 55,
94 84, 75, 94, 91, 95, 48, 65, 22, 40, 49,
95 5, 2, 0, 0, 1, 4, 3, 51, 0, 0,
96 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
97 0, 0, 0, 0, 0, 0, 77, 89, 87, 90,
98 93, 0, 0, 73, 76, 83, 69, 80, 82, 74,
99 123, 79, 43, 86, 85,122, 81, 92, 96, 78};
102 Short_t tdigId[NMAX][NBOARD];
103 Short_t tdigId_Vpd[NVPDTRAY][NBOARD] = { 89, 91, 1102, 0, 885, 82, 0, 0,
104 85, 79, 1101, 0, 80, 83, 0, 0};
106 ifstream infile(
"TDIGMap");
107 Short_t tId[NTRAY], boardId[NTRAY][NBOARD];
108 for(
int i=0;i<NTRAY;i++) {
109 for(
int j=0;j<NBOARD;j++) {
110 int trayNum, iboard, boardNum;
111 infile >> trayNum >> iboard >> boardNum;
112 cout << trayNum <<
" " << boardNum << endl;
113 tId[i] = (Short_t)trayNum;
114 boardId[i][iboard-1] = (Short_t)boardNum;
119 for(
int i=0;i<NMAX;i++) {
120 for(
int j=0;j<NBOARD;j++) {
124 Short_t thisTray = trayId[i];
126 for(
int j=0;j<NTRAY;j++) {
127 if(thisTray==tId[j]) {
133 cout <<
"tray = " << thisTray <<
" index = " << index << endl;
134 if(index<0||index>=NTRAY)
continue;
135 for(
int j=0;j<NBOARD;j++) {
136 tdigId[i][j] = boardId[index][j];
147 for(
int i=0;i<NMAX+NVPDTRAY;i++) {
148 tdig[i].trayId = i+1;
149 for(
int j=0;j<NBOARD;j++) {
151 tdig[i].tdigId[j] = tdigId[i][j];
153 tdig[i].tdigId[j] = tdigId_Vpd[i-NMAX][j];
158 ofstream outData(
"testTDIGMap.dat");
159 for(
int i=0;i<NMAX+NVPDTRAY;i++) {
160 for(
int j=0;j<NBOARD;j++) {
161 outData << setw(5) << tdig[i].tdigId[j];
168 tofTDIGOnTray->
SetTable((
char*)tdig, NMAX+NVPDTRAY);
170 dbManager->setStoreTime(ZStoreTime.Data());
172 cout<<
" here "<<endl;
173 dbManager->storeDbTable(tofTDIGOnTray);
174 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