Skip to content

CombinedMuonTrackBuilder::addIDMSerrors try to write it in a way that is clear we do not alias between unique pointers.

CombinedMuonTrackBuilder::addIDMSerrors try to write it in a way that

  1. Is obvious we do not modify the input,
  2. and we get a new track or nullptr in case of failure.
  3. In case of nullptr we do not update anything, in case of non nullptr we might want to eventually update the combined Track.

@sroe, @jojungge , @emoyse please take a look.

I am somehow convinced that the previous kind of worked but it was expressed in a bit round about way. It allowed 2 unique_ptr to alias (Which is principle we do not want).
And then was checking if they do alias as a way to determine if the newTrack makes sense otherwise was taking some cleanup action.

Seems simpler

A. to pass the input by const (stays untouched so why use non-const)

B. return nullptras failure rather than a newTrack that alias the input in case of "error" (nothing happened). As this also should be easier to check.

As a side note we should look at the alignment tools and see if can pass get const ref rather than const ptr.

Edited by Christos Anastopoulos

Merge request reports