// $Id$ // // Created Oct 10, 2013 David Lawrence #include "hddm_cull_events.h" #include using namespace hddm_r; // NOTE: The REST format files claim they are in a compressed format that // the C API cannot handle so we use the C++ API here //----------- // Process_r -- HDDM REST format //----------- void Process_r(unsigned int &NEvents, unsigned int &NEvents_read) { // Output file cout<<" output file: "<> xrec; NEvents_read++; bool write_this_event = false; // Loop over physics events within this event and see if one // has the event number of interest class ReconstructedPhysicsEvent &reconstructedPhysicsEvent = xrec.getReconstructedPhysicsEvent(); if(EVENT_TO_KEEP_MODE){ // need to check if reconstructedPhysicsEvent is valid!! int eventNo = reconstructedPhysicsEvent.getEventNo(); 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){ ostr << xrec; NEvents++; } // Update ticker time_t now = time(NULL); if(now != last_time){ cout<<" "<=(EVENTS_TO_SKIP+EVENTS_TO_KEEP))break; if(QUIT)break; }catch(...){ break; } } } }