New "misspelling" check functionality added in TRestMetadata

We added a new feature in TRestMetadata that, if the parameter in rml is not found with corresponding data member, it will check if there are any similar data members. If true, it will prompt a warning saying that you may misspell the parameter.

Here similar means differences in strings. We introduced a new method DiffString() in TRestStringHelper to count differences of two input strings. It returns the number of different characters. So if the unidentified parameter is matched with a data member with <= 2 differences, we regard it as “misspelling”, as in case that the two characters are swapped. For example, in TRestRawSignalAnalysisProcess rml section, we write:

<parameter name="piontThreshold" value="2" />

It will prompt:

-- Warning : TRestRawSignalAnalysisProcess::ReadAllParameters(): parameter "piontThreshold" not recognized for automatic load, did you mean "pointThreshold" ?
Press a KEY to continue ...

and ask for verification. Previously in this case we won’t know that the parameter is unset until we see the wrong result. I think this feature is very helpful.

Now this feature is enabled on those metadata classes which has automatic parameter loading, i.e, with data members linked to parameters, and calling TRestMetadata::ReadAllParameters() in their InitFromConfigFile() method. In future we will continue updating processes to implement automatic parameter loading.

Yes, thats extremely helpful! It is awesome!

I imagine that will also solve the issue with upper/lower case indentification, since it will warn us of mispelling such as pointThresHOld.

We should keep in mind to update InitFromConfigFile at most of the classes, where that is possible.

Yes, the upper/lower misspelling can also be identified.

1 Like