Skip to content

Remove un-needed std::string allocations from GsfExtrapolator , when Not running in DEBUG

This class has a method printState that when in Debug prints relevant info

void Trk::GsfExtrapolator::printState( const std::string& description, 
const Trk::TrackParameters& trackParameters ) const
 {
 std::string label = description + " (r,phi,z), (phi, theta, q/p):\t(";
   ATH_MSG_DEBUG( label
      << trackParameters.position().perp() << ", " << trackParameters.position().phi() 
     ........

By calling it you end up allocating one std::string even if you print nothing (i.e when not in DEBUG). Typically , it was called inside if statements checking we are in DEBUG mode. But not always as one can see from a e/gamma profile of running over 20 events.

Screenshot_2019-05-29_at_19.04.19

It is not a huge gain obviously but it took me some time to figure why one will allocate std::string from the GsfExtrapolator in production mode...

@amorley I guess we could clean up or make these facilites better . For now just move them inside the if DEBUG statements.

Edited by Christos Anastopoulos

Merge request reports