// $Id$ // // Created Dec 22, 2007 David Lawrence #include #include #include using namespace std; #include #include #include "HDDM/hddm_s.h" void Smear(s_HDDM_t *hddm_s); void ParseCommandLineArguments(int narg, char* argv[]); void Usage(void); void ctrlCHandle(int x); vector INFILENAMES; char *OUTFILENAME = NULL; int QUIT = 0; unsigned int EVENTS_TO_SKIP = 0; unsigned int EVENTS_TO_KEEP = 1; unsigned int SPECIFIC_OFFSET_TO_KEEP = 0; unsigned int SPECIFIC_EVENT_TO_KEEP = 0; bool EVENT_TO_KEEP_MODE = false; #define _DBG_ cout<<__FILE__<<":"<<__LINE__<<" " #define _DBG__ cout<<__FILE__<<":"<<__LINE__<physicsEvents!=HDDM_NULL){ for(unsigned int i=0; iphysicsEvents->mult; i++){ int eventNo = hddm_s->physicsEvents->in[i].eventNo; if((unsigned int)eventNo == SPECIFIC_EVENT_TO_KEEP){ write_this_event = true; QUIT = true; } } } // Check if we're in the range of offsets to write out if(NEvents_read>EVENTS_TO_SKIP)write_this_event = true; // Write this output event to file and free its memory if(write_this_event){ flush_s_HDDM(hddm_s, fout); NEvents++; }else{ flush_s_HDDM(hddm_s, NULL); } // Update ticker time_t now = time(NULL); if(now != last_time){ cout<<" "<=(EVENTS_TO_SKIP+EVENTS_TO_KEEP))break; if(QUIT)break; } // Close input file close_s_HDDM(fin); } // Close output file close_s_HDDM(fout); cout<0){ EVENTS_TO_KEEP=1; EVENTS_TO_SKIP=SPECIFIC_OFFSET_TO_KEEP-1; } if(SPECIFIC_EVENT_TO_KEEP>0){ EVENTS_TO_KEEP=1; EVENTS_TO_SKIP=1000000000; // Large number of events to read in while looking for the specified event } if(OUTFILENAME==NULL){ if(SPECIFIC_OFFSET_TO_KEEP>0){ OUTFILENAME = new char[256]; sprintf(OUTFILENAME,"evt%d.hddm", SPECIFIC_OFFSET_TO_KEEP); }else{ OUTFILENAME = (char*)"culled.hddm"; } } } //----------- // Usage //----------- void Usage(void) { cout<