split all in .h and .cc, add plot util, separate sim and fit loops