86 #include <sys/types.h>
92 #include "StDaqLib/GENERIC/EventReader.hh"
93 #include "StDaqLib/EMC/EMC_Reader.hh"
94 #include "StDaqLib/RICH/RICH_Reader.hh"
95 #include "StDaqLib/TRG/TRG_Reader.hh"
97 #include "StDaqLib/TPC/trans_table.hh"
106 char *convert_name_to_logfile(
const char *filename)
108 static char locfile[80];
109 strcpy(locfile,filename);
110 strcat(locfile,
".log");
113 t1 = strtok(locfile,
"/");
116 t1 = strtok(NULL,
"/");
122 int main(
int argc,
char *argv[])
128 u_char *(padlist[TPC_PADROWS]);
130 int histogram[50] = {50*0};
133 if (argc==3) offset = atol(argv[2]);
137 printf(
"Usage: %s file.daq [offset]\n",argv[0]);
138 printf(
"Example: %s /scratch/2sbWith2Rcv_from_Tape.dat\n",argv[0]);
146 strcpy(logfile,convert_name_to_logfile(filename.c_str()));
148 printf(
" opening log file: %s\n",logfile);
150 fd = open(filename.c_str(),O_RDONLY);
154 perror(
"FormatClient");
159 EventReader *er = getEventReader(fd,offset,(
const char *)logfile,0);
162 cout <<
"============================================" << endl;
163 cout <<
"Error creating ER" << endl;
164 cout <<
"This may be simply the end of the .daq file." << endl;
169 er->printEventInfo();
174 offset = er->NextEventOffset();
180 cout <<
"Error creating TRG_Reader: " << er->errstr() << endl;
184 else printf(
"created TRG_Reader!!!\n");
194 cout <<
"Error creating TPC_Reader: " << er->errstr() << endl;
198 else printf(
"created TPC_Reader!!!\n");
200 for(
int sector=1;sector <= 24;sector++)
203 int nSeq[TPC_MAXPADS];
210 cout <<
"Error creating pedestal reader: " << dr->errstr() << endl;
218 cout <<
"Error creating pedestal RMS reader: " << dr->errstr() << endl;
224 if (pedr->getNumberOfEvents()==0)
continue;
226 for(
int row=1;row <= TPC_PADROWS; row++)
228 int count = pedr->getPadList(row, &padlist[row-1]);
230 printf(
"%2d -- pad list\n",row);
231 for(
int i=0;i<count;i++)
233 printf(
"%4d",padlist[row-1][i]);
239 for(
int row=1;row <= TPC_PADROWS; row++)
241 int count = pedr->getPadList(row, &padlist[row-1]);
243 for(
int i=0;i<count;i++)
246 u_char *Array[TPC_MAXPADS];
247 u_char thispad = padlist[row-1][i];
248 int nseq = pedr->getSequences(row, thispad, &length, &Array[thispad-1]);
251 printf(
"pedestal values for row %d, pad %d:\n",row,thispad);
252 for(
int j=0; j<length; j++)
254 printf(
"%d ", Array[thispad-1][j]);
255 if (j%16==0) printf(
"\n");
261 for(
int row=1;row <= TPC_PADROWS; row++)
263 int count = rmsr->getPadList(row, &padlist[row-1]);
265 for(
int i=0;i<count;i++)
268 u_char *Array[TPC_MAXPADS];
269 u_char thispad = padlist[row-1][i];
270 int nseq = rmsr->getSequences(row, thispad, &length, &Array[thispad-1]);
273 printf(
"pedestal RMS values for row %d, pad %d:\n",row,thispad);
274 for(
int j=0; j<length; j++)
276 printf(
"%4.1f ", (
float)Array[thispad-1][j]/16.0);
277 if (j%16==0) printf(
"\n");