19 void Usage(
string mess);
34 int main(
int narg,
char *argv[])
47 uint32_t *buff =
new uint32_t[1000000];
55 cout << hdevio->
err_mess.str() << endl;
70 bool write_block =
false;
71 switch(br.block_type){
87 write_block = ((idx++)%
PRESCALE) == 0;
91 ifs.seekg(br.pos, ios::beg);
92 int nbytes = br.block_len*4;
93 ifs.read((
char*)buff, nbytes);
94 if( ifs.gcount() != nbytes ){
95 _DBG_<<
"Unable to read entire block (is file truncated?)" << endl;
98 ofs.write((
char*)buff, nbytes);
106 if(buff)
delete[] buff;
117 cout <<
"Usage:" << endl;
119 cout <<
" hdevio_pare [options] file.evio [file2.evio ...]" << endl;
121 cout <<
"options:" << endl;
122 cout <<
" -h, --help Print this usage statement" << endl;
123 cout <<
" -o file.evio Set name of EVIO ouput file" << endl;
124 cout <<
" -p prescale Prescale factor for EVIO events (not L1 trigger events)" << endl;
125 cout <<
" -bor Don't save BOR events" << endl;
126 cout <<
" -epics Don't save EPICS events" << endl;
127 cout <<
" -coda Don't save CODA control events" << endl;
130 if(mess !=
"") cout << endl << mess << endl << endl;
141 if(narg<2)
Usage(
"You must supply a filename!");
143 for(
int i=1; i<narg; i++){
144 string arg = argv[i];
145 string next = (i+1)<narg ? argv[i+1]:
"";
147 if(arg ==
"-h" || arg ==
"--help")
Usage();
149 else if(arg ==
"-p" ){
PRESCALE = atoi(next.c_str()); i++;}
150 else if(arg ==
"-bor" ){
KEEP_BOR =
false;}
151 else if(arg ==
"-epics"){
KEEP_EPICS =
false;}
152 else if(arg ==
"-coda" ){
KEEP_CODA =
false;}
153 else if(arg[0] ==
'-') {cout <<
"Unknown option \""<<arg<<
"\" !" << endl; exit(-1);}
vector< EVIOBlockRecord > & GetEVIOBlockRecords(void)
void ParseCommandLineArguments(int &narg, char *argv[])
void Usage(JApplication &app)
int main(int argc, char *argv[])
vector< string > filenames