Data Skimming

From GlueXWiki
Jump to: navigation, search

Physical EVIO Skims

  • The "evio_writer" plugin (in sim-recon/src/programs/Utilities/plugins/), can be used to write input EVIO events to an output EVIO file.
    • This plugin defines the DEventWriterEVIO class, which handles writing to file.
    • This plugin works for now, but needs to be updated when we switch to including more than one event per EVIO block/buffer.
  • To create a physical EVIO skim, create your own empty plugin and in the evnt() method call the DEventWriterEVIO class methods. An example is below (from the "2trackskim" plugin):
const DEventWriterEVIO* locEventWriterEVIO = NULL;
locEventLoop->GetSingle(locEventWriterEVIO);
 
//Save EPICS events
vector<const DEPICSvalue*> locEPICSValues;
locEventLoop->Get(locEPICSValues);
if(!locEPICSValues.empty())
{
   locEventWriterEVIO->Write_EVIOEvent(locEventLoop, "2tracks");
   return NOERROR;
}
 
vector<const DChargedTrack*> locChargedTracks;
locEventLoop->Get(locChargedTracks, "PreSelect");
if(locChargedTracks.size() >= 2)
{
   locEventWriterEVIO->Write_EVIOEvent(locEventLoop, "2tracks");
   return NOERROR;
}

To use these, you must run both your plugin and the evio_writer at the same time (you can replace "2trackskim" with your personal skim plugin):

hd_root my_file -PPLUGINS=evio_writer,2trackskim

Physical REST Skims

  • DEventWriterREST: Persistent object created by the DEventWriterREST factory.
    • DEventWriterREST::Write_RESTEvent(string) saves the event into the REST file specified by the string.
//e.g., in your plugin's ::evnt() method:
vector<const DEventWriterREST*> locEventWriterRESTVector;
locEventLoop->Get(locEventWriterRESTVector);
locEventWriterRESTVector[0]->Write_RESTEvent(locEventLoop, "b1pi"); //dana_rest_b1pi.hddm
  • Can write (skim) to many different files in the same plugin, even during multi-threaded execution.
//e.g., in your plugin's ::evnt() method:
if((locNumPositiveTracks >= 2) && (locNumNegativeTracks >= 2))
  locEventWriterRESTVector[0]->Write_RESTEvent(locEventLoop, "2+_2-");
 
if((locNumPositiveTracks >= 3) && (locNumNegativeTracks >= 2))
  locEventWriterRESTVector[0]->Write_RESTEvent(locEventLoop, "3+_2-");

Logical Skims (EventStore)