/*------------------------------------------------------------------------------*
 * File Name:				 													*
 * Creation: 																	*
 * Purpose: OriginC Source C file												*
 * Copyright (c) ABCD Corp.	2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010		*
 * All Rights Reserved															*
 * 																				*
 * Modification Log:															*
 *	Cheney 2007-7-30 ADD_NEW_FUNC_TO_SUPPORT_PFM_LOAD_FDF						*
 *	Cheney 2007-8-1 CORRECT_LOGIC_OF_LOADING_THEME								*
 *	Cheney/Arvin 2007-9-10 XOP_NEED_SUPPORT_PFM									*
 *	Jasmine 11/05/07 SUBTRACT_BASELINE_BEFORE_PFM_FIT							*
 *	Folger 11/27/07 ADD_OTHER_IMFORMATION_TABLE									*
 *	Sim 11-29-2007 ADD_INFO_INTO_REPORT_GRAPH									*
 *	Folger 12/04/07 ADD_MORE_INFO_TO_REPORT_GRAPH								*
 *	Folger 04/10/08 QA80-11364 OPTIMIZE_CALCULATE_OUTPUT_RESULT_FOR_PA_FIT		*
 *	Hong 04/10/08 v8.0840c PEAK_FIT_REPORT_PEAK_CHARACTERISTICS_TO_SEPARATE_SHEET
 *	Folger 10/14/08 WRONG_NLF_CURVES_CLASS_IN_PA_MAKES_WRONG_REPORT				*
 *	Folger 11/06/08 QA80-12536 v8.0966 LOWER_AND_UPPER_BOUNDS_FAILS_TO_REPORT_IN_PA
 *	Hong 11/15/08 QA80-12584 v8.0972 SBUTRACTED_DATA_IS_FIT_SRC_DATA_AND_SHOULD_REPLACE_DRAW_SRC_DATA
 *	Sophy 11/25/2008 v8.979 SHOULD_RESCALE_REPORT_RESULT_GRAPH_AFTER_PLOT		*
 *	Hong 12/23/08 v8.0990 PA_AVOID_NESTED_LOOP_BY_CACHE_LAST_RESULT				*
 *	Folger 12/23/08 v8.0990 FAST_ACCESS_ABOUT_GETTING_PARAMETER_NAMES_IN_NLFIT_AND_PA
 *	Folger 01/07/09 QA80-12925-P1 v8.0994b ORIGIN_CRASH_IN_PA_FITTING_WHEN_NEW_PROJECT
 *	Hong 01/13/09 v8.0995d IMPROVE_CODE_OF_MEMORY_CONSUMER_IN_PA				*
 *	Sophy 3/5/2009 QA80-12584 v8.0992 FIX_LOSE_SOURCE_CURVE_WHEN_FIT_FROM_GRAPH_ARRANGE_SAME_PLOTS_ON_ONE_GRAPH
 *	Folger 03/06/09 SHOULD_NOT_NEW_SHEET_IF_NO_PEAK_PROPERTIES_OUTPUT			*
 *	Folger 03/19/09 SHOULD_NOT_CLEAR_OUTPUTS_OF_PA_WHEN_AUTO_UPDATED			*
 *  Iris 3/24/2009 FIX_CREATE_NEW_NLFIT_FINDXY_REPORT_WHEN_RECALCULATE			*
 *  Iris 04/14/2009 FIX_NUM_PARAMS_IN_NOTE_TABLE_IS_1							*
 *	Folger 07/07/09 NANOSIZER_PARAMETER_SHARE_INFO_NOT_SHOW_CORRECTLY_IN_REPORT	*
 *	Kyle 08/10/2009 QA80-14077 ADD_PARAMETER_UNIT_TO_FITTING_REPORT				*
 *	Folger 09/25/09 LINEAR_CONSTRAINTS_NOT_WORK_WHEN_RUN_PA_IN_SCRIPT_MODE		*
 *	Folger 10/28/09 QA81-14552 WRONG_REPORT_STATUS_WHEN_CHANGE_PARAM_IN_PA		*
 *------------------------------------------------------------------------------*/

///Cheney/Arvin 2007-9-10 XOP_NEED_SUPPORT_PFM
#ifndef _FITPEAK_H
#define _FITPEAK_H
///end XOP_NEED_SUPPORT_PFM


//typedef bool (* PFDLG_FUNC)(TreeNode& trNode, TreeNode& trFDF, TreeNode& trPFM, MulFuncsFitSession* pFitSession, HWND hWndParent, LPCSTR lpcszTitle, PEVENT_GETN pfn);


class	OC_REGISTERED	FitPeak	:	public	FitNL
{
public:
	FitPeak();
	~FitPeak();
	
	/// Iris 06/29/2007 OVERLOAD_TO_AVOID_DESTROY_FIT_SESSION_POINTER, should delete this pointer in pkfitDlg xfunction when nEventID == CLOSE
	//virtual
	///Sophy 9/24/2008 NEW_PA
	//void	DestroyInternal()
	//{
		//FitterOperation::DestroyInternal();
	//}
	//
	////virtual
	//BOOL	OnKeepOpAfterExecute()
	//{
		//return FitterOperation::OnKeepOpAfterExecute();
	//}
	///end NEW_PA
	///END OVERLOAD_TO_AVOID_DESTROY_FIT_SESSION_POINTER
	
	/// Iris 04/14/2009 FIX_NUM_PARAMS_IN_NOTE_TABLE_IS_1
	//virtual
	bool 	UpdateNumParamsDatasetsNote(TreeNode& trTable, int nTotalNumData, const TreeNode& trOperation);
	///end FIX_NUM_PARAMS_IN_NOTE_TABLE_IS_1
	
public:	
	//MulFuncsFitSession* GetFitSession();
	
	////virtual 
	//BOOL	OperationtoGUI(TreeNode& trOperation, bool bInit, string* pstrSelectedTheme = NULL, bool bSetDefaultInputOnInit = true);	
	
	//virtual
	PEVENT_GETN	GetNewEventFunction() { return NULL; }
	
	///Cheney 2007-8-1 CORRECT_LOGIC_OF_LOADING_THEME
	//virtual
	int OnInitOperationTreeFromOCLT(TreeNode &trOp, TreeNode& trOCLT, bool bInitTree = true);
	///end CORRECT_LOGIC_OF_LOADING_THEME
	
	///Arvin 12/10/07 WRONG_RESIDUAL_DATA_IN_PFW
	//viraul
	bool GetCumRegularResidualData(const TreeNode &trOp, const vector& vX, const vector &vY, FitParameter *psFitParameter, vector& vCumRegular, vector& vFitY, int index, int nMultiplicity, vector &vWeights, matrix &mXs, GraphLayer &grLayAppar, matrix& mResiduals);
	///end WRONG_RESIDUAL_DATA_IN_PFW
	
	///Sophy 7/9/2008 CLEAN_CODE_FIX_FAIL_TO_GET_INPUT_OUT_DATA_NODE_IN_OUTPUTGUIMANAGER
	//virtual
	TreeNode	GetInputDataNode( const TreeNode& trGUI );
	//virtual
	TreeNode	GetOutputNode( const TreeNode& trGUI );
	///end CLEAN_CODE_FIX_FAIL_TO_GET_INPUT_OUT_DATA_NODE_IN_OUTPUTGUIMANAGER
	
	///------ Folger 01/07/09 QA80-12925-P1 v8.0994b ORIGIN_CRASH_IN_PA_FITTING_WHEN_NEW_PROJECT
	///virtual
	void	SetHelperClass(void* pHelper);
	///------ End ORIGIN_CRASH_IN_PA_FITTING_WHEN_NEW_PROJECT
	
	///------ Folger 03/19/09 SHOULD_NOT_CLEAR_OUTPUTS_OF_PA_WHEN_AUTO_UPDATED
	/// virtual
	BOOL			IsSkipCleanOutputBeforeCalculations()		{ return TRUE; }
	///------ End SHOULD_NOT_CLEAR_OUTPUTS_OF_PA_WHEN_AUTO_UPDATED
	
protected:

	// virtual
	BOOL	PostExecute(int nExeMode, BOOL bExeRet)
	{
		return FitterOperation::PostExecute(nExeMode, bExeRet);
	}	
	//virtual
	bool	IsPlotOnSourceGraph(TreeNode& trOp, int nGraphIndex = -1);
	//virtual
	BOOL    Construct(TreeNode& trOperation, int nOption = 0);	
	
	//virtual
	bool	InitOutputGUIManagerPointer(const TreeNode& trGUI); /// Iris 3/26/2008 v8.0832 CLEANUP_OUTPUT_BOOK_SHEET_AREA_TO_CLASS
  
	void	FilterFittingGUI(TreeNode& trOp);
 	// virtual
	void	OnAfterCreateReport(TreeNode &trOp, Worksheet& wksReport, DataRange& rngInput, DataRange &rgReportSheetOutput, int nExeMode, bool bNewResultBookCreatedHidden, int nTotalNumData);
	//virtual 
 	int 	GetDataMode() { return INPUTDATA_RANGES; }
 	
 	//virtual 
 	bool	CalcMultiData(TreeNode& trOp, DataRange& dr, int &nTotalNumData, int nExeMode, DWORD dwExecCntrl = 0);
 	
 	virtual string GetResultModel(const TreeNode& trOperation);		///Jasmine 04/16/08 MODEL_SHOW_MULTI_FUNCS_OR_FITFUNC_IF_ONLY_ONE_IN_FITPEAK
 	
	///Jasmine 11/05/07 SUBTRACT_BASELINE_BEFORE_PFM_FIT
  	//virtual 
  	//double GetBaseLineY0(FitParameter *psFitParameter = NULL) { return 0.0; }
  	//virtual 
  	void ParameterGetShared(vector<int>& vnShared);	///Jasmine 11/08/07 ADD_SHARED_TO_PARAMETER_REPORT_TABLE
  	//virtual 
  	bool IsMulFuncsFit(){return true;}

	///------ Folger 07/07/09 NANOSIZER_PARAMETER_SHARE_INFO_NOT_SHOW_CORRECTLY_IN_REPORT
	/// virtual
	BOOL	IsFitPeak()		{ return TRUE; }
	///------ End NANOSIZER_PARAMETER_SHARE_INFO_NOT_SHOW_CORRECTLY_IN_REPORT

  	/// Hong 12/23/08 v8.0990 PA_AVOID_NESTED_LOOP_BY_CACHE_LAST_RESULT
  	////virtual 		
	//bool	GetPeakNumber(int nIndex, int& nPeakNo, bool& bFuncFirstParam);///Jasmine 11/07/07 ADD_PEAK_NUMBER_TO_PFM_PARAMETERS
	//virtual 		
	bool	GetPeakNumber(int nIndex, int& nPeakNo, bool& bFuncFirstParam, int* pnLastPeakNoWithoutOffset = NULL, int* pnLastPeaksNum = NULL);
	/// end PA_AVOID_NESTED_LOOP_BY_CACHE_LAST_RESULT
	//virtual 
	void 	CumulativeSubtractBaseline(const vector vX, vector& vCumulate, int nNum, double dY0 = 0);
	////virtual 
	//void SetupFittedCurvesPlotDetails(const TreeNode& trOp, GraphLayer& gl, int nFittedPlot, int nNumFittedPlots, int nGraphIndex, bool bIsSourceGraph = false, int nDataIndex = 0, bool bUpdateExistedReportGraph = false);
	///End SUBTRACT_BASELINE_BEFORE_PFM_FIT
	
	//bool 	HasBaselinePeak(TreeNode trPFM);	///Jasmine 11/14/07 FIT_BASELINE_AS_WELL_AS_OTHER_PEAKS
	bool 	HasBaselinePeak();	///Jasmine 06/15/09 NO_NEED_PFM_TREE
	
  	//virtual
  	string GetClassName() {return "FitPeak";}
  	//virtual 
	string GetAnalysisName(int nOption){return _LR("Peak Fit");}
	string GetResultDescription(const TreeNode& trOperation, bool bLong = true);
  	///Cheney 2007-7-30 ADD_NEW_FUNC_TO_SUPPORT_PFM_LOAD_FDF
	//virtual 
	bool	LoadFDFtoTree(LPCSTR lpcszFuncName);
	//virtual 
	void	UpdateFDFTreeFromThemeOrChangeFunc(bool bOpenDlg);
	///end ADD_NEW_FUNC_TO_SUPPORT_PFM_LOAD_FDF
	
	///Cheney 2007-8-1 CORRECT_LOGIC_OF_LOADING_THEME	
	//virtual
	void	ThemeUpdateLastUsed(LPCSTR lpcszClassName, TreeNode& tr, bool bThemesTree = false);
	///end CORRECT_LOGIC_OF_LOADING_THEME
  	//virtual 
  	bool 	AddParamtersSummaryTableToReportTree(TreeNode& trOp, int index, LPCSTR lpcszDataLabel, int nTotalNumData, const FitParameter* pFitParams, const vector<string>& vstrParamNames, const FitDerivedParameter* pstDerivedParams = NULL, int nNumDerivedParams = 0, const RegStats &sRegStats = NULL, vector<bool> &vbIsDerived = NULL, int nMultiplicity = 1, int nNumParamInFunc = 0, int nDupUnit = 0){return false;}
	//------ Folger 12/04/07 ADD_MORE_INFO_TO_REPORT_GRAPH
	virtual bool UpdateSourceGraphFromReport(TreeNode& trOp, const DataRange &rReportSheetOutput, int nTotalNumData, int nExeMode);
	//------
	
	///Arvin 12/05/07 XOP_NEED_SUPPORT_PFW
	//int constructPFWTreeByUserSettings(const TreeNode& trUserSettings, TreeNode& trPFW);
	int	UpdatePFWTreeByUserSettings(TreeNode& trPFW, int nFitType, bool bHasBaseLine = false);
	///end XOP_NEED_SUPPORT_PFW
	
	/// Hong 04/10/08 v8.0840c PEAK_FIT_REPORT_PEAK_CHARACTERISTICS_TO_SEPARATE_SHEET
	// virtual
	void SetOutputBookSheetDefaultName(TreeNode& trGUI);
	// virtual
	string GetResultCurveDefBookName(TreeNode& trOperation, int nDataIndex = 0, int nOption = -1);
	/// end PEAK_FIT_REPORT_PEAK_CHARACTERISTICS_TO_SEPARATE_SHEET	
	/// Hong 04/14/08 v8.0840c PEAK_FIT_REPORT_PEAK_CHARACTERISTICS_TO_SEPARATE_SHEET
	// virtual 
	bool IsOutputPeakCharacterSheet(const TreeNode& trOp);
	/// end PEAK_FIT_REPORT_PEAK_CHARACTERISTICS_TO_SEPARATE_SHEET
	
	/// Iris 11/12/2008 v8.0969 QA80-12584 OUTPUT_BASELINE_AND_SUBTRACTED_DATA_IN_FIT_PEAK_OP
	/// Iris 3/24/2009 FIX_CREATE_NEW_NLFIT_FINDXY_REPORT_WHEN_RECALCULATE
	/*
	//virtual
	bool IsOutputSubtractedDataSheet(const TreeNode& trOp);
	//virtual
	bool IsOutputBaselineDataSheet(const TreeNode& trOp);
	*/
	//virtual
	int IsOutputSubtractedDataSheet(const TreeNode& trOp);
	//virtual
	int IsOutputBaselineDataSheet(const TreeNode& trOp);
	///end FIX_CREATE_NEW_NLFIT_FINDXY_REPORT_WHEN_RECALCULATE
	///end OUTPUT_BASELINE_AND_SUBTRACTED_DATA_IN_FIT_PEAK_OP
	
	//virtual 
	string	GetResultCurveSheetFullName(TreeNode& trOperation, int nIndex = 0, int nOption = OUTPUT_RESULT_CURVE_FIT_CURVES_SHEET);	

	//virtual 
	string  GetResultCurveBookShortName(TreeNode& trOperation, int nIndex = 0, int nOption = -1);
	
	//virtual 
	string 	GetResultBookName(TreeNode& trGUI);
	
	//virtual 
	string 	GetResultSheetName(TreeNode& trGUI);
	
	/// Iris 10/28/2009 QA81-14546 CHANGE_GUI_REPORT_TABLE_LABEL
	/*
	//virtual 
	string	GetReportTableGUIName(TreeNode& trGUI);
	*/
	///end CHANGE_GUI_REPORT_TABLE_LABEL

	//virtual
	bool	IsReportComplexInputDataTable(TreeNode& trOp); /// Iris 4/25/2008 NANOSIZER_REPORT_COMPLEX_INPUT_DATA_WITH_WEIGHT_INFO

	//virtual 
	void SetupFittedCurvesPlotDetails(const TreeNode& trOp, GraphLayer& gl, int nFittedPlot, int nNumFittedPlots, int nGraphIndex, bool bIsSourceGraph = false, int nDataIndex = 0, bool bUpdateExistedReportGraph = false);
	
	/// Hong 11/15/08 QA80-12584 v8.0972 SBUTRACTED_DATA_IS_FIT_SRC_DATA_AND_SHOULD_REPLACE_DRAW_SRC_DATA
	//virtual
	bool	PlotSourceDataInLayer(int nDataIndex, TreeNode& trPlotInfo, TreeNode& trOp, GraphLayer& gl, int nGraphIndex = 0, int nXIndex = 0, int nYIndex = 0);
	//virtual
	bool	CheckReplaceSourceDataPlot(TreeNode& trOperation, int nTotalNumData);
	/// end SBUTRACTED_DATA_IS_FIT_SRC_DATA_AND_SHOULD_REPLACE_DRAW_SRC_DATA
	///Sophy 3/5/2009 QA80-12584 v8.0992 FIX_LOSE_SOURCE_CURVE_WHEN_FIT_FROM_GRAPH_ARRANGE_SAME_PLOTS_ON_ONE_GRAPH
	//virtual
	bool	CheckReplaceSourceRange(TreeNode& trOperation, DataRange& drInput, int nDataIndex = 0);
	///end FIX_LOSE_SOURCE_CURVE_WHEN_FIT_FROM_GRAPH_ARRANGE_SAME_PLOTS_ON_ONE_GRAPH

	///Sophy 11/25/2008 v8.979 SHOULD_RESCALE_REPORT_RESULT_GRAPH_AFTER_PLOT
	//virtual
	void 	RescaleReportGraph(TreeNode& trOp, GraphLayer& gl, int nGraphIndex, int nPicRowIndex, int nPicColIndex, int nFirstFittedPlotIndex);
	///end SHOULD_RESCALE_REPORT_RESULT_GRAPH_AFTER_PLOT
	
	///------ Folger 12/23/08 v8.0990 FAST_ACCESS_ABOUT_GETTING_PARAMETER_NAMES_IN_NLFIT_AND_PA
	/////Sandy add 2008-12-22 virtual
	//int		GetParametersInFunctions(vector<string> &vstrParameterNames, int nNumberFunction, bool bIncNumPostfix){return 0}
	//////virtual
	///------ End FAST_ACCESS_ABOUT_GETTING_PARAMETER_NAMES_IN_NLFIT_AND_PA

	///------ Folger 10/28/09 QA81-14552 WRONG_REPORT_STATUS_WHEN_CHANGE_PARAM_IN_PA
	virtual	string	GetAutoUpdateType(int nExecMode);
	///------ End WRONG_REPORT_STATUS_WHEN_CHANGE_PARAM_IN_PA

private:
	void 	InitFitSessionPointer(TreeNode& trOperation);
	//void	constructFitSettings(TreeNode& trGUI);
	void	constructAddFitQuantitiesToCompute(TreeNode& trGUI);
	void	constructButtonTree(TreeNode& trGUI);
	bool 	beforeCalcMultiData(TreeNode& trOp);
	void	constructReportOptions(TreeNode& trGUI);
	void 	constructReportFieldOptions(TreeNode& trGUI);
	void 	constructPeakReportFieldTree(const TreeNode trGUI, TreeNode &tr);
	void 	constructOutputOptions(TreeNode& trGUI);///Iris 4/10/2008 PEAK_FIT_REPORT_PEAK_CHARACTERISTICS_TO_SEPARATE_SHEET
	void 	modifyFitCurveOptions(TreeNode& trGUI);	///Jasmine 02/01/08 FITCURVE_POINTS_PER_PEAR
	/// Iris 07/23/2007 REMOVE_PLOT_OPTIONS
	//void 	constructPeakReportOptionTree(TreeNode &tr, bool bReportGraph = false);
	void 	constructPeakReportOptionTree(TreeNode &tr);
	///end REMOVE_PLOT_OPTIONS

	///---Sim 11-29-2007 ADD_INFO_INTO_REPORT_GRAPH
	//TreeNode getInfoPeaksFromPageStorage(GraphPage& gp);
	bool 	addInfoToReportGraph(const TreeNode trResult, const TreeNode trFields, GraphLayer& gl);
	///---END ADD_INFO_INTO_REPORT_GRAPH
	//------ Folger 12/04/07 ADD_MORE_INFO_TO_REPORT_GRAPH
	bool 	addMoreInfoToReportGraph(const TreeNode &trCalculation, GraphLayer& gl);
	//------
	virtual bool 	calcPFMPeakResults(TreeNode& trOp);
	virtual void	updateLabelsForPeaksReportTable(TreeNode& trOneResult);
	void 	addFitFuncTable(TreeNode& trOp, bool bDataLabelAsTableMainHeader = true);	///Jasmine 11/10/07 ADD_PFW_FIT_FUNCTIONS_TABLE
	//------ Folger 11/27/07 ADD_OTHER_IMFORMATION_TABLE
	virtual void	addOtherInformationTable(TreeNode& trOp);
	//------
	///Jasmine 10/27/07 QA70-10543 PFM_TREE_STRUCTURE_CHANGE
	//virtual
	bool insertDerivedParamsNames(vector<string>& vstrParameterNames, vector<string>& vsDerivedParamNames, bool bIncPostifx, vector<bool>& vnTarget, int index);
	///End PFM_TREE_STRUCTURE_CHANGE
	///Kyle 08/10/2009 QA80-14077 ADD_PARAMETER_UNIT_TO_FITTING_REPORT
	// virtual
	bool insertDerivedParamsUnits(vector<string>& vstrParameterUnits, vector<string>& vsDerivedParamUnits, vector<bool>& vnTarget, int index);
	///End ADD_PARAMETER_UNIT_TO_FITTING_REPORT

	bool updatePFWTreeAfterFit(TreeNode& trOp);	///Jasmine 12/17/07 SHOULD_UPDATE_PFW_TREE_AFTER_FITTING
	void updateReportGraphColor(const TreeNode& trOp, GraphLayer& gl);		///Jasmine 05/04/08 UPDATE_COLOR_OF_BOTH_REPORT_GRAPH_AND_EMBED_GRAPH_IN_REPORT_SHEET
	//virtual 
	void 	calcAddMultiPeaksFitCurveTable(TreeNode& trOp, TreeNode& trFC, int index, vector& vX, vector& vFitX, vector& vFitY, const tagFitResultCurveDataOptions& fitOptions, FitParameter *psFitParameter, int nMultiplicity = 1);  
	
	
	///Sophy 10/10/2008 CLEAN_PFW_TREE_MOVE_CODE_FROM_PFM_UTILS
	bool	isNeedComputePeaksCharacterization( const PFMPeakCharsRequire xRequireList );
	bool	getFileNameAndParams( const int& nIndex, string& strFullFileName, string& strFuncName, vector& vFitParams );
	void	zeroOffsetParams( vector& vFitParams, vector& vZeroY0Params, TreeNode& trFF );
	///end CLEAN_PFW_TREE_MOVE_CODE_FROM_PFM_UTILS
		
	///Kyle 10/10/08 CLEAN_PFW_TREE_MOVE_CODE_FROM_PFM_UTILS
	/// Hong 01/13/09 v8.0995d IMPROVE_CODE_OF_MEMORY_CONSUMER_IN_PA
	//int calculatePeaksCharacterization( vector& vx, matrix& mPeaksData, /*vector& vXCenter, vector& vXWidth,*/ vector& vyCum,  ///Sandy 2008-12-23 not use vectors move inside 
	//			const PFMPeakCharsRequire xRequireList, PFMPeakCharsVaule* pxPFMPeakCharsValueList,
	//			double dWidthAtPercent = 10, double dAreaAbovePercent = 10, double dCumAreaTo = 0,
	//			int nMomentmethod = MOMENT_METHOD_NUM_INTEGRAL);
	bool	calculatePeaksCharacterization(vector& vX, vector& vY, int nPeakIndex, const IntegrationResult& xCumIntg, const PFMPeakCharsRequire& xRequireList, 
				const PFMPeakCharsVaule& xPFMPeakCharsValueList, double dWidthAtPercent, double dAreaAbovePercent, double dCumAreaTo, int nMomentMethod, 
				double& dAreaFitTCumArea, double& dLastXC, double& dLastWidth, string& strLastFuncName, TreeNode& trLastFDF, NumericFunction& pLastNF);
	/// end IMPROVE_CODE_OF_MEMORY_CONSUMER_IN_PA
	///End CLEAN_PFW_TREE_MOVE_CODE_FROM_PFM_UTILS
	
	//------ Folger 10/14/08 WRONG_NLF_CURVES_CLASS_IN_PA_MAKES_WRONG_REPORT
	/// virtual
	NLFCurvesBase*	createNLFCurvePointer(TreeNode& trOp);
	//------
	
	//------ Folger 11/06/08 QA80-12536 v8.0966 LOWER_AND_UPPER_BOUNDS_FAILS_TO_REPORT_IN_PA
	/// virtual
	bool addOneDataLBUBToParametersTable(TreeNode& trOp, vector<string>& vstrFactors, vector<string>& vsParamNames, vector<string>& vsParamNamesPostfix, int nDataFrom = 0, int nNumMultiplicity = 0);
	//------ End LOWER_AND_UPPER_BOUNDS_FAILS_TO_REPORT_IN_PA
	
	/// Iris 11/12/2008 v8.0969 QA80-12584 OUTPUT_BASELINE_AND_SUBTRACTED_DATA_IN_FIT_PEAK_OP
	bool isOutputSpecialResultCurveSheet(const TreeNode& trBranch);  
	bool calcConstructSubtractedDataResultCurveTable(TreeNode& trOp);
	bool calcConstructBaselineDataResultCurveTable(TreeNode& trOp);
	///end OUTPUT_BASELINE_AND_SUBTRACTED_DATA_IN_FIT_PEAK_OP

	///------ Folger 09/25/09 LINEAR_CONSTRAINTS_NOT_WORK_WHEN_RUN_PA_IN_SCRIPT_MODE
	bool	setNLFitSettings(TreeNode& trOp)		{ return true; }
	///------ End LINEAR_CONSTRAINTS_NOT_WORK_WHEN_RUN_PA_IN_SCRIPT_MODE

//private:
	//Tree		m_trFDF;
	//Tree		m_trPFM;
	
private:
	
	Tree		m_trReportCombo;		//------ Folger 04/10/08 QA80-11364 OPTIMIZE_CALCULATE_OUTPUT_RESULT_FOR_PA_FIT
	///------ Folger 01/07/09 QA80-12925-P1 v8.0994b ORIGIN_CRASH_IN_PA_FITTING_WHEN_NEW_PROJECT
	PeakFitHelperBase*		m_pPeakFitHelper;
	///------ End ORIGIN_CRASH_IN_PA_FITTING_WHEN_NEW_PROJECT
	
	///------ Folger 03/06/09 SHOULD_NOT_NEW_SHEET_IF_NO_PEAK_PROPERTIES_OUTPUT
	bool		m_bNeedCalculatePeakResults;
	///------ End SHOULD_NOT_NEW_SHEET_IF_NO_PEAK_PROPERTIES_OUTPUT
};



#endif ///Cheney/Arvin 2007-9-10 XOP_NEED_SUPPORT_PFM
