/* * Sampler.h * * Created on: Sep 27, 2012 * Author: dklein */ #ifndef SAMPLER_H_ #define SAMPLER_H_ #include #include "base/FairRunAna.h" #include "base/FairTask.h" #include "Device.h" #include "SamplerTask.h" namespace Highway { /** * Reads simulated digis from a root file and samples the digi as a time-series UDP stream. * Must be initialized with the filename to the root file and the name of the sub-detector * branch, whose digis should be streamed. * * The purpose of this class is to provide a data source of digis very similar to the * future detector output at the point where the detector is connected to the online * computing farm. For the development of online analysis algorithms, it is very important * to simulate the future detector output as realistic as possible to evaluate the * feasibility and quality of the various possible online analysis features. */ #define DEVICE Device<0,1> class Sampler: public DEVICE { private: FairRunAna* fFairRunAna; SamplerTask* fSamplerTask; std::string fInputFile; // Filename of a root file containing the simulated digis. std::string fParFile; std::string fBranch; // The name of the sub-detector branch to stream the digis from. int fEventRate; int fEventCounter; public: enum { InputFile = DEVICE::Last, Branch, ParFile, EventRate }; Sampler(); virtual ~Sampler(); virtual void Init(); virtual void Run(); void Log(int intervalInMs); void ResetEventCounter(); virtual void SetProperty(int key, std::string value, int slot = 0); virtual std::string GetProperty(int key, std::string default_ = "", int slot = 0); virtual void SetProperty(int key, int value, int slot = 0); virtual int GetProperty(int key, int default_ = 0, int slot = 0); }; } /* namespace Highway */ #endif /* SAMPLER_H_ */