FairMQ/fairmq/FairMQSampler.h
2014-01-28 11:56:08 +01:00

61 lines
1.9 KiB
C++

/**
* FairMQSampler.h
*
* @since 2012-09-27
* @author D. Klein, A. Rybalchenko
*/
#ifndef FAIRMQSAMPLER_H_
#define FAIRMQSAMPLER_H_
#include "FairRunAna.h"
#include "FairTask.h"
#include "FairMQDevice.h"
#include "FairMQSamplerTask.h"
/**
* 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.
*/
class FairMQSampler: public FairMQDevice
{
public:
enum {
InputFile = FairMQDevice::Last,
Branch,
ParFile,
EventRate
};
FairMQSampler();
virtual ~FairMQSampler();
void ResetEventCounter();
virtual void ListenToCommands();
virtual void SetProperty(const int key, const string& value, const int slot = 0);
virtual string GetProperty(const int key, const string& default_ = "", const int slot = 0);
virtual void SetProperty(const int key, const int value, const int slot = 0);
virtual int GetProperty(const int key, const int default_ = 0, const int slot = 0);
protected:
FairRunAna* fFairRunAna;
int fNumEvents;
FairMQSamplerTask* fSamplerTask;
string fInputFile; // Filename of a root file containing the simulated digis.
string fParFile;
string fBranch; // The name of the sub-detector branch to stream the digis from.
int fEventRate;
int fEventCounter;
virtual void Init();
virtual void Run();
};
#endif /* FAIRMQSAMPLER_H_ */