14 const Int_t NTRAY = 120;
15 const Int_t NCHANNELTRAY = 192;
16 const Int_t NCHANNELTOTAL = 23040;
17 const Int_t NCHANNELMODULE = 6;
18 Short_t tofmap[NCHANNELTOTAL];
22 gSystem->Load(
"St_base");
23 gSystem->Load(
"StChain");
24 gSystem->Load(
"StUtilities");
25 gSystem->Load(
"St_Tables.so");
26 gSystem->Load(
"StDbLib.so");
27 gSystem->Load(
"libStDb_Tables.so");
33 StDbConfigNode* configNode = dbManager->initConfig(
"Calibrations_tof");
36 StDbTable* tofStatus = configNode->addDbTable(
"tofStatus");
39 tofStatus_st *Status =
new tofStatus_st[1];
45 TString ZStoreTime =
"2011-12-20 00:00:02";
49 for(
int channel = 0; channel<NCHANNELTOTAL; channel++){
55 Int_t inputTray[100]={0},inputModule[100]={0},inputChannel[100]={0};
80 inData.open(
"data/run13/tofStatus/badtofentry.txt");
81 inData >> Date >> Time >> nEntries;
83 cout<<
"Date: "<<Date<<
", Entries: "<<nEntries<<endl;
87 for(
int entry=0;entry<nEntries;entry++){
88 inData >> inputTray[entry] >> inputModule[entry] >> inputChannel[entry];
89 cout<<
"tray,module,channel: "<<inputTray[entry]<<
", "<<inputModule[entry]<<
", "<<inputChannel[entry]<<endl;
95 ZStoreTime = Date.Append(Time);
96 cout <<
"Date+time and ZStoreTime : "<<Date<<
", "<<ZStoreTime<<endl;
99 if(nEntries==0) cout<<
"Enabling All Trays--Entries=0" <<endl;
102 for(
int entry=0;entry<nEntries;entry++){
105 if(nEntries==0)
continue;
107 if(inputTray[entry]==0){
108 cout <<
"Caution: Disabling all trays"<<endl;
109 for(
int channel=0;channel<NCHANNELTOTAL;channel++) tofmap[channel]=0;
112 if(inputTray[entry]!=0&&inputModule[entry]==0){
114 for(
int channel =0;channel<NCHANNELTRAY;channel++){
115 tofmap[(inputTray[entry]-1)*NCHANNELTRAY+channel]=0;
119 if(inputTray[entry]!=0&&inputModule[entry]!=0&&inputChannel[entry]==0){
122 for(
int channel =0;channel<NCHANNELMODULE;channel++){
123 tofmap[(inputTray[entry]-1)*NCHANNELTRAY+channel+(inputModule[entry]-1)*NCHANNELMODULE]=0;
128 if((inputTray[entry]!=0)&&(inputModule[entry]!=0)&&(inputChannel[entry]!=0)){
129 tofmap[(inputTray[entry]-1)*NCHANNELTRAY+(inputModule[entry]-1)*NCHANNELMODULE+inputChannel[entry]-1]=0;
136 for(
int tray=0;tray<NTRAY;tray++){
137 for(
int channel=0;channel<NCHANNELTRAY;channel++){
138 if (0) cout <<
"Tray, channel, map: "<<tray<<
", "<<channel<<
", "<< tofmap[tray*NCHANNELTRAY+channel]<<endl;
139 Status[0].status[channel+tray*NCHANNELTRAY]=tofmap[tray*NCHANNELTRAY+channel];
145 tofStatus->
SetTable((
char*)Status,1);
147 dbManager->setStoreTime(ZStoreTime.Data());
148 dbManager->storeDbTable(tofStatus);
virtual void SetTable(char *data, int nrows, int *idList=0)
calloc'd version of data for StRoot
static StDbManager * Instance()
strdup(..) is not ANSI