Tertiary particle production and target optimization of the H2 beam line in the SPS North Area