some more work on userFcn
This commit is contained in:
parent
6159700e85
commit
cc8d9981c3
@ -27,10 +27,12 @@ ROOTGLIBS = $(shell $(ROOTSYS)/bin/root-config --glibs)
|
|||||||
# linker, and the flags to use
|
# linker, and the flags to use
|
||||||
#
|
#
|
||||||
|
|
||||||
ifeq ($(OSTYPE),linux)
|
OSTYPE = $(shell uname)
|
||||||
|
|
||||||
|
ifeq ($(OSTYPE),Linux)
|
||||||
OS = LINUX
|
OS = LINUX
|
||||||
endif
|
endif
|
||||||
ifeq ($(OSTYPE),linux-gnu)
|
ifeq ($(OSTYPE),Linux-gnu)
|
||||||
OS = LINUX
|
OS = LINUX
|
||||||
endif
|
endif
|
||||||
ifeq ($(OSTYPE),darwin)
|
ifeq ($(OSTYPE),darwin)
|
||||||
|
@ -93,6 +93,7 @@ PTheory::PTheory(PMsrHandler *msrInfo, unsigned int runNo, const bool hasParent)
|
|||||||
fMul = 0;
|
fMul = 0;
|
||||||
fStaticKTLFFunc = 0;
|
fStaticKTLFFunc = 0;
|
||||||
fUserFcnClassName = TString("");
|
fUserFcnClassName = TString("");
|
||||||
|
fUserFcn = 0;
|
||||||
|
|
||||||
static unsigned int lineNo = 1; // lineNo
|
static unsigned int lineNo = 1; // lineNo
|
||||||
static unsigned int depth = 0; // needed to handle '+' properly
|
static unsigned int depth = 0; // needed to handle '+' properly
|
||||||
@ -258,8 +259,12 @@ PTheory::PTheory(PMsrHandler *msrInfo, unsigned int runNo, const bool hasParent)
|
|||||||
if (!fUserFcnClassName.IsWhitespace()) {
|
if (!fUserFcnClassName.IsWhitespace()) {
|
||||||
cout << endl << ">> user function class name: " << fUserFcnClassName.Data() << endl;
|
cout << endl << ">> user function class name: " << fUserFcnClassName.Data() << endl;
|
||||||
if (!TClass::GetDict(fUserFcnClassName.Data())) {
|
if (!TClass::GetDict(fUserFcnClassName.Data())) {
|
||||||
cout << endl << "**ERROR**: PTheory: user function class '" << fUserFcnClassName.Data() << "' not found. See line no " << line->fLineNo;
|
char libname[256];
|
||||||
fValid = false;
|
sprintf(libname, "lib%s.so", fUserFcnClassName.Data()); // add path needed??
|
||||||
|
if (gSystem->Load(libname) < 0) {
|
||||||
|
cout << endl << "**ERROR**: PTheory: user function class '" << fUserFcnClassName.Data() << "' not found. See line no " << line->fLineNo;
|
||||||
|
fValid = false;
|
||||||
|
}
|
||||||
} else { // invoke user function object
|
} else { // invoke user function object
|
||||||
fUserFcn = 0;
|
fUserFcn = 0;
|
||||||
fUserFcn = (PUserFcnBase*)TClass::GetClass(fUserFcnClassName.Data())->New();
|
fUserFcn = (PUserFcnBase*)TClass::GetClass(fUserFcnClassName.Data())->New();
|
||||||
|
56
src/classes/PUserFcnBase.cpp
Normal file
56
src/classes/PUserFcnBase.cpp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
PUserFcnBase.cpp
|
||||||
|
|
||||||
|
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. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "PUserFcnBase.h"
|
||||||
|
|
||||||
|
ClassImp(PUserFcnBase)
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// Constructor
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
PUserFcnBase::PUserFcnBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// Destructor
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
PUserFcnBase::~PUserFcnBase()
|
||||||
|
{
|
||||||
|
}
|
@ -32,6 +32,7 @@
|
|||||||
#ifndef _PTHEORY_H_
|
#ifndef _PTHEORY_H_
|
||||||
#define _PTHEORY_H_
|
#define _PTHEORY_H_
|
||||||
|
|
||||||
|
#include <TSystem.h>
|
||||||
#include <TString.h>
|
#include <TString.h>
|
||||||
#include <TF1.h>
|
#include <TF1.h>
|
||||||
|
|
||||||
|
50
src/include/PUserFcnBase.h
Normal file
50
src/include/PUserFcnBase.h
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
PUserFcnBase.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. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _PUSERFCNBASE_H_
|
||||||
|
#define _PUSERFCNBASE_H_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "TObject.h"
|
||||||
|
|
||||||
|
class PUserFcnBase : public TObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PUserFcnBase();
|
||||||
|
virtual ~PUserFcnBase();
|
||||||
|
|
||||||
|
virtual Double_t operator()(Double_t t, const std::vector<Double_t> ¶m) const = 0;
|
||||||
|
|
||||||
|
ClassDef(PUserFcnBase, 1)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _PUSERFCNBASE_H_
|
40
src/include/PUserFcnBaseLinkDef.h
Normal file
40
src/include/PUserFcnBaseLinkDef.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
PUserFcnBaseLinkDef.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 PUserFcnBase+;
|
||||||
|
|
||||||
|
#endif
|
@ -19,12 +19,12 @@ ROOTGLIBS = $(shell $(ROOTSYS)/bin/root-config --glibs)
|
|||||||
# linker, and the flags to use
|
# linker, and the flags to use
|
||||||
#
|
#
|
||||||
|
|
||||||
OSTYPE = linux
|
OSTYPE = $(shell uname)
|
||||||
|
|
||||||
ifeq ($(OSTYPE),linux)
|
ifeq ($(OSTYPE),Linux)
|
||||||
OS = LINUX
|
OS = LINUX
|
||||||
endif
|
endif
|
||||||
ifeq ($(OSTYPE),linux-gnu)
|
ifeq ($(OSTYPE),Linux-gnu)
|
||||||
OS = LINUX
|
OS = LINUX
|
||||||
endif
|
endif
|
||||||
ifeq ($(OSTYPE),darwin)
|
ifeq ($(OSTYPE),darwin)
|
||||||
@ -58,7 +58,8 @@ LIBS = $(ROOTLIBS) -lXMLParser
|
|||||||
GLIBS = $(ROOTGLIBS) -lXMLParser
|
GLIBS = $(ROOTGLIBS) -lXMLParser
|
||||||
|
|
||||||
# UserFcn lib
|
# UserFcn lib
|
||||||
USERFCNLIB = -lTUserFcnBase -lTUserFcn
|
USERFCNLIB = -lTUserFcnBase
|
||||||
|
#-lTUserFcn
|
||||||
|
|
||||||
INSTALLPATH = ./
|
INSTALLPATH = ./
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <TApplication.h>
|
#include <TSystem.h>
|
||||||
#include <TClass.h>
|
#include <TClass.h>
|
||||||
#include <TString.h>
|
#include <TString.h>
|
||||||
#include <TTime.h>
|
#include <TTime.h>
|
||||||
@ -54,9 +54,14 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
// check if class is found (argv[1] == class name)
|
// check if class is found (argv[1] == class name)
|
||||||
if (!TClass::GetDict("TUserFcn")) {
|
if (!TClass::GetDict("TUserFcn")) {
|
||||||
cout << endl << "**ERROR**: user function class 'TUserFcn' not found.";
|
cout << endl << "could find TUserFcn, will try to load the shared lib ...";
|
||||||
cout << endl << endl;
|
// try to load the shared library
|
||||||
return 0;
|
TString libName = TString("libTUserFcn.so");
|
||||||
|
if (gSystem->Load(libName.Data())<0) {
|
||||||
|
cout << endl << "**ERROR**: user function class 'TUserFcn' not found.";
|
||||||
|
cout << endl << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate class object
|
// generate class object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user