5 #include <rtsSystems.h>
7 #include <SFS/sfs_index.h>
8 #include <DAQ_READER/daqReader.h>
9 #include <DAQ_READER/daq_dta.h>
14 extern int pmd_reader(
char *m,
struct pmd_t *pmd, u_int driver) ;
16 const char *daq_pmd::help_string =
"PMD tst\n" ;
22 daq_det_factory::det_factories[PMD_ID] = this ;
36 LOG(DBG,
"PMD: rts_id %d, name %s",rts_id,name) ;
40 name = rts2name(rts_id) ;
43 if(caller) caller->insert(
this, rts_id) ;
48 LOG(DBG,
"%s: constructor: caller %p",name,caller) ;
53 LOG(DBG,
"%s: destructor",name) ;
54 if(caller) caller->de_insert(rts_id) ;
63 daq_dta *daq_pmd::get(
const char *bank,
int c1,
int c2,
int c3,
void *p1,
void *p2)
66 if(!present)
return 0 ;
68 if(strcmp(bank,
"*")==0) bank =
"legacy" ;
70 if(strcasecmp(bank,
"legacy") == 0) {
71 return handle_legacy() ;
74 if(strcasecmp(bank,
"raw") == 0) {
75 return handle_raw(c1) ;
78 LOG(ERR,
"%s: unknown bank %s",name,bank) ;
85 daq_dta *daq_pmd::handle_legacy()
89 legacy->create(1,
"pmd_t",rts_id,DAQ_DTA_STRUCT(
pmd_t)) ;
94 LOG(DBG,
"PMD: present is %d",present) ;
96 memset(pmd_p,0,
sizeof(
pmd_t)) ;
98 if(present & DET_PRESENT_DATAP) {
99 pmd_reader(caller->mem, pmd_p, 0) ;
102 for(
int s=1;s<=2;s++) {
104 daq_dta *store = handle_raw(s) ;
105 if(store && store->iterate()) {
106 LOG(DBG,
"PMD: calling reader with %p for %d",store->Void,s) ;
107 pmd_reader((
char *)store->Void, pmd_p, s) ;
112 legacy->finalize(1,0,0,0) ;
119 daq_dta *daq_pmd::handle_raw(
int sec)
128 sprintf(str,
"%s/sec%02d/rb%02d/raw",sfs_name,sec,0) ;
129 full_name = caller->get_sfs_name(str) ;
131 if(!full_name)
return 0 ;
134 bytes = caller->sfs->fileSize(full_name) ;
136 raw->create(bytes,
"pmd_raw",rts_id,DAQ_DTA_STRUCT(
char)) ;
137 st = (
char *) raw->request(bytes) ;
139 int ret = caller->sfs->read(str,st,bytes) ;
141 LOG(ERR,
"PMD: ret is %d",ret) ;
144 raw->finalize(bytes,sec,0,0) ;