//////////////////////////////////////////////////////////////////// // // Process only events in a [run, event ID] list. // // This processor is largely based off of EventListProc. // // This is a conditional processor, and so should be used in conjunction // with a ConditionalProcBlock, i.e. an if statement. For an example, // see rat/example/macros/analysis/eventlist.mac. // // This processor allows you to specify a list of runs and event // IDs (GTIDs) to process in a text file. Events with IDs not in the // list are aborted, i.e. no subsequent processors are run. // The typical use case is reading in events from disk, in which case // this processor should be called first in the event loop. // // Note that, since the processing chain is aborted for an event if the // ID is not in the list, skipped events will not be written to disk. // // Each line must contain a run number and GTID separated by a comma. // A run and/or ID may be in decimal format (indicated by a bare number), // hexadecimal (preceded by a "0x"), or octal (preceded by a "0"). // // Author: M. Anderson - contact person // // REVISION HISTORY: // 03 Feb 2023 : M. Anderson - new file // //////////////////////////////////////////////////////////////////// #ifndef __RAT_RunEventListProc___ #define __RAT_RunEventListProc___ #include #include #include #include namespace RAT { namespace DS { class Entry; class EV; } class RunEventListProc : public Processor { public: RunEventListProc() : Processor("RunEventListProc") {} virtual ~RunEventListProc() {} // Handle string 'procset' arguments. // // file - string, name of the file from which to load the event ID list virtual void SetS(const std::string& param, const std::string& value); // Process one event. // // If the event's ID is in the list, continue processing by returning OK; // otherwise, abort further processing by returning ABORT. virtual Processor::Result DSEvent(DS::Run& run, DS::Entry& ds); protected: // Read GTIDs from a file into fEventIDMap bool LoadFile(const std::string& filename); std::unordered_map> fEventIDMap; // Map of [run, event ID] pairs (IDs sorted) to process bool fFileSet = false; // true after the ID list file has been loaded }; } // namespace RAT #endif // __RAT_RunEventListProc__