/////////////////////////////////////////////////////////////////// // // Conditional processor for randomly sampling a fraction of data. // // Author: B Liggins // // REVISION HISTORY: // 2019-02-21 : B Liggins - new file. // /////////////////////////////////////////////////////////////////// #ifndef __RAT_FractionProcessedProc__ #define __RAT_FractionProcessedProc__ #include #include namespace RAT { class FractionProcessedProc : public Processor { public: // Create new count processor. // // Default is for conditional to return OKTRUE every 10th physics event. FractionProcessedProc(); // Destroy count processor. virtual ~FractionProcessedProc(); // Applies the fraction command // // param: should be "number" // value: (0,1] // Throws ParamUnknown if param is not number // Throws ParamInvalid if value is not >0 or <1 virtual void SetD( const std::string& param, const double value ); // Applies the fraction command for the unique case of all events excepted. // // param: should be "number" // value: (0,1] // Throws ParamUnknown if param is not number // Throws ParamInvalid if value is not >0 or <1 virtual void SetI( const std::string& param, const int value ); // Called for each event // // Increment event counters, check if counter is equal to "number" interval. // // run: run information to process // ds: entry information to process // Returns as OKTRUE if counter is equal to interval, OKFALSE otherwise virtual Processor::Result DSEvent( DS::Run& run, DS::Entry& ds ); protected: double fNumber; // Fraction of physics events to pass }; } // namespace RAT #endif