diff --git a/src/Makefile.musrview b/src/Makefile.musrview new file mode 100644 index 00000000..a60e91dc --- /dev/null +++ b/src/Makefile.musrview @@ -0,0 +1,100 @@ +#--------------------------------------------------- +# Makefile.musrview +# +# Author: Andreas Suter +# e-mail: andreas.suter@psi.ch +# +# $Id$ +#--------------------------------------------------- + +#--------------------------------------------------- +# get compilation and library flags from root-config + +ROOTCFLAGS = $(shell $(ROOTSYS)/bin/root-config --cflags) +ROOTLIBS = $(shell $(ROOTSYS)/bin/root-config --libs) +ROOTGLIBS = $(shell $(ROOTSYS)/bin/root-config --glibs) + +#--------------------------------------------------- +# depending on the architecture, choose the compiler, +# linker, and the flags to use +# + +OSTYPE = linux + +ifeq ($(OSTYPE),linux) +OS = LINUX +endif +ifeq ($(OSTYPE),linux-gnu) +OS = LINUX +endif +ifeq ($(OSTYPE),darwin) +OS = DARWIN +endif + +# -- Linux +ifeq ($(OS),LINUX) +CXX = g++ +CXXFLAGS = -g -Wall -fPIC +PMUSRPATH = ./include +MNPATH = $(ROOTSYS)/include +GSLPATH = /usr/include/gsl +INCLUDES = -I $(PMUSRPATH) -I $(MNPATH) -I $(GSLPATH) +LD = g++ +LDFLAGS = -g +endif + +# -- Darwin +ifeq ($(OS),DARWIN) +CXX = g++ +CXXFLAGS = -g -Wall -fPIC +INCLUDES = -I../include +LD = g++ +LDFLAGS = -g +endif + +# the output from the root-config script: +CXXFLAGS += $(ROOTCFLAGS) +LDFLAGS += + +# the ROOT libraries (G = graphic) +LIBS = $(ROOTLIBS) -lXMLParser +GLIBS = $(ROOTGLIBS) -lXMLParser + +# PSI libs +PSILIBS = -lTLemRunHeader -lPMusr +# Minuit2 lib +MNLIB = -L$(ROOTSYS)/lib -lMinuit2 +# GSL lib +GSLLIB = -lgslcblas -lgsl + + +EXEC = musrview + +# some definitions: headers, sources, objects,... +OBJS = +OBJS += $(EXEC).o + +# make the executable: +# +all: $(EXEC) + +$(EXEC): $(OBJS) + @echo "---> Building $(EXEC) ..." + /bin/rm -f $(SHLIB) + $(LD) $(OBJS) -o $(EXEC) $(GLIBS) $(PSILIBS) $(MNLIB) $(GSLLIB) + @echo "done" + +# clean up: remove all object file (and core files) +# semicolon needed to tell make there is no source +# for this target! +# +clean:; @rm -f $(OBJS) + @echo "---> removing $(OBJS)" + +# +$(OBJS): %.o: %.cpp + $(CXX) $(INCLUDES) $(CXXFLAGS) -c $< + +install: all + @echo "doesn't do anything yet ..." + diff --git a/src/include/PMusrCanvas.h b/src/include/PMusrCanvas.h new file mode 100644 index 00000000..c2c85cf1 --- /dev/null +++ b/src/include/PMusrCanvas.h @@ -0,0 +1,87 @@ +/*************************************************************************** + + PMusrCanvas.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +***************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2007 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PMUSRCANVAS_H_ +#define _PMUSRCANVAS_H_ + +#include +#include +#include +#include +#include + +#define YINFO 0.1 +#define YTITLE 0.95 +#define XTHEO 0.75 + +//-------------------------------------------------------------------------- +/** + *

+ */ +class PMusrCanvas : public TObject, public TQObject +{ + public: + PMusrCanvas(); + PMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh); + virtual ~PMusrCanvas(); + + virtual Bool_t IsValid() { return fValid; } + + virtual void Done(Int_t status=0); // *SIGNAL* + virtual void HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected); // SLOT + + private: + Bool_t fValid; + + TCanvas *fMainCanvas; + TPaveText *fTitlePad; + TPad *fDataTheoryPad; + TPaveText *fParameterTheoryPad; + TPaveText *fInfoPad; + + TPaveText *fKeyboardHandlerText; + + ClassDef(PMusrCanvas, 1) +}; + +// root dictionary stuff -------------------------------------------------- +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class PMusrCanvas+; + +#endif +// root dictionary stuff -------------------------------------------------- + +#endif // _PMUSRCANVAS_H_ diff --git a/src/include/PRunBase.h b/src/include/PRunBase.h index 07ae4b8c..c8f1837d 100644 --- a/src/include/PRunBase.h +++ b/src/include/PRunBase.h @@ -86,7 +86,7 @@ class PRunBase PRunData fData; ///< data to be fitted double fTimeResolution; ///< time resolution - vector fT0s; ///< all t0's of a run! The derived classes will handle it + vector fT0s; ///< all t0's of a run! The derived classes will handle it virtual bool PrepareData() = 0; // pure virtual, i.e. needs to be implemented by the deriving class!! diff --git a/src/musrfit.cpp b/src/musrfit.cpp index c7dd2108..90f69b56 100644 --- a/src/musrfit.cpp +++ b/src/musrfit.cpp @@ -54,9 +54,9 @@ void musrfit_syntax() { cout << endl << "usage: musrfit [ [--debug] | [--dump ]] | --version | --help"; cout << endl << " : msr input file"; - cout << endl << " 'msrfit ' will execute msrfit"; - cout << endl << " 'msrfit' or 'msrfit --help' will show this help"; - cout << endl << " 'msrfit --version' will print the msrfit version"; + cout << endl << " 'musrfit ' will execute msrfit"; + cout << endl << " 'musrfit' or 'musrfit --help' will show this help"; + cout << endl << " 'musrfit --version' will print the msrfit version"; cout << endl << " --debug is used to print additional infos"; cout << endl << " --dump is writing a data file with the fit data and the theory"; cout << endl << " can be 'ascii', 'root'"; @@ -467,7 +467,7 @@ int main(int argc, char *argv[]) // check syntax if (argc == 2) { if (!strcmp(argv[1], "--version")) { - cout << endl << "msrfit version: $Id$"; + cout << endl << "musrfit version: $Id$"; cout << endl << endl; return PMUSR_SUCCESS; } else if (!strcmp(argv[1], "--help")) { diff --git a/src/musrview.cpp b/src/musrview.cpp new file mode 100644 index 00000000..a9f730bf --- /dev/null +++ b/src/musrview.cpp @@ -0,0 +1,108 @@ +/*************************************************************************** + + musrview.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +***************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2007 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +using namespace std; + +#include + +#include "PMusr.h" +#include "PMusrCanvas.h" + +//-------------------------------------------------------------------------- +/** + *

+ * + */ +void musrview_syntax() +{ + cout << endl << "usage: musrview | --version | --help"; + cout << endl << " : msr input file"; + cout << endl << " 'musrview ' will execute msrfit"; + cout << endl << " 'musrview' or 'msrfit --help' will show this help"; + cout << endl << " 'musrview --version' will print the msrfit version"; + cout << endl << endl; +} + +//-------------------------------------------------------------------------- +int main(int argc, char *argv[]) +{ + bool show_syntax = false; + + switch (argc) { + case 1: + show_syntax = true; + break; + case 2: + if (strstr(argv[1], "--version")) { + cout << endl << "musrview version: $Id$"; + cout << endl << endl; + return PMUSR_SUCCESS; + } else if (strstr(argv[1], "--help")) { + show_syntax = true; + } else { + // check if filename has extension msr + if (!strstr(argv[1], ".msr")) { + cout << endl << "ERROR: " << argv[1] << " is not a msr-file!" << endl; + show_syntax = true; + } + } + break; + default: + show_syntax = true; + } + + if (show_syntax) { + musrview_syntax(); + return PMUSR_WRONG_STARTUP_SYNTAX; + } + + TApplication app("App", &argc, argv); + + PMusrCanvas *musrCanvas = new PMusrCanvas("musr canvas dummy", 10, 10, 800, 600); + if (!musrCanvas->IsValid()) { + cout << endl << "**SEVERE ERROR** Couldn't invoke all necessary objects, will quit."; + cout << endl; + return -1; + } + + musrCanvas->Connect("Done(Int_t)", "TApplication", &app, "Terminate(Int_t)"); + + app.Run(); + + // clean up + if (musrCanvas) { + delete musrCanvas; + musrCanvas = 0; + } + + return 0; +} diff --git a/src/tests/skewedGaussianTest/paramInput.dat b/src/tests/skewedGaussianTest/paramInput.dat index 232d975d..7838b91b 100644 --- a/src/tests/skewedGaussianTest/paramInput.dat +++ b/src/tests/skewedGaussianTest/paramInput.dat @@ -10,10 +10,10 @@ channels, 66601 t0, 3300, 3300, 3300, 3300 #------------------------------------------------------ # asym's -asym, 0.26, 0.26, 0.26, 0.26 +asym, 0.24, 0.24, 0.24, 0.24 #------------------------------------------------------ # phases in (°) -phase, 0.0, 90.0, 180.0, 270.0 +phase, 10.0, 90.0, 170.0, 270.0 #------------------------------------------------------ # N0's N0, 110, 100, 102, 99