#include "gammaanalydatainterface.h" #include "DataManager_Define.h" #include "Settings.h" #include "MyLog4qt.h" #include "LogFormCreate.h" #include #define OPERATOR_AUTO QLatin1String("AUTOMATIC") #define OPERATOR_Interactive QLatin1String("Interactive") #define T_NUL_LIB_LOCAL QLatin1String("libdata") #define T_NUL_LINE_LOCAL QLatin1String("lines") #define T_RELEVANT_LOCAL QLatin1String("relevant") #define T_BASELINE_LOCAL QLatin1String("BaseLine") #define T_NUL_LIB_REMOTE QLatin1String("CONFIGURATION.GARDS_NUCL_LIB") #define T_NUL_LINE_REMOTE QLatin1String("CONFIGURATION.GARDS_NUCL_LINES_LIB") #define T_RELEVANT_REMOTE QLatin1String("CONFIGURATION.GARDS_RELEVANT_NUCLIDE") #define T_BASELINE_REMOTE QLatin1String("CONFIGURATION.GARDS_BASELINE") #define ENERGY_CAL QLatin1String("energy") #define EFFICIENCY_CAL QLatin1String("efficiency") #define RESOLUTION_CAL QLatin1String("Resolution") #define TOTALEFFICIENCY_CAL QLatin1String("TotalEfficiency") #define PHD QLatin1String("PHD") #define ARR_NAME_SUFFIX QLatin1String("_rpt") #define ARR_REPORT_PATH QLatin1String("Arr") #define SPECTRIM_PATH QLatin1String("Spectrum") #define PARTICULATES_PATH QLatin1String("Particulates") #define OTHER_PATH QLatin1String("Other") #define ERROR_PATH QLatin1String("Error") #define XENON_PATH QLatin1String("Xenon") #define XENON_SANNA_PATH QLatin1String("Sauna") #define XENON_SPALAX_PATH QLatin1String("Spalax") #define SOH_PATH QLatin1String("Soh") #define MET_PATH QLatin1String("Met") #define ALET_PATH QLatin1String("Alert") #define DB_LOG_FILE QLatin1String("Db") #define MAIL_SEND_FILE QLatin1String("Mail/Send") #define QCPHD_PATH QLatin1String("Qcphd") #define DETBKPHD_PATH QLatin1String("Detbkphd") #define SAMPLEPHD_PATH QLatin1String("Samplephd") #define GASBKPHD_PATH QLatin1String("Gasbkphd") #define DATETYPE_ERROR QLatin1String("Error") #define SQL_DATA_TYPE_G QLatin1String("G") #define SQL_DATA_TYPE_S QLatin1String("S") #define SQL_DATA_TYPE_B QLatin1String("B") #define SQL_DATA_TYPE_D QLatin1String("D") #define SQL_DATA_TYPE_C QLatin1String("C") #define SQL_DATA_TYPE_Q QLatin1String("Q") #define DATE_TIME_FORMAT QLatin1String("yyyyMMdd_hhmm") #define FILE_DATE_TIME_FORMAT QLatin1String("yyyy/MM/dd-hh:mm") #define FILE_DATE_TIME_SPACE_FORMAT QLatin1String("yyyy/MM/dd hh:mm") #define DATE_TIME_FORMAT_DD QLatin1String("yyyyMMdd") #define FILE_DATE_TIME_FORMAT_DD QLatin1String("yyyy/MM/dd") #define CFG_NULIDELIBRARY QLatin1String("/cfg/filesource/") #define BASELINE_SUFFIX QLatin1String("baseline") #define LC_SUFFIX QLatin1String("lc") #define SCAC_SUFFIX QLatin1String("scac") #define LOG_SUFFIX QLatin1String("log") #define TYPE_SUFFIX QLatin1String("%TYPE") #define LT_SUFFIX QLatin1String("%LT") #define TYPE_SYSTEM QLatin1String("%SYSTEM") #define SAMPLE_FILE_SUFFIX QString("_S_%1_%2.PHD").arg(TYPE_SUFFIX).arg(LT_SUFFIX) #define DETA_FILE_SUFFIX QString("_D_%1_%2.PHD").arg(TYPE_SUFFIX).arg(LT_SUFFIX) #define GAS_FILE_SUFFIX QString("_G_%1_%2.PHD").arg(TYPE_SUFFIX).arg(LT_SUFFIX) #define Q_FILE_SUFFIX QString("_Q_%1_%2.PHD").arg(TYPE_SUFFIX).arg(LT_SUFFIX) #define FILE_DATE_TIME_FORMAT2 QLatin1String("yyyy/MM/dd hh:mm:ss.zzz") #define FILE_DATE_TIME_FORMAT3 QLatin1String("yyyy/MM/dd-hh:mm:ss") #define FILE_DATE_TIME_FORMAT4 QLatin1String("yyyy/MM/dd-hh:mm:ss.zzz") #define FILE_DATE_TIME_FORMAT5 QLatin1String("yyyy/MM/dd-hh:mm:ss.z") #define COLUMN_WIDTH 30 GammaAnalyDataInterface::GammaAnalyDataInterface(QObject *parent):QObject(parent) { QString fileName; fileName=CSettings::Read(CFG_FILE_PATH+CFG_FILE_NAME,GROUP_CFG_FILE,KEY_BG_AUTO_PROCESS); m_SavefilePath = CSettings::Read(CFG_FILE_PATH+fileName,GROUP_BG_AUTO_DEAL,KEY_BG_AUTO_FILE_SAVE_PATH); m_SavefileRelationPath = m_SavefilePath; QDir dir(m_SavefilePath); m_SavefilePath = dir.absolutePath(); dir.setPath(m_SavefileRelationPath); m_SavefileRelationPath = dir.path(); fileName=CSettings::Read(CFG_FILE_PATH+CFG_FILE_NAME,GROUP_CFG_FILE,KEY_BG_AUTO_PROCESS); m_logFilePath = CSettings::Read(CFG_FILE_PATH+fileName,GROUP_BG_AUTO_LOG,KEY_BG_AUTO_LOG_PATH); m_logFileRelationPath = m_logFilePath; dir.setPath(m_logFilePath); m_logFilePath = dir.absolutePath(); dir.setPath(m_logFileRelationPath); m_logFileRelationPath = dir.path(); MyLog4qt::Instanace(); } QStringList GammaAnalyDataInterface::GetSysTemSubdir(const QString& _systemType) { QStringList subDirSavePath; if(_systemType.contains(SYSTEMTYPE_B)) { subDirSavePath.append(SPECTRIM_PATH); subDirSavePath.append(XENON_PATH); subDirSavePath.append(XENON_SANNA_PATH); } else if(_systemType.contains(SYSTEMTYPE_G)) { subDirSavePath.append(SPECTRIM_PATH); subDirSavePath.append(XENON_PATH); subDirSavePath.append(XENON_SPALAX_PATH); } else if(_systemType.contains(SYSTEMTYPE_P)) { subDirSavePath.append(SPECTRIM_PATH); subDirSavePath.append(PARTICULATES_PATH); } return subDirSavePath; } QStringList GammaAnalyDataInterface::GetDateTypeSubdir(const QString& _dateType) { QStringList subDirSavePath; if(_dateType.contains(DATATYPE_SAMPLEPHD)) { subDirSavePath.append(SAMPLEPHD_PATH); } else if(_dateType.contains(DATATYPE_QCPHD)) { subDirSavePath.append(QCPHD_PATH); } else if(_dateType.contains(DATATYPE_DETBKPHD)) { subDirSavePath.append(DETBKPHD_PATH); } else if(_dateType.contains(DATATYPE_GASBKPHD)) { subDirSavePath.append(GASBKPHD_PATH); } else if(_dateType.contains(DATETYPE_SOH)) { subDirSavePath.append(SOH_PATH); } else if(_dateType.contains(DATETYPE_MET)) { subDirSavePath.append(MET_PATH); } else if(_dateType.contains(DATETYPE_ALERT_FLOW)|| _dateType.contains(DATETYPE_ALERT_SYSTEM)|| _dateType.contains(DATETYPE_ALERT_TEMP)|| _dateType.contains(DATETYPE_ALERT_UPS)) { subDirSavePath.append(ALET_PATH); } else if(_dateType.contains(DATETYPE_ERROR)) { subDirSavePath.append(ERROR_PATH); } else { subDirSavePath.append(OTHER_PATH); } return subDirSavePath; } void GammaAnalyDataInterface::GetReportFixedWidth(MyReport::reportTableCell& _cell,MyReport::reportTableGroup& _group,int width,QString _data) { for(int m=0;m<=_data.size()/width;m++) { if(m>0) { _cell.Flag=""; } _cell.Data.clear(); if((m+1)*width<_data.size()) { _cell.Data<<_data.mid(m*width,width); } else { _cell.Data<<_data.mid(m*width); } _group.data.append(_cell); } } QStringList GammaAnalyDataInterface::GetSubDirByFileName(const QString& _fileName) { QStringList rData; int pos = _fileName.indexOf('-'); if(-1 == pos) { // } else if(_fileName.size()>=pos+7) { rData.append(_fileName.mid(pos+1,4)); rData.append(_fileName.mid(pos+5,2)); // rData.append(_fileName.mid(pos+7,2)); } return rData; } QString GammaAnalyDataInterface::GetLCPathFileName() { QString data = m_SavefileRelationPath+QDir::separator(); data += m_lcFileName; return PathStandard(data); } QString GammaAnalyDataInterface::GetLCFileName() { QDir dir(m_lcFileName); QString fileName = dir.dirName(); return fileName; } QString GammaAnalyDataInterface::GetLCFilePath() { QString data; data += m_lcFileName; QFileInfo file(data); QString filePath = file.path(); return PathStandard(filePath); } QString GammaAnalyDataInterface::GetBasePathFileName() { QString data = m_SavefileRelationPath+QDir::separator(); data += m_baseLineFileName; return PathStandard(data); } QString GammaAnalyDataInterface::GetBaseFileName() { QDir dir(m_baseLineFileName); QString fileName = dir.dirName(); return fileName; } QString GammaAnalyDataInterface::GetBaseFilePath() { QString data; data += m_baseLineFileName; QFileInfo file(data); QString filePath = file.path(); return PathStandard(filePath); } QString GammaAnalyDataInterface::GetScacPathFileName() { QString data = m_SavefileRelationPath+QDir::separator(); data += m_scacFileName; return PathStandard(data); } QString GammaAnalyDataInterface::GetScacFileName() { QDir dir(m_scacFileName); QString fileName = dir.dirName(); return fileName; } QString GammaAnalyDataInterface::GetScacFilePath() { QString data; data += m_scacFileName; QFileInfo file(data); QString filePath = file.path(); return PathStandard(filePath); } QString GammaAnalyDataInterface::GetReportPathFileName() { QString data = m_SavefileRelationPath+QDir::separator()+ARR_REPORT_PATH+QDir::separator(); data += m_reportFileName; return PathStandard(data); } QString GammaAnalyDataInterface::GetReportFileName() { QDir dir(m_reportFileName); QString fileName = dir.dirName(); return fileName; } QString GammaAnalyDataInterface::GetReportFilePath() { QString data; data += m_reportFileName; QFileInfo file(data); QString filePath = file.path(); return PathStandard(filePath); } QString GammaAnalyDataInterface::GetSavePathFileName() { QString data = m_SavefileRelationPath+QDir::separator()+ARR_REPORT_PATH+QDir::separator(); data += m_saveFileName; return PathStandard(data); } QString GammaAnalyDataInterface::GetSaveFileName() { QDir dir(m_saveFileName); QString fileName = dir.dirName(); return fileName; } QString GammaAnalyDataInterface::GetSaveFilePath() { QString data; data += m_saveFileName; QFileInfo file(data); QString filePath = file.path(); return PathStandard(filePath); } QString GammaAnalyDataInterface::GetLogPathFileName() { QString data = m_logFileRelationPath+QDir::separator(); data += m_logfileName; return PathStandard(data); } QString GammaAnalyDataInterface::GetLogFileName() { QDir dir(m_logfileName); QString fileName = dir.dirName(); return fileName; } QString GammaAnalyDataInterface::GetLogFilePath() { QString data; data += m_logfileName; QFileInfo file(data); QString filePath = file.path(); return PathStandard(filePath); } QString GammaAnalyDataInterface::PathStandard(const QString& _path) { QString rData=_path; rData.replace('\\','/'); return rData; } QString GammaAnalyDataInterface::GetSavefileRelationPathFileName() { // QString input_file_name=m_SavefileRelationPath+QDir::separator(); QString input_file_name; QStringList lst = m_subDir; for(int pos=0;pos1) { first = lstTemp.at(0); // return rData; } if(first.size()>3) { QString temp=QLatin1String("-"); for(int pos=1;pos GammaAnalyDataInterface::DoubleLimit(QVector _data) { QVector rdata; for(int pos=0;pos<_data.size();pos++) { if(qIsNaN(_data.at(pos))) { rdata<<"NULL"; m_info = QLatin1String("data has NULL"); // test = QString::number(_data.at(pos)); } else if(qIsInf(_data.at(pos))) { rdata<<"NULL"; m_info = QLatin1String("data has INF"); } else { rdata< GammaAnalyDataInterface::DoubleLimit_G(QVector _data) { QString test; QVector rdata; for(int pos=0;pos<_data.size();pos++) { if(qIsNaN(_data.at(pos))) { rdata<<"NULL"; m_info = QLatin1String("data has NULL INF"); // test = QString::number(_data.at(pos)); } else if(qIsInf(_data.at(pos))) { rdata<<"NULL"; m_info = QLatin1String("data has INF"); } else { rdata< GammaAnalyDataInterface::DoubleLimit(QVector &data) { for(int pos=0;pos GammaAnalyDataInterface::GetPercent(QVector &one,QVector &two) { QVector rData; if(one.size() == two.size()) { for(int m=0;m GammaAnalyDataInterface::GetThreePoint(QVector source) { QVector rData; for(int m=0;m GammaAnalyDataInterface::GetPass(QVector source) { QVector rData; for(int m=0;m &nucline,structGStoreMiddleProcessData& middleData) { return GetMiddleData(fileAnlyse,nucline,middleData,Auto); } bool GammaAnalyDataInterface::GetInterMiddlData(PHDFile& fileAnlyse,structGStoreMiddleProcessData& middleData) { bool bRet = true; QMap temp; bRet = GetMiddleData(fileAnlyse,temp,middleData,InterAction); middleData.analyses_type =OPERATOR_Interactive; return bRet; } bool GammaAnalyDataInterface::WriteLog(structGStoreMiddleProcessData& middleData) { bool bRet=true; QString logName= m_logFilePath+QDir::separator()+middleData.analyses_LogPath; MyLog4qt::MakeNewFileLogger(logName); MyLog4qt::SetLoggerText(logName, GetLogContent(middleData)); MyLog4qt::RemoveLogger(logName); /*QString logName= m_logFilePath+QDir::separator()+middleData.analyses_LogPath; MyLog4qt::MakeNewFileLogger(logName); MyLog4qt::SetLoggerText(logName,CLogFormCreate::AnlyseResultsBegin()); QVector logAtributeData; LOGFORMCREATE::AttributeContext logAtributeItem; logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Channel"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_E_xValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Energy"); logAtributeItem.unit = QLatin1String("keV"); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_E_yValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Error"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context =GetThreePoint(middleData.calibration_pairs_S_E_uncYValue); logAtributeData.append(logAtributeItem); MyLog4qt::SetLoggerText(logName,CLogFormCreate::TitleCalibration()); MyLog4qt::SetLoggerText(logName,CLogFormCreate::GSetSampleEnergyChannel(logAtributeData,middleData.sample_id)); logAtributeData.clear(); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Channel"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_EF_xValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Energy"); logAtributeItem.unit = QLatin1String("keV"); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_EF_yValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Error"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_EF_uncYValue); logAtributeData.append(logAtributeItem); MyLog4qt::SetLoggerText(logName,CLogFormCreate::GSetSampleEfficiencyChannel(logAtributeData,middleData.sample_id)); logAtributeData.clear(); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Channel"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_R_xValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Energy"); logAtributeItem.unit = QLatin1String("keV"); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_R_yValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Error"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_R_uncYValue); logAtributeData.append(logAtributeItem); MyLog4qt::SetLoggerText(logName,CLogFormCreate::GSetSampleResolutionChannel(logAtributeData,middleData.sample_id)); logAtributeData.clear(); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Channel"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = middleData.calibration_pairs_S_T_xValue; logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Energy"); logAtributeItem.unit = QLatin1String("keV"); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_T_yValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Error"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_T_uncYValue); logAtributeData.append(logAtributeItem); MyLog4qt::SetLoggerText(logName,CLogFormCreate::GSetSampleTotalEfficiencyChannel(logAtributeData,middleData.sample_id)); QStringList lstAtribute; QStringList lstContext; lstAtribute<0) { lstAtribute.clear(); lstContext.clear(); lstAtribute<0) { lstAtribute.clear(); lstContext.clear(); lstAtribute<0) { lstAtribute.clear(); lstContext.clear(); lstAtribute<0) { lstAtribute.clear(); lstContext.clear(); lstAtribute<1) { qsNuclidesName = qsNuclidesName+middleData.nucl_ided_Nuclidename.at(middleData.nucl_ided_Nuclidename.size()-1); } lstAtribute< logAtributeData; LOGFORMCREATE::AttributeContext logAtributeItem; logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Channel"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_E_xValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Energy"); logAtributeItem.unit = QLatin1String("keV"); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_E_yValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Error"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context =GetThreePoint(middleData.calibration_pairs_S_E_uncYValue); logAtributeData.append(logAtributeItem); /////////////////////////////////////////////////////////////// strResults += CLogFormCreate::TitleCalibration(); strResults += CLogFormCreate::GSetSampleEnergyChannel(logAtributeData,middleData.sample_id); logAtributeData.clear(); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Channel"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_EF_xValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Energy"); logAtributeItem.unit = QLatin1String("keV"); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_EF_yValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Error"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_EF_uncYValue); logAtributeData.append(logAtributeItem); ///////////////////////////////////////////////////////////////////////////// strResults += CLogFormCreate::GSetSampleEfficiencyChannel(logAtributeData,middleData.sample_id); logAtributeData.clear(); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Channel"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_R_xValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Energy"); logAtributeItem.unit = QLatin1String("keV"); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_R_yValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Error"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_R_uncYValue); logAtributeData.append(logAtributeItem); ///////////////////////////////////////////////////////////////////////////////// strResults += CLogFormCreate::GSetSampleResolutionChannel(logAtributeData,middleData.sample_id); logAtributeData.clear(); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Channel"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = middleData.calibration_pairs_S_T_xValue; logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Energy"); logAtributeItem.unit = QLatin1String("keV"); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_T_yValue); logAtributeData.append(logAtributeItem); logAtributeItem.context.clear(); logAtributeItem.atrribute= QLatin1String("Error"); logAtributeItem.unit = QLatin1String(""); logAtributeItem.context = GetThreePoint(middleData.calibration_pairs_S_T_uncYValue); logAtributeData.append(logAtributeItem); //////////////////////////////////////////////////////////////////////////////////// strResults += CLogFormCreate::GSetSampleTotalEfficiencyChannel(logAtributeData,middleData.sample_id); QStringList lstAtribute; QStringList lstContext; lstAtribute<0) { lstAtribute.clear(); lstContext.clear(); lstAtribute<0) { lstAtribute.clear(); lstContext.clear(); lstAtribute<0) { lstAtribute.clear(); lstContext.clear(); lstAtribute<0) { lstAtribute.clear(); lstContext.clear(); lstAtribute<1) { qsNuclidesName = qsNuclidesName+middleData.nucl_ided_Nuclidename.at(middleData.nucl_ided_Nuclidename.size()-1); } lstAtribute<columnWidth = ReportOutput::GetMaxColumnSize(_text); QMap::iterator itor = columnWidth.begin(); int width=0; int maxWidth=0; for(;itor!=columnWidth.end();itor++) { *itor+=COL_GAP; width+=itor.value(); if(maxWidth title = _text.tilte; QString strResults; QTextStream stream(&strResults); stream.setFieldAlignment(QTextStream::AlignCenter); for(int pos=0;pos0) { //flag for(int fRow=0;fRowtRow) { stream<1) { qsNuclidesName = qsNuclidesName+middleData.nucl_ided_Nuclidename.at(middleData.nucl_ided_Nuclidename.size()-1); } group.data.clear(); group.header = QLatin1String("ACTIVITY SUMMARY"); cell.Flag = QLatin1String("Nuclides Identified"); // cell.Data.clear(); // cell.Data<0) { group.data.clear(); group.header = QLatin1String("Calibration"); cell.Flag = QString("Energy Calibration [%1 ]").arg(middleData.calibration_pairs_E_Input); cell.Data.clear(); cell.Data<0) { group.data.clear(); group.header = QLatin1String(""); cell.Flag = QString("Resolution Calibration [%1 ]").arg(middleData.calibration_pairs_R_Input); cell.Data.clear(); cell.Data<0) { group.data.clear(); group.header = QLatin1String(""); cell.Flag = QString("Efficiency Calibration [%1 ]").arg(middleData.calibration_pairs_EF_Input); cell.Data.clear(); cell.Data<0) { group.data.clear(); group.header = QLatin1String(""); cell.Flag = QString("Tot_efficiency Calibration [%1 ]").arg(middleData.calibration_pairs_T_Input); cell.Data.clear(); cell.Data<SetReportText(inputPara); report_creat->deleteLater(); report_creat=0; } return bRet; } void GammaAnalyDataInterface::MkDir(QString fileName) { QDir dirPath(fileName); if(!dirPath.exists()) { QFileInfo info(fileName); dirPath.mkpath(info.absolutePath()); } } bool GammaAnalyDataInterface::GetMiddleData(PHDFile& fileAnlyse,QMap &nucline,structGStoreMiddleProcessData& middleData,enum_middleDataType type) { m_info.clear(); bool bRet=true; //标准名称规范化 SetDataFile(fileAnlyse.filepath); QString dataType = fileAnlyse.msgInfo.data_type; QStringList subDirSavePath; subDirSavePath << GetSysTemSubdir(fileAnlyse.header.system_type); subDirSavePath << GetDateTypeSubdir(dataType); SetSaveSubdir(subDirSavePath); NameStandard(fileAnlyse); SetFileDir(); middleData.analyses_analyst=GetAnlyseName(); QString qsSaveFile = m_saveFileName; QString qsLogPath=PathStandard(GetLogFilePath()+QDir::separator()+middleData.analyses_analyst+QLatin1String("_")+GetLogFileName()); QString qsReportPath=PathStandard(ARR_REPORT_PATH+QDir::separator()+GetReportFilePath()+QDir::separator()+middleData.analyses_analyst+QLatin1String("_")+GetReportFileName()); middleData.analyses_save_filePath = qsSaveFile; middleData.analyses_LogPath = qsLogPath; middleData.analyses_ReportPath = qsReportPath; //获取算法数据 if(type == Auto) { QString anylseBegin; QString anylseEnd; anylseBegin =DateTimeStandard(QDateTime::currentDateTime()); // AlgFunc::LoadSpectrum(&fileAnlyse); GammaAnalyALG alg; try { bRet = alg.AnalyseSpectrum(&fileAnlyse,nucline); } catch(...) { m_info = QLatin1String("arithmetic exception"); middleData.ErrorInfo = m_info; return false; } if(!bRet) { m_info=QLatin1String("arithmetic error"); middleData.ErrorInfo = m_info; // return bRet; } anylseEnd =DateTimeStandard(QDateTime::currentDateTime()); middleData.analyses_analysisBegin = anylseBegin; middleData.analyses_analysisEnd = anylseEnd; } //gards_analyses QString qsBaseLinePath = PathStandard(GetBaseFilePath()+QDir::separator()+middleData.analyses_analyst+QLatin1String("_")+GetBaseFileName()); // m_baseLineFileName; QString qsLcPath=PathStandard(GetLCFilePath()+QDir::separator()+middleData.analyses_analyst+QLatin1String("_")+GetLCFileName()); QString qsScacPath=PathStandard(GetScacFilePath()+QDir::separator()+middleData.analyses_analyst+QLatin1String("_")+GetScacFileName()); //Add By XYL 20170718 QString szFilePath = m_SavefilePath+QDir::separator()+PathStandard(GetBaseFilePath()); QDir BaseFilePath(szFilePath); if(!BaseFilePath.exists()) { BaseFilePath.mkpath(szFilePath); } szFilePath = m_SavefilePath+QDir::separator()+PathStandard(GetLCFilePath()); QDir LCFilePath(szFilePath); if(!LCFilePath.exists()) { LCFilePath.mkpath(szFilePath); } szFilePath = m_SavefilePath+QDir::separator()+PathStandard(GetScacFilePath()); QDir ScacFilePath(szFilePath); if(!ScacFilePath.exists()) { ScacFilePath.mkpath(szFilePath); } //Add By XYL 20170718 QString qsSaveBaseLine = m_SavefilePath+QDir::separator()+qsBaseLinePath; QString qsSaveLc = m_SavefilePath+QDir::separator()+qsLcPath; QString qsSaveScac = m_SavefilePath+QDir::separator()+qsScacPath; AlgFunc::WriteBaseInfo(fileAnlyse.baseCtrls,qsSaveBaseLine); AlgFunc::WriteLcScac(fileAnlyse.vLc,WRITE_LC,qsSaveLc); AlgFunc::WriteLcScac(fileAnlyse.vScac,WRITE_SCAC,qsSaveScac); double totalNumber = 0.0; for(int m=0;m temp; if(fileAnlyse.usedEnerKD.g_energy.size() != 0) { middleData.calibration_pairs_E_Caltype = ENERGY_CAL; middleData.calibration_pairs_E_Input = fileAnlyse.usedEner; middleData.calibration_pairs_S_E_Caltype = ENERGY_CAL; middleData.calibration_pairs_S_E_Input = fileAnlyse.usedEner; for(int pos=0;pos0) { funcType = fileAnlyse.usedEnerPara.p.at(0); } for(int m=1;m0) { coeff+=QString::number(fileAnlyse.usedEnerPara.p.at(coeffNumber-1),'e'); } uncerNumber = fileAnlyse.usedEnerPara.perr.size(); for(int m=0;m0) { uncer+=QString::number(fileAnlyse.usedEnerPara.perr.at(uncerNumber-1),'e'); } funcDef = AlgFunc::EquationDescription(funcType); funcTypeDef = AlgFunc::EquationName(funcType); middleData.calibration_E_Caltype = ENERGY_CAL; middleData.calibration_E_function = funcType; middleData.calibration_E_functionDef = funcDef; middleData.calibration_E_functionTypeDef = funcTypeDef; middleData.calibration_E_startOfRange = 0; middleData.calibration_E_endOfRange = 1; middleData.calibration_E_coeff_string = coeff; coeff.clear(); uncer.clear(); coeffNumber = fileAnlyse.usedEffiPara.p.size(); if(coeffNumber>0) { funcType = fileAnlyse.usedEffiPara.p.at(0); } for(int m=1;m0) { coeff+=QString::number(fileAnlyse.usedEffiPara.p.at(coeffNumber-1),'e'); } uncerNumber = fileAnlyse.usedEffiPara.perr.size(); for(int m=0;m0) { uncer+=QString::number(fileAnlyse.usedEffiPara.perr.at(uncerNumber-1),'e'); } funcDef = AlgFunc::EquationDescription(funcType); funcTypeDef = AlgFunc::EquationName(funcType); middleData.calibration_EF_Caltype = EFFICIENCY_CAL; middleData.calibration_EF_function = funcType; middleData.calibration_EF_functionDef = funcDef; middleData.calibration_EF_functionTypeDef = funcTypeDef; middleData.calibration_EF_startOfRange = 0; middleData.calibration_EF_endOfRange = 1; middleData.calibration_EF_coeff_string = coeff; coeff.clear(); uncer.clear(); coeffNumber = fileAnlyse.usedResoPara.p.size(); if(coeffNumber>0) { funcType = fileAnlyse.usedResoPara.p.at(0); } for(int m=1;m0) { coeff+=QString::number(fileAnlyse.usedResoPara.p.at(coeffNumber-1),'e'); } uncerNumber = fileAnlyse.usedResoPara.perr.size(); for(int m=0;m0) { uncer+=QString::number(fileAnlyse.usedResoPara.perr.at(uncerNumber-1),'e'); } funcDef = AlgFunc::EquationDescription(funcType); funcTypeDef = AlgFunc::EquationName(funcType); middleData.calibration_R_Caltype = RESOLUTION_CAL; middleData.calibration_R_function = funcType; middleData.calibration_R_functionDef = funcDef; middleData.calibration_R_functionTypeDef = funcTypeDef; middleData.calibration_R_startOfRange = 0; middleData.calibration_R_endOfRange = 1; middleData.calibration_R_coeff_string = coeff; coeff.clear(); uncer.clear(); coeffNumber = fileAnlyse.usedTotEPara.p.size(); if(coeffNumber>0) { funcType = fileAnlyse.usedTotEPara.p.at(0); } for(int m=1;m0) { coeff+=QString::number(fileAnlyse.usedTotEPara.p.at(coeffNumber-1),'e'); } uncerNumber = fileAnlyse.usedTotEPara.perr.size(); for(int m=0;m0) { uncer+=QString::number(fileAnlyse.usedTotEPara.perr.at(uncerNumber-1),'e'); } funcDef = AlgFunc::EquationDescription(funcType); funcTypeDef = AlgFunc::EquationName(funcType); middleData.calibration_T_Caltype = TOTALEFFICIENCY_CAL; middleData.calibration_T_function = funcType; middleData.calibration_T_functionDef = funcDef; middleData.calibration_T_functionTypeDef = funcTypeDef; middleData.calibration_T_startOfRange = 0; middleData.calibration_T_endOfRange = 1; middleData.calibration_T_coeff_string = coeff; //gards_ peaks数据表 if(fileAnlyse.vPeak.size() != 0) { QVector dvctIDPEAK; QVector dvctCENTROIDCHANNEL; QVector dvctUNCCENTROIDCHANNEL; QVector dvctENERGY; QVector dvctUNCENERGY; QVector dvctAREA; QVector dvctnetCountRate; QVector dvctuncNetCountRate; QVector dvctUNCAREA; QVector dvctEFFICIENCY; QVector dvctUNCEFFICIENCY; QVector dvctFWHM; QVector dvctFWTM; QVector dvctSIGNIFICANCE; QVector dvctSENSITIVITY; QVector dvctMULTIINDEX; QVector dvctROISTART; QVector dvctROIEND; QVector dvctTAIL; QVector dvctTAILALPHA; QVector dvctUPPERTAIL; QVector dvctUPPERTAILALPHA; QVector dvctBWWIDTHCHAN; QVector dvctRECOILBETACHAN; QVector dvctRECOILDELTACHAN; QVector dvctSTEPRAIO; QVector dvctBACKGROUNDAREA; QVector dvctMEANBACKCOUNT; QVector dvctLC; QVector dvctLD; QVector dvctNuclide_name; QVector dvctComments; for(int m=0;m 1024) t_comment = t_comment.left(1024); dvctComments.append(t_comment); QString qsName; for(int n=0;n::iterator itor = fileAnlyse.mapNucActMda.begin(); for(;itor!=fileAnlyse.mapNucActMda.end();itor++) { structGStoreMiddleProcessDataNuclLinesIded nucl_lines_ided_data; QVector svctNUCLIDEFULLNAME; QVector dvctIDPEAK; QVector dvctENERGY; QVector dvctUNCENERGY; QVector dvctABUNDANCE; QVector dvctUNCABUNDANCE; QVector dvctACTIVITY; QVector dvctUNCACTIVITY; QVector dvctEFFIC; QVector dvctUNEFFIC; QVector dvctMDA; QVector dvctKEY_FLAG; QVector dvctCSC_RATIO; QVector dvctCSC_RATIO_ERR; QVector dvctCSC_MOD_FLAG; QVector dvctMDC; QVector dvctCONCENTRATION; int first=itor.value().fullNames.size(); int second=itor.value().vPeakIdx.size(); first = qMin(first,second); second = itor.value().vEnergy.size(); first = qMin(first,second); second = itor.value().vUncertE.size(); first = qMin(first,second); second = itor.value().vYield.size(); first = qMin(first,second); second = itor.value().vUncertY.size(); first = qMin(first,second); for(int m=0;m svctNUCLIDEFULLNAME; QVector svctTYPE; QVector dvctHALFLIFE; QVector dvctAVE_ACTIV; QVector dvctAVE_ACTIV_ERR; QVector dvctACTIV_KEY; QVector dvctACTIV_KEY_ERR; QVector dvctMDA; QVector dvctMDA_ERR; QVector dvctNID_FLAG; QVector dvctCSC_RATIO; QVector dvctCSC_RATIO_ERR; QVector dvctCSC_MOD_FLAG; QVector dvctMDC; QVector dvctCONCENTRATION; QVector dvctKey_Energy; QVector dvctKey_Yield; if( fileAnlyse.mapNucActMda.size() != 0) { QMap::iterator itor_v = fileAnlyse.mapNucActMda.begin(); for(;itor_v!=fileAnlyse.mapNucActMda.end();itor_v++) { QString nuclideName = itor_v.key(); svctNUCLIDEFULLNAME.append(nuclideName); dvctHALFLIFE.append(itor_v.value().halflife); dvctACTIV_KEY.append(itor_v.value().activity); dvctACTIV_KEY_ERR.append(itor_v.value().act_err); dvctMDA.append(QString::number(itor_v.value().mda,'e')); dvctMDC.append(QString::number(itor_v.value().mdc,'e')); dvctCONCENTRATION.append(QString::number(itor_v.value().concentration,'e')); // QString stest = QString::number(itor_v.value().concentration,'e'); // double dtest = stest.toDouble(); // dvctTYPE.append(itor.value().vPeakIdx.at(m)); // dvctACTIV_KEY.append(itor.value().vUncertY.at(m)); // dvctACTIV_KEY_ERR.append(itor.value().activity); // dvctMDA_ERR.append(itor.value().efficiency); // dvctNID_FLAG.append(itor.value().effi_err); // dvctKEY_FLAG.append(itor.value().vYield.at(m)); dvctCSC_RATIO.append(1); dvctCSC_RATIO_ERR.append(0); if(itor_v.value().calculateIdx qvctQC_NAME; QVector dvctQC_VALUE; QVector qvctQC_STANDARD; QVector dvctQC_RESULT; if( fileAnlyse.QcItems.size() != 0) { QMap::iterator itor_q = fileAnlyse.QcItems.begin(); for(;itor_q!=fileAnlyse.QcItems.end();itor_q++) { QString nuclideName = itor_q.key(); qvctQC_NAME.append(nuclideName); dvctQC_VALUE.append(itor_q.value().value); qvctQC_STANDARD.append(itor_q.value().standard); dvctQC_RESULT.append(itor_q.value().bPass); } middleData.QC_CHECK_QC_NAME=qvctQC_NAME; middleData.QC_CHECK_QC_RESULT=DoubleLimit_G(dvctQC_RESULT); middleData.QC_CHECK_QC_STANDARD=qvctQC_STANDARD; middleData.QC_CHECK_QC_VALUE=DoubleLimit_G(dvctQC_VALUE); } middleData.ErrorInfo = m_info; //sample info middleData.sample_collection_start = DateTimeSpaceStandard(fileAnlyse.collect.collection_start_date+fileAnlyse.collect.collection_start_time); middleData.sample_collection_stop = DateTimeSpaceStandard(fileAnlyse.collect.collection_stop_date+fileAnlyse.collect.collection_stop_time); if(fileAnlyse.QcItems.contains(QC_COL_TIME)) { middleData.sample_time = QString::number(fileAnlyse.QcItems[QC_COL_TIME].value); if(fileAnlyse.QcItems[QC_COL_TIME].value!=0) { middleData.sample_Avg_Flow_Rate = QString::number(fileAnlyse.collect.air_volume/fileAnlyse.QcItems[QC_COL_TIME].value); } } if(fileAnlyse.QcItems.contains(QC_DECAY_TIME)) { middleData.sample_decay_time = QString::number(fileAnlyse.QcItems[QC_DECAY_TIME].value); } if(fileAnlyse.QcItems.contains(QC_ACQ_TIME)) { middleData.sample_acquistion_time = QString::number(fileAnlyse.QcItems[QC_ACQ_TIME].value); } middleData.sample_quantity = QString::number(fileAnlyse.collect.air_volume); middleData.sample_acquisiton_start = DateTimeSpaceStandard(fileAnlyse.acq.acquisition_start_date+fileAnlyse.acq.acquisition_start_time); QString acquisition_start = middleData.sample_acquisiton_start; QDateTime dataTime = StringToDateTimeStandard(acquisition_start); acquisition_start = DateTimeSpaceStandard(acquisition_start); dataTime = dataTime.addSecs(fileAnlyse.acq.acquisition_live_time); middleData.sample_acquistion_stop = DateTimeSpaceStandard(dataTime); middleData.sample_acquistion_time =QString::number(fileAnlyse.acq.acquisition_real_time) ; middleData.sample_stationID = fileAnlyse.header.site_code; middleData.sample_detectID = fileAnlyse.header.detector_code; middleData.sample_Geometry = fileAnlyse.header.sample_geometry; middleData.sample_Type = fileAnlyse.header.system_type; middleData.setting_specSetup = fileAnlyse.usedSetting; middleData.Collection_Station_Comments = fileAnlyse.oriTotalCmt; middleData.NDC_Analysis_General_Comments = fileAnlyse.totalCmt; return bRet; } QString GammaAnalyDataInterface::DateTimeSpaceStandard(const QDateTime&_data) { return _data.toString(DATATIME_FORMAT_SPACE_SECONDS); } QDateTime GammaAnalyDataInterface::StringToDateTimeStandard(const QString&_data) { QDateTime dateTime = QDateTime::fromString(_data,DATATIME_FORMAT_NOSPACE); if(dateTime.isNull()) { dateTime = QDateTime::fromString(_data,DATATIME_FORMAT_SECONDS); if(dateTime.isNull()) { dateTime = QDateTime::fromString(_data,DATATIME_FORMAT_SPACE_SECONDS); } } return dateTime; } QString GammaAnalyDataInterface::DateTimeSpaceStandard(const QString&_data) { QDateTime dateTime = QDateTime::fromString(_data,DATATIME_FORMAT_NOSPACE); if(dateTime.isNull()) { dateTime = QDateTime::fromString(_data,DATATIME_FORMAT_SECONDS); if(dateTime.isNull()) { dateTime = QDateTime::fromString(_data,DATATIME_FORMAT_SPACE_SECONDS); } } return dateTime.toString(DATATIME_FORMAT_SPACE_SECONDS); }