5 #include <rtsSystems.h>
7 #include <DAQ_READER/daqReader.h>
8 #include <DAQ_READER/daq_dta.h>
12 #include <DAQ_BTOW/daq_btow.h>
13 #include <DAQ_ETOW/daq_etow.h>
14 #include <DAQ_ESMD/daq_esmd.h>
15 #include <DAQ_BSMD/daq_bsmd.h>
17 const char *daq_emc::help_string =
"EMC tst\n" ;
23 daq_det_factory::pseudo_factories[BTOW_ID] = this ;
37 LOG(WARN,
"Using EMC_LEGACY is deprecated! Rather use the specific readers: BTOW, BSMD, ETOW, ESMD") ;
39 LOG(DBG,
"EMC: rts_id %d, name %s",rts_id,name) ;
43 name = sfs_name =
"emc_pseudo" ;
46 if(caller) caller->insert(
this, rts_id) ;
50 LOG(DBG,
"%s: constructor: caller %p",name,caller) ;
55 LOG(DBG,
"%s: destructor",name) ;
67 daq_dta *daq_emc::get(
const char *bank,
int c1,
int c2,
int c3,
void *p1,
void *p2)
70 if(strcmp(bank,
"*")==0) bank =
"legacy" ;
72 if(strcasecmp(bank,
"legacy") != 0) {
73 LOG(ERR,
"%s: unknown bank %s",name,bank) ;
77 return handle_legacy() ;
82 daq_dta *daq_emc::handle_legacy()
92 legacy->create(1,
"emc_t",rts_id,DAQ_DTA_STRUCT(
emc_t)) ;
96 memset(emc_p,0,
sizeof(
struct emc_t)) ;
98 emc_p->etow_max_ch = ETOW_MAXFEE * ETOW_DATSIZE ;
99 emc_p->btow_max_ch = BTOW_MAXFEE * BTOW_DATSIZE ;
100 emc_p->esmd_max_ch = ESMD_MAXFEE * ESMD_DATSIZE ;
101 emc_p->bsmd_max_ch = BSMD_FIBERS * BSMD_DATSIZE ;
103 dd = caller->det(
"btow")->get(
"adc") ;
104 while(dd && dd->iterate()) {
112 for(
int i=0;i<BTOW_MAXFEE;i++) {
113 for(
int j=0;j<BTOW_PRESIZE;j++) {
114 emc_p->btow_pre[i][j] = d->preamble[i][j] ;
116 for(
int j=0;j<BTOW_DATSIZE;j++) {
117 if(d->adc[i][j] > 0) emc_p->btow_ch++ ;
118 emc_p->btow_new[i][j] = d->adc[i][j] ;
125 dd = caller->det(
"etow")->get(
"adc") ;
126 while(dd && dd->iterate()) {
133 for(
int i=0;i<ETOW_MAXFEE;i++) {
134 for(
int j=0;j<ETOW_PRESIZE;j++) {
135 emc_p->etow_pre[i][j] = d->preamble[i][j] ;
137 for(
int j=0;j<ETOW_DATSIZE;j++) {
138 if(d->adc[i][j] > 0) emc_p->etow_ch++ ;
139 emc_p->etow[i][j] = d->adc[i][j] ;
147 dd = caller->det(
"esmd")->get(
"adc") ;
148 while(dd && dd->iterate()) {
152 emc_p->esmd_max_fee = ESMD_MAXFEE ;
156 for(
int i=0;i<ESMD_MAXFEE;i++) {
157 for(
int j=0;j<ESMD_PRESIZE;j++) {
158 emc_p->
esmd_pre[i][j] = d->preamble[i][j] ;
160 for(
int j=0;j<ESMD_DATSIZE;j++) {
161 if(d->adc[i][j] > 0) emc_p->esmd_ch++ ;
162 emc_p->esmd[i][j] = d->adc[i][j] ;
171 if((dd=caller->det(
"bsmd")->get(
"adc_non_zs"))) {
172 while(dd->iterate()) {
176 emc_p->bsmd_raw_in = 1 ;
180 int rdo_ix = dd->rdo - 1 ;
181 for(
int i=0;i<BSMD_DATSIZE;i++) {
182 if(d->adc[i] > 0) emc_p->bsmd_ch++ ;
184 emc_p->bsmd[rdo_ix][i] = d->adc[i] ;
187 emc_p->bsmd_cap[rdo_ix] = d->cap ;
190 else if((dd=caller->det(
"bsmd")->get(
"adc"))) {
191 while(dd->iterate()) {
195 emc_p->bsmd_raw_in = 0 ;
199 int rdo_ix = dd->rdo - 1 ;
201 for(
int i=0;i<BSMD_DATSIZE;i++) {
202 if(d->adc[i] > 0) emc_p->bsmd_ch++ ;
204 emc_p->bsmd[rdo_ix][i] = d->adc[i] ;
207 emc_p->bsmd_cap[rdo_ix] = d->cap ;
213 legacy->finalize(1,0,0,0) ;
216 if(found_some)
return legacy ;
u_short esmd_pre[ESMD_MAXFEE][ESMD_PRESIZE]
ADC data.