27 #include <sys/types.h>
33 #include "StDaqLib/GENERIC/EventReader.hh"
34 #include "StDaqLib/SVT/SVTV1P0_Reader.hh"
41 char *convert_name_to_logfile(
const char *filename)
43 static char locfile[80];
44 strcpy(locfile,filename);
45 strcat(locfile,
".log");
48 t1 = strtok(locfile,
"/");
51 t1 = strtok(NULL,
"/");
57 int main(
int argc,
char *argv[])
63 u_char *(padlist[TPC_PADROWS]);
65 int histogram[50] = {50*0};
68 if (argc==3) offset = atol(argv[2]);
72 printf(
"Usage: %s file.daq [offset]\n",argv[0]);
73 printf(
"Example: %s /scratch/2sbWith2Rcv_from_Tape.dat\n",argv[0]);
81 strcpy(logfile,convert_name_to_logfile(filename.c_str()));
83 printf(
" opening log file: %s\n",logfile);
85 fd = open(filename.c_str(),O_RDONLY);
89 perror(
"FormatClient");
94 for (eventNo=0; eventNo < 1; eventNo++ )
96 EventReader *er = getEventReader(fd,offset,(
const char *)logfile,0);
99 cout <<
"============================================" << endl;
100 cout <<
"Error creating ER" << endl;
101 cout <<
"This may be simply the end of the .daq file." << endl;
107 er->printEventInfo();
112 offset = er->NextEventOffset();
122 cout <<
"Error creating SVT_Reader: " << er->errstr() << endl;
123 if (er->errorNo() == INFO_MISSING_BANK)
124 cout <<
"No SVTP bank available" << endl;
128 else printf(
"created SVT_Reader!!!\n");
133 int wafer = 7, barrel = 3, ladder = 1;
135 sdr->getADCRawReader(barrel, ladder, wafer);
138 int nVal, hybrid=1, anode=241;
139 int ret = adcrr->getSequences(hybrid, anode, &nVal, &adcVal);
140 printf(
"Found %d ADC values for anode %d, hybrid %d\n",
141 nVal, anode, hybrid);
145 for (
int ii=0; ii<11; ii++) printf(
"%d ", adcVal[ii]);
153 int wafer = 7, barrel = 3, ladder = 1;
155 sdr->getPedestalReader(barrel, ladder, wafer);
158 int nVal, hybrid=1, anode=241;
159 int ret = pedrr->getSequences(hybrid, anode, &nVal, &adcVal);
160 printf(
"Found %d ADC values for anode %d, hybrid %d\n",
161 nVal, anode, hybrid);
165 for (
int ii=0; ii<11; ii++) printf(
"%d ", adcVal[ii]);
171 for(
int wafer = 104; wafer < 104+5; wafer++) {
173 dr->getZeroSuppressedReader(wafer);
175 printf(
"zsr creation for wafer %d failed\n", wafer);
178 else printf(
"Created zsr for wafer %d\n", wafer);
180 int nSeq, anode, hybrid;
187 nAnodes = zsr->getPadList(hybrid, &AnodeList);
188 printf(
"Wafer %d, hybrid %d has %d anodes with data:\n",
189 wafer, hybrid, nAnodes);
191 for (
int ii=0; ii<nAnodes; ii++)
192 printf(
"%d ", AnodeList[ii]);
194 int ret = zsr->getSequences(hybrid, AnodeList[0], &nSeq, &Seq);
195 printf(
"Found %d sequences for anode %d, hybrid %d:\n",
196 nSeq, AnodeList[0], hybrid);
198 printf(
"Sequence 0: startTime %d, len %d, ADC values:\n",
199 Seq[0].startTimeBin, Seq[0].Length);
200 for (
int ii=0; ii<Seq[0].Length; ii++)
201 printf(
"%d ", Seq[0].FirstAdc[ii]);
204 zsr->getSpacePts(hybrid, &nSpt, &Spt);
205 printf(
"Found %d spacepoints\n", nSpt);