1528 lines
49 KiB
C++
1528 lines
49 KiB
C++
|
#include "BgWork.h"
|
|||
|
#include <QStringList>
|
|||
|
#include "ROI.h"
|
|||
|
#include "Fit.h"
|
|||
|
#include "QDateTime"
|
|||
|
#include "ROIConUncer.h"
|
|||
|
#include "XeConUncer.h"
|
|||
|
#include "MDC.h"
|
|||
|
#include <QCoreApplication>
|
|||
|
#include <QDir>
|
|||
|
#include <QtMath>
|
|||
|
#include <QMutex>
|
|||
|
#define STRING_END QLatin1String("\r\n")
|
|||
|
using namespace RadionuclideData;
|
|||
|
const double CBgWork::cst_fixed_volXe=0.0;
|
|||
|
const double CBgWork::cst_defvolXe=1.1; // Value substituted when Xe volume read as below 0.1 ml - warning issued.
|
|||
|
bool CBgWork::m_initAlgorithm=false;
|
|||
|
|
|||
|
CBgWork::CBgWork()
|
|||
|
{
|
|||
|
m_lastError=E_NONE;
|
|||
|
}
|
|||
|
|
|||
|
CBgWork::CBgWork(BgFileI& _fileHanle)
|
|||
|
{
|
|||
|
m_flag_read_file = SetPara(_fileHanle);
|
|||
|
}
|
|||
|
CBgWork::~CBgWork()
|
|||
|
{
|
|||
|
;
|
|||
|
}
|
|||
|
|
|||
|
void CBgWork::SetBgFile(BgFileI &_fileHanle)
|
|||
|
{
|
|||
|
m_flag_read_file = SetPara(_fileHanle);
|
|||
|
}
|
|||
|
BgAllGenerate CBgWork::GetAllValue()
|
|||
|
{
|
|||
|
return m_allGenerate;
|
|||
|
}
|
|||
|
BgUINeed CBgWork::GetUIValue()
|
|||
|
{
|
|||
|
return m_uiNeed;
|
|||
|
}
|
|||
|
BgErrorType CBgWork::GetLastError()
|
|||
|
{
|
|||
|
return m_lastError;
|
|||
|
}
|
|||
|
|
|||
|
BgSample CBgWork::GetSampleUseData()
|
|||
|
{
|
|||
|
return m_sampleData;
|
|||
|
}
|
|||
|
BgGas CBgWork::GetGasUseData()
|
|||
|
{
|
|||
|
return m_gasData;
|
|||
|
}
|
|||
|
|
|||
|
BgDetbgr CBgWork::GetDetbgrUseData()
|
|||
|
{
|
|||
|
return m_detbgrData;
|
|||
|
}
|
|||
|
|
|||
|
void CBgWork::RenameAnalyseFile(BgFileI& _fileHanle)
|
|||
|
{
|
|||
|
m_flag_read_file = SetPara(_fileHanle);
|
|||
|
}
|
|||
|
bool CBgWork::MutialAnalyse(BgCalibratePara& _BgCalPara)
|
|||
|
{
|
|||
|
if(!m_flag_read_file)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bool bRet = false;
|
|||
|
m_bgCalPara = _BgCalPara;
|
|||
|
bRet = Analyse();
|
|||
|
m_bgCalPara.bApplyNewCalicDetBg=false;
|
|||
|
m_bgCalPara.bApplyNewCalicGasBg=false;
|
|||
|
m_bgCalPara.bApplyNewCalicSample=false;
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
bool CBgWork::GetFileFittingPara(QVector<double>& _watch_x,QVector<double> &_watch_y,QVector<double> &_fittingPara)
|
|||
|
{
|
|||
|
double vari=0;
|
|||
|
bool bRet= false;
|
|||
|
switch (global::fit_type)
|
|||
|
{
|
|||
|
case liner:
|
|||
|
bRet = CFit::LinearFit(_watch_x,_watch_y,_fittingPara,vari);
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
bRet = CFit::_2PloynimialFit(_watch_y,_watch_x,_fittingPara,vari);
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
bRet = CFit::_3PloynimialFit(_watch_x,_watch_y,_fittingPara,vari);
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
bRet = CFit::GaussFit(_watch_x,_watch_y,_fittingPara,vari);
|
|||
|
break;
|
|||
|
case _default:
|
|||
|
bRet = CFit::_2PloynimialFit(_watch_y,_watch_x,_fittingPara,vari);
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
bool CBgWork::GetFileFittingData(QVector<double>& _watch,QVector<double> &_fittingPara,QVector<int>& _rData)
|
|||
|
{
|
|||
|
bool bRet= false;
|
|||
|
switch (global::fit_type)
|
|||
|
{
|
|||
|
case liner:
|
|||
|
bRet = CFit::LinearFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
bRet = CFit::_3PloynimialFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
bRet = CFit::GaussFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case _default:
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
bool CBgWork::GetFileFittingData(QVector<double>& _watch,QVector<double> &_fittingPara,QVector<double>& _rData)
|
|||
|
{
|
|||
|
bool bRet= false;
|
|||
|
switch (global::fit_type)
|
|||
|
{
|
|||
|
case liner:
|
|||
|
bRet = CFit::LinearFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
bRet = CFit::_3PloynimialFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
bRet = CFit::GaussFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case _default:
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
bool CBgWork::GetFittingPara(QVector<double>& _watch_x,QVector<double> &_watch_y,FitType _fittype,QVector<double> &_fittingPara)
|
|||
|
{
|
|||
|
double vari=0;
|
|||
|
bool bRet= false;
|
|||
|
switch (_fittype)
|
|||
|
{
|
|||
|
case liner:
|
|||
|
bRet = CFit::LinearFit(_watch_x,_watch_y,_fittingPara,vari);
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
bRet = CFit::_2PloynimialFit(_watch_y,_watch_x,_fittingPara,vari);
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
bRet = CFit::_3PloynimialFit(_watch_x,_watch_y,_fittingPara,vari);
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
bRet = CFit::GaussFit(_watch_x,_watch_y,_fittingPara,vari);
|
|||
|
break;
|
|||
|
case _default:
|
|||
|
bRet = CFit::_2PloynimialFit(_watch_y,_watch_x,_fittingPara,vari);
|
|||
|
break;
|
|||
|
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
bool CBgWork::GetFittingData(QVector<double>& _watch,FitType _fittype,QVector<double> &_fittingPara,QVector<int>& _rData)
|
|||
|
{
|
|||
|
bool bRet= false;
|
|||
|
switch (_fittype)
|
|||
|
{
|
|||
|
case liner:
|
|||
|
bRet = CFit::LinearFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
bRet = CFit::_3PloynimialFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
bRet = CFit::GaussFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case _default:
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
bool CBgWork::GetFittingData(QVector<double>& _watch,FitType _fittype,QVector<double> &_fittingPara,QVector<double>& _rData)
|
|||
|
{
|
|||
|
bool bRet= false;
|
|||
|
switch (_fittype)
|
|||
|
{
|
|||
|
case liner:
|
|||
|
bRet = CFit::LinearFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
bRet = CFit::_3PloynimialFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
bRet = CFit::GaussFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
case _default:
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_watch,_fittingPara,_rData);
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
double CBgWork::CaculateXeActivity(QVector<double>&_watch_x,QVector<double>&_watch_y,const double& _lamadaXe,const double& _acqRealTime,QVector<double> &_fittingPara,int _fittingType)
|
|||
|
{
|
|||
|
QVector<double> fittingPara;
|
|||
|
double vari=0;
|
|||
|
bool bRet = false;
|
|||
|
double rData=0;
|
|||
|
int pos=0;
|
|||
|
switch (_fittingType)
|
|||
|
{
|
|||
|
case liner:
|
|||
|
bRet = CFit::LinearFit(_watch_x,_watch_y,fittingPara,vari);
|
|||
|
if(fittingPara.size()>1)
|
|||
|
{
|
|||
|
pos = 1;
|
|||
|
}
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
bRet = CFit::_2PloynimialFit(_watch_y,_watch_x,fittingPara,vari);
|
|||
|
if(fittingPara.size()>0)
|
|||
|
{
|
|||
|
pos=0;
|
|||
|
}
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
bRet = CFit::_3PloynimialFit(_watch_x,_watch_y,fittingPara,vari);
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
bRet = CFit::GaussFit(_watch_x,_watch_y,fittingPara,vari);
|
|||
|
break;
|
|||
|
case _default:
|
|||
|
bRet = CFit::_2PloynimialFit(_watch_y,_watch_x,fittingPara,vari);
|
|||
|
if(fittingPara.size()>0)
|
|||
|
{
|
|||
|
pos=0;
|
|||
|
}
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
rData = fittingPara.at(pos)*(_lamadaXe*_acqRealTime)/(1-qExp(-_lamadaXe*_acqRealTime));
|
|||
|
_fittingPara = fittingPara;
|
|||
|
}
|
|||
|
return rData;
|
|||
|
}
|
|||
|
QString CBgWork::GetFittingDescriptionByType(int _type)
|
|||
|
{
|
|||
|
QString rData;
|
|||
|
switch (_type) {
|
|||
|
case liner:
|
|||
|
rData = QLatin1String("LinearFitEquation :y = int(_fit_para[0]*_watch_x[n..]+_fit_para[1])");
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
rData = QLatin1String("_2PloynimialFitEquation :y = int(_fit_para[0]+_fit_para[1]*_watch_x[n..]+_fit_para[2]*_watch_x[n..]*_watch_x[n..]+0.5)");
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
rData = QLatin1String("_3PloynimialFitEquation");
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
rData = QLatin1String("GaussFitEquation");
|
|||
|
break;
|
|||
|
case _default:
|
|||
|
rData = QLatin1String("_2PloynimialFitEquation :y = int(_fit_para[0]+_fit_para[1]*_watch_x[n..]+_fit_para[2]*_watch_x[n..]*_watch_x[n..]+0.5)");
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
return rData;
|
|||
|
}
|
|||
|
QString CBgWork::GetFittingEquation(int _type)
|
|||
|
{
|
|||
|
QString rData;
|
|||
|
switch (_type) {
|
|||
|
case liner:
|
|||
|
rData = QLatin1String("(?1)+(?2)*x");
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
rData = QLatin1String("(?1)+(?2)*x+(?3)x*x");
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
rData = QLatin1String("_3PloynimialFitEquation");
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
rData = QLatin1String("GaussFitEquation");
|
|||
|
break;
|
|||
|
case _default:
|
|||
|
rData = QLatin1String("(?1)+(?2)*x+(?3)x*x");
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
return rData;
|
|||
|
}
|
|||
|
|
|||
|
bool CBgWork::CalcBgBoundary(BgROILimit& _roi_limit,BgEC& _b_g_e_c,BgCalibratePara& _BgCalPara,BgBoundary& _output,BgFittingPara& _fittingPara)
|
|||
|
{
|
|||
|
bool bRet=true;
|
|||
|
QVector<double> b_e_cal=_BgCalPara.b_e_cal;//b_系数
|
|||
|
QVector<double> b_cal_e;
|
|||
|
double vari; //误差
|
|||
|
double variEC;
|
|||
|
|
|||
|
if(_BgCalPara.b_e_cal_flag == _default)
|
|||
|
{
|
|||
|
_BgCalPara.b_e_cal_flag = global::fit_type;
|
|||
|
}
|
|||
|
switch (_BgCalPara.b_e_cal_flag)
|
|||
|
{
|
|||
|
case liner:
|
|||
|
if(b_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::LinearFit(_b_g_e_c.b_e_c.channel,_b_g_e_c.b_e_c.energy,b_e_cal,vari);
|
|||
|
CFit::LinearFit(_b_g_e_c.b_e_c.energy,_b_g_e_c.b_e_c.channel,b_cal_e,variEC);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::LinearFitEquation(_roi_limit.ROI_B_start_x1,b_e_cal,_output.ROI_B_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::LinearFitEquation(_roi_limit.ROI_B_stop_x2,b_e_cal,_output.ROI_B_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
if(b_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::_2PloynimialFit(_b_g_e_c.b_e_c.channel,_b_g_e_c.b_e_c.energy,b_e_cal,vari);
|
|||
|
CFit::_2PloynimialFit(_b_g_e_c.b_e_c.energy,_b_g_e_c.b_e_c.channel,b_cal_e,variEC);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_B_start_x1,b_e_cal,_output.ROI_B_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_B_stop_x2,b_e_cal,_output.ROI_B_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
if(b_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::_3PloynimialFit(_b_g_e_c.b_e_c.channel,_b_g_e_c.b_e_c.energy,b_e_cal,vari);
|
|||
|
CFit::_3PloynimialFit(_b_g_e_c.b_e_c.energy,_b_g_e_c.b_e_c.channel,b_cal_e,variEC);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::_3PloynimialFitEquation(_roi_limit.ROI_B_start_x1,b_e_cal,_output.ROI_B_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::_3PloynimialFitEquation(_roi_limit.ROI_B_stop_x2,b_e_cal,_output.ROI_B_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
if(b_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::GaussFit(_b_g_e_c.b_e_c.channel,_b_g_e_c.b_e_c.energy,b_e_cal,vari);
|
|||
|
CFit::GaussFit(_b_g_e_c.b_e_c.energy,_b_g_e_c.b_e_c.channel,b_cal_e,variEC);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::GaussFitEquation(_roi_limit.ROI_B_start_x1,b_e_cal,_output.ROI_B_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::GaussFitEquation(_roi_limit.ROI_B_stop_x2,b_e_cal,_output.ROI_B_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
default:
|
|||
|
if(b_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::_2PloynimialFit(_b_g_e_c.b_e_c.channel,_b_g_e_c.b_e_c.energy,b_e_cal,vari);
|
|||
|
CFit::_2PloynimialFit(_b_g_e_c.b_e_c.energy,_b_g_e_c.b_e_c.channel,b_cal_e,variEC);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_B_start_x1,b_e_cal,_output.ROI_B_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_B_stop_x2,b_e_cal,_output.ROI_B_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
_fittingPara.b_fitting_type = _BgCalPara.b_e_cal_flag;
|
|||
|
_fittingPara.b_fitting_e_c = b_e_cal;
|
|||
|
_fittingPara.b_fitting_c_e = b_cal_e;
|
|||
|
//g_能 刻度方程系数计算
|
|||
|
QVector<double> g_e_cal=_BgCalPara.g_e_cal;//g_系数
|
|||
|
QVector<double> g_cal_e;
|
|||
|
if(_BgCalPara.g_e_cal_flag == _default)
|
|||
|
{
|
|||
|
_BgCalPara.g_e_cal_flag = global::fit_type;
|
|||
|
}
|
|||
|
switch (_BgCalPara.g_e_cal_flag)
|
|||
|
{
|
|||
|
case liner:
|
|||
|
if(g_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::LinearFit(_b_g_e_c.g_e_c.channel,_b_g_e_c.g_e_c.energy,g_e_cal,vari);
|
|||
|
CFit::LinearFit(_b_g_e_c.g_e_c.energy,_b_g_e_c.g_e_c.channel,g_cal_e,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::LinearFitEquation(_roi_limit.ROI_G_start_y1,g_e_cal,_output.ROI_G_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::LinearFitEquation(_roi_limit.ROI_G_stop_y2,g_e_cal,_output.ROI_G_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
if(g_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::_2PloynimialFit(_b_g_e_c.g_e_c.channel,_b_g_e_c.g_e_c.energy,g_e_cal,vari);
|
|||
|
CFit::_2PloynimialFit(_b_g_e_c.g_e_c.energy,_b_g_e_c.g_e_c.channel,g_cal_e,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_G_start_y1,g_e_cal,_output.ROI_G_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_G_stop_y2,g_e_cal,_output.ROI_G_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
if(g_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::_3PloynimialFit(_b_g_e_c.g_e_c.channel,_b_g_e_c.g_e_c.energy,g_e_cal,vari);
|
|||
|
CFit::_3PloynimialFit(_b_g_e_c.g_e_c.energy,_b_g_e_c.g_e_c.channel,g_cal_e,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::_3PloynimialFitEquation(_roi_limit.ROI_G_start_y1,g_e_cal,_output.ROI_G_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::_3PloynimialFitEquation(_roi_limit.ROI_G_stop_y2,g_e_cal,_output.ROI_G_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
if(g_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::GaussFit(_b_g_e_c.g_e_c.channel,_b_g_e_c.g_e_c.energy,g_e_cal,vari);
|
|||
|
CFit::GaussFit(_b_g_e_c.g_e_c.energy,_b_g_e_c.g_e_c.channel,g_cal_e,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::GaussFitEquation(_roi_limit.ROI_G_start_y1,g_e_cal,_output.ROI_G_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::GaussFitEquation(_roi_limit.ROI_G_stop_y2,g_e_cal,_output.ROI_G_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
default:
|
|||
|
if(g_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::_2PloynimialFit(_b_g_e_c.g_e_c.channel,_b_g_e_c.g_e_c.energy,g_e_cal,vari);
|
|||
|
CFit::_2PloynimialFit(_b_g_e_c.g_e_c.energy,_b_g_e_c.g_e_c.channel,g_cal_e,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_G_start_y1,g_e_cal,_output.ROI_G_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_G_stop_y2,g_e_cal,_output.ROI_G_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
_fittingPara.g_fitting_type = _BgCalPara.g_e_cal_flag;
|
|||
|
_fittingPara.g_fitting_e_c = g_e_cal;
|
|||
|
_fittingPara.g_fitting_c_e = g_cal_e;
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
|
|||
|
bool CBgWork::CalcBgBoundary(BgROILimit& _roi_limit,BgEC& _b_g_e_c,BgCalibratePara& _BgCalPara,BgBoundary& _output)
|
|||
|
{
|
|||
|
bool bRet=true;
|
|||
|
QVector<double> b_e_cal=_BgCalPara.b_e_cal;//b_系数
|
|||
|
double vari; //误差
|
|||
|
|
|||
|
if(_BgCalPara.b_e_cal_flag == _default)
|
|||
|
{
|
|||
|
_BgCalPara.b_e_cal_flag = global::fit_type;
|
|||
|
}
|
|||
|
switch (_BgCalPara.b_e_cal_flag)
|
|||
|
{
|
|||
|
case liner:
|
|||
|
if(b_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::LinearFit(_b_g_e_c.b_e_c.channel,_b_g_e_c.b_e_c.energy,b_e_cal,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::LinearFitEquation(_roi_limit.ROI_B_start_x1,b_e_cal,_output.ROI_B_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::LinearFitEquation(_roi_limit.ROI_B_stop_x2,b_e_cal,_output.ROI_B_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
if(b_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::_2PloynimialFit(_b_g_e_c.b_e_c.channel,_b_g_e_c.b_e_c.energy,b_e_cal,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_B_start_x1,b_e_cal,_output.ROI_B_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_B_stop_x2,b_e_cal,_output.ROI_B_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
if(b_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::_3PloynimialFit(_b_g_e_c.b_e_c.channel,_b_g_e_c.b_e_c.energy,b_e_cal,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::_3PloynimialFitEquation(_roi_limit.ROI_B_start_x1,b_e_cal,_output.ROI_B_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::_3PloynimialFitEquation(_roi_limit.ROI_B_stop_x2,b_e_cal,_output.ROI_B_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
if(b_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::GaussFit(_b_g_e_c.b_e_c.channel,_b_g_e_c.b_e_c.energy,b_e_cal,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::GaussFitEquation(_roi_limit.ROI_B_start_x1,b_e_cal,_output.ROI_B_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::GaussFitEquation(_roi_limit.ROI_B_stop_x2,b_e_cal,_output.ROI_B_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
default:
|
|||
|
if(b_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::_2PloynimialFit(_b_g_e_c.b_e_c.channel,_b_g_e_c.b_e_c.energy,b_e_cal,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_B_start_x1,b_e_cal,_output.ROI_B_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_B_stop_x2,b_e_cal,_output.ROI_B_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//g_能 刻度方程系数计算
|
|||
|
QVector<double> g_e_cal=_BgCalPara.g_e_cal;//g_系数
|
|||
|
if(_BgCalPara.g_e_cal_flag == _default)
|
|||
|
{
|
|||
|
_BgCalPara.g_e_cal_flag = global::fit_type;
|
|||
|
}
|
|||
|
switch (_BgCalPara.g_e_cal_flag)
|
|||
|
{
|
|||
|
case liner:
|
|||
|
if(g_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::LinearFit(_b_g_e_c.g_e_c.channel,_b_g_e_c.g_e_c.energy,g_e_cal,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::LinearFitEquation(_roi_limit.ROI_G_start_y1,g_e_cal,_output.ROI_G_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::LinearFitEquation(_roi_limit.ROI_G_stop_y2,g_e_cal,_output.ROI_G_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
case poly2:
|
|||
|
if(g_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::_2PloynimialFit(_b_g_e_c.g_e_c.channel,_b_g_e_c.g_e_c.energy,g_e_cal,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_G_start_y1,g_e_cal,_output.ROI_G_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_G_stop_y2,g_e_cal,_output.ROI_G_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
case poly3:
|
|||
|
if(g_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::_3PloynimialFit(_b_g_e_c.g_e_c.channel,_b_g_e_c.g_e_c.energy,g_e_cal,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::_3PloynimialFitEquation(_roi_limit.ROI_G_start_y1,g_e_cal,_output.ROI_G_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::_3PloynimialFitEquation(_roi_limit.ROI_G_stop_y2,g_e_cal,_output.ROI_G_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
case gauss:
|
|||
|
if(g_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::GaussFit(_b_g_e_c.g_e_c.channel,_b_g_e_c.g_e_c.energy,g_e_cal,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::GaussFitEquation(_roi_limit.ROI_G_start_y1,g_e_cal,_output.ROI_G_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::GaussFitEquation(_roi_limit.ROI_G_stop_y2,g_e_cal,_output.ROI_G_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
default:
|
|||
|
if(g_e_cal.isEmpty())
|
|||
|
{
|
|||
|
bRet = CFit::_2PloynimialFit(_b_g_e_c.g_e_c.channel,_b_g_e_c.g_e_c.energy,g_e_cal,vari);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_G_start_y1,g_e_cal,_output.ROI_G_Boundary_start);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
bRet = CFit::_2PloynimialFitEquation(_roi_limit.ROI_G_stop_y2,g_e_cal,_output.ROI_G_Boundary_stop);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
|
|||
|
bool CBgWork::ExtractSROIcts()
|
|||
|
{
|
|||
|
bool bRet=false;
|
|||
|
//样品谱
|
|||
|
BgBoundary boundary;
|
|||
|
BgCalibratePara dbgCalPara;
|
|||
|
if(m_bgCalPara.bApplyNewCalicSample)
|
|||
|
{
|
|||
|
dbgCalPara = m_bgCalPara;
|
|||
|
}
|
|||
|
bRet = CalcBgBoundary(m_sampleData.s_limit,m_sampleData.s_e_c,dbgCalPara,boundary,m_allGenerate.BgSample.s_fittingPara);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
//感兴趣区输入参数赋值
|
|||
|
ROIctsI s_roiCtsI;
|
|||
|
s_roiCtsI.histogram.b_channels = m_sampleData.s_histogram.b_channels;
|
|||
|
s_roiCtsI.histogram.g_channels = m_sampleData.s_histogram.g_channels;
|
|||
|
s_roiCtsI.histogram.counts = m_sampleData.s_histogram.counts;
|
|||
|
s_roiCtsI.roi_boundary.ROI_B_start_x = boundary.ROI_B_Boundary_start;
|
|||
|
s_roiCtsI.roi_boundary.ROI_B_stop_x = boundary.ROI_B_Boundary_stop;
|
|||
|
s_roiCtsI.roi_boundary.ROI_G_start_y = boundary.ROI_G_Boundary_start;
|
|||
|
s_roiCtsI.roi_boundary.ROI_G_stop_y = boundary.ROI_G_Boundary_stop;
|
|||
|
//提取感兴趣计数 以及 中间数据
|
|||
|
ROIctsO s_roiCtsO;
|
|||
|
bRet = CROI::ExtractROIcts(s_roiCtsI,s_roiCtsO);
|
|||
|
m_allGenerate.BgSample.s_roi_cts = s_roiCtsO.roi_cts;
|
|||
|
m_allGenerate.BgSample.s_boungdary = boundary;
|
|||
|
return true;
|
|||
|
}
|
|||
|
bool CBgWork::ExtractGROIcts()
|
|||
|
{
|
|||
|
bool bRet=false;
|
|||
|
//气体本底谱
|
|||
|
//样品谱
|
|||
|
BgBoundary boundary;
|
|||
|
BgCalibratePara dbgCalPara;
|
|||
|
if(m_bgCalPara.bApplyNewCalicGasBg)
|
|||
|
{
|
|||
|
dbgCalPara = m_bgCalPara;
|
|||
|
}
|
|||
|
bRet = CalcBgBoundary(m_gasData.g_limit,m_gasData.g_e_c,dbgCalPara,boundary,m_allGenerate.BgGas.g_fittingPara);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
//感兴趣区输入参数赋值
|
|||
|
ROIctsI g_roiCtsI;
|
|||
|
g_roiCtsI.histogram.b_channels = m_gasData.g_histogram.b_channels;
|
|||
|
g_roiCtsI.histogram.g_channels = m_gasData.g_histogram.g_channels;
|
|||
|
g_roiCtsI.histogram.counts = m_gasData.g_histogram.counts;
|
|||
|
g_roiCtsI.roi_boundary.ROI_B_start_x = boundary.ROI_B_Boundary_start;
|
|||
|
g_roiCtsI.roi_boundary.ROI_B_stop_x = boundary.ROI_B_Boundary_stop;
|
|||
|
g_roiCtsI.roi_boundary.ROI_G_start_y = boundary.ROI_G_Boundary_start;
|
|||
|
g_roiCtsI.roi_boundary.ROI_G_stop_y = boundary.ROI_G_Boundary_stop;
|
|||
|
//提取感兴趣计数 以及 中间数据
|
|||
|
ROIctsO g_roiCtsO;
|
|||
|
bRet = CROI::ExtractROIcts(g_roiCtsI,g_roiCtsO);
|
|||
|
m_allGenerate.BgGas.g_boungdary = boundary;
|
|||
|
m_allGenerate.BgGas.g_roi_cts = g_roiCtsO.roi_cts;
|
|||
|
return true;
|
|||
|
}
|
|||
|
bool CBgWork::ExtractDROIcts()
|
|||
|
{
|
|||
|
bool bRet=false;
|
|||
|
//探测器本地谱
|
|||
|
BgBoundary boundary;
|
|||
|
//使用默认刻度系数
|
|||
|
// m_UII.b_e_cal_flag = false;
|
|||
|
// m_UII.g_e_cal_flag = false;
|
|||
|
BgCalibratePara dbgCalPara;
|
|||
|
if(m_bgCalPara.bApplyNewCalicDetBg)
|
|||
|
{
|
|||
|
dbgCalPara = m_bgCalPara;
|
|||
|
}
|
|||
|
bRet = CalcBgBoundary(m_detbgrData.d_limit,m_detbgrData.d_e_c,dbgCalPara,boundary,m_allGenerate.BgDetbgr.d_fittingPara);
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
//感兴趣区输入参数赋值
|
|||
|
ROIctsI d_roiCtsI;
|
|||
|
d_roiCtsI.histogram.b_channels = m_detbgrData.d_histogram.b_channels;
|
|||
|
d_roiCtsI.histogram.g_channels = m_detbgrData.d_histogram.g_channels;
|
|||
|
d_roiCtsI.histogram.counts = m_detbgrData.d_histogram.counts;
|
|||
|
d_roiCtsI.roi_boundary.ROI_B_start_x = boundary.ROI_B_Boundary_start;
|
|||
|
d_roiCtsI.roi_boundary.ROI_B_stop_x = boundary.ROI_B_Boundary_stop;
|
|||
|
d_roiCtsI.roi_boundary.ROI_G_start_y = boundary.ROI_G_Boundary_start;
|
|||
|
d_roiCtsI.roi_boundary.ROI_G_stop_y = boundary.ROI_G_Boundary_stop;
|
|||
|
//提取感兴趣计数 以及 中间数据
|
|||
|
ROIctsO d_roiCtsO;
|
|||
|
bRet = CROI::ExtractROIcts(d_roiCtsI,d_roiCtsO);
|
|||
|
m_allGenerate.BgDetbgr.d_boungdary=boundary;
|
|||
|
m_allGenerate.BgDetbgr.d_roi_cts = d_roiCtsO.roi_cts;
|
|||
|
return true;
|
|||
|
}
|
|||
|
bool CBgWork::SDetuctDcts()
|
|||
|
{
|
|||
|
bool bRet =false;
|
|||
|
NetXectsI s_d_XectsI;
|
|||
|
s_d_XectsI.roi_ratios = m_sampleData.s_count_ratio;
|
|||
|
s_d_XectsI.roi_cts = m_allGenerate.BgSample.s_roi_cts;
|
|||
|
s_d_XectsI.roi_detbg_cts =m_allGenerate.BgDetbgr.d_roi_cts;
|
|||
|
s_d_XectsI.ratio = m_sampleData.s_acquisition_live_time/m_detbgrData.s_acquisition_live_time;
|
|||
|
bRet = CROI::CalcNetXects(s_d_XectsI,m_allGenerate.BgSample.s_deduct_d_cts);
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
bool CBgWork::GDetuctDcts()
|
|||
|
{
|
|||
|
bool bRet =false;
|
|||
|
NetXectsI g_d_XectsI;
|
|||
|
g_d_XectsI.roi_ratios = m_gasData.g_count_ratio;
|
|||
|
g_d_XectsI.roi_cts = m_allGenerate.BgGas.g_roi_cts;
|
|||
|
g_d_XectsI.roi_detbg_cts =m_allGenerate.BgDetbgr.d_roi_cts;
|
|||
|
g_d_XectsI.ratio = m_gasData.g_acquisition_live_time/m_detbgrData.s_acquisition_live_time;
|
|||
|
bRet = CROI::CalcNetXects(g_d_XectsI,m_allGenerate.BgGas.g_deduct_d_cts);
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
bool CBgWork::ExtractNetCounts()
|
|||
|
{
|
|||
|
bool bRet = false;
|
|||
|
NetCountsI netCountsI;
|
|||
|
netCountsI.g_netXe = m_allGenerate.BgGas.g_deduct_d_cts;
|
|||
|
netCountsI.s_netXe = m_allGenerate.BgSample.s_deduct_d_cts;
|
|||
|
netCountsI.time.g_acquisition_live_time = m_gasData.g_acquisition_live_time;
|
|||
|
netCountsI.time.g_acquisition_real_time = m_gasData.g_acquisition_real_time;
|
|||
|
netCountsI.time.s_acquisition_live_time = m_sampleData.s_acquisition_live_time;
|
|||
|
netCountsI.time.s_acquisition_real_time = m_sampleData.s_acquisition_real_time;
|
|||
|
netCountsI.time.gtos_acqStartDiff = SubtractTime(\
|
|||
|
m_gasData.g_acquisition_start_date+m_gasData.g_acquisition_start_time,\
|
|||
|
m_sampleData.s_acquisition_start_date+m_sampleData.s_acquisition_start_time);
|
|||
|
bRet = CROI::CalcNetCounts(netCountsI,m_allGenerate.BgOther.ROI_net_coutns);
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
double CBgWork::SubtractTime(QString _begin,QString _end)
|
|||
|
{
|
|||
|
double begin = QDateTime::fromString(_begin,"yyyy/MM/ddhh:mm:ss.z").toTime_t();
|
|||
|
double end = QDateTime::fromString(_end,"yyyy/MM/ddhh:mm:ss.z").toTime_t();
|
|||
|
return (end - begin);
|
|||
|
}
|
|||
|
bool CBgWork::AutoAnalyse()
|
|||
|
{
|
|||
|
// if(!m_flag_read_file)
|
|||
|
// {
|
|||
|
// return false;
|
|||
|
// }
|
|||
|
bool bRet = false;
|
|||
|
bRet = Analyse();
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
|
|||
|
bool CBgWork::Analyse()
|
|||
|
{
|
|||
|
bool bRet = false;
|
|||
|
//初始化算法全局变量
|
|||
|
/*
|
|||
|
if(!m_initAlgorithm)
|
|||
|
{
|
|||
|
m_initAlgorithm=true;
|
|||
|
QString cfg_file = QCoreApplication::applicationDirPath()+QDir::separator()+QLatin1String("cfg/");
|
|||
|
QDir dir(cfg_file);
|
|||
|
if(!dir.exists())
|
|||
|
{
|
|||
|
dir.mkpath(dir.absolutePath());
|
|||
|
}
|
|||
|
cfg_file = cfg_file+QLatin1String("algorithm.ini");
|
|||
|
|
|||
|
if(QFile::exists(cfg_file))
|
|||
|
{
|
|||
|
global::InitAlgorithmVar(cfg_file);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
global::GenerateAlgorithmVar(cfg_file);
|
|||
|
}
|
|||
|
|
|||
|
}*/
|
|||
|
//样品谱感兴趣区计数
|
|||
|
bRet = ExtractSROIcts();
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
m_lastError = E_SAMPLE_ROI_CTS;
|
|||
|
return false;
|
|||
|
}
|
|||
|
//气体本底谱感兴趣区计数
|
|||
|
bRet = ExtractGROIcts();
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
m_lastError = E_GAS_ROI_CTS;
|
|||
|
return false;
|
|||
|
}
|
|||
|
//探测器本体谱感兴趣区计数
|
|||
|
bRet = ExtractDROIcts();
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
m_lastError = E_DETA_ROI_CTS;
|
|||
|
return false;
|
|||
|
}
|
|||
|
//样品普扣除探测器本底谱计数
|
|||
|
bRet = SDetuctDcts();
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
m_lastError = E_S_DETUCT_D_CTS;
|
|||
|
return false;
|
|||
|
}
|
|||
|
//气体本底谱扣除探测器本底谱计数
|
|||
|
bRet = GDetuctDcts();
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
m_lastError = E_G_DETUCT_D_CTS;
|
|||
|
return false;
|
|||
|
}
|
|||
|
//获取净计数
|
|||
|
bRet = ExtractNetCounts();
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
m_lastError = E_NET_COUNTS;
|
|||
|
return false;
|
|||
|
}
|
|||
|
//获取感兴趣浓度和不平衡度
|
|||
|
bRet = CalcRoiConUncer();
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
m_lastError = E_ROI_CON_UNCER;
|
|||
|
return false;
|
|||
|
}
|
|||
|
//获取同位素浓度和不确定度
|
|||
|
bRet = CalcXeConUncer();
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
m_lastError = E_XE_CON_UNCER;
|
|||
|
return false;
|
|||
|
}
|
|||
|
//MDC计算
|
|||
|
bRet =MDC();
|
|||
|
if(!bRet)
|
|||
|
{
|
|||
|
m_lastError = E_MDC;
|
|||
|
return false;
|
|||
|
}
|
|||
|
return true;
|
|||
|
}
|
|||
|
bool CBgWork::MDC()
|
|||
|
{
|
|||
|
bool bRet = false;
|
|||
|
MDCI mdcI;
|
|||
|
MDCO mdcO;
|
|||
|
mdcI.ROI_con_counts_factor = m_allGenerate.BgOther.ROI_con_counts_factor;
|
|||
|
mdcI.ROI_con_uncer = m_allGenerate.BgOther.ROI_con_uncer;
|
|||
|
mdcI.ROI_netcts = m_allGenerate.BgOther.ROI_net_coutns;
|
|||
|
bRet = CMdc::MDC(mdcI,m_allGenerate.BgOther.XeType,mdcO);
|
|||
|
m_allGenerate.BgOther.MDCPara.MDC_Xe131m = mdcO.mdcPara.MDC_Xe131m;
|
|||
|
m_allGenerate.BgOther.MDCPara.MDC_Xe133 = mdcO.mdcPara.MDC_Xe133;
|
|||
|
m_allGenerate.BgOther.MDCPara.MDC_Xe135 = mdcO.mdcPara.MDC_Xe135;
|
|||
|
m_allGenerate.BgOther.MDCPara.MDC_Xe133m = mdcO.mdcPara.MDC_Xe133m;
|
|||
|
m_allGenerate.BgOther.MDCPara.MDC = mdcO.mdcPara.MDC;
|
|||
|
m_allGenerate.BgOther.MDCPara.MDC_CTS = mdcO.mdcPara.MDC_CTS;
|
|||
|
|
|||
|
m_allGenerate.BgOther.LCPara.LC_Xe131m = mdcO.lcPara.LC_Xe131m;
|
|||
|
m_allGenerate.BgOther.LCPara.LC_Xe133 = mdcO.lcPara.LC_Xe133;
|
|||
|
m_allGenerate.BgOther.LCPara.LC_Xe133m = mdcO.lcPara.LC_Xe133m;
|
|||
|
m_allGenerate.BgOther.LCPara.LC_Xe135 = mdcO.lcPara.LC_Xe135;
|
|||
|
m_allGenerate.BgOther.LCPara.LC = mdcO.lcPara.LC;
|
|||
|
m_allGenerate.BgOther.LCPara.LC_CTS = mdcO.lcPara.LC_CTS;
|
|||
|
|
|||
|
m_uiNeed.MDCPara = m_allGenerate.BgOther.MDCPara;
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
|
|||
|
bool CBgWork::CalcXeConUncer()
|
|||
|
{
|
|||
|
bool bRet = false;
|
|||
|
XeConUncerI xeConUncerI;
|
|||
|
xeConUncerI.s_netXe = m_allGenerate.BgSample.s_deduct_d_cts;
|
|||
|
xeConUncerI.g_netXe = m_allGenerate.BgGas.g_deduct_d_cts;
|
|||
|
xeConUncerI.ROI_con_uncer = m_allGenerate.BgOther.ROI_con_uncer;
|
|||
|
XeConUncerO xeConUncerO;
|
|||
|
bRet = CXeConUncer::CalcXeConUncer(xeConUncerI,xeConUncerO,m_allGenerate.BgOther.XeType);
|
|||
|
m_allGenerate.BgOther.XeConUncer.Xe131m_con = xeConUncerO.Xe131m_con;
|
|||
|
m_allGenerate.BgOther.XeConUncer.Xe131m_uncer = xeConUncerO.Xe131m_uncer;
|
|||
|
m_allGenerate.BgOther.XeConUncer.Xe133m_con = xeConUncerO.Xe133m_con;
|
|||
|
m_allGenerate.BgOther.XeConUncer.Xe133m_uncer = xeConUncerO.Xe133m_uncer;
|
|||
|
m_allGenerate.BgOther.XeConUncer.Xe135_con = xeConUncerO.Xe135_con;
|
|||
|
m_allGenerate.BgOther.XeConUncer.Xe135_uncer = xeConUncerO.Xe135_uncer;
|
|||
|
m_allGenerate.BgOther.XeConUncer.Xe133_con = xeConUncerO.Xe133_con;
|
|||
|
m_allGenerate.BgOther.XeConUncer.Xe133_uncer = xeConUncerO.Xe133_uncer;
|
|||
|
m_uiNeed.XeConUncer = m_allGenerate.BgOther.XeConUncer;
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
bool CBgWork::CalcRoiConUncer()
|
|||
|
{
|
|||
|
bool bRet = false;
|
|||
|
ConUncerI conUncerI;
|
|||
|
conUncerI.SPara.s_acquisition_real_time = m_sampleData.s_acquisition_real_time;
|
|||
|
conUncerI.SPara.s_coll_interval_time = SubtractTime(\
|
|||
|
m_sampleData.s_collection_start_date+m_sampleData.s_collection_start_time,\
|
|||
|
m_sampleData.s_collection_stop_date+m_sampleData.s_collection_stop_time);
|
|||
|
conUncerI.SPara.s_pre_time = SubtractTime(\
|
|||
|
m_sampleData.s_collection_stop_date+m_sampleData.s_collection_stop_time,\
|
|||
|
m_sampleData.s_acquisition_start_date+m_sampleData.s_acquisition_start_time);
|
|||
|
if(cst_fixed_volXe != 0.0)
|
|||
|
{
|
|||
|
conUncerI.SPara.s_volume_of_Xe = cst_fixed_volXe;
|
|||
|
}
|
|||
|
else if(cst_fixed_volXe==0.1||cst_fixed_volXe<0.0)
|
|||
|
{
|
|||
|
conUncerI.SPara.s_volume_of_Xe = cst_defvolXe;
|
|||
|
}
|
|||
|
else if(m_sampleData.s_volume_of_Xe==0.0)
|
|||
|
{
|
|||
|
conUncerI.SPara.s_volume_of_Xe = m_sampleData.s_uncertainty;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
conUncerI.SPara.s_volume_of_Xe = m_sampleData.s_volume_of_Xe;
|
|||
|
}
|
|||
|
conUncerI._netCts = m_allGenerate.BgOther.ROI_net_coutns;
|
|||
|
conUncerI.s_bg_efficiency = m_sampleData.s_bg_efficiency;
|
|||
|
ConUncerO conUncerO;
|
|||
|
bRet = CRoiConUncer::CalcRoiConUncer(conUncerI,conUncerO);
|
|||
|
m_allGenerate.BgOther.ROI_con_counts_factor = conUncerO.ROI_con_counts_factor;
|
|||
|
m_allGenerate.BgOther.ROI_con_uncer = conUncerO.ROI_con_uncer;
|
|||
|
m_allGenerate.BgSample.s_collection_time = QString::number(conUncerI.SPara.s_coll_interval_time);
|
|||
|
return bRet;
|
|||
|
}
|
|||
|
|
|||
|
bool CBgWork::SetPara(BgFileI& _fileHanle)//先测试使用
|
|||
|
{
|
|||
|
// QString basePath("C:\\caoanqi\\new_caoanqi\\test_data\\JPX38\\");
|
|||
|
// QString qsSample= basePath+"JPX38_001-20110411_0925_S.PHD";
|
|||
|
// QString qsGas=basePath+"JPX38_001-20110410_2125_G.PHD";
|
|||
|
// QString qsDeta=basePath+"JPX38_001-20061220_0015_D.PHD";
|
|||
|
//样品谱值提取
|
|||
|
QString order = QLatin1String("#Acquisition");
|
|||
|
QVariant variant = _fileHanle.sample.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_SAMPLE_Acquisition;
|
|||
|
return false;
|
|||
|
}
|
|||
|
AcquisitionBlock acquisition = variant.value<AcquisitionBlock>();
|
|||
|
m_sampleData.s_acquisition_live_time = acquisition.acquisition_live_time;
|
|||
|
m_sampleData.s_acquisition_real_time = acquisition.acquisition_real_time;
|
|||
|
m_sampleData.s_acquisition_start_date = acquisition.acquisition_start_date;
|
|||
|
m_sampleData.s_acquisition_start_time = acquisition.acquisition_start_time;
|
|||
|
order = QLatin1String("#Collection");
|
|||
|
variant = _fileHanle.sample.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_SAMPLE_Collection;
|
|||
|
return false;
|
|||
|
}
|
|||
|
CollectionBlock collection = variant.value<CollectionBlock>();
|
|||
|
m_sampleData.s_collection_start_date = collection.collection_start_date;
|
|||
|
m_sampleData.s_collection_start_time = collection.collection_start_time;
|
|||
|
m_sampleData.s_collection_stop_date = collection.collection_stop_date;
|
|||
|
m_sampleData.s_collection_stop_time = collection.collection_stop_time;
|
|||
|
m_sampleData.s_xe_stable_volume = collection.air_volume;
|
|||
|
order = QLatin1String("#Ratios");
|
|||
|
variant = _fileHanle.sample.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_SAMPLE_Ratios;
|
|||
|
return false;
|
|||
|
}
|
|||
|
RatiosBlock ratios = variant.value<RatiosBlock>();
|
|||
|
m_sampleData.s_count_ratio = ratios.count_ratio;
|
|||
|
m_sampleData.s_roi_ratio.ratio_id = ratios.ratio_id;
|
|||
|
m_sampleData.s_roi_ratio.ROI_num_highter_G_energy_ROI = ratios.ROI_num_highter_G_energy_ROI;
|
|||
|
m_sampleData.s_roi_ratio.ROI_num_lower_G_energy_ROI = ratios.ROI_num_lower_G_energy_ROI;
|
|||
|
m_sampleData.s_roi_ratio.count_ratio = ratios.count_ratio;
|
|||
|
m_sampleData.s_roi_ratio.count_ratio_uncertainty = ratios.count_ratio_uncertainty;
|
|||
|
|
|||
|
/*
|
|||
|
order = QLatin1String("BEGIN");
|
|||
|
variant = _fileHanle.sample.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
*/
|
|||
|
|
|||
|
// MessageInfo messageinfo = variant.value<MessageInfo>();
|
|||
|
MessageInfo messageinfo = _fileHanle.sample.GetMessageInfo();
|
|||
|
m_sampleData.s_data_type = messageinfo.data_type;
|
|||
|
|
|||
|
order = QLatin1String("#g_Energy");
|
|||
|
variant = _fileHanle.sample.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_SAMPLE_g_Energy;
|
|||
|
return false;
|
|||
|
}
|
|||
|
G_EnergyBlock g_Energy = variant.value<G_EnergyBlock>();
|
|||
|
m_sampleData.s_e_c.g_e_c.energy = g_Energy.g_energy;
|
|||
|
m_sampleData.s_e_c.g_e_c.channel = g_Energy.centroid_channel;
|
|||
|
m_sampleData.s_e_c.g_e_c.uncertainty = g_Energy.uncertainty;
|
|||
|
m_sampleData.s_e_c.g_e_c.record_count = g_Energy.record_count;
|
|||
|
order = QLatin1String("#b_Energy");
|
|||
|
variant = _fileHanle.sample.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_SAMPLE_b_Energy;
|
|||
|
return false;
|
|||
|
}
|
|||
|
B_EnergyBlock B_Energy = variant.value<B_EnergyBlock>();
|
|||
|
m_sampleData.s_e_c.b_e_c.energy = B_Energy.electron_energy;
|
|||
|
m_sampleData.s_e_c.b_e_c.channel = B_Energy.channel;
|
|||
|
m_sampleData.s_e_c.b_e_c.uncertainty = B_Energy.uncertainty;
|
|||
|
m_sampleData.s_e_c.b_e_c.mode = B_Energy.decay_mode;
|
|||
|
m_sampleData.s_e_c.b_e_c.record_count = B_Energy.record_count;
|
|||
|
order = QLatin1String("#ROI_Limits");
|
|||
|
variant = _fileHanle.sample.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_SAMPLE_ROI_Limits;
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
ROI_LimitsBlock ROI_limits = variant.value<ROI_LimitsBlock>();
|
|||
|
m_sampleData.s_limit.ROI_B_start_x1 = ROI_limits.POI_B_x1;
|
|||
|
m_sampleData.s_limit.ROI_B_stop_x2 = ROI_limits.POI_B_x2;
|
|||
|
m_sampleData.s_limit.ROI_G_start_y1 = ROI_limits.POI_G_y1;
|
|||
|
m_sampleData.s_limit.ROI_G_stop_y2 = ROI_limits.POI_G_y2;
|
|||
|
|
|||
|
order = QLatin1String("#b-gEfficiency");
|
|||
|
variant = _fileHanle.sample.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_SAMPLE_bgEfficiency;
|
|||
|
return false;
|
|||
|
}
|
|||
|
BG_EfficiencyBlock BG_efficiency = variant.value<BG_EfficiencyBlock>();
|
|||
|
m_sampleData.s_bg_efficiency = BG_efficiency.bg_efficiency;
|
|||
|
m_sampleData.s_bg_efficiency_show.bg_efficiency = BG_efficiency.bg_efficiency;
|
|||
|
m_sampleData.s_bg_efficiency_show.nuclide_name = BG_efficiency.nuclide_name;
|
|||
|
m_sampleData.s_bg_efficiency_show.ROI_number = BG_efficiency.ROI_number;
|
|||
|
m_sampleData.s_bg_efficiency_show.uncertainty = BG_efficiency.uncertainty;
|
|||
|
order = QLatin1String("#Processing");
|
|||
|
variant = _fileHanle.sample.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_SAMPLE_Processing;
|
|||
|
return false;
|
|||
|
}
|
|||
|
ProcessingBlock processing = variant.value<ProcessingBlock>();
|
|||
|
m_sampleData.s_volume_of_Xe = processing.sample_volume_of_Xe;
|
|||
|
m_sampleData.s_uncertainty = processing.uncertainty_1;
|
|||
|
|
|||
|
order = QLatin1String("#Histogram");
|
|||
|
variant = _fileHanle.sample.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_SAMPLE_Histogram;
|
|||
|
return false;
|
|||
|
}
|
|||
|
HistogramBlock histogram = variant.value<HistogramBlock>();
|
|||
|
m_sampleData.s_histogram.b_channels = histogram.b_channels;
|
|||
|
m_sampleData.s_histogram.counts = histogram.counts;
|
|||
|
m_sampleData.s_histogram.g_channels = histogram.g_channels;
|
|||
|
|
|||
|
//气体本底谱数据初始化
|
|||
|
|
|||
|
order = QLatin1String("#Acquisition");
|
|||
|
variant = _fileHanle.gas.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_GAS_Acquisition;
|
|||
|
return false;
|
|||
|
}
|
|||
|
acquisition = variant.value<AcquisitionBlock>();
|
|||
|
m_gasData.g_acquisition_live_time = acquisition.acquisition_live_time;
|
|||
|
m_gasData.g_acquisition_real_time = acquisition.acquisition_real_time;
|
|||
|
m_gasData.g_acquisition_start_date = acquisition.acquisition_start_date;
|
|||
|
m_gasData.g_acquisition_start_time = acquisition.acquisition_start_time;
|
|||
|
|
|||
|
/*
|
|||
|
order = QLatin1String("BEGIN");
|
|||
|
variant = _fileHanle.gas.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
*/
|
|||
|
messageinfo = _fileHanle.gas.GetMessageInfo();
|
|||
|
m_gasData.g_data_type = messageinfo.data_type;
|
|||
|
|
|||
|
order = QLatin1String("#g_Energy");
|
|||
|
variant = _fileHanle.gas.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_GAS_g_Energy;
|
|||
|
return false;
|
|||
|
}
|
|||
|
g_Energy = variant.value<G_EnergyBlock>();
|
|||
|
m_gasData.g_e_c.g_e_c.energy = g_Energy.g_energy;
|
|||
|
m_gasData.g_e_c.g_e_c.channel = g_Energy.centroid_channel;
|
|||
|
m_gasData.g_e_c.g_e_c.uncertainty = g_Energy.uncertainty;
|
|||
|
m_gasData.g_e_c.g_e_c.record_count = g_Energy.record_count;
|
|||
|
order = QLatin1String("#b_Energy");
|
|||
|
variant = _fileHanle.gas.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_GAS_b_Energy;
|
|||
|
return false;
|
|||
|
}
|
|||
|
B_Energy = variant.value<B_EnergyBlock>();
|
|||
|
m_gasData.g_e_c.b_e_c.energy = B_Energy.electron_energy;
|
|||
|
m_gasData.g_e_c.b_e_c.channel = B_Energy.channel;
|
|||
|
m_gasData.g_e_c.b_e_c.mode = B_Energy.decay_mode;
|
|||
|
m_gasData.g_e_c.b_e_c.uncertainty = B_Energy.uncertainty;
|
|||
|
m_gasData.g_e_c.b_e_c.record_count = B_Energy.record_count;
|
|||
|
order = QLatin1String("#ROI_Limits");
|
|||
|
variant = _fileHanle.gas.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_GAS_ROI_Limits;
|
|||
|
return false;
|
|||
|
}
|
|||
|
ROI_limits = variant.value<ROI_LimitsBlock>();
|
|||
|
m_gasData.g_limit.ROI_B_start_x1 = ROI_limits.POI_B_x1;
|
|||
|
m_gasData.g_limit.ROI_B_stop_x2 = ROI_limits.POI_B_x2;
|
|||
|
m_gasData.g_limit.ROI_G_start_y1 = ROI_limits.POI_G_y1;
|
|||
|
m_gasData.g_limit.ROI_G_stop_y2 = ROI_limits.POI_G_y2;
|
|||
|
|
|||
|
order = QLatin1String("#Histogram");
|
|||
|
variant = _fileHanle.gas.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_GAS_Histogram;
|
|||
|
return false;
|
|||
|
}
|
|||
|
histogram = variant.value<HistogramBlock>();
|
|||
|
m_gasData.g_histogram.b_channels = histogram.b_channels;
|
|||
|
m_gasData.g_histogram.counts = histogram.counts;
|
|||
|
m_gasData.g_histogram.g_channels = histogram.g_channels;
|
|||
|
|
|||
|
order = QLatin1String("#Ratios");
|
|||
|
variant = _fileHanle.gas.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_GAS_Ratios;
|
|||
|
return false;
|
|||
|
}
|
|||
|
ratios = variant.value<RatiosBlock>();
|
|||
|
m_gasData.g_count_ratio = ratios.count_ratio;
|
|||
|
|
|||
|
//探测器本底谱初始数据
|
|||
|
order = QLatin1String("#Histogram");
|
|||
|
variant = _fileHanle.Detbgr.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_DETA_Histogram;
|
|||
|
return false;
|
|||
|
}
|
|||
|
histogram = variant.value<HistogramBlock>();
|
|||
|
m_detbgrData.d_histogram.b_channels = histogram.b_channels;
|
|||
|
m_detbgrData.d_histogram.counts = histogram.counts;
|
|||
|
m_detbgrData.d_histogram.g_channels = histogram.g_channels;
|
|||
|
|
|||
|
order = QLatin1String("#Acquisition");
|
|||
|
variant = _fileHanle.Detbgr.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_DETA_Acquisition;
|
|||
|
return false;
|
|||
|
}
|
|||
|
acquisition = variant.value<AcquisitionBlock>();
|
|||
|
m_detbgrData.s_acquisition_live_time = acquisition.acquisition_live_time;
|
|||
|
m_detbgrData.d_acquisition_real_time = acquisition.acquisition_real_time;
|
|||
|
|
|||
|
/*
|
|||
|
order = QLatin1String("BEGIN");
|
|||
|
variant = _fileHanle.Detbgr.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
*/
|
|||
|
messageinfo = _fileHanle.Detbgr.GetMessageInfo();
|
|||
|
m_detbgrData.d_data_type = messageinfo.data_type;\
|
|||
|
|
|||
|
order = QLatin1String("#g_Energy");
|
|||
|
variant = _fileHanle.Detbgr.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_DETA_g_Energy;
|
|||
|
return false;
|
|||
|
}
|
|||
|
g_Energy = variant.value<G_EnergyBlock>();
|
|||
|
m_detbgrData.d_e_c.g_e_c.energy = g_Energy.g_energy;
|
|||
|
m_detbgrData.d_e_c.g_e_c.channel = g_Energy.centroid_channel;
|
|||
|
m_detbgrData.d_e_c.g_e_c.uncertainty = g_Energy.uncertainty;
|
|||
|
m_detbgrData.d_e_c.g_e_c.record_count = g_Energy.record_count;
|
|||
|
order = QLatin1String("#b_Energy");
|
|||
|
variant = _fileHanle.Detbgr.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_DETA_b_Energy;
|
|||
|
return false;
|
|||
|
}
|
|||
|
B_Energy = variant.value<B_EnergyBlock>();
|
|||
|
m_detbgrData.d_e_c.b_e_c.energy = B_Energy.electron_energy;
|
|||
|
m_detbgrData.d_e_c.b_e_c.channel = B_Energy.channel;
|
|||
|
m_detbgrData.d_e_c.b_e_c.mode = B_Energy.decay_mode;
|
|||
|
m_detbgrData.d_e_c.b_e_c.record_count=B_Energy.record_count;
|
|||
|
m_detbgrData.d_e_c.b_e_c.uncertainty = B_Energy.uncertainty;
|
|||
|
order = QLatin1String("#ROI_Limits");
|
|||
|
variant = _fileHanle.Detbgr.GetBlockData(order);
|
|||
|
if(!variant.isValid())
|
|||
|
{
|
|||
|
m_lastError = E_FILE_CONTEXT_DETA_ROI_Limits;
|
|||
|
return false;
|
|||
|
}
|
|||
|
ROI_limits = variant.value<ROI_LimitsBlock>();
|
|||
|
m_detbgrData.d_limit.ROI_B_start_x1 = ROI_limits.POI_B_x1;
|
|||
|
m_detbgrData.d_limit.ROI_B_stop_x2 = ROI_limits.POI_B_x2;
|
|||
|
m_detbgrData.d_limit.ROI_G_start_y1 = ROI_limits.POI_G_y1;
|
|||
|
m_detbgrData.d_limit.ROI_G_stop_y2 = ROI_limits.POI_G_y2;
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
QString CBgWork::BgAnlyseError(const BgErrorType& _error)
|
|||
|
{
|
|||
|
QString temp;
|
|||
|
switch (_error) {
|
|||
|
case E_NONE:
|
|||
|
temp = QLatin1String("no error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_SAMPLE_Acquisition:
|
|||
|
temp = QLatin1String("sample file #Acquisition read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_SAMPLE_bgEfficiency:
|
|||
|
temp = QLatin1String("sample file #bgEfficiency read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_SAMPLE_b_Energy:
|
|||
|
temp = QLatin1String("sample file #b_Energy read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_SAMPLE_Collection:
|
|||
|
temp = QLatin1String("sample file #Collection read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_SAMPLE_g_Energy:
|
|||
|
temp = QLatin1String("sample file #g_Energy read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_SAMPLE_Histogram:
|
|||
|
temp = QLatin1String("sample file #Histogram read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_SAMPLE_Processing:
|
|||
|
temp = QLatin1String("sample file #Processing read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_SAMPLE_Ratios:
|
|||
|
temp = QLatin1String("sample file #Ratios read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_SAMPLE_ROI_Limits:
|
|||
|
temp = QLatin1String("sample file #ROI_Limits read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_GAS_Acquisition:
|
|||
|
temp = QLatin1String("gas file #Acquisition read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_GAS_b_Energy:
|
|||
|
temp = QLatin1String("gas file #b_Energy read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_GAS_g_Energy:
|
|||
|
temp = QLatin1String("gas file #g_Energy read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_GAS_Histogram:
|
|||
|
temp = QLatin1String("gas file #Histogram read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_GAS_Ratios:
|
|||
|
temp = QLatin1String("gas file #Ratios read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_GAS_ROI_Limits:
|
|||
|
temp = QLatin1String("gas file #ROI_Limits read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_DETA_Acquisition:
|
|||
|
temp = QLatin1String("deta file #Acquisition read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_DETA_b_Energy:
|
|||
|
temp = QLatin1String("deta file #b_Energy read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_DETA_g_Energy:
|
|||
|
temp = QLatin1String("deta file #g_Energy read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_DETA_Histogram:
|
|||
|
temp = QLatin1String("deta file #Histogram read error");
|
|||
|
break;
|
|||
|
case E_FILE_CONTEXT_DETA_ROI_Limits:
|
|||
|
temp = QLatin1String("deta file #ROI_Limits read error");
|
|||
|
break;
|
|||
|
case E_SAMPLE_ROI_CTS:
|
|||
|
temp = QLatin1String("sample roi cts error");
|
|||
|
break;
|
|||
|
case E_GAS_ROI_CTS:
|
|||
|
temp = QLatin1String("gas roi cts error");
|
|||
|
break;
|
|||
|
case E_DETA_ROI_CTS:
|
|||
|
temp = QLatin1String("deta roi cts error");
|
|||
|
break;
|
|||
|
case E_S_DETUCT_D_CTS:
|
|||
|
temp = QLatin1String("sampe detuct deta cts error");
|
|||
|
break;
|
|||
|
case E_G_DETUCT_D_CTS:
|
|||
|
temp = QLatin1String("gas detuct deta cts error");
|
|||
|
break;
|
|||
|
case E_NET_COUNTS:
|
|||
|
temp = QLatin1String("net counts error");
|
|||
|
break;
|
|||
|
case E_ROI_CON_UNCER:
|
|||
|
temp = QLatin1String("roi con uncer error");
|
|||
|
break;
|
|||
|
case E_XE_CON_UNCER:
|
|||
|
temp = QLatin1String("xe con uncer error");
|
|||
|
break;
|
|||
|
case E_MDC:
|
|||
|
temp = QLatin1String("mdc error");
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
return QString("Anlyse result : %1%2").arg(temp).arg(STRING_END);
|
|||
|
}
|