/*----------------------------------------------------------------------------* * Copyright (c) 1998 Southeastern Universities Research Association, * * Thomas Jefferson National Accelerator Facility * * * * This software was developed under a United States Government license * * described in the NOTICE file included as part of this distribution. * * * * Author: Carl Timmer * * timmer@jlab.org Jefferson Lab, MS-12H * * Phone: (757) 269-5130 12000 Jefferson Ave. * * Fax: (757) 269-5800 Newport News, VA 23606 * * * *----------------------------------------------------------------------------* * * Description: * A very simple ET event producer * *----------------------------------------------------------------------------*/ #include #include #include using namespace std; #include #include #include "et.h" #define _DBG_ cerr<<__FILE__<<":"<<__LINE__<<" " #define _DBG__ cerr<<__FILE__<<":"<<__LINE__<0 && next[0]=='-')) missing_arg = true; fname = next; } if(arg == "-h"){ if(arg=="" || (next.size()>0 && next[0]=='-')) missing_arg = true; host = next; } if(arg == "-p"){ if(arg=="" || (next.size()>0 && next[0]=='-')) missing_arg = true; port = atoi(next.c_str()); } if(arg == "-e"){ if(arg=="" || (next.size()>0 && next[0]=='-')) missing_arg = true; events_per_chunk = atoi(next.c_str()); } if(arg == "-s"){ if(arg=="" || (next.size()>0 && next[0]=='-')) missing_arg = true; event_size = atoi(next.c_str()); } if(arg == "-c"){ if(arg=="" || (next.size()>0 && next[0]=='-')) missing_arg = true; max_chunks = atoi(next.c_str()); } if(arg == "-m"){ use_muticast = true; } if(missing_arg){ cout << endl; cout << "Option \"" << arg << "\" requires and argument!" << endl; cout << endl; Usage(); } } char max_chunks_str[256]; sprintf(max_chunks_str, "%d", max_chunks); cout << endl; cout << "Will attach with the following:" <0 && Nchunks>=max_chunks)break; // Wait for ET system to revive if (!et_alive(id)) { et_wait_for_alive(id); } } // while(alive) delete[] pes; double kB_sent = ((double)Nchunks*(double)events_per_chunk*(double)event_size)/1024.0; double MB_sent = kB_sent/1024.0; double GB_sent = MB_sent/1000.0; int value = (int)round(kB_sent); string units="kB"; if(kB_sent>10000.0){value = (int)round(MB_sent); units="MB";} if(MB_sent>10000.0){value = (int)round(GB_sent); units="GB";} cout << Nchunks << " chunks (=" << Nchunks*events_per_chunk << " events = " << value << " " << units << ") sent" << endl; cout << kB_sent << "kB" < -h host -p port" << endl; cout << endl; cout << " options:" <