Skip to content
Snippets Groups Projects
Commit 49481410 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

Improvements for MicroDAQ module:

- Make data decimation configurable
- Addded some documentation
- Some code cleaning (eliminate warnings, move internal classes into detail namespace)
parent d86ec347
No related branches found
No related tags found
No related merge requests found
......@@ -10,8 +10,33 @@
namespace ChimeraTK {
namespace detail {
struct AccessorAttacher;
struct H5storage;
struct DataSpaceCreator;
struct DataWriter;
}
/**
* MicroDAQ module for logging data to HDF5 files. This can be usefull in enviromenents where no sufficient logging
* of data is possible through the control system. Any ChimeraTK::Module can act as a data source. Which variables
* should be logged can be selected through EntityOwner::findTag().
*/
struct MicroDAQ : public ApplicationModule {
using ApplicationModule::ApplicationModule;
/**
* Constructor. decimationFactor and decimationThreshold are configuration constants which determine how the
* data reduction is working. Arrays with a size bigger than decimationThreshold will be decimated by
* decimationFactor before writing to the HDF5 file.
*/
MicroDAQ(EntityOwner *owner, const std::string &name, const std::string &description, uint32_t decimationFactor=10,
uint32_t decimationThreshold=1000, bool eliminateHierarchy=false,
const std::unordered_set<std::string> &tags={})
: ApplicationModule(owner, name, description, eliminateHierarchy, tags),
decimationFactor_(decimationFactor), decimationThreshold_(decimationThreshold) {}
/** Default constructor, creates a non-working module. Can be used for late initialisation. */
MicroDAQ() : decimationFactor_(0), decimationThreshold_(0) {}
ScalarPushInput<int> trigger{this, "trigger", "", "When written, the MicroDAQ write snapshot of all variables "
"to the file", {"MicroDAQ.CONFIG"}};
......@@ -26,11 +51,13 @@ namespace ChimeraTK {
ScalarOutput<uint32_t> currentFile{this, "currentFile", "", "File number currently written to.",
{"MicroDAQ.CONFIG"}};
void mainLoop() override;
/** Add a Module as a source to this DAQ. */
void addSource(const Module &source, const std::string &namePrefix="");
protected:
void mainLoop() override;
template<typename UserType>
VariableNetworkNode getAccessor(const std::string &variableName);
......@@ -50,6 +77,14 @@ namespace ChimeraTK {
/** Overall variable name list, used to detect name collisions */
std::list<std::string> overallVariableList;
/** Parameters for the data decimation */
uint32_t decimationFactor_, decimationThreshold_;
friend struct detail::AccessorAttacher;
friend struct detail::H5storage;
friend struct detail::DataSpaceCreator;
friend struct detail::DataWriter;
};
} // namespace ChimeraTK
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment