00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 class StEmcDbHandler;
00023 std::vector<std::string> list;
00024 int index = -1;
00025 StEmcDbHandler* dbHandler = NULL;
00026 TString table;
00027
00028 void drawTables(char* t = "bemcStatus",
00029 char* TSi = "2001-01-01 00:00:00",
00030 char* TSf = "2030-01-01 00:00:00",
00031 char* MAX = "2030-01-01 00:00:00",
00032 char* flavor = "ofl")
00033 {
00034 gROOT->Macro("loadMuDst.C");
00035 gROOT->LoadMacro("$STAR/StRoot/StEmcUtil/macros/drawSingleTable.C");
00036
00037 table = t;
00038
00039 dbHandler=new StEmcDbHandler();
00040 dbHandler->setTableName(t);
00041 dbHandler->setMaxEntryTime(MAX);
00042 dbHandler->setFlavor(flavor);
00043 list = dbHandler->getTimeStampList(TSi,TSf);
00044
00045 stats();
00046 plot(0);
00047 }
00048
00049 void stats()
00050 {
00051 for(int i =0;i<list.size();i++)
00052 {
00053 dbHandler->setTimeStamp(list[i].c_str());
00054 int nGood = 0;
00055 int nEmpty = 0;
00056 int nBad = 0;
00058 if(!strcmp("bemcPed",table.Data()) || !strcmp("bprsPed",table.Data()))
00059 {
00060 emcPed = (emcPed_st*) dbHandler->getDbTable()->GetTable();
00061 for(int j = 0;j<4800;j++)
00062 if(emcPed->Status[j] == 1) nGood++;
00063 else if(emcPed->Status[j] == 0) nEmpty++;
00064 else nBad++;
00065 }
00066 if(!strcmp("bemcCalib",table.Data()) || !strcmp("bprsCalib",table.Data()))
00067 {
00068 emcCalib = (emcCalib_st*) dbHandler->getDbTable()->GetTable();
00069 for(int j = 0;j<4800;j++)
00070 if(emcCalib->Status[j] == 1) nGood++;
00071 else if(emcCalib->Status[j] == 0) nEmpty++;
00072 else nBad++;
00073 }
00074 if(!strcmp("bemcStatus",table.Data()) || !strcmp("bprsStatus",table.Data()))
00075 {
00076 emcStatus = (emcStatus_st*) dbHandler->getDbTable()->GetTable();
00077 for(int j = 0;j<4800;j++)
00078 if(emcStatus->Status[j] == 1) nGood++;
00079 else if(emcStatus->Status[j] == 0) nEmpty++;
00080 else nBad++;
00081 }
00082 if(!strcmp("bemcGain",table.Data()) || !strcmp("bprsGain",table.Data()))
00083 {
00084 emcGain = (emcGain_st*) dbHandler->getDbTable()->GetTable();
00085 for(int j = 0;j<4800;j++)
00086 if(emcGain->Status[j] == 1) nGood++;
00087 else if(emcGain->Status[j] == 0) nEmpty++;
00088 else nBad++;
00089 }
00091 if(!strcmp("bsmdePed",table.Data()) || !strcmp("bsmdpPed",table.Data()))
00092 {
00093 smdPed = (smdPed_st*) dbHandler->getDbTable()->GetTable();
00094 for(int j = 0;j<18000;j++)
00095 if (smdPed->Status[j] == 1) nGood++;
00096 else if(smdPed->Status[j] == 0) nEmpty++;
00097 else nBad++;
00098 }
00099 if(!strcmp("bsmdeCalib",table.Data()) || !strcmp("bsmdpCalib",table.Data()))
00100 {
00101 smdCalib = (smdCalib_st*) dbHandler->getDbTable()->GetTable();
00102 for(int j = 0;j<18000;j++)
00103 if (smdCalib->Status[j] == 1) nGood++;
00104 else if(smdCalib->Status[j] == 0) nEmpty++;
00105 else nBad++;
00106 }
00107 if(!strcmp("bsmdeStatus",table.Data()) || !strcmp("bsmdpStatus",table.Data()))
00108 {
00109 smdStatus = (smdStatus_st*) dbHandler->getDbTable()->GetTable();
00110 for(int j = 0;j<18000;j++)
00111 if (smdStatus->Status[j] == 1) nGood++;
00112 else if(smdStatus->Status[j] == 0) nEmpty++;
00113 else nBad++;
00114 }
00115 if(!strcmp("bsmdeGain",table.Data()) || !strcmp("bsmdpGain",table.Data()))
00116 {
00117 smdGain = (smdGain_st*) dbHandler->getDbTable()->GetTable();
00118 for(int j = 0;j<18000;j++)
00119 if (smdGain->Status[j] == 1) nGood++;
00120 else if(smdGain->Status[j] == 0) nEmpty++;
00121 else nBad++;
00122 }
00123 char line[200];
00124 sprintf(line," %4d %s Good channels = %4d Empty = %5d BAD = %5d\n",i,list[i].c_str(),nGood,nEmpty,nBad);
00125 cout <<line;
00126 }
00127 cout <<"List size = "<<list.size()<<endl<<endl;
00128 cout <<"Type:\n";
00129 cout <<" next() for the next plot in the list\n";
00130 cout <<" previous() for the previous plot in the list\n";
00131 cout <<" plot(i) for the i-entry in the list\n";
00132 cout <<" stats() for this statistics\n";
00133 }
00134 void plot(int I)
00135 {
00136 if(I>=list.size() || I <0) return;
00137 std::string a = list[I];
00138 index = I;
00139 dbHandler->setTimeStamp(a.c_str());
00141 if(!strcmp("bemcPed",table.Data()) || !strcmp("bprsPed",table.Data())) draw((emcPed_st*) dbHandler->getDbTable()->GetTable());
00142 if(!strcmp("bemcCalib",table.Data()) || !strcmp("bprsCalib",table.Data())) draw((emcCalib_st*) dbHandler->getDbTable()->GetTable());
00143 if(!strcmp("bemcStatus",table.Data()) || !strcmp("bprsStatus",table.Data())) draw((emcStatus_st*) dbHandler->getDbTable()->GetTable());
00144 if(!strcmp("bemcGain",table.Data()) || !strcmp("bprsGain",table.Data())) draw((emcGain_st*) dbHandler->getDbTable()->GetTable());
00146 if(!strcmp("bsmdePed",table.Data()) || !strcmp("bsmdpPed",table.Data())) draw((smdPed_st*) dbHandler->getDbTable()->GetTable());
00147 if(!strcmp("bsmdeCalib",table.Data()) || !strcmp("bsmdpCalib",table.Data())) draw((smdCalib_st*) dbHandler->getDbTable()->GetTable());
00148 if(!strcmp("bsmdeStatus",table.Data()) || !strcmp("bsmdpStatus",table.Data())) draw((smdStatus_st*) dbHandler->getDbTable()->GetTable());
00149 if(!strcmp("bsmdeGain",table.Data()) || !strcmp("bsmdpGain",table.Data())) draw((smdGain_st*) dbHandler->getDbTable()->GetTable());
00151 if(!strcmp("bemcTriggerPed",table.Data())) draw((emcTriggerPed_st*) dbHandler->getDbTable()->GetTable());
00152 if(!strcmp("bemcTriggerStatus",table.Data())) draw((emcTriggerStatus_st*) dbHandler->getDbTable()->GetTable());
00153 if(!strcmp("bemcTriggerLUT",table.Data())) draw((emcTriggerLUT_st*) dbHandler->getDbTable()->GetTable());
00154
00155 cout <<"Type:\n";
00156 cout <<" next() for the next plot in the list\n";
00157 cout <<" previous() for the previous plot in the list\n";
00158 cout <<" plot(i) for the i-entry in the list\n";
00159 cout <<" stats() for statistics\n";
00160 }
00161 void next()
00162 {
00163 if(list.size()==0) return;
00164 index ++;
00165 if(index>=list.size()) index = 0;
00166 plot(index);
00167 }
00168
00169 void previous()
00170 {
00171 if(list.size()==0) return;
00172 index --;
00173 if(index<0) index = list.size()-1;
00174 plot(index);
00175 }