Difference between revisions of "Data Skimming"
From GlueXWiki
(→Physical REST Skims) |
|||
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. | ||
+ | |||
+ | * This plugin enables writing when called | ||
+ | I've also created a skimming plugin "2trackskim" (in the same folder) which uses "evio_writer" to write out events with 2 track candidates into a new EVIO file. It also writes out all EPICS events. Look at this plugin for an example on how to use "evio_writer." | ||
+ | |||
+ | <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 all of the following plugins at once (you can replace "2trackskim" with your personal skim plugin): | ||
+ | |||
+ | hd_root my_file -PPLUGINS=DAQ,TTab,evio_writer,2trackskim | ||
+ | |||
+ | |||
+ | |||
== Physical REST Skims == | == Physical REST Skims == | ||
Revision as of 15:00, 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.
- This plugin enables writing when called
I've also created a skimming plugin "2trackskim" (in the same folder) which uses "evio_writer" to write out events with 2 track candidates into a new EVIO file. It also writes out all EPICS events. Look at this plugin for an example on how to use "evio_writer."
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 all of the following plugins at once (you can replace "2trackskim" with your personal skim plugin):
hd_root my_file -PPLUGINS=DAQ,TTab,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-");