Refactor the code.  Refs #6747.

Refactor the code such that
1. Calculation of background from input is unified;
2. Output workspace of caluclation and fit/MC are unified;
3. Fix a bug on calculating Rp and Rwp.