Skip to content

MuonIdHelpers - Perform consistency checks by seperate methods

Hi everybody,

many methods of the MuonIdHelpers have the design pattern of

 <blah>, bool check =false, bool* isValid = nullptr) const;

Given that the methods, in general, have multiple arguments, this layer of default arguments makes them even more intransparent and also I believe it can lead to some unforeseen memory corruptions if the isValid pointer is not set properly.

To improve this, I updated all the interfaces of the IDhelpers. The two default arguments are removed and there is a second version with

<blah>, bool& isValid) const;

If this one is called, the validity of the generated identifier is checked.

  • Improvement of the string -> int conversion of the stationNames: the mapping is now stored in std::map<std::string, int> & std::map<int,std::string> objects. Before it was a single vector. The conversion from string -> int happened via looping over each element & calling the compare function. However, for endcap stations this meant an order of 30-50 unsuccessfully comparisons. In addition, the validity check should be speed up, as the conversion from int -> stringNames and subsequent char comparison is largely omitted. Instead the station names relevant for the technology are cached in a std::set
Edited by Johannes Junggeburth

Merge request reports

Loading