添加Java_org_jeecg_modules_native_1jni_CalValuesHandler_selfBgAnalyse接口

This commit is contained in:
wanglong 2024-08-16 17:56:57 +08:00
parent fe493fb636
commit 29acdf7eea
11 changed files with 343 additions and 28 deletions

View File

@ -91,7 +91,6 @@ bool AbstractSpectrumDataMessage::AnalyseFile(QString file_name)
file.close();
return bRet &= false;
}
bRet &= AnalyseMessgeInfo(content);
/*
if (bRet)

View File

@ -502,6 +502,17 @@ namespace RadionuclideData
}
G_EfficiencyBlock, *PtG_EfficiencyBlock;
typedef struct _n_g_Efficiency_Block_
{
/* g_Efficiency Block */
QVector<QString> dev_name;
QVector<double> g_energy; // γ -energy (keV)
QVector<double> efficiency; // efficiency (counts in peak/photon emitted)
QVector<double> uncertainty; // uncertainty (counts in peak/photon emitted)
int record_count;
}
n_G_EfficiencyBlock, *Pt_n_G_EfficiencyBlock;
typedef struct _ROI_Limits_Block_
{
/* ROI_Limits Block */
@ -525,6 +536,16 @@ namespace RadionuclideData
}
BG_EfficiencyBlock, *PtBG_EfficiencyBlock;
typedef struct _N_BG_Efficiency_Block_
{
/* b-gEfficiency Block */
QVector<QString> nuclide_name; // nuclide name
QVector<double> bg_efficiency; // β-γ coincidence efficiency (counts in ROI/β-γ pair emitted)
QVector<double> uncertainty; // uncertainty (counts in ROI/β-γ pair emitted)
int record_count;
}
NBG_EfficiencyBlock, *PtNBG_EfficiencyBlock;
typedef struct _Totaleff_Block_
{
@ -614,6 +635,23 @@ namespace RadionuclideData
}
}
CertificateBlock, *PtCertificateBlock;
typedef struct _b_self_Attenuation_block_
{
/* b_self_Attenuation Block */
QVector<QString> devNames;
QVector<std::array<double, 3>> xenon;
QVector<std::array<double, 3>> nitrogen;
}
BSelfAttenuationBlock, *PtBSelfAttenuationBlock;
typedef struct _Gps_Block_
{
/* gps Block */
double lon; // 经度
double lat; // 纬度
}
GpsBlock, *PtGpsBlock;
}
Q_DECLARE_METATYPE(RadionuclideData::HeaderBlock)
Q_DECLARE_METATYPE(RadionuclideData::AcquisitionBlock)
@ -626,14 +664,18 @@ Q_DECLARE_METATYPE(RadionuclideData::B_EnergyBlock)
Q_DECLARE_METATYPE(RadionuclideData::G_ResolutionBlock)
Q_DECLARE_METATYPE(RadionuclideData::B_ResolutionBlock)
Q_DECLARE_METATYPE(RadionuclideData::G_EfficiencyBlock)
Q_DECLARE_METATYPE(RadionuclideData::n_G_EfficiencyBlock)
Q_DECLARE_METATYPE(RadionuclideData::ROI_LimitsBlock)
Q_DECLARE_METATYPE(RadionuclideData::BG_EfficiencyBlock)
Q_DECLARE_METATYPE(RadionuclideData::NBG_EfficiencyBlock)
Q_DECLARE_METATYPE(RadionuclideData::TotaleffBlock)
Q_DECLARE_METATYPE(RadionuclideData::RatiosBlock)
Q_DECLARE_METATYPE(RadionuclideData::G_SpectrumBlock)
Q_DECLARE_METATYPE(RadionuclideData::B_SpectrumBlock)
Q_DECLARE_METATYPE(RadionuclideData::HistogramBlock)
Q_DECLARE_METATYPE(RadionuclideData::CertificateBlock)
Q_DECLARE_METATYPE(RadionuclideData::BSelfAttenuationBlock)
Q_DECLARE_METATYPE(RadionuclideData::GpsBlock)
namespace MetData
{

View File

@ -514,7 +514,6 @@ void fitPeakFull(PHDFile *phd, uvec Af, uvec Cf, uvec Ff)
free_idx << ep << ep << ep << Af << Cf << Ff << ep << ep << ep << ep << ep << ep << ep << ep;
QString addArg = "Peaks above spline baseline";
bool s = Independ::fitFunction(Ps, X2, free_idx, vectorise(x), vectorise(y), "wrapStepRatio", QStringList("Restrict"), addArg);
printf("s : %d",s);
// PrintMat2fvec("Ps1.txt", Ps);
/*mat& CXo = Ps(0);
//if(Ps(1).is_colvec()) cy = Ps(1).t();
@ -604,7 +603,6 @@ void fitPeakFull(PHDFile *phd, uvec Af, uvec Cf, uvec Ff)
phd->vPeak[ allidx(i) ].peakCentroid = Co(i);
phd->vPeak[ allidx(i) ].energy = vE(i);
phd->vPeak[ allidx(i) ].area = Ao(i);
printf("idx : %d area : %lf\n", allidx(i), phd->vPeak[ allidx(i) ].area);
phd->vPeak[ allidx(i) ].areaErr = sqrt( max( Ao(i), LC(i) ) + BC(i) );
phd->vPeak[ allidx(i) ].fwhm = Fo(i) * dE(i);
phd->vPeak[ allidx(i) ].fwhmc = Fo(i);
@ -1088,7 +1086,6 @@ void ReadSpecialNuclides(QMap<QString, double> &mapHalflife, QStringList &vNucli
QFile t_file(fileName);
if(!t_file.open(QIODevice::ReadOnly))
{
printf("open file %s error!", fileName.toStdString().c_str());
return;
}
@ -1439,7 +1436,13 @@ bool LoadSpectrum(PHDFile *phd, QString fileContents)
QVariant g_effi = sample_data.GetBlockData(block_name);
if(!g_effi.isNull())
{
phd->mapEffiKD[CalPHD] = g_effi.value<G_EfficiencyBlock>();
if(phd->header.system_type == 'C')
{
phd->nMapEffiKD[CalPHD] = g_effi.value<n_G_EfficiencyBlock>();
}
else {
phd->mapEffiKD[CalPHD] = g_effi.value<G_EfficiencyBlock>();
}
}
block_name = QLatin1String("#TotalEff");
@ -1449,6 +1452,28 @@ bool LoadSpectrum(PHDFile *phd, QString fileContents)
phd->mapTotEKD[CalPHD] = g_tote.value<TotaleffBlock>();
}
block_name = QLatin1String("#b_self_Attenuation");
QVariant bsel = sample_data.GetBlockData(block_name);
if(!bsel.isNull())
{
phd->bSelfAttenuation = bsel.value<BSelfAttenuationBlock>();
}
block_name = QLatin1String("#b-gEfficiency");
QVariant bgeff = sample_data.GetBlockData(block_name);
if(!bgeff.isNull() && phd->header.system_type != 'C')
{
phd->mapbgEffiKD[CalPHD] = bgeff.value<BG_EfficiencyBlock>();
}
block_name = QLatin1String("#b_Efficiency");
QVariant beff = sample_data.GetBlockData(block_name);
if(!beff.isNull() && phd->header.system_type == 'C')
{
phd->nMapbgEffiKD[CalPHD] = beff.value<NBG_EfficiencyBlock>();
}
// 初始化默认分析设置
if(phd->header.system_type == "P")
{
@ -1462,7 +1487,6 @@ bool LoadSpectrum(PHDFile *phd, QString fileContents)
phd->bAnalyed = false;
phd->analy_start_time = QDateTime::currentDateTimeUtc().toString(DATATIME_FORMAT_SPACE_SECONDS);
printf(" #phd->filepath:%s\n", phd->filepath.toStdString().c_str());
qDebug() << QString("Load %1:").arg(phd->filepath) << LINE_END
<< QString("\tChannel number: %1").arg(phd->Spec.num_g_channel) << LINE_END
<< QString("\tStartChannel: %1").arg(phd->Spec.begin_channel) << LINE_END
@ -1816,7 +1840,6 @@ void PrintMat2fvec(QString name, field<vec>& vecc)
QFile file("C:/Result_Debug3/" + name);
if (file.open(QIODevice::WriteOnly))
{
printf("file : %s open ok!\n", file.fileName().toStdString().c_str());
QTextStream out(&file);
for (uword row = 0; row < vecc.size(); ++row)
@ -1831,7 +1854,6 @@ void PrintMat2fvec(QString name, field<vec>& vecc)
}
else
{
printf("file : %s open error!\n", file.fileName().toStdString().c_str());
}
}
void PrintMat22(QString name, mat& dataMat)
@ -2018,7 +2040,6 @@ bool GammaAnalyALG::Process(bool bUpdate, QChar dataType, vec certEne)
void GammaAnalyALG::callGammaProcess(int npro)
{
printf("## GammaProcess:%d\n", npro);
if (m_pJniEnv == NULL || m_pSendObj == NULL)
return;
@ -2053,7 +2074,6 @@ bool GammaAnalyALG::AnalyseSpectrum(PHDFile *phd, QMap<QString, NuclideLines> ma
//GammaAnalyALG alg(phd->setting);
specSetup = phd->setting;
SetBaseInfo(phd->Spec.counts, phd->Spec.begin_channel);
printf("AnalyseSpectrum 000000000000000\n");
QStringList names;
names << phd->newEner << phd->newReso;
bool bUpdate = false;
@ -2065,9 +2085,7 @@ bool GammaAnalyALG::AnalyseSpectrum(PHDFile *phd, QMap<QString, NuclideLines> ma
SetCalData(names, phd->mapEnerKD[ names[0] ], phd->mapResoKD[ names[1] ], phd->mapEffiKD[phd->newEffi], phd->mapTotEKD[phd->newTotE]);
if(phd->setting.bUpdateCal) bUpdate = true;
}
printf("AnalyseSpectrum 1111111111111\n");
if(!Process(bUpdate, phd->msgInfo.data_type.at(0), phd->certificate.g_energy.toStdVector())) return false;
printf("AnalyseSpectrum 22222222222222\n");
// 获取分析结果
if(!phd->bAnalyed)
{
@ -2125,14 +2143,12 @@ bool GammaAnalyALG::AnalyseSpectrum(PHDFile *phd, QMap<QString, NuclideLines> ma
phd->mapResoPara[CalResUpdate] = GetCalPara(Cal_Resolution, CalResUpdate);
}
}
printf("AnalyseSpectrum 33333333333333\n");
phd->vEnergy = getBaseInfo(s_Energy);
phd->vBase = getBaseInfo(s_BaseLine);
phd->vLc = getBaseInfo(s_Lc);
phd->vScac = getBaseInfo(s_Scac);
phd->vPeak = getPAT();
printf("AnalyseSpectrum 444444444444444\n");
stdvec AnalyRg = getBaseInfo(s_AnalysisRange);
if(AnalyRg.size() > 1)
{
@ -2155,7 +2171,6 @@ bool GammaAnalyALG::AnalyseSpectrum(PHDFile *phd, QMap<QString, NuclideLines> ma
bcStack.cdy = phd->baseCtrls.YSlope;
phd->baseCtrls.BaseStack.clear();
phd->baseCtrls.BaseStack.push_back(bcStack);
printf("AnalyseSpectrum 55555555555555555\n");
// 保存当前分析所用的参数信息
phd->usedSetting = phd->setting;
if(!phd->mapEnerKD.isEmpty())
@ -2182,14 +2197,10 @@ bool GammaAnalyALG::AnalyseSpectrum(PHDFile *phd, QMap<QString, NuclideLines> ma
phd->usedTotEKD = phd->mapTotEKD[phd->newTotE];
phd->usedTotEPara = phd->mapTotEPara[phd->newTotE];
}
printf("AnalyseSpectrum 66666666666666666666\n");
callGammaProcess(5);
printf("AnalyseSpectrum 77777777777777777777\n");
AlgFunc::NuclidesIdent(phd, mapLines, this->m_strFilePath);
AlgFunc::RunQC(phd, m_strFilePath);
printf("AnalyseSpectrum 8888888888888888\n");
callGammaProcess(6);
printf("AnalyseSpectrum 9999999999999999999999\n");
return true;
}
@ -2768,8 +2779,7 @@ uvec GammaAnalyALG::PeakSearch(vec &C, vec &NA, vec &CNL, vec &CNR,
int ChanLow = searchRg(0);
int ChanHigh = searchRg(1);
// printf("ChanLow: %d\n", ChanLow);
// printf("ChanHigh: %d\n", ChanHigh);
// qDebug() << "ChanLow: " << ChanLow;
// qDebug() << "ChanHigh: " << ChanHigh;
@ -5635,8 +5645,6 @@ void GammaAnalyALG::calUpdate(QChar dataType, vec certEne, bool E1, bool R, bool
if(ELibEne.is_empty() || ELibRes.is_empty())
{
// printf("Read %s Failed. Maybe the file is not existed or data is error.", filename.toStdString().c_str());
// qDebug() << QString("Read %1 Failed. Maybe the file is not existed or data is error.").arg(filename);
return;
}
}

View File

@ -65,8 +65,8 @@ HEADERS += \#mainwindow.h \
#FORMS += mainwindow.ui
win32:INCLUDEPATH += "C:/java64/jdk/include"
win32:INCLUDEPATH += "C:/java64/jdk/include/win32"
win32:INCLUDEPATH += "C:/Program Files/Java/jdk1.8.0_351/include"
win32:INCLUDEPATH += "C:/Program Files/Java/jdk1.8.0_351/include/win32"
QMAKE_LFLAGS += -Wl,--kill-at

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.9.1, 2024-03-19T10:22:07. -->
<!-- Written by QtCreator 4.9.1, 2024-08-16T10:07:31. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -520,8 +520,13 @@ public:
QMap<QString, G_EnergyBlock> mapEnerKD; // 能量刻度
QMap<QString, G_ResolutionBlock> mapResoKD; // 分辨率刻度
QMap<QString, G_EfficiencyBlock> mapEffiKD; // 效率刻度
QMap<QString, n_G_EfficiencyBlock> nMapEffiKD; // 效率刻度
QMap<QString, TotaleffBlock> mapTotEKD; // 总效率刻度
//bate刻度数据
QMap<QString, BG_EfficiencyBlock> mapbgEffiKD; // 效率刻度
QMap<QString, NBG_EfficiencyBlock> nMapbgEffiKD; // 效率刻度
// 当前寻峰结果所用的刻度参数
ParameterInfo usedEnerPara;
ParameterInfo usedResoPara;
@ -541,6 +546,9 @@ public:
ParameterInfo para_tailRight;
ParameterInfo para_tailRightAlpha;
//自衰减
BSelfAttenuationBlock bSelfAttenuation;
// 谱基本信息
QString id_sample;
QString id_analysis;

View File

@ -2,6 +2,7 @@
#include <QFile>
#include <QTextStream>
#include <QDebug>
#include <sstream>
#define SECOND 1
#define HOUR 3600
@ -115,6 +116,9 @@ void RadionuclideMessage::InitBlockFlagInfo()
block_flag.append(QLatin1String("STOP")); // [ STOP ]
block_flag.append(QLatin1String("BEGIN")); // [ BEGIN ]
block_flag.append(QLatin1String("#Spectrum")); // [ 22 ]
block_flag.append(QLatin1String("#GPS")); // [ 23 ]
block_flag.append(QLatin1String("#b_self_Attenuation")); // [ 24 ]
block_flag.append(QLatin1String("#b_Efficiency")); // [ 25 ]
}
bool RadionuclideMessage::AnalyseMessgeBody(QTextStream &content)
@ -220,6 +224,18 @@ bool RadionuclideMessage::AnalyseMessgeBody(QTextStream &content)
{
bRet &= Analyse_Certificate_Block(content, line);
}
else if ( 0==line.compare(block_flag.at(24)) && bRet)
{
bRet &= Analyse_b_self_Attenuation_Block(content, line);
}
else if ( 0==line.compare(block_flag.at(25)) && bRet)
{
bRet &= Analyse_b_Efficiency_Block(content, line);
}
else if ( 0==line.compare(block_flag.at(23)) && bRet)
{
bRet &= Analyse_Gps_Block(content, line);
}
else
{ // 数据错误,数据有效
bIsValid = false;
@ -243,7 +259,6 @@ bool RadionuclideMessage::AnalyseMessgeBody(QTextStream &content)
}
}
while( bRet );
return bRet;
}
@ -256,6 +271,7 @@ bool RadionuclideMessage::Analyse_Header_Block(QTextStream& content, QString& ne
content >> Header.sample_ref_id;
content.readLine();
m_system_type = Header.system_type;
const MessageInfo& msg = AbstractSpectrumDataMessage::GetMessageInfo();
if ( msg.verify_srid )
{
@ -508,6 +524,36 @@ bool RadionuclideMessage::Analyse_b_Resolution_Block(QTextStream& content, QStri
bool RadionuclideMessage::Analyse_g_Efficiency_Block(QTextStream& content, QString& nextBlock)
{
if(m_system_type == 'C')
{
n_G_EfficiencyBlock g_eff;
int row_count = 0;
nextBlock = content.readLine();
QString temp_line = nextBlock.simplified();
while (!block_flag.contains(temp_line) && !content.atEnd())
{
double g_energy, efficiency, uncertainty;
QString name;
QTextStream line_content(&nextBlock);
line_content >> name >> g_energy >> efficiency >> uncertainty;
g_eff.dev_name.push_back(name);
g_eff.g_energy << g_energy;
g_eff.efficiency << efficiency;
g_eff.uncertainty << uncertainty;
++ row_count;
nextBlock = content.readLine();
temp_line = nextBlock.simplified();
if (line_content.status()==QTextStream::ReadCorruptData)
{
return false;
}
}
g_eff.record_count = row_count;
radionuclide_msg_data.insert(block_flag.at(10), QVariant::fromValue(g_eff));
return (content.status()==QTextStream::Ok)?true:false;
}
G_EfficiencyBlock g_Efficiency;
int row_count = 0;
nextBlock = content.readLine();
@ -941,6 +987,84 @@ bool RadionuclideMessage::Analyse_Certificate_Block(QTextStream& content, QStrin
return (content.status()==QTextStream::Ok)?true:false;
}
bool RadionuclideMessage::Analyse_b_self_Attenuation_Block(QTextStream &content, QString &nextBlock)
{
BSelfAttenuationBlock bsel;
QString buffer;
buffer = content.readLine();
while(buffer.at(0) != '#')
{
std::stringstream ss(buffer.toStdString());
std::string name;
std::array<double, 3> data1, data2;
ss >> name;
for(int i = 0; i < 3; i++)
{
ss >> data1[i];
}
for(int i = 0; i < 3; i++)
{
ss >> data2[i];
}
bsel.devNames.push_back(QString::fromStdString(name));
bsel.xenon.push_back(data1);
bsel.nitrogen.push_back(data2);
buffer = content.readLine();
};
radionuclide_msg_data.insert(block_flag.at(24), QVariant::fromValue(bsel));
nextBlock = buffer;
// content.readLine();
return (content.status()==QTextStream::Ok)?true:false;
}
bool RadionuclideMessage::Analyse_b_Efficiency_Block(QTextStream &content, QString &nextBlock)
{
NBG_EfficiencyBlock bg_Efficiency;
int row_count = 0;
nextBlock = content.readLine();
QString temp_line = nextBlock.simplified();
while (!block_flag.contains(temp_line) && !content.atEnd())
{
QString nuclide_name;
double bg_efficiency, uncertainty;
QTextStream line_content(&nextBlock);
line_content >> nuclide_name >> bg_efficiency >> uncertainty;
bg_Efficiency.nuclide_name << nuclide_name;
bg_Efficiency.bg_efficiency << bg_efficiency;
bg_Efficiency.uncertainty << uncertainty;
++ row_count;
nextBlock = content.readLine();
temp_line = nextBlock.simplified();
if (line_content.status()==QTextStream::ReadCorruptData)
{
return false;
}
}
bg_Efficiency.record_count = row_count;
radionuclide_msg_data.insert(block_flag.at(25), QVariant::fromValue(bg_Efficiency));
return (content.status()==QTextStream::Ok)?true:false;
}
bool RadionuclideMessage::Analyse_Gps_Block(QTextStream &content, QString &nextBlock)
{
GpsBlock gps;
content >> gps.lon >> gps.lat;
radionuclide_msg_data.insert(block_flag.at(23), QVariant::fromValue(gps));
content >> nextBlock;
content.readLine();
return (content.status()==QTextStream::Ok)?true:false;
}
bool RadionuclideMessage::Verity_SampleReferenceId(QString srid)
{
bool bRet = true;

View File

@ -45,6 +45,9 @@ private:
bool Analyse_Histogram_Block(QTextStream& content, QString& nextBlock);
bool Analyse_Calibration_Block(QTextStream& content, QString& nextBlock);
bool Analyse_Certificate_Block(QTextStream& content, QString& nextBlock);
bool Analyse_b_self_Attenuation_Block(QTextStream& content, QString& nextBlock);
bool Analyse_b_Efficiency_Block(QTextStream& content, QString& nextBlock);
bool Analyse_Gps_Block(QTextStream &content, QString &nextBlock);
bool Verity_SampleReferenceId(QString srid);
private:
@ -52,6 +55,7 @@ private:
QStringList block_flag;
QVariantMap radionuclide_msg_data; // 因解析的数据的结构不同请其统一存储至QVariantMap容器中
RadionuclideData::AnalyseDataType analyse_data_type;
QString m_system_type = "";
};
#endif // RADIONUCLIDEMESSAGE_H

View File

@ -41,7 +41,6 @@ AnalyseFlow::AnalyseFlow(DataStore *store, QString strPath, ThrCallBack callFunc
// m_flowThread = new FlowThread(store->m_phd, store->GetNuclideLines(),store->m_vCount, strPath, callFunc);
m_flowThread = new FlowThread(store, strPath, callFunc);
m_flowThread->start();
// printf(" start thread!\n");
}
AnalyseFlow::~AnalyseFlow()

View File

@ -3248,3 +3248,126 @@ JNIEXPORT void JNICALL test_analyseSpectrum(const char* pszPath)
int aa = 0;
}
jstring Java_org_jeecg_modules_native_1jni_CalValuesHandler_selfBgAnalyse(JNIEnv *env, jclass, jstring phdFile, jstring json)
{
QString phdPath = CplusToJava::jstring2QString(env, phdFile);
//phd转换
PHDFile* phd = new PHDFile;
phd->filepath = phdPath;
if(!AlgFunc::LoadSpectrum(phd))
{
return env->NewStringUTF("");
}
QDateTime collectStart = QDateTime::fromString(phd->collect.collection_start_date + " " + phd->collect.collection_start_time, QString(DATATIME_FORMAT));
QDateTime collectStop = QDateTime::fromString(phd->collect.collection_stop_date + " " + phd->collect.collection_stop_time, QString(DATATIME_FORMAT));
QDateTime acqStart = QDateTime::fromString(phd->acq.acquisition_start_date + " " + phd->acq.acquisition_start_time, QString(DATATIME_FORMAT));
double tc = collectStart.secsTo(collectStop); // 采样时间
double tp = collectStop.secsTo(acqStart); // 衰变时间
double tr = phd->acq.acquisition_real_time; // 能谱获取实时间
double tl = phd->acq.acquisition_live_time; // 能谱获取活时间
// QMap<QString, double> sendOdds;
// QMap<QString, double> halfLife;
// QMap<QString, double> area;
QString jsonStr = CplusToJava::jstring2QString(env, json);
QJsonDocument doc;
doc = QJsonDocument::fromJson(jsonStr.toUtf8());
QJsonObject inObj = doc.object();
// QMap<QString, double> sendOdds = {{"XE-131m",(43.9) / 100.0},{"XE-133m",(45.7) / 100.0},{"XE-133",37 / 100.0},{"XE-135",90 / 100.0}};
// QMap<QString, double> halfLife = {{"XE-131m",11.93400 * (24 * 60 * 60)},{"XE-133m",2.190000 * (24 * 60 * 60)},{"XE-133",5.243000 * (24 * 60 * 60)},{"XE-135",0.380832 * (24 * 60 * 60)}};
//// QMap<QString, double> halfLife = {{"XE-131m",11.93400},{"XE-133m",2.190000 },{"XE-133",5.243000 },{"XE-135",0.380832 }};
// QMap<QString, double> area = {{"XE-131m",579},{"XE-133m",925},{"XE-133",2361},{"XE-135",363}};
QJsonArray data;
for(int i = 0; i < phd->bSelfAttenuation.devNames.size(); i++)
{
QString name = phd->bSelfAttenuation.devNames[i];
std::array<double, 3> self = phd->bSelfAttenuation.xenon[i];
std::array<double, 3> self2 = phd->bSelfAttenuation.nitrogen[i];
double vxe, vn2;
vxe = phd->process.sample_volume_of_Xe;
vn2 = phd->process.Xe_collection_yield;
QJsonObject factorObj = inObj[name].toObject();
double halfLife = factorObj["halflife"].toString().toDouble() * (24 * 60 * 60);
double sendOdds = factorObj["yield"].toString().toDouble() / 100.0;
double area = factorObj["area"].toString().toDouble();
double bgeff, geff;
double f;
double fxe = self[0] - self[1] * vxe + self[2] * pow(10, -5) * pow(vxe,2);
double fn2 = self2[0] - self2[0] * vn2 + self2[2] * pow(10, -4) * pow(vn2, 2);
f = fxe * fn2;
// if(phd->bSelfAttenuation.devNames[i].compare("XE-133") == 0)
// {
// double fxe133 = self[0] - self[1] * vxe + self[2] * pow(10, -5) * pow(vxe,2);
// double fn2133 = self2[0] - self2[0] * vn2 + self2[2] * pow(10, -4) * pow(vn2, 2);
// f = fxe133 * fn2133;
// }
// else if(phd->bSelfAttenuation.devNames[i].compare("XE-135") == 0)
// {
// double fxe135 = self[0] - self[1] * vxe + self[2] * pow(10, -5) * pow(vxe,2);
// double fn2135 = self2[0] - self2[0] * vn2 + self2[2] * pow(10, -4) * pow(vn2, 2);
// f = fxe135 * fn2135;
// }
// else if(phd->bSelfAttenuation.devNames[i].compare("XE-133m") == 0)
// {
// f = 1;
// }
// else if(phd->bSelfAttenuation.devNames[i].compare("XE-131m") == 0)
// {
// f = 1;
// }
for(int i2 = 0; i2 < phd->nMapbgEffiKD[CalPHD].nuclide_name.size(); i2++)
{
if(phd->nMapbgEffiKD[CalPHD].nuclide_name[i2].compare(name) == 0)
{
bgeff = phd->nMapbgEffiKD[CalPHD].bg_efficiency[i2];
break;
}
}
for(int i2 = 0; i2 < phd->nMapEffiKD[CalPHD].dev_name.size(); i2++)
{
if(phd->nMapEffiKD[CalPHD].dev_name[i2].compare(name) == 0)
{
geff = phd->nMapEffiKD[CalPHD].efficiency[i2];
break;
}
}
double e = exp(1.0); // 计算e的值
double ln2 = log(2);
double T = (halfLife);
double lambda = ln2 / T;
double kc = lambda * tr / (1 - pow(e, -(lambda * tr)));
double a_up = (area / f);
double a_low = (tl * bgeff * geff * sendOdds);
double a = (a_up / a_low) * kc;
double ac_mi = lambda * tp;
double ac_e = pow(e, ac_mi);
double ac_kc = (lambda * tc) / (1 - pow(e, -(lambda * tc)));
double ac = (1000 * a / (vxe / 0.087)) * ac_e * ac_kc;
qDebug() << "ac : " << ac;
QJsonObject obj;
obj["name"] = name;
obj["ac"] = ac;
data.push_back(obj);
}
QJsonDocument document;
document.setArray(data);
QByteArray simpbyte_array = document.toJson(QJsonDocument::Compact);
QString simpjson_str(simpbyte_array);
jstring jresult = env->NewStringUTF(simpjson_str.toStdString().c_str());
return jresult;
}

View File

@ -158,6 +158,14 @@ JNIEXPORT jstring JNICALL Java_org_jeecg_modules_native_1jni_CalValuesHandler_an
JNIEXPORT jstring JNICALL Java_org_jeecg_modules_native_1jni_CalValuesHandler_fitPeakFull
(JNIEnv *, jclass, jstring, jobject, jobject, jobject);
/*
* Class: org_jeecg_modules_native_jni_CalValuesHandler
* Method: selfBgAnalyse
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_jeecg_modules_native_1jni_CalValuesHandler_selfBgAnalyse
(JNIEnv *, jclass, jstring, jstring);
JNIEXPORT void JNICALL test_analyseSpectrum(const char* pszPath);
#ifdef __cplusplus