From 7458f000a830f8e3e3c2a98a142f14003d398c60 Mon Sep 17 00:00:00 2001 From: nemu Date: Thu, 29 May 2008 14:41:33 +0000 Subject: [PATCH] correct handling of dictionary handling --- src/ToDo.txt | 4 +-- src/classes/Makefile.PMusr | 4 +-- src/classes/PTheory.cpp | 17 +++++++++++- src/include/PMusrCanvas.h | 12 -------- src/include/PMusrCanvasLinkDef.h | 41 ++++++++++++++++++++++++++++ src/include/PStartupHandler.h | 14 +--------- src/include/PStartupHandlerLinkDef.h | 40 +++++++++++++++++++++++++++ src/include/PTheory.h | 3 +- 8 files changed, 104 insertions(+), 31 deletions(-) create mode 100644 src/include/PMusrCanvasLinkDef.h create mode 100644 src/include/PStartupHandlerLinkDef.h diff --git a/src/ToDo.txt b/src/ToDo.txt index b738dd1b..7df1ef4d 100644 --- a/src/ToDo.txt +++ b/src/ToDo.txt @@ -54,19 +54,19 @@ short term: * something is strange with the coordinate system in TPaveText! **CHECK** -* something is wrong with lifetimecorrection plot of musrview (up shifted data) **DONE** 08-05-16 +* something is wrong with lifetimecorrection plot of musrview (up shifted data) **FIXED** 08-05-16 --------------------- intermediate term: --------------------- +* implement access to user-function, i.e. functions not * start writing docu, i.e. transferring WKM doc from German -> English and describe new features with examples! * introduce error numbers with corresponding docu/explanation in the latex-docu. * implement RRF stuff * implement NonMuSR stuff -* implement access to user-function, i.e. functions not defined within musrfit, using the ROOT dictionary feature to look for them and use them. * think about if it is worth to modify wkm in order to read diff --git a/src/classes/Makefile.PMusr b/src/classes/Makefile.PMusr index b46658e9..080bd6d9 100644 --- a/src/classes/Makefile.PMusr +++ b/src/classes/Makefile.PMusr @@ -124,11 +124,11 @@ $(OBJS): %.o: %.cpp MuSR_td_PSI_bin.o: ../external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp $(CXX) $(INCLUDES) $(CXXFLAGS) -c ../external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp -PStartupHandlerDict.cpp: ../include/PStartupHandler.h +PStartupHandlerDict.cpp: ../include/PStartupHandler.h ../include/PStartupHandlerLinkDef.h @echo "Generating dictionary $@..." rootcint -f $@ -c -p $^ -PMusrCanvasDict.cpp: ../include/PMusrCanvas.h +PMusrCanvasDict.cpp: ../include/PMusrCanvas.h ../include/PMusrCanvasLinkDef.h @echo "Generating dictionary $@..." rootcint -v -f $@ -c -p $^ diff --git a/src/classes/PTheory.cpp b/src/classes/PTheory.cpp index 4da5ea27..64534290 100644 --- a/src/classes/PTheory.cpp +++ b/src/classes/PTheory.cpp @@ -254,12 +254,21 @@ PTheory::PTheory(PMsrHandler *msrInfo, unsigned int runNo, const bool hasParent) MakeCleanAndTidyTheoryBlock(fullTheoryBlock); } - // check if user function, if so, check if it is reachable (root) + // check if user function, if so, check if it is reachable (root) and if yes invoke object if (!fUserFcnClassName.IsWhitespace()) { cout << endl << ">> user function class name: " << fUserFcnClassName.Data() << endl; if (!TClass::GetDict(fUserFcnClassName.Data())) { cout << endl << "**ERROR**: PTheory: user function class '" << fUserFcnClassName.Data() << "' not found. See line no " << line->fLineNo; fValid = false; + } else { // invoke user function object + fUserFcn = 0; + fUserFcn = TClass::GetClass(fUserFcnClassName.Data())->New(); +cout << endl << ">> fUserFcn = " << fUserFcn; + if (fUserFcn == 0) { + cout << endl << "**ERROR**: PTheory: user function object could not be invoked. See line no " << line->fLineNo; + fValid = false; + } else { // get the pointer to the user function evaluation routine + } } } @@ -296,6 +305,12 @@ PTheory::~PTheory() delete fStaticKTLFFunc; fStaticKTLFFunc = 0; } + + if (fUserFcn) { +/* + fUserFcn = 0; +*/ + } } //-------------------------------------------------------------------------- diff --git a/src/include/PMusrCanvas.h b/src/include/PMusrCanvas.h index e54da749..53ee7340 100644 --- a/src/include/PMusrCanvas.h +++ b/src/include/PMusrCanvas.h @@ -140,16 +140,4 @@ class PMusrCanvas : public TObject, public TQObject 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/PMusrCanvasLinkDef.h b/src/include/PMusrCanvasLinkDef.h new file mode 100644 index 00000000..7099a9d6 --- /dev/null +++ b/src/include/PMusrCanvasLinkDef.h @@ -0,0 +1,41 @@ +/*************************************************************************** + + PMusrCanvasLinkDef.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. * + ***************************************************************************/ + +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class PMusrCanvas+; + +#endif + diff --git a/src/include/PStartupHandler.h b/src/include/PStartupHandler.h index b3e0f18b..302f4712 100644 --- a/src/include/PStartupHandler.h +++ b/src/include/PStartupHandler.h @@ -57,7 +57,7 @@ class PStartupHandler : public TObject, public TQObject virtual void OnCdataBlock(const char*, Int_t); // SLOT virtual void CheckLists(); - + virtual const PStringVector GetDataPathList() const { return fDataPathList; } virtual const PIntVector GetMarkerList() const { return fMarkerList; } virtual const PIntVector GetColorList() const { return fColorList; } @@ -75,17 +75,5 @@ class PStartupHandler : public TObject, public TQObject ClassDef(PStartupHandler, 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 PStartupHandler+; - -#endif -// root dictionary stuff -------------------------------------------------- - #endif // _PSTARTUPHANDLER_H_ diff --git a/src/include/PStartupHandlerLinkDef.h b/src/include/PStartupHandlerLinkDef.h new file mode 100644 index 00000000..78ba7e1a --- /dev/null +++ b/src/include/PStartupHandlerLinkDef.h @@ -0,0 +1,40 @@ +/*************************************************************************** + + PStartupHandlerLinkDef.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +***************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2007 by Andreas Suter * + * andreas.suter@psi.c * + * * + * 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. * + ***************************************************************************/ + +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class PStartupHandler+; + +#endif diff --git a/src/include/PTheory.h b/src/include/PTheory.h index 8c950b56..babdf998 100644 --- a/src/include/PTheory.h +++ b/src/include/PTheory.h @@ -214,7 +214,8 @@ class PTheory // TString fUserFunPreParsed; TF1 *fStaticKTLFFunc; - TString fUserFcnClassName; ///< name of the user function class for within root + TString fUserFcnClassName; ///< name of the user function class for within root + void *fUserFcn; ///< pointer to the user function object PMsrHandler *fMsrInfo; };