framework icon indicating copy to clipboard operation
framework copied to clipboard

Implement automatic parameter loading for all the metadata classes

Open nkx111 opened this issue 4 years ago • 2 comments

It is time to implement automatic parameter loading from rml text to all the class data members. We shall verify each metadata classes that:

  1. All the data members are named following our naming convention
  2. The method InitFromConfigFile() has only simple logic of parameter reading: fXXX=StringToDouble(GetParameter("xXX","10"))
  3. The data members have default values

nkx111 avatar Apr 16 '21 08:04 nkx111

Will constructions such as this one be properly interpreted by default?

std::vector <double> fTimeWindow;
fTimeWindow = StringToElements(GetParameter("timeWindow", "-1,-1"), ",");

This construction appears for example at: https://github.com/rest-for-physics/rawlib/blob/master/src/TRestRawVetoAnalysisProcess.cxx

jgalan avatar Apr 21 '21 19:04 jgalan

Yes, it could. But somehow the string to vector style is different. The string form should be like: {1,2,3,4,5}, which is wrapped with {} as root command line prints.

root [0] std::vector<double> vec;
root [1] any(vec).ParseString("{1,2,3,0.5}"); 
root [2] vec  // will print: (std::vector<double> &) { 1.0000000, 2.0000000, 3.0000000, 0.50000000 }

It is implemented in https://github.com/rest-for-physics/framework/blob/f83c73dae97f781827e55edbf8e3cf0336a360ac/source/framework/core/src/startup.cpp#L181

nkx111 avatar Apr 22 '21 02:04 nkx111