Added autotool-support for building musrfit - some additional tests are needed, the old Makefiles are still around

This commit is contained in:
Bastian M. Wojek
2009-06-19 20:37:06 +00:00
parent 93e6e7d059
commit b5016637fd
28 changed files with 831 additions and 378 deletions

20
src/Makefile.am Normal file
View File

@ -0,0 +1,20 @@
## Process this file with automake to create Makefile.in
SUBDIRS = classes external
bin_PROGRAMS = musrfit musrview musrt0 musrparam msr2msr
musrfit_SOURCES = musrfit.cpp
musrview_SOURCES = musrview.cpp
musrt0_SOURCES = musrt0.cpp
musrparam_SOURCES = musrparam.cpp
msr2msr_SOURCES = msr2msr.cpp
xmldir = $(bindir)
xml_DATA = musrfit_startup.xml
LIBADD = $(LEM_LIBS) $(PMUSR_LIBS)
AM_CFLAGS = -g -O3 -Wall -Wno-trigraphs
INCLUDES = $(PMUSR_CFLAGS) $(FFTW3_CFLAGS) $(GSL_CFLAGS) $(BOOST_CFLAGS) $(ROOT_CFLAGS)
LIBS = $(LEM_LIBS) $(PMUSR_LIBS) $(FFTW3_LIBS) $(GSL_LIBS) $(ROOT_LIBS)

View File

@ -1,25 +0,0 @@
#---------------------------------------------------------------------
# README
# Andreas Suter, 2008/01/15
# $Id$
#---------------------------------------------------------------------
To get it all build:
1) go to the subdiretory 'classes' and execute
make -f Makefile.PMusr
make -f Makefile.PMusr install (as root)
2) if the privous step worked execute in the current directory (in which
you found this README)
make clean
make
make install
In the optimal case, everything is setup ;-)
#---------------------------------------------------------------------
# this is the end ...
#---------------------------------------------------------------------

View File

@ -44,7 +44,7 @@ endif
# -- Linux
ifeq ($(OS),LINUX)
CXX = g++
CXX = g++-4.2.4
CXXFLAGS = -O3 -Wall -Wno-trigraphs -fPIC
PMUSRPATH = ../include
MNPATH = $(ROOTSYS)/include
@ -54,7 +54,7 @@ FFTW3PATH = /usr/include
LEMPATH = ../external/TLemRunHeader
PSIBINPATH = ../external/MuSR_software/Class_MuSR_PSI
INCLUDES = -I$(PMUSRPATH) -I$(MNPATH) -I$(GSLPATH) -I$(BOOSTPATH) -I$(LEMPATH) -I$(PSIBINPATH) -I$(FFTW3PATH)
LD = g++
LD = g++-4.2.4
LDFLAGS = -O
SOFLAGS = -shared
LEMLIB = libTLemRunHeader.so

View File

@ -34,10 +34,10 @@ endif
# -- Linux
ifeq ($(OS),LINUX)
CXX = g++
CXX = g++-4.3.3
CXXFLAGS = -Wall -Wno-trigraphs -fPIC
INCLUDES = -I../include
LD = g++
LD = g++-4.3.3
LDFLAGS = -g
SOFLAGS = -O -shared
endif

90
src/classes/Makefile.am Normal file
View File

@ -0,0 +1,90 @@
## Process this file with automake to create Makefile.in
h_sources = \
../include/PFitterFcn.h \
../include/PFitter.h \
../include/PFourier.h \
../include/PFunctionGrammar.h \
../include/PFunction.h \
../include/PFunctionHandler.h \
../include/PMsrHandler.h \
../include/PMusrCanvas.h \
../include/PMusr.h \
../include/PMusrT0.h \
../include/PRunAsymmetry.h \
../include/PRunBase.h \
../include/PRunDataHandler.h \
../include/PRunListCollection.h \
../include/PRunNonMusr.h \
../include/PRunRRF.h \
../include/PRunSingleHisto.h \
../include/PStartupHandler.h \
../include/PTheory.h \
../include/PUserFcnBase.h
h_linkdef = \
../include/PMusrCanvasLinkDef.h \
../include/PMusrT0LinkDef.h \
../include/PStartupHandlerLinkDef.h \
../include/PUserFcnBaseLinkDef.h
dict_h_sources = \
PMusrCanvasDict.h \
PMusrT0Dict.h \
PStartupHandlerDict.h \
PUserFcnBaseDict.h
cpp_sources = \
PFitter.cpp \
PFitterFcn.cpp \
PFourier.cpp \
PFunction.cpp \
PFunctionHandler.cpp \
PMsrHandler.cpp \
PMusrCanvas.cpp \
PMusrT0.cpp \
PRunAsymmetry.cpp \
PRunBase.cpp \
PRunDataHandler.cpp \
PRunListCollection.cpp \
PRunNonMusr.cpp \
PRunRRF.cpp \
PRunSingleHisto.cpp \
PStartupHandler.cpp \
PTheory.cpp \
PUserFcnBase.cpp
dict_cpp_sources = \
PMusrCanvasDict.cpp \
PMusrT0Dict.cpp \
PStartupHandlerDict.cpp \
PUserFcnBaseDict.cpp
ext_source_dir = $(top_srcdir)/src/external/MuSR_software/Class_MuSR_PSI
ext_h_sources = $(ext_source_dir)/MuSR_td_PSI_bin.h $(ext_source_dir)/tydefs.h
ext_cpp_sources = $(ext_source_dir)/MuSR_td_PSI_bin.cpp
include_HEADERS = $(h_sources) $(ext_h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
INCLUDES = -I$(top_srcdir)/src/include -I$(ext_source_dir) $(LEM_CFLAGS) $(FFTW3_CFLAGS) $(GSL_CFLAGS) $(BOOST_CFLAGS) $(ROOT_CFLAGS)
AM_CXXFLAGS = -g -O3 -Wall -Wno-trigraphs
BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources)
AM_CPPFLAGS = -I@ROOTINCDIR@
AM_LDFLAGS = -L@ROOTLIBDIR@
CLEANFILES = *Dict.cpp *Dict.h *~ core
%Dict.cpp %Dict.h: ../include/%.h ../include/%LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(INCLUDES) $(AM_CPPFLAGS) $^
lib_LTLIBRARIES = libPMusr.la
LIBADD = $(LEM_LIBS)
libPMusr_la_SOURCES = $(h_sources) $(cpp_sources) $(dict_h_sources) $(dict_cpp_sources) $(ext_h_sources) $(ext_cpp_sources)
libPMusr_la_LIBADD = $(FFTW3_LIBS) $(GSL_LIBS) $(ROOT_LIBS)
libPMusr_la_LDFLAGS = -version-info $(MUSR_LIBRARY_VERSION) -release $(MUSR_RELEASE)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = PMusr.pc

View File

@ -31,6 +31,7 @@
#include <iostream>
#include <fstream>
#include <limits>
using namespace std;
#include <math.h>
@ -408,8 +409,11 @@ bool PFitter::ExecuteHesse()
// create the hesse object
ROOT::Minuit2::MnHesse hesse;
// specify maximal number of function calls
unsigned int maxfcn = numeric_limits<unsigned int>::max();
// call hesse
ROOT::Minuit2::MnUserParameterState mnState = hesse((*fFitterFcn), fMnUserParams);
ROOT::Minuit2::MnUserParameterState mnState = hesse((*fFitterFcn), fMnUserParams, maxfcn);
if (!mnState.IsValid()) {
cout << endl << "**WARNING** PFitter::ExecuteHesse(): Hesse encountered some problems!";
@ -453,7 +457,7 @@ bool PFitter::ExecuteMigrad()
// minimize
// maxfcn is MINUIT2 Default maxfcn
unsigned int maxfcn = (200 + 100*fParams.size() + 5*fParams.size()*fParams.size());
unsigned int maxfcn = numeric_limits<unsigned int>::max();
// tolerance = MINUIT2 Default tolerance
double tolerance = 0.1;
ROOT::Minuit2::FunctionMinimum min = migrad(maxfcn, tolerance);
@ -521,7 +525,7 @@ bool PFitter::ExecuteMinimize()
// minimize
// maxfcn is MINUIT2 Default maxfcn
unsigned int maxfcn = (200 + 100*fParams.size() + 5*fParams.size()*fParams.size());
unsigned int maxfcn = numeric_limits<unsigned int>::max();
//cout << endl << "maxfcn=" << maxfcn << endl;
// tolerance = MINUIT2 Default tolerance
double tolerance = 0.1;
@ -896,7 +900,7 @@ bool PFitter::ExecuteSimplex()
// minimize
// maxfcn is 10*MINUIT2 Default maxfcn
unsigned int maxfcn = 10*(200 + 100*fParams.size() + 5*fParams.size()*fParams.size());
unsigned int maxfcn = numeric_limits<unsigned int>::max();
// tolerance = MINUIT2 Default tolerance
double tolerance = 0.1;
ROOT::Minuit2::FunctionMinimum min = simplex(maxfcn, tolerance);

10
src/classes/PMusr.pc.in Normal file
View File

@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: PMusr
Description: C++ shared library providing musr classes
Version: @VERSION@
Libs: -L${libdir} -l@GENERIC_LIBRARY_NAME@
Cflags: -I${includedir}/@GENERIC_LIBRARY_NAME@ -I${libdir}/include

1
src/external/Makefile.am vendored Normal file
View File

@ -0,0 +1 @@
SUBDIRS = TLemRunHeader scripts

View File

@ -152,11 +152,16 @@ TLondon1D_1L::TLondon1D_1L(const vector<double> &param, unsigned int steps)
fMinB = -1.0;
// thicknesses have to be greater or equal to zero
for(unsigned int i(1); i<3; i++)
assert(param[i]>=0.);
for(unsigned int i(1); i<3; i++){
if(param[i] < 0.){
fParam[i] = 0.;
}
}
// lambdas have to be greater than zero
assert(param[3]!=0.);
if(param[3] < 0.1){
fParam[3] = 0.1;
}
// Calculate the coefficients of the exponentials
double N0(param[0]/(1.0+exp(param[2]/param[3])));
@ -194,7 +199,10 @@ double TLondon1D_1L::GetBmin() const
void TLondon1D_1L::SetBmin()
{
double b_a(fCoeff[1]/fCoeff[0]);
assert (b_a>0.);
// assert(b_a>0.);
if(b_a<10E-7){
b_a = 10E-7;
}
double minZ;
// check if the minimum is in the first layer
@ -205,7 +213,14 @@ void TLondon1D_1L::SetBmin()
return;
}
assert(fMinZ > 0. && fMinB > 0.);
// assert(fMinZ > 0. && fMinB > 0.);
if(fMinZ <= 0.){
fMinZ = 0.;
}
if(fMinB <= 0.){
fMinB = 0.;
}
return;
}

View File

@ -204,6 +204,8 @@ double TLondon1DHS::operator()(double t, const vector<double> &par) const {
if(t<0.0)
return cos(par[0]*0.017453293);
bool dead_layer_changed(false);
// check if the function is called the first time and if yes, read in parameters
if(fFirstCall){
@ -217,7 +219,8 @@ double TLondon1DHS::operator()(double t, const vector<double> &par) const {
fParForBofZ.push_back(fPar[i]);
// cout << "fParForBofZ[" << i-2 << "] = " << fParForBofZ[i-2] << endl;
}
fFirstCall=false;
fFirstCall = false;
dead_layer_changed = true;
// cout << this << endl;
}
@ -232,11 +235,11 @@ double TLondon1DHS::operator()(double t, const vector<double> &par) const {
par_changed = true;
if (i == 0) {
only_phase_changed = true;
} else if (i == 3) {
fDeadLayerChanged = true;
only_phase_changed = false;
} else {
only_phase_changed = false;
if (i == 3) {
dead_layer_changed = true;
}
}
}
}
@ -261,12 +264,11 @@ double TLondon1DHS::operator()(double t, const vector<double> &par) const {
fParForPofB[3] = par[2]; // Bkg-Field
//fParForPofB[4] = 0.005; // Bkg-width (in principle zero)
if(fDeadLayerChanged){
if(dead_layer_changed){
vector<double> interfaces;
interfaces.push_back(par[3]);// dead layer
fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces); // Fraction of muons in the deadlayer
interfaces.clear();
fDeadLayerChanged = false;
}
TLondon1D_HS BofZ(fParForBofZ);
@ -615,7 +617,9 @@ TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) {
fParForPofB.push_back(startupHandler->GetDeltat());
fParForPofB.push_back(startupHandler->GetDeltaB());
fParForPofB.push_back(0.0);
// fParForPofB.push_back(0.0);
fParForPofB.push_back(0.0); // Bkg-Field
fParForPofB.push_back(0.005); // Bkg-width
fParForPofB.push_back(0.0); // Bkg-weight
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
fImpProfile = x;
@ -652,6 +656,7 @@ double TProximity1D1LHS::operator()(double t, const vector<double> &par) const {
// check if the function is called the first time and if yes, read in parameters
bool width_changed(false);
bool dead_layer_changed(false);
if(fFirstCall){
fPar = par;
@ -666,6 +671,7 @@ double TProximity1D1LHS::operator()(double t, const vector<double> &par) const {
}
fFirstCall=false;
width_changed = true;
dead_layer_changed = true;
// cout << this << endl;
}
@ -685,6 +691,9 @@ double TProximity1D1LHS::operator()(double t, const vector<double> &par) const {
if (i == 7){
width_changed = true;
}
if (i == 4){
dead_layer_changed = true;
}
}
}
}
@ -705,11 +714,19 @@ double TProximity1D1LHS::operator()(double t, const vector<double> &par) const {
for (unsigned int i(2); i<fPar.size(); i++)
fParForBofZ[i-2] = par[i];
fParForPofB[2] = par[1]; // energy
if(width_changed) { // Convolution of the implantation profile with Gaussian
fImpProfile->ConvolveGss(par[7], par[1]);
width_changed = false;
}
fParForPofB[2] = par[1]; // energy
fParForPofB[3] = par[2]; // Bkg-Field
//fParForPofB[4] = 0.005; // Bkg-width (in principle zero)
if(dead_layer_changed){
vector<double> interfaces;
interfaces.push_back(par[4]);// dead layer
fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces); // Fraction of muons in the deadlayer
interfaces.clear();
}
TProximity1D_1LHS BofZ(fParForBofZ);

View File

@ -186,7 +186,8 @@ TPofBCalc::TPofBCalc( const TBofZCalcInverse &BofZ, const TTrimSPData &dataTrimS
for (unsigned int i(firstZerosEnd); i<lastZerosStart; i++)
fPB[i] /= pBsum;
AddBackground(para[3], para[4], para[5]);
if(para.size() == 6)
AddBackground(para[3], para[4], para[5]);
}

View File

@ -30,7 +30,6 @@ private:
TPofTCalc *fPofT;
mutable bool fCalcNeeded;
mutable bool fFirstCall;
mutable bool fDeadLayerChanged;
mutable vector<double> fParForPofT;
mutable vector<double> fParForBofZ;
mutable vector<double> fParForPofB;

43
src/external/TLemRunHeader/Makefile.am vendored Normal file
View File

@ -0,0 +1,43 @@
## Process this file with automake to create Makefile.in
h_sources = \
TLemStats.h \
TLemRunHeader.h
h_linkdef = \
TLemStatsLinkDef.h \
TLemRunHeaderLinkDef.h
dict_h_sources = \
TLemStatsDict.h \
TLemRunHeaderDict.h
cpp_sources = \
TLemStats.cxx \
TLemRunHeader.cxx
dict_cpp_sources = \
TLemStatsDict.cxx \
TLemRunHeaderDict.cxx
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
INCLUDES = -I. $(ROOT_CFLAGS)
BUILT_SOURCES = $(dict_cpp_sources) $(dist_h_sources)
AM_CPPFLAGS = -I@ROOTINCDIR@
AM_LDFLAGS = -L@ROOTLIBDIR@
CLEANFILES = *Dict.cxx *Dict.h *~ core
%Dict.cxx %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cxx -c -p $(INCLUDES) $(AM_CPPFLAGS) $^
lib_LTLIBRARIES = libTLemRunHeader.la
libTLemRunHeader_la_SOURCES = $(h_sources) $(cpp_sources) $(dict_h_sources) $(dict_cpp_sources)
libTLemRunHeader_la_LIBADD = $(ROOT_LIBS)
libTLemRunHeader_la_LDFLAGS = -version-info $(LEM_LIBRARY_VERSION) -release $(LEM_RELEASE)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = TLemRunHeader.pc

View File

@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: TLemRunHeader
Description: C++ shared library providing the LEM Run Header class
Version: @VERSION@
Libs: -L${libdir} -l@GENERIC_LIBRARY_NAME@
Cflags: -I${includedir}

1
src/external/scripts/Makefile.am vendored Normal file
View File

@ -0,0 +1 @@
bin_SCRIPTS = msr2data

View File

@ -9,8 +9,8 @@ exists( /usr/bin/cygwin1.dll ) {
}
INSTALLS += target
QMAKE_CC = gcc
QMAKE_CXX = g++
QMAKE_CC = gcc-4.2.4
QMAKE_CXX = g++-4.2.4
# install path for the XML configuration file
unix:xml.path = $(ROOTSYS)/bin/