144 lines
4.5 KiB
C++
144 lines
4.5 KiB
C++
#include "ROIConUncer.h"
|
|
#include "ProcessAlgorithmGlobalVar.h"
|
|
#include <QtMath>
|
|
double CRoiConUncer::CalcCorrect(SPara& _input,double _Xe)
|
|
{
|
|
double rData;
|
|
rData = (1-qExp(-_Xe*_input.s_coll_interval_time))* \
|
|
qExp(-_Xe*_input.s_pre_time)* \
|
|
(1-qExp(-_Xe*_input.s_acquisition_real_time));
|
|
return rData;
|
|
}
|
|
bool CRoiConUncer::CalcConc(SPara& _input,double _Xe,double& _output)
|
|
{
|
|
double rData=0.0;
|
|
if(CalcCorrect(_input,_Xe)==0.0||global::cst_d_xe_air==0.0||_input.s_volume_of_Xe/global::cst_d_xe_air==0.0)
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
rData = 1000*_Xe*_Xe/CalcCorrect(_input,_Xe)*(_input.s_coll_interval_time/(_input.s_volume_of_Xe/global::cst_d_xe_air));
|
|
}
|
|
_output = rData;
|
|
return true;
|
|
}
|
|
bool CRoiConUncer::CalcRoiConUncer(ConUncerI& _input,ConUncerO& _output)
|
|
{
|
|
bool bRet = false;
|
|
Factor factor; //系数处理
|
|
double dData;
|
|
bRet = CalcConc(_input.SPara, global::cst_d_decay_135xeg_lam,dData);
|
|
if(!bRet)
|
|
{
|
|
return false;
|
|
}
|
|
factor.calcFactor.append(dData);
|
|
bRet = CalcConc(_input.SPara, global::cst_d_decay_133xeg_lam,dData);
|
|
if(!bRet)
|
|
{
|
|
return false;
|
|
}
|
|
factor.calcFactor.append(dData);
|
|
factor.calcFactor.append(dData);
|
|
bRet = CalcConc(_input.SPara, global::cst_d_decay_131xem_lam,dData);
|
|
if(!bRet)
|
|
{
|
|
return false;
|
|
}
|
|
factor.calcFactor.append(dData);
|
|
bRet = CalcConc(_input.SPara, global::cst_d_decay_133xem_lam,dData);
|
|
if(!bRet)
|
|
{
|
|
return false;
|
|
}
|
|
factor.calcFactor.append(dData);
|
|
bRet = CalcConc(_input.SPara, global::cst_d_decay_133xeg_lam,dData);
|
|
if(!bRet)
|
|
{
|
|
return false;
|
|
}
|
|
factor.calcFactor.append(dData);
|
|
|
|
factor.bgbrFactor.append(global::cst_d_br_135xeg);
|
|
factor.bgbrFactor.append(global::cst_d_br_133xe_80);
|
|
factor.bgbrFactor.append(global::cst_d_br_133xe_30);
|
|
factor.bgbrFactor.append(global::cst_d_br_131xem_30);
|
|
factor.bgbrFactor.append(global::cst_d_br_133xem_30);
|
|
factor.bgbrFactor.append(global::cst_d_br_133xe_30);
|
|
//通过系数和输入值计算输出值
|
|
bRet = CalcRoiConUncerByFactor(_input._netCts,_input.s_bg_efficiency,factor,_output);
|
|
if(!bRet)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
|
|
}
|
|
bool CRoiConUncer::CalcRoiConUncerByFactor(QVector<double>& _netCts,QVector<double>& _s_ROI_number_eff,Factor& _factor,ConUncerO& _output)
|
|
{
|
|
QVector<double> con_uncer(4,0); //浓度和不确定度 前两组置零
|
|
QVector<double> con_counts(2,0); //不确定度系数
|
|
double dCalcFactor=0.0;
|
|
double dbgbrFactor=0.0;
|
|
const int netCtsGroupNmber = 3; //净计数一组三个数据
|
|
QVector<double>::size_type qdNetctsPos=6;
|
|
QVector<double>::size_type qdBgeffsPos=0;
|
|
const int con_uncer_grpnm = 10;
|
|
const int pos_net_cts_vari = 1;
|
|
//提取数据
|
|
for(int pos=0;pos<con_uncer_grpnm;pos++)
|
|
{
|
|
//提取系数,最后的系数保持不变 一直使用
|
|
if(pos<_factor.bgbrFactor.size())
|
|
{
|
|
dbgbrFactor = _factor.bgbrFactor[pos];
|
|
}
|
|
if(pos<_factor.calcFactor.size())
|
|
{
|
|
dCalcFactor = _factor.calcFactor[pos];
|
|
}
|
|
if(_netCts.size()<=qdNetctsPos+pos_net_cts_vari||_s_ROI_number_eff.size()<=qdBgeffsPos)
|
|
{
|
|
break;
|
|
}
|
|
double dataDCTmep=0.0;
|
|
double dataCTmep=0.0;
|
|
if(qdNetctsPos+pos_net_cts_vari<_netCts.size()&&qdBgeffsPos<_s_ROI_number_eff.size())
|
|
{
|
|
double divsion = 0.0;
|
|
divsion = (_s_ROI_number_eff[qdBgeffsPos]*dbgbrFactor);
|
|
if(divsion == 0)
|
|
{
|
|
return false;
|
|
}
|
|
dataCTmep = (_netCts[qdNetctsPos]/divsion)*dCalcFactor;
|
|
divsion = _netCts[qdNetctsPos];
|
|
if(divsion == 0 || _netCts[qdNetctsPos+pos_net_cts_vari]<0)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
dataDCTmep = dataCTmep*qSqrt(_netCts[qdNetctsPos+pos_net_cts_vari])/divsion;
|
|
con_uncer.append(dataCTmep); //浓度
|
|
con_uncer.append(dataDCTmep);//不确定度
|
|
divsion = dataCTmep;
|
|
if(divsion == 0)
|
|
{
|
|
return false;
|
|
}
|
|
con_counts.append(_netCts[qdNetctsPos]/dataCTmep);//不确定度系数
|
|
qdNetctsPos+=netCtsGroupNmber;
|
|
qdBgeffsPos++;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
|
|
}
|
|
_output.ROI_con_uncer = con_uncer;
|
|
_output.ROI_con_counts_factor = con_counts;
|
|
return true;
|
|
}
|