merge fit code from paolo_devel_effAccCorr to master branch