added code for doFit==8 (missing: output file and synchronization with macro 2)