// $Id: mcsmear.cc 2388 2007-01-10 16:46:03Z davidl $ // // Created June 22, 2005 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 Nevents_to_merge; vector loop_source; vector INFILENAMES; char *OUTFILENAME = NULL; int QUIT = 0; int MAXEVENTS=-1; #define _DBG_ cout<<__FILE__<<":"<<__LINE__<<" " #define _DBG__ cout<<__FILE__<<":"<<__LINE__< instreams; for(unsigned int i=0; i events; // Loop over inputs bool done=false; events.clear(); for(unsigned int i=0; iphysicsEvents->mult; // Add enough PhysicsEvents to hold all of our inputs output_hddm_s->physicsEvents = make_s_PhysicsEvents(Nphysics_events); // Copy PhysicsEvents for inputs, transferring ownership to // output event and freeing memory from the "heads" of the // input events. unsigned int &mult = output_hddm_s->physicsEvents->mult; mult = 0; for(unsigned int i=0; iphysicsEvents->mult; j++){ output_hddm_s->physicsEvents->in[mult++] = input_hddm_s->physicsEvents->in[j]; // Set the 2 pointers in PhysicsEvent to HDDM_NULL so they aren't freed // when the input event is freed. input_hddm_s->physicsEvents->in[j].reactions = (s_Reactions_t*)HDDM_NULL; input_hddm_s->physicsEvents->in[j].hitView = (s_HitView_t*)HDDM_NULL; } // Free this input event flush_s_HDDM(input_hddm_s, NULL); } // Write this output event to file and free its memory flush_s_HDDM(output_hddm_s, fout); NEvents++; // Update ticker time_t now = time(NULL); if(now != last_time){ cout<<" "<0){ if(NEvents>=MAXEVENTS)break; } } // Close all inputs for(unsigned int i=0; i