Skip to content

SiSpacePointsSeedMaker_ATLxk : Do not use ref for plain floats

SiSpacePointsSeedMaker_ATLxk : Do not use ref for plain floats

There are 2 things here

  1. Is passing const float as is and not as const float& is cheaper and conveys more

  2. This piece of code is a bit "insidious"

void InDet::SiSpacePointsSeedMaker_ATLxk::production3Sp
(EventData& data, ... 

const float& ipt2K = data.ipt2K;
const float& ipt2C = data.ipt2C;
const float& COFK  = data.COFK;
const float& maxd0cut = m_maxdImpact;
const float& maxd0cutstrips = m_maxdImpactDecays;
const float& zmin  = data.zminU;
const float& zmax  = data.zmaxU;
const float& dzdrmax = data.dzdrmax;
const float& dzdrmin = data.dzdrmin;

as this is a valid possibility https://godbolt.org/z/jdY8Gz945 . Aka is clear that we can not change the data.ipt2K value via the "alias" ipt2K . Since the alias is const. But nothing forbids data.ipt2K it self to change (this is not const) .

Looking the history I assume const float is what we want . If yes again float should be cheaper than reference here.

Merge request reports