![]() |
KaliVeda
Toolkit for HIC analysis
|
KaliVeda provides a class which can write source code for other classes: KVClassFactory. At its simplest, only a class name and short description are required in order to generate a fully ROOT-compatible class from the KaliVeda command line. Giving a base class to derive your new class from will copy and implement all constructors from the base class:
will generate the following MyClass.h
and MyClass.cpp
files which includes a template doxygen comment block for documenting your class (not shown):
You can also add methods to your class before generating the code, or use template files to define complicated methods which can be reused in many classes. See the KVClassFactory documentation and associated examples.
The header file KVConfig.h which is configured and generated at build time contains several symbols which may be of help when writing your own code using KaliVeda. KVConfig.h is #include
d by most class headers in the toolkit; in case of doubt, just add #include "KVConfig.h"
in your code.
The following symbols are mainly to ensure portability of code:
Symbol | Meaning/Function |
---|---|
WITH_MFM | can read GANIL MFM format data (KVMFMDataFileReader) |
WITH_MESYTEC | can read Mesytec acquisition data |
WITH_BUILTIN_GRU | can read legacy GANIL EBYEDAT format data (KVGANILDataReader) |
External software | |
WITH_GEMINI | GEMINI++ interface KVGemini exists (see Optional software) |
WITH_ZMQ | compiled with ZeroMQ support (KVZMQMessage) |
WITH_BOOST | compiled with boost library support |
WITH_PROTOBUF | can read Google Proto Buffer data (KVProtobufDataReader) |
WITH_RSQLITE | has SQLite interfaces (KVSQLite::database, KVSQLROOTFile) |
Hardware | |
WITH_MULTICORE_CPU | integer value equal to number of processors/cores |
C++ standard | |
WITH_CPP11 | C++11 language can be used |
WITH_CPP14 | C++14 & C++11 language can be used |
WITH_CPP17 | C++17,C++14 & C++11 can be used |
WITH_CPP20 | C++20, C++17,C++14 & C++11 can be used |
Beginning with v1.15, KaliVeda adheres to modern CMake usage and provides exported CMake targets with transitive dependencies for other projects to use.
Compiling the following simple executable,
requires the following CMakeLists.txt
:
Configuration of the build then proceeds like this:
Note that the dependencies of the KaliVeda targets on ROOT and any other packages are taken care of by the transitive properties of the exported targets.
After configuring, your code can be compiled like so:
Here are the main CMake targets exported by KaliVeda. They are available after a call to find_package(KaliVeda)
if variable KaliVeda_FOUND
is TRUE
:
Target | library |
---|---|
kaliveda::kaliveda | libkaliveda.so |
kaliveda::kaliveda-indra | libkaliveda-indra.so |
kaliveda::kaliveda-fazia | libkaliveda-fazia.so |
kaliveda::kaliveda-indrafazia | libkaliveda-indrafazia.so |
In order to be able to use your own classes on the kaliveda
(or root
) command line, or write objects of your classes in ROOT files, you need to compile them into a shared library containing the necessary ROOT dictionary entries (see I/O of custom classes in the ROOT manual for more details).
This can be done using the root_generate_dictionary
CMake macro provided by ROOT (see Using CMake in the ROOT manual). Assuming you have a directory with class source files and a LinkDef.h
file like this:
myProj/ class1.h class1.cpp class2.h class2.cpp LinkDef.h
the minimum cmake-based project to build the shared library and other necessary files will look like this: