/*----------------------------------------------------------------------------* GlueX file to ET producer This program reads events from an EVIO(CODA) file(s) and then inserts them into an ET system. *----------------------------------------------------------------------------*/ #include #include #include #include using namespace std; #include #include #include #include #include #include #include #define max_event_size 100000 // Globals et_sys_id id; et_att_id attach; string et_fname(""); useconds_t DELAY; vector source_files; bool LOOP=false; // Routines int InsertEventIntoET(const char *buff, int nwords); void Usage(void); //------------------------ // main //------------------------ int main(int narg,char **argv) { // Loop over command line arguments. for(int i=1; imax_event_size)event_size = max_event_size; InsertEventIntoET(buff, event_size); } // Close EVIO file evClose(handle); } }while(LOOP); return 0; } //------------------------ // InsertEventIntoET //------------------------ int InsertEventIntoET(const char *buff, int nwords) { et_event *pe; int status; char *pdata; // Make sure ET system is still alive. Wait for it if not. if (!et_alive(id)) { et_wait_for_alive(id); } /* get new/unused event */ status = et_event_new(id, attach, &pe, ET_SLEEP, NULL, nwords*sizeof(int)); if (status != ET_OK) { printf("et_producer: error in et_event_new\n"); exit(0); } // Get pointer to data of new event et_event_getdata(pe,(void**)&pdata); // Copy contents into new event memcpy( (char*)pdata, (char*)buff, nwords*sizeof(int)); // put event back into the ET system status = et_event_put(id, attach, pe); if (status != ET_OK) { printf("et_producer: put error\n"); exit(0); } // Delay a little (if specified) to lower the event rate if(DELAY != 0)usleep(DELAY); return 0; } //------------------------ // Usage //------------------------ void Usage(void) { cout<