added timeout facility for musrfit, musrview, musrt0. Adopted musredit/musrgui accordingly.
This commit is contained in:
parent
3a0715b3ed
commit
7368884482
@ -6,6 +6,9 @@
|
||||
|
||||
changes since 0.10.0
|
||||
===================================
|
||||
NEW 2012-04-15 added timeout facility for musrfit, musrview, musrt0. Adopted musredit/musrgui accordingly.
|
||||
This is at least a partial workaround until it can be pinned down why sometimes musrfit, etc.
|
||||
do not terminate properly.
|
||||
NEW 2012-03-28 added a validator program (musrRootValidation) for MusrRoot files.
|
||||
NEW 2012-03-22 added a first version of MusrRoot, the next muSR file format at PSI. At the same time a rewrite of
|
||||
the low run data handling has been done which enables a proper Red/Green handling with histogram sets addressable
|
||||
|
@ -115,6 +115,8 @@ ClassImpQ(PMusrCanvas)
|
||||
*/
|
||||
PMusrCanvas::PMusrCanvas()
|
||||
{
|
||||
fTimeout = 0;
|
||||
|
||||
fScaleN0AndBkg = true;
|
||||
fValid = false;
|
||||
fDifferenceView = false;
|
||||
@ -179,6 +181,8 @@ PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title,
|
||||
const Bool_t batch) :
|
||||
fBatchMode(batch), fPlotNumber(number)
|
||||
{
|
||||
fTimeout = 0;
|
||||
|
||||
fMultiGraphData = 0;
|
||||
fMultiGraphDiff = 0;
|
||||
|
||||
@ -229,6 +233,8 @@ PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title,
|
||||
fPlotNumber(number), fFourier(fourierDefault),
|
||||
fMarkerList(markerList), fColorList(colorList)
|
||||
{
|
||||
fTimeout = 0;
|
||||
|
||||
fMultiGraphData = 0;
|
||||
fMultiGraphDiff = 0;
|
||||
|
||||
@ -260,6 +266,10 @@ PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title,
|
||||
PMusrCanvas::~PMusrCanvas()
|
||||
{
|
||||
// cleanup
|
||||
if (fTimeoutTimer) {
|
||||
delete fTimeoutTimer;
|
||||
fTimeoutTimer = 0;
|
||||
}
|
||||
if (fCurrentFourierPhaseText) {
|
||||
delete fCurrentFourierPhaseText;
|
||||
fCurrentFourierPhaseText = 0;
|
||||
@ -412,6 +422,32 @@ void PMusrCanvas::SetMsrHandler(PMsrHandler *msrHandler)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetTimeout (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param timeout after which the done signal shall be emitted. Given in seconds
|
||||
*/
|
||||
void PMusrCanvas::SetTimeout(Int_t timeout)
|
||||
{
|
||||
fTimeout = timeout;
|
||||
|
||||
if (fTimeout <= 0)
|
||||
return;
|
||||
|
||||
if (fTimeoutTimer) {
|
||||
delete fTimeoutTimer;
|
||||
fTimeoutTimer = 0;
|
||||
}
|
||||
fTimeoutTimer = new TTimer();
|
||||
|
||||
fTimeoutTimer->Connect("Timeout()", "PMusrCanvas", this, "Done()");
|
||||
|
||||
fTimeoutTimer->Start(1000*fTimeout, kTRUE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// UpdateParamTheoryPad (public)
|
||||
//--------------------------------------------------------------------------
|
||||
|
@ -247,6 +247,8 @@ ClassImpQ(PMusrT0)
|
||||
*/
|
||||
PMusrT0::PMusrT0()
|
||||
{
|
||||
fTimeout = 0;
|
||||
|
||||
fValid = false;
|
||||
|
||||
fStatus = 0; // default is quit locally
|
||||
@ -286,6 +288,8 @@ PMusrT0::PMusrT0()
|
||||
*/
|
||||
PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
|
||||
{
|
||||
fTimeout = 0;
|
||||
|
||||
fValid = true;
|
||||
|
||||
fStatus = 0; // default is quit locally
|
||||
@ -568,6 +572,10 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
|
||||
*/
|
||||
PMusrT0::~PMusrT0()
|
||||
{
|
||||
if (fTimeoutTimer) {
|
||||
delete fTimeoutTimer;
|
||||
fTimeoutTimer = 0;
|
||||
}
|
||||
if (fHisto) {
|
||||
delete fHisto;
|
||||
fHisto = 0;
|
||||
@ -702,6 +710,32 @@ void PMusrT0::Quit()
|
||||
Done(0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetTimeout (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param timeout after which the done signal shall be emitted. Given in seconds
|
||||
*/
|
||||
void PMusrT0::SetTimeout(Int_t timeout)
|
||||
{
|
||||
fTimeout = timeout;
|
||||
|
||||
if (fTimeout <= 0)
|
||||
return;
|
||||
|
||||
if (fTimeoutTimer) {
|
||||
delete fTimeoutTimer;
|
||||
fTimeoutTimer = 0;
|
||||
}
|
||||
fTimeoutTimer = new TTimer();
|
||||
|
||||
fTimeoutTimer->Connect("Timeout()", "PMusrT0", this, "Quit()");
|
||||
|
||||
fTimeoutTimer->Start(1000*fTimeout, kTRUE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetMsrHandler
|
||||
//--------------------------------------------------------------------------
|
||||
|
@ -219,6 +219,7 @@ class PMusrCanvas : public TObject, public TQObject
|
||||
virtual void SetRunListCollection(PRunListCollection *runList) { fRunList = runList; }
|
||||
#endif // __MAKECINT__
|
||||
|
||||
virtual void SetTimeout(Int_t ival);
|
||||
virtual void UpdateParamTheoryPad();
|
||||
virtual void UpdateDataTheoryPad();
|
||||
virtual void UpdateInfoPad();
|
||||
@ -231,6 +232,7 @@ class PMusrCanvas : public TObject, public TQObject
|
||||
virtual void SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat);
|
||||
|
||||
private:
|
||||
Int_t fTimeout; ///< timeout after which the Done signal should be emited. If timeout <= 0, no timeout is taking place
|
||||
Bool_t fScaleN0AndBkg; ///< true=N0 and background is scaled to (1/ns), otherwise (1/bin) for the single histogram case
|
||||
Bool_t fBatchMode; ///< musrview in ROOT batch mode
|
||||
Bool_t fValid; ///< if true, everything looks OK
|
||||
@ -250,6 +252,8 @@ class PMusrCanvas : public TObject, public TQObject
|
||||
|
||||
TStyle *fStyle; ///< A collection of all graphics attributes
|
||||
|
||||
TTimer *fTimeoutTimer; ///< timeout timer in order to terminate if no action is taking place for too long
|
||||
|
||||
// canvas menu related variables
|
||||
TRootCanvas *fImp; ///< ROOT native GUI version of main window with menubar and drawing area
|
||||
TGMenuBar *fBar; ///< menu bar
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <TH1.h>
|
||||
#include <TLine.h>
|
||||
#include <TLatex.h>
|
||||
#include <TTimer.h>
|
||||
|
||||
#include "PMusr.h"
|
||||
#ifndef __MAKECINT__
|
||||
@ -130,6 +131,7 @@ class PMusrT0 : public TObject, public TQObject
|
||||
virtual void Done(Int_t status=0); // *SIGNAL*
|
||||
virtual void HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected); // SLOT
|
||||
virtual void Quit(); // SLOT
|
||||
virtual void SetTimeout(Int_t timeout);
|
||||
|
||||
#ifndef __MAKECINT__
|
||||
virtual void SetMsrHandler(PMsrHandler *msrHandler);
|
||||
@ -143,6 +145,7 @@ class PMusrT0 : public TObject, public TQObject
|
||||
#ifndef __MAKECINT__
|
||||
PMsrHandler *fMsrHandler; ///< msr-file handler
|
||||
#endif // __MAKECINT__
|
||||
Int_t fTimeout; ///< timeout after which the Done signal should be emited. If timeout <= 0, no timeout is taking place
|
||||
|
||||
Bool_t fValid; ///< true if raw data set are available, otherwise false
|
||||
|
||||
@ -155,6 +158,8 @@ class PMusrT0 : public TObject, public TQObject
|
||||
Int_t fT0Estimated; ///< estimated t0 value (in bins)
|
||||
Bool_t fShowT0DataChannel;
|
||||
|
||||
TTimer *fTimeoutTimer; ///< timeout timer in order to terminate if no action is taking place for too long
|
||||
|
||||
// canvas related variables
|
||||
TCanvas *fMainCanvas; ///< main canvas for the graphical user interface
|
||||
|
||||
|
@ -69,7 +69,9 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
|
||||
const QString& qName,
|
||||
const QXmlAttributes& )
|
||||
{
|
||||
if (qName == "font_name") {
|
||||
if (qName == "timeout") {
|
||||
fKeyWord = eTimeout;
|
||||
} else if (qName == "font_name") {
|
||||
fKeyWord = eFontName;
|
||||
} else if (qName == "font_size") {
|
||||
fKeyWord = eFontSize;
|
||||
@ -196,6 +198,11 @@ bool PAdminXMLParser::characters(const QString& str)
|
||||
int ival;
|
||||
|
||||
switch (fKeyWord) {
|
||||
case eTimeout:
|
||||
ival = QString(str.toLatin1()).trimmed().toInt(&ok);
|
||||
if (ok)
|
||||
fAdmin->setTimeout(ival);
|
||||
break;
|
||||
case eFontName:
|
||||
fAdmin->setFontName(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
@ -529,6 +536,8 @@ QString PAdminXMLParser::expandPath(const QString &str)
|
||||
*/
|
||||
PAdmin::PAdmin()
|
||||
{
|
||||
fTimeout = 3600;
|
||||
|
||||
fFontName = QString("Courier"); // default font
|
||||
fFontSize = 11; // default font size
|
||||
|
||||
|
@ -70,7 +70,7 @@ class PAdminXMLParser : public QXmlDefaultHandler
|
||||
virtual ~PAdminXMLParser() {}
|
||||
|
||||
private:
|
||||
enum EAdminKeyWords {eEmpty, eFontName, eFontSize, eExecPath, eDefaultSavePath, eTitleFromDataFile, eEnableMusrT0,
|
||||
enum EAdminKeyWords {eEmpty, eTimeout, eFontName, eFontSize, eExecPath, eDefaultSavePath, eTitleFromDataFile, eEnableMusrT0,
|
||||
eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath,
|
||||
eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
|
||||
eFuncPixmap, eFuncParams, eHelpMain, eHelpTitle, eHelpParameters, eHelpTheory, eHelpFunctions,
|
||||
@ -112,6 +112,7 @@ class PAdmin
|
||||
PAdmin();
|
||||
virtual ~PAdmin() {}
|
||||
|
||||
int getTimeout() { return fTimeout; }
|
||||
QString getFontName() { return fFontName; }
|
||||
int getFontSize() { return fFontSize; }
|
||||
QString getExecPath() { return fExecPath; }
|
||||
@ -133,6 +134,7 @@ class PAdmin
|
||||
void setFontSize(const int ival) { fFontSize = ival; }
|
||||
|
||||
protected:
|
||||
void setTimeout(const int ival) { fTimeout = ival; }
|
||||
void setExecPath(const QString str) { fExecPath = str; }
|
||||
void setDefaultSavePath(const QString str) { fDefaultSavePath = str; }
|
||||
void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; }
|
||||
@ -149,6 +151,8 @@ class PAdmin
|
||||
private:
|
||||
friend class PAdminXMLParser;
|
||||
|
||||
int fTimeout; ///< timeout in seconds
|
||||
|
||||
QString fFontName; ///< default font name
|
||||
int fFontSize; ///< default font size
|
||||
|
||||
|
@ -667,7 +667,7 @@ bool PTextEdit::validRunList(const QString runList)
|
||||
int i = 0;
|
||||
QString subStr;
|
||||
bool done = false;
|
||||
int val;
|
||||
int val = 0;
|
||||
bool ok;
|
||||
while (!done) {
|
||||
subStr = runList.section(' ', i, i, QString::SectionSkipEmpty);
|
||||
@ -1655,6 +1655,12 @@ void PTextEdit::musrFit()
|
||||
break;
|
||||
}
|
||||
|
||||
// add timeout
|
||||
cmd.append("--timeout");
|
||||
QString numStr;
|
||||
numStr.setNum(fAdmin->getTimeout());
|
||||
cmd.append(numStr);
|
||||
|
||||
PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd);
|
||||
fitOutputHandler.setModal(true);
|
||||
fFileSystemWatcherActive = false;
|
||||
@ -2058,9 +2064,11 @@ void PTextEdit::musrView()
|
||||
cmd = str + " \"";
|
||||
|
||||
str = *fFilenames.find( currentEditor() );
|
||||
cmd += str + "\" &";
|
||||
QString numStr;
|
||||
numStr.setNum(fAdmin->getTimeout());
|
||||
cmd += str + "\" --timeout " + numStr + " &";
|
||||
|
||||
system(cmd.toLatin1());
|
||||
int status=system(cmd.toLatin1());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -2089,9 +2097,11 @@ void PTextEdit::musrT0()
|
||||
cmd = str + " \"";
|
||||
|
||||
str = *fFilenames.find( currentEditor() );
|
||||
cmd += str + "\" &";
|
||||
QString numStr;
|
||||
numStr.setNum(fAdmin->getTimeout());
|
||||
cmd += str + "\" --timeout " + numStr + " &";
|
||||
|
||||
system(cmd.toLatin1());
|
||||
int status=system(cmd.toLatin1());
|
||||
|
||||
QString fln = *fFilenames.find( currentEditor() );
|
||||
}
|
||||
@ -2166,13 +2176,13 @@ void PTextEdit::musrSwapMsrMlog()
|
||||
// swap files
|
||||
QString cmd;
|
||||
cmd = QString("cp \"") + currentFileName + QString("\" \"") + tempFileName + QString("\"");
|
||||
system(cmd.toLatin1());
|
||||
int status=system(cmd.toLatin1());
|
||||
cmd = QString("cp \"") + swapFileName + QString("\" \"") + currentFileName + QString("\"");
|
||||
system(cmd.toLatin1());
|
||||
status=system(cmd.toLatin1());
|
||||
cmd = QString("cp \"") + tempFileName + QString("\" \"") + swapFileName + QString("\"");
|
||||
system(cmd.toLatin1());
|
||||
status=system(cmd.toLatin1());
|
||||
cmd = QString("rm \"") + tempFileName + QString("\"");
|
||||
system(cmd.toLatin1());
|
||||
status=system(cmd.toLatin1());
|
||||
|
||||
int currentIdx = fTabWidget->currentIndex();
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
<font_name>Courier</font_name>
|
||||
<font_size>12</font_size>
|
||||
</font_settings>
|
||||
<timeout>3600</timeout>
|
||||
<msr_file_defaults>
|
||||
<beamline>mue4</beamline>
|
||||
<institute>psi</institute>
|
||||
|
@ -29,9 +29,12 @@
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
//#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
@ -44,6 +47,7 @@ using namespace std;
|
||||
#include <TH1.h>
|
||||
#include <TSystem.h>
|
||||
#include <TSystemFile.h>
|
||||
#include <TThread.h>
|
||||
|
||||
#include "PMusr.h"
|
||||
#include "PStartupHandler.h"
|
||||
@ -52,6 +56,28 @@ using namespace std;
|
||||
#include "PRunListCollection.h"
|
||||
#include "PFitter.h"
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
static int timeout = 3600; // given in (sec)
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Sometimes musrfit is not terminating properly for reasons still not pinned down, hence
|
||||
* this workaround. It should be removed asap. Especially since it is leading to memory leaks.
|
||||
*/
|
||||
void* musrfit_timeout(void *args)
|
||||
{
|
||||
pid_t *pid = (pid_t*)(args);
|
||||
|
||||
sleep(timeout);
|
||||
|
||||
cerr << endl << ">> **FATAL ERROR** musrfit_timeout for task pid=" << *pid << " called! Will kill it!" << endl << endl;
|
||||
|
||||
kill(*pid, SIGKILL);
|
||||
|
||||
return (void*)0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Sends the usage description to the standard output.
|
||||
@ -59,7 +85,7 @@ using namespace std;
|
||||
void musrfit_syntax()
|
||||
{
|
||||
cout << endl << "usage: musrfit [<msr-file> [-k, --keep-mn2-ouput] [-c, --chisq-only] [-t, --title-from-data-file]";
|
||||
cout << endl << " [--dump <type>] | --version | --help";
|
||||
cout << endl << " [--dump <type>] [--timeout <timeout_tag>] | --version | --help";
|
||||
cout << endl << " <msr-file>: msr input file";
|
||||
cout << endl << " 'musrfit <msr-file>' will execute musrfit";
|
||||
cout << endl << " 'musrfit' or 'musrfit --help' will show this help";
|
||||
@ -75,7 +101,11 @@ void musrfit_syntax()
|
||||
cout << endl << " run title of the FIRST run of the <msr-file> run block, if a run title";
|
||||
cout << endl << " is present in the data file.";
|
||||
cout << endl << " --dump <type> is writing a data file with the fit data and the theory";
|
||||
cout << endl << " <type> can be 'ascii', 'root'" << endl;
|
||||
cout << endl << " <type> can be 'ascii', 'root'";
|
||||
cout << endl << " --timeout <timeout_tag>: overwrites to predefined timeout of " << timeout << " (sec).";
|
||||
cout << endl << " <timeout_tag> = 'none' means timeout facility is not enabled. <timeout_tag> = nn";
|
||||
cout << endl << " will set the timeout to nn (sec).";
|
||||
cout << endl;
|
||||
cout << endl << " At the end of a fit, musrfit writes the fit results into an <mlog-file> and";
|
||||
cout << endl << " swaps them, i.e. in the <msr-file> you will find the fit results and in the";
|
||||
cout << endl << " <mlog-file> your initial guess values.";
|
||||
@ -352,6 +382,7 @@ int main(int argc, char *argv[])
|
||||
bool keep_mn2_output = false;
|
||||
bool chisq_only = false;
|
||||
bool title_from_data_file = false;
|
||||
bool timeout_enabled = true;
|
||||
|
||||
TString dump("");
|
||||
char filename[1024];
|
||||
@ -397,6 +428,24 @@ int main(int argc, char *argv[])
|
||||
show_syntax = true;
|
||||
break;
|
||||
}
|
||||
} else if (!strcmp(argv[i], "--timeout")) {
|
||||
if (i<argc-1) {
|
||||
if (!strcmp(argv[i+1], "none")) {
|
||||
timeout_enabled = false;
|
||||
} else {
|
||||
TString str(argv[i+1]);
|
||||
if (str.IsDigit()) {
|
||||
timeout = str.Atoi();
|
||||
} else {
|
||||
show_syntax = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
show_syntax = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
show_syntax = true;
|
||||
break;
|
||||
@ -515,6 +564,16 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// start timeout thread
|
||||
TThread *th = 0;
|
||||
if (timeout_enabled) {
|
||||
pid_t musrfit_pid = getpid();
|
||||
th = new TThread(musrfit_timeout, (void*)&musrfit_pid);
|
||||
if (th) {
|
||||
th->Run();
|
||||
}
|
||||
}
|
||||
|
||||
// do fitting
|
||||
PFitter *fitter = 0;
|
||||
if (success) {
|
||||
@ -597,6 +656,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// clean up
|
||||
if (th) {
|
||||
th->Delete();
|
||||
}
|
||||
if (saxParser) {
|
||||
delete saxParser;
|
||||
saxParser = 0;
|
||||
|
@ -69,7 +69,9 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
|
||||
const QString& qName,
|
||||
const QXmlAttributes& )
|
||||
{
|
||||
if (qName == "font_name") {
|
||||
if (qName == "timeout") {
|
||||
fKeyWord = eTimeout;
|
||||
} else if (qName == "font_name") {
|
||||
fKeyWord = eFontName;
|
||||
} else if (qName == "font_size") {
|
||||
fKeyWord = eFontSize;
|
||||
@ -171,6 +173,11 @@ bool PAdminXMLParser::characters(const QString& str)
|
||||
int ival;
|
||||
|
||||
switch (fKeyWord) {
|
||||
case eTimeout:
|
||||
ival = QString(str.ascii()).stripWhiteSpace().toInt(&ok);
|
||||
if (ok)
|
||||
fAdmin->setTimeout(ival);
|
||||
break;
|
||||
case eFontName:
|
||||
fAdmin->setFontName(QString(str.ascii()).stripWhiteSpace());
|
||||
break;
|
||||
|
@ -59,7 +59,7 @@ class PAdminXMLParser : public QXmlDefaultHandler
|
||||
virtual ~PAdminXMLParser() {}
|
||||
|
||||
private:
|
||||
enum EAdminKeyWords {eEmpty, eFontName, eFontSize, eExecPath, eDefaultSavePath, eTitleFromDataFile, eEnableMusrT0,
|
||||
enum EAdminKeyWords {eEmpty, eTimeout, eFontName, eFontSize, eExecPath, eDefaultSavePath, eTitleFromDataFile, eEnableMusrT0,
|
||||
eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath,
|
||||
eHelpMain, eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
|
||||
eFuncPixmap, eFuncParams,
|
||||
@ -93,6 +93,8 @@ class PAdmin
|
||||
PAdmin();
|
||||
virtual ~PAdmin() {}
|
||||
|
||||
int getTimeout() { return fTimeout; }
|
||||
|
||||
QString getFontName() { return fFontName; }
|
||||
int getFontSize() { return fFontSize; }
|
||||
QString getExecPath() { return fExecPath; }
|
||||
@ -114,6 +116,7 @@ class PAdmin
|
||||
void setFontSize(const int ival) { fFontSize = ival; }
|
||||
|
||||
protected:
|
||||
void setTimeout(const int ival) { fTimeout = ival; }
|
||||
void setExecPath(const QString str) { fExecPath = str; }
|
||||
void setDefaultSavePath(const QString str) { fDefaultSavePath = str; }
|
||||
void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; }
|
||||
@ -130,6 +133,8 @@ class PAdmin
|
||||
private:
|
||||
friend class PAdminXMLParser;
|
||||
|
||||
int fTimeout; ///< timeout in seconds
|
||||
|
||||
QString fFontName;
|
||||
int fFontSize;
|
||||
|
||||
|
@ -1390,6 +1390,12 @@ void PTextEdit::musrFit()
|
||||
break;
|
||||
}
|
||||
|
||||
// add timeout
|
||||
cmd.append("--timeout");
|
||||
QString numStr;
|
||||
numStr.setNum(fAdmin->getTimeout());
|
||||
cmd.append(numStr);
|
||||
|
||||
PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).dirPath(), cmd);
|
||||
fitOutputHandler.setModal(true);
|
||||
fitOutputHandler.exec();
|
||||
@ -1775,7 +1781,9 @@ void PTextEdit::musrView()
|
||||
cmd = str + " \"";
|
||||
|
||||
str = *fFilenames.find( currentEditor() );
|
||||
cmd += str + "\" &";
|
||||
QString numStr;
|
||||
numStr.setNum(fAdmin->getTimeout());
|
||||
cmd += str + "\" --timeout " + numStr + "&";
|
||||
|
||||
system(cmd.latin1());
|
||||
}
|
||||
@ -1806,7 +1814,9 @@ void PTextEdit::musrT0()
|
||||
cmd = str + " \"";
|
||||
|
||||
str = *fFilenames.find( currentEditor() );
|
||||
cmd += str + "\" &";
|
||||
QString numStr;
|
||||
numStr.setNum(fAdmin->getTimeout());
|
||||
cmd += str + "\" --timeout " + numStr + " &";
|
||||
|
||||
system(cmd.latin1());
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
<font_name>Courier</font_name>
|
||||
<font_size>12</font_size>
|
||||
</font_settings>
|
||||
<timeout>3600</timeout>
|
||||
<msr_file_defaults>
|
||||
<beamline>mue4</beamline>
|
||||
<institute>psi</institute>
|
||||
|
133
src/musrt0.cpp
133
src/musrt0.cpp
@ -53,13 +53,20 @@ using namespace std;
|
||||
*/
|
||||
void musrt0_syntax()
|
||||
{
|
||||
cout << endl << "usage: musrt0 <msr-file> [{--getT0FromPromptPeak | -g} [<firstGoodBinOffset>]] | --version | --help";
|
||||
cout << endl << "usage: musrt0 <msr-file> [{--getT0FromPromptPeak | -g} [<firstGoodBinOffset>]]";
|
||||
cout << endl << " [--timeout <timeout>] | --version | --help";
|
||||
cout << endl << " <msr-file>: msr input file";
|
||||
cout << endl << " --getT0FromPromptPeak, -g with <firstGoodBinOffset>:";
|
||||
cout << endl << " will, in non-interactive mode estimate the t0's from the prompt peak and write it into the msr-file.";
|
||||
cout << endl << " will, in non-interactive mode estimate the t0's from the prompt peak";
|
||||
cout << endl << " and write it into the msr-file.";
|
||||
cout << endl << " if <firstGoodBinOffset> is given, to first good bin will be t0+<firstGoodBinOffset>.";
|
||||
cout << endl << " if no <firstGoodBinOffset> is given, only t0 will be set.";
|
||||
cout << endl << " --timeout <timeout>: <timeout> given in seconds after which musrview terminates.";
|
||||
cout << endl << " If <timeout> <= 0, no timeout will take place. Default <timeout> is 0.";
|
||||
cout << endl;
|
||||
cout << endl << " 'musrt0 <msr-file>' will execute musrt0";
|
||||
cout << endl << " 'musrt0 <msr-file> --timeout 180' will execute musrt0, but terminate it after";
|
||||
cout << endl << " 180 sec if not already done so.";
|
||||
cout << endl << " 'musrt0' or 'musrt0 --help' will show this help";
|
||||
cout << endl << " 'musrt0 --version' will print the musrt0 version";
|
||||
cout << endl << endl;
|
||||
@ -79,7 +86,7 @@ void musrt0_syntax()
|
||||
* \param data musrT0 data set handler
|
||||
* \param idx index to filter out the proper msr-file run
|
||||
*/
|
||||
Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data, UInt_t idx)
|
||||
Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data, UInt_t idx, Int_t timeout)
|
||||
{
|
||||
PMusrT0 *musrT0 = new PMusrT0(data);
|
||||
|
||||
@ -98,6 +105,9 @@ Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data
|
||||
return false;
|
||||
}
|
||||
|
||||
// set timeout
|
||||
musrT0->SetTimeout(timeout);
|
||||
|
||||
// set the msr-file handler. The handler cannot be transfered at construction time since rootcint is not able to handle the PMsrHandler class
|
||||
musrT0->SetMsrHandler(msrHandler);
|
||||
|
||||
@ -207,65 +217,64 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
Bool_t getT0FromPromptPeak = false;
|
||||
Bool_t firstGoodBinOffsetPresent = false;
|
||||
Int_t firstGoodBinOffset = 0;
|
||||
Int_t timeout = 0;
|
||||
|
||||
switch (argc) {
|
||||
case 1:
|
||||
show_syntax = true;
|
||||
break;
|
||||
case 2:
|
||||
if (strstr(argv[1], "--version")) {
|
||||
if (argc == 1) {
|
||||
musrt0_syntax();
|
||||
return PMUSR_SUCCESS;
|
||||
}
|
||||
|
||||
memset(filename, '\0', sizeof(filename));
|
||||
for (int i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "--version")) {
|
||||
cout << endl << ">> musrt0 version: " << PMUSR_VERSION << " / $Id$";
|
||||
cout << endl << endl;
|
||||
return PMUSR_SUCCESS;
|
||||
} else if (strstr(argv[1], "--help")) {
|
||||
} else if (!strcmp(argv[i], "--help")) {
|
||||
show_syntax = true;
|
||||
} else {
|
||||
// check if filename has extension msr or mlog
|
||||
if (!strstr(argv[1], ".msr")) {
|
||||
cerr << endl << ">> musrt0 **ERROR** " << argv[1] << " is not a msr-file!" << endl;
|
||||
show_syntax = true;
|
||||
} else {
|
||||
strncpy(filename, argv[1], sizeof(filename));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
// check if filename has extension msr or mlog
|
||||
if (!strstr(argv[1], ".msr")) {
|
||||
cerr << endl << ">> musrt0 **ERROR** " << argv[1] << " is not a msr-file!" << endl;
|
||||
show_syntax = true;
|
||||
} else if (strstr(argv[i], ".msr")) { // check for filename
|
||||
if (strlen(filename) == 0) {
|
||||
strcpy(filename, argv[i]);
|
||||
} else {
|
||||
strncpy(filename, argv[1], sizeof(filename));
|
||||
if (!strcmp(argv[2], "-g") || !strcmp(argv[2], "--getT0FromPromptPeak")) {
|
||||
getT0FromPromptPeak = true;
|
||||
}
|
||||
}
|
||||
cout << endl << "**ERROR** only one file name allowed." << endl;
|
||||
show_syntax = true;
|
||||
break;
|
||||
case 4:
|
||||
// check if filename has extension msr or mlog
|
||||
if (!strstr(argv[1], ".msr")) {
|
||||
cerr << endl << ">> musrt0 **ERROR** " << argv[1] << " is not a msr-file!" << endl;
|
||||
show_syntax = true;
|
||||
} else {
|
||||
strncpy(filename, argv[1], sizeof(filename));
|
||||
if (!strcmp(argv[2], "-g") || !strcmp(argv[2], "--getT0FromPromptPeak")) {
|
||||
}
|
||||
} else if (!strcmp(argv[i], "--getT0FromPromptPeak") || !strcmp(argv[i], "-g")) { // T0 from prompt peak option
|
||||
getT0FromPromptPeak = true;
|
||||
Int_t dval = 0;
|
||||
status = sscanf(argv[3], "%d", &dval);
|
||||
if (status == 1) { // it is a number
|
||||
if (i+1 < argc) {
|
||||
TString offset(argv[i+1]);
|
||||
if (offset.IsFloat()) {
|
||||
firstGoodBinOffsetPresent = true;
|
||||
firstGoodBinOffset = dval;
|
||||
} else { // it is not a number
|
||||
cerr << endl << ">> musrt0 **ERROR** first good bin offset option found: '" << argv[3] << "', this is not a number." << endl;
|
||||
firstGoodBinOffset = offset.Atof();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(argv[i], "--timeout")) {
|
||||
if (i+1 < argc) {
|
||||
TString numStr(argv[i+1]);
|
||||
if (numStr.IsDigit()) {
|
||||
timeout = numStr.Atoi();
|
||||
} else {
|
||||
cout << endl << "**ERROR** timeout '" << argv[i+1] << "' is not a number" << endl;
|
||||
show_syntax = true;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
cout << endl << "**ERROR** no timeout given." << endl;
|
||||
show_syntax = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
cerr << endl << ">> musrt0 **ERROR** found 4 input arguments, but missing the 'get prompt T0 from peak' option." << endl;
|
||||
show_syntax = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(filename) == 0) {
|
||||
cout << endl << "**ERROR** msr-file missing!" << endl;
|
||||
show_syntax = true;
|
||||
}
|
||||
|
||||
@ -660,7 +669,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||
musrT0Data.SetCmdTag(PMUSRT0_GET_T0_DATA_AND_BKG_RANGE);
|
||||
// execute cmd
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -687,7 +696,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
}
|
||||
// feed necessary data
|
||||
musrT0Data.SetAddRunIdx(j); // addruns
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, j)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, j, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -714,7 +723,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
}
|
||||
// feed necessary data
|
||||
musrT0Data.SetHistoNoIdx(j);
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -743,7 +752,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
}
|
||||
// feed necessary data
|
||||
musrT0Data.SetHistoNoIdx(k);
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, j)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, j, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -759,7 +768,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
musrT0Data.SetAddT0Bin((UInt_t)runList->at(i).GetAddT0Bin(k, j), k, j);
|
||||
}
|
||||
}
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -786,7 +795,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||
musrT0Data.SetCmdTag(PMUSRT0_GET_T0_DATA_AND_BKG_RANGE);
|
||||
// execute cmd
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -809,7 +818,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
musrT0Data.SetDetectorTag(PMUSRT0_BACKWARD);
|
||||
musrT0Data.SetCmdTag(PMUSRT0_GET_T0_DATA_AND_BKG_RANGE);
|
||||
// execute cmd
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -837,7 +846,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
}
|
||||
// feed necessary data
|
||||
musrT0Data.SetAddRunIdx(j); // addruns
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, j)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, j, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -863,7 +872,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
}
|
||||
// feed necessary data
|
||||
musrT0Data.SetAddRunIdx(j); // addruns
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, j)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, j, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -890,7 +899,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
}
|
||||
// feed necessary data
|
||||
musrT0Data.SetHistoNoIdx(j);
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -916,7 +925,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
}
|
||||
// feed necessary data
|
||||
musrT0Data.SetHistoNoIdx(j);
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -945,7 +954,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
}
|
||||
// feed necessary data
|
||||
musrT0Data.SetHistoNoIdx(k);
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, j)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, j, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -974,7 +983,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
}
|
||||
// feed necessary data
|
||||
musrT0Data.SetHistoNoIdx(k);
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, j)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, j, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
@ -992,13 +1001,13 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
}
|
||||
musrT0Data.SetHistoNo(forwardHistos);
|
||||
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
musrT0Data.SetHistoNo(backwardHistos);
|
||||
musrT0Data.SetDetectorTag(PMUSRT0_BACKWARD);
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||
if (!musrt0_item(app, msrHandler, musrT0Data, 0, timeout)) {
|
||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||
exit(0);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -54,7 +54,7 @@ using namespace std;
|
||||
*/
|
||||
void musrview_syntax()
|
||||
{
|
||||
cout << endl << "usage: musrview <msr-file> [--<graphic-format-extension>] | --version | --help";
|
||||
cout << endl << "usage: musrview <msr-file> [--<graphic-format-extension>] [--timeout <timeout>] | --version | --help";
|
||||
cout << endl << " <msr-file>: msr/mlog input file";
|
||||
cout << endl << " 'musrview <msr-file>' will execute musrview";
|
||||
cout << endl << " --<graphic-format-extension>: ";
|
||||
@ -64,6 +64,9 @@ void musrview_syntax()
|
||||
cout << endl << " eps, pdf, gif, jpg, png, svg, xpm, root";
|
||||
cout << endl << " example: musrview 3310.msr --png, will produce a files 3310_X.png";
|
||||
cout << endl << " where 'X' stands for the plot number (starting form 0)";
|
||||
cout << endl << " --timeout <timeout>: <timeout> given in seconds after which musrview terminates.";
|
||||
cout << endl << " If <timeout> <= 0, no timeout will take place. Default <timeout> is 0.";
|
||||
cout << endl;
|
||||
cout << endl << " 'musrview' or 'musrview --help' will show this help";
|
||||
cout << endl << " 'musrview --version' will print the musrview version";
|
||||
cout << endl << endl;
|
||||
@ -95,61 +98,55 @@ int main(int argc, char *argv[])
|
||||
char fileName[128];
|
||||
bool graphicsOutput = false;
|
||||
char graphicsExtension[128];
|
||||
int timeout = 0;
|
||||
|
||||
memset(fileName, '\0', sizeof(fileName));
|
||||
|
||||
// check input arguments
|
||||
switch (argc) {
|
||||
case 1:
|
||||
if (argc == 1) {
|
||||
musrview_syntax();
|
||||
return PMUSR_SUCCESS;
|
||||
}
|
||||
for (int i=1; i<argc; i++) {
|
||||
if (strstr(argv[i], ".msr") || strstr(argv[i], ".mlog")) {
|
||||
if (strlen(fileName) == 0) {
|
||||
strcpy(fileName, argv[i]);
|
||||
} else {
|
||||
cerr << endl << "**ERROR** only one file name allowed." << endl;
|
||||
show_syntax = true;
|
||||
break;
|
||||
case 2:
|
||||
if (strstr(argv[1], "--version")) {
|
||||
}
|
||||
} else if (!strcmp(argv[i], "--version")) {
|
||||
cout << endl << "musrview version: " << PMUSR_VERSION << " / $Id$";
|
||||
cout << endl << endl;
|
||||
return PMUSR_SUCCESS;
|
||||
} else if (strstr(argv[1], "--help")) {
|
||||
} else if (!strcmp(argv[i], "--help")) {
|
||||
show_syntax = true;
|
||||
} else {
|
||||
// check if filename has extension msr or mlog
|
||||
if (!strstr(argv[1], ".msr") && !strstr(argv[1], ".mlog")) {
|
||||
cerr << endl << ">> musrview **ERROR** " << argv[1] << " is not a msr/mlog-file, nor is it a supported graphics extension." << endl;
|
||||
show_syntax = true;
|
||||
} else {
|
||||
strcpy(fileName, argv[1]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (!strcmp(argv[1], "--eps") || !strcmp(argv[1], "--pdf") || !strcmp(argv[1], "--gif") ||
|
||||
!strcmp(argv[1], "--jpg") || !strcmp(argv[1], "--png") || !strcmp(argv[1], "--svg") ||
|
||||
!strcmp(argv[1], "--xpm") || !strcmp(argv[1], "--root")) {
|
||||
} else if (!strcmp(argv[i], "--eps") || !strcmp(argv[i], "--pdf") || !strcmp(argv[i], "--gif") ||
|
||||
!strcmp(argv[i], "--jpg") || !strcmp(argv[i], "--png") || !strcmp(argv[i], "--svg") ||
|
||||
!strcmp(argv[i], "--xpm") || !strcmp(argv[i], "--root")) {
|
||||
|
||||
graphicsOutput = true;
|
||||
strcpy(graphicsExtension, argv[1]+2);
|
||||
// check if filename has extension msr or mlog
|
||||
if (!strstr(argv[2], ".msr") && !strstr(argv[2], ".mlog")) {
|
||||
cerr << endl << ">> musrview **ERROR** " << argv[2] << " is not a msr/mlog-file, nor is it a supported graphics extension." << endl;
|
||||
show_syntax = true;
|
||||
} else {
|
||||
strcpy(fileName, argv[2]);
|
||||
}
|
||||
} else if (!strcmp(argv[2], "--eps") || !strcmp(argv[2], "--pdf") || !strcmp(argv[2], "--gif") ||
|
||||
!strcmp(argv[2], "--jpg") || !strcmp(argv[2], "--png") || !strcmp(argv[2], "--svg") ||
|
||||
!strcmp(argv[2], "--xpm") || !strcmp(argv[2], "--root")) {
|
||||
graphicsOutput = true;
|
||||
strcpy(graphicsExtension, argv[2]+2);
|
||||
// check if filename has extension msr or mlog
|
||||
if (!strstr(argv[1], ".msr") && !strstr(argv[1], ".mlog")) {
|
||||
cerr << endl << ">> musrview **ERROR** " << argv[1] << " is not a msr/mlog-file, nor is it a supported graphics extension." << endl;
|
||||
show_syntax = true;
|
||||
} else {
|
||||
strcpy(fileName, argv[1]);
|
||||
}
|
||||
strcpy(graphicsExtension, argv[i]+2);
|
||||
} else if (!strcmp(argv[i], "--timeout")) {
|
||||
if (i+1 < argc) {
|
||||
TString str(argv[i+1]);
|
||||
if (str.IsDigit()) {
|
||||
timeout = str.Atoi();
|
||||
} else {
|
||||
show_syntax = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
show_syntax = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
show_syntax = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (show_syntax) {
|
||||
@ -308,6 +305,8 @@ int main(int argc, char *argv[])
|
||||
// connect signal/slot
|
||||
TQObject::Connect("TCanvas", "Closed()", "PMusrCanvas", musrCanvas, "LastCanvasClosed()");
|
||||
|
||||
musrCanvas->SetTimeout(timeout);
|
||||
|
||||
// ugly but rootcint cannot handle the spirit-parser framework
|
||||
musrCanvas->SetMsrHandler(msrHandler);
|
||||
musrCanvas->SetRunListCollection(runListCollection);
|
||||
|
Loading…
x
Reference in New Issue
Block a user