more work to get rid of raw pointers.
This commit is contained in:
parent
ff9245fd28
commit
ca742a064f
@ -536,8 +536,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// read startup file
|
// read startup file
|
||||||
char startup_path_name[128];
|
char startup_path_name[128];
|
||||||
std::unique_ptr<TSAXParser> saxParser = std::unique_ptr<TSAXParser>(new TSAXParser());
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
std::unique_ptr<PStartupHandler> startupHandler = std::unique_ptr<PStartupHandler>(new PStartupHandler());
|
std::unique_ptr<PStartupHandler> startupHandler = std::make_unique<PStartupHandler>();
|
||||||
if (!startupHandler->StartupFileFound()) {
|
if (!startupHandler->StartupFileFound()) {
|
||||||
std::cerr << std::endl << ">> addRun **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
std::cerr << std::endl << ">> addRun **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -627,14 +627,7 @@ int main(int argc, char *argv[])
|
|||||||
Bool_t isGood{true};
|
Bool_t isGood{true};
|
||||||
for (UInt_t i=0; i<runDataHandler.size(); i++) {
|
for (UInt_t i=0; i<runDataHandler.size(); i++) {
|
||||||
if (startupHandler != nullptr) {
|
if (startupHandler != nullptr) {
|
||||||
runDataHandler[i] = std::unique_ptr<PRunDataHandler>(new PRunDataHandler(addRunInfo[i].fPathFileName, addRunInfo[i].fFileFormat, startupHandler->GetDataPathList()));
|
runDataHandler[i] = std::make_unique<PRunDataHandler>(addRunInfo[i].fPathFileName, addRunInfo[i].fFileFormat, startupHandler->GetDataPathList());
|
||||||
if (runDataHandler[i] == nullptr) {
|
|
||||||
isGood = false;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "**ERROR** couldn't invoke PRunDataHandler (i=" << i << ")." << std::endl;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
runDataHandler[i]->ReadData();
|
runDataHandler[i]->ReadData();
|
||||||
if (!runDataHandler[i]->IsAllDataAvailable()) {
|
if (!runDataHandler[i]->IsAllDataAvailable()) {
|
||||||
isGood = false;
|
isGood = false;
|
||||||
@ -644,14 +637,7 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
runDataHandler[i] = std::unique_ptr<PRunDataHandler>(new PRunDataHandler(addRunInfo[i].fPathFileName, addRunInfo[i].fFileFormat));
|
runDataHandler[i] = std::make_unique<PRunDataHandler>(addRunInfo[i].fPathFileName, addRunInfo[i].fFileFormat);
|
||||||
if (runDataHandler[i] == nullptr) {
|
|
||||||
isGood = false;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "**ERROR** couldn't invoke PRunDataHandler (i=" << i << ")." << std::endl;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
runDataHandler[i]->ReadData();
|
runDataHandler[i]->ReadData();
|
||||||
if (!runDataHandler[i]->IsAllDataAvailable()) {
|
if (!runDataHandler[i]->IsAllDataAvailable()) {
|
||||||
isGood = false;
|
isGood = false;
|
||||||
@ -678,13 +664,7 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info = std::unique_ptr<PAny2ManyInfo>(new PAny2ManyInfo());
|
info = std::make_unique<PAny2ManyInfo>();
|
||||||
if (info == nullptr) {
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "**ERROR** couldn't invoke PAny2ManyInfo." << std::endl;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
isGood = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGood) {
|
if (isGood) {
|
||||||
@ -692,13 +672,7 @@ int main(int argc, char *argv[])
|
|||||||
info->outFormat = format;
|
info->outFormat = format;
|
||||||
info->year = year;
|
info->year = year;
|
||||||
info->outFileName = flnOut;
|
info->outFileName = flnOut;
|
||||||
dataOut = std::unique_ptr<PRunDataHandler>(new PRunDataHandler(info.get()));
|
dataOut = std::make_unique<PRunDataHandler>(info.get());
|
||||||
if (dataOut == nullptr) {
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "**ERROR** couldn't invoke PRunDataHandler for the output file." << std::endl;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
isGood = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGood) {
|
if (isGood) {
|
||||||
@ -795,8 +769,12 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// feed all the necessary information for the data file
|
// feed all the necessary information for the data file
|
||||||
std::unique_ptr<PRawRunData> rawRunData = std::unique_ptr<PRawRunData>(new PRawRunData());
|
PRawRunData *rawRunData = nullptr;
|
||||||
rawRunData = std::unique_ptr<PRawRunData>(runDataHandler[0]->GetRunData()); // copy all
|
rawRunData = runDataHandler[0]->GetRunData(); // copy all
|
||||||
|
if (rawRunData == nullptr) {
|
||||||
|
std::cerr << ">> addRun: **ERROR** couldn't obtain PRawRunData object." << std::endl;
|
||||||
|
return PMUSR_MSR_ALLOCATION_ERROR;
|
||||||
|
}
|
||||||
rawRunData->SetGenerator("addRun");
|
rawRunData->SetGenerator("addRun");
|
||||||
// overwrite the t0 values with the new ones
|
// overwrite the t0 values with the new ones
|
||||||
for (UInt_t i=0; i<rawRunData->GetNoOfHistos(); i++) {
|
for (UInt_t i=0; i<rawRunData->GetNoOfHistos(); i++) {
|
||||||
@ -808,7 +786,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// feed run data handler with new data
|
// feed run data handler with new data
|
||||||
if (dataOut->SetRunData(rawRunData.get())) {
|
if (dataOut->SetRunData(rawRunData)) {
|
||||||
// write output file
|
// write output file
|
||||||
dataOut->WriteData();
|
dataOut->WriteData();
|
||||||
}
|
}
|
||||||
|
@ -494,8 +494,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// read startup file
|
// read startup file
|
||||||
char startup_path_name[128];
|
char startup_path_name[128];
|
||||||
std::unique_ptr<TSAXParser> saxParser = std::unique_ptr<TSAXParser>(new TSAXParser());
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
std::unique_ptr<PStartupHandler> startupHandler = std::unique_ptr<PStartupHandler>(new PStartupHandler());
|
std::unique_ptr<PStartupHandler> startupHandler = std::make_unique<PStartupHandler>();
|
||||||
if (!startupHandler->StartupFileFound()) {
|
if (!startupHandler->StartupFileFound()) {
|
||||||
std::cerr << std::endl << ">> any2many **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
std::cerr << std::endl << ">> any2many **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -516,9 +516,9 @@ int main(int argc, char *argv[])
|
|||||||
// read all the necessary runs (raw data)
|
// read all the necessary runs (raw data)
|
||||||
std::unique_ptr<PRunDataHandler> dataHandler;
|
std::unique_ptr<PRunDataHandler> dataHandler;
|
||||||
if (startupHandler)
|
if (startupHandler)
|
||||||
dataHandler = std::unique_ptr<PRunDataHandler>(new PRunDataHandler(&info, startupHandler->GetDataPathList()));
|
dataHandler = std::make_unique<PRunDataHandler>(&info, startupHandler->GetDataPathList());
|
||||||
else
|
else
|
||||||
dataHandler = std::unique_ptr<PRunDataHandler>(new PRunDataHandler(&info));
|
dataHandler = std::make_unique<PRunDataHandler>(&info);
|
||||||
|
|
||||||
// read and convert all data
|
// read and convert all data
|
||||||
dataHandler->ConvertData();
|
dataHandler->ConvertData();
|
||||||
|
@ -200,13 +200,7 @@ int dump_header_root(const std::string fileName, const bool summary, const bool
|
|||||||
std::cout << std::endl << "-------------------" << std::endl << std::endl;
|
std::cout << std::endl << "-------------------" << std::endl << std::endl;
|
||||||
} else { // MusrRoot
|
} else { // MusrRoot
|
||||||
// invoke the MusrRoot header object
|
// invoke the MusrRoot header object
|
||||||
header = std::unique_ptr<TMusrRunHeader>(new TMusrRunHeader(fileName.c_str(), true)); // read quite
|
header = std::make_unique<TMusrRunHeader>(fileName.c_str(), true); // read quite
|
||||||
if (header == nullptr) {
|
|
||||||
std::cerr << std::endl << "**ERROR** Couldn't invoke MusrRoot RunHeader in file:" << fileName;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
f.Close();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// try to populate the MusrRoot header object
|
// try to populate the MusrRoot header object
|
||||||
if (!header->ExtractAll(folder)) {
|
if (!header->ExtractAll(folder)) {
|
||||||
@ -320,14 +314,7 @@ int dump_header_root(const std::string fileName, const bool summary, const bool
|
|||||||
int dump_header_nexus(const std::string fileName, const bool counts) {
|
int dump_header_nexus(const std::string fileName, const bool counts) {
|
||||||
|
|
||||||
#ifdef PNEXUS_ENABLED
|
#ifdef PNEXUS_ENABLED
|
||||||
std::unique_ptr<PNeXus> nxs_file = std::unique_ptr<PNeXus>(new PNeXus(fileName.c_str()));
|
std::unique_ptr<PNeXus> nxs_file = std::make_unique<PNeXus>(fileName.c_str());
|
||||||
|
|
||||||
if (nxs_file == nullptr) {
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "**ERROR** couldn't invoke NeXus file object." << std::endl;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nxs_file->IsValid(false)) {
|
if (nxs_file->IsValid(false)) {
|
||||||
nxs_file->Dump(counts);
|
nxs_file->Dump(counts);
|
||||||
@ -930,8 +917,8 @@ int main(int argc, char *argv[])
|
|||||||
// invoke the startup handler in order to get the default search paths to the data files
|
// invoke the startup handler in order to get the default search paths to the data files
|
||||||
// read startup file
|
// read startup file
|
||||||
char startup_path_name[128];
|
char startup_path_name[128];
|
||||||
std::unique_ptr<TSAXParser> saxParser = std::unique_ptr<TSAXParser>(new TSAXParser());
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
std::unique_ptr<PStartupHandler> startupHandler = std::unique_ptr<PStartupHandler>(new PStartupHandler());
|
std::unique_ptr<PStartupHandler> startupHandler = std::make_unique<PStartupHandler>();
|
||||||
if (!startupHandler->StartupFileFound()) {
|
if (!startupHandler->StartupFileFound()) {
|
||||||
std::cerr << std::endl << ">> musrfit **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
std::cerr << std::endl << ">> musrfit **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
@ -555,12 +555,7 @@ int main(int argc, char *argv[])
|
|||||||
run_list += arg[i] + " ";
|
run_list += arg[i] + " ";
|
||||||
}
|
}
|
||||||
// parse run_list string
|
// parse run_list string
|
||||||
std::unique_ptr<PStringNumberList> nl = std::unique_ptr<PStringNumberList>(new PStringNumberList(run_list));
|
std::unique_ptr<PStringNumberList> nl = std::make_unique<PStringNumberList>(run_list);
|
||||||
if (nl == nullptr) { // couldn't invoke object
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << ">> msr2data: **ERROR** Couldn't invoke run_list parser object! Quitting now." << std::endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
std::string errorMsg("");
|
std::string errorMsg("");
|
||||||
if (!nl->Parse(errorMsg)) {
|
if (!nl->Parse(errorMsg)) {
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -662,12 +657,7 @@ int main(int argc, char *argv[])
|
|||||||
realOutput = false;
|
realOutput = false;
|
||||||
|
|
||||||
// create the msr2data-object and set the run numbers according to the runTAG above
|
// create the msr2data-object and set the run numbers according to the runTAG above
|
||||||
std::unique_ptr<PMsr2Data> msr2dataHandler = std::unique_ptr<PMsr2Data>(new PMsr2Data(msrExtension));
|
std::unique_ptr<PMsr2Data> msr2dataHandler = std::make_unique<PMsr2Data>(msrExtension);
|
||||||
if (msr2dataHandler == nullptr) {
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << ">> msr2data: **ERROR** couldn't invoke msr2dataHandler." << std::endl;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
@ -801,7 +791,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// delete old db/data file if the "new" option is given
|
// delete old db/data file if the "new" option is given
|
||||||
if (!msr2data_useOption(arg, "new")) {
|
if (!msr2data_useOption(arg, "new")) {
|
||||||
fileOutput = std::unique_ptr<std::fstream>(new std::fstream);
|
fileOutput = std::make_unique<std::fstream>();
|
||||||
fileOutput->open(outputFile.c_str(), std::ios::in);
|
fileOutput->open(outputFile.c_str(), std::ios::in);
|
||||||
if (fileOutput->is_open()) {
|
if (fileOutput->is_open()) {
|
||||||
std::cout << std::endl << ">> msr2data: **INFO** Deleting output file " << outputFile << std::endl;
|
std::cout << std::endl << ">> msr2data: **INFO** Deleting output file " << outputFile << std::endl;
|
||||||
@ -980,7 +970,7 @@ int main(int argc, char *argv[])
|
|||||||
// Unfortunately, there are also problems with boost::filesystem::exists(outputFile)
|
// Unfortunately, there are also problems with boost::filesystem::exists(outputFile)
|
||||||
// Therefore, first try to open the file for reading and if this works, write to it - not clean but it works
|
// Therefore, first try to open the file for reading and if this works, write to it - not clean but it works
|
||||||
if (realOutput) {
|
if (realOutput) {
|
||||||
fileOutput = std::unique_ptr<std::fstream>(new std::fstream);
|
fileOutput = std::make_unique<std::fstream>();
|
||||||
fileOutput->open(outputFile.c_str(), std::ios::in);
|
fileOutput->open(outputFile.c_str(), std::ios::in);
|
||||||
if (fileOutput->is_open()) {
|
if (fileOutput->is_open()) {
|
||||||
fileOutput->close();
|
fileOutput->close();
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <TApplication.h>
|
#include <TApplication.h>
|
||||||
#include <TROOT.h>
|
#include <TROOT.h>
|
||||||
@ -1030,40 +1031,22 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
PStartupOptions startup_options;
|
PStartupOptions startup_options;
|
||||||
startup_options.writeExpectedChisq = false;
|
startup_options.writeExpectedChisq = false;
|
||||||
startup_options.estimateN0 = true;
|
startup_options.estimateN0 = true;
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
PStartupHandler *startupHandler = new PStartupHandler();
|
std::unique_ptr<PStartupHandler> startupHandler = std::make_unique<PStartupHandler>();
|
||||||
if (!startupHandler->StartupFileFound()) {
|
if (!startupHandler->StartupFileFound()) {
|
||||||
std::cerr << std::endl << ">> musrFT **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
std::cerr << std::endl << ">> musrFT **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
// clean up
|
|
||||||
if (saxParser) {
|
|
||||||
delete saxParser;
|
|
||||||
saxParser = nullptr;
|
|
||||||
}
|
|
||||||
if (startupHandler) {
|
|
||||||
delete startupHandler;
|
|
||||||
startupHandler = nullptr;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
||||||
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("PStartupHandler", startupHandler.get());
|
||||||
//status = saxParser->ParseFile(startup_path_name);
|
//status = saxParser->ParseFile(startup_path_name);
|
||||||
// parsing the file as above seems to lead to problems in certain environments;
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
|
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
|
||||||
status = parseXmlFile(saxParser, startup_path_name);
|
status = parseXmlFile(saxParser.get(), startup_path_name);
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
std::cerr << std::endl << ">> musrFT **WARNING** Reading/parsing musrfit_startup.xml failed.";
|
std::cerr << std::endl << ">> musrFT **WARNING** Reading/parsing musrfit_startup.xml failed.";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
// clean up
|
|
||||||
if (saxParser) {
|
|
||||||
delete saxParser;
|
|
||||||
saxParser = nullptr;
|
|
||||||
}
|
|
||||||
if (startupHandler) {
|
|
||||||
delete startupHandler;
|
|
||||||
startupHandler = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1071,10 +1054,10 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
PPrepFourier data(startupParam.packing, startupParam.bkg_range, startupParam.bkg);
|
PPrepFourier data(startupParam.packing, startupParam.bkg_range, startupParam.bkg);
|
||||||
|
|
||||||
// load msr-file(s)
|
// load msr-file(s)
|
||||||
std::vector<PMsrHandler*> msrHandler;
|
std::vector< std::unique_ptr<PMsrHandler> > msrHandler;
|
||||||
msrHandler.resize(startupParam.msrFln.size());
|
msrHandler.resize(startupParam.msrFln.size());
|
||||||
for (UInt_t i=0; i<startupParam.msrFln.size(); i++) {
|
for (UInt_t i=0; i<startupParam.msrFln.size(); i++) {
|
||||||
msrHandler[i] = new PMsrHandler(startupParam.msrFln[i].Data(), &startup_options, true);
|
msrHandler[i] = std::make_unique<PMsrHandler>(startupParam.msrFln[i].Data(), &startup_options, true);
|
||||||
status = msrHandler[i]->ReadMsrFile();
|
status = msrHandler[i]->ReadMsrFile();
|
||||||
if (status != PMUSR_SUCCESS) {
|
if (status != PMUSR_SUCCESS) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -1092,24 +1075,32 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<PRunDataHandler*> runDataHandler;
|
std::vector< std::unique_ptr<PRunDataHandler> > runDataHandler;
|
||||||
runDataHandler.resize(startupParam.msrFln.size()+startupParam.dataFln.size()); // resize to the total number of run data provided
|
runDataHandler.resize(startupParam.msrFln.size()+startupParam.dataFln.size()); // resize to the total number of run data provided
|
||||||
// load data-file(s) related to msr-file
|
// load data-file(s) related to msr-file
|
||||||
for (UInt_t i=0; i<msrHandler.size(); i++) {
|
for (UInt_t i=0; i<msrHandler.size(); i++) {
|
||||||
// create run data handler
|
// create run data handler
|
||||||
if (startupHandler)
|
if (startupHandler)
|
||||||
runDataHandler[i] = new PRunDataHandler(msrHandler[i], startupHandler->GetDataPathList());
|
runDataHandler[i] = std::make_unique<PRunDataHandler>(msrHandler[i].get(), startupHandler->GetDataPathList());
|
||||||
else
|
else
|
||||||
runDataHandler[i] = new PRunDataHandler(msrHandler[i]);
|
runDataHandler[i] = std::make_unique<PRunDataHandler>(msrHandler[i].get());
|
||||||
|
if (runDataHandler[i] == nullptr) {
|
||||||
|
std::cerr << ">> musrFT: **ERROR** couldn't allocate PRunDataHandler object." << std::endl;
|
||||||
|
return PMUSR_MSR_ALLOCATION_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// load data-file(s) provided directly
|
// load data-file(s) provided directly
|
||||||
for (UInt_t i=msrHandler.size(); i<msrHandler.size()+startupParam.dataFln.size(); i++) {
|
for (UInt_t i=msrHandler.size(); i<msrHandler.size()+startupParam.dataFln.size(); i++) {
|
||||||
// create run data handler
|
// create run data handler
|
||||||
if (startupHandler)
|
if (startupHandler)
|
||||||
runDataHandler[i] = new PRunDataHandler(startupParam.dataFln[i-msrHandler.size()], startupParam.dataFileFormat[i-msrHandler.size()], startupHandler->GetDataPathList());
|
runDataHandler[i] = std::make_unique<PRunDataHandler>(startupParam.dataFln[i-msrHandler.size()], startupParam.dataFileFormat[i-msrHandler.size()], startupHandler->GetDataPathList());
|
||||||
else
|
else
|
||||||
runDataHandler[i] = new PRunDataHandler(startupParam.dataFln[i-msrHandler.size()], startupParam.dataFileFormat[i-msrHandler.size()]);
|
runDataHandler[i] = std::make_unique<PRunDataHandler>(startupParam.dataFln[i-msrHandler.size()], startupParam.dataFileFormat[i-msrHandler.size()]);
|
||||||
|
if (runDataHandler[i] == nullptr) {
|
||||||
|
std::cerr << ">> musrFT: **ERROR** couldn't allocate PRunDataHandler object." << std::endl;
|
||||||
|
return PMUSR_MSR_ALLOCATION_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// read all the data files
|
// read all the data files
|
||||||
@ -1288,7 +1279,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
|
|
||||||
// handle data set(s)
|
// handle data set(s)
|
||||||
// group forward histos
|
// group forward histos
|
||||||
if (musrFT_groupHistos(runDataHandler[i], global, runs->at(runList[j]-1), rd)) {
|
if (musrFT_groupHistos(runDataHandler[i].get(), global, runs->at(runList[j]-1), rd)) {
|
||||||
return PMUSR_DATA_FILE_READ_ERROR;
|
return PMUSR_DATA_FILE_READ_ERROR;
|
||||||
}
|
}
|
||||||
// keep data set
|
// keep data set
|
||||||
@ -1512,29 +1503,11 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
if (fourierCanvas)
|
if (fourierCanvas)
|
||||||
delete fourierCanvas;
|
delete fourierCanvas;
|
||||||
|
|
||||||
if (startupHandler)
|
|
||||||
delete startupHandler;
|
|
||||||
|
|
||||||
for (UInt_t i=0; i<msrHandler.size(); i++)
|
|
||||||
if (msrHandler[i])
|
|
||||||
delete msrHandler[i];
|
|
||||||
msrHandler.clear();
|
|
||||||
|
|
||||||
for (UInt_t i=0; i<runDataHandler.size(); i++)
|
|
||||||
if (runDataHandler[i])
|
|
||||||
delete runDataHandler[i];
|
|
||||||
runDataHandler.clear();
|
|
||||||
|
|
||||||
if (histo.size() > 0) {
|
if (histo.size() > 0) {
|
||||||
for (UInt_t i=0; i<histo.size(); i++)
|
for (UInt_t i=0; i<histo.size(); i++)
|
||||||
delete histo[i];
|
delete histo[i];
|
||||||
histo.clear();
|
histo.clear();
|
||||||
}
|
}
|
||||||
if (fourier.size() > 0) {
|
|
||||||
for (UInt_t i=0; i<fourier.size(); i++)
|
|
||||||
delete fourier[i];
|
|
||||||
fourier.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
return PMUSR_SUCCESS;
|
return PMUSR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -289,14 +289,14 @@ void musrfit_write_root(TFile &f, TString fln, PRunData *data, int runCounter)
|
|||||||
|
|
||||||
snprintf(name, sizeof(name),"c%d", runCounter);
|
snprintf(name, sizeof(name),"c%d", runCounter);
|
||||||
|
|
||||||
std::unique_ptr<TCanvas> c = std::unique_ptr<TCanvas>(new TCanvas(name, title.Data(), 10, 10, 800, 600));
|
std::unique_ptr<TCanvas> c = std::make_unique<TCanvas>(name, title.Data(), 10, 10, 800, 600);
|
||||||
|
|
||||||
// create histos
|
// create histos
|
||||||
Double_t diff = data->GetDataTimeStep();
|
Double_t diff = data->GetDataTimeStep();
|
||||||
Double_t start = -diff/2.0;
|
Double_t start = -diff/2.0;
|
||||||
Double_t end = data->GetDataTimeStep()*data->GetValue()->size();
|
Double_t end = data->GetDataTimeStep()*data->GetValue()->size();
|
||||||
std::unique_ptr<TH1F> hdata = std::unique_ptr<TH1F>(new TH1F("hdata", "run data", data->GetValue()->size(), start, end));
|
std::unique_ptr<TH1F> hdata = std::make_unique<TH1F>("hdata", "run data", data->GetValue()->size(), start, end);
|
||||||
std::unique_ptr<TH1F> htheo = std::unique_ptr<TH1F>(new TH1F("htheo", "run theory", data->GetValue()->size(), start, end));
|
std::unique_ptr<TH1F> htheo = std::make_unique<TH1F>("htheo", "run theory", data->GetValue()->size(), start, end);
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
for (unsigned int i=0; i<data->GetValue()->size(); i++) {
|
for (unsigned int i=0; i<data->GetValue()->size(); i++) {
|
||||||
@ -617,8 +617,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// read startup file
|
// read startup file
|
||||||
char startup_path_name[128];
|
char startup_path_name[128];
|
||||||
std::unique_ptr<TSAXParser> saxParser(new TSAXParser());
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
std::unique_ptr<PStartupHandler> startupHandler(new PStartupHandler());
|
std::unique_ptr<PStartupHandler> startupHandler = std::make_unique<PStartupHandler>();
|
||||||
if (!startupHandler->StartupFileFound()) {
|
if (!startupHandler->StartupFileFound()) {
|
||||||
std::cerr << std::endl << ">> musrfit **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
std::cerr << std::endl << ">> musrfit **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -644,9 +644,9 @@ int main(int argc, char *argv[])
|
|||||||
// read msr-file
|
// read msr-file
|
||||||
std::unique_ptr<PMsrHandler> msrHandler;
|
std::unique_ptr<PMsrHandler> msrHandler;
|
||||||
if (startupHandler)
|
if (startupHandler)
|
||||||
msrHandler = std::unique_ptr<PMsrHandler>(new PMsrHandler(filename, &startup_options));
|
msrHandler = std::make_unique<PMsrHandler>(filename, &startup_options);
|
||||||
else
|
else
|
||||||
msrHandler = std::unique_ptr<PMsrHandler>(new PMsrHandler(filename));
|
msrHandler = std::make_unique<PMsrHandler>(filename);
|
||||||
status = msrHandler->ReadMsrFile();
|
status = msrHandler->ReadMsrFile();
|
||||||
if (status != PMUSR_SUCCESS) {
|
if (status != PMUSR_SUCCESS) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -666,9 +666,9 @@ int main(int argc, char *argv[])
|
|||||||
// read all the necessary runs (raw data)
|
// read all the necessary runs (raw data)
|
||||||
std::unique_ptr<PRunDataHandler> dataHandler;
|
std::unique_ptr<PRunDataHandler> dataHandler;
|
||||||
if (startupHandler)
|
if (startupHandler)
|
||||||
dataHandler = std::unique_ptr<PRunDataHandler>(new PRunDataHandler(msrHandler.get(), startupHandler->GetDataPathList()));
|
dataHandler = std::make_unique<PRunDataHandler>(msrHandler.get(), startupHandler->GetDataPathList());
|
||||||
else
|
else
|
||||||
dataHandler = std::unique_ptr<PRunDataHandler>(new PRunDataHandler(msrHandler.get()));
|
dataHandler = std::make_unique<PRunDataHandler>(msrHandler.get());
|
||||||
|
|
||||||
dataHandler->ReadData();
|
dataHandler->ReadData();
|
||||||
|
|
||||||
@ -689,7 +689,7 @@ int main(int argc, char *argv[])
|
|||||||
std::unique_ptr<PRunListCollection> runListCollection;
|
std::unique_ptr<PRunListCollection> runListCollection;
|
||||||
if (success) {
|
if (success) {
|
||||||
// feed all the necessary histogramms for the fit
|
// feed all the necessary histogramms for the fit
|
||||||
runListCollection = std::unique_ptr<PRunListCollection>(new PRunListCollection(msrHandler.get(), dataHandler.get()));
|
runListCollection = std::make_unique<PRunListCollection>(msrHandler.get(), dataHandler.get());
|
||||||
for (unsigned int i=0; i < msrHandler->GetMsrRunList()->size(); i++) {
|
for (unsigned int i=0; i < msrHandler->GetMsrRunList()->size(); i++) {
|
||||||
success = runListCollection->Add(i, kFit);
|
success = runListCollection->Add(i, kFit);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
@ -704,7 +704,7 @@ int main(int argc, char *argv[])
|
|||||||
std::unique_ptr<TThread> th;
|
std::unique_ptr<TThread> th;
|
||||||
if (timeout_enabled) {
|
if (timeout_enabled) {
|
||||||
pid_t musrfit_pid = getpid();
|
pid_t musrfit_pid = getpid();
|
||||||
th = std::unique_ptr<TThread>(new TThread(musrfit_timeout, (void*)&musrfit_pid));
|
th = std::make_unique<TThread>(musrfit_timeout, (void*)&musrfit_pid);
|
||||||
if (th) {
|
if (th) {
|
||||||
th->Run();
|
th->Run();
|
||||||
}
|
}
|
||||||
@ -713,7 +713,7 @@ int main(int argc, char *argv[])
|
|||||||
// do fitting
|
// do fitting
|
||||||
std::unique_ptr<PFitter> fitter;
|
std::unique_ptr<PFitter> fitter;
|
||||||
if (success) {
|
if (success) {
|
||||||
fitter = std::unique_ptr<PFitter>(new PFitter(msrHandler.get(), runListCollection.get(), chisq_only));
|
fitter = std::make_unique<PFitter>(msrHandler.get(), runListCollection.get(), chisq_only);
|
||||||
if (fitter->IsValid()) {
|
if (fitter->IsValid()) {
|
||||||
fitter->DoFit();
|
fitter->DoFit();
|
||||||
if (!fitter->IsScanOnly())
|
if (!fitter->IsScanOnly())
|
||||||
|
128
src/musrt0.cpp
128
src/musrt0.cpp
@ -94,15 +94,7 @@ void musrt0_syntax()
|
|||||||
*/
|
*/
|
||||||
Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data, UInt_t idx, Int_t timeout)
|
Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data, UInt_t idx, Int_t timeout)
|
||||||
{
|
{
|
||||||
PMusrT0 *musrT0 = new PMusrT0(data);
|
std::unique_ptr<PMusrT0> musrT0 = std::make_unique<PMusrT0>(data);
|
||||||
|
|
||||||
// check if the musrT0 object could be invoked
|
|
||||||
if (musrT0 == nullptr) {
|
|
||||||
std::cerr << std::endl << ">> musrt0 **ERROR** Couldn't invoke musrT0 ...";
|
|
||||||
std::cerr << std::endl << ">> run name " << data.GetRawRunData(idx)->GetRunName()->Data();
|
|
||||||
std::cerr << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if the musrT0 object is valid
|
// check if the musrT0 object is valid
|
||||||
if (!musrT0->IsValid()) {
|
if (!musrT0->IsValid()) {
|
||||||
@ -137,45 +129,11 @@ Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data
|
|||||||
result = true;
|
result = true;
|
||||||
|
|
||||||
// disconnect all SIGNALS and SLOTS connected t0 musrT0
|
// disconnect all SIGNALS and SLOTS connected t0 musrT0
|
||||||
musrT0->Disconnect(musrT0);
|
musrT0->Disconnect(musrT0.get());
|
||||||
|
|
||||||
// cleanup
|
|
||||||
delete musrT0;
|
|
||||||
musrT0 = nullptr;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* <p>This routine cleans up the handlers.
|
|
||||||
*
|
|
||||||
* \param saxParser XML SAX parser
|
|
||||||
* \param startupHandler startup handler
|
|
||||||
* \param msrHandler msr-file handler
|
|
||||||
* \param dataHandler raw run data handler
|
|
||||||
*/
|
|
||||||
void musrt0_cleanup(TSAXParser *saxParser, PStartupHandler *startupHandler, PMsrHandler *msrHandler, PRunDataHandler *dataHandler)
|
|
||||||
{
|
|
||||||
if (saxParser) {
|
|
||||||
delete saxParser;
|
|
||||||
saxParser = nullptr;
|
|
||||||
}
|
|
||||||
if (startupHandler) {
|
|
||||||
delete startupHandler;
|
|
||||||
startupHandler = nullptr;
|
|
||||||
}
|
|
||||||
if (msrHandler) {
|
|
||||||
delete msrHandler;
|
|
||||||
msrHandler = nullptr;
|
|
||||||
}
|
|
||||||
if (dataHandler) {
|
|
||||||
delete dataHandler;
|
|
||||||
dataHandler = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -312,45 +270,27 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
|
|
||||||
// read startup file
|
// read startup file
|
||||||
Char_t startup_path_name[128];
|
Char_t startup_path_name[128];
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
PStartupHandler *startupHandler = new PStartupHandler();
|
std::unique_ptr<PStartupHandler> startupHandler = std::make_unique<PStartupHandler>();
|
||||||
if (!startupHandler->StartupFileFound()) {
|
if (!startupHandler->StartupFileFound()) {
|
||||||
std::cerr << std::endl << ">> musrt0 **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
std::cerr << std::endl << ">> musrt0 **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
// clean up
|
|
||||||
if (saxParser) {
|
|
||||||
delete saxParser;
|
|
||||||
saxParser = nullptr;
|
|
||||||
}
|
|
||||||
if (startupHandler) {
|
|
||||||
delete startupHandler;
|
|
||||||
startupHandler = nullptr;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
|
||||||
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("PStartupHandler", startupHandler.get());
|
||||||
//status = saxParser->ParseFile(startup_path_name);
|
//status = saxParser->ParseFile(startup_path_name);
|
||||||
// parsing the file as above seems to lead to problems in certain environments;
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
|
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
|
||||||
status = parseXmlFile(saxParser, startup_path_name);
|
status = parseXmlFile(saxParser.get(), startup_path_name);
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
std::cerr << std::endl << ">> musrt0 **WARNING** Reading/parsing musrfit_startup.xml failed.";
|
std::cerr << std::endl << ">> musrt0 **WARNING** Reading/parsing musrfit_startup.xml failed.";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
// clean up
|
|
||||||
if (saxParser) {
|
|
||||||
delete saxParser;
|
|
||||||
saxParser = nullptr;
|
|
||||||
}
|
|
||||||
if (startupHandler) {
|
|
||||||
delete startupHandler;
|
|
||||||
startupHandler = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// read msr-file
|
// read msr-file
|
||||||
PMsrHandler *msrHandler = new PMsrHandler(filename);
|
std::unique_ptr<PMsrHandler> msrHandler = std::make_unique<PMsrHandler>(filename);
|
||||||
status = msrHandler->ReadMsrFile();
|
status = msrHandler->ReadMsrFile();
|
||||||
if (status != PMUSR_SUCCESS) {
|
if (status != PMUSR_SUCCESS) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -383,12 +323,12 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read all the necessary runs (raw data)
|
// read all the necessary runs (raw data)
|
||||||
PRunDataHandler *dataHandler = nullptr;
|
std::unique_ptr<PRunDataHandler> dataHandler;
|
||||||
if (success) {
|
if (success) {
|
||||||
if (startupHandler)
|
if (startupHandler)
|
||||||
dataHandler = new PRunDataHandler(msrHandler, startupHandler->GetDataPathList());
|
dataHandler = std::make_unique<PRunDataHandler>(msrHandler.get(), startupHandler->GetDataPathList());
|
||||||
else
|
else
|
||||||
dataHandler = new PRunDataHandler(msrHandler);
|
dataHandler = std::make_unique<PRunDataHandler>(msrHandler.get());
|
||||||
|
|
||||||
dataHandler->ReadData();
|
dataHandler->ReadData();
|
||||||
|
|
||||||
@ -874,8 +814,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||||
musrT0Data.SetCmdTag(PMUSRT0_GET_T0_DATA_AND_BKG_RANGE);
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0_DATA_AND_BKG_RANGE);
|
||||||
// execute cmd
|
// execute cmd
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, 0, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -901,8 +840,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
// feed necessary data
|
// feed necessary data
|
||||||
musrT0Data.SetAddRunIdx(j); // addruns
|
musrT0Data.SetAddRunIdx(j); // addruns
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, j, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, j, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -928,8 +866,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
// feed necessary data
|
// feed necessary data
|
||||||
musrT0Data.SetHistoNoIdx(j);
|
musrT0Data.SetHistoNoIdx(j);
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, 0, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -957,8 +894,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
// feed necessary data
|
// feed necessary data
|
||||||
musrT0Data.SetHistoNoIdx(k);
|
musrT0Data.SetHistoNoIdx(k);
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, j, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, j, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -973,8 +909,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
musrT0Data.SetAddT0Bin((UInt_t)runList->at(i).GetAddT0Bin(k, j), k, j);
|
musrT0Data.SetAddT0Bin((UInt_t)runList->at(i).GetAddT0Bin(k, j), k, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, 0, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1002,8 +937,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||||
musrT0Data.SetCmdTag(PMUSRT0_GET_T0_DATA_AND_BKG_RANGE);
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0_DATA_AND_BKG_RANGE);
|
||||||
// execute cmd
|
// execute cmd
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, 0, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
// feed necessary data backward
|
// feed necessary data backward
|
||||||
@ -1025,8 +959,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
musrT0Data.SetDetectorTag(PMUSRT0_BACKWARD);
|
musrT0Data.SetDetectorTag(PMUSRT0_BACKWARD);
|
||||||
musrT0Data.SetCmdTag(PMUSRT0_GET_T0_DATA_AND_BKG_RANGE);
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0_DATA_AND_BKG_RANGE);
|
||||||
// execute cmd
|
// execute cmd
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, 0, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1053,8 +986,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
// feed necessary data
|
// feed necessary data
|
||||||
musrT0Data.SetAddRunIdx(j); // addruns
|
musrT0Data.SetAddRunIdx(j); // addruns
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, j, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, j, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1079,8 +1011,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
// feed necessary data
|
// feed necessary data
|
||||||
musrT0Data.SetAddRunIdx(j); // addruns
|
musrT0Data.SetAddRunIdx(j); // addruns
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, j, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, j, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1106,8 +1037,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
// feed necessary data
|
// feed necessary data
|
||||||
musrT0Data.SetHistoNoIdx(j);
|
musrT0Data.SetHistoNoIdx(j);
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, 0, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1132,8 +1062,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
// feed necessary data
|
// feed necessary data
|
||||||
musrT0Data.SetHistoNoIdx(j);
|
musrT0Data.SetHistoNoIdx(j);
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, 0, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1161,8 +1090,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
// feed necessary data
|
// feed necessary data
|
||||||
musrT0Data.SetHistoNoIdx(k);
|
musrT0Data.SetHistoNoIdx(k);
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, j, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, j, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1190,8 +1118,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
// feed necessary data
|
// feed necessary data
|
||||||
musrT0Data.SetHistoNoIdx(k);
|
musrT0Data.SetHistoNoIdx(k);
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, j, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, j, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1208,14 +1135,12 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
}
|
}
|
||||||
musrT0Data.SetHistoNo(forwardHistos);
|
musrT0Data.SetHistoNo(forwardHistos);
|
||||||
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, 0, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
musrT0Data.SetHistoNo(backwardHistos);
|
musrT0Data.SetHistoNo(backwardHistos);
|
||||||
musrT0Data.SetDetectorTag(PMUSRT0_BACKWARD);
|
musrT0Data.SetDetectorTag(PMUSRT0_BACKWARD);
|
||||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
if (!musrt0_item(app, msrHandler.get(), musrT0Data, 0, timeout)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1248,8 +1173,5 @@ Int_t main(Int_t argc, Char_t *argv[])
|
|||||||
// delete __temp.msr
|
// delete __temp.msr
|
||||||
gSystem->Exec("rm __temp.msr");
|
gSystem->Exec("rm __temp.msr");
|
||||||
|
|
||||||
// clean up
|
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
|
|
||||||
return PMUSR_SUCCESS;
|
return PMUSR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -200,8 +200,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// read startup file
|
// read startup file
|
||||||
char startup_path_name[128];
|
char startup_path_name[128];
|
||||||
std::unique_ptr<TSAXParser> saxParser = std::unique_ptr<TSAXParser>(new TSAXParser());
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
std::unique_ptr<PStartupHandler> startupHandler = std::unique_ptr<PStartupHandler>(new PStartupHandler());
|
std::unique_ptr<PStartupHandler> startupHandler = std::make_unique<PStartupHandler>();
|
||||||
if (!startupHandler->StartupFileFound()) {
|
if (!startupHandler->StartupFileFound()) {
|
||||||
std::cerr << std::endl << ">> musrview **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
std::cerr << std::endl << ">> musrview **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -223,7 +223,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read msr-file
|
// read msr-file
|
||||||
std::unique_ptr<PMsrHandler> msrHandler = std::unique_ptr<PMsrHandler>(new PMsrHandler(fileName));
|
std::unique_ptr<PMsrHandler> msrHandler = std::make_unique<PMsrHandler>(fileName);
|
||||||
status = msrHandler->ReadMsrFile();
|
status = msrHandler->ReadMsrFile();
|
||||||
if (status != PMUSR_SUCCESS) {
|
if (status != PMUSR_SUCCESS) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -262,9 +262,9 @@ int main(int argc, char *argv[])
|
|||||||
// read all the necessary runs (raw data)
|
// read all the necessary runs (raw data)
|
||||||
std::unique_ptr<PRunDataHandler> dataHandler;
|
std::unique_ptr<PRunDataHandler> dataHandler;
|
||||||
if (startupHandler)
|
if (startupHandler)
|
||||||
dataHandler = std::unique_ptr<PRunDataHandler>(new PRunDataHandler(msrHandler.get(), startupHandler->GetDataPathList()));
|
dataHandler = std::make_unique<PRunDataHandler>(msrHandler.get(), startupHandler->GetDataPathList());
|
||||||
else
|
else
|
||||||
dataHandler = std::unique_ptr<PRunDataHandler>(new PRunDataHandler(msrHandler.get()));
|
dataHandler = std::make_unique<PRunDataHandler>(msrHandler.get());
|
||||||
|
|
||||||
dataHandler->ReadData();
|
dataHandler->ReadData();
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ int main(int argc, char *argv[])
|
|||||||
std::unique_ptr<PRunListCollection> runListCollection;
|
std::unique_ptr<PRunListCollection> runListCollection;
|
||||||
if (result == PMUSR_SUCCESS) {
|
if (result == PMUSR_SUCCESS) {
|
||||||
// feed all the necessary histogramms for the view
|
// feed all the necessary histogramms for the view
|
||||||
runListCollection = std::unique_ptr<PRunListCollection>(new PRunListCollection(msrHandler.get(), dataHandler.get(), theoAtData));
|
runListCollection = std::make_unique<PRunListCollection>(msrHandler.get(), dataHandler.get(), theoAtData);
|
||||||
for (unsigned int i=0; i<msrHandler->GetMsrRunList()->size(); i++) {
|
for (unsigned int i=0; i<msrHandler->GetMsrRunList()->size(); i++) {
|
||||||
// if run is in plotList add it, otherwise go to the next
|
// if run is in plotList add it, otherwise go to the next
|
||||||
runPresent = false;
|
runPresent = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user