-
Notifications
You must be signed in to change notification settings - Fork 11
TRestMetadata : Initializing REST classes through XML format configuration files
We first talk about the most important class - TRestMetadata. This abstract class brings basic funcitionality to REST, and is the base class of many REST classes. Data member of a TRestMetadata-inherited class is defined inside an rml file, an xml encoded configuration file. With this configuration file the inherited class can be initialized. The concrete operation of its initialization is defined in the method InitFromConfigFile() by the inherited class. This method is called during start up of the class by another method LoadConfigFromFile(), which parses the rml file or section as preparation.
TRestMetadata itself is inherited from the class TNamed. It allows the save/load functionality into/from a ROOT file. In many cases loading from ROOT file will be much quicker than reading and parsing an rml file.
TRestMetadata inherited class should have a name and a title. They are from TNamed class. In addition, we also define two basic attritubes: verbose level and storage. They controls the amount of words printed on screen and whether the class should be saved, respectively. All those will automatically be set from the rml config file.
One major type of the inherited class is called metadata. They contain data of, for example, the geometry of a simulation, the properties of a gas, the readout pattern used to "pixelize" data, etc. Usually we will first instantiate and save a metadata class with an rml file. In pratical use, we can just read it from the saved ROOT file.
Another family of TRestMetadata inherited class is called core class. Their rml file gives, for example, the parameters of an analysis, the targets of a plot, the processes to load of an analysis, etc. core class can do specific jobs according to the configuration.
TRestMetadata also provides some utilities for the inherited class. The most commonly used methods are: GetParameter(), GetElement(), GetChar(), GetDataMemberWithName(), etc. It also defines leveled string output tools: fout, essential, info, debug, etc. See them in the REST class reference page.