Difference between revisions of "Data Skimming"

From GlueXWiki
Jump to: navigation, search
(Created page with "== Physical EVIO Skims == == Physical REST Skims == == Logical Skims (EventStore) ==")
 
(Physical EVIO Skims)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Physical EVIO Skims ==
 
== 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 <span style="color:#0000FF">DEventWriterEVIO</span> 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 <span style="color:#0000FF">DEventWriterEVIO</span> class methods. An example is below (from the "2trackskim" plugin):
 +
 +
<syntaxhighlight>
 +
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;
 +
}
 +
</syntaxhighlight>
 +
 +
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):
 +
 +
<syntaxhighlight>
 +
hd_root my_file -PPLUGINS=evio_writer,2trackskim
 +
</syntaxhighlight>
 +
 
== Physical REST Skims ==
 
== Physical REST Skims ==
 +
 +
* '''DEventWriterREST''': Persistent object created by the <span style="color:#0000FF">DEventWriterREST</span> factory.
 +
** <span style="color:#0000FF">DEventWriterREST</span>::<span style="color:#008000">Write_RESTEvent</span>(<span style="color:#0000FF">string</span>) saves the event into the REST file specified by the string.
 +
 +
<syntaxhighlight>
 +
//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
 +
</syntaxhighlight>
 +
 +
* Can write (skim) to many different files in the same plugin, even during multi-threaded execution.
 +
<syntaxhighlight>
 +
//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-");
 +
</syntaxhighlight>
 +
 
== Logical Skims (EventStore) ==
 
== Logical Skims (EventStore) ==

Latest revision as of 15:04, 21 January 2015

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)