AA35 will not do anything anyway, therefore:
changed the type of the PSI-BIN bin_width member from float to double.
This commit is contained in:
@ -408,11 +408,11 @@ int MuSR_td_PSI_bin::readbin(const char * fileName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dum_Float32 = (Float32 *) &buffer_file[1012];
|
dum_Float32 = (Float32 *) &buffer_file[1012];
|
||||||
bin_width = *dum_Float32;
|
bin_width = static_cast<double>(*dum_Float32);
|
||||||
|
|
||||||
if (bin_width == 0.)
|
if (bin_width == 0.)
|
||||||
{
|
{
|
||||||
bin_width=(625.E-6)/8.*pow(Float32(2.),Float32(tdc_resolution));
|
bin_width=0.125*(625.E-6)*pow(static_cast<double>(2.0),static_cast<double>(tdc_resolution));
|
||||||
}
|
}
|
||||||
|
|
||||||
default_binning = 1;
|
default_binning = 1;
|
||||||
@ -702,7 +702,7 @@ int MuSR_td_PSI_bin::writebin(const char *fileName)
|
|||||||
strncpy(buffer+948+i*4, labels_histo[i], 4);
|
strncpy(buffer+948+i*4, labels_histo[i], 4);
|
||||||
}
|
}
|
||||||
// write TDS time resolution
|
// write TDS time resolution
|
||||||
dum_Float32 = (Float32)bin_width;
|
dum_Float32 = static_cast<Float32>(bin_width);
|
||||||
memcpy(buffer+1012, (const char*)&dum_Float32, 4);
|
memcpy(buffer+1012, (const char*)&dum_Float32, 4);
|
||||||
|
|
||||||
// write header information
|
// write header information
|
||||||
@ -3396,7 +3396,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning)
|
|||||||
|
|
||||||
double MuSR_td_PSI_bin::get_binWidth_ps()
|
double MuSR_td_PSI_bin::get_binWidth_ps()
|
||||||
{
|
{
|
||||||
return double((double)bin_width*(double)1000000.);
|
return bin_width*1.0e6;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*******************************
|
//*******************************
|
||||||
@ -3410,7 +3410,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning)
|
|||||||
|
|
||||||
void MuSR_td_PSI_bin::put_binWidth_ps(double binWidth)
|
void MuSR_td_PSI_bin::put_binWidth_ps(double binWidth)
|
||||||
{
|
{
|
||||||
bin_width = (float)(binWidth/1.0e6);
|
bin_width = binWidth*1.0e-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*******************************
|
//*******************************
|
||||||
@ -3422,7 +3422,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning)
|
|||||||
|
|
||||||
double MuSR_td_PSI_bin::get_binWidth_ns()
|
double MuSR_td_PSI_bin::get_binWidth_ns()
|
||||||
{
|
{
|
||||||
return double((double)bin_width*(double)1000.);
|
return bin_width*1.0e3;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*******************************
|
//*******************************
|
||||||
@ -3436,7 +3436,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning)
|
|||||||
|
|
||||||
void MuSR_td_PSI_bin::put_binWidth_ns(double binWidth)
|
void MuSR_td_PSI_bin::put_binWidth_ns(double binWidth)
|
||||||
{
|
{
|
||||||
bin_width = (float)(binWidth/1.0e3);
|
bin_width = binWidth*1.0e-3;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*******************************
|
//*******************************
|
||||||
@ -3448,7 +3448,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning)
|
|||||||
|
|
||||||
double MuSR_td_PSI_bin::get_binWidth_us()
|
double MuSR_td_PSI_bin::get_binWidth_us()
|
||||||
{
|
{
|
||||||
return double(bin_width);
|
return bin_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*******************************
|
//*******************************
|
||||||
@ -3462,7 +3462,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning)
|
|||||||
|
|
||||||
void MuSR_td_PSI_bin::put_binWidth_us(double binWidth)
|
void MuSR_td_PSI_bin::put_binWidth_us(double binWidth)
|
||||||
{
|
{
|
||||||
bin_width = (float)binWidth;
|
bin_width = binWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*******************************
|
//*******************************
|
||||||
@ -4253,7 +4253,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning)
|
|||||||
|
|
||||||
for (unsigned int i=0; i<scalersName.size(); i++) {
|
for (unsigned int i=0; i<scalersName.size(); i++) {
|
||||||
strncpy(labels_scalers[i], scalersName[i].c_str(), MAXLABELSIZE-1);
|
strncpy(labels_scalers[i], scalersName[i].c_str(), MAXLABELSIZE-1);
|
||||||
labels_scalers[i][MAXLABELSIZE] = '\0';
|
labels_scalers[i][MAXLABELSIZE-1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -4540,7 +4540,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning)
|
|||||||
strcpy(date_stop, " ");
|
strcpy(date_stop, " ");
|
||||||
strcpy(time_stop, " ");
|
strcpy(time_stop, " ");
|
||||||
|
|
||||||
bin_width = 0.f;
|
bin_width = 0.;
|
||||||
number_histo = 0;
|
number_histo = 0;
|
||||||
length_histo = 0;
|
length_histo = 0;
|
||||||
total_events = 0;
|
total_events = 0;
|
||||||
|
@ -82,7 +82,7 @@ class MuSR_td_PSI_bin {
|
|||||||
char time_start[9];
|
char time_start[9];
|
||||||
char time_stop[9];
|
char time_stop[9];
|
||||||
|
|
||||||
float bin_width;
|
double bin_width;
|
||||||
|
|
||||||
int number_histo;
|
int number_histo;
|
||||||
int length_histo;
|
int length_histo;
|
||||||
|
154
src/msr2data.cpp
154
src/msr2data.cpp
@ -127,6 +127,40 @@ void msr2data_syntax()
|
|||||||
cout << endl << endl;
|
cout << endl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>Cleaning up some used variables
|
||||||
|
*
|
||||||
|
* \param msr2dataHandler pointer to PMsr2Data object
|
||||||
|
* \param run_vec vector containing the run numbers
|
||||||
|
* \param arg vector containing the command line arguments
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void msr2data_cleanup(PMsr2Data *msr2dataHandler, vector<unsigned int> &run_vec, vector<string> &arg)
|
||||||
|
{
|
||||||
|
delete msr2dataHandler;
|
||||||
|
msr2dataHandler = 0;
|
||||||
|
run_vec.clear();
|
||||||
|
arg.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>Cleaning up some used variables
|
||||||
|
*
|
||||||
|
* \param msr2dataHandler pointer to PMsr2Data object
|
||||||
|
* \param arg vector containing the command line arguments
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void msr2data_cleanup(PMsr2Data *msr2dataHandler, vector<string> &arg)
|
||||||
|
{
|
||||||
|
delete msr2dataHandler;
|
||||||
|
msr2dataHandler = 0;
|
||||||
|
arg.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>Checks if only valid options appear in the argument list
|
* <p>Checks if only valid options appear in the argument list
|
||||||
@ -168,7 +202,7 @@ string msr2data_validArguments(const vector<string> &arg)
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>filters out the output file name from at argument string
|
* <p>filters out the output file name from the argument string
|
||||||
*
|
*
|
||||||
* <p><b>return:</b>
|
* <p><b>return:</b>
|
||||||
* - output file name if present in the argument list
|
* - output file name if present in the argument list
|
||||||
@ -481,36 +515,34 @@ 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
|
||||||
PMsr2Data msr2dataHandler(msrExtension);
|
PMsr2Data *msr2dataHandler = new PMsr2Data(msrExtension);
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
switch(runTAG) {
|
switch(runTAG) {
|
||||||
case 1:
|
case 1:
|
||||||
status = msr2dataHandler.SetRunNumbers(run_vec);
|
status = msr2dataHandler->SetRunNumbers(run_vec);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
status = msr2dataHandler.SetRunNumbers(run_vec[0], run_vec[1]);
|
status = msr2dataHandler->SetRunNumbers(run_vec[0], run_vec[1]);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
status = msr2dataHandler.SetRunNumbers(run_vec[0]);
|
status = msr2dataHandler->SetRunNumbers(run_vec[0]);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
status = msr2dataHandler.SetRunNumbers(run_list);
|
status = msr2dataHandler->SetRunNumbers(run_list);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
cerr << ">> msr2data: **ERROR** None of the possible run list specifications has been detected! Quitting now..." << endl;
|
cerr << ">> msr2data: **ERROR** None of the possible run list specifications has been detected! Quitting now..." << endl;
|
||||||
run_vec.clear();
|
msr2data_cleanup(msr2dataHandler, run_vec, arg);
|
||||||
arg.clear();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == 1) {
|
if (status == 1) {
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
cerr << ">> msr2data: **ERROR** The run numbers are out of range! Quitting..." << endl;
|
cerr << ">> msr2data: **ERROR** The run numbers are out of range! Quitting..." << endl;
|
||||||
run_vec.clear();
|
msr2data_cleanup(msr2dataHandler, run_vec, arg);
|
||||||
arg.clear();
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,14 +558,12 @@ int main(int argc, char *argv[])
|
|||||||
if (temp == -2) {
|
if (temp == -2) {
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
cerr << ">> msr2data: **ERROR** More than one fitting options are specified! Quitting..." << endl;
|
cerr << ">> msr2data: **ERROR** More than one fitting options are specified! Quitting..." << endl;
|
||||||
run_vec.clear();
|
msr2data_cleanup(msr2dataHandler, arg);
|
||||||
arg.clear();
|
|
||||||
return temp;
|
return temp;
|
||||||
} else if (temp == -3) {
|
} else if (temp == -3) {
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
cerr << ">> msr2data: **ERROR** The given template has not a valid run number! Quitting..." << endl;
|
cerr << ">> msr2data: **ERROR** The given template has not a valid run number! Quitting..." << endl;
|
||||||
run_vec.clear();
|
msr2data_cleanup(msr2dataHandler, arg);
|
||||||
arg.clear();
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,8 +588,7 @@ int main(int argc, char *argv[])
|
|||||||
if (temp == -3) {
|
if (temp == -3) {
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
cerr << ">> msr2data: **ERROR** The given template has not a valid run number! Quitting..." << endl;
|
cerr << ">> msr2data: **ERROR** The given template has not a valid run number! Quitting..." << endl;
|
||||||
run_vec.clear();
|
msr2data_cleanup(msr2dataHandler, arg);
|
||||||
arg.clear();
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -579,24 +608,22 @@ int main(int argc, char *argv[])
|
|||||||
// At this point it should be clear if any template for input-file generation is given or not.
|
// At this point it should be clear if any template for input-file generation is given or not.
|
||||||
// Therefore, the number of digits in the run number format is determined only here.
|
// Therefore, the number of digits in the run number format is determined only here.
|
||||||
if(temp > 0) {
|
if(temp > 0) {
|
||||||
status = msr2dataHandler.DetermineRunNumberDigits(temp, setNormalMode);
|
status = msr2dataHandler->DetermineRunNumberDigits(temp, setNormalMode);
|
||||||
} else {
|
} else {
|
||||||
status = msr2dataHandler.DetermineRunNumberDigits(msr2dataHandler.GetPresentRun(), setNormalMode);
|
status = msr2dataHandler->DetermineRunNumberDigits(msr2dataHandler->GetPresentRun(), setNormalMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(status) {
|
if(status) {
|
||||||
run_vec.clear();
|
msr2data_cleanup(msr2dataHandler, arg);
|
||||||
arg.clear();
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if all given run numbers are covered by the formatting of the data file name
|
// Check if all given run numbers are covered by the formatting of the data file name
|
||||||
status = msr2dataHandler.CheckRunNumbersInRange();
|
status = msr2dataHandler->CheckRunNumbersInRange();
|
||||||
if(status) {
|
if(status) {
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
cerr << ">> msr2data: **ERROR** At least one given run number is out of range! Quitting..." << endl;
|
cerr << ">> msr2data: **ERROR** At least one given run number is out of range! Quitting..." << endl;
|
||||||
run_vec.clear();
|
msr2data_cleanup(msr2dataHandler, arg);
|
||||||
arg.clear();
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,6 +633,7 @@ int main(int argc, char *argv[])
|
|||||||
// 1 - write header explicitly (even if the file is present already)
|
// 1 - write header explicitly (even if the file is present already)
|
||||||
// 2 - write header automatically if a new file is created and do not if the data is appended to an existing file
|
// 2 - write header automatically if a new file is created and do not if the data is appended to an existing file
|
||||||
|
|
||||||
|
fstream *fileOutput = 0;
|
||||||
if (realOutput) {
|
if (realOutput) {
|
||||||
// check the arguments for the "header" and "noheader" options
|
// check the arguments for the "header" and "noheader" options
|
||||||
if (!msr2data_useOption(arg, "header")) {
|
if (!msr2data_useOption(arg, "header")) {
|
||||||
@ -623,16 +651,18 @@ 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")) {
|
||||||
fstream fileOutput;
|
fileOutput = new fstream;
|
||||||
fileOutput.open(outputFile.c_str(), ios::in);
|
fileOutput->open(outputFile.c_str(), ios::in);
|
||||||
if (fileOutput.is_open()) {
|
if (fileOutput->is_open()) {
|
||||||
cout << endl << ">> msr2data: **INFO** Deleting output file " << outputFile << endl;
|
cout << endl << ">> msr2data: **INFO** Deleting output file " << outputFile << endl;
|
||||||
fileOutput.close();
|
fileOutput->close();
|
||||||
fileOutput.open(outputFile.c_str(), ios::out | ios::trunc);
|
fileOutput->open(outputFile.c_str(), ios::out | ios::trunc);
|
||||||
fileOutput.close();
|
fileOutput->close();
|
||||||
} else {
|
} else {
|
||||||
cout << endl << ">> msr2data: **INFO** Ignoring the 'new' option since " << outputFile << " does not exist yet." << endl;
|
cout << endl << ">> msr2data: **INFO** Ignoring the 'new' option since " << outputFile << " does not exist yet." << endl;
|
||||||
}
|
}
|
||||||
|
delete fileOutput;
|
||||||
|
fileOutput = 0;
|
||||||
if (writeHeader == 2) {
|
if (writeHeader == 2) {
|
||||||
writeHeader = 1;
|
writeHeader = 1;
|
||||||
}
|
}
|
||||||
@ -642,16 +672,16 @@ int main(int argc, char *argv[])
|
|||||||
// GLOBAL MODE
|
// GLOBAL MODE
|
||||||
if (!setNormalMode) {
|
if (!setNormalMode) {
|
||||||
ostringstream strInfile;
|
ostringstream strInfile;
|
||||||
strInfile << msr2dataHandler.GetPresentRun() << "+global" << msrExtension << ".msr";
|
strInfile << msr2dataHandler->GetPresentRun() << "+global" << msrExtension << ".msr";
|
||||||
|
|
||||||
// if fitting should be done, prepare a new input file
|
// if fitting should be done, prepare a new input file
|
||||||
if (temp) {
|
if (temp) {
|
||||||
if (temp > 0) { // if it is smaller no input file should be generated
|
if (temp > 0) { // if it is smaller no input file should be generated
|
||||||
bool success(msr2dataHandler.PrepareGlobalInputFile(temp, strInfile.str(), globalMode));
|
bool success(msr2dataHandler->PrepareGlobalInputFile(temp, strInfile.str(), globalMode));
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
cerr << endl << ">> msr2data: **ERROR** Input file generation has not been successful! Quitting..." << endl;
|
cerr << endl << ">> msr2data: **ERROR** Input file generation has not been successful! Quitting..." << endl;
|
||||||
arg.clear();
|
msr2data_cleanup(msr2dataHandler, arg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -679,11 +709,11 @@ int main(int argc, char *argv[])
|
|||||||
if (realOutput) {
|
if (realOutput) {
|
||||||
// read musrfit startup file
|
// read musrfit startup file
|
||||||
if (writeSummary) {
|
if (writeSummary) {
|
||||||
status = msr2dataHandler.ParseXmlStartupFile();
|
status = msr2dataHandler->ParseXmlStartupFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read msr file
|
// Read msr file
|
||||||
status = msr2dataHandler.ReadMsrFile(strInfile.str());
|
status = msr2dataHandler->ReadMsrFile(strInfile.str());
|
||||||
if (status != PMUSR_SUCCESS) {
|
if (status != PMUSR_SUCCESS) {
|
||||||
arg.clear();
|
arg.clear();
|
||||||
return status;
|
return status;
|
||||||
@ -691,15 +721,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// read data files
|
// read data files
|
||||||
if (writeSummary)
|
if (writeSummary)
|
||||||
writeSummary = msr2dataHandler.ReadRunDataFile();
|
writeSummary = msr2dataHandler->ReadRunDataFile();
|
||||||
|
|
||||||
unsigned int counter(0);
|
unsigned int counter(0);
|
||||||
|
|
||||||
while (msr2dataHandler.GetPresentRun()) {
|
while (msr2dataHandler->GetPresentRun()) {
|
||||||
// write DB or dat file
|
// write DB or dat file
|
||||||
status = msr2dataHandler.WriteOutput(outputFile, db, writeHeader, !setNormalMode, counter);
|
status = msr2dataHandler->WriteOutput(outputFile, db, writeHeader, !setNormalMode, counter);
|
||||||
if (status != PMUSR_SUCCESS) {
|
if (status != PMUSR_SUCCESS) {
|
||||||
arg.clear();
|
msr2data_cleanup(msr2dataHandler, arg);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
++counter;
|
++counter;
|
||||||
@ -709,7 +739,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// read musrfit startup file
|
// read musrfit startup file
|
||||||
if (writeSummary) {
|
if (writeSummary) {
|
||||||
status = msr2dataHandler.ParseXmlStartupFile();
|
status = msr2dataHandler->ParseXmlStartupFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Processing the run list, do the fitting and write the data to the DB or data output file
|
// Processing the run list, do the fitting and write the data to the DB or data output file
|
||||||
@ -717,26 +747,26 @@ int main(int argc, char *argv[])
|
|||||||
unsigned int oldtemp(0); // should be accessed only when updated before...
|
unsigned int oldtemp(0); // should be accessed only when updated before...
|
||||||
ostringstream strInfile;
|
ostringstream strInfile;
|
||||||
|
|
||||||
while (msr2dataHandler.GetPresentRun()) {
|
while (msr2dataHandler->GetPresentRun()) {
|
||||||
strInfile.clear();
|
strInfile.clear();
|
||||||
strInfile.str("");
|
strInfile.str("");
|
||||||
strInfile << msr2dataHandler.GetPresentRun() << msrExtension << ".msr";
|
strInfile << msr2dataHandler->GetPresentRun() << msrExtension << ".msr";
|
||||||
|
|
||||||
// if fitting should be done, prepare a new input file
|
// if fitting should be done, prepare a new input file
|
||||||
if (temp) {
|
if (temp) {
|
||||||
if (temp > 0) {
|
if (temp > 0) {
|
||||||
bool success(true);
|
bool success(true);
|
||||||
if (firstrun || !chainfit)
|
if (firstrun || !chainfit)
|
||||||
success = msr2dataHandler.PrepareNewInputFile(temp, false);
|
success = msr2dataHandler->PrepareNewInputFile(temp, false);
|
||||||
else
|
else
|
||||||
success = msr2dataHandler.PrepareNewInputFile(oldtemp, false);
|
success = msr2dataHandler->PrepareNewInputFile(oldtemp, false);
|
||||||
if (firstrun)
|
if (firstrun)
|
||||||
firstrun = false;
|
firstrun = false;
|
||||||
oldtemp = msr2dataHandler.GetPresentRun();
|
oldtemp = msr2dataHandler->GetPresentRun();
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
cerr << endl << ">> msr2data: **ERROR** Input file generation has not been successful! Quitting..." << endl;
|
cerr << endl << ">> msr2data: **ERROR** Input file generation has not been successful! Quitting..." << endl;
|
||||||
arg.clear();
|
msr2data_cleanup(msr2dataHandler, arg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -763,12 +793,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// read msr-file
|
// read msr-file
|
||||||
if (realOutput) {
|
if (realOutput) {
|
||||||
status = msr2dataHandler.ReadMsrFile(strInfile.str());
|
status = msr2dataHandler->ReadMsrFile(strInfile.str());
|
||||||
if (status != PMUSR_SUCCESS) {
|
if (status != PMUSR_SUCCESS) {
|
||||||
// if the msr-file cannot be read, write no output but proceed to the next run
|
// if the msr-file cannot be read, write no output but proceed to the next run
|
||||||
status = msr2dataHandler.WriteOutput("none", db, writeHeader);
|
status = msr2dataHandler->WriteOutput("none", db, writeHeader);
|
||||||
if (status != PMUSR_SUCCESS) {
|
if (status != PMUSR_SUCCESS) {
|
||||||
arg.clear();
|
msr2data_cleanup(msr2dataHandler, arg);
|
||||||
return status;
|
return status;
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
@ -778,12 +808,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// read data files
|
// read data files
|
||||||
if (writeSummary)
|
if (writeSummary)
|
||||||
writeSummary = msr2dataHandler.ReadRunDataFile();
|
writeSummary = msr2dataHandler->ReadRunDataFile();
|
||||||
|
|
||||||
// write DB or dat file
|
// write DB or dat file
|
||||||
status = msr2dataHandler.WriteOutput(outputFile, db, writeHeader);
|
status = msr2dataHandler->WriteOutput(outputFile, db, writeHeader);
|
||||||
if (status != PMUSR_SUCCESS) {
|
if (status != PMUSR_SUCCESS) {
|
||||||
arg.clear();
|
msr2data_cleanup(msr2dataHandler, arg);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -795,13 +825,14 @@ 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) {
|
||||||
ifstream fileOutputCheck(outputFile.c_str());
|
fileOutput = new fstream;
|
||||||
if (fileOutputCheck.is_open()) {
|
fileOutput->open(outputFile.c_str(), ios::in);
|
||||||
fileOutputCheck.close();
|
if (fileOutput->is_open()) {
|
||||||
ofstream fileOutput(outputFile.c_str(), ios::app);
|
fileOutput->close();
|
||||||
if (fileOutput.is_open()) {
|
fileOutput->open(outputFile.c_str(), ios::out | ios::app);
|
||||||
fileOutput << endl << endl;
|
if (fileOutput->is_open()) {
|
||||||
fileOutput.close();
|
*fileOutput << endl << endl;
|
||||||
|
fileOutput->close();
|
||||||
} else {
|
} else {
|
||||||
cerr << endl << ">> msr2data: **ERROR** The output file " << outputFile << " cannot be opened! Please check!";
|
cerr << endl << ">> msr2data: **ERROR** The output file " << outputFile << " cannot be opened! Please check!";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
@ -810,17 +841,20 @@ int main(int argc, char *argv[])
|
|||||||
cerr << endl << ">> msr2data: **WARNING** No output has been written to the file " << outputFile << "!";
|
cerr << endl << ">> msr2data: **WARNING** No output has been written to the file " << outputFile << "!";
|
||||||
cerr << endl << ">> msr2data: **WARNING** Please check the range of runs and the specified options!" << endl;
|
cerr << endl << ">> msr2data: **WARNING** Please check the range of runs and the specified options!" << endl;
|
||||||
}
|
}
|
||||||
|
delete fileOutput;
|
||||||
|
fileOutput = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arg.empty()) {
|
if (!arg.empty()) {
|
||||||
cout << endl << ">> msr2data: **INFO** The following command line arguments have been specified but not been used: " << endl;
|
cout << endl << ">> msr2data: **INFO** The following command line arguments have been specified but not been used: " << endl;
|
||||||
cout << ">> msr2data: **INFO**";
|
cout << ">> msr2data: **INFO**";
|
||||||
for (unsigned int i(0); i<arg.size(); i++)
|
for (unsigned int i(0); i<arg.size(); ++i)
|
||||||
cout << " " << arg[i];
|
cout << " " << arg[i];
|
||||||
cout << endl;
|
cout << endl;
|
||||||
arg.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msr2data_cleanup(msr2dataHandler, arg);
|
||||||
|
|
||||||
cout << endl << ">> msr2data: done ..." << endl;
|
cout << endl << ">> msr2data: done ..." << endl;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Reference in New Issue
Block a user