This MR aims to improve the speed of the code when running the radiation damage digitisation for pixel. Current implementation is only for the planar sensor, but can be also added for the 3D one.
The idea is simple, currently the code takes the electron-hole pairs in groups, diffuses them (also to nearby sensors) and for each group it adds the charge to the relevant diode, see: https://acode-browser1.usatlas.bnl.gov/lxr/source/athena/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx#0485
The problem is that the linked line is relatively slow.
The MR changes the logic a bit as it first calculates the induced charge without calling the "add()" method which only summs doubles. Only after the loops over the charges are done, the cahrge is really added. This seems to have large impact on the speed of up to 30%.
The expectation is that this should have no impact on the output, however running root-diff on output of 10 events, the following diff is observed:
Py:diff-root INFO 009.InDetSimDataCollection_p3_PixelSDO_Map.m_simdata.8087.second.m_enDeposits.0 -291.15380859375 -> -291.1538391113281 => diff= [-0.00000262%] Py:diff-root INFO 009.InDetSimDataCollection_p3_PixelSDO_Map.m_simdata.14189.second.m_enDeposits.0 0.057994309812784195 -> -10.708404541015625 => diff= [-50.54452654%] Py:diff-root INFO 009.InDetSimDataCollection_p3_PixelSDO_Map.m_simdata.14189.second.m_enDeposits.1 -10.708404541015625 -> 0.057994309812784195 => diff= [50.54452654%] Py:diff-root INFO 009.InDetSimDataCollection_p3_PixelSDO_Map.m_simdata.14189.second.m_links.0.m_barcode 20 -> 200485 => diff= [-49.99002519%] Py:diff-root INFO 009.InDetSimDataCollection_p3_PixelSDO_Map.m_simdata.14189.second.m_links.1.m_barcode 200485 -> 20 => diff= [49.99002519%] Py:diff-root INFO Found  identical leaves Py:diff-root INFO Found  different leaves Py:diff-root INFO [InDetSimDataCollection_p3_PixelSDO_Map.m_simdata.second.m_enDeposits]: 3 leaves differ Py:diff-root INFO [InDetSimDataCollection_p3_PixelSDO_Map.m_simdata.second.m_links.m_barcode]: 2 leaves differ Py:diff-root ERROR files differ!
Which shows that for some reason 2 values out of 2542812 are swapped (?). This of course has no real impact, but it is a bit puzzling where this comes from.
The MR was originally prepared by @tbisanz