Merged muonspin/musrfit:root6 into master

This commit is contained in:
Zaher Salman 2023-09-01 11:51:52 +02:00
commit 91d6a4bc99
7 changed files with 94 additions and 22 deletions

View File

@ -54,8 +54,10 @@ PFindRun::PFindRun(const PStringVector path, const PRunNameTemplateList runNameT
* @param run * @param run
*/ */
PFindRun::PFindRun(const PStringVector path, const PRunNameTemplateList runNameTemplateList, PFindRun::PFindRun(const PStringVector path, const PRunNameTemplateList runNameTemplateList,
const TString &instrument, const UInt_t year, const UInt_t run) : const TString &instrument, const UInt_t year, const UInt_t run,
fPath(path), fRunNameTemplateList(runNameTemplateList), fInstrument(instrument), fYear(year), fRun(run) const TString file_format) :
fPath(path), fRunNameTemplateList(runNameTemplateList), fInstrument(instrument),
fYear(year), fRun(run), fFileFormat(file_format)
{ {
// nothing to be done here // nothing to be done here
} }
@ -130,6 +132,23 @@ TString PFindRun::CreatePathName(const TString path, const TString runNameTempla
*/ */
Bool_t PFindRun::FoundPathName() Bool_t PFindRun::FoundPathName()
{ {
// if file format is given, get proper extension
TString ext("");
if (fFileFormat.Length() != 0) {
if (!fFileFormat.CompareTo("MusrRoot") || !fFileFormat.CompareTo("ROOT"))
ext = ".root";
else if (!fFileFormat.CompareTo("NeXus"))
ext = ".nxs";
else if (!fFileFormat.CompareTo("PSI-BIN"))
ext = ".bin";
else if (!fFileFormat.CompareTo("PSI-MDU"))
ext = ".mdu";
else if (!fFileFormat.CompareTo("MUD"))
ext = ".mud";
else if (!fFileFormat.CompareTo("WKM"))
ext = ".wkm";
}
// find instrument name in path list // find instrument name in path list
TString pathName{""}; TString pathName{""};
for (Int_t i=0; i<fPath.size(); i++) { for (Int_t i=0; i<fPath.size(); i++) {
@ -137,6 +156,10 @@ Bool_t PFindRun::FoundPathName()
for (Int_t j=0; j<fRunNameTemplateList.size(); j++) { for (Int_t j=0; j<fRunNameTemplateList.size(); j++) {
if (fRunNameTemplateList[j].instrument == fInstrument) { if (fRunNameTemplateList[j].instrument == fInstrument) {
pathName = CreatePathName(fPath[i], fRunNameTemplateList[j].runNameTemplate); pathName = CreatePathName(fPath[i], fRunNameTemplateList[j].runNameTemplate);
if (fFileFormat.Length() != 0) {
if (!pathName.Contains(ext, TString::kIgnoreCase))
continue;
}
if (boost::filesystem::exists(pathName.Data())) { if (boost::filesystem::exists(pathName.Data())) {
fPathName = pathName; fPathName = pathName;
return true; return true;

View File

@ -4647,9 +4647,13 @@ Bool_t PRunDataHandler::WriteMusrRootFile(TString fln)
str.Form("hDecay%03d", dataSet->GetHistoNo()); str.Form("hDecay%03d", dataSet->GetHistoNo());
length = dataSet->GetData()->size(); length = dataSet->GetData()->size();
histo = new TH1F(str.Data(), str.Data(), length+1, -0.5, static_cast<Double_t>(length)+0.5); histo = new TH1F(str.Data(), str.Data(), length+1, -0.5, static_cast<Double_t>(length)+0.5);
Int_t sum=0, entries=0;
for (UInt_t j=0; j<length; j++) { for (UInt_t j=0; j<length; j++) {
histo->SetBinContent(j+1, dataSet->GetData()->at(j)); entries = dataSet->GetData()->at(j);
histo->SetBinContent(j+1, entries);
sum += entries;
} }
histo->SetEntries(sum);
histos.push_back(histo); histos.push_back(histo);
} }
} else { // rebin > 1 } else { // rebin > 1
@ -4666,14 +4670,18 @@ Bool_t PRunDataHandler::WriteMusrRootFile(TString fln)
length = dataSet->GetData()->size(); length = dataSet->GetData()->size();
histo = new TH1F(str.Data(), str.Data(), static_cast<Int_t>(length/fAny2ManyInfo->rebin)+1, -0.5, static_cast<Double_t>(static_cast<Int_t>(length/fAny2ManyInfo->rebin))+0.5); histo = new TH1F(str.Data(), str.Data(), static_cast<Int_t>(length/fAny2ManyInfo->rebin)+1, -0.5, static_cast<Double_t>(static_cast<Int_t>(length/fAny2ManyInfo->rebin))+0.5);
dataCount = 0; dataCount = 0;
Int_t sum=0, entries=0;
for (UInt_t j=0; j<length; j++) { for (UInt_t j=0; j<length; j++) {
if ((j > 0) && (j % fAny2ManyInfo->rebin == 0)) { if ((j > 0) && (j % fAny2ManyInfo->rebin == 0)) {
dataCount++; dataCount++;
histo->SetBinContent(dataCount, dataRebin); histo->SetBinContent(dataCount, dataRebin);
dataRebin = 0; dataRebin = 0;
} }
dataRebin += static_cast<UInt_t>(dataSet->GetData()->at(j)); entries = dataSet->GetData()->at(j);
sum += entries;
dataRebin += static_cast<UInt_t>(entries);
} }
histo->SetEntries(sum);
histos.push_back(histo); histos.push_back(histo);
} }
} }

View File

@ -655,6 +655,7 @@ Bool_t PStartupHandler::WriteDefaultStartupFile()
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/alc</data_path>" << std::endl; fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/alc</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/hifi</data_path>" << std::endl; fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/hifi</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/lem</data_path>" << std::endl; fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/lem</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/flame</data_path>" << std::endl;
fout << " <!-- Dolly/PSI -->" << std::endl; fout << " <!-- Dolly/PSI -->" << std::endl;
fout << " <run_name_template inst=\"dolly\">d%yyyy%/pie1/deltat_flc_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"dolly\">d%yyyy%/pie1/deltat_flc_%rrrr%.bin</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"dolly\">d%yyyy%/pie3/deltat_flc_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"dolly\">d%yyyy%/pie3/deltat_flc_%rrrr%.bin</run_name_template>" << std::endl;
@ -664,8 +665,11 @@ Bool_t PStartupHandler::WriteDefaultStartupFile()
fout << " <run_name_template inst=\"dolly\">d%yyyy%/pta/deltat_pta_dolly_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"dolly\">d%yyyy%/pta/deltat_pta_dolly_%rrrr%.bin</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"dolly\">d%yyyy%/tdc/deltat_tdc_dolly_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"dolly\">d%yyyy%/tdc/deltat_tdc_dolly_%rrrr%.bin</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"dolly\">d%yyyy%/tdc/root/deltat_tdc_dolly_%rrrr%.root</run_name_template>" << std::endl; fout << " <run_name_template inst=\"dolly\">d%yyyy%/tdc/root/deltat_tdc_dolly_%rrrr%.root</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"dolly\">d%yyyy%/tdc/mdu/deltat_tdc_dolly_%rrrr%.mdu</run_name_template>" << std::endl;
fout << " <!-- Flame/PSI -->" << std::endl; fout << " <!-- Flame/PSI -->" << std::endl;
fout << " <run_name_template inst=\"flame\">d%yyyy%/tdc/root/deltat_tdc_flame_%yyyy%_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"flame\">d%yyyy%/tdc/root/deltat_tdc_flame_%yyyy%_%rrrr%.root</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"flame\">d%yyyy%/tdc/deltat_tdc_flame_%rrrr%.bin</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"flame\">d%yyyy%/tdc/mdu/deltat_tdc_flame_%yyyy%_%rrrr%.mdu</run_name_template>" << std::endl;
fout << " <!-- GPD/PSI -->" << std::endl; fout << " <!-- GPD/PSI -->" << std::endl;
fout << " <run_name_template inst=\"gpd\">d%yyyy%/deltat_mue1_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"gpd\">d%yyyy%/deltat_mue1_%rrrr%.bin</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"gpd\">d%yyyy%/deltat_fq_si_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"gpd\">d%yyyy%/deltat_fq_si_%rrrr%.bin</run_name_template>" << std::endl;
@ -679,6 +683,7 @@ Bool_t PStartupHandler::WriteDefaultStartupFile()
fout << " <run_name_template inst=\"gpd\">d%yyyy%/deltat_pta_gpd_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"gpd\">d%yyyy%/deltat_pta_gpd_%rrrr%.bin</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"gpd\">d%yyyy%/tdc/deltat_tdc_gpd_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"gpd\">d%yyyy%/tdc/deltat_tdc_gpd_%rrrr%.bin</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"gpd\">d%yyyy%/tdc/root/deltat_tdc_gpd_%rrrr%.root</run_name_template>" << std::endl; fout << " <run_name_template inst=\"gpd\">d%yyyy%/tdc/root/deltat_tdc_gpd_%rrrr%.root</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"gpd\">d%yyyy%/tdc/mdu/deltat_tdc_gpd_%rrrr%.mdu</run_name_template>" << std::endl;
fout << " <!-- GPS/PSI -->" << std::endl; fout << " <!-- GPS/PSI -->" << std::endl;
fout << " <run_name_template inst=\"gps\">d%yyyy%/deltat_ccr_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"gps\">d%yyyy%/deltat_ccr_%rrrr%.bin</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"gps\">d%yyyy%/deltat_he3_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"gps\">d%yyyy%/deltat_he3_%rrrr%.bin</run_name_template>" << std::endl;
@ -691,6 +696,7 @@ Bool_t PStartupHandler::WriteDefaultStartupFile()
fout << " <run_name_template inst=\"gps\">d%yyyy%/deltat_pta_gps_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"gps\">d%yyyy%/deltat_pta_gps_%rrrr%.bin</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"gps\">d%yyyy%/tdc/deltat_tdc_gps_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"gps\">d%yyyy%/tdc/deltat_tdc_gps_%rrrr%.bin</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"gps\">d%yyyy%/tdc/root/deltat_tdc_gps_%yyyy%_%rrrr%.root</run_name_template>" << std::endl; fout << " <run_name_template inst=\"gps\">d%yyyy%/tdc/root/deltat_tdc_gps_%yyyy%_%rrrr%.root</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"gps\">d%yyyy%/tdc/mdu/deltat_tdc_gps_%yyyy%_%rrrr%.mdu</run_name_template>" << std::endl;
fout << " <!-- HAL-9500/PSI == HIFI/PSI -->" << std::endl; fout << " <!-- HAL-9500/PSI == HIFI/PSI -->" << std::endl;
fout << " <run_name_template inst=\"hifi\">d%yyyy%/tdc/deltat_hifi_%rrrr%.bin</run_name_template>" << std::endl; fout << " <run_name_template inst=\"hifi\">d%yyyy%/tdc/deltat_hifi_%rrrr%.bin</run_name_template>" << std::endl;
fout << " <run_name_template inst=\"hifi\">d%yyyy%/tdc/tdc_hifi_%yyyy%_%rrrrr%.mdu</run_name_template>" << std::endl; fout << " <run_name_template inst=\"hifi\">d%yyyy%/tdc/tdc_hifi_%yyyy%_%rrrrr%.mdu</run_name_template>" << std::endl;

View File

@ -99,7 +99,7 @@ void dump_header_syntax()
std::cout << std::endl << " -s, --summary : this option is used for LE-uSR data sets only. It will, additionally"; std::cout << std::endl << " -s, --summary : this option is used for LE-uSR data sets only. It will, additionally";
std::cout << std::endl << " to the header information, print the summary file content."; std::cout << std::endl << " to the header information, print the summary file content.";
std::cout << std::endl << " -i, --instrument <inst> : where <inst> is the requested instrument:"; std::cout << std::endl << " -i, --instrument <inst> : where <inst> is the requested instrument:";
std::cout << std::endl << " lem (default) | gps | ltf | dolly | gpd | hifi."; std::cout << std::endl << " lem (default) | gps | ltf | dolly | gpd | hifi | flame.";
std::cout << std::endl << " -c, --counts : will show detector counts as well."; std::cout << std::endl << " -c, --counts : will show detector counts as well.";
std::cout << std::endl << " -h, --help : will show this help"; std::cout << std::endl << " -h, --help : will show this help";
std::cout << std::endl << " -v, --version : will show the current version."; std::cout << std::endl << " -v, --version : will show the current version.";
@ -145,6 +145,10 @@ int dump_header_root(const std::string fileName, const bool summary, const bool
fileType = DH_LEM_ROOT; fileType = DH_LEM_ROOT;
} }
TMusrRunHeader *header{nullptr};
bool ok;
Int_t ival;
if (fileType == DH_LEM_ROOT) { // ROOT (LEM) if (fileType == DH_LEM_ROOT) { // ROOT (LEM)
// read header and check if some missing run info need to be fed // read header and check if some missing run info need to be fed
TLemRunHeader *runHeader = dynamic_cast<TLemRunHeader*>(folder->FindObjectAny("TLemRunHeader")); TLemRunHeader *runHeader = dynamic_cast<TLemRunHeader*>(folder->FindObjectAny("TLemRunHeader"));
@ -197,7 +201,7 @@ int dump_header_root(const std::string fileName, const bool summary, const bool
delete runHeader; delete runHeader;
} else { // MusrRoot } else { // MusrRoot
// invoke the MusrRoot header object // invoke the MusrRoot header object
TMusrRunHeader *header = new TMusrRunHeader(fileName.c_str(), true); // read quite header = new TMusrRunHeader(fileName.c_str(), true); // read quite
if (header == 0) { if (header == 0) {
std::cerr << std::endl << "**ERROR** Couldn't invoke MusrRoot RunHeader in file:" << fileName; std::cerr << std::endl << "**ERROR** Couldn't invoke MusrRoot RunHeader in file:" << fileName;
std::cerr << std::endl; std::cerr << std::endl;
@ -216,8 +220,6 @@ int dump_header_root(const std::string fileName, const bool summary, const bool
header->DumpHeader(); header->DumpHeader();
if (counts) { if (counts) {
bool ok;
Int_t ival;
PIntVector ivec; PIntVector ivec;
header->Get("RunInfo/No of Histos", ival, ok); header->Get("RunInfo/No of Histos", ival, ok);
if (ok) if (ok)
@ -226,8 +228,6 @@ int dump_header_root(const std::string fileName, const bool summary, const bool
if (ok) if (ok)
redGreenOffset = ivec; redGreenOffset = ivec;
} }
delete header;
} }
// summary as well? // summary as well?
@ -248,33 +248,54 @@ int dump_header_root(const std::string fileName, const bool summary, const bool
tstr = static_cast<TObjString*>(runSum->At(i)); tstr = static_cast<TObjString*>(runSum->At(i));
str = tstr->String(); str = tstr->String();
std::cout << str; std::cout << str;
if (!str.Contains("\r") && !str.Contains("\n"))
std::cout << std::endl;
} }
} }
// detector counts as well? // detector counts as well?
if (counts && (fileType == DH_MUSR_ROOT)) { if (counts && (fileType == DH_MUSR_ROOT)) {
// dump the detector counts // dump the detector counts
std::cout << "Detector counts" << std::endl; std::cout << "Detector counts (all, between fgb and lgb)" << std::endl;
f.GetObject("histos", folder); f.GetObject("histos", folder);
if (folder != nullptr) { if ((folder != nullptr) && (header != nullptr)) {
char detectorLabel[64]; char detectorLabel[64];
TH1F *histo{nullptr}; TH1F *histo{nullptr};
UInt_t total{0}; UInt_t total{0}, total_good{0}, ta, tg;
Int_t fgb, lgb;
for (UInt_t i=0; i<redGreenOffset.size(); i++) { for (UInt_t i=0; i<redGreenOffset.size(); i++) {
std::cout << " Group " << i+1 << " (Offset=" << redGreenOffset[i] << ") : " << std::endl; std::cout << " Group " << i+1 << " (Offset=" << redGreenOffset[i] << ") : " << std::endl;
total = 0; total = 0;
total_good = 0;
for (UInt_t j=0; j<noOfHistos; j++) { for (UInt_t j=0; j<noOfHistos; j++) {
// get fgb, lgb
fgb = -1;
snprintf(detectorLabel, sizeof(detectorLabel), "DetectorInfo/Detector%03d/First Good Bin", redGreenOffset[i]+j+1);
header->Get(detectorLabel, ival, ok);
if (ok) {
fgb = ival;
}
lgb = -1;
snprintf(detectorLabel, sizeof(detectorLabel), "DetectorInfo/Detector%03d/Last Good Bin", redGreenOffset[i]+j+1);
header->Get(detectorLabel, ival, ok);
if (ok) {
lgb = ival;
}
// get histo info
snprintf(detectorLabel, sizeof(detectorLabel), "hDecay%03d", redGreenOffset[i]+j+1); snprintf(detectorLabel, sizeof(detectorLabel), "hDecay%03d", redGreenOffset[i]+j+1);
histo = (TH1F*) folder->FindObjectAny(detectorLabel); histo = (TH1F*) folder->FindObjectAny(detectorLabel);
if (histo != nullptr) { if (histo != nullptr) {
std::cout << " " << histo->GetTitle() << ":\t " << histo->GetEntries() << std::endl; ta = histo->Integral(0, histo->GetNbinsX()+1);
total += histo->GetEntries(); tg = histo->Integral(fgb, lgb);
std::cout << " " << histo->GetTitle() << ":\t " << ta << ", " << tg << std::endl;
total += ta;
total_good += tg;
} }
} }
if (i % 2 == 0) if (i % 2 == 0)
std::cout << " total counts of group " << i+1 << ":\t\t\t " << total << std::endl; std::cout << " total counts of group " << i+1 << ":\t\t\t " << total << ", " << total_good << std::endl;
else else
std::cout << " total counts of group " << i+1 << ":\t\t\t\t\t " << total << std::endl; std::cout << " total counts of group " << i+1 << ":\t\t\t\t\t " << total << ", " << total_good << std::endl;
} }
} else { } else {
std::cout << "Sorry, no histos folder found" << std::endl; std::cout << "Sorry, no histos folder found" << std::endl;
@ -285,6 +306,9 @@ int dump_header_root(const std::string fileName, const bool summary, const bool
f.Close(); f.Close();
if (header)
delete header;
return 0; return 0;
} }
@ -883,7 +907,8 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
if (strcmp(argv[i+1], "lem") && strcmp(argv[i+1], "gps") && strcmp(argv[i+1], "ltf") && if (strcmp(argv[i+1], "lem") && strcmp(argv[i+1], "gps") && strcmp(argv[i+1], "ltf") &&
strcmp(argv[i+1], "dolly") && strcmp(argv[i+1], "gpd") && strcmp(argv[i+1], "hifi")) { strcmp(argv[i+1], "dolly") && strcmp(argv[i+1], "gpd") && strcmp(argv[i+1], "hifi") &&
strcmp(argv[i+1], "flame")) {
std::cerr << std::endl << "**ERROR** found --instrument with unkown instrument name: '" << argv[i+1] << "'!" << std::endl; std::cerr << std::endl << "**ERROR** found --instrument with unkown instrument name: '" << argv[i+1] << "'!" << std::endl;
dump_header_syntax(); dump_header_syntax();
return 1; return 1;
@ -954,7 +979,8 @@ int main(int argc, char *argv[])
if (fileName == "") { // only look for runs if the file name is not explicitly given if (fileName == "") { // only look for runs if the file name is not explicitly given
int yy = static_cast<int>(strtod(year.c_str(), static_cast<char**>(nullptr))); int yy = static_cast<int>(strtod(year.c_str(), static_cast<char**>(nullptr)));
int run = static_cast<int>(strtod(runNo.c_str(), static_cast<char**>(nullptr))); int run = static_cast<int>(strtod(runNo.c_str(), static_cast<char**>(nullptr)));
PFindRun findRun(startupHandler->GetDataPathList(), startupHandler->GetRunNameTemplateList(), instrument, yy, run); PFindRun findRun(startupHandler->GetDataPathList(), startupHandler->GetRunNameTemplateList(),
instrument, yy, run, fileFormat);
if (findRun.FoundPathName()) { if (findRun.FoundPathName()) {
pathFln = findRun.GetPathName().Data(); pathFln = findRun.GetPathName().Data();
} else { } else {

View File

@ -36,7 +36,7 @@ class PFindRun {
public: public:
PFindRun(const PStringVector path, const PRunNameTemplateList runNameTemplateList); PFindRun(const PStringVector path, const PRunNameTemplateList runNameTemplateList);
PFindRun(const PStringVector path, const PRunNameTemplateList runNameTemplateList, PFindRun(const PStringVector path, const PRunNameTemplateList runNameTemplateList,
const TString &instrument, const UInt_t year, const UInt_t run); const TString &instrument, const UInt_t year, const UInt_t run, const TString file_format="");
Bool_t FoundPathName(); Bool_t FoundPathName();
TString GetPathName() { return fPathName; } TString GetPathName() { return fPathName; }
@ -48,6 +48,7 @@ class PFindRun {
TString fInstrument{""}; TString fInstrument{""};
Int_t fYear{-1}; Int_t fYear{-1};
Int_t fRun{-1}; Int_t fRun{-1};
TString fFileFormat{""};
TString fPathName{""}; TString fPathName{""};
TString CreatePathName(const TString path, const TString runNameTemplate); TString CreatePathName(const TString path, const TString runNameTemplate);

View File

@ -2649,6 +2649,10 @@ void PTextEdit::musrT0()
#endif #endif
proc->setProcessEnvironment(env); proc->setProcessEnvironment(env);
proc->setWorkingDirectory(workDir); proc->setWorkingDirectory(workDir);
connect(proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
[=](int exitCode, QProcess::ExitStatus exitStatus){ fileReload(); });
proc->start(cmd, arg); proc->start(cmd, arg);
if (!proc->waitForStarted()) { if (!proc->waitForStarted()) {
// error handling // error handling

View File

@ -2643,6 +2643,10 @@ void PTextEdit::musrT0()
#endif #endif
proc->setProcessEnvironment(env); proc->setProcessEnvironment(env);
proc->setWorkingDirectory(workDir); proc->setWorkingDirectory(workDir);
connect(proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
[=](int exitCode, QProcess::ExitStatus exitStatus){ fileReload(); });
proc->start(cmd, arg); proc->start(cmd, arg);
if (!proc->waitForStarted()) { if (!proc->waitForStarted()) {
// error handling // error handling