Implementing a module

Modules are atomic units designed to perform tasks on events. They can read all the information contained in Event and, if needed, they can also modify the Event piece that the software administrator allowed to write. We encourage the developer not to write fat modules with thousands lines of code, all the leading code should be arranged in service classes to ensure code reusability. Therefore modules have to be intended as interfaces between Diana and service classes performing all the leading operations.

Modules have to implement at least the three following methods:

Modules can control the Diana flow by executing again the Sequence they belong to, this feature has been designed for algorithms that need multiple iterations. In order to perform this operation use the following methods:

Modules can save temporary data, i.e. objects that will not be written in output files and live only inside the Diana run. These object are useful to share informations beetwen modules that doesn't need to be dumped on output files:

Instead of using the usual printf or cout output stream functions use the following commands that support the printf syntax, each of them will print messages on the screen only if the verbose level set in the config file is greater equal than the used one:

Modules can read configuration parameters from config file. if the parameter is not found the default value provided by the user is used. Available methods are: GetInt, GetDouble, GetString, GetBool. Below is a config file entry example for a generic module:



module ModuleName ##mandatory parameters # set verbosity level verbosity = info # set if the module have to be loaded enable = true # set if the module have save data into the event or not. storedata = true ##module specific parameters myvarint = 1 myvardouble = 1.0 myvarstring = hellocuore! myvarbool = true endmod