8 #include <rtsSystems.h>
11 #include <DAQ_READER/daqReader.h>
12 #include <DAQ_READER/daq_dta.h>
18 #include <DAQ_BSMD/daq_bsmd.h>
19 #include <DAQ_BTOW/daq_btow.h>
20 #include <DAQ_EMC/daq_emc.h>
21 #include <DAQ_ESMD/daq_esmd.h>
22 #include <DAQ_ETOW/daq_etow.h>
23 #include <DAQ_FPD/daq_fpd.h>
24 #include <DAQ_FTP/daq_ftp.h>
25 #include <DAQ_L3/daq_l3.h>
26 #include <DAQ_PMD/daq_pmd.h>
27 #include <DAQ_PP2PP/daq_pp2pp.h>
28 #include <DAQ_RIC/daq_ric.h>
29 #include <DAQ_SC/daq_sc.h>
30 #include <DAQ_SSD/daq_ssd.h>
31 #include <DAQ_SVT/daq_svt.h>
32 #include <DAQ_TOF/daq_tof.h>
33 #include <DAQ_TPC/daq_tpc.h>
34 #include <DAQ_TPX/daq_tpx.h>
35 #include <DAQ_TRG/daq_trg.h>
36 #include <DAQ_HLT/daq_hlt.h>
37 #include <DAQ_L4/daq_l4.h>
38 #include <DAQ_FGT/daq_fgt.h>
39 #include <DAQ_MTD/daq_mtd.h>
40 #include <DAQ_PXL/daq_pxl.h>
44 #ifdef INSIST_ON_EMC_PSEUDO
45 static int emc_pseudo_doer(
daqReader *rdr,
const char *do_print) ;
48 static int bsmd_doer(
daqReader *rdr,
const char *do_print) ;
49 static int esmd_doer(
daqReader *rdr,
const char *do_print) ;
50 static int btow_doer(
daqReader *rdr,
const char *do_print) ;
51 static int etow_doer(
daqReader *rdr,
const char *do_print) ;
52 static int tpc_doer(
daqReader *rdr,
const char *do_print) ;
53 static int tpx_doer(
daqReader *rdr,
const char *do_print) ;
54 static int trg_doer(
daqReader *rdr,
const char *do_print) ;
55 static int ftp_doer(
daqReader *rdr,
const char *do_print) ;
56 static int pmd_doer(
daqReader *rdr,
const char *do_print) ;
57 static int hlt_doer(
daqReader *rdr,
const char *do_print) ;
58 static int l4_doer(
daqReader *rdr,
const char *do_print) ;
60 static int pp2pp_doer(
daqReader *rdr,
const char *do_print) ;
61 static int l3_doer(
daqReader *rdr,
const char *do_print) ;
62 static int fgt_doer(
daqReader *rdr,
const char *do_print,
int which) ;
63 static int mtd_doer(
daqReader *rdr,
const char *do_print) ;
64 static int tinfo_doer(
daqReader *rdr,
const char *do_print);
65 static int pxl_doer(
daqReader *rdr,
const char *do_print) ;
69 int main(
int argc,
char *argv[])
74 const char *print_det =
"" ;
75 char _mountpoint[256];
76 char *mountpoint = NULL;
78 rtsLogOutput(RTS_LOG_STDERR) ;
79 rtsLogLevel((
char *)WARN) ;
82 while((c = getopt(argc, argv,
"D:d:m:h")) != EOF) {
91 mountpoint = _mountpoint;
92 strcpy(mountpoint, optarg);
103 evp->setEvpDisk(mountpoint);
110 char *ret = evp->get(0,EVP_TYPE_ANY);
114 LOG(ERR,
"evp status is non-null [0x08X, %d dec]",evp->status,evp->status) ;
120 switch(evp->status) {
124 LOG(DBG,
"End of Run/File");
126 LOG(DBG,
"Wait a second...");
133 LOG(WARN,
"Problem getting event - skipping [good %d, bad %d]",good,bad);
137 LOG(CRIT,
"evp->status CRITICAL (?)") ;
143 if(evp->status == EVP_STAT_EOR) {
144 LOG(INFO,
"End of File reached...") ;
151 LOG(INFO,
"evt %d: sequence %d: token %4d, trgcmd %d, daqcmd %d, time %u, detectors 0x%08X (status 0x%X)",good,evp->seq, evp->token, evp->trgcmd, evp->daqcmd,
152 evp->evt_time, evp->detectors, evp->status) ;
159 if(strcmp(print_det,
"tinfo") == 0) {
160 printf(
"trginfo: seq = #%d token = %d detectors = 0x%x triggers = 0x%llx/0x%llx/0x%llx evptriggers=0x%x\n",
169 tinfo_doer(evp,
"tinfo");
174 if(strcmp(print_det,
"readahead") == 0) {
176 int ret = evp->readNextFutureSummaryInfo(&nsummary);
180 printf(
"Event #%d, token %d triggers 0x%llx ----> No Next Event...",
181 evp->seq,evp->token,evp->daqbits64);
184 printf(
"Event #%d, token %d triggers 0x%llx ----> Next Event: #%d, token %d triggers 0x%llx\n",
185 evp->seq,evp->token,evp->daqbits64,
186 nsummary.seq, nsummary.token,
187 make64(nsummary.L3summary[0],nsummary.L3summary[1]));
192 dd = evp->det(
"sc")->get() ;
193 if(dd && dd->iterate()) {
195 if(strcasecmp(print_det,
"sc")==0) {
202 sc_p->timelag = evp->evt_time - sc_p->time ;
203 if(sc_p->timelag > 0) alag = sc_p->timelag ;
204 else alag = -sc_p->timelag ;
206 if(alag > 5) sc_p->valid = 0 ;
207 else sc_p->valid = 1 ;
209 printf(
"SC: valid %d, time %u, timelag %d, B field %.3f\n",sc_p->valid,sc_p->time,sc_p->timelag,sc_p->mag_field) ;
210 for(
int i=0;i<16;i++) {
211 printf(
"\tRICH scaler %2d: %u\n",i,sc_p->rich_scalers[i]) ;
216 dd = evp->det(
"fpd")->get(
"legacy") ;
219 if(ftp_doer(evp,print_det)) LOG(INFO,
"FTP found") ;
222 dd = evp->det(
"rich")->get(
"legacy") ;
225 dd = evp->det(
"ssd")->get(
"legacy") ;
228 dd = evp->det(
"svt")->get(
"legacy") ;
232 if(pmd_doer(evp, print_det)) LOG(INFO,
"PMD found") ;
234 dd = evp->det(
"tof")->get(
"legacy") ;
237 if(strcasecmp(print_det,
"tof")==0) {
238 while(dd->iterate()) {
240 for(
int r=0;r<4;r++) {
241 printf(
"TOF RDO %d: words %d:\n",r+1,tof->ddl_words[r]) ;
242 for(u_int i=0;i<tof->ddl_words[r];i++) {
243 printf(
"\t%d: 0x%08X [%u dec]\n",i,tof->ddl[r][i],tof->ddl[r][i]) ;
250 if(trg_doer(evp, print_det))
254 if(btow_doer(evp, print_det))
257 bsmd_doer(evp,print_det) ;
259 if(etow_doer(evp, print_det))
261 if(esmd_doer(evp, print_det))
265 if(tpc_doer(evp,print_det))
269 tpx_doer(evp,print_det) ;
274 if(pp2pp_doer(evp,print_det)) LOG(INFO,
"PP2PP found") ;
278 if(l3_doer(evp,print_det)) LOG(INFO,
"L3/HLT_FY09 found") ;
281 if(hlt_doer(evp,print_det)) LOG(INFO,
"HLT_FY10 found") ;
284 if(l4_doer(evp,print_det)) {
285 LOG(INFO,
"HLT FY12 found");
289 fgt_doer(evp,print_det,0) ;
292 if(mtd_doer(evp,print_det)) LOG(INFO,
"MTD found") ;
296 fgt_doer(evp,print_det,1) ;
299 fgt_doer(evp,print_det,2) ;
303 if(pxl_doer(evp,print_det)) LOG(INFO,
"PXL found") ;
309 #ifdef INSIST_ON_EMC_PSEUDO
310 if(emc_pseudo_doer(evp,print_det)) LOG(INFO,
"EMC found (any detector)") ;
320 static int trg_doer(
daqReader *rdr,
const char *do_print)
325 if(strcasestr(do_print,
"trg")) ;
330 dd = rdr->det(
"trg")->get(
"legacy") ;
336 printf(
"Trigger: tcubits 0x%08X, trg_word 0x%04X\n",trg_p->tcubits,trg_p->trg_word) ;
344 dd = rdr->det(
"trg")->get(
"raw") ;
350 u_char *trg_raw = dd->Byte;
362 desc = (simple_desc *) trg_raw ;
365 printf(
"Trigger: raw bank has %d bytes: ver 0x%02X, desc %d, len %d\n",dd->ncontent,desc->ver, desc->evt_desc, desc->len) ;
368 u_int *i32 = (u_int *) trg_raw ;
369 for(
int i=0;i<10;i++) {
370 printf(
"Trigger: word %d: 0x%08X\n",i,i32[i]) ;
380 static int hlt_doer(
daqReader *rdr,
const char *do_print)
385 if(strcasestr(do_print,
"hlt")) ;
388 for(
int s=1;s<=24;s++) {
389 dd = rdr->det(
"hlt")->get(
"tpx",s) ;
390 while(dd && dd->iterate()) {
393 printf(
"HLT TPX sec %02d: bytes %d\n",dd->sec,dd->ncontent) ;
398 dd = rdr->det(
"hlt")->get(
"trg") ;
399 while(dd && dd->iterate()) {
402 printf(
"HLT TRG sec %02d: bytes %d\n",dd->sec,dd->ncontent) ;
406 dd = rdr->det(
"hlt")->get(
"tof") ;
407 while(dd && dd->iterate()) {
410 printf(
"HLT TOF sec %02d: bytes %d\n",dd->sec,dd->ncontent) ;
414 dd = rdr->det(
"hlt")->get(
"gl3") ;
415 while(dd && dd->iterate()) {
419 printf(
"HLT GL3 sec %02d: bytes %d: %d %s\n",dd->sec,dd->ncontent,h->bytes,h->name) ;
428 static int l4_doer(
daqReader *rdr,
const char *do_print)
433 if(strcasestr(do_print,
"l4")) ;
436 for(
int s=1;s<=24;s++) {
437 dd = rdr->det(
"l4")->get(
"tpx",s) ;
438 while(dd && dd->iterate()) {
441 printf(
"L4 TPX sec %02d: bytes %d\n",dd->sec,dd->ncontent) ;
446 dd = rdr->det(
"l4")->get(
"trg") ;
447 while(dd && dd->iterate()) {
450 printf(
"l4 TRG sec %02d: bytes %d\n",dd->sec,dd->ncontent) ;
454 dd = rdr->det(
"l4")->get(
"tof") ;
455 while(dd && dd->iterate()) {
458 printf(
"l4 TOF sec %02d: bytes %d\n",dd->sec,dd->ncontent) ;
462 dd = rdr->det(
"l4")->get(
"gl3") ;
463 while(dd && dd->iterate()) {
467 printf(
"L4 GL3 sec %02d: bytes %d: %d %s\n",dd->sec,dd->ncontent,h->bytes,h->name) ;
476 static int tpx_doer(
daqReader *rdr,
const char *do_print)
486 if(strcasestr(do_print,
"tpx")) ;
492 memset(s_mask,0,
sizeof(s_mask)) ;
494 for(
int s=1;s<=24;s++) {
514 int pixel_count[46] ;
515 memset(pixel_count,0,
sizeof(pixel_count)) ;
518 dd = rdr->det(
"tpx")->get(
"adc",s) ;
521 s_mask[dd->sec-1]=1 ;
523 while(dd->iterate()) {
531 printf(
"TPX: sec %02d, row %2d, pad %3d: %3d pixels\n",dd->sec,dd->row,dd->pad,dd->ncontent) ;
534 pixel_count[dd->row] += dd->ncontent ;
536 for(u_int i=0;i<dd->ncontent;i++) {
538 printf(
"\ttb %3d = %4d ADC\n",dd->adc[i].tb, dd->adc[i].adc) ;
544 if(sec_found && do_print) {
545 for(
int row=0;row<=45;row++) {
546 printf(
"+sector %2d, row %2d: pixels %d\n",s,row,pixel_count[row]) ;
552 dd = rdr->det(
"tpx")->get(
"cld",s) ;
553 while(dd && dd->iterate()) {
558 s_mask[dd->sec-1]=1 ;
562 printf(
"TPX: sec %02d, row %2d: %3d clusters (evt %d)\n",dd->sec,dd->row,dd->ncontent,good) ;
565 for(u_int i=0;i<dd->ncontent;i++) {
574 if(p1 > 200) bad = 1 ;
575 if(p2 > 200) bad = 1 ;
577 if((p2-p1)>14) bad = 1 ;
579 if(t1 > 1200) bad = 1 ;
580 if(t2 > 1200) bad = 1 ;
582 if((t2-t1)>30) bad = 1 ;
584 if(bad) printf(
"BAD: ") ;
585 printf(
"\tpad %7.3f[%d,%d], time %7.3f[%d,%d], charge %5d, flags 0x%02X\n",
586 dd->cld[i].pad,dd->cld[i].p1,dd->cld[i].p2,
587 dd->cld[i].tb,dd->cld[i].t1,dd->cld[i].t2,
588 dd->cld[i].charge,dd->cld[i].flags) ;
596 dd = rdr->det(
"tpx")->get(
"pedrms",s) ;
597 while(dd && dd->iterate()) {
601 s_mask[dd->sec-1]=1 ;
604 printf(
"TPX: sec %02d, row %2d, pad %3d (%d pix)\n",dd->sec,dd->row,dd->pad,dd->ncontent) ;
606 for(u_int tb=0;tb<dd->ncontent;tb++) {
607 printf(
" tb %3d: ped %3d, rms %.2f\n",tb,ped[tb].ped,ped[tb].rms) ;
618 strcat(fstr,
"CLD ") ;
621 strcat(fstr,
"ADC " ) ;
624 strcat(fstr,
"PEDRMS ") ;
629 for(
int s=0;s<24;s++) {
632 sprintf(stmp,
"%d ",s+1) ;
639 LOG(INFO,
"TPX found [%s;%d]",fstr,s_cou) ;
646 static int ftp_doer(
daqReader *rdr,
const char *do_print)
651 if(strcasestr(do_print,
"ftp")) ;
654 dd = rdr->det(
"ftp")->get(
"legacy") ;
656 while(dd && dd->iterate()) {
661 printf(
"FTP sector %d: pixels %d\n",dd->sec,ftp->channels) ;
664 for(
int ss=0;ss<2;ss++) {
665 for(
int rb=0;
rb<10;
rb++) {
666 for(
int pad=0;pad<960;pad++) {
667 for(
int tbi=0;tbi<ftp->counts[ss][
rb][pad];tbi++) {
668 printf(
"%d %d %d %d %d\n",
670 ftp->timebin[ss][
rb][pad][tbi],
671 ftp->adc[ss][
rb][pad][tbi]);
684 static int tpc_doer(
daqReader *rdr,
const char *do_print)
689 if(strcasestr(do_print,
"tpc")) ;
695 for(
int s=1;s<=24;s++) {
696 dd = rdr->det(
"tpc")->get(
"legacy",s) ;
698 while(dd && dd->iterate()) {
703 printf(
"TPC sector %d: pixels %d\n",dd->sec,tpc->channels_sector) ;
704 for(
int r=0;r<45;r++) {
705 for(
int c=0;c<tpc->cl_counts[r];c++) {
706 printf(
"row %2d: pad %1.f, tb %.1f, charge %d\n",r+1,
707 tpc->cl[r][c].p,tpc->cl[r][c].t,tpc->cl[r][c].charge) ;
726 static int pmd_doer(
daqReader *rdr,
const char *do_print)
731 if(strcasestr(do_print,
"pmd")) ;
734 dd = rdr->det(
"pmd")->get(
"legacy") ;
736 if(dd && dd->iterate()) {
740 for(
int crate=0;crate<2;crate++) {
741 printf(
"Crate %s: status %d, mode %d\n",crate==0?
"Up":
"Dn",pmd_p->status[crate],pmd_p->mode) ;
743 for(
int c=0;c<PMD_CRAMS_MAX;c++) {
744 for(
int s=0;s<2;s++) {
745 for(
int ch=0;ch<PMD_CRAMS_CH_MAX;ch++) {
746 printf(
" CRAM %2d: side %d: ch %4d: adc %4d [ped %4.1f, rms %4.2f, thr %4.1f]\n",
748 pmd_p->adc[crate][c][s][ch],
749 (
double)pmd_p->ped[crate][c][s][ch]/16.0,
750 (
double)pmd_p->rms[crate][c][s][ch]/16.0,
751 (
double)pmd_p->thr[crate][c][s][ch]/16.0) ;
761 if(found) LOG(NOTE,
"PMD legacy found") ;
768 static int bsmd_doer(
daqReader *rdr,
const char *do_print)
774 int adc_non_zs_found = 0 ;
778 if(strcasestr(do_print,
"bsmd")) ;
783 for(
int f=1;f<=12;f++) {
784 dd = rdr->det(
"bsmd")->get(
"raw",0,f) ;
786 while(dd->iterate()) {
790 if(do_print) printf(
"BSMD RAW: fiber %2d [==%d], sector %d:\n",dd->rdo,f,dd->sec) ;
793 for(
int i=0;i<10;i++) {
794 if(do_print) printf(
" Head %2d = %08X\n",i,dd->Int32[i]) ;
802 for(
int f=1;f<=12;f++) {
803 dd = rdr->det(
"bsmd")->get(
"adc_non_zs",0,f) ;
805 while(dd->iterate()) {
807 adc_non_zs_found = 1 ;
811 if(do_print) printf(
"BSMD non-ZS: fiber %2d, capacitor %d:\n",dd->rdo,d->cap) ;
814 for(
int i=0;i<BSMD_DATSIZE;i++) {
815 if(do_print) printf(
" %4d = %4d\n",i,d->adc[i]) ;
822 for(
int f=1;f<=12;f++) {
823 dd = rdr->det(
"bsmd")->get(
"adc",0,f) ;
825 while(dd->iterate()) {
831 if(do_print) printf(
"BSMD ZS: fiber %2d, capacitor %d:\n",dd->rdo,d->cap) ;
833 for(
int i=0;i<BSMD_DATSIZE;i++) {
835 if(do_print)
if(d->adc[i]) printf(
" %4d = %4d\n",i,d->adc[i]) ;
842 for(
int f=1;f<=12;f++) {
843 dd = rdr->det(
"bsmd")->get(
"ped",0,f) ;
845 while(dd->iterate()) {
851 if(do_print) printf(
"BSMD PED: fiber %2d, capacitor %d:\n",dd->rdo,d->cap) ;
853 for(
int i=0;i<BSMD_DATSIZE;i++) {
854 if(do_print) printf(
" %4d = %4d\n",i,d->adc[i]) ;
861 for(
int f=1;f<=12;f++) {
862 dd = rdr->det(
"bsmd")->get(
"rms",0,f) ;
864 while(dd->iterate()) {
870 if(do_print) printf(
"BSMD RMS: fiber %2d, capacitor %d:\n",dd->rdo,d->cap) ;
872 for(
int i=0;i<BSMD_DATSIZE;i++) {
873 if(do_print) printf(
" %4d = %.2f\n",i,(
double)d->adc[i]/8.0) ;
884 strcat(fstr,
"RAW ") ;
888 strcat(fstr,
"ADC-ZS ") ;
890 if(adc_non_zs_found) {
891 strcat(fstr,
"ADC-non-ZS " ) ;
894 strcat(fstr,
"PEDRMS ") ;
898 LOG(INFO,
"BSMD found [%s]",fstr) ;
905 static int esmd_doer(
daqReader *rdr,
const char *do_print)
910 if(strcasestr(do_print,
"esmd")) ;
914 dd = rdr->det(
"esmd")->get(
"adc") ;
916 while(dd->iterate()) {
921 for(
int i=0;i<ESMD_MAXFEE;i++) {
922 for(
int j=0;j<ESMD_PRESIZE;j++) {
923 if(do_print) printf(
"ESMD: fee %2d: preamble %d: 0x%04X [%d dec]\n",i,j,d->preamble[i][j], d->preamble[i][j]) ;
925 for(
int j=0;j<ESMD_DATSIZE;j++) {
926 if(do_print) printf(
"ESMD: fee %2d: data %d: 0x%04X [%d dec]\n",i,j,d->adc[i][j], d->adc[i][j]) ;
936 static int etow_doer(
daqReader *rdr,
const char *do_print)
941 if(strcasestr(do_print,
"etow")) ;
945 dd = rdr->det(
"etow")->get(
"adc") ;
947 while(dd->iterate()) {
952 for(
int i=0;i<ETOW_MAXFEE;i++) {
953 for(
int j=0;j<ETOW_PRESIZE;j++) {
954 if(do_print) printf(
"ETOW: fee %2d: preamble %d: 0x%04X [%d dec]\n",i,j,d->preamble[i][j], d->preamble[i][j]) ;
956 for(
int j=0;j<ETOW_DATSIZE;j++) {
957 if(do_print) printf(
"ETOW: fee %2d: data %d: 0x%04X [%d dec]\n",i,j,d->adc[i][j], d->adc[i][j]) ;
967 static int btow_doer(
daqReader *rdr,
const char *do_print)
972 if(strcasestr(do_print,
"btow")) ;
977 dd = rdr->det(
"btow")->get(
"raw") ;
979 while(dd->iterate()) {
980 u_short *s16 = (u_short *) dd->Void ;
983 printf(
"BTOW: bytes %d\n",dd->ncontent) ;
986 for(u_int i=0;i<dd->ncontent/2;i++) {
988 printf(
"%d: 0x%04X [%d dec]\n",i,s16[i],s16[i]) ;
995 dd = rdr->det(
"btow")->get(
"adc") ;
997 while(dd->iterate()) {
1002 for(
int i=0;i<BTOW_MAXFEE;i++) {
1003 for(
int j=0;j<BTOW_PRESIZE;j++) {
1004 if(do_print) printf(
"BTOW: fee %2d: preamble %d: 0x%04X [%d dec]\n",i,j,d->preamble[i][j], d->preamble[i][j]) ;
1006 for(
int j=0;j<BTOW_DATSIZE;j++) {
1007 if(do_print) printf(
"BTOW: fee %2d: data %d: 0x%04X [%d dec]\n",i,j,d->adc[i][j], d->adc[i][j]) ;
1017 #ifdef INSIST_ON_EMC_PSEUDO
1018 static int emc_pseudo_doer(
daqReader *rdr,
const char *do_print)
1023 if(strcasestr(do_print,
"emc_pseudo")) ;
1027 dd = rdr->det(
"emc_pseudo")->get(
"legacy") ;
1029 while(dd->iterate()) {
1034 if(do_print) printf(
"BTOW found %d (%d ch), BSMD found %d (%d ch), ETOW found %d (%d ch), ESMD found %d (%d ch)\n",
1035 d->btow_in, d->btow_ch, d->bsmd_in, d->bsmd_ch, d->etow_in, d->etow_ch, d->esmd_in, d->esmd_ch) ;
1045 static int pp2pp_doer(
daqReader *rdr,
const char *do_print)
1050 if(strcasestr(do_print,
"pp2pp")) ;
1054 dd = rdr->det(
"pp2pp")->get(
"adc") ;
1056 while(dd->iterate()) {
1062 printf(
"PP2PP: sector %d, seq %d, chain %d, SVX %d:\n",dd->sec,d->seq_id,d->chain_id,d->svx_id) ;
1063 for(
int c=0;c<PP2PP_SVX_CH;c++) {
1065 if(d->trace[c]) printf(
" %3d: %3d [0x%02X], trace %d\n",c,d->adc[c],d->adc[c],d->trace[c]) ;
1075 static int l3_doer(
daqReader *rdr,
const char *do_print)
1080 if(strcasestr(do_print,
"l3")) ;
1084 dd = rdr->det(
"l3")->get(
"legacy") ;
1086 while(dd->iterate()) {
1092 printf(
"L3/HLT: sequence %u, decision 0x%X: tracks %d, clusters %d, vertex %f:%f:%f\n",
1093 l3_p->channels, l3_p->mode,
1094 l3_p->tracks_num, l3_p->cluster_num,
1095 l3_p->xVertex, l3_p->yVertex, l3_p->xVertex) ;
1098 for(u_int i=0;i<l3_p->tracks_num;i++) {
1100 printf(
" track %d: Pt %f, charge %d, nHits %d\n",i+1,
1101 l3_p->track[i].pt, l3_p->track[i].q, l3_p->track[i].nHits) ;
1112 static int fgt_doer(
daqReader *rdr,
const char *do_print,
int which)
1134 if(strcasestr(do_print,d_name)) ;
1139 short adc_data[2][FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU][15] ;
1140 short zs_data[2][FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU][15] ;
1141 memset(adc_data,0,
sizeof(adc_data)) ;
1142 memset(zs_data,0,
sizeof(zs_data)) ;
1144 dd = rdr->det(d_name)->get(
"raw") ;
1146 while(dd->iterate()) {
1150 u_int *d = (u_int *) dd->Void ;
1154 printf(
"%s RAW: RDO %d: %d bytes, %d words\n",d_name,dd->rdo,dd->ncontent,dd->ncontent/4) ;
1156 for(
int i=0;i<10;i++) {
1157 printf(
" %3d: 0x%08X\n",i,d[i]) ;
1166 dd = rdr->det(d_name)->get(
"adc") ;
1169 if(dd && dd->meta && do_print) {
1172 printf(
"%s meta data:\n",d_name) ;
1173 for(
int r=1;r<=FGT_RDO_COU;r++) {
1174 if(meta->arc[r].present == 0) continue ;
1176 printf(
" ARC %d: error %c; format %d, ARM mask 0x%X\n",r,meta->arc[r].error?
'Y':
'N',
1177 meta->arc[r].format_code,
1178 meta->arc[r].arm_mask) ;
1180 for(
int arm=0;arm<FGT_ARM_COU;arm++) {
1181 if(meta->arc[r].arm[arm].present == 0) continue ;
1183 printf(
" ARM %d: error %c\n",arm,meta->arc[r].arm[arm].error?
'Y':
'N') ;
1184 printf(
" : arm_id %d, arm_seq %d, arm_err %d, apv_mask 0x%X\n",
1185 meta->arc[r].arm[arm].arm_id,
1186 meta->arc[r].arm[arm].arm_seq,
1187 meta->arc[r].arm[arm].arm_err,
1188 meta->arc[r].arm[arm].apv_mask) ;
1190 for(
int apv=0;apv<FGT_APV_COU;apv++) {
1191 if(meta->arc[r].arm[arm].apv[apv].present == 0) continue ;
1193 printf(
" APV %2d: error %c\n",apv,meta->arc[r].arm[arm].apv[apv].error?
'Y':
'N') ;
1194 printf(
" : apv_id %d, fmt %d, length %d, seq %d, capid %d, nhits %d, is_error %d, refadc %d, ntim %d\n",
1195 meta->arc[r].arm[arm].apv[apv].apv_id,
1196 meta->arc[r].arm[arm].apv[apv].fmt,
1197 meta->arc[r].arm[arm].apv[apv].length,
1198 meta->arc[r].arm[arm].apv[apv].seq,
1199 meta->arc[r].arm[arm].apv[apv].capid,
1200 meta->arc[r].arm[arm].apv[apv].nhits,
1201 meta->arc[r].arm[arm].apv[apv].is_error,
1202 meta->arc[r].arm[arm].apv[apv].refadc,
1203 meta->arc[r].arm[arm].apv[apv].ntim) ;
1210 while(dd && dd->iterate()) {
1216 printf(
"%s ADC: RDO %d, ARM %d, APV %d: %d values\n",d_name,dd->rdo,dd->sec,dd->pad,dd->ncontent) ;
1218 for(u_int i=0;i<dd->ncontent;i++) {
1219 adc_data[dd->rdo-1][dd->sec][dd->pad][f[i].ch][f[i].tb] = f[i].adc ;
1220 printf(
" %5d: ch %3d, tb %d = %3d\n",i,f[i].ch,f[i].tb,f[i].adc) ;
1231 dd = rdr->det(d_name)->get(
"zs") ;
1235 if(dd && dd->meta && do_print) {
1238 printf(
"%s ZS meta data:\n",d_name) ;
1239 for(
int r=1;r<=FGT_RDO_COU;r++) {
1240 if(meta->arc[r].present == 0) continue ;
1242 printf(
" ARC %d: error %c; format %d, ARM mask 0x%X\n",r,meta->arc[r].error?
'Y':
'N',
1243 meta->arc[r].format_code,
1244 meta->arc[r].arm_mask) ;
1246 for(
int arm=0;arm<FGT_ARM_COU;arm++) {
1247 if(meta->arc[r].arm[arm].present == 0) continue ;
1249 printf(
" ARM %d: error %c\n",arm,meta->arc[r].arm[arm].error?
'Y':
'N') ;
1250 printf(
" : arm_id %d, arm_seq %d, arm_err %d, apv_mask 0x%X\n",
1251 meta->arc[r].arm[arm].arm_id,
1252 meta->arc[r].arm[arm].arm_seq,
1253 meta->arc[r].arm[arm].arm_err,
1254 meta->arc[r].arm[arm].apv_mask) ;
1256 for(
int apv=0;apv<FGT_APV_COU;apv++) {
1257 if(meta->arc[r].arm[arm].apv[apv].present == 0) continue ;
1259 printf(
" APV %2d: error %c\n",apv,meta->arc[r].arm[arm].apv[apv].error?
'Y':
'N') ;
1260 printf(
" : apv_id %d, fmt %d, length %d, seq %d, capid %d, nhits %d, is_error %d, refadc %d, ntim %d\n",
1261 meta->arc[r].arm[arm].apv[apv].apv_id,
1262 meta->arc[r].arm[arm].apv[apv].fmt,
1263 meta->arc[r].arm[arm].apv[apv].length,
1264 meta->arc[r].arm[arm].apv[apv].seq,
1265 meta->arc[r].arm[arm].apv[apv].capid,
1266 meta->arc[r].arm[arm].apv[apv].nhits,
1267 meta->arc[r].arm[arm].apv[apv].is_error,
1268 meta->arc[r].arm[arm].apv[apv].refadc,
1269 meta->arc[r].arm[arm].apv[apv].ntim) ;
1276 while(dd && dd->iterate()) {
1282 printf(
"%s ZS: RDO %d, ARM %d, APV %d: %d values\n",d_name,dd->rdo,dd->sec,dd->pad,dd->ncontent) ;
1284 for(u_int i=0;i<dd->ncontent;i++) {
1285 zs_data[dd->rdo-1][dd->sec][dd->pad][f[i].ch][f[i].tb] = f[i].adc ;
1286 printf(
" %5d: ch %3d, tb %d = %3d\n",i,f[i].ch,f[i].tb,f[i].adc) ;
1294 for(
int r=0;r<2;r++) {
1295 for(
int arm=0;arm<FGT_ARM_COU;arm++) {
1296 for(
int apv=0;apv<FGT_APV_COU;apv++) {
1297 for(
int ch=0;ch<FGT_CH_COU;ch++) {
1298 for(
int tb=0;tb<15;tb++) {
1299 int zs = zs_data[r][arm][apv][ch][tb] ;
1300 int adc = adc_data[r][arm][apv][ch][tb] ;
1302 if(zs && (zs != adc)) {
1303 printf(
"ZS ERROR: %d %d %d %d %d = zs %d, adc %d\n",r+1,arm,apv,ch,tb,zs,adc) ;
1310 dd = rdr->det(d_name)->get(
"pedrms") ;
1311 while(dd && dd->iterate()) {
1323 for(u_int i=0;i<dd->ncontent;i++) {
1324 printf(
"%d %d %2d %3d %2d: %.3f +- %.3f\n",arc,arm,apv,f[i].ch,f[i].tb,f[i].ped,f[i].rms) ;
1334 strcat(s_found,
"RAW ") ;
1337 strcat(s_found,
"ADC ") ;
1340 strcat(s_found,
"ZS ") ;
1343 strcat(s_found,
"PEDRMS ") ;
1346 if(found) LOG(INFO,
"%s found: %s",d_name,s_found) ;
1351 static int mtd_doer(
daqReader *rdr,
const char *do_print)
1356 if(strcasestr(do_print,
"mtd")) ;
1361 dd = rdr->det(
"mtd")->get(
"raw") ;
1363 while(dd->iterate()) {
1367 u_int *d = (u_int *) dd->Void ;
1371 printf(
"MTD: RDO %d: %d bytes\n",dd->rdo,dd->ncontent) ;
1373 for(u_int i=0;i<dd->ncontent/4;i++) {
1374 printf(
" %2d: 0x%08X\n",i,d[i]) ;
1385 static int gmt_doer(
daqReader *rdr,
const char *do_print)
1390 if(strcasestr(do_print,
"gmt")) ;
1395 dd = rdr->det(
"gmt")->get(
"raw") ;
1397 while(dd->iterate()) {
1401 u_int *d = (u_int *) dd->Void ;
1405 printf(
"GMT RAW: ARC %d: %d bytes (%d words)\n",dd->rdo,dd->ncontent,dd->ncontent/4) ;
1407 for(
int i=0;i<10;i++) {
1408 printf(
" %2d: 0x%08X\n",i,d[i]) ;
1417 dd = rdr->det(
"gmt")->get(
"adc") ;
1421 if(dd && dd->meta && do_print) {
1424 printf(
"GMT meta data:\n") ;
1425 for(
int r=1;r<=FGT_RDO_COU;r++) {
1426 if(meta->arc[r].present == 0) continue ;
1428 printf(
" ARC %d: error %c; format %d, ARM mask 0x%X\n",r,meta->arc[r].error?
'Y':
'N',
1429 meta->arc[r].format_code,
1430 meta->arc[r].arm_mask) ;
1432 for(
int arm=0;arm<FGT_ARM_COU;arm++) {
1433 if(meta->arc[r].arm[arm].present == 0) continue ;
1435 printf(
" ARM %d: error %c\n",arm,meta->arc[r].arm[arm].error?
'Y':
'N') ;
1436 printf(
" : arm_id %d, arm_seq %d, arm_err %d, apv_mask 0x%X\n",
1437 meta->arc[r].arm[arm].arm_id,
1438 meta->arc[r].arm[arm].arm_seq,
1439 meta->arc[r].arm[arm].arm_err,
1440 meta->arc[r].arm[arm].apv_mask) ;
1442 for(
int apv=0;apv<FGT_APV_COU;apv++) {
1443 if(meta->arc[r].arm[arm].apv[apv].present == 0) continue ;
1445 printf(
" APV %2d: error %c\n",apv,meta->arc[r].arm[arm].apv[apv].error?
'Y':
'N') ;
1446 printf(
" : apv_id %d, fmt %d, length %d, seq %d, capid %d, nhits %d, is_error %d, refadc %d, ntim %d\n",
1447 meta->arc[r].arm[arm].apv[apv].apv_id,
1448 meta->arc[r].arm[arm].apv[apv].fmt,
1449 meta->arc[r].arm[arm].apv[apv].length,
1450 meta->arc[r].arm[arm].apv[apv].seq,
1451 meta->arc[r].arm[arm].apv[apv].capid,
1452 meta->arc[r].arm[arm].apv[apv].nhits,
1453 meta->arc[r].arm[arm].apv[apv].is_error,
1454 meta->arc[r].arm[arm].apv[apv].refadc,
1455 meta->arc[r].arm[arm].apv[apv].ntim) ;
1463 while(dd && dd->iterate()) {
1469 printf(
"GMT ADC: ARC %d, ARM %d, APV %d: %d values\n",dd->rdo,dd->sec,dd->pad,dd->ncontent) ;
1471 for(u_int i=0;i<dd->ncontent;i++) {
1472 printf(
" %5d: ch %3d, tb %d = %3d\n",i,f[i].ch,f[i].tb,f[i].adc) ;
1487 static int tinfo_doer(
daqReader *rdr,
const char *do_print)
1491 daq_dta *dd = rdr->det(
"trg")->get(
"raw") ;
1508 printf(
"trginfo: lastDSM: \n");
1509 for(
int i=0;i<8;i++) {
1512 for(
int ii=0;ii<16;ii++) {
1513 printf(
"%c", (swap16(l1Dsm->lastDSM[i]) & (1<<ii)) ?
'1' :
'0');
1515 if((ii==3)||(ii==7)||(ii==11)) {
1520 int vpdtac = swap16(l1Dsm->lastDSM[1]) & (1<<13);
1521 int vpde = swap16(l1Dsm->lastDSM[1]) & (1<<14);
1522 int vpdw = swap16(l1Dsm->lastDSM[1]) & (1<<15);
1526 printf(
" tac=%d e=%d w=%d \n",vpdtac>0,vpde>0,vpdw>0);
1536 static int pxl_doer(
daqReader *rdr,
const char *do_print)
1541 if(strcasestr(do_print,
"pxl")) ;
1546 dd = rdr->det(
"pxl")->get(
"raw") ;
1548 while(dd->iterate()) {
1552 u_int *d = (u_int *) dd->Void ;
1556 printf(
"PXL RAW: Sector %d, RDO %d: %d bytes (%d words)\n",dd->sec,dd->rdo,dd->ncontent,dd->ncontent/4) ;
1558 for(
int i=0;i<10;i++) {
1559 printf(
" %2d: 0x%08X\n",i,d[i]) ;