add a identiflier in the sol file to indicate the id of digi

This commit is contained in:
Ryan Tang 2023-03-27 18:21:51 -04:00
parent 6a37002b5d
commit d839def1f2
3 changed files with 9 additions and 3 deletions

View File

@ -765,7 +765,7 @@ void Digitizer2Gen::ReadAllSettings(){
} }
} }
int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName){ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnly){
if( saveFileName != NULL) settingFileName = saveFileName; if( saveFileName != NULL) settingFileName = saveFileName;
int totCount = 0; int totCount = 0;
@ -811,6 +811,11 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName){
return -1; return -1;
} }
if( setReadOnly ){
int result = chmod(saveFileName, S_IRUSR | S_IRGRP | S_IROTH);
if( result != 0 ) printf("somewrong when set file (%s) to read only.", saveFileName);
}
//printf("Saved setting files to %s\n", saveFileName); //printf("Saved setting files to %s\n", saveFileName);
return 1; return 1;

View File

@ -130,7 +130,7 @@ class Digitizer2Gen {
std::string GetSettingFileName() const {return settingFileName;} std::string GetSettingFileName() const {return settingFileName;}
void SetSettingFileName(std::string fileName) {settingFileName = fileName;} void SetSettingFileName(std::string fileName) {settingFileName = fileName;}
void ReadAllSettings(); // read settings from digitier and save to memory void ReadAllSettings(); // read settings from digitier and save to memory
int SaveSettingsToFile(const char * saveFileName = NULL); //Save settings from memory to text file int SaveSettingsToFile(const char * saveFileName = NULL, bool setReadOnly = false); //Save settings from memory to text file
int ReadAndSaveSettingsToFile(const char * saveFileName = NULL); // ReadAllSettings + text file int ReadAndSaveSettingsToFile(const char * saveFileName = NULL); // ReadAllSettings + text file
bool LoadSettingsFromFile(const char * loadFileName = NULL); // Load settings, write to digitizer and save to memory bool LoadSettingsFromFile(const char * loadFileName = NULL); // Load settings, write to digitizer and save to memory

View File

@ -404,7 +404,8 @@ void MainWindow::StartACQ(){
QString fileSetting = rawDataFolder + "/" + expName + "_" + runIDStr + "XSetting_" + QString::number(digi[i]->GetSerialNumber()) + ".dat"; QString fileSetting = rawDataFolder + "/" + expName + "_" + runIDStr + "XSetting_" + QString::number(digi[i]->GetSerialNumber()) + ".dat";
digi[i]->SaveSettingsToFile(fileSetting.toStdString().c_str()); digi[i]->SaveSettingsToFile(fileSetting.toStdString().c_str());
QString outFileName = rawDataFolder + "/" + expName + "_" + runIDStr + "_" + QString::number(digi[i]->GetSerialNumber()); // name should be [ExpName]_[runID]_[digiID]_[digiSerialNumber]_[acculmulate_count].sol
QString outFileName = rawDataFolder + "/" + expName + "_" + runIDStr + "_" + QString::number(i).rightJustified(2, '0') + "_" + QString::number(digi[i]->GetSerialNumber());
qDebug() << outFileName; qDebug() << outFileName;
digi[i]->OpenOutFile(outFileName.toStdString());// overwrite digi[i]->OpenOutFile(outFileName.toStdString());// overwrite
} }