2022-10-14 18:27:31 -04:00
|
|
|
#include <TApplication.h>
|
|
|
|
#include <TGClient.h>
|
2022-10-31 16:39:19 -04:00
|
|
|
#include <TSystem.h>
|
2022-10-14 18:27:31 -04:00
|
|
|
#include <TCanvas.h>
|
|
|
|
#include <TF1.h>
|
|
|
|
#include <TRandom.h>
|
|
|
|
#include <TRootEmbeddedCanvas.h>
|
|
|
|
#include <TGTableContainer.h>
|
|
|
|
#include <TGFileDialog.h>
|
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
#include <fstream>
|
|
|
|
#include <iostream>
|
2022-10-31 16:39:19 -04:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <experimental/filesystem>
|
2022-10-26 18:38:55 -04:00
|
|
|
|
2022-10-14 18:27:31 -04:00
|
|
|
#include "programSetting.h"
|
|
|
|
|
2022-10-31 16:39:19 -04:00
|
|
|
namespace fs = std::experimental::filesystem;
|
|
|
|
|
2022-10-31 21:26:10 -04:00
|
|
|
std::string ProgramSetting::databaseIP = "https://fsunuc.physics.fsu.edu/influx/";
|
2022-10-14 18:27:31 -04:00
|
|
|
std::string ProgramSetting::databaseName = "testing";
|
2022-11-02 15:43:23 -04:00
|
|
|
std::string ProgramSetting::DataSavingPath = "/home/catrina/FSUDAQ/expDir";
|
|
|
|
std::string ProgramSetting::ExpName = "ZZZZZ";
|
|
|
|
std::string ProgramSetting::ElogIP = "elog.physics.fsu.edu";
|
2022-10-26 18:38:55 -04:00
|
|
|
|
2022-10-31 21:26:10 -04:00
|
|
|
bool ProgramSetting::EnableElog = true;
|
|
|
|
bool ProgramSetting::EnableDatabase = true;
|
2022-10-31 16:39:19 -04:00
|
|
|
|
2022-11-01 18:38:01 -04:00
|
|
|
unsigned short ProgramSetting::maxPort = 4;
|
|
|
|
unsigned short ProgramSetting::maxBoardPrePort = 3;
|
|
|
|
|
2022-10-31 21:26:10 -04:00
|
|
|
/// fixed program things
|
2022-10-26 18:38:55 -04:00
|
|
|
const std::string ProgramSetting::settingFileName = "FSUDAQ.sh";
|
2022-10-31 21:26:10 -04:00
|
|
|
const std::string ProgramSetting::programPath = "~/FSUDAQ/";
|
2022-10-26 18:38:55 -04:00
|
|
|
|
|
|
|
///this is declared at FSUDAQ.cpp
|
|
|
|
extern unsigned short lastRunID;
|
2022-10-31 16:39:19 -04:00
|
|
|
extern unsigned short nDigi;
|
|
|
|
extern Digitizer ** digi;
|
2022-10-14 18:27:31 -04:00
|
|
|
|
|
|
|
ProgramSetting::ProgramSetting(const TGWindow *p){
|
2022-10-31 15:00:04 -04:00
|
|
|
|
2022-10-14 18:27:31 -04:00
|
|
|
fMain = new TGMainFrame(p, 600, 400);
|
|
|
|
fMain->SetWindowName("Program Setting");
|
|
|
|
fMain->Connect("CloseWindow()", "ProgramSetting", this, "CloseWindow()");
|
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
TGLayoutHints * haha = new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5,5,5,2);
|
|
|
|
TGLayoutHints * kaka = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,0,0);
|
|
|
|
|
2022-10-14 18:27:31 -04:00
|
|
|
TGVerticalFrame * vframe = new TGVerticalFrame(fMain); fMain->AddFrame(vframe);
|
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
{///============== Data Saving Path
|
2022-11-01 18:38:01 -04:00
|
|
|
TGGroupFrame * gfData = new TGGroupFrame(vframe, "Data Storage", kVerticalFrame); vframe->AddFrame(gfData, new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5));
|
2022-10-14 18:27:31 -04:00
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
TGHorizontalFrame * hfData = new TGHorizontalFrame(gfData); gfData->AddFrame(hfData, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
|
|
|
|
|
|
|
|
TGVerticalFrame * vfLabel = new TGVerticalFrame(hfData, 200); hfData->AddFrame(vfLabel );
|
|
|
|
TGVerticalFrame * vfTxt = new TGVerticalFrame(hfData); hfData->AddFrame(vfTxt);
|
2022-10-31 15:00:04 -04:00
|
|
|
TGVerticalFrame * vfAux = new TGVerticalFrame(hfData); hfData->AddFrame(vfAux);
|
2022-10-14 18:27:31 -04:00
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
TGLabel * lbExpName = new TGLabel(vfLabel, "ExpName :"); vfLabel->AddFrame(lbExpName, haha);
|
|
|
|
TGLabel * lbDataPath = new TGLabel(vfLabel, "Data Absolute Path :"); vfLabel->AddFrame(lbDataPath, haha);
|
2022-10-14 18:27:31 -04:00
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
txtExpName = new TGTextEntry(vfTxt, ExpName.c_str()); vfTxt->AddFrame(txtExpName, kaka);
|
|
|
|
txtExpName->Connect("ReturnPressed()", "ProgramSetting", this, "SetSetting()");
|
|
|
|
txtExpName->Resize(300, 20);
|
|
|
|
|
|
|
|
txtDataPath = new TGTextEntry(vfTxt, DataSavingPath.c_str()); vfTxt->AddFrame(txtDataPath, kaka);
|
|
|
|
txtDataPath->Connect("ReturnPressed()", "ProgramSetting", this, "SetSetting()");
|
|
|
|
txtDataPath->Resize(300, 20);
|
2022-10-14 18:27:31 -04:00
|
|
|
|
2022-10-31 15:00:04 -04:00
|
|
|
|
|
|
|
TGLabel * lbdummy0 = new TGLabel(vfAux, ""); vfAux->AddFrame(lbdummy0, haha);
|
|
|
|
|
|
|
|
TGTextButton * bSetFolder = new TGTextButton(vfAux, "Set Folder"); vfAux->AddFrame(bSetFolder, kaka);
|
|
|
|
bSetFolder->Connect("Clicked()", "ProgramSetting", this, "SetFolder()");
|
|
|
|
|
2022-10-14 18:27:31 -04:00
|
|
|
}
|
2022-10-26 18:38:55 -04:00
|
|
|
|
|
|
|
{///============== Database & Elog
|
2022-11-01 18:38:01 -04:00
|
|
|
TGGroupFrame * gfDatabase = new TGGroupFrame(vframe, "Database & Elog Setting", kVerticalFrame); vframe->AddFrame(gfDatabase, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
|
2022-10-18 17:23:29 -04:00
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
TGHorizontalFrame * hfDB1 = new TGHorizontalFrame(gfDatabase); gfDatabase->AddFrame(hfDB1, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
|
2022-10-18 17:23:29 -04:00
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
TGVerticalFrame * vfLabel = new TGVerticalFrame(hfDB1, 200); hfDB1->AddFrame(vfLabel);
|
|
|
|
TGVerticalFrame * vfTxt = new TGVerticalFrame(hfDB1); hfDB1->AddFrame(vfTxt);
|
2022-10-31 16:39:19 -04:00
|
|
|
TGVerticalFrame * vfOnOff = new TGVerticalFrame(hfDB1); hfDB1->AddFrame(vfOnOff);
|
2022-10-26 18:38:55 -04:00
|
|
|
|
2022-10-31 16:39:19 -04:00
|
|
|
TGLabel * lbIP = new TGLabel(vfLabel, "DB IP :"); vfLabel->AddFrame(lbIP, haha);
|
2022-10-26 18:38:55 -04:00
|
|
|
TGLabel * lbDBName = new TGLabel(vfLabel, "DB Name :"); vfLabel->AddFrame(lbDBName, haha);
|
|
|
|
TGLabel * lbElogIP = new TGLabel(vfLabel, "Elog IP :"); vfLabel->AddFrame(lbElogIP, haha);
|
|
|
|
|
|
|
|
txtIP = new TGTextEntry(vfTxt, databaseIP.c_str()); vfTxt->AddFrame(txtIP, kaka);
|
|
|
|
txtIP->Resize(300, 20);
|
|
|
|
txtIP->Connect("ReturnPressed()", "ProgramSetting", this, "SetSetting()");
|
|
|
|
|
|
|
|
txtDBName = new TGTextEntry(vfTxt, databaseName.c_str()); vfTxt->AddFrame(txtDBName, kaka);
|
|
|
|
txtDBName->Resize(300, 20);
|
|
|
|
txtDBName->Connect("ReturnPressed()", "ProgramSetting", this, "SetSetting()");
|
|
|
|
|
|
|
|
txtElogIP = new TGTextEntry(vfTxt, ElogIP.c_str()); vfTxt->AddFrame(txtElogIP, kaka);
|
|
|
|
txtElogIP->Resize(300, 20);
|
|
|
|
txtElogIP->Connect("ReturnPressed()", "ProgramSetting", this, "SetSetting()");
|
2022-10-31 16:39:19 -04:00
|
|
|
|
|
|
|
TGLabel * lbdummy0 = new TGLabel(vfOnOff, ""); vfOnOff->AddFrame(lbdummy0, haha);
|
|
|
|
|
|
|
|
cbDatabase = new TGCheckButton(vfOnOff, "Enable Database", 1); vfOnOff->AddFrame(cbDatabase, kaka);
|
2022-10-31 21:26:10 -04:00
|
|
|
if( ProgramSetting::EnableDatabase ){
|
|
|
|
cbDatabase->SetState(kButtonDown);
|
|
|
|
}else{
|
|
|
|
cbDatabase->SetState(kButtonUp);
|
|
|
|
}
|
2022-10-31 16:39:19 -04:00
|
|
|
cbDatabase->Connect("Clicked()", "ProgramSetting", this, "SetDataBaseElogOnOff()");
|
|
|
|
|
|
|
|
cbElog = new TGCheckButton(vfOnOff, "Enable Elog", 1); vfOnOff->AddFrame(cbElog, kaka);
|
2022-10-31 21:26:10 -04:00
|
|
|
if( ProgramSetting::EnableElog ){
|
|
|
|
cbElog->SetState(kButtonDown);
|
|
|
|
}else{
|
|
|
|
cbElog->SetState(kButtonUp);
|
|
|
|
}
|
2022-10-31 16:39:19 -04:00
|
|
|
cbElog->Connect("Clicked()", "ProgramSetting", this, "SetDataBaseElogOnOff()");
|
|
|
|
|
2022-10-18 17:23:29 -04:00
|
|
|
}
|
|
|
|
|
2022-11-01 18:38:01 -04:00
|
|
|
{///============== Other setting Read Time event building
|
|
|
|
TGGroupFrame * gfOther = new TGGroupFrame(vframe, "Other Settings", kVerticalFrame); vframe->AddFrame(gfOther, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
|
2022-10-14 18:27:31 -04:00
|
|
|
|
2022-11-01 18:38:01 -04:00
|
|
|
TGHorizontalFrame * hfOther1 = new TGHorizontalFrame(gfOther); gfOther->AddFrame(hfOther1, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
|
|
|
|
|
|
|
|
TGLabel * lbPort = new TGLabel(hfOther1, "Number of Port :"); hfOther1->AddFrame(lbPort, kaka);
|
|
|
|
numPort = new TGNumberEntry(hfOther1, ProgramSetting::maxPort, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hfOther1->AddFrame(numPort, kaka);
|
|
|
|
numPort->SetWidth(50);
|
|
|
|
numPort->SetLimits(TGNumberFormat::kNELLimitMinMax, 1, MaxNPorts);
|
|
|
|
numPort->Connect("Modified()", "ProgramSetting", this, "SetSearchRange()");
|
|
|
|
|
|
|
|
TGHorizontalFrame * hfOther2 = new TGHorizontalFrame(gfOther); gfOther->AddFrame(hfOther2, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
|
|
|
|
|
|
|
|
TGLabel * lbBoard = new TGLabel(hfOther2, "Number of Board / Port :"); hfOther2->AddFrame(lbBoard, kaka);
|
|
|
|
numBoard = new TGNumberEntry(hfOther2, ProgramSetting::maxBoardPrePort, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hfOther2->AddFrame(numBoard, kaka);
|
|
|
|
numBoard->SetWidth(50);
|
|
|
|
numBoard->SetLimits(TGNumberFormat::kNELLimitMinMax, 1, 9);
|
|
|
|
numBoard->Connect("Modified()", "ProgramSetting", this, "SetSearchRange()");
|
2022-10-14 18:27:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
fMain->MapSubwindows();
|
|
|
|
fMain->Resize(fMain->GetDefaultSize());
|
|
|
|
fMain->MapWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
ProgramSetting::~ProgramSetting(){
|
|
|
|
|
2022-10-31 15:00:04 -04:00
|
|
|
printf("----- %s \n", __func__);
|
|
|
|
|
2022-10-14 18:27:31 -04:00
|
|
|
delete txtIP;
|
|
|
|
delete txtDBName;
|
2022-10-26 14:55:06 -04:00
|
|
|
delete txtDataPath;
|
2022-10-26 18:38:55 -04:00
|
|
|
delete txtExpName;
|
|
|
|
delete txtElogIP;
|
2022-10-31 16:39:19 -04:00
|
|
|
|
|
|
|
delete cbDatabase;
|
|
|
|
delete cbElog;
|
2022-11-01 18:38:01 -04:00
|
|
|
|
|
|
|
delete numPort;
|
|
|
|
delete numBoard;
|
2022-10-14 18:27:31 -04:00
|
|
|
|
|
|
|
fMain->Cleanup();
|
|
|
|
delete fMain;
|
|
|
|
}
|
|
|
|
|
2022-11-02 15:43:23 -04:00
|
|
|
void ProgramSetting::LogMsg(TString msg){
|
|
|
|
Emit("LogMsg(char*)", msg.Data());
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramSetting::SetDataBaseElogOnOff(){
|
|
|
|
|
|
|
|
EnableDatabase = ( cbDatabase->GetState() == kButtonDown ? true : false );
|
|
|
|
EnableElog = ( cbElog->GetState() == kButtonDown ? true : false );
|
|
|
|
|
|
|
|
int status = SaveProgramSetting();
|
|
|
|
if( status == 1 ) LogMsg(Form("Saved Program settings to %s",ProgramSetting::settingFileName.c_str()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramSetting::SetSearchRange(){
|
|
|
|
maxPort = numPort->GetNumber();
|
|
|
|
maxBoardPrePort = numPort->GetNumber();
|
|
|
|
|
|
|
|
int status = SaveProgramSetting();
|
|
|
|
if( status == 1 ) LogMsg(Form("Saved Program settings to %s",ProgramSetting::settingFileName.c_str()));
|
|
|
|
}
|
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
void ProgramSetting::SetSetting(){
|
2022-10-14 18:27:31 -04:00
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
DataSavingPath = txtDataPath->GetText();
|
|
|
|
ExpName = txtExpName->GetText();
|
|
|
|
|
|
|
|
databaseIP = txtIP->GetText();
|
2022-10-14 18:27:31 -04:00
|
|
|
databaseName = txtDBName->GetText();
|
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
ElogIP = txtElogIP->GetText();
|
|
|
|
|
|
|
|
PrintSettings();
|
|
|
|
|
2022-11-02 15:43:23 -04:00
|
|
|
int status = SaveProgramSetting();
|
|
|
|
if( status == 1 ) LogMsg(Form("Saved Program settings to %s",ProgramSetting::settingFileName.c_str()));
|
2022-10-26 18:38:55 -04:00
|
|
|
|
2022-10-31 16:39:19 -04:00
|
|
|
gSystem->mkdir(( ProgramSetting::DataSavingPath + "/data").c_str());
|
|
|
|
gSystem->mkdir(( ProgramSetting::DataSavingPath + "/settings").c_str());
|
|
|
|
|
|
|
|
///save digitizer settings to the settings folder
|
2022-11-02 15:43:23 -04:00
|
|
|
if( digi != NULL ){
|
|
|
|
for( int i = 0; i < nDigi; i ++){
|
|
|
|
digi[i]->SaveAllSettingsAsBin(ProgramSetting::DataSavingPath + "/settings/setting_" + std::to_string(digi[i]->GetSerialNumber()) + ".bin");
|
|
|
|
}
|
2022-10-31 16:39:19 -04:00
|
|
|
}
|
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
Emit("SetSetting()");
|
2022-10-14 18:27:31 -04:00
|
|
|
|
|
|
|
}
|
2022-10-18 17:23:29 -04:00
|
|
|
|
2022-10-31 15:00:04 -04:00
|
|
|
void ProgramSetting::SetFolder(){
|
|
|
|
|
|
|
|
const char *filetypes[] = { "All Files", "*.*", 0, 0 };
|
|
|
|
|
|
|
|
TGFileInfo fi;
|
|
|
|
fi.fFileTypes = filetypes;
|
|
|
|
fi.SetIniDir(".");
|
|
|
|
printf("fIniDir = %s\n", fi.fIniDir);
|
|
|
|
new TGFileDialog(gClient->GetRoot(), fMain, kDOpen, &fi);
|
|
|
|
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
|
|
|
|
|
|
|
if( fi.fFilename == NULL) return;
|
|
|
|
|
2022-10-31 16:39:19 -04:00
|
|
|
txtDataPath->SetText(fi.fFilename, false);
|
2022-10-31 15:00:04 -04:00
|
|
|
|
|
|
|
SetSetting();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-11-02 15:43:23 -04:00
|
|
|
///============= Static function
|
2022-10-26 18:38:55 -04:00
|
|
|
void ProgramSetting::PrintSettings(){
|
2022-10-18 17:23:29 -04:00
|
|
|
|
2022-11-02 15:43:23 -04:00
|
|
|
printf(" Data Saving Path : %s\n", DataSavingPath.c_str());
|
|
|
|
printf(" ExpName : %s\n", ExpName.c_str());
|
|
|
|
printf(" Database Enable : %d\n", EnableDatabase);
|
|
|
|
printf(" Database IP : %s\n", databaseIP.c_str());
|
|
|
|
printf(" Database Name : %s\n", databaseName.c_str());
|
|
|
|
printf(" Elog Enable : %d\n", EnableElog);
|
|
|
|
printf(" Elog IP : %s\n", ElogIP.c_str());
|
|
|
|
printf(" Max Port Scan : %d\n", maxPort);
|
|
|
|
printf("Max Board / Port Scan : %d\n", maxBoardPrePort);
|
|
|
|
printf(" last run ID : %d\n", lastRunID);
|
2022-10-18 17:23:29 -04:00
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramSetting::LoadProgramSetting(){
|
|
|
|
|
|
|
|
std::ifstream fileIn;
|
|
|
|
fileIn.open(ProgramSetting::settingFileName.c_str(), std::ios::in);
|
2022-10-18 17:23:29 -04:00
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
if( fileIn ){
|
|
|
|
std::string line;
|
|
|
|
int lineNum = 0;
|
|
|
|
size_t pos = 0;
|
|
|
|
while (fileIn.good() ){
|
|
|
|
std::getline(fileIn, line);
|
|
|
|
pos = line.find("=");
|
|
|
|
if( pos > 1 ){
|
2022-11-02 15:43:23 -04:00
|
|
|
lineNum ++;
|
2022-10-31 21:26:10 -04:00
|
|
|
pos += 1;
|
2022-10-26 18:38:55 -04:00
|
|
|
///printf("%d | %s , %d \n", lineNum, line.c_str(), pos);
|
|
|
|
switch ( lineNum ){
|
2022-11-02 15:43:23 -04:00
|
|
|
case 1: ProgramSetting::ExpName = line.substr(pos); break;
|
|
|
|
case 2: ProgramSetting::DataSavingPath = line.substr(pos); break;
|
|
|
|
case 3: ProgramSetting::EnableDatabase = std::atoi(line.substr(pos).c_str()); break;
|
|
|
|
case 4: ProgramSetting::databaseIP = line.substr(pos); break;
|
|
|
|
case 5: ProgramSetting::databaseName = line.substr(pos); break;
|
|
|
|
case 6: ProgramSetting::EnableElog = std::atoi(line.substr(pos).c_str()); break;
|
|
|
|
case 7: ProgramSetting::ElogIP = line.substr(pos); break;
|
|
|
|
case 8: ProgramSetting::maxPort = std::atoi(line.substr(pos).c_str()); break;
|
|
|
|
case 9: ProgramSetting::maxBoardPrePort = std::atoi(line.substr(pos).c_str()); break;
|
|
|
|
case 10: lastRunID = std::atoi(line.substr(pos).c_str()); break;
|
2022-10-26 18:38:55 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fileIn.close();
|
2022-11-02 15:43:23 -04:00
|
|
|
|
|
|
|
if( lineNum < 10 ) {
|
|
|
|
printf("Something wrong with the %s file. Creating a new one.\n", ProgramSetting::settingFileName.c_str());
|
|
|
|
SaveProgramSetting();
|
|
|
|
}
|
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
}else{
|
|
|
|
printf("%s | Cannot open file : %s.\n", __func__, ProgramSetting::settingFileName.c_str());
|
|
|
|
printf("Creating One with default setting");
|
|
|
|
SaveProgramSetting();
|
|
|
|
}
|
|
|
|
|
|
|
|
PrintSettings();
|
|
|
|
}
|
|
|
|
|
2022-11-02 15:43:23 -04:00
|
|
|
int ProgramSetting::SaveProgramSetting(){
|
2022-10-26 18:38:55 -04:00
|
|
|
|
|
|
|
printf("+++++++ %s \n", __func__);
|
|
|
|
|
2022-10-31 21:26:10 -04:00
|
|
|
std::string filePath = ProgramSetting::settingFileName;
|
|
|
|
|
|
|
|
FILE * fileOut = fopen(filePath.c_str(), "w");
|
2022-10-26 18:38:55 -04:00
|
|
|
if( fileOut != NULL ){
|
|
|
|
|
2022-10-31 21:26:10 -04:00
|
|
|
fputs( ("ExpName=" + ProgramSetting::ExpName + "\n").c_str(), fileOut);
|
|
|
|
fputs( ("DataPath=" + ProgramSetting::DataSavingPath + "\n").c_str(), fileOut);
|
2022-11-02 15:43:23 -04:00
|
|
|
fputs( ("EnableDatabase=" + std::to_string(ProgramSetting::EnableDatabase) + "\n").c_str(), fileOut);
|
2022-10-31 21:26:10 -04:00
|
|
|
fputs( ("DatabaseIP=" + ProgramSetting::databaseIP + "\n").c_str(), fileOut);
|
|
|
|
fputs( ("DatabaseName=" + ProgramSetting::databaseName + "\n").c_str(), fileOut);
|
2022-11-02 15:43:23 -04:00
|
|
|
fputs( ("EnableElog=" + std::to_string(ProgramSetting::EnableElog) + "\n").c_str(), fileOut);
|
2022-10-31 21:26:10 -04:00
|
|
|
fputs( ("ElogIP=" + ProgramSetting::ElogIP + "\n").c_str(), fileOut);
|
2022-11-02 15:43:23 -04:00
|
|
|
fputs( ("MaxPort=" + std::to_string(ProgramSetting::maxPort) + "\n").c_str(), fileOut);
|
|
|
|
fputs( ("MaxBoardPrePort=" + std::to_string(ProgramSetting::maxBoardPrePort) + "\n").c_str(), fileOut);
|
2022-10-31 21:26:10 -04:00
|
|
|
fputs( ("lastRunID=" + std::to_string(lastRunID) + "\n").c_str(), fileOut);
|
2022-10-26 18:38:55 -04:00
|
|
|
|
|
|
|
fclose(fileOut);
|
2022-10-31 16:39:19 -04:00
|
|
|
|
|
|
|
gSystem->CopyFile(ProgramSetting::settingFileName.c_str(), (ProgramSetting::DataSavingPath + "/FSUDAQ.sh").c_str(), true); /// overwrite
|
|
|
|
|
2022-11-02 15:43:23 -04:00
|
|
|
return 1;
|
|
|
|
|
2022-10-26 18:38:55 -04:00
|
|
|
}else{
|
2022-10-31 21:26:10 -04:00
|
|
|
printf("%s | Cannot open file : %s.\n", __func__, filePath.c_str());
|
2022-11-02 15:43:23 -04:00
|
|
|
return 0;
|
2022-10-26 18:38:55 -04:00
|
|
|
}
|
2022-10-31 16:39:19 -04:00
|
|
|
|
2022-11-02 15:43:23 -04:00
|
|
|
return 0;
|
2022-11-01 18:38:01 -04:00
|
|
|
}
|