27 void storevpdTotCorr(
const Bool_t mTest = 1)
29 const int mNTray = 120;
34 gSystem->Load(
"St_base");
35 gSystem->Load(
"StChain");
36 gSystem->Load(
"StUtilities");
37 gSystem->Load(
"St_Tables.so");
39 gSystem->Load(
"StDbLib.so");
40 gSystem->Load(
"libStDb_Tables.so");
46 StDbConfigNode* configNode = dbManager->initConfig(
"Calibrations_tof");
58 inTime.open(
"input/timestamp");
60 if (inTime.is_open()) {
61 getline(inTime, time);
64 cout <<
" Unable to open the TimeStamp file! EXIT! " << endl;
67 TString StoreTime = time;
68 cout <<
" Store Time " << StoreTime.Data() << endl;
71 StDbTable* vpdTotCorr = configNode->addDbTable(
"vpdTotCorr");
74 vpdTotCorr_st *totcorr=
new vpdTotCorr_st[2*mNVPD];
79 Double_t diff[mNVPD*2];
81 Double_t XS[mNVPD*2][128];
82 Double_t YS[mNVPD*2][128];
85 infile.open(
"input/vpdCali_4DB.dat");
86 if (!infile.is_open()){
87 cerr <<
" unable to open input/vpdCali_4DB.dat; bailing out ..." << endl;
91 for(
int i=0;i<mNVPD*2;i++) {
95 for(
int j=0;j<128;j++) {
96 if(j<nbins+1) infile>>XS[tubeId-1][j];
97 else XS[tubeId-1][j] = 0.0;
99 for(
int j=0;j<128;j++) {
100 if(j<nbins+1) infile>>YS[tubeId-1][j];
101 else YS[tubeId-1][j] = 0.0;
106 for(
int i=0;i<2*mNVPD;i++) {
108 totcorr[i].tubeId = (Short_t)tubeId;
109 totcorr[i].corralgo = corralgo;
110 for(
int j=0;j<128;j++) {
111 totcorr[i].tot[j] = (Float_t)XS[i][j];
112 totcorr[i].corr[j] = (Float_t)YS[i][j];
118 outData.open(
"vpdTotCorr_test.dat");
119 for(
int i=0;i<nRow;i++) {
120 outData << setw(6) << totcorr[i].tubeId << endl;
121 cout << totcorr[i].corralgo <<
" ";
122 for(
int j=0;j<128;j++) {
123 if(totcorr[i].tot[j]>1.e-4)
124 outData << setw(15) << totcorr[i].tot[j];
127 for(
int j=0;j<128;j++) {
128 if(totcorr[i].tot[j]>1.e-4)
129 outData << setw(15) << totcorr[i].corr[j];
137 cout<<
" prepare to upload data to DB"<<endl;
139 vpdTotCorr->
SetTable((
char*)totcorr, nRow);
141 dbManager->setStoreTime(StoreTime.Data());
143 dbManager->storeDbTable(vpdTotCorr);
144 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