21 void storetofINLSCorrStep2()
26 const Int_t NMAX = 1200;
28 const Int_t NCHAN = 8;
31 gSystem->Load(
"St_base");
32 gSystem->Load(
"StChain");
33 gSystem->Load(
"StUtilities");
34 gSystem->Load(
"St_Tables.so");
36 gSystem->Load(
"StDbLib.so");
37 gSystem->Load(
"libStDb_Tables.so");
43 StDbConfigNode* configNode = dbManager->initConfig(
"Calibrations_tof");
46 TString ZStoreTime =
"2009-09-01 00:00:00";
49 StDbTable* tofINLSCorr = configNode->addDbTable(
"tofINLSCorr");
52 tofINLSCorr_st *inlcorr=
new tofINLSCorr_st[NMAX*NTDC*NCHAN];
58 TH1S *hINLSCorr[NMAX][NTDC][NCHAN];
60 for(
int i=0;i<NMAX;i++) hFlag[i] =
false;
62 TFile *f1 =
new TFile(
"INL_test_0_300.root");
63 TFile *f2 =
new TFile(
"INL_test_300_600.root");
64 TFile *f3 =
new TFile(
"INL_test_600_900.root");
65 TFile *f4 =
new TFile(
"INL_test_900_1200.root");
67 for(
int iboard=0;iboard<NMAX;iboard++) {
68 if(iboard%100==0) cout <<
" Processing board Id = " << iboard << endl;
70 for(
int itdc=0;itdc<NTDC;itdc++){
71 for(
int ichan=0;ichan<NCHAN;ichan++) {
74 sprintf(hisname,
"b_%d_tdc_%d_chan_%d",iboard,itdc,ichan);
77 hINLSCorr[iboard][itdc][ichan] = (TH1S *)f1->Get(hisname);
78 }
else if(iboard<600) {
79 hINLSCorr[iboard][itdc][ichan] = (TH1S *)f2->Get(hisname);
80 }
else if(iboard<900) {
81 hINLSCorr[iboard][itdc][ichan] = (TH1S *)f3->Get(hisname);
83 hINLSCorr[iboard][itdc][ichan] = (TH1S *)f4->Get(hisname);
86 if(!hINLSCorr[iboard][itdc][ichan]) {
91 inlcorr[NFILL].tdigId = (Short_t)iboard;
92 inlcorr[NFILL].tdcChanId = (Short_t)(itdc*NCHAN+ichan);
95 for(
int j=0;j<1024;j++) {
96 inlcorr[NFILL].INLCorr[j]=(Short_t)(hINLSCorr[iboard][itdc][ichan]->GetBinContent(j+1));
105 hFlag[iboard] =
true;
108 cout<<
" prepare to upload data to DB NFILL="<<NFILL<<
" NBOARD="<<NBOARD<<endl;
111 sprintf(rootname,
"INL_test.root");
112 TFile *fout =
new TFile(rootname,
"recreate");
114 for(
int iboard=0;iboard<NMAX;iboard++) {
115 if(!hFlag[iboard])
continue;
117 for(
int itdc=0;itdc<NTDC;itdc++){
118 for(
int ichan=0;ichan<NCHAN;ichan++) {
119 if(!hINLSCorr[iboard][itdc][ichan])
continue;
120 hINLSCorr[iboard][itdc][ichan]->Write();
static StDbManager * Instance()
strdup(..) is not ANSI