Started to implement a few changes in order to increase the calculation efficiency of libTFitPofB
This commit is contained in:
parent
61de7905e6
commit
9a693de0ce
@ -1,82 +0,0 @@
|
|||||||
#---------------------------------------------------
|
|
||||||
# get compilation flags from root-config
|
|
||||||
|
|
||||||
ROOTCFLAGS = $(shell $(ROOTSYS)/bin/root-config --cflags)
|
|
||||||
|
|
||||||
#---------------------------------------------------
|
|
||||||
|
|
||||||
OS = LINUX
|
|
||||||
CXX = g++-4.4.0
|
|
||||||
CXXFLAGS = -O3 -Wall -fopenmp -Wno-trigraphs -fPIC
|
|
||||||
MUSRFITINCLUDE = ../../../include
|
|
||||||
#MUSRFITINCLUDE = /home/l_wojek/rep/analysis/musrfit/src/include
|
|
||||||
LOCALINCLUDE = ../include
|
|
||||||
ROOTINCLUDE = $(ROOTSYS)/include
|
|
||||||
INCLUDES = -I$(LOCALINCLUDE) -I$(MUSRFITINCLUDE) -I$(ROOTINCLUDE)
|
|
||||||
LD = g++-4.4.0
|
|
||||||
LDFLAGS = -O3
|
|
||||||
SOFLAGS = -O3 -shared -fopenmp -lfftw3_threads -lfftw3 -lm -lpthread
|
|
||||||
|
|
||||||
# the output from the root-config script:
|
|
||||||
CXXFLAGS += $(ROOTCFLAGS)
|
|
||||||
LDFLAGS +=
|
|
||||||
|
|
||||||
# some definitions: headers (used to generate *Dict* stuff), sources, objects,...
|
|
||||||
OBJS =
|
|
||||||
OBJS += TTrimSPDataHandler.o
|
|
||||||
OBJS += TBulkVortexFieldCalc.o
|
|
||||||
OBJS += TBofZCalc.o
|
|
||||||
OBJS += TPofBCalc.o
|
|
||||||
OBJS += TPofTCalc.o
|
|
||||||
OBJS += TFitPofBStartupHandler.o TFitPofBStartupHandlerDict.o
|
|
||||||
OBJS += TVortex.o TVortexDict.o
|
|
||||||
OBJS += TLondon1D.o TLondon1DDict.o
|
|
||||||
OBJS += TSkewedGss.o TSkewedGssDict.o
|
|
||||||
|
|
||||||
SHLIB = libTFitPofB.so
|
|
||||||
|
|
||||||
# make the shared lib:
|
|
||||||
#
|
|
||||||
all: $(SHLIB)
|
|
||||||
|
|
||||||
$(SHLIB): $(OBJS)
|
|
||||||
@echo "---> Building shared library $(SHLIB) ..."
|
|
||||||
/bin/rm -f $(SHLIB)
|
|
||||||
$(LD) $(OBJS) $(SOFLAGS) -o $(SHLIB)
|
|
||||||
@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) *Dict* core*
|
|
||||||
@echo "---> removing $(OBJS)"
|
|
||||||
|
|
||||||
#
|
|
||||||
$(OBJS): %.o: %.cpp
|
|
||||||
$(CXX) $(INCLUDES) $(CXXFLAGS) -c $<
|
|
||||||
|
|
||||||
# Generate the ROOT CINT dictionary
|
|
||||||
|
|
||||||
TVortexDict.cpp: ../include/TVortex.h ../include/TVortexLinkDef.h
|
|
||||||
@echo "Generating dictionary $@..."
|
|
||||||
rootcint -f $@ -c -p -I$(MUSRFITINCLUDE) $^
|
|
||||||
|
|
||||||
TLondon1DDict.cpp: ../include/TLondon1D.h ../include/TLondon1DLinkDef.h
|
|
||||||
@echo "Generating dictionary $@..."
|
|
||||||
rootcint -f $@ -c -p -I$(MUSRFITINCLUDE) $^
|
|
||||||
|
|
||||||
TSkewedGssDict.cpp: ../include/TSkewedGss.h ../include/TSkewedGssLinkDef.h
|
|
||||||
@echo "Generating dictionary $@..."
|
|
||||||
rootcint -f $@ -c -p -I$(MUSRFITINCLUDE) $^
|
|
||||||
|
|
||||||
TFitPofBStartupHandlerDict.cpp: ../include/TFitPofBStartupHandler.h ../include/TFitPofBStartupHandlerLinkDef.h
|
|
||||||
@echo "Generating dictionary $@..."
|
|
||||||
rootcint -f $@ -c -p $^
|
|
||||||
|
|
||||||
install: all
|
|
||||||
@echo "Installing shared lib: libTFitPofB.so"
|
|
||||||
ifeq ($(OS),LINUX)
|
|
||||||
cp -pv $(SHLIB) $(ROOTSYS)/lib
|
|
||||||
cp -pv $(LOCALINCLUDE)/*.h $(ROOTSYS)/include
|
|
||||||
endif
|
|
187
src/external/TFitPofB-lib/classes/Makefile.libTFitPofB
vendored
Normal file
187
src/external/TFitPofB-lib/classes/Makefile.libTFitPofB
vendored
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
#---------------------------------------------------
|
||||||
|
# Makefile.libTFitPofB
|
||||||
|
#
|
||||||
|
# Author: Bastian M. Wojek
|
||||||
|
# e-mail: bastian.wojek@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
|
||||||
|
#
|
||||||
|
|
||||||
|
ARCH = $(shell $(ROOTSYS)/bin/root-config --arch)
|
||||||
|
|
||||||
|
ifeq ($(ARCH),linux)
|
||||||
|
OS = LINUX
|
||||||
|
endif
|
||||||
|
ifeq ($(ARCH),linuxx8664gcc)
|
||||||
|
OS = LINUX
|
||||||
|
endif
|
||||||
|
ifeq ($(ARCH),win32gcc)
|
||||||
|
OS = WIN32GCC
|
||||||
|
endif
|
||||||
|
ifeq ($(ARCH),macosx)
|
||||||
|
OS = DARWIN
|
||||||
|
endif
|
||||||
|
|
||||||
|
# -- Linux
|
||||||
|
ifeq ($(OS),LINUX)
|
||||||
|
CXX = g++-4.4.0
|
||||||
|
CXXFLAGS = -O3 -fopenmp -Wall -Wno-trigraphs -fPIC
|
||||||
|
PMUSRPATH = ../../../include
|
||||||
|
MNPATH = $(ROOTSYS)/include
|
||||||
|
LOCALPATH = ../include
|
||||||
|
FFTW3PATH = /usr/include
|
||||||
|
INCLUDES = -I$(PMUSRPATH) -I$(MNPATH) -I$(LOCALPATH) -I$(FFTW3PATH)
|
||||||
|
LD = g++-4.4.0
|
||||||
|
LDFLAGS = -O
|
||||||
|
SOFLAGS = -shared -fopenmp
|
||||||
|
SHLIB = libTFitPofB.so
|
||||||
|
endif
|
||||||
|
|
||||||
|
# -- Windows/Cygwin
|
||||||
|
ifeq ($(OS),WIN32GCC)
|
||||||
|
CXX = g++
|
||||||
|
CXXFLAGS = -O3 -Wall -Wno-trigraphs -D_DLL
|
||||||
|
PMUSRPATH = ../../../include
|
||||||
|
MNPATH = $(ROOTSYS)/include
|
||||||
|
LOCALPATH = ../include
|
||||||
|
FFTW3PATH = /usr/include
|
||||||
|
INCLUDES = -I$(PMUSRPATH) -I$(MNPATH) -I$(LOCALPATH) -I$(FFTW3PATH)
|
||||||
|
LD = g++
|
||||||
|
LDFLAGS = -O -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc
|
||||||
|
SOFLAGS = -shared -Wl,--export-all-symbols
|
||||||
|
SHLIB = libTFitPofB.dll
|
||||||
|
endif
|
||||||
|
|
||||||
|
# -- MacOSX/Darwin
|
||||||
|
ifeq ($(OS),DARWIN)
|
||||||
|
CXX = g++
|
||||||
|
CXXFLAGS = -O3 -Wall -Wno-trigraphs -fPIC
|
||||||
|
PMUSRPATH = ../../../include
|
||||||
|
MNPATH = $(ROOTSYS)/include
|
||||||
|
FINKPATH = /sw/include
|
||||||
|
LOCALPATH = ../include
|
||||||
|
FFTW3PATH = /sw/include
|
||||||
|
INCLUDES = -I$(PMUSRPATH) -I$(MNPATH) -I$(LOCALPATH) -I$(FINKPATH) -I$(FFTW3PATH)
|
||||||
|
LD = g++
|
||||||
|
LDFLAGS = -O -Xlinker -bind_at_load
|
||||||
|
SOFLAGS = -dynamiclib -flat_namespace -undefined suppress -Wl,-x
|
||||||
|
SHLIB = libTFitPofB.dylib
|
||||||
|
endif
|
||||||
|
|
||||||
|
# the output from the root-config script:
|
||||||
|
CXXFLAGS += $(ROOTCFLAGS)
|
||||||
|
LDFLAGS +=
|
||||||
|
|
||||||
|
# the ROOT libraries (G = graphic)
|
||||||
|
LIBS = $(ROOTLIBS)
|
||||||
|
GLIBS = $(ROOTGLIBS)
|
||||||
|
|
||||||
|
# PMusr lib
|
||||||
|
PMUSRLIB = -L$(ROOTSYS)/lib -lPMusr
|
||||||
|
# FFTW lib
|
||||||
|
FFTW3LIB = -lfftw3_threads -lfftw3 -lm -lpthread
|
||||||
|
|
||||||
|
ifeq ($(OS),WIN32GCC)
|
||||||
|
# PMusr lib
|
||||||
|
PMUSRLIB = -L$(ROOTSYS)/lib -lPMusr -lMathMore
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OS),DARWIN)
|
||||||
|
# FFTW lib
|
||||||
|
FFTW3LIB = -L/sw/lib -lfftw3_threads -lfftw3 -lm -lpthread
|
||||||
|
# PMusr lib
|
||||||
|
PMUSRLIB = -L$(ROOTSYS)/lib -lPMusr -lMathMore
|
||||||
|
endif
|
||||||
|
|
||||||
|
# some definitions: headers (used to generate *Dict* stuff), sources, objects,...
|
||||||
|
OBJS =
|
||||||
|
OBJS += TTrimSPDataHandler.o
|
||||||
|
OBJS += TBulkVortexFieldCalc.o
|
||||||
|
OBJS += TBofZCalc.o
|
||||||
|
OBJS += TPofBCalc.o
|
||||||
|
OBJS += TPofTCalc.o
|
||||||
|
OBJS += TFitPofBStartupHandler.o TFitPofBStartupHandlerDict.o
|
||||||
|
OBJS += TVortex.o TVortexDict.o
|
||||||
|
OBJS += TLondon1D.o TLondon1DDict.o
|
||||||
|
OBJS += TSkewedGss.o TSkewedGssDict.o
|
||||||
|
|
||||||
|
INST_HEADER =
|
||||||
|
INST_HEADER += ../include/TBofZCalc.h
|
||||||
|
INST_HEADER += ../include/TBulkVortexFieldCalc.h
|
||||||
|
INST_HEADER += ../include/TFitPofBStartupHandler.h
|
||||||
|
INST_HEADER += ../include/TLondon1D.h
|
||||||
|
INST_HEADER += ../include/TPofBCalc.h
|
||||||
|
INST_HEADER += ../include/TPofTCalc.h
|
||||||
|
INST_HEADER += ../include/TSkewedGss.h
|
||||||
|
INST_HEADER += ../include/TTrimSPDataHandler.h
|
||||||
|
INST_HEADER += ../include/TVortex.h
|
||||||
|
|
||||||
|
# make the shared libs:
|
||||||
|
|
||||||
|
all: $(SHLIB)
|
||||||
|
|
||||||
|
$(SHLIB): $(EXTOBJS) $(OBJS)
|
||||||
|
@echo "---> Building shared library $(SHLIB) ..."
|
||||||
|
/bin/rm -f $(SHLIB)
|
||||||
|
$(LD) $(SOFLAGS) $(LDFLAGS) -o $(SHLIB) $(OBJS) $(LIBS) $(PMUSRLIB) $(FFTW3LIB)
|
||||||
|
@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) $(EXTOBJS) $(SHLIB) *Dict* core* *~
|
||||||
|
@echo "---> removing $(OBJS) $(SHLIB)"
|
||||||
|
|
||||||
|
|
||||||
|
$(OBJS): %.o: %.cpp
|
||||||
|
$(CXX) $(INCLUDES) $(CXXFLAGS) -c $<
|
||||||
|
|
||||||
|
# Generate the ROOT CINT dictionary
|
||||||
|
|
||||||
|
TVortexDict.cpp: ../include/TVortex.h ../include/TVortexLinkDef.h
|
||||||
|
@echo "Generating dictionary $@..."
|
||||||
|
rootcint -f $@ -c -p -I$(PMUSRPATH) $^
|
||||||
|
|
||||||
|
TLondon1DDict.cpp: ../include/TLondon1D.h ../include/TLondon1DLinkDef.h
|
||||||
|
@echo "Generating dictionary $@..."
|
||||||
|
rootcint -f $@ -c -p -I$(PMUSRPATH) $^
|
||||||
|
|
||||||
|
TSkewedGssDict.cpp: ../include/TSkewedGss.h ../include/TSkewedGssLinkDef.h
|
||||||
|
@echo "Generating dictionary $@..."
|
||||||
|
rootcint -f $@ -c -p -I$(PMUSRPATH) $^
|
||||||
|
|
||||||
|
TFitPofBStartupHandlerDict.cpp: ../include/TFitPofBStartupHandler.h ../include/TFitPofBStartupHandlerLinkDef.h
|
||||||
|
@echo "Generating dictionary $@..."
|
||||||
|
rootcint -f $@ -c -p $^
|
||||||
|
|
||||||
|
install: all
|
||||||
|
@echo "Installing shared lib: $(SHLIB)"
|
||||||
|
ifeq ($(OS),LINUX)
|
||||||
|
cp -pv $(SHLIB) $(ROOTSYS)/lib
|
||||||
|
cp -pv $(INST_HEADER) $(ROOTSYS)/include
|
||||||
|
endif
|
||||||
|
ifeq ($(OS),WIN32GCC)
|
||||||
|
cp -pv $(SHLIB) $(ROOTSYS)/bin
|
||||||
|
ln -sf $(ROOTSYS)/bin/$(SHLIB) $(ROOTSYS)/lib/$(SHLIB)
|
||||||
|
cp -pv $(INST_HEADER) $(ROOTSYS)/include
|
||||||
|
endif
|
||||||
|
ifeq ($(OS),DARWIN)
|
||||||
|
cp -pv $(SHLIB) $(ROOTSYS)/lib
|
||||||
|
cp -pv $(INST_HEADER) $(ROOTSYS)/include
|
||||||
|
endif
|
||||||
|
|
||||||
|
cleaninstall: clean install
|
20
src/external/TFitPofB-lib/classes/TBofZCalc.cpp
vendored
20
src/external/TFitPofB-lib/classes/TBofZCalc.cpp
vendored
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 "TBofZCalc.h"
|
#include "TBofZCalc.h"
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
@ -9,16 +9,40 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 "TBulkVortexFieldCalc.h"
|
#include "TBulkVortexFieldCalc.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
#define PI 3.14159265358979323846
|
#define PI 3.14159265358979323846
|
||||||
#define TWOPI 6.28318530717958647692
|
#define TWOPI 6.28318530717958647692
|
||||||
|
|
||||||
const double fluxQuantum(2.067833667e7); // 10e14 times CGS units %% in CGS units should be 10^-7
|
const double fluxQuantum(2.067833667e7); // 10e14 times CGS units %% in CGS units should be 10^-7
|
||||||
// in this case this is Gauss per square nm
|
// in this case this is Gauss per square nm
|
||||||
|
const double sqrt3(sqrt(3.0));
|
||||||
|
|
||||||
double getXi(const double hc2) { // get xi given Hc2 in Gauss
|
double getXi(const double hc2) { // get xi given Hc2 in Gauss
|
||||||
if (hc2)
|
if (hc2)
|
||||||
@ -34,68 +58,295 @@ double getHc2(const double xi) { // get Hc2 given xi in nm
|
|||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TBulkTriVortexLondonFieldCalc::TBulkTriVortexLondonFieldCalc(const vector<double>& param, const unsigned int steps, const unsigned int Ncomp)
|
TBulkVortexFieldCalc::~TBulkVortexFieldCalc() {
|
||||||
: fNFourierComp(Ncomp) {
|
// if a wisdom file is used export the wisdom so it has not to be checked for the FFT-plan next time
|
||||||
|
if (fUseWisdom) {
|
||||||
|
FILE *wordsOfWisdomW;
|
||||||
|
wordsOfWisdomW = fopen(fWisdom.c_str(), "w");
|
||||||
|
if (wordsOfWisdomW == NULL) {
|
||||||
|
cout << "TBulkVortexFieldCalc::~TBulkVortexFieldCalc(): Could not open file ... No wisdom is exported..." << endl;
|
||||||
|
} else {
|
||||||
|
fftw_export_wisdom_to_file(wordsOfWisdomW);
|
||||||
|
fclose(wordsOfWisdomW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
|
||||||
|
fftw_destroy_plan(fFFTplan);
|
||||||
|
delete[] fFFTin; fFFTin = 0;
|
||||||
|
delete[] fFFTout; fFFTout = 0;
|
||||||
|
//fftw_cleanup();
|
||||||
|
//fftw_cleanup_threads();
|
||||||
|
}
|
||||||
|
|
||||||
|
TBulkTriVortexLondonFieldCalc::TBulkTriVortexLondonFieldCalc(const string& wisdom, const unsigned int steps) {
|
||||||
|
fWisdom = wisdom;
|
||||||
fSteps = steps;
|
fSteps = steps;
|
||||||
fParam = param;
|
fParam.resize(3);
|
||||||
fB.clear();
|
fGridExists = false;
|
||||||
}
|
if (fSteps%2)
|
||||||
|
fSteps++;
|
||||||
|
|
||||||
double TBulkTriVortexLondonFieldCalc::GetBatPoint(double relX, double relY) const {
|
int init_threads(fftw_init_threads());
|
||||||
|
if (init_threads)
|
||||||
|
fftw_plan_with_nthreads(2);
|
||||||
|
|
||||||
double latConstTr(sqrt(fluxQuantum/fParam[2])*sqrt(sqrt(4.0/3.0)));
|
fFFTin = new fftw_complex[(fSteps/2 + 1) * fSteps];
|
||||||
double Hc2(getHc2(fParam[1]));
|
fFFTout = new double[fSteps*fSteps];
|
||||||
|
|
||||||
double xCoord(latConstTr*relX); // in nanometers
|
// cout << "Check for the FFT plan..." << endl;
|
||||||
double yCoord(latConstTr*relY);
|
|
||||||
|
|
||||||
if ((fParam[2] < Hc2) && (fParam[0] > fParam[1]/sqrt(2.0))) {
|
// Load wisdom from file if it exists and should be used
|
||||||
double KLatTr(4.0*PI/(latConstTr*sqrt(3.0)));
|
|
||||||
double fourierSum(0.0);
|
fUseWisdom = true;
|
||||||
for(int mm = -fNFourierComp; mm <= static_cast<int>(fNFourierComp); mm++) {
|
int wisdomLoaded(0);
|
||||||
for(int nn = -fNFourierComp; nn <= static_cast<int>(fNFourierComp); nn++) {
|
|
||||||
fourierSum += cos(KLatTr*(xCoord*mm*(0.5*sqrt(3.0)) + yCoord*mm*0.5 + yCoord*nn))*exp(-(0.5*fParam[1]*fParam[1]*KLatTr*KLatTr)* \
|
FILE *wordsOfWisdomR;
|
||||||
(0.75*mm*mm + (nn + 0.5*mm)*(nn + 0.5*mm)))/(1.0+(fParam[0]*KLatTr*fParam[0]*KLatTr)*(0.75*mm*mm + (nn + 0.5*mm)*(nn + 0.5*mm)));
|
wordsOfWisdomR = fopen(fWisdom.c_str(), "r");
|
||||||
|
if (wordsOfWisdomR == NULL) {
|
||||||
|
fUseWisdom = false;
|
||||||
|
} else {
|
||||||
|
wisdomLoaded = fftw_import_wisdom_from_file(wordsOfWisdomR);
|
||||||
|
fclose(wordsOfWisdomR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!wisdomLoaded) {
|
||||||
|
fUseWisdom = false;
|
||||||
}
|
}
|
||||||
return fParam[2]*fourierSum;
|
|
||||||
}
|
// create the FFT plan
|
||||||
|
|
||||||
|
if (fUseWisdom)
|
||||||
|
fFFTplan = fftw_plan_dft_c2r_2d(fSteps, fSteps, fFFTin, fFFTout, FFTW_EXHAUSTIVE);
|
||||||
else
|
else
|
||||||
return fParam[2];
|
fFFTplan = fftw_plan_dft_c2r_2d(fSteps, fSteps, fFFTin, fFFTout, FFTW_ESTIMATE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// double TBulkTriVortexLondonFieldCalc::GetBatPoint(double relX, double relY) const {
|
||||||
|
//
|
||||||
|
// double field(fParam[0]), lambda(fParam[1]), xi(fParam[2]);
|
||||||
|
// double xisq_2(0.5*xi*xi), lambdasq(lambda*lambda);
|
||||||
|
//
|
||||||
|
// double latConstTr(sqrt(fluxQuantum/field)*sqrt(sqrt(4.0/3.0)));
|
||||||
|
// double Hc2(getHc2(xi));
|
||||||
|
//
|
||||||
|
// double xCoord(latConstTr*relX); // in nanometers
|
||||||
|
// double yCoord(latConstTr*relY);
|
||||||
|
//
|
||||||
|
// if ((field < Hc2) && (lambda > xi/sqrt(2.0))) {
|
||||||
|
// double KLatTr(4.0*PI/(latConstTr*sqrt3));
|
||||||
|
// double fourierSum(1.0), fourierAdd(0.0), expo;
|
||||||
|
//
|
||||||
|
// // k = 0, l = 0 gives 1.0, already in fourierSum
|
||||||
|
//
|
||||||
|
// // l = 0, only integer k
|
||||||
|
// for (double k (1.0); k < static_cast<double>(fNFourierComp); k+=1.0){
|
||||||
|
// expo = 3.0*pow(KLatTr*k, 2.0);
|
||||||
|
// fourierAdd += exp(-xisq_2*expo)/(lambdasq*expo + 1.0)*cos(sqrt3*KLatTr*k*xCoord);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// fourierSum += 2.0*fourierAdd;
|
||||||
|
// fourierAdd = 0.0;
|
||||||
|
//
|
||||||
|
// // k = 0, only integer l
|
||||||
|
// for (double l (1.0); l < static_cast<double>(fNFourierComp); l+=1.0){
|
||||||
|
// expo = pow(KLatTr*l, 2.0);
|
||||||
|
// fourierAdd += exp(-xisq_2*expo)/(lambdasq*expo + 1.0)*cos(KLatTr*l*yCoord);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// fourierSum += 2.0*fourierAdd;
|
||||||
|
// fourierAdd = 0.0;
|
||||||
|
//
|
||||||
|
// // k != 0, l != 0 both integers
|
||||||
|
// for (double k (1.0); k < static_cast<double>(fNFourierComp); k+=1.0){
|
||||||
|
// for (double l (1.0); l < static_cast<double>(fNFourierComp); l+=1.0){
|
||||||
|
// expo = KLatTr*KLatTr*(3.0*k*k + l*l);
|
||||||
|
// fourierAdd += exp(-xisq_2*expo)/(lambdasq*expo + 1.0)*cos(sqrt3*KLatTr*k*xCoord)*cos(KLatTr*l*yCoord);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// fourierSum += 4.0*fourierAdd;
|
||||||
|
// fourierAdd = 0.0;
|
||||||
|
//
|
||||||
|
// // k != 0, l != 0 both half-integral numbers
|
||||||
|
// for (double k (0.5); k < static_cast<double>(fNFourierComp); k+=1.0){
|
||||||
|
// for (double l (0.5); l < static_cast<double>(fNFourierComp); l+=1.0){
|
||||||
|
// expo = KLatTr*KLatTr*(3.0*k*k + l*l);
|
||||||
|
// fourierAdd += exp(-xisq_2*expo)/(lambdasq*expo + 1.0)*cos(sqrt3*KLatTr*k*xCoord)*cos(KLatTr*l*yCoord);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// fourierSum += 4.0*fourierAdd;
|
||||||
|
//
|
||||||
|
// // for(int mm = -fNFourierComp; mm <= static_cast<int>(fNFourierComp); mm++) {
|
||||||
|
// // for(int nn = -fNFourierComp; nn <= static_cast<int>(fNFourierComp); nn++) {
|
||||||
|
// // fourierSum += cos(KLatTr*(xCoord*mm*(0.5*sqrt(3.0)) + yCoord*mm*0.5 + yCoord*nn))*exp(-(0.5*fParam[1]*fParam[1]*KLatTr*KLatTr)*
|
||||||
|
// // (0.75*mm*mm + (nn + 0.5*mm)*(nn + 0.5*mm)))/(1.0+(fParam[0]*KLatTr*fParam[0]*KLatTr)*(0.75*mm*mm + (nn + 0.5*mm)*(nn + 0.5*mm)));
|
||||||
|
// // }
|
||||||
|
// // }
|
||||||
|
// // cout << " " << fourierSum << ", ";
|
||||||
|
// return field*fourierSum;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// return field;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
void TBulkTriVortexLondonFieldCalc::CalculateGrid() const {
|
void TBulkTriVortexLondonFieldCalc::CalculateGrid() const {
|
||||||
|
// SetParameters - method has to be called from the user before the calculation!!
|
||||||
|
double field(abs(fParam[0])), lambda(abs(fParam[1])), xi(abs(fParam[2]));
|
||||||
|
double Hc2(getHc2(xi));
|
||||||
|
|
||||||
double bb(cos(PI/6.0)*0.5);
|
double latConstTr(sqrt(fluxQuantum/field*sqrt(4.0/3.0)));
|
||||||
double yStep(bb/static_cast<double>(fSteps));
|
double xisq_2_scaled(2.0/3.0*pow(xi*PI/latConstTr,2.0)), lambdasq_scaled(4.0/3.0*pow(lambda*PI/latConstTr,2.0));
|
||||||
double xStep(0.5/static_cast<double>(fSteps));
|
|
||||||
|
|
||||||
fB.resize(fSteps);
|
int NFFT(fSteps);
|
||||||
for (unsigned int i(0); i < fSteps; i++)
|
int NFFT_2(fSteps/2);
|
||||||
fB[i].resize(fSteps);
|
int NFFTsq(fSteps*fSteps);
|
||||||
|
|
||||||
for(unsigned int i(0); i < fSteps; i++) {
|
// fill the field Fourier components in the matrix
|
||||||
int j;
|
|
||||||
#pragma omp parallel for default(shared) private(j) schedule(dynamic)
|
int m;
|
||||||
for(j=0; j < static_cast<int>(fSteps); j++) {
|
|
||||||
fB[i][j] = GetBatPoint(static_cast<double>(i)*xStep, static_cast<double>(j)*yStep);
|
// ... but first check that the field is not larger than Hc2 and that we are dealing with a type II SC
|
||||||
|
if ((field >= Hc2) || (lambda < xi/sqrt(2.0))) {
|
||||||
|
#pragma omp parallel for default(shared) private(m) schedule(dynamic)
|
||||||
|
for (m = 0; m < NFFTsq; m++) {
|
||||||
|
fFFTout[m] = field;
|
||||||
}
|
}
|
||||||
// end pragma omp parallel
|
// Set the flag which shows that the calculation has been done
|
||||||
|
fGridExists = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ... now fill in the Fourier components if everything was okay above
|
||||||
|
double Gsq;
|
||||||
|
int k, l, lNFFT_2;
|
||||||
|
|
||||||
|
// omp causes problems with the fftw_complex*... comment it out for the moment
|
||||||
|
//#pragma omp parallel default(shared) private(l,lNFFT_2,k,Gsq)
|
||||||
|
{
|
||||||
|
// #pragma omp sections nowait
|
||||||
|
{
|
||||||
|
// #pragma omp section
|
||||||
|
// #pragma omp parallel for default(shared) private(l,lNFFT_2,k) schedule(dynamic)
|
||||||
|
for (l = 0; l < NFFT_2; l += 2) {
|
||||||
|
lNFFT_2 = l*(NFFT_2 + 1);
|
||||||
|
for (k = 0; k < NFFT_2; k += 2) {
|
||||||
|
Gsq = 3.0*static_cast<double>(k*k) + static_cast<double>(l*l);
|
||||||
|
fFFTin[lNFFT_2 + k][0] = exp(-xisq_2_scaled*Gsq)/(1.0+lambdasq_scaled*Gsq);
|
||||||
|
fFFTin[lNFFT_2 + k][1] = 0.0;
|
||||||
|
fFFTin[lNFFT_2 + k + 1][0] = 0.0;
|
||||||
|
fFFTin[lNFFT_2 + k + 1][1] = 0.0;
|
||||||
|
}
|
||||||
|
k = NFFT_2;
|
||||||
|
Gsq = 3.0*static_cast<double>(k*k) + static_cast<double>(l*l);
|
||||||
|
fFFTin[lNFFT_2 + k][0] = exp(-xisq_2_scaled*Gsq)/(1.0+lambdasq_scaled*Gsq);
|
||||||
|
fFFTin[lNFFT_2 + k][1] = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// #pragma omp section
|
||||||
|
// #pragma omp parallel for default(shared) private(l,lNFFT_2,k) schedule(dynamic)
|
||||||
|
for (l = NFFT_2; l < NFFT; l += 2) {
|
||||||
|
lNFFT_2 = l*(NFFT_2 + 1);
|
||||||
|
for (k = 0; k < NFFT_2; k += 2) {
|
||||||
|
Gsq = 3.0*static_cast<double>(k*k) + static_cast<double>((NFFT-l)*(NFFT-l));
|
||||||
|
fFFTin[lNFFT_2 + k][0] = exp(-xisq_2_scaled*Gsq)/(1.0+lambdasq_scaled*Gsq);
|
||||||
|
fFFTin[lNFFT_2 + k][1] = 0.0;
|
||||||
|
fFFTin[lNFFT_2 + k + 1][0] = 0.0;
|
||||||
|
fFFTin[lNFFT_2 + k + 1][1] = 0.0;
|
||||||
|
}
|
||||||
|
k = NFFT_2;
|
||||||
|
Gsq = 3.0*static_cast<double>(k*k) + static_cast<double>((NFFT-l)*(NFFT-l));
|
||||||
|
fFFTin[lNFFT_2 + k][0] = exp(-xisq_2_scaled*Gsq)/(1.0+lambdasq_scaled*Gsq);
|
||||||
|
fFFTin[lNFFT_2 + k][1] = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// intermediate rows
|
||||||
|
// #pragma omp section
|
||||||
|
// #pragma omp parallel for default(shared) private(l,lNFFT_2,k) schedule(dynamic)
|
||||||
|
for (l = 1; l < NFFT_2; l += 2) {
|
||||||
|
lNFFT_2 = l*(NFFT_2 + 1);
|
||||||
|
for (k = 0; k < NFFT_2; k += 2) {
|
||||||
|
Gsq = 3.0*static_cast<double>((k + 1)*(k + 1)) + static_cast<double>(l*l);
|
||||||
|
fFFTin[lNFFT_2 + k][0] = 0.0;
|
||||||
|
fFFTin[lNFFT_2 + k][1] = 0.0;
|
||||||
|
fFFTin[lNFFT_2 + k + 1][0] = exp(-xisq_2_scaled*Gsq)/(1.0+lambdasq_scaled*Gsq);
|
||||||
|
fFFTin[lNFFT_2 + k + 1][1] = 0.0;
|
||||||
|
}
|
||||||
|
k = NFFT_2;
|
||||||
|
fFFTin[lNFFT_2 + k][0] = 0.0;
|
||||||
|
fFFTin[lNFFT_2 + k][1] = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// #pragma omp section
|
||||||
|
// #pragma omp parallel for default(shared) private(l,lNFFT_2,k) schedule(dynamic)
|
||||||
|
for (l = NFFT_2 + 1; l < NFFT; l += 2) {
|
||||||
|
lNFFT_2 = l*(NFFT_2 + 1);
|
||||||
|
for (k = 0; k < NFFT_2; k += 2) {
|
||||||
|
Gsq = 3.0*static_cast<double>((k+1)*(k+1)) + static_cast<double>((NFFT-l)*(NFFT-l));
|
||||||
|
fFFTin[lNFFT_2 + k][0] = 0.0;
|
||||||
|
fFFTin[lNFFT_2 + k][1] = 0.0;
|
||||||
|
fFFTin[lNFFT_2 + k + 1][0] = exp(-xisq_2_scaled*Gsq)/(1.0+lambdasq_scaled*Gsq);
|
||||||
|
fFFTin[lNFFT_2 + k + 1][1] = 0.0;
|
||||||
|
}
|
||||||
|
k = NFFT_2;
|
||||||
|
fFFTin[lNFFT_2 + k][0] = 0.0;
|
||||||
|
fFFTin[lNFFT_2 + k][1] = 0.0;
|
||||||
|
}
|
||||||
|
} /* end of sections */
|
||||||
|
|
||||||
|
} /* end of parallel section */
|
||||||
|
|
||||||
|
// Do the Fourier transform to get B(x,y)
|
||||||
|
|
||||||
|
fftw_execute(fFFTplan);
|
||||||
|
|
||||||
|
// Multiply by the applied field
|
||||||
|
#pragma omp parallel for default(shared) private(l) schedule(dynamic)
|
||||||
|
for (l = 0; l < NFFTsq; l++) {
|
||||||
|
fFFTout[l] *= field;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the flag which shows that the calculation has been done
|
||||||
|
|
||||||
|
fGridExists = true;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double TBulkTriVortexLondonFieldCalc::GetBmin() const {
|
double TBulkTriVortexLondonFieldCalc::GetBmin() const {
|
||||||
return GetBatPoint(0.5, 0.5*tan(PI/6.0));
|
if (fGridExists) {
|
||||||
|
double min(fFFTout[0]);
|
||||||
|
unsigned int minindex(0), counter(0);
|
||||||
|
for (unsigned int j(0); j < fSteps * fSteps / 2; j++) {
|
||||||
|
if (fFFTout[j] <= 0.0) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
if (fFFTout[j] < min) {
|
||||||
|
min = fFFTout[j];
|
||||||
|
minindex = j;
|
||||||
|
}
|
||||||
|
counter++;
|
||||||
|
if (counter == fSteps/2) { // check only the first quadrant of B(x,y)
|
||||||
|
counter = 0;
|
||||||
|
j += fSteps/2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fFFTout[minindex];
|
||||||
|
} else {
|
||||||
|
CalculateGrid();
|
||||||
|
return GetBmin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double TBulkTriVortexLondonFieldCalc::GetBmax() const {
|
double TBulkTriVortexLondonFieldCalc::GetBmax() const {
|
||||||
if (!fB.empty())
|
if (fGridExists)
|
||||||
return fB[0][0];
|
return fFFTout[0];
|
||||||
else
|
else {
|
||||||
return GetBatPoint(0.0, 0.0);
|
CalculateGrid();
|
||||||
|
return GetBmax();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
TFitPofBStartupHandler.h
|
TFitPofBStartupHandler.cpp
|
||||||
|
|
||||||
Author: Bastian M. Wojek
|
Author: Bastian M. Wojek
|
||||||
e-mail: bastian.wojek@psi.ch
|
e-mail: bastian.wojek@psi.ch
|
||||||
@ -14,7 +14,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2007 by Andreas Suter, Bastian M. Wojek *
|
* Copyright (C) 2007-2008 by Andreas Suter, Bastian M. Wojek *
|
||||||
* *
|
* *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
167
src/external/TFitPofB-lib/classes/TLondon1D.cpp
vendored
167
src/external/TFitPofB-lib/classes/TLondon1D.cpp
vendored
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 "TLondon1D.h"
|
#include "TLondon1D.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -43,6 +63,8 @@ TLondon1DHS::~TLondon1DHS() {
|
|||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
delete fImpProfile;
|
||||||
fImpProfile = 0;
|
fImpProfile = 0;
|
||||||
|
delete fPofB;
|
||||||
|
fPofB = 0;
|
||||||
delete fPofT;
|
delete fPofT;
|
||||||
fPofT = 0;
|
fPofT = 0;
|
||||||
}
|
}
|
||||||
@ -54,6 +76,8 @@ TLondon1D1L::~TLondon1D1L() {
|
|||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
delete fImpProfile;
|
||||||
fImpProfile = 0;
|
fImpProfile = 0;
|
||||||
|
delete fPofB;
|
||||||
|
fPofB = 0;
|
||||||
delete fPofT;
|
delete fPofT;
|
||||||
fPofT = 0;
|
fPofT = 0;
|
||||||
}
|
}
|
||||||
@ -65,6 +89,8 @@ TLondon1D2L::~TLondon1D2L() {
|
|||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
delete fImpProfile;
|
||||||
fImpProfile = 0;
|
fImpProfile = 0;
|
||||||
|
delete fPofB;
|
||||||
|
fPofB = 0;
|
||||||
delete fPofT;
|
delete fPofT;
|
||||||
fPofT = 0;
|
fPofT = 0;
|
||||||
}
|
}
|
||||||
@ -76,6 +102,8 @@ TProximity1D1LHS::~TProximity1D1LHS() {
|
|||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
delete fImpProfile;
|
||||||
fImpProfile = 0;
|
fImpProfile = 0;
|
||||||
|
delete fPofB;
|
||||||
|
fPofB = 0;
|
||||||
delete fPofT;
|
delete fPofT;
|
||||||
fPofT = 0;
|
fPofT = 0;
|
||||||
}
|
}
|
||||||
@ -87,6 +115,8 @@ TProximity1D1LHSGss::~TProximity1D1LHSGss() {
|
|||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
delete fImpProfile;
|
||||||
fImpProfile = 0;
|
fImpProfile = 0;
|
||||||
|
delete fPofB;
|
||||||
|
fPofB = 0;
|
||||||
delete fPofT;
|
delete fPofT;
|
||||||
fPofT = 0;
|
fPofT = 0;
|
||||||
}
|
}
|
||||||
@ -98,6 +128,8 @@ TLondon1D3L::~TLondon1D3L() {
|
|||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
delete fImpProfile;
|
||||||
fImpProfile = 0;
|
fImpProfile = 0;
|
||||||
|
delete fPofB;
|
||||||
|
fPofB = 0;
|
||||||
delete fPofT;
|
delete fPofT;
|
||||||
fPofT = 0;
|
fPofT = 0;
|
||||||
}
|
}
|
||||||
@ -109,6 +141,8 @@ TLondon1D3LS::~TLondon1D3LS() {
|
|||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
delete fImpProfile;
|
||||||
fImpProfile = 0;
|
fImpProfile = 0;
|
||||||
|
delete fPofB;
|
||||||
|
fPofB = 0;
|
||||||
delete fPofT;
|
delete fPofT;
|
||||||
fPofT = 0;
|
fPofT = 0;
|
||||||
}
|
}
|
||||||
@ -131,6 +165,8 @@ TLondon1D3LSub::~TLondon1D3LSub() {
|
|||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
delete fImpProfile;
|
||||||
fImpProfile = 0;
|
fImpProfile = 0;
|
||||||
|
delete fPofB;
|
||||||
|
fPofB = 0;
|
||||||
delete fPofT;
|
delete fPofT;
|
||||||
fPofT = 0;
|
fPofT = 0;
|
||||||
}
|
}
|
||||||
@ -159,7 +195,7 @@ TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
string rge_path(startupHandler->GetDataPath());
|
string rge_path(startupHandler->GetDataPath());
|
||||||
vector<string> energy_vec(startupHandler->GetEnergyList());
|
vector<string> energy_vec(startupHandler->GetEnergyList());
|
||||||
|
|
||||||
fParForPofT.push_back(0.0);
|
fParForPofT.push_back(0.0); // phase
|
||||||
fParForPofT.push_back(startupHandler->GetDeltat());
|
fParForPofT.push_back(startupHandler->GetDeltat());
|
||||||
fParForPofT.push_back(startupHandler->GetDeltaB());
|
fParForPofT.push_back(startupHandler->GetDeltaB());
|
||||||
|
|
||||||
@ -173,12 +209,15 @@ TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
||||||
fImpProfile = x;
|
fImpProfile = x;
|
||||||
x = 0;
|
x = 0;
|
||||||
delete x;
|
|
||||||
|
|
||||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
TPofBCalc *y = new TPofBCalc(fParForPofB);
|
||||||
fPofT = y;
|
fPofB = y;
|
||||||
y = 0;
|
y = 0;
|
||||||
delete y;
|
|
||||||
|
TPofTCalc *z = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
||||||
|
fPofT = z;
|
||||||
|
z = 0;
|
||||||
|
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
if (saxParser) {
|
if (saxParser) {
|
||||||
@ -212,13 +251,8 @@ double TLondon1DHS::operator()(double t, const vector<double> &par) const {
|
|||||||
if(fFirstCall){
|
if(fFirstCall){
|
||||||
fPar = par;
|
fPar = par;
|
||||||
|
|
||||||
// for (unsigned int i(0); i<fPar.size(); i++){
|
|
||||||
// cout << "fPar[" << i << "] = " << fPar[i] << endl;
|
|
||||||
// }
|
|
||||||
|
|
||||||
for (unsigned int i(2); i<fPar.size(); i++){
|
for (unsigned int i(2); i<fPar.size(); i++){
|
||||||
fParForBofZ.push_back(fPar[i]);
|
fParForBofZ.push_back(fPar[i]);
|
||||||
// cout << "fParForBofZ[" << i-2 << "] = " << fParForBofZ[i-2] << endl;
|
|
||||||
}
|
}
|
||||||
fFirstCall = false;
|
fFirstCall = false;
|
||||||
dead_layer_changed = true;
|
dead_layer_changed = true;
|
||||||
@ -280,8 +314,9 @@ double TLondon1DHS::operator()(double t, const vector<double> &par) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TLondon1D_HS BofZ(fParForBofZ);
|
TLondon1D_HS BofZ(fParForBofZ);
|
||||||
TPofBCalc PofB(BofZ, *fImpProfile, fParForPofB);
|
fPofB->UnsetPBExists();
|
||||||
fPofT->DoFFT(PofB);
|
fPofB->Calculate(&BofZ, fImpProfile, fParForPofB);
|
||||||
|
fPofT->DoFFT();
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||||
@ -332,12 +367,14 @@ TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true), fCallCounter(0
|
|||||||
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
||||||
fImpProfile = x;
|
fImpProfile = x;
|
||||||
x = 0;
|
x = 0;
|
||||||
delete x;
|
|
||||||
|
|
||||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
TPofBCalc *y = new TPofBCalc(fParForPofB);
|
||||||
fPofT = y;
|
fPofB = y;
|
||||||
y = 0;
|
y = 0;
|
||||||
delete y;
|
|
||||||
|
TPofTCalc *z = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
||||||
|
fPofT = z;
|
||||||
|
z = 0;
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
if (saxParser) {
|
if (saxParser) {
|
||||||
@ -420,8 +457,9 @@ double TLondon1D1L::operator()(double t, const vector<double> &par) const {
|
|||||||
fParForPofB[2] = par[1]; // energy
|
fParForPofB[2] = par[1]; // energy
|
||||||
|
|
||||||
TLondon1D_1L BofZ1(fParForBofZ);
|
TLondon1D_1L BofZ1(fParForBofZ);
|
||||||
TPofBCalc PofB1(BofZ1, *fImpProfile, fParForPofB);
|
fPofB->UnsetPBExists();
|
||||||
fPofT->DoFFT(PofB1);
|
fPofB->Calculate(&BofZ1, fImpProfile, fParForPofB);
|
||||||
|
fPofT->DoFFT();
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||||
@ -480,12 +518,15 @@ TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true), fLastTwoChange
|
|||||||
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
||||||
fImpProfile = x;
|
fImpProfile = x;
|
||||||
x = 0;
|
x = 0;
|
||||||
delete x;
|
|
||||||
|
|
||||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
TPofBCalc *y = new TPofBCalc(fParForPofB);
|
||||||
fPofT = y;
|
fPofB = y;
|
||||||
y = 0;
|
y = 0;
|
||||||
delete y;
|
|
||||||
|
TPofTCalc *z = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
||||||
|
fPofT = z;
|
||||||
|
z = 0;
|
||||||
|
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
if (saxParser) {
|
if (saxParser) {
|
||||||
@ -577,8 +618,10 @@ double TLondon1D2L::operator()(double t, const vector<double> &par) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TLondon1D_2L BofZ2(fParForBofZ);
|
TLondon1D_2L BofZ2(fParForBofZ);
|
||||||
TPofBCalc PofB2(BofZ2, *fImpProfile, fParForPofB);
|
fPofB->UnsetPBExists();
|
||||||
fPofT->DoFFT(PofB2);
|
fPofB->Calculate(&BofZ2, fImpProfile, fParForPofB);
|
||||||
|
fPofT->DoFFT();
|
||||||
|
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||||
@ -633,10 +676,14 @@ TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
fImpProfile = x;
|
fImpProfile = x;
|
||||||
x = 0;
|
x = 0;
|
||||||
|
|
||||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
TPofBCalc *y = new TPofBCalc(fParForPofB);
|
||||||
fPofT = y;
|
fPofB = y;
|
||||||
y = 0;
|
y = 0;
|
||||||
|
|
||||||
|
TPofTCalc *z = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
||||||
|
fPofT = z;
|
||||||
|
z = 0;
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
if (saxParser) {
|
if (saxParser) {
|
||||||
delete saxParser;
|
delete saxParser;
|
||||||
@ -738,8 +785,10 @@ double TProximity1D1LHS::operator()(double t, const vector<double> &par) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TProximity1D_1LHS BofZ(fParForBofZ);
|
TProximity1D_1LHS BofZ(fParForBofZ);
|
||||||
TPofBCalc PofB(BofZ, *fImpProfile, fParForPofB);
|
fPofB->UnsetPBExists();
|
||||||
fPofT->DoFFT(PofB);
|
fPofB->Calculate(&BofZ, fImpProfile, fParForPofB);
|
||||||
|
fPofT->DoFFT();
|
||||||
|
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||||
@ -791,10 +840,14 @@ TProximity1D1LHSGss::TProximity1D1LHSGss() : fCalcNeeded(true), fFirstCall(true)
|
|||||||
fImpProfile = x;
|
fImpProfile = x;
|
||||||
x = 0;
|
x = 0;
|
||||||
|
|
||||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
TPofBCalc *y = new TPofBCalc(fParForPofB);
|
||||||
fPofT = y;
|
fPofB = y;
|
||||||
y = 0;
|
y = 0;
|
||||||
|
|
||||||
|
TPofTCalc *z = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
||||||
|
fPofT = z;
|
||||||
|
z = 0;
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
if (saxParser) {
|
if (saxParser) {
|
||||||
delete saxParser;
|
delete saxParser;
|
||||||
@ -872,8 +925,9 @@ double TProximity1D1LHSGss::operator()(double t, const vector<double> &par) cons
|
|||||||
fParForPofB[2] = par[1]; // energy
|
fParForPofB[2] = par[1]; // energy
|
||||||
|
|
||||||
TProximity1D_1LHSGss BofZ(fParForBofZ);
|
TProximity1D_1LHSGss BofZ(fParForBofZ);
|
||||||
TPofBCalc PofB(BofZ, *fImpProfile, fParForPofB);
|
fPofB->UnsetPBExists();
|
||||||
fPofT->DoFFT(PofB);
|
fPofB->Calculate(&BofZ, fImpProfile, fParForPofB);
|
||||||
|
fPofT->DoFFT();
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||||
@ -922,12 +976,15 @@ TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true), fLastThreeChan
|
|||||||
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
||||||
fImpProfile = x;
|
fImpProfile = x;
|
||||||
x = 0;
|
x = 0;
|
||||||
delete x;
|
|
||||||
|
|
||||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
TPofBCalc *y = new TPofBCalc(fParForPofB);
|
||||||
fPofT = y;
|
fPofB = y;
|
||||||
y = 0;
|
y = 0;
|
||||||
delete y;
|
|
||||||
|
TPofTCalc *z = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
||||||
|
fPofT = z;
|
||||||
|
z = 0;
|
||||||
|
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
if (saxParser) {
|
if (saxParser) {
|
||||||
@ -1034,8 +1091,10 @@ double TLondon1D3L::operator()(double t, const vector<double> &par) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TLondon1D_3L BofZ3(fParForBofZ);
|
TLondon1D_3L BofZ3(fParForBofZ);
|
||||||
TPofBCalc PofB3(BofZ3, *fImpProfile, fParForPofB);
|
fPofB->UnsetPBExists();
|
||||||
fPofT->DoFFT(PofB3);
|
fPofB->Calculate(&BofZ3, fImpProfile, fParForPofB);
|
||||||
|
fPofT->DoFFT();
|
||||||
|
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||||
@ -1085,12 +1144,14 @@ TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true), fLastThreeCh
|
|||||||
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
||||||
fImpProfile = x;
|
fImpProfile = x;
|
||||||
x = 0;
|
x = 0;
|
||||||
delete x;
|
|
||||||
|
|
||||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
TPofBCalc *y = new TPofBCalc(fParForPofB);
|
||||||
fPofT = y;
|
fPofB = y;
|
||||||
y = 0;
|
y = 0;
|
||||||
delete y;
|
|
||||||
|
TPofTCalc *z = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
||||||
|
fPofT = z;
|
||||||
|
z = 0;
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
if (saxParser) {
|
if (saxParser) {
|
||||||
@ -1183,8 +1244,9 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TLondon1D_3LS BofZ3S(fParForBofZ);
|
TLondon1D_3LS BofZ3S(fParForBofZ);
|
||||||
TPofBCalc PofB3S(BofZ3S, *fImpProfile, fParForPofB);
|
fPofB->UnsetPBExists();
|
||||||
fPofT->DoFFT(PofB3S);
|
fPofB->Calculate(&BofZ3S, fImpProfile, fParForPofB);
|
||||||
|
fPofT->DoFFT();
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||||
@ -1402,12 +1464,14 @@ TLondon1D3LSub::TLondon1D3LSub() : fCalcNeeded(true), fFirstCall(true), fWeights
|
|||||||
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
||||||
fImpProfile = x;
|
fImpProfile = x;
|
||||||
x = 0;
|
x = 0;
|
||||||
delete x;
|
|
||||||
|
|
||||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
TPofBCalc *y = new TPofBCalc(fParForPofB);
|
||||||
fPofT = y;
|
fPofB = y;
|
||||||
y = 0;
|
y = 0;
|
||||||
delete y;
|
|
||||||
|
TPofTCalc *z = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
||||||
|
fPofT = z;
|
||||||
|
z = 0;
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
if (saxParser) {
|
if (saxParser) {
|
||||||
@ -1519,13 +1583,14 @@ double TLondon1D3LSub::operator()(double t, const vector<double> &par) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TLondon1D_3L BofZ3(fParForBofZ);
|
TLondon1D_3L BofZ3(fParForBofZ);
|
||||||
TPofBCalc PofB3(BofZ3, *fImpProfile, fParForPofB);
|
fPofB->UnsetPBExists();
|
||||||
|
fPofB->Calculate(&BofZ3, fImpProfile, fParForPofB);
|
||||||
|
|
||||||
// Add background contribution from the substrate
|
// Add background contribution from the substrate
|
||||||
PofB3.AddBackground(par[2], par[14], fImpProfile->LayerFraction(par[1], 4, interfaces));
|
fPofB->AddBackground(par[2], par[14], fImpProfile->LayerFraction(par[1], 4, interfaces));
|
||||||
|
|
||||||
// FourierTransform of P(B)
|
// FourierTransform of P(B)
|
||||||
fPofT->DoFFT(PofB3);
|
fPofT->DoFFT();
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||||
|
436
src/external/TFitPofB-lib/classes/TPofBCalc.cpp
vendored
436
src/external/TFitPofB-lib/classes/TPofBCalc.cpp
vendored
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 "TPofTCalc.h"
|
#include "TPofTCalc.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@ -23,13 +43,39 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
/-------------------------------------------------------*/
|
/-------------------------------------------------------*/
|
||||||
|
|
||||||
|
TPofBCalc::TPofBCalc(const vector<double> ¶) : fBmin(0.0), fBmax(0.0), fDT(para[0]), fDB(para[1]), fPBExists(false) {
|
||||||
|
fPBSize = static_cast<int>(1.0/(gBar*fDT*fDB));
|
||||||
|
if (fPBSize % 2) {
|
||||||
|
fPBSize += 1;
|
||||||
|
} else {
|
||||||
|
fPBSize += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
fB = new double[fPBSize];
|
||||||
|
fPB = new double[fPBSize];
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < static_cast<int>(fPBSize); i++) {
|
||||||
|
fB[i] = static_cast<double>(i)*fDB;
|
||||||
|
fPB[i] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Do not actually calculate P(B) but take it from a B and a P(B) vector of the same size
|
// Do not actually calculate P(B) but take it from a B and a P(B) vector of the same size
|
||||||
|
|
||||||
TPofBCalc::TPofBCalc( const vector<double>& b, const vector<double>& pb, double dt) {
|
TPofBCalc::TPofBCalc(const vector<double>& b, const vector<double>& pb, double dt) {
|
||||||
assert(b.size() == pb.size() && b.size() >= 2);
|
assert(b.size() == pb.size() && b.size() >= 2);
|
||||||
|
fPBSize = pb.size();
|
||||||
|
|
||||||
fB = b;
|
fB = new double[fPBSize];
|
||||||
fPB = pb;
|
fPB = new double[fPBSize];
|
||||||
|
|
||||||
|
for (unsigned int i(0); i < fPBSize; i++) {
|
||||||
|
fB[i] = b[i];
|
||||||
|
fPB[i] = pb[i];
|
||||||
|
}
|
||||||
|
|
||||||
vector<double>::const_iterator iter, iterB;
|
vector<double>::const_iterator iter, iterB;
|
||||||
iterB = b.begin();
|
iterB = b.begin();
|
||||||
@ -37,7 +83,7 @@ TPofBCalc::TPofBCalc( const vector<double>& b, const vector<double>& pb, double
|
|||||||
for(iter = pb.begin(); iter != pb.end(); iter++){
|
for(iter = pb.begin(); iter != pb.end(); iter++){
|
||||||
if(*iter != 0.0) {
|
if(*iter != 0.0) {
|
||||||
fBmin = *iterB;
|
fBmin = *iterB;
|
||||||
cout << fBmin << endl;
|
// cout << fBmin << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
iterB++;
|
iterB++;
|
||||||
@ -46,7 +92,7 @@ TPofBCalc::TPofBCalc( const vector<double>& b, const vector<double>& pb, double
|
|||||||
for( ; iter != b.end(); iter++){
|
for( ; iter != b.end(); iter++){
|
||||||
if(*iter == 0.0) {
|
if(*iter == 0.0) {
|
||||||
fBmax = *(iterB-1);
|
fBmax = *(iterB-1);
|
||||||
cout << fBmax << endl;
|
// cout << fBmax << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
iterB++;
|
iterB++;
|
||||||
@ -55,129 +101,92 @@ TPofBCalc::TPofBCalc( const vector<double>& b, const vector<double>& pb, double
|
|||||||
fDT = dt; // needed if a convolution should be done
|
fDT = dt; // needed if a convolution should be done
|
||||||
fDB = b[1]-b[0];
|
fDB = b[1]-b[0];
|
||||||
|
|
||||||
cout << fDB << endl;
|
// cout << fDB << endl;
|
||||||
|
|
||||||
|
fPBExists = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TPofBCalc::UnsetPBExists() {
|
||||||
|
int i;
|
||||||
|
#pragma omp parallel for default(shared) private(i) schedule(dynamic)
|
||||||
|
for (i = 0; i < static_cast<int>(fPBSize); i++) {
|
||||||
|
fPB[i] = 0.0;
|
||||||
|
}
|
||||||
|
fPBExists = false;
|
||||||
|
}
|
||||||
|
|
||||||
TPofBCalc::TPofBCalc( const string &type, const vector<double> ¶ ) : fDT(para[0]), fDB(para[1]) {
|
void TPofBCalc::Calculate(const string &type, const vector<double> ¶) {
|
||||||
|
|
||||||
if (type == "skg"){ // skewed Gaussian
|
if (type == "skg"){ // skewed Gaussian
|
||||||
|
|
||||||
fBmin = 0.0;
|
fBmin = 0.0;
|
||||||
fBmax = para[2]/gBar+10.0*fabs(para[4])/(2.0*pi*gBar);
|
fBmax = para[2]/gBar+10.0*fabs(para[4])/(2.0*pi*gBar);
|
||||||
|
|
||||||
double BB;
|
int a3(static_cast<int>(floor(fBmax/fDB)));
|
||||||
|
int a4(static_cast<int>(ceil(fBmax/fDB)));
|
||||||
|
|
||||||
|
unsigned int BmaxIndex((a3 < a4) ? a4 : (a4 + 1));
|
||||||
|
unsigned int B0Index(static_cast<int>(ceil(para[2]/(gBar*fDB))));
|
||||||
|
|
||||||
double expominus(para[3]*para[3]/(2.0*pi*pi*gBar*gBar));
|
double expominus(para[3]*para[3]/(2.0*pi*pi*gBar*gBar));
|
||||||
double expoplus(para[4]*para[4]/(2.0*pi*pi*gBar*gBar));
|
double expoplus(para[4]*para[4]/(2.0*pi*pi*gBar*gBar));
|
||||||
double B0(para[2]/gBar);
|
double B0(para[2]/(gBar));
|
||||||
double BmaxFFT(1.0/gBar/fDT);
|
|
||||||
|
|
||||||
for ( BB = 0.0 ; BB < B0 ; BB += fDB ) {
|
for (unsigned int i(0); i < B0Index; i++) {
|
||||||
fB.push_back(BB);
|
fPB[i] = exp(-(fB[i]-B0)*(fB[i]-B0)/expominus);
|
||||||
fPB.push_back(exp(-(BB-B0)*(BB-B0)/expominus));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ; BB < fBmax ; BB += fDB ) {
|
for (unsigned int i(B0Index); i <= BmaxIndex; i++) {
|
||||||
fB.push_back(BB);
|
fPB[i] = exp(-(fB[i]-B0)*(fB[i]-B0)/expoplus);
|
||||||
fPB.push_back(exp(-(BB-B0)*(BB-B0)/expoplus));
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int lastZerosStart(fB.size());
|
|
||||||
|
|
||||||
for ( ; BB <= BmaxFFT ; BB += fDB ) {
|
|
||||||
fB.push_back(BB);
|
|
||||||
fPB.push_back(0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure that we have an even number of elements in p(B) for FFT, so we do not have to care later
|
|
||||||
|
|
||||||
if (fB.size() % 2) {
|
|
||||||
fB.push_back(BB);
|
|
||||||
fPB.push_back(0.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// normalize p(B)
|
// normalize p(B)
|
||||||
|
|
||||||
double pBsum = 0.0;
|
double pBsum = 0.0;
|
||||||
for (unsigned int i(0); i<lastZerosStart; i++)
|
for (unsigned int i(0); i <= BmaxIndex; i++)
|
||||||
pBsum += fPB[i];
|
pBsum += fPB[i];
|
||||||
pBsum *= fDB;
|
pBsum *= fDB;
|
||||||
for (unsigned int i(0); i<lastZerosStart; i++)
|
for (unsigned int i(0); i <= BmaxIndex; i++)
|
||||||
fPB[i] /= pBsum;
|
fPB[i] /= pBsum;
|
||||||
|
|
||||||
} else { // fill the vectors with zeros
|
|
||||||
|
|
||||||
fBmin = 0.0;
|
|
||||||
fBmax = 1.0/gBar/fDT;
|
|
||||||
|
|
||||||
double BB;
|
|
||||||
|
|
||||||
for (BB=0.0 ; BB < fBmax ; BB += fDB ) {
|
|
||||||
fB.push_back(BB);
|
|
||||||
fPB.push_back(0.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure that we have an even number of elements in p(B) for FFT, so we do not have to care later
|
fPBExists = true;
|
||||||
|
return;
|
||||||
if (fB.size() % 2) {
|
|
||||||
fB.push_back(BB);
|
|
||||||
fPB.push_back(0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------
|
//-----------
|
||||||
// Constructor that does the P(B) calculation for given analytical inverse of B(z) and its derivative and n(z)
|
// Calculate-method that does the P(B) calculation for given analytical inverse of B(z) and its derivative and n(z)
|
||||||
// Parameters: dt[us], dB[G], Energy[keV], Bbg[G], width[us^{-1}], weight[1]
|
// Parameters: dt[us], dB[G], Energy[keV], Bbg[G], width[us^{-1}], weight[1]
|
||||||
//-----------
|
//-----------
|
||||||
|
|
||||||
TPofBCalc::TPofBCalc( const TBofZCalcInverse &BofZ, const TTrimSPData &dataTrimSP, const vector<double> ¶ ) : fDT(para[0]), fDB(para[1])
|
void TPofBCalc::Calculate(const TBofZCalcInverse *BofZ, const TTrimSPData *dataTrimSP, const vector<double> ¶) {
|
||||||
{
|
|
||||||
|
|
||||||
fBmin = BofZ.GetBmin();
|
if(fPBExists)
|
||||||
fBmax = BofZ.GetBmax();
|
return;
|
||||||
|
|
||||||
double BB;
|
fBmin = BofZ->GetBmin();
|
||||||
|
fBmax = BofZ->GetBmax();
|
||||||
|
|
||||||
// fill not used Bs before Bmin with 0.0
|
int a1(static_cast<int>(floor(fBmin/fDB)));
|
||||||
|
int a2(static_cast<int>(ceil(fBmin/fDB)));
|
||||||
|
int a3(static_cast<int>(floor(fBmax/fDB)));
|
||||||
|
int a4(static_cast<int>(ceil(fBmax/fDB)));
|
||||||
|
|
||||||
for (BB = 0.0; BB < fBmin; BB += fDB)
|
unsigned int firstZerosEnd ((a1 < a2) ? a1 : ((a1 > 0) ? (a1 - 1) : 0));
|
||||||
fB.push_back(BB);
|
unsigned int lastZerosStart ((a3 < a4) ? a4 : (a4 + 1));
|
||||||
fPB.resize(fB.size(),0.0);
|
|
||||||
|
|
||||||
unsigned int firstZerosEnd(fB.size());
|
unsigned int i;
|
||||||
|
|
||||||
// calculate p(B) from the inverse of B(z)
|
// calculate p(B) from the inverse of B(z)
|
||||||
|
|
||||||
for ( ; BB <= fBmax ; BB += fDB) {
|
for (i = firstZerosEnd; i <= lastZerosStart; i++) {
|
||||||
fB.push_back(BB);
|
|
||||||
fPB.push_back(0.0);
|
|
||||||
|
|
||||||
vector< pair<double, double> > inv;
|
vector< pair<double, double> > inv;
|
||||||
inv = BofZ.GetInverseAndDerivative(BB);
|
inv = BofZ->GetInverseAndDerivative(fB[i]);
|
||||||
|
|
||||||
for (unsigned int i(0); i<inv.size(); i++)
|
for (unsigned int j(0); j < inv.size(); j++)
|
||||||
*(fPB.end()-1) += dataTrimSP.GetNofZ(inv[i].first, para[2])*fabs(inv[i].second);
|
fPB[i] += dataTrimSP->GetNofZ(inv[j].first, para[2])*fabs(inv[j].second);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int lastZerosStart(fB.size());
|
|
||||||
|
|
||||||
// fill not used Bs after Bext with 0.0
|
|
||||||
|
|
||||||
double BmaxFFT(1.0/gBar/fDT);
|
|
||||||
|
|
||||||
for ( ; BB <= BmaxFFT ; BB += fDB )
|
|
||||||
fB.push_back(BB);
|
|
||||||
fPB.resize(fB.size(),0.0);
|
|
||||||
|
|
||||||
|
|
||||||
// make sure that we have an even number of elements in p(B) for FFT, so we do not have to care later
|
|
||||||
if (fB.size() % 2) {
|
|
||||||
fB.push_back(BB);
|
|
||||||
fPB.push_back(0.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// normalize p(B)
|
// normalize p(B)
|
||||||
@ -194,35 +203,35 @@ TPofBCalc::TPofBCalc( const TBofZCalcInverse &BofZ, const TTrimSPData &dataTrimS
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------
|
//-----------
|
||||||
// Constructor that does the P(B) calculation for given B(z) and n(z)
|
// Calculate-method that does the P(B) calculation for given B(z) and n(z)
|
||||||
// Parameters: dt[us], dB[G], Energy[keV]
|
// Parameters: dt[us], dB[G], Energy[keV]
|
||||||
//-----------
|
//-----------
|
||||||
|
|
||||||
TPofBCalc::TPofBCalc( const TBofZCalc &BofZ, const TTrimSPData &dataTrimSP, const vector<double> ¶, unsigned int zonk ) : fDT(para[0]), fDB(para[1]) {
|
void TPofBCalc::Calculate(const TBofZCalc *BofZ, const TTrimSPData *dataTrimSP, const vector<double> ¶, unsigned int zonk) {
|
||||||
|
|
||||||
fBmin = BofZ.GetBmin();
|
if(fPBExists)
|
||||||
fBmax = BofZ.GetBmax();
|
return;
|
||||||
|
|
||||||
|
fBmin = BofZ->GetBmin();
|
||||||
|
fBmax = BofZ->GetBmax();
|
||||||
|
|
||||||
|
int a1(static_cast<int>(floor(fBmin/fDB)));
|
||||||
|
int a2(static_cast<int>(ceil(fBmin/fDB)));
|
||||||
|
int a3(static_cast<int>(floor(fBmax/fDB)));
|
||||||
|
int a4(static_cast<int>(ceil(fBmax/fDB)));
|
||||||
|
|
||||||
|
unsigned int firstZerosEnd ((a1 < a2) ? a1 : ((a1 > 0) ? (a1 - 1) : 0));
|
||||||
|
unsigned int lastZerosStart ((a3 < a4) ? a4 : (a4 + 1));
|
||||||
|
|
||||||
double BB, BBnext;
|
double BB, BBnext;
|
||||||
double zm, zp, zNext, dz;
|
double zm, zp, zNext, dz;
|
||||||
|
|
||||||
// fill not used Bs before Bmin with 0.0
|
|
||||||
|
|
||||||
for (BB = 0.0; BB < fBmin; BB += fDB) {
|
|
||||||
fB.push_back(BB);
|
|
||||||
fPB.push_back(0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int firstZerosEnd(fB.size());
|
|
||||||
|
|
||||||
// calculate p(B) from B(z)
|
// calculate p(B) from B(z)
|
||||||
|
|
||||||
vector<double> bofzZ(BofZ.DataZ());
|
vector<double> *bofzZ = BofZ->DataZ();
|
||||||
vector<double> bofzBZ(BofZ.DataBZ());
|
vector<double> *bofzBZ = BofZ->DataBZ();
|
||||||
double ddZ(BofZ.GetDZ());
|
double ddZ(BofZ->GetDZ());
|
||||||
|
|
||||||
/* USED FOR DEBUGGING-----------------------------------
|
/* USED FOR DEBUGGING-----------------------------------
|
||||||
cout << "Bmin = " << fBmin << ", Bmax = " << fBmax << endl;
|
cout << "Bmin = " << fBmin << ", Bmax = " << fBmax << endl;
|
||||||
@ -281,19 +290,20 @@ TPofBCalc::TPofBCalc( const TBofZCalc &BofZ, const TTrimSPData &dataTrimSP, cons
|
|||||||
double nn;
|
double nn;
|
||||||
bool zNextFound(false);
|
bool zNextFound(false);
|
||||||
|
|
||||||
for ( ; BB <= fBmax ; BB += fDB) {
|
unsigned int i;
|
||||||
BBnext = BB + fDB;
|
|
||||||
fB.push_back(BB);
|
|
||||||
fPB.push_back(0.0);
|
|
||||||
|
|
||||||
for ( unsigned int j(0); j < bofzZ.size() - 1; j++ ) {
|
for (i = 0; i <= lastZerosStart; i++) {
|
||||||
if ( bofzBZ[j] >= BB && bofzBZ[j+1] <= BB ) {
|
BB = fB[i];
|
||||||
zm = (BB-bofzBZ[j])*ddZ/(bofzBZ[j+1]-bofzBZ[j]) + bofzZ[j];
|
BBnext = fB[i+1];
|
||||||
|
|
||||||
|
for ( unsigned int j(0); j < bofzZ->size() - 1; j++ ) {
|
||||||
|
if ( (*bofzBZ)[j] >= BB && (*bofzBZ)[j+1] <= BB ) {
|
||||||
|
zm = (BB-(*bofzBZ)[j])*ddZ/((*bofzBZ)[j+1]-(*bofzBZ)[j]) + (*bofzZ)[j];
|
||||||
|
|
||||||
for (unsigned int k(0); k < j; k++) {
|
for (unsigned int k(0); k < j; k++) {
|
||||||
if ( ( bofzBZ[j-k] <= BBnext && bofzBZ[j-k-1] >= BBnext ) ) {
|
if ( ( (*bofzBZ)[j-k] <= BBnext && (*bofzBZ)[j-k-1] >= BBnext ) ) {
|
||||||
// cout << "1 " << j << " " << k << endl;
|
// cout << "1 " << j << " " << k << endl;
|
||||||
zNext = (BBnext-bofzBZ[j-k-1])*ddZ/(bofzBZ[j-k]-bofzBZ[j-k-1]) + bofzZ[j-k-1];
|
zNext = (BBnext-(*bofzBZ)[j-k-1])*ddZ/((*bofzBZ)[j-k]-(*bofzBZ)[j-k-1]) + (*bofzZ)[j-k-1];
|
||||||
zNextFound = true;
|
zNextFound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -303,20 +313,20 @@ TPofBCalc::TPofBCalc( const TBofZCalc &BofZ, const TTrimSPData &dataTrimSP, cons
|
|||||||
zNextFound = false;
|
zNextFound = false;
|
||||||
|
|
||||||
dz = zNext-zm;
|
dz = zNext-zm;
|
||||||
nn = dataTrimSP.GetNofZ(zm, para[2]);
|
nn = dataTrimSP->GetNofZ(zm, para[2]);
|
||||||
if (nn != -1.0) {
|
if (nn != -1.0) {
|
||||||
// cout << "zNext = " << zNextm << ", zm = " << zm << ", dz = " << dz << endl;
|
// cout << "zNext = " << zNextm << ", zm = " << zm << ", dz = " << dz << endl;
|
||||||
*(fPB.end()-1) += nn*fabs(dz/fDB);
|
fPB[i] += nn*fabs(dz/fDB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (bofzBZ[j] <= BB && bofzBZ[j+1] >= BB ) {
|
} else if ((*bofzBZ)[j] <= BB && (*bofzBZ)[j+1] >= BB ) {
|
||||||
zp = (BB-bofzBZ[j])*ddZ/(bofzBZ[j+1]-bofzBZ[j]) + bofzZ[j];
|
zp = (BB-(*bofzBZ)[j])*ddZ/((*bofzBZ)[j+1]-(*bofzBZ)[j]) + (*bofzZ)[j];
|
||||||
|
|
||||||
for (unsigned int k(0); k < bofzZ.size() - j - 1; k++) {
|
for (unsigned int k(0); k < bofzZ->size() - j - 1; k++) {
|
||||||
if ( ( bofzBZ[j+k] <= BBnext && bofzBZ[j+k+1] >= BBnext ) ) {
|
if ( ( (*bofzBZ)[j+k] <= BBnext && (*bofzBZ)[j+k+1] >= BBnext ) ) {
|
||||||
// cout << "2 " << j << " " << k << endl;
|
// cout << "2 " << j << " " << k << endl;
|
||||||
zNext = (BBnext-bofzBZ[j+k])*ddZ/(bofzBZ[j+k+1]-bofzBZ[j+k]) + bofzZ[j+k];
|
zNext = (BBnext-(*bofzBZ)[j+k])*ddZ/((*bofzBZ)[j+k+1]-(*bofzBZ)[j+k]) + (*bofzZ)[j+k];
|
||||||
zNextFound = true;
|
zNextFound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -326,10 +336,10 @@ TPofBCalc::TPofBCalc( const TBofZCalc &BofZ, const TTrimSPData &dataTrimSP, cons
|
|||||||
zNextFound = false;
|
zNextFound = false;
|
||||||
|
|
||||||
dz = zNext-zp;
|
dz = zNext-zp;
|
||||||
nn = dataTrimSP.GetNofZ(zp, para[2]);
|
nn = dataTrimSP->GetNofZ(zp, para[2]);
|
||||||
if (nn != -1.0) {
|
if (nn != -1.0) {
|
||||||
// cout << "zNext = " << zNextp << ", zp = " << zp << ", dz = " << dz << endl;
|
// cout << "zNext = " << zNextp << ", zp = " << zp << ", dz = " << dz << endl;
|
||||||
*(fPB.end()-1) += nn*fabs(dz/fDB);
|
fPB[i] += nn*fabs(dz/fDB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -337,114 +347,90 @@ TPofBCalc::TPofBCalc( const TBofZCalc &BofZ, const TTrimSPData &dataTrimSP, cons
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int lastZerosStart(fB.size());
|
bofzZ = 0;
|
||||||
|
bofzBZ = 0;
|
||||||
// fill not used Bs after Bext with 0.0
|
|
||||||
|
|
||||||
double BmaxFFT(1.0/gBar/fDT);
|
|
||||||
|
|
||||||
// cout << "N = " << int(BmaxFFT/para[1]+1.0) << endl;
|
|
||||||
|
|
||||||
for ( ; BB <= BmaxFFT ; BB += fDB ) {
|
|
||||||
fB.push_back(BB);
|
|
||||||
fPB.push_back(0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure that we have an even number of elements in p(B) for FFT, so we do not have to care later
|
|
||||||
|
|
||||||
if (fB.size() % 2) {
|
|
||||||
fB.push_back(BB);
|
|
||||||
fPB.push_back(0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// cout << "size of B = " << fB.size() << ", size of p(B) = " << fPB.size() << endl;
|
|
||||||
|
|
||||||
// normalize p(B)
|
// normalize p(B)
|
||||||
|
|
||||||
double pBsum = 0.0;
|
double pBsum = 0.0;
|
||||||
for (unsigned int i(firstZerosEnd); i<lastZerosStart; i++)
|
for (unsigned int i(firstZerosEnd); i<=lastZerosStart; i++)
|
||||||
pBsum += fPB[i];
|
pBsum += fPB[i];
|
||||||
pBsum *= fDB;
|
pBsum *= fDB;
|
||||||
for (unsigned int i(firstZerosEnd); i<lastZerosStart; i++)
|
for (unsigned int i(firstZerosEnd); i<=lastZerosStart; i++)
|
||||||
fPB[i] /= pBsum;
|
fPB[i] /= pBsum;
|
||||||
|
|
||||||
|
fPBExists = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------
|
//-----------
|
||||||
// Constructor that does the P(B) calculation for a bulk vortex lattice
|
// Calculate method that does the P(B) calculation for a bulk vortex lattice
|
||||||
// Parameters: dt[us], dB[G] [, Bbg[G], width[us^{-1}], weight[1] ]
|
// Parameters: dt[us], dB[G] [, Bbg[G], width[us^{-1}], weight[1] ]
|
||||||
//-----------
|
//-----------
|
||||||
|
|
||||||
TPofBCalc::TPofBCalc( const TBulkVortexFieldCalc &vortexLattice, const vector<double> ¶ ) : fDT(para[0]), fDB(para[1])
|
void TPofBCalc::Calculate(const TBulkVortexFieldCalc *vortexLattice, const vector<double> ¶) {
|
||||||
{
|
|
||||||
|
|
||||||
fBmin = vortexLattice.GetBmin();
|
if(fPBExists)
|
||||||
fBmax = vortexLattice.GetBmax();
|
return;
|
||||||
|
|
||||||
unsigned int a1(static_cast<int>(floor(fBmin/fDB)));
|
fBmin = vortexLattice->GetBmin();
|
||||||
unsigned int a2(static_cast<int>(ceil(fBmin/fDB)));
|
fBmax = vortexLattice->GetBmax();
|
||||||
unsigned int a3(static_cast<int>(floor(fBmax/fDB)));
|
|
||||||
unsigned int a4(static_cast<int>(ceil(fBmax/fDB)));
|
|
||||||
|
|
||||||
unsigned int firstZerosEnd ((a1 != a2) ? a1 : (a1 - 1));
|
int a1(static_cast<int>(floor(fBmin/fDB)));
|
||||||
unsigned int lastZerosStart ((a3 != a4) ? a4 : (a4 + 1));
|
int a2(static_cast<int>(ceil(fBmin/fDB)));
|
||||||
|
int a3(static_cast<int>(floor(fBmax/fDB)));
|
||||||
|
int a4(static_cast<int>(ceil(fBmax/fDB)));
|
||||||
|
|
||||||
// fill the B vector
|
unsigned int firstZerosEnd ((a1 < a2) ? a1 : ((a1 > 0) ? (a1 - 1) : 0));
|
||||||
unsigned int indexBmaxFFT(static_cast<int>(ceil(1.0/(gBar*fDT*fDB))));
|
unsigned int lastZerosStart ((a3 < a4) ? a4 : (a4 + 1));
|
||||||
fB.resize(indexBmaxFFT, 0.0);
|
unsigned int numberOfSteps(vortexLattice->GetNumberOfSteps());
|
||||||
fPB.resize(indexBmaxFFT, 0.0);
|
unsigned int numberOfStepsSq(numberOfSteps*numberOfSteps);
|
||||||
|
unsigned int numberOfSteps_2(numberOfSteps/2);
|
||||||
|
unsigned int numberOfStepsSq_2(numberOfStepsSq/2);
|
||||||
|
|
||||||
|
if (lastZerosStart >= fPBSize)
|
||||||
|
lastZerosStart = fPBSize - 1;
|
||||||
|
|
||||||
|
// cout << endl << fBmin << " " << fBmax << " " << firstZerosEnd << " " << lastZerosStart << " " << numberOfPoints << endl;
|
||||||
|
|
||||||
|
if (!vortexLattice->GridExists()) {
|
||||||
|
vortexLattice->CalculateGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
double *vortexFields = vortexLattice->DataB();
|
||||||
|
unsigned int fill_index, counter(0);
|
||||||
|
|
||||||
|
for (unsigned int j(0); j < numberOfStepsSq_2; j++) {
|
||||||
|
fill_index = static_cast<unsigned int>(ceil(abs((vortexFields[j]/fDB))));
|
||||||
|
if (fill_index >= fPBSize)
|
||||||
|
fPB[fPBSize - 1] += 1.0;
|
||||||
|
else
|
||||||
|
fPB[fill_index] += 1.0;
|
||||||
|
counter++;
|
||||||
|
if (counter == numberOfSteps_2) { // sum only over the first quadrant of B(x,y)
|
||||||
|
counter = 0;
|
||||||
|
j += numberOfSteps_2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vortexFields = 0;
|
||||||
|
|
||||||
|
double normalizer(static_cast<double>(numberOfStepsSq_2/2)*fDB);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
#pragma omp parallel for default(shared) private(i) schedule(dynamic)
|
|
||||||
for (i = 0; i < static_cast<int>(indexBmaxFFT); i++)
|
|
||||||
fB[i] = fDB*static_cast<double>(i);
|
|
||||||
// end pragma omp parallel
|
|
||||||
|
|
||||||
// make sure that we have an even number of elements in p(B) for FFT, so we do not have to care later
|
|
||||||
if (fB.size() % 2) {
|
|
||||||
fB.push_back(*(fB.end()-1)+fDB);
|
|
||||||
fPB.push_back(0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
vector< vector<double> > vortexFields(vortexLattice.DataB());
|
|
||||||
|
|
||||||
if (vortexFields.empty()) {
|
|
||||||
vortexLattice.CalculateGrid();
|
|
||||||
vortexFields = vortexLattice.DataB();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int numberOfPoints(vortexFields.size());
|
|
||||||
|
|
||||||
for (unsigned int j(0); j < numberOfPoints; j++){
|
|
||||||
for (unsigned int k(0); k < numberOfPoints; k++){
|
|
||||||
fPB[static_cast<int>(ceil(vortexFields[j][k]/fDB))] += 1.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double normalizer(static_cast<double>(numberOfPoints*numberOfPoints)*fDB);
|
|
||||||
|
|
||||||
#pragma omp parallel for default(shared) private(i) schedule(dynamic)
|
#pragma omp parallel for default(shared) private(i) schedule(dynamic)
|
||||||
for (i = firstZerosEnd; i <= static_cast<int>(lastZerosStart); i++) {
|
for (i = firstZerosEnd; i <= static_cast<int>(lastZerosStart); i++) {
|
||||||
fPB[i] /= normalizer;
|
fPB[i] /= normalizer;
|
||||||
}
|
}
|
||||||
// end pragma omp parallel
|
// end pragma omp parallel
|
||||||
|
|
||||||
// // normalize p(B)
|
|
||||||
//
|
|
||||||
// double pBsum = 0.0;
|
|
||||||
// for (unsigned int i(firstZerosEnd); i<lastZerosStart; i++)
|
|
||||||
// pBsum += fPB[i];
|
|
||||||
// pBsum *= fDB;
|
|
||||||
// for (unsigned int i(firstZerosEnd); i<lastZerosStart; i++)
|
|
||||||
// fPB[i] /= pBsum;
|
|
||||||
|
|
||||||
if(para.size() == 5)
|
if(para.size() == 5)
|
||||||
AddBackground(para[2], para[3], para[4]);
|
AddBackground(para[2], para[3], para[4]);
|
||||||
|
|
||||||
|
fPBExists = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TPofBCalc::AddBackground, Parameters: field B[G], width s[us], weight w
|
// TPofBCalc::AddBackground, Parameters: field B[G], width s[us], weight w
|
||||||
|
|
||||||
void TPofBCalc::AddBackground(double B, double s, double w) {
|
void TPofBCalc::AddBackground(double B, double s, double w) {
|
||||||
@ -452,25 +438,24 @@ void TPofBCalc::AddBackground(double B, double s, double w) {
|
|||||||
if(!s || w<0.0 || w>1.0 || B<0.0)
|
if(!s || w<0.0 || w>1.0 || B<0.0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned int sizePB(fPB.size());
|
|
||||||
double BsSq(s*s/(gBar*gBar*4.0*pi*pi));
|
double BsSq(s*s/(gBar*gBar*4.0*pi*pi));
|
||||||
|
|
||||||
// calculate Gaussian background
|
// calculate Gaussian background
|
||||||
vector<double> bg;
|
double bg[fPBSize];
|
||||||
for(unsigned int i(0); i < sizePB; i++) {
|
for(unsigned int i(0); i < fPBSize; i++) {
|
||||||
bg.push_back(exp(-(fB[i]-B)*(fB[i]-B)/(2.0*BsSq)));
|
bg[i] = exp(-(fB[i]-B)*(fB[i]-B)/(2.0*BsSq));
|
||||||
}
|
}
|
||||||
|
|
||||||
// normalize background
|
// normalize background
|
||||||
double bgsum(0.0);
|
double bgsum(0.0);
|
||||||
for (unsigned int i(0); i < sizePB; i++)
|
for (unsigned int i(0); i < fPBSize; i++)
|
||||||
bgsum += bg[i];
|
bgsum += bg[i];
|
||||||
bgsum *= fDB;
|
bgsum *= fDB;
|
||||||
for (unsigned int i(0); i < sizePB; i++)
|
for (unsigned int i(0); i < fPBSize; i++)
|
||||||
bg[i] /= bgsum;
|
bg[i] /= bgsum;
|
||||||
|
|
||||||
// add background to P(B)
|
// add background to P(B)
|
||||||
for (unsigned int i(0); i < sizePB; i++)
|
for (unsigned int i(0); i < fPBSize; i++)
|
||||||
fPB[i] = (1.0 - w)*fPB[i] + w*bg[i];
|
fPB[i] = (1.0 - w)*fPB[i] + w*bg[i];
|
||||||
|
|
||||||
// // check if normalization is still valid
|
// // check if normalization is still valid
|
||||||
@ -487,30 +472,19 @@ void TPofBCalc::ConvolveGss(double w) {
|
|||||||
if(!w)
|
if(!w)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned int NFFT;
|
unsigned int NFFT(fPBSize);
|
||||||
double TBin;
|
double TBin;
|
||||||
fftw_plan FFTplanToTimeDomain;
|
fftw_plan FFTplanToTimeDomain;
|
||||||
fftw_plan FFTplanToFieldDomain;
|
fftw_plan FFTplanToFieldDomain;
|
||||||
fftw_complex *FFTout;
|
fftw_complex *FFTout;
|
||||||
double *FFTin;
|
|
||||||
|
|
||||||
NFFT = ( int(1.0/gBar/fDT/fDB+1.0) % 2 ) ? int(1.0/gBar/fDT/fDB+2.0) : int(1.0/gBar/fDT/fDB+1.0);
|
TBin = 1.0/(gBar*double(NFFT-1)*fDB);
|
||||||
TBin = 1.0/gBar/double(NFFT-1)/fDB;
|
|
||||||
|
|
||||||
FFTin = (double *)malloc(sizeof(double) * NFFT);
|
FFTout = new fftw_complex[NFFT/2 + 1]; //(fftw_complex *)fftw_malloc(sizeof(fftw_complex) * (NFFT/2+1));
|
||||||
FFTout = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * (NFFT/2+1));
|
|
||||||
|
|
||||||
// do the FFT to time domain
|
// do the FFT to time domain
|
||||||
|
|
||||||
FFTplanToTimeDomain = fftw_plan_dft_r2c_1d(NFFT, FFTin, FFTout, FFTW_ESTIMATE);
|
FFTplanToTimeDomain = fftw_plan_dft_r2c_1d(NFFT, fPB, FFTout, FFTW_ESTIMATE);
|
||||||
|
|
||||||
for (unsigned int i(0); i<NFFT; i++) {
|
|
||||||
FFTin[i] = fPB[i];
|
|
||||||
}
|
|
||||||
for (unsigned int i(0); i<NFFT/2+1; i++) {
|
|
||||||
FFTout[i][0] = 0.0;
|
|
||||||
FFTout[i][1] = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fftw_execute(FFTplanToTimeDomain);
|
fftw_execute(FFTplanToTimeDomain);
|
||||||
|
|
||||||
@ -519,37 +493,33 @@ void TPofBCalc::ConvolveGss(double w) {
|
|||||||
double GssInTimeDomain;
|
double GssInTimeDomain;
|
||||||
double expo(-2.0*PI*PI*gBar*gBar*w*w*TBin*TBin);
|
double expo(-2.0*PI*PI*gBar*gBar*w*w*TBin*TBin);
|
||||||
|
|
||||||
for (unsigned int i(0); i<NFFT/2+1; i++) {
|
for (unsigned int i(0); i < NFFT/2+1; i++) {
|
||||||
GssInTimeDomain = exp(expo*double(i)*double(i));
|
GssInTimeDomain = exp(expo*static_cast<double>(i*i));
|
||||||
FFTout[i][0] *= GssInTimeDomain;
|
FFTout[i][0] *= GssInTimeDomain;
|
||||||
FFTout[i][1] *= GssInTimeDomain;
|
FFTout[i][1] *= GssInTimeDomain;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FFT back to the field domain
|
// FFT back to the field domain
|
||||||
|
|
||||||
FFTplanToFieldDomain = fftw_plan_dft_c2r_1d(NFFT, FFTout, FFTin, FFTW_ESTIMATE);
|
FFTplanToFieldDomain = fftw_plan_dft_c2r_1d(NFFT, FFTout, fPB, FFTW_ESTIMATE);
|
||||||
|
|
||||||
fftw_execute(FFTplanToFieldDomain);
|
fftw_execute(FFTplanToFieldDomain);
|
||||||
|
|
||||||
for (unsigned int i(0); i<NFFT; i++) {
|
|
||||||
fPB[i] = FFTin[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
|
|
||||||
fftw_destroy_plan(FFTplanToTimeDomain);
|
fftw_destroy_plan(FFTplanToTimeDomain);
|
||||||
fftw_destroy_plan(FFTplanToFieldDomain);
|
fftw_destroy_plan(FFTplanToFieldDomain);
|
||||||
free(FFTin);
|
delete[] FFTout; // fftw_free(FFTout);
|
||||||
fftw_free(FFTout);
|
FFTout = 0;
|
||||||
// fftw_cleanup();
|
// fftw_cleanup();
|
||||||
|
|
||||||
// normalize p(B)
|
// normalize p(B)
|
||||||
|
|
||||||
double pBsum = 0.0;
|
double pBsum = 0.0;
|
||||||
for (unsigned int i(0); i<NFFT; i++)
|
for (unsigned int i(0); i < NFFT; i++)
|
||||||
pBsum += fPB[i];
|
pBsum += fPB[i];
|
||||||
pBsum *= fDB;
|
pBsum *= fDB;
|
||||||
for (unsigned int i(0); i<NFFT; i++)
|
for (unsigned int i(0); i < NFFT; i++)
|
||||||
fPB[i] /= pBsum;
|
fPB[i] /= pBsum;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
182
src/external/TFitPofB-lib/classes/TPofTCalc.cpp
vendored
182
src/external/TFitPofB-lib/classes/TPofTCalc.cpp
vendored
@ -16,8 +16,8 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2008 by Andreas Suter *
|
* Copyright (C) 2008-2009 by Bastian M. Wojek, Andreas Suter *
|
||||||
* andreas.suter@psi.ch *
|
* *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* 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 *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
@ -63,7 +63,7 @@
|
|||||||
// Parameters: phase, dt, dB
|
// Parameters: phase, dt, dB
|
||||||
//------------------
|
//------------------
|
||||||
|
|
||||||
TPofTCalc::TPofTCalc (const string &wisdom, const vector<double> &par) : fWisdom(wisdom) {
|
TPofTCalc::TPofTCalc (const TPofBCalc *PofB, const string &wisdom, const vector<double> &par) : fWisdom(wisdom) {
|
||||||
|
|
||||||
int init_threads(fftw_init_threads());
|
int init_threads(fftw_init_threads());
|
||||||
if (!init_threads)
|
if (!init_threads)
|
||||||
@ -71,88 +71,95 @@ TPofTCalc::TPofTCalc (const string &wisdom, const vector<double> &par) : fWisdom
|
|||||||
else
|
else
|
||||||
fftw_plan_with_nthreads(2);
|
fftw_plan_with_nthreads(2);
|
||||||
|
|
||||||
fNFFT = ( int(1.0/gBar/par[1]/par[2]+1.0) % 2 ) ? int(1.0/gBar/par[1]/par[2]+2.0) : int(1.0/gBar/par[1]/par[2]+1.0);
|
fNFFT = static_cast<int>(1.0/(gBar*par[1]*par[2]));
|
||||||
fTBin = 1.0/gBar/double(fNFFT-1)/par[2];
|
if (fNFFT % 2) {
|
||||||
|
fNFFT += 1;
|
||||||
|
} else {
|
||||||
|
fNFFT += 2;
|
||||||
|
}
|
||||||
|
|
||||||
fT.resize(fNFFT/2+1);
|
fTBin = 1.0/(gBar*double(fNFFT-1)*par[2]);
|
||||||
fPT.resize(fNFFT/2+1);
|
|
||||||
|
int NFFT_2p1(fNFFT/2 + 1);
|
||||||
|
|
||||||
|
// allocating memory for the time- and polarisation vectors
|
||||||
|
|
||||||
|
fT = new double[NFFT_2p1]; //static_cast<double *>(malloc(sizeof(double) * NFFT_2p1));
|
||||||
|
fPT = new double[NFFT_2p1]; //static_cast<double *>(malloc(sizeof(double) * NFFT_2p1));
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#pragma omp parallel for default(shared) private(i) schedule(dynamic)
|
#pragma omp parallel for default(shared) private(i) schedule(dynamic)
|
||||||
for (i=0; i<fNFFT/2+1; i++){
|
for (i = 0; i < NFFT_2p1; i++) {
|
||||||
fT[i] = double(i)*fTBin;
|
fT[i] = static_cast<double>(i)*fTBin;
|
||||||
}
|
}
|
||||||
|
|
||||||
fFFTin = (double *)malloc(sizeof(double) * fNFFT);
|
fFFTin = PofB->DataPB();
|
||||||
fFFTout = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * (fNFFT/2+1));
|
fFFTout = new fftw_complex[NFFT_2p1]; //static_cast<fftw_complex *>(fftw_malloc(sizeof(fftw_complex) * NFFT_2p1));
|
||||||
|
|
||||||
cout << "TPofTCalc::TPofTCalc: Check for the FFT plan..." << endl;
|
// Load wisdom from file if it exists and should be used
|
||||||
|
|
||||||
// Load wisdom from file
|
|
||||||
|
|
||||||
|
fUseWisdom = true;
|
||||||
int wisdomLoaded(0);
|
int wisdomLoaded(0);
|
||||||
|
|
||||||
FILE *wordsOfWisdomR;
|
FILE *wordsOfWisdomR;
|
||||||
wordsOfWisdomR = fopen(fWisdom.c_str(), "r");
|
wordsOfWisdomR = fopen(wisdom.c_str(), "r");
|
||||||
if (wordsOfWisdomR == NULL) {
|
if (wordsOfWisdomR == NULL) {
|
||||||
cout << "TPofTCalc::TPofTCalc: Couldn't open wisdom file ..." << endl;
|
fUseWisdom = false;
|
||||||
} else {
|
} else {
|
||||||
wisdomLoaded = fftw_import_wisdom_from_file(wordsOfWisdomR);
|
wisdomLoaded = fftw_import_wisdom_from_file(wordsOfWisdomR);
|
||||||
fclose(wordsOfWisdomR);
|
fclose(wordsOfWisdomR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wisdomLoaded) {
|
if (!wisdomLoaded) {
|
||||||
cout << "TPofTCalc::TPofTCalc: No wisdom is imported..." << endl;
|
fUseWisdom = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fFFTplan = fftw_plan_dft_r2c_1d(fNFFT, fFFTin, fFFTout, FFTW_EXHAUSTIVE);
|
// create the FFT plan
|
||||||
|
|
||||||
// cout << &fFFTplan << endl;
|
if (fUseWisdom)
|
||||||
|
fFFTplan = fftw_plan_dft_r2c_1d(fNFFT, fFFTin, fFFTout, FFTW_EXHAUSTIVE);
|
||||||
|
else
|
||||||
|
fFFTplan = fftw_plan_dft_r2c_1d(fNFFT, fFFTin, fFFTout, FFTW_ESTIMATE);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------
|
||||||
|
// Destructor of the TPofTCalc class - it saves the FFT plan and cleans up
|
||||||
|
//---------------------
|
||||||
|
|
||||||
|
TPofTCalc::~TPofTCalc() {
|
||||||
|
// if a wisdom file is used export the wisdom so it has not to be checked for the FFT-plan next time
|
||||||
|
if (fUseWisdom) {
|
||||||
|
FILE *wordsOfWisdomW;
|
||||||
|
wordsOfWisdomW = fopen(fWisdom.c_str(), "w");
|
||||||
|
if (wordsOfWisdomW == NULL) {
|
||||||
|
cout << "TPofTCalc::~TPofTCalc(): Could not open file ... No wisdom is exported..." << endl;
|
||||||
|
} else {
|
||||||
|
fftw_export_wisdom_to_file(wordsOfWisdomW);
|
||||||
|
fclose(wordsOfWisdomW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
|
||||||
|
fftw_destroy_plan(fFFTplan);
|
||||||
|
delete[] fFFTout; //fftw_free(fFFTout);
|
||||||
|
fFFTout = 0;
|
||||||
|
// fftw_cleanup();
|
||||||
|
// fftw_cleanup_threads();
|
||||||
|
|
||||||
|
delete[] fT;
|
||||||
|
fT = 0;
|
||||||
|
delete[] fPT;
|
||||||
|
fPT = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------
|
//--------------
|
||||||
// Method that does the FFT of a given p(B)
|
// Method that does the FFT of a given p(B)
|
||||||
//--------------
|
//--------------
|
||||||
|
|
||||||
void TPofTCalc::DoFFT(const TPofBCalc &PofB) {
|
void TPofTCalc::DoFFT() {
|
||||||
|
|
||||||
vector<double> pB(PofB.DataPB());
|
|
||||||
|
|
||||||
/* USED FOR DEBUGGING -----------------------
|
|
||||||
|
|
||||||
time_t seconds;
|
|
||||||
seconds = time(NULL);
|
|
||||||
|
|
||||||
vector<double> B(PofB.DataB());
|
|
||||||
double Bmin(PofB.GetBmin());
|
|
||||||
|
|
||||||
char debugfile[50];
|
|
||||||
int n = sprintf (debugfile, "test_PB_%ld_%f.dat", seconds, Bmin);
|
|
||||||
|
|
||||||
if (n > 0) {
|
|
||||||
ofstream of(debugfile);
|
|
||||||
|
|
||||||
for (unsigned int i(0); i<B.size(); i++) {
|
|
||||||
of << B[i] << " " << pB[i] << endl;
|
|
||||||
}
|
|
||||||
of.close();
|
|
||||||
}
|
|
||||||
/--------------------------------------------*/
|
|
||||||
|
|
||||||
int i;
|
|
||||||
|
|
||||||
#pragma omp parallel for default(shared) private(i) schedule(dynamic)
|
|
||||||
for (i=0; i<fNFFT; i++) {
|
|
||||||
fFFTin[i] = pB[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// for (unsigned int i(0); i<fNFFT/2+1; i++) {
|
|
||||||
// fFFTout[i][0] = 0.0;
|
|
||||||
// fFFTout[i][1] = 0.0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// cout << "perform the Fourier transform..." << endl;
|
|
||||||
|
|
||||||
fftw_execute(fFFTplan);
|
fftw_execute(fFFTplan);
|
||||||
|
|
||||||
@ -170,11 +177,26 @@ void TPofTCalc::CalcPol(const vector<double> &par) {
|
|||||||
|
|
||||||
#pragma omp parallel for default(shared) private(i) schedule(dynamic)
|
#pragma omp parallel for default(shared) private(i) schedule(dynamic)
|
||||||
for (i=0; i<fNFFT/2+1; i++){
|
for (i=0; i<fNFFT/2+1; i++){
|
||||||
// fT[i] = double(i)*fTBin;
|
|
||||||
fPT[i] = cosph*fFFTout[i][0]*par[2] + sinph*fFFTout[i][1]*par[2];
|
fPT[i] = cosph*fFFTout[i][0]*par[2] + sinph*fFFTout[i][1]*par[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------
|
||||||
|
// Method for evaluating P(t) at a given t
|
||||||
|
//---------------------
|
||||||
|
|
||||||
|
double TPofTCalc::Eval(double t) const {
|
||||||
|
|
||||||
|
int i(static_cast<int>(t/fTBin));
|
||||||
|
if (i < fNFFT/2){
|
||||||
|
return fPT[i]+(fPT[i+1]-fPT[i])/(fT[i+1]-fT[i])*(t-fT[i]);
|
||||||
|
}
|
||||||
|
cout << "TPofTCalc::Eval: No data for the time " << t << " us available! Returning -999.0 ..." << endl;
|
||||||
|
return -999.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------
|
//---------------------
|
||||||
// Method for generating fake LEM decay histograms from p(B)
|
// Method for generating fake LEM decay histograms from p(B)
|
||||||
// Parameters: output filename, par(dt, dB, timeres, channels, asyms, phases, t0s, N0s, bgs)
|
// Parameters: output filename, par(dt, dB, timeres, channels, asyms, phases, t0s, N0s, bgs)
|
||||||
@ -381,49 +403,5 @@ void TPofTCalc::FakeData(const string &rootOutputFileName, const vector<double>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------
|
|
||||||
// Method for evaluating P(t) at a given t
|
|
||||||
//---------------------
|
|
||||||
|
|
||||||
double TPofTCalc::Eval(double t) const {
|
|
||||||
|
|
||||||
unsigned int i(int(t/fTBin));
|
|
||||||
if (i<fT.size()-1)
|
|
||||||
return fPT[i]+(fPT[i+1]-fPT[i])/(fT[i+1]-fT[i])*(t-fT[i]);
|
|
||||||
|
|
||||||
// for (unsigned int i(0); i<fT.size()-1; i++) {
|
|
||||||
// if (t < fT[i+1])
|
|
||||||
// return fPT[i]+(fPT[i+1]-fPT[i])/(fT[i+1]-fT[i])*(t-fT[i]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
cout << "TPofTCalc::Eval: No data for the time " << t << " us available! Returning -999.0 ..." << endl;
|
|
||||||
return -999.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------
|
|
||||||
// Destructor of the TPofTCalc class - it saves the FFT plan and cleans up
|
|
||||||
//---------------------
|
|
||||||
|
|
||||||
TPofTCalc::~TPofTCalc() {
|
|
||||||
// export wisdom so it has not to be checked for the FFT-plan next time
|
|
||||||
|
|
||||||
FILE *wordsOfWisdomW;
|
|
||||||
wordsOfWisdomW = fopen(fWisdom.c_str(), "w");
|
|
||||||
if (wordsOfWisdomW == NULL) {
|
|
||||||
cout << "TPofTCalc::~TPofTCalc(): Could not open file ... No wisdom is exported..." << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
fftw_export_wisdom_to_file(wordsOfWisdomW);
|
|
||||||
|
|
||||||
fclose(wordsOfWisdomW);
|
|
||||||
|
|
||||||
fftw_destroy_plan(fFFTplan);
|
|
||||||
free(fFFTin);
|
|
||||||
fftw_free(fFFTout);
|
|
||||||
// fftw_cleanup();
|
|
||||||
// fftw_cleanup_threads();
|
|
||||||
fT.clear();
|
|
||||||
fPT.clear();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
33
src/external/TFitPofB-lib/classes/TSkewedGss.cpp
vendored
33
src/external/TFitPofB-lib/classes/TSkewedGss.cpp
vendored
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 "TSkewedGss.h"
|
#include "TSkewedGss.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -27,6 +47,8 @@ TSkewedGss::~TSkewedGss() {
|
|||||||
fPar.clear();
|
fPar.clear();
|
||||||
fParForPofB.clear();
|
fParForPofB.clear();
|
||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
|
delete fPofB;
|
||||||
|
fPofB = 0;
|
||||||
delete fPofT;
|
delete fPofT;
|
||||||
fPofT = 0;
|
fPofT = 0;
|
||||||
}
|
}
|
||||||
@ -61,10 +83,13 @@ TSkewedGss::TSkewedGss() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
fParForPofB.push_back(0.0); // s-
|
fParForPofB.push_back(0.0); // s-
|
||||||
fParForPofB.push_back(0.0); // s+
|
fParForPofB.push_back(0.0); // s+
|
||||||
|
|
||||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
TPofBCalc *x = new TPofBCalc(fParForPofB);
|
||||||
|
fPofB = x;
|
||||||
|
x = 0;
|
||||||
|
|
||||||
|
TPofTCalc *y = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
||||||
fPofT = y;
|
fPofT = y;
|
||||||
y = 0;
|
y = 0;
|
||||||
delete y;
|
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
if (saxParser) {
|
if (saxParser) {
|
||||||
@ -131,8 +156,8 @@ double TSkewedGss::operator()(double t, const vector<double> &par) const {
|
|||||||
fParForPofB[3] = par[2]; // sigma-
|
fParForPofB[3] = par[2]; // sigma-
|
||||||
fParForPofB[4] = par[3]; // sigma+
|
fParForPofB[4] = par[3]; // sigma+
|
||||||
|
|
||||||
TPofBCalc PofB("skg", fParForPofB);
|
fPofB->Calculate("skg", fParForPofB);
|
||||||
fPofT->DoFFT(PofB);
|
fPofT->DoFFT();
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||||
|
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 "TTrimSPDataHandler.h"
|
#include "TTrimSPDataHandler.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
63
src/external/TFitPofB-lib/classes/TVortex.cpp
vendored
63
src/external/TFitPofB-lib/classes/TVortex.cpp
vendored
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 "TVortex.h"
|
#include "TVortex.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -25,12 +45,16 @@ ClassImp(TBulkTriVortexLondon)
|
|||||||
//------------------
|
//------------------
|
||||||
|
|
||||||
TBulkTriVortexLondon::~TBulkTriVortexLondon() {
|
TBulkTriVortexLondon::~TBulkTriVortexLondon() {
|
||||||
|
delete fPofT;
|
||||||
|
fPofT = 0;
|
||||||
|
delete fPofB;
|
||||||
|
fPofT = 0;
|
||||||
|
delete fVortex;
|
||||||
|
fVortex = 0;
|
||||||
fPar.clear();
|
fPar.clear();
|
||||||
fParForVortex.clear();
|
fParForVortex.clear();
|
||||||
fParForPofB.clear();
|
fParForPofB.clear();
|
||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fPofT;
|
|
||||||
fPofT = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------
|
//------------------
|
||||||
@ -54,9 +78,8 @@ TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(tru
|
|||||||
|
|
||||||
fGridSteps = startupHandler->GetGridSteps();
|
fGridSteps = startupHandler->GetGridSteps();
|
||||||
fWisdom = startupHandler->GetWisdomFile();
|
fWisdom = startupHandler->GetWisdomFile();
|
||||||
fVortexFourierComp = startupHandler->GetVortexFourierComp();
|
|
||||||
|
|
||||||
fParForVortex.clear();
|
fParForVortex.resize(3); // field, lambda, xi
|
||||||
|
|
||||||
fParForPofT.push_back(0.0);
|
fParForPofT.push_back(0.0);
|
||||||
fParForPofT.push_back(startupHandler->GetDeltat());
|
fParForPofT.push_back(startupHandler->GetDeltat());
|
||||||
@ -69,10 +92,18 @@ TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(tru
|
|||||||
fParForPofB.push_back(0.005); // Bkg-width
|
fParForPofB.push_back(0.005); // Bkg-width
|
||||||
fParForPofB.push_back(0.0); // Bkg-weight
|
fParForPofB.push_back(0.0); // Bkg-weight
|
||||||
|
|
||||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
TBulkTriVortexLondonFieldCalc *x = new TBulkTriVortexLondonFieldCalc(fWisdom, fGridSteps);
|
||||||
fPofT = y;
|
fVortex = x;
|
||||||
|
x = 0;
|
||||||
|
|
||||||
|
TPofBCalc *y = new TPofBCalc(fParForPofB);
|
||||||
|
fPofB = y;
|
||||||
y = 0;
|
y = 0;
|
||||||
|
|
||||||
|
TPofTCalc *z = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
||||||
|
fPofT = z;
|
||||||
|
z = 0;
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
if (saxParser) {
|
if (saxParser) {
|
||||||
delete saxParser;
|
delete saxParser;
|
||||||
@ -87,7 +118,7 @@ TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(tru
|
|||||||
//------------------
|
//------------------
|
||||||
// TBulkTriVortexLondon-Method that calls the procedures to create B(x,y), p(B) and P(t)
|
// TBulkTriVortexLondon-Method that calls the procedures to create B(x,y), p(B) and P(t)
|
||||||
// It finally returns P(t) for a given t.
|
// It finally returns P(t) for a given t.
|
||||||
// Parameters: all the parameters for the function to be fitted through TBulkTriVortexLondon (phase, appl.field, lambda, xi)
|
// Parameters: all the parameters for the function to be fitted through TBulkTriVortexLondon (phase, appl.field, lambda, xi, [not implemented: bkg weight])
|
||||||
//------------------
|
//------------------
|
||||||
|
|
||||||
double TBulkTriVortexLondon::operator()(double t, const vector<double> &par) const {
|
double TBulkTriVortexLondon::operator()(double t, const vector<double> &par) const {
|
||||||
@ -102,8 +133,8 @@ double TBulkTriVortexLondon::operator()(double t, const vector<double> &par) con
|
|||||||
if(fFirstCall){
|
if(fFirstCall){
|
||||||
fPar = par;
|
fPar = par;
|
||||||
|
|
||||||
for (unsigned int i(1); i < 4; i++){
|
for (unsigned int i(0); i < 3; i++){
|
||||||
fParForVortex.push_back(fPar[i]);
|
fParForVortex[i] = fPar[i+1];
|
||||||
}
|
}
|
||||||
fFirstCall = false;
|
fFirstCall = false;
|
||||||
}
|
}
|
||||||
@ -138,16 +169,18 @@ double TBulkTriVortexLondon::operator()(double t, const vector<double> &par) con
|
|||||||
|
|
||||||
// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl;
|
// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl;
|
||||||
|
|
||||||
fParForVortex[0] = par[2]; // lambda
|
for (unsigned int i(0); i < 3; i++) {
|
||||||
fParForVortex[1] = par[3]; // xi
|
fParForVortex[i] = par[i+1];
|
||||||
fParForVortex[2] = par[1]; // field
|
}
|
||||||
|
|
||||||
fParForPofB[2] = par[1]; // Bkg-Field
|
fParForPofB[2] = par[1]; // Bkg-Field
|
||||||
//fParForPofB[3] = 0.005; // Bkg-width (in principle zero)
|
//fParForPofB[3] = 0.005; // Bkg-width (in principle zero)
|
||||||
|
|
||||||
TBulkTriVortexLondonFieldCalc vortexLattice(fParForVortex, fGridSteps, fVortexFourierComp);
|
fVortex->SetParameters(fParForVortex);
|
||||||
TPofBCalc PofB(vortexLattice, fParForPofB);
|
fVortex->CalculateGrid();
|
||||||
fPofT->DoFFT(PofB);
|
fPofB->UnsetPBExists();
|
||||||
|
fPofB->Calculate(fVortex, fParForPofB);
|
||||||
|
fPofT->DoFFT();
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||||
|
28
src/external/TFitPofB-lib/include/TBofZCalc.h
vendored
28
src/external/TFitPofB-lib/include/TBofZCalc.h
vendored
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 _TBofZCalc_H_
|
#ifndef _TBofZCalc_H_
|
||||||
#define _TBofZCalc_H_
|
#define _TBofZCalc_H_
|
||||||
|
|
||||||
@ -31,8 +51,8 @@ public:
|
|||||||
fParam.clear();
|
fParam.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual vector<double> DataZ() const {return fZ;}
|
virtual vector<double>* DataZ() const {return &fZ;}
|
||||||
virtual vector<double> DataBZ() const {return fBZ;}
|
virtual vector<double>* DataBZ() const {return &fBZ;}
|
||||||
virtual void Calculate();
|
virtual void Calculate();
|
||||||
virtual double GetBofZ(double) const = 0;
|
virtual double GetBofZ(double) const = 0;
|
||||||
virtual double GetBmin() const = 0;
|
virtual double GetBmin() const = 0;
|
||||||
@ -43,8 +63,8 @@ protected:
|
|||||||
int fSteps;
|
int fSteps;
|
||||||
double fDZ;
|
double fDZ;
|
||||||
vector<double> fParam;
|
vector<double> fParam;
|
||||||
vector<double> fZ;
|
mutable vector<double> fZ;
|
||||||
vector<double> fBZ;
|
mutable vector<double> fBZ;
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
|
@ -9,12 +9,35 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 _TBulkVortexFieldCalc_H_
|
#ifndef _TBulkVortexFieldCalc_H_
|
||||||
#define _TBulkVortexFieldCalc_H_
|
#define _TBulkVortexFieldCalc_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#include <fftw3.h>
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Base class for any kind of vortex symmetry
|
// Base class for any kind of vortex symmetry
|
||||||
//--------------------
|
//--------------------
|
||||||
@ -25,43 +48,43 @@ public:
|
|||||||
|
|
||||||
TBulkVortexFieldCalc() {}
|
TBulkVortexFieldCalc() {}
|
||||||
|
|
||||||
virtual ~TBulkVortexFieldCalc() {
|
virtual ~TBulkVortexFieldCalc();
|
||||||
for(unsigned int i(0); i < fB.size(); i++)
|
|
||||||
fB[i].clear();
|
|
||||||
fB.clear();
|
|
||||||
fParam.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual vector< vector<double> > DataB() const {return fB;}
|
virtual double* DataB() const {return fFFTout;}
|
||||||
|
virtual void SetParameters(const vector<double>& par) {fParam = par; fGridExists = false;}
|
||||||
virtual void CalculateGrid() const = 0;
|
virtual void CalculateGrid() const = 0;
|
||||||
virtual double GetBatPoint(double, double) const = 0;
|
|
||||||
virtual double GetBmin() const = 0;
|
virtual double GetBmin() const = 0;
|
||||||
virtual double GetBmax() const = 0;
|
virtual double GetBmax() const = 0;
|
||||||
|
virtual bool GridExists() const {return fGridExists;}
|
||||||
|
virtual void UnsetGridExists() const {fGridExists = false;}
|
||||||
|
virtual unsigned int GetNumberOfSteps() const {return fSteps;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
vector<double> fParam;
|
||||||
unsigned int fSteps; // number of steps, the "unit cell" of the vortex lattice is devided in (in x- and y- direction)
|
unsigned int fSteps; // number of steps, the "unit cell" of the vortex lattice is devided in (in x- and y- direction)
|
||||||
vector<double> fParam; // lambda, xi, appl.field
|
fftw_complex *fFFTin; // Fourier components of the field
|
||||||
mutable vector< vector<double> > fB; // fields in a "unit cell" of the vortex lattice
|
double *fFFTout; // fields in a "unit cell" of the vortex lattice
|
||||||
|
fftw_plan fFFTplan;
|
||||||
|
bool fUseWisdom;
|
||||||
|
string fWisdom;
|
||||||
|
mutable bool fGridExists;
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Class for triangular vortex lattice, London model
|
// Class for triangular vortex lattice, London model with Gaussian Cutoff
|
||||||
//--------------------
|
//--------------------
|
||||||
|
|
||||||
class TBulkTriVortexLondonFieldCalc : public TBulkVortexFieldCalc {
|
class TBulkTriVortexLondonFieldCalc : public TBulkVortexFieldCalc {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TBulkTriVortexLondonFieldCalc(const vector<double>&, const unsigned int steps = 200, const unsigned int Ncomp = 17);
|
TBulkTriVortexLondonFieldCalc(const string&, const unsigned int steps = 256);
|
||||||
~TBulkTriVortexLondonFieldCalc() {}
|
~TBulkTriVortexLondonFieldCalc() {}
|
||||||
|
|
||||||
void CalculateGrid() const;
|
void CalculateGrid() const;
|
||||||
double GetBatPoint(double, double) const;
|
|
||||||
double GetBmin() const;
|
double GetBmin() const;
|
||||||
double GetBmax() const;
|
double GetBmax() const;
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned int fNFourierComp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _TBulkVortexFieldCalc_H_
|
#endif // _TBulkVortexFieldCalc_H_
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
TLondon1DLinkDef.h
|
TFitPofBStartupHandlerLinkDef.h
|
||||||
|
|
||||||
Author: Bastian M. Wojek
|
Author: Bastian M. Wojek
|
||||||
e-mail: bastian.wojek@psi.ch
|
e-mail: bastian.wojek@psi.ch
|
||||||
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
// root dictionary stuff --------------------------------------------------
|
// root dictionary stuff --------------------------------------------------
|
||||||
#ifdef __CINT__
|
#ifdef __CINT__
|
||||||
|
|
||||||
|
28
src/external/TFitPofB-lib/include/TLondon1D.h
vendored
28
src/external/TFitPofB-lib/include/TLondon1D.h
vendored
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 _TLondon1D_H_
|
#ifndef _TLondon1D_H_
|
||||||
#define _TLondon1D_H_
|
#define _TLondon1D_H_
|
||||||
|
|
||||||
@ -27,6 +47,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
mutable vector<double> fPar;
|
mutable vector<double> fPar;
|
||||||
TTrimSPData *fImpProfile;
|
TTrimSPData *fImpProfile;
|
||||||
|
TPofBCalc *fPofB;
|
||||||
TPofTCalc *fPofT;
|
TPofTCalc *fPofT;
|
||||||
mutable bool fCalcNeeded;
|
mutable bool fCalcNeeded;
|
||||||
mutable bool fFirstCall;
|
mutable bool fFirstCall;
|
||||||
@ -51,6 +72,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
mutable vector<double> fPar;
|
mutable vector<double> fPar;
|
||||||
TTrimSPData *fImpProfile;
|
TTrimSPData *fImpProfile;
|
||||||
|
TPofBCalc *fPofB;
|
||||||
TPofTCalc *fPofT;
|
TPofTCalc *fPofT;
|
||||||
mutable bool fCalcNeeded;
|
mutable bool fCalcNeeded;
|
||||||
mutable bool fFirstCall;
|
mutable bool fFirstCall;
|
||||||
@ -76,6 +98,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
mutable vector<double> fPar;
|
mutable vector<double> fPar;
|
||||||
TTrimSPData *fImpProfile;
|
TTrimSPData *fImpProfile;
|
||||||
|
TPofBCalc *fPofB;
|
||||||
TPofTCalc *fPofT;
|
TPofTCalc *fPofT;
|
||||||
mutable bool fCalcNeeded;
|
mutable bool fCalcNeeded;
|
||||||
mutable bool fFirstCall;
|
mutable bool fFirstCall;
|
||||||
@ -101,6 +124,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
mutable vector<double> fPar;
|
mutable vector<double> fPar;
|
||||||
TTrimSPData *fImpProfile;
|
TTrimSPData *fImpProfile;
|
||||||
|
TPofBCalc *fPofB;
|
||||||
TPofTCalc *fPofT;
|
TPofTCalc *fPofT;
|
||||||
mutable bool fCalcNeeded;
|
mutable bool fCalcNeeded;
|
||||||
mutable bool fFirstCall;
|
mutable bool fFirstCall;
|
||||||
@ -125,6 +149,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
mutable vector<double> fPar;
|
mutable vector<double> fPar;
|
||||||
TTrimSPData *fImpProfile;
|
TTrimSPData *fImpProfile;
|
||||||
|
TPofBCalc *fPofB;
|
||||||
TPofTCalc *fPofT;
|
TPofTCalc *fPofT;
|
||||||
mutable bool fCalcNeeded;
|
mutable bool fCalcNeeded;
|
||||||
mutable bool fFirstCall;
|
mutable bool fFirstCall;
|
||||||
@ -150,6 +175,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
mutable vector<double> fPar;
|
mutable vector<double> fPar;
|
||||||
TTrimSPData *fImpProfile;
|
TTrimSPData *fImpProfile;
|
||||||
|
TPofBCalc *fPofB;
|
||||||
TPofTCalc *fPofT;
|
TPofTCalc *fPofT;
|
||||||
mutable bool fCalcNeeded;
|
mutable bool fCalcNeeded;
|
||||||
mutable bool fFirstCall;
|
mutable bool fFirstCall;
|
||||||
@ -176,6 +202,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
mutable vector<double> fPar;
|
mutable vector<double> fPar;
|
||||||
TTrimSPData *fImpProfile;
|
TTrimSPData *fImpProfile;
|
||||||
|
TPofBCalc *fPofB;
|
||||||
TPofTCalc *fPofT;
|
TPofTCalc *fPofT;
|
||||||
mutable bool fCalcNeeded;
|
mutable bool fCalcNeeded;
|
||||||
mutable bool fFirstCall;
|
mutable bool fFirstCall;
|
||||||
@ -226,6 +253,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
mutable vector<double> fPar;
|
mutable vector<double> fPar;
|
||||||
TTrimSPData *fImpProfile;
|
TTrimSPData *fImpProfile;
|
||||||
|
TPofBCalc *fPofB;
|
||||||
TPofTCalc *fPofT;
|
TPofTCalc *fPofT;
|
||||||
mutable bool fCalcNeeded;
|
mutable bool fCalcNeeded;
|
||||||
mutable bool fFirstCall;
|
mutable bool fFirstCall;
|
||||||
|
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
// root dictionary stuff --------------------------------------------------
|
// root dictionary stuff --------------------------------------------------
|
||||||
#ifdef __CINT__
|
#ifdef __CINT__
|
||||||
|
|
||||||
|
50
src/external/TFitPofB-lib/include/TPofBCalc.h
vendored
50
src/external/TFitPofB-lib/include/TPofBCalc.h
vendored
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 _TPofBCalc_H_
|
#ifndef _TPofBCalc_H_
|
||||||
#define _TPofBCalc_H_
|
#define _TPofBCalc_H_
|
||||||
|
|
||||||
@ -23,30 +43,38 @@ class TPofBCalc {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TPofBCalc( const string&, const vector<double>& );
|
// standard constructor: allocates memory for B and PB, the arrays are filled later by one of the Calculate-methods
|
||||||
TPofBCalc( const TBofZCalc&, const TTrimSPData&, const vector<double>&, unsigned int );
|
TPofBCalc(const vector<double>&);
|
||||||
TPofBCalc( const TBofZCalcInverse&, const TTrimSPData&, const vector<double>& );
|
// alternative constructor: PB is not actually calculated but copied from a vector
|
||||||
TPofBCalc( const TBulkVortexFieldCalc&, const vector<double>& );
|
TPofBCalc(const vector<double>&, const vector<double>& , double dt = 0.01);
|
||||||
TPofBCalc( const vector<double>&, const vector<double>& , double dt = 0.01 );
|
|
||||||
~TPofBCalc() {
|
~TPofBCalc() {
|
||||||
fB.clear();
|
delete[] fB; fB = 0;
|
||||||
fPB.clear();
|
delete[] fPB; fPB = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<double> DataB() const {return fB;}
|
void Calculate(const string&, const vector<double>&);
|
||||||
vector<double> DataPB() const {return fPB;}
|
void Calculate(const TBofZCalc*, const TTrimSPData*, const vector<double>&, unsigned int);
|
||||||
|
void Calculate(const TBofZCalcInverse*, const TTrimSPData*, const vector<double>&);
|
||||||
|
void Calculate(const TBulkVortexFieldCalc*, const vector<double>&);
|
||||||
|
|
||||||
|
const double* DataB() const {return fB;}
|
||||||
|
double* DataPB() const {return fPB;}
|
||||||
double GetBmin() const {return fBmin;}
|
double GetBmin() const {return fBmin;}
|
||||||
double GetBmax() const {return fBmax;}
|
double GetBmax() const {return fBmax;}
|
||||||
|
unsigned int GetPBSize() const {return fPBSize;}
|
||||||
void ConvolveGss(double);
|
void ConvolveGss(double);
|
||||||
void AddBackground(double, double, double);
|
void AddBackground(double, double, double);
|
||||||
|
void UnsetPBExists();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
vector<double> fB;
|
double *fB;
|
||||||
vector<double> fPB;
|
mutable double *fPB;
|
||||||
double fBmin;
|
double fBmin;
|
||||||
double fBmax;
|
double fBmax;
|
||||||
double fDT;
|
double fDT;
|
||||||
double fDB;
|
double fDB;
|
||||||
|
mutable bool fPBExists;
|
||||||
|
unsigned int fPBSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _TPofBCalc_H_
|
#endif // _TPofBCalc_H_
|
||||||
|
37
src/external/TFitPofB-lib/include/TPofTCalc.h
vendored
37
src/external/TFitPofB-lib/include/TPofTCalc.h
vendored
@ -9,11 +9,31 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 _TPofTCalc_H_
|
#ifndef _TPofTCalc_H_
|
||||||
#define _TPofTCalc_H_
|
#define _TPofTCalc_H_
|
||||||
|
|
||||||
#include "TPofBCalc.h"
|
#include "TPofBCalc.h"
|
||||||
#include "fftw3.h"
|
#include <fftw3.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#define PI 3.14159265358979323846
|
#define PI 3.14159265358979323846
|
||||||
@ -23,25 +43,26 @@ class TPofTCalc {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TPofTCalc(const string&, const vector<double>&);
|
TPofTCalc(const TPofBCalc*, const string&, const vector<double>&);
|
||||||
~TPofTCalc();
|
~TPofTCalc();
|
||||||
|
|
||||||
vector<double> DataT() const {return fT;}
|
const double* DataT() const {return fT;}
|
||||||
vector<double> DataPT() const {return fPT;}
|
const double* DataPT() const {return fPT;}
|
||||||
void DoFFT(const TPofBCalc&);
|
void DoFFT();
|
||||||
void CalcPol(const vector<double>&);
|
void CalcPol(const vector<double>&);
|
||||||
void FakeData(const string&, const vector<double>&);
|
void FakeData(const string&, const vector<double>&);
|
||||||
double Eval(double) const;
|
double Eval(double) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
fftw_plan fFFTplan;
|
fftw_plan fFFTplan;
|
||||||
fftw_complex *fFFTout;
|
|
||||||
double *fFFTin;
|
double *fFFTin;
|
||||||
vector<double> fT;
|
fftw_complex *fFFTout;
|
||||||
vector<double> fPT;
|
double *fT;
|
||||||
|
double *fPT;
|
||||||
double fTBin;
|
double fTBin;
|
||||||
int fNFFT;
|
int fNFFT;
|
||||||
const string fWisdom;
|
const string fWisdom;
|
||||||
|
bool fUseWisdom;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
21
src/external/TFitPofB-lib/include/TSkewedGss.h
vendored
21
src/external/TFitPofB-lib/include/TSkewedGss.h
vendored
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 _TSkewedGss_H_
|
#ifndef _TSkewedGss_H_
|
||||||
#define _TSkewedGss_H_
|
#define _TSkewedGss_H_
|
||||||
|
|
||||||
@ -26,6 +46,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
mutable vector<double> fPar;
|
mutable vector<double> fPar;
|
||||||
|
TPofBCalc *fPofB;
|
||||||
TPofTCalc *fPofT;
|
TPofTCalc *fPofT;
|
||||||
mutable bool fCalcNeeded;
|
mutable bool fCalcNeeded;
|
||||||
mutable bool fFirstCall;
|
mutable bool fFirstCall;
|
||||||
|
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
// root dictionary stuff --------------------------------------------------
|
// root dictionary stuff --------------------------------------------------
|
||||||
#ifdef __CINT__
|
#ifdef __CINT__
|
||||||
|
|
||||||
|
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 _TTrimSPDataHandler_H_
|
#ifndef _TTrimSPDataHandler_H_
|
||||||
#define _TTrimSPDataHandler_H_
|
#define _TTrimSPDataHandler_H_
|
||||||
|
|
||||||
|
25
src/external/TFitPofB-lib/include/TVortex.h
vendored
25
src/external/TFitPofB-lib/include/TVortex.h
vendored
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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 _TVortex_H_
|
#ifndef _TVortex_H_
|
||||||
#define _TVortex_H_
|
#define _TVortex_H_
|
||||||
|
|
||||||
@ -25,15 +45,16 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
mutable vector<double> fPar;
|
mutable vector<double> fPar;
|
||||||
|
TBulkTriVortexLondonFieldCalc *fVortex;
|
||||||
|
TPofBCalc *fPofB;
|
||||||
TPofTCalc *fPofT;
|
TPofTCalc *fPofT;
|
||||||
mutable bool fCalcNeeded;
|
mutable bool fCalcNeeded;
|
||||||
mutable bool fFirstCall;
|
mutable bool fFirstCall;
|
||||||
mutable vector<double> fParForPofT;
|
|
||||||
mutable vector<double> fParForVortex;
|
mutable vector<double> fParForVortex;
|
||||||
mutable vector<double> fParForPofB;
|
mutable vector<double> fParForPofB;
|
||||||
|
mutable vector<double> fParForPofT;
|
||||||
string fWisdom;
|
string fWisdom;
|
||||||
unsigned int fGridSteps;
|
unsigned int fGridSteps;
|
||||||
unsigned int fVortexFourierComp;
|
|
||||||
|
|
||||||
ClassDef(TBulkTriVortexLondon,1)
|
ClassDef(TBulkTriVortexLondon,1)
|
||||||
};
|
};
|
||||||
|
@ -9,6 +9,26 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2009 by Bastian M. Wojek *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* 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. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
// root dictionary stuff --------------------------------------------------
|
// root dictionary stuff --------------------------------------------------
|
||||||
#ifdef __CINT__
|
#ifdef __CINT__
|
||||||
|
|
||||||
|
49
src/external/TFitPofB-lib/test/Makefile.testVortex-v2
vendored
Normal file
49
src/external/TFitPofB-lib/test/Makefile.testVortex-v2
vendored
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#---------------------------------------------------
|
||||||
|
# get compilation and library flags from root-config
|
||||||
|
|
||||||
|
ROOTCFLAGS = $(shell $(ROOTSYS)/bin/root-config --cflags)
|
||||||
|
ROOTLIBS = $(shell $(ROOTSYS)/bin/root-config --libs)
|
||||||
|
|
||||||
|
#---------------------------------------------------
|
||||||
|
|
||||||
|
CXX = g++-4.4.0
|
||||||
|
CXXFLAGS = -O3 -Wall
|
||||||
|
LOCALINCLUDE = ../include
|
||||||
|
ROOTINCLUDE = $(ROOTSYS)/include
|
||||||
|
INCLUDES = -I$(LOCALINCLUDE) -I$(ROOTINCLUDE)
|
||||||
|
LD = g++-4.4.0
|
||||||
|
LDFLAGS = -O3 -L../classes -lTFitPofB -lfftw3_threads -lfftw3 -lm -lpthread -fopenmp -lPMusr
|
||||||
|
|
||||||
|
# the output from the root-config script:
|
||||||
|
CXXFLAGS += $(ROOTCFLAGS)
|
||||||
|
LDFLAGS +=
|
||||||
|
|
||||||
|
# the ROOT libraries
|
||||||
|
LIBS = $(ROOTLIBS) -lXMLParser -lMathMore
|
||||||
|
|
||||||
|
EXEC = testVortex-v2
|
||||||
|
|
||||||
|
# some definitions: headers, sources, objects,...
|
||||||
|
OBJS =
|
||||||
|
OBJS += $(EXEC).o
|
||||||
|
|
||||||
|
# make the executable:
|
||||||
|
#
|
||||||
|
all: $(EXEC)
|
||||||
|
|
||||||
|
$(EXEC): $(OBJS)
|
||||||
|
@echo "---> Building $(EXEC) ..."
|
||||||
|
$(LD) $(LDFLAGS) $(OBJS) -o $(EXEC) $(LIBS)
|
||||||
|
@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 $<
|
||||||
|
|
635
src/external/TFitPofB-lib/test/testVortex-v2.cpp
vendored
Normal file
635
src/external/TFitPofB-lib/test/testVortex-v2.cpp
vendored
Normal file
@ -0,0 +1,635 @@
|
|||||||
|
#include "TPofTCalc.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
unsigned int NFFT(256);
|
||||||
|
|
||||||
|
vector<double> parForVortex;
|
||||||
|
parForVortex.resize(3);
|
||||||
|
|
||||||
|
// parForVortex[0] = 100.0; //app.field
|
||||||
|
// parForVortex[1] = 200.0; //lambda
|
||||||
|
// parForVortex[2] = 4.0; //xi
|
||||||
|
|
||||||
|
vector<double> parForPofB;
|
||||||
|
parForPofB.push_back(0.01); //dt
|
||||||
|
parForPofB.push_back(0.5); //dB
|
||||||
|
|
||||||
|
vector<double> parForPofT;
|
||||||
|
parForPofT.push_back(0.0); //phase
|
||||||
|
parForPofT.push_back(0.01); //dt
|
||||||
|
parForPofT.push_back(0.5); //dB
|
||||||
|
|
||||||
|
TBulkTriVortexLondonFieldCalc *vortexLattice = new TBulkTriVortexLondonFieldCalc("/home/l_wojek/analysis/WordsOfWisdom.dat", NFFT);
|
||||||
|
|
||||||
|
parForVortex[0] = 500.0; //app.field
|
||||||
|
parForVortex[1] = 300.0; //lambda
|
||||||
|
parForVortex[2] = 3.0; //xi
|
||||||
|
|
||||||
|
vortexLattice->SetParameters(parForVortex);
|
||||||
|
vortexLattice->CalculateGrid();
|
||||||
|
|
||||||
|
// ofstream ofy("testVortex-B.dat");
|
||||||
|
// for (unsigned int j(0); j < NFFT * NFFT; j++) {
|
||||||
|
// ofy << vortexLattice->DataB()[j] << " ";
|
||||||
|
// if (!((j+1)%(NFFT)))
|
||||||
|
// ofy << endl;
|
||||||
|
// }
|
||||||
|
// ofy.close();
|
||||||
|
|
||||||
|
TPofBCalc *PofB = new TPofBCalc(parForPofB);
|
||||||
|
PofB->Calculate(vortexLattice, parForPofB);
|
||||||
|
|
||||||
|
// const double *b(PofB->DataB());
|
||||||
|
// const double *pb(PofB->DataPB());
|
||||||
|
// unsigned int s(PofB->GetPBSize());
|
||||||
|
//
|
||||||
|
double test(0.0);
|
||||||
|
//
|
||||||
|
// ofstream ofx("testVortex.dat");
|
||||||
|
// for (unsigned int i(0); i < s; i++) {
|
||||||
|
// ofx << b[i] << " " << pb[i] << endl;
|
||||||
|
// test+=pb[i];
|
||||||
|
// }
|
||||||
|
// ofx.close();
|
||||||
|
|
||||||
|
// cout << test << endl;
|
||||||
|
|
||||||
|
TPofTCalc poft(PofB, "/home/l_wojek/analysis/WordsOfWisdom.dat", parForPofT);
|
||||||
|
|
||||||
|
poft.DoFFT();
|
||||||
|
poft.CalcPol(parForPofT);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ofstream of8("testVortex-Pt.dat");
|
||||||
|
for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
test = poft.Eval(i);
|
||||||
|
// of8 << i << " " << poft.Eval(i) << endl;
|
||||||
|
}
|
||||||
|
// of8.close();
|
||||||
|
|
||||||
|
// parForVortex[0] = 500.0; //app.field
|
||||||
|
// parForVortex[1] = 100.0; //lambda
|
||||||
|
// parForVortex[2] = 3.0; //xi
|
||||||
|
//
|
||||||
|
// vortexLattice->SetParameters(parForVortex);
|
||||||
|
// vortexLattice->CalculateGrid();
|
||||||
|
// PofB->UnsetPBExists();
|
||||||
|
// PofB->Calculate(vortexLattice, parForPofB);
|
||||||
|
//
|
||||||
|
// poft.DoFFT();
|
||||||
|
// poft.CalcPol(parForPofT);
|
||||||
|
//
|
||||||
|
// ofstream of9("testVortex-Pt1.dat");
|
||||||
|
// for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
// // test = poft.Eval(i);
|
||||||
|
// of9 << i << " " << poft.Eval(i) << endl;
|
||||||
|
// }
|
||||||
|
// of9.close();
|
||||||
|
|
||||||
|
delete vortexLattice;
|
||||||
|
vortexLattice = 0;
|
||||||
|
delete PofB;
|
||||||
|
PofB = 0;
|
||||||
|
|
||||||
|
parForPofB.clear();
|
||||||
|
parForPofT.clear();
|
||||||
|
parForVortex.clear();
|
||||||
|
|
||||||
|
/*
|
||||||
|
double par_arr[] = {24.4974, E, 94.6, 10.0, 130.0};
|
||||||
|
vector<double> par_vec(par_arr, par_arr+(sizeof(par_arr)/sizeof(par_arr[0])));
|
||||||
|
|
||||||
|
|
||||||
|
vector<double> parForBofZ;
|
||||||
|
for (unsigned int i(2); i<par_vec.size(); i++)
|
||||||
|
parForBofZ.push_back(par_vec[i]);
|
||||||
|
|
||||||
|
vector<double> parForPofB;
|
||||||
|
parForPofB.push_back(0.01); //dt
|
||||||
|
parForPofB.push_back(0.1); //dB
|
||||||
|
parForPofB.push_back(par_vec[1]);
|
||||||
|
parForPofB.push_back(par_vec[2]); // Bkg-Field
|
||||||
|
parForPofB.push_back(0.005); // Bkg-width (in principle zero)
|
||||||
|
vector<double> interfaces;
|
||||||
|
interfaces.push_back(par_vec[3]); // dead layer
|
||||||
|
parForPofB.push_back(calcData.LayerFraction(par_vec[1], 1, interfaces)); // Fraction of muons in the deadlayer
|
||||||
|
|
||||||
|
|
||||||
|
vector<double> zonk;
|
||||||
|
vector<double> donk;
|
||||||
|
vector<double> hurgaB;
|
||||||
|
vector<double> hurgaPB;
|
||||||
|
|
||||||
|
for (unsigned int u(0); u<10 ; u++) {
|
||||||
|
|
||||||
|
parForBofZ[par_vec.size()-3] = par_vec[4] + double(u)*5.;
|
||||||
|
|
||||||
|
TLondon1D_HS *BofZ = new TLondon1D_HS(parForBofZ);
|
||||||
|
TPofBCalc *PofB = new TPofBCalc(*BofZ, calcData, parForPofB);
|
||||||
|
|
||||||
|
if(u == 0){
|
||||||
|
hurgaB = PofB->DataB();
|
||||||
|
hurgaPB = PofB->DataPB();
|
||||||
|
PofB->ConvolveGss(7.0);
|
||||||
|
donk = PofB->DataPB();
|
||||||
|
}
|
||||||
|
|
||||||
|
delete BofZ;
|
||||||
|
delete PofB;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TPofBCalc sumPB(hurgaB, zonk);
|
||||||
|
|
||||||
|
// sumPB.AddBackground(par_vec[2], 0.15, 0.1);
|
||||||
|
// sumPB.ConvolveGss(7.0);
|
||||||
|
// donk = sumPB.DataPB();
|
||||||
|
|
||||||
|
char debugfile[50];
|
||||||
|
int n = sprintf (debugfile, "testInverseExp-BpB_B-%.4f_l-%.3f_E-%.1f_normal.dat", par_vec[2], par_vec[4], par_vec[1]);
|
||||||
|
|
||||||
|
if (n > 0) {
|
||||||
|
ofstream of7(debugfile);
|
||||||
|
for (unsigned int i(0); i<hurgaB.size(); i++) {
|
||||||
|
of7 << hurgaB[i] << " " << donk[i] << " " << hurgaPB[i] << endl;
|
||||||
|
}
|
||||||
|
of7.close();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// vector<double> parForPofT;
|
||||||
|
// parForPofT.push_back(par_vec[0]); //phase
|
||||||
|
// parForPofT.push_back(0.01); //dt
|
||||||
|
// parForPofT.push_back(0.02); //dB
|
||||||
|
|
||||||
|
// TLondon1D_HS BofZ(parForBofZ);
|
||||||
|
|
||||||
|
// vector<double> zz;
|
||||||
|
// vector<double> Bz;
|
||||||
|
// for(double i(0.5); i<2001; i+=1.0) {
|
||||||
|
// zz.push_back(i/10.0);
|
||||||
|
// if(!(i/10.0 < parForBofZ[1])) {
|
||||||
|
// Bz.push_back(BofZ.GetBofZ(i/10.0));
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// Bz.push_back(parForBofZ[0]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
/*
|
||||||
|
char debugfile1[50];
|
||||||
|
int nn = sprintf (debugfile1, "testInverseExp-Bz_z-%.4f_l-%.3f_E-%.1f_normal.dat", par_vec[2], par_vec[9], par_vec[1]);
|
||||||
|
if (nn > 0) {
|
||||||
|
ofstream of01(debugfile1);
|
||||||
|
for (unsigned int i(0); i<2000; i++) {
|
||||||
|
of01 << zz[i] << " " << Bz[i] << endl;
|
||||||
|
}
|
||||||
|
of01.close();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// TPofBCalc PofB(BofZ, calcData, parForPofB);
|
||||||
|
|
||||||
|
|
||||||
|
// double t1(0.0);
|
||||||
|
// get start time
|
||||||
|
// struct timeval tv_start, tv_stop;
|
||||||
|
// gettimeofday(&tv_start, 0);
|
||||||
|
//
|
||||||
|
// TPofBCalc PofB(BofZ, calcData, parForPofB);
|
||||||
|
//
|
||||||
|
// gettimeofday(&tv_stop, 0);
|
||||||
|
// t1 = (tv_stop.tv_sec - tv_start.tv_sec)*1000.0 + (tv_stop.tv_usec - tv_start.tv_usec)/1000.0;
|
||||||
|
|
||||||
|
// cout << "p(B) calculation time with derivatives of the inverse function: " << t1 << " ms" << endl;
|
||||||
|
|
||||||
|
// gettimeofday(&tv_start, 0);
|
||||||
|
//
|
||||||
|
// BofZ.Calculate();
|
||||||
|
// TPofBCalc PofB1(BofZ, calcData, parForPofB, 1);
|
||||||
|
//
|
||||||
|
// gettimeofday(&tv_stop, 0);
|
||||||
|
// t1 = (tv_stop.tv_sec - tv_start.tv_sec)*1000.0 + (tv_stop.tv_usec - tv_start.tv_usec)/1000.0;
|
||||||
|
//
|
||||||
|
// cout << "p(B) calculation time without derivatives of the inverse function: " << t1 << " ms" << endl;
|
||||||
|
|
||||||
|
// PofB.ConvolveGss(1.17);
|
||||||
|
|
||||||
|
// PofB.AddBackground(par_vec[2], 0.2, calcData.LayerFraction(E, 4, interfaces));
|
||||||
|
// PofB.ConvolveGss(1.17);
|
||||||
|
|
||||||
|
// vector<double> hurgaB(PofB.DataB());
|
||||||
|
// vector<double> hurgaPB(PofB.DataPB());
|
||||||
|
// vector<double> hurgaPB1(PofB1.DataPB());
|
||||||
|
//
|
||||||
|
// char debugfile[50];
|
||||||
|
// int n = sprintf (debugfile, "testInverseExp-BpB_B-%.4f_l-%.3f_E-%.1f_normal.dat", par_vec[2], par_vec[4], par_vec[1]);
|
||||||
|
//
|
||||||
|
// if (n > 0) {
|
||||||
|
// ofstream of7(debugfile);
|
||||||
|
// for (unsigned int i(0); i<hurgaB.size(); i++) {
|
||||||
|
// of7 << hurgaB[i] << " " << hurgaPB[i] << " " << hurgaPB1[i] << endl;
|
||||||
|
// }
|
||||||
|
// of7.close();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// TPofTCalc poft("/home/l_wojek/analysis/WordsOfWisdom.dat", parForPofT);
|
||||||
|
//
|
||||||
|
// poft.DoFFT(PofB);
|
||||||
|
// poft.CalcPol(parForPofT);
|
||||||
|
//
|
||||||
|
// char debugfilex[50];
|
||||||
|
// int nx = sprintf (debugfilex, "4Ltest-P_t-%.4f_l-%.3f_E-%.1f_normal.dat", par_vec[2], par_vec[9], par_vec[1]);
|
||||||
|
//
|
||||||
|
// if (nx > 0) {
|
||||||
|
// ofstream of8(debugfilex);
|
||||||
|
// for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
// of8 << i << " " << poft.Eval(i) << endl;
|
||||||
|
// }
|
||||||
|
// of8.close();
|
||||||
|
// }
|
||||||
|
/*
|
||||||
|
PofB.ConvolveGss(8.8);
|
||||||
|
|
||||||
|
vector<double> hurgaB1(PofB.DataB());
|
||||||
|
vector<double> hurgaPB1(PofB.DataPB());
|
||||||
|
|
||||||
|
n = sprintf (debugfile, "BpB_B-%.4f_l-%.3f_E-%.1f_broadend8.8G.dat", par_vec[2], par_vec[4], par_vec[1]);
|
||||||
|
|
||||||
|
if (n > 0) {
|
||||||
|
ofstream of1(debugfile);
|
||||||
|
for (unsigned int i(0); i<hurgaB1.size(); i++) {
|
||||||
|
of1 << hurgaB1[i] << " " << hurgaPB1[i] << endl;
|
||||||
|
}
|
||||||
|
of1.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
calcData.ConvolveGss(10.0, par_vec[1]);
|
||||||
|
calcData.Normalize(par_vec[1]);
|
||||||
|
|
||||||
|
TPofBCalc PofB2(BofZ, calcData, parForPofB);
|
||||||
|
|
||||||
|
vector<double> z2(calcData.DataZ(par_vec[1]));
|
||||||
|
vector<double> nz2(calcData.DataNZ(par_vec[1]));
|
||||||
|
|
||||||
|
ofstream of2("Implantation-profile-broad.dat");
|
||||||
|
for (unsigned int i(0); i<z2.size(); i++) {
|
||||||
|
of2 << z2[i] << " " << nz2[i] << endl;
|
||||||
|
}
|
||||||
|
of2.close();
|
||||||
|
|
||||||
|
vector<double> hurgaB2(PofB2.DataB());
|
||||||
|
vector<double> hurgaPB2(PofB2.DataPB());
|
||||||
|
|
||||||
|
n = sprintf (debugfile, "BpB_B-%.4f_l-%.3f_E-%.1f_broadend10nm.dat", par_vec[2], par_vec[4], par_vec[1]);
|
||||||
|
|
||||||
|
if (n>0) {
|
||||||
|
ofstream of8(debugfile);
|
||||||
|
for (unsigned int i(0); i<hurgaB2.size(); i++) {
|
||||||
|
of8 << hurgaB2[i] << " " << hurgaPB2[i] << endl;
|
||||||
|
}
|
||||||
|
of8.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
PofB2.ConvolveGss(7.5);
|
||||||
|
|
||||||
|
vector<double> hurgaB3(PofB2.DataB());
|
||||||
|
vector<double> hurgaPB3(PofB2.DataPB());
|
||||||
|
|
||||||
|
n = sprintf (debugfile, "BpB_B-%.4f_l-%.3f_E-%.1f_broadend10nm+7.5G.dat", par_vec[2], par_vec[4], par_vec[1]);
|
||||||
|
|
||||||
|
if (n > 0) {
|
||||||
|
ofstream of9(debugfile);
|
||||||
|
for (unsigned int i(0); i<hurgaB3.size(); i++) {
|
||||||
|
of9 << hurgaB3[i] << " " << hurgaPB3[i] << endl;
|
||||||
|
}
|
||||||
|
of9.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
z.clear();
|
||||||
|
nz.clear();
|
||||||
|
z2.clear();
|
||||||
|
nz2.clear();
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
|
||||||
|
double param[8] = {100.0, 5.0, 50.0, 100.0, 40.0, 0.01, 0.1, 15.0};
|
||||||
|
vector<double> parameter(param,param+8);
|
||||||
|
vector<double> param_for_BofZ;
|
||||||
|
vector<double> param_for_PofB;
|
||||||
|
vector<double> param_for_PofT;
|
||||||
|
|
||||||
|
for (unsigned int i(0); i<4; i++)
|
||||||
|
param_for_BofZ.push_back(parameter[i]);
|
||||||
|
|
||||||
|
for (unsigned int i(5); i<8; i++)
|
||||||
|
param_for_PofB.push_back(parameter[i]);
|
||||||
|
|
||||||
|
for (unsigned int i(4); i<7; i++)
|
||||||
|
param_for_PofT.push_back(parameter[i]);
|
||||||
|
|
||||||
|
TLondon1D_1L bofz(param_for_BofZ);
|
||||||
|
|
||||||
|
cout << "Bmin = " << bofz.GetBmin() << endl;
|
||||||
|
cout << "Bmax = " << bofz.GetBmax() << endl;
|
||||||
|
cout << "dZ = " << bofz.GetdZ() << endl;
|
||||||
|
|
||||||
|
ofstream of5("test_Bz.dat");
|
||||||
|
for (double i(0); i<50.; i+=0.1) {
|
||||||
|
of5 << i << " " << bofz.GetBofZ(i) << endl;
|
||||||
|
}
|
||||||
|
of5.close();
|
||||||
|
|
||||||
|
ofstream of6("test_zBz.dat");
|
||||||
|
for (unsigned int i(0); i<bofz.DataZ().size(); i++) {
|
||||||
|
of6 << bofz.DataZ()[i] << " " << bofz.DataBZ()[i] << endl;
|
||||||
|
}
|
||||||
|
of6.close();
|
||||||
|
|
||||||
|
TPofBCalc pofb(bofz, calcData, param_for_PofB);
|
||||||
|
|
||||||
|
cout << "Output to file now..." << endl;
|
||||||
|
|
||||||
|
vector<double> hurgaB(pofb.DataB());
|
||||||
|
vector<double> hurgaPB(pofb.DataPB());
|
||||||
|
|
||||||
|
ofstream of7("test_BpB.dat");
|
||||||
|
for (unsigned int i(0); i<hurgaB.size(); i++) {
|
||||||
|
of7 << hurgaB[i] << " " << hurgaPB[i] << endl;
|
||||||
|
}
|
||||||
|
of7.close();
|
||||||
|
|
||||||
|
TPofTCalc poft(param_for_PofT);
|
||||||
|
|
||||||
|
poft.DoFFT(pofb, param_for_PofT);
|
||||||
|
|
||||||
|
ofstream of8("test_tpt4.dat");
|
||||||
|
for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
of8 << i << " " << poft(i) << endl;
|
||||||
|
}
|
||||||
|
of8.close();
|
||||||
|
|
||||||
|
*/
|
||||||
|
/**************** Test TLondon1DHS *********************************
|
||||||
|
|
||||||
|
// unsigned int parNo_arr[] = {1, 2, 5, 7, 9, 10, 11, 12};
|
||||||
|
double par_arr[] = {24.4974, 22.0, 95.8253, 7.62096, 143.215};
|
||||||
|
|
||||||
|
// vector<unsigned int> parNo_vec(parNo_arr, parNo_arr+(sizeof(parNo_arr)/sizeof(parNo_arr[0])));
|
||||||
|
vector<double> par_vec(par_arr, par_arr+(sizeof(par_arr)/sizeof(par_arr[0])));
|
||||||
|
|
||||||
|
// vector<double> par_vec_sub;
|
||||||
|
|
||||||
|
// for(unsigned int i(0); i<parNo_vec.size(); i++) {
|
||||||
|
// par_vec_sub.push_back(par_vec[parNo_vec[i]-1]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
TLondon1DHS fitter;
|
||||||
|
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/**************** Test TLondon1D1L *********************************
|
||||||
|
|
||||||
|
unsigned int parNo_arr[] = {1, 3, 5, 7, 9, 10, 11, 12};
|
||||||
|
double par_arr[] = {0.0, 999.0, 0.01, 999.0, 0.01, 999.0, 4.6, 999.0, 100.0, 5.0, 190.0, 180.0};
|
||||||
|
|
||||||
|
vector<unsigned int> parNo_vec(parNo_arr, parNo_arr+(sizeof(parNo_arr)/sizeof(parNo_arr[0])));
|
||||||
|
vector<double> par_vec(par_arr, par_arr+(sizeof(par_arr)/sizeof(par_arr[0])));
|
||||||
|
|
||||||
|
vector<double> par_vec_sub;
|
||||||
|
|
||||||
|
for(unsigned int i(0); i<parNo_vec.size(); i++) {
|
||||||
|
par_vec_sub.push_back(par_vec[parNo_vec[i]-1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
TLondon1D1L fitter(parNo_vec, par_vec);
|
||||||
|
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/**************** Test TLondon1D2L **********************************
|
||||||
|
|
||||||
|
unsigned int parNo_arr[] = {1, 3, 5, 7, 9, 10, 11, 12, 13, 14, 15, 16};
|
||||||
|
double par_arr[] = {0.0, 999.0, 0.01, 999.0, 0.01, 999.0, 21.6, 999.0, 100.0, 5.0, 70.0, 70.0, 180.0, 500.0, 1.0, 0.3};
|
||||||
|
|
||||||
|
vector<unsigned int> parNo_vec(parNo_arr, parNo_arr+(sizeof(parNo_arr)/sizeof(parNo_arr[0])));
|
||||||
|
vector<double> par_vec(par_arr, par_arr+(sizeof(par_arr)/sizeof(par_arr[0])));
|
||||||
|
|
||||||
|
vector<double> par_vec_sub;
|
||||||
|
|
||||||
|
for(unsigned int i(0); i<parNo_vec.size(); i++) {
|
||||||
|
par_vec_sub.push_back(par_vec[parNo_vec[i]-1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
TLondon1D2L fitter(parNo_vec, par_vec);
|
||||||
|
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/**************** Test TLondon1D3L ********************************
|
||||||
|
|
||||||
|
unsigned int parNo_arr[] = {1, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
|
||||||
|
double par_arr[] = {0.0, 999.0, 0.01, 999.0, 0.01, 999.0, 4.6, 999.0, 100.0, 5.0, 70.0, 50.0, 70.0, 180.0, 180.0, 180.0, 1.0, 1.0, 1.0};
|
||||||
|
|
||||||
|
vector<unsigned int> parNo_vec(parNo_arr, parNo_arr+(sizeof(parNo_arr)/sizeof(parNo_arr[0])));
|
||||||
|
vector<double> par_vec(par_arr, par_arr+(sizeof(par_arr)/sizeof(par_arr[0])));
|
||||||
|
|
||||||
|
vector<double> par_vec_sub;
|
||||||
|
|
||||||
|
for(unsigned int i(0); i<parNo_vec.size(); i++) {
|
||||||
|
par_vec_sub.push_back(par_vec[parNo_vec[i]-1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
TLondon1D3L fitter(parNo_vec, par_vec);
|
||||||
|
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/**************** Test TLondon1D3LS *********************************
|
||||||
|
|
||||||
|
unsigned int parNo_arr[] = {1, 3, 5, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18};
|
||||||
|
double par_arr[] = {0.0, 999.0, 0.01, 999.0, 0.01, 999.0, 21.6, 999.0, 100.0, 5.0, 70.0, 50.0, 70.0, 180.0, 500.0, 1.0, 0.3, 1.0};
|
||||||
|
|
||||||
|
vector<unsigned int> parNo_vec(parNo_arr, parNo_arr+(sizeof(parNo_arr)/sizeof(parNo_arr[0])));
|
||||||
|
vector<double> par_vec(par_arr, par_arr+(sizeof(par_arr)/sizeof(par_arr[0])));
|
||||||
|
|
||||||
|
vector<double> par_vec_sub;
|
||||||
|
|
||||||
|
for(unsigned int i(0); i<parNo_vec.size(); i++) {
|
||||||
|
par_vec_sub.push_back(par_vec[parNo_vec[i]-1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
TLondon1D3LS fitter(parNo_vec, par_vec);
|
||||||
|
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
// ofstream of01("test_fitter01.dat");
|
||||||
|
// ofstream of02("test_fitter02.dat");
|
||||||
|
// ofstream of03("test_fitter03.dat");
|
||||||
|
// ofstream of04("test_fitter04.dat");
|
||||||
|
// ofstream of05("test_fitter05.dat");
|
||||||
|
// ofstream of06("test_fitter06.dat");
|
||||||
|
// ofstream of07("test_fitter07.dat");
|
||||||
|
// ofstream of08("test_fitter08.dat");
|
||||||
|
// ofstream of09("test_fitter09.dat");
|
||||||
|
// ofstream of10("test_fitter10.dat");
|
||||||
|
|
||||||
|
|
||||||
|
// for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
// of01 << i << " " << fitter(i, par_vec) << endl;
|
||||||
|
// }
|
||||||
|
// of01.close();
|
||||||
|
|
||||||
|
// par_vec[1] = 7.7;
|
||||||
|
//
|
||||||
|
// for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
// of02 << i << " " << fitter(i, par_vec) << endl;
|
||||||
|
// }
|
||||||
|
// of02.close();
|
||||||
|
//
|
||||||
|
// par_vec[0] = 0.0;
|
||||||
|
//
|
||||||
|
// for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
// of03 << i << " " << fitter(i, par_vec) << endl;
|
||||||
|
// }
|
||||||
|
// of03.close();
|
||||||
|
//
|
||||||
|
// par_vec[2] = 200.0;
|
||||||
|
//
|
||||||
|
// for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
// of04 << i << " " << fitter(i, par_vec) << endl;
|
||||||
|
// }
|
||||||
|
// of04.close();
|
||||||
|
//
|
||||||
|
// par_vec[4] = 100.0;
|
||||||
|
//
|
||||||
|
// for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
// of05 << i << " " << fitter(i, par_vec) << endl;
|
||||||
|
// }
|
||||||
|
// of05.close();
|
||||||
|
//
|
||||||
|
// par_vec[0] = 20.0;
|
||||||
|
// par_vec[1] = 24.6;
|
||||||
|
// par_vec[2] = 96.5;
|
||||||
|
// par_vec[3] = 15.0;
|
||||||
|
// par_vec[4] = 130.0;
|
||||||
|
//
|
||||||
|
// for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
// of06 << i << " " << fitter(i, par_vec) << endl;
|
||||||
|
// }
|
||||||
|
// of06.close();
|
||||||
|
//
|
||||||
|
// par_vec[0] = 20.0;
|
||||||
|
// par_vec[1] = 24.6;
|
||||||
|
// par_vec[2] = 96.5;
|
||||||
|
// par_vec[3] = 15.0;
|
||||||
|
// par_vec[4] = 140.0;
|
||||||
|
//
|
||||||
|
// for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
// of07 << i << " " << fitter(i, par_vec) << endl;
|
||||||
|
// }
|
||||||
|
// of07.close();
|
||||||
|
//
|
||||||
|
// par_vec[0] = 20.0;
|
||||||
|
// par_vec[1] = 24.6;
|
||||||
|
// par_vec[2] = 96.5;
|
||||||
|
// par_vec[3] = 20.0;
|
||||||
|
// par_vec[4] = 130.0;
|
||||||
|
//
|
||||||
|
// for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
// of08 << i << " " << fitter(i, par_vec) << endl;
|
||||||
|
// }
|
||||||
|
// of08.close();
|
||||||
|
/*
|
||||||
|
par_vec_sub[0] = 0.0;
|
||||||
|
par_vec_sub[7] = 1000.0;
|
||||||
|
|
||||||
|
for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
of09 << i << " " << fitter.Eval(i, par_vec_sub) << endl;
|
||||||
|
}
|
||||||
|
of09.close();
|
||||||
|
|
||||||
|
par_vec_sub[0] = 0.0;
|
||||||
|
par_vec_sub[7] = 10.0;
|
||||||
|
|
||||||
|
for (double i(0.); i<12.0; i+=0.003) {
|
||||||
|
of10 << i << " " << fitter.Eval(i, par_vec_sub) << endl;
|
||||||
|
}
|
||||||
|
of10.close();
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
vector<double> data01, data02, data03, data04, data05, data06, data07, data08, data09, data10;
|
||||||
|
|
||||||
|
for (double i(0.); i<12.0; i+=0.003)
|
||||||
|
data01.push_back(fitter.Eval(i, par_vec_sub));
|
||||||
|
|
||||||
|
|
||||||
|
par_vec_sub[0] += 10.0;
|
||||||
|
par_vec_sub[10] -= 10.0;
|
||||||
|
|
||||||
|
for (double i(0.); i<12.0; i+=0.003)
|
||||||
|
data02.push_back(fitter.Eval(i, par_vec_sub));
|
||||||
|
|
||||||
|
|
||||||
|
par_vec_sub[0] += 10.0;
|
||||||
|
par_vec_sub[10] -= 10.0;
|
||||||
|
|
||||||
|
for (double i(0.); i<12.0; i+=0.003)
|
||||||
|
data03.push_back(fitter.Eval(i, par_vec_sub));
|
||||||
|
|
||||||
|
par_vec_sub[0] += 10.0;
|
||||||
|
|
||||||
|
for (double i(0.); i<12.0; i+=0.003)
|
||||||
|
data04.push_back(fitter.Eval(i, par_vec_sub));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
par_vec_sub[0] += 10.0;
|
||||||
|
par_vec_sub[10] -= 10.0;
|
||||||
|
|
||||||
|
for (double i(0.); i<12.0; i+=0.003)
|
||||||
|
data05.push_back(fitter.Eval(i, par_vec_sub));
|
||||||
|
|
||||||
|
par_vec_sub[0] += 10.0;
|
||||||
|
par_vec_sub[10] -= 10.0;
|
||||||
|
|
||||||
|
for (double i(0.); i<12.0; i+=0.003)
|
||||||
|
data06.push_back(fitter.Eval(i, par_vec_sub));
|
||||||
|
|
||||||
|
par_vec_sub[0] += 10.0;
|
||||||
|
|
||||||
|
for (double i(0.); i<12.0; i+=0.003)
|
||||||
|
data07.push_back(fitter.Eval(i, par_vec_sub));
|
||||||
|
|
||||||
|
par_vec_sub[0] += 10.0;
|
||||||
|
par_vec_sub[10] = 190.0;
|
||||||
|
|
||||||
|
for (double i(0.); i<12.0; i+=0.003)
|
||||||
|
data08.push_back(fitter.Eval(i, par_vec_sub));
|
||||||
|
|
||||||
|
par_vec_sub[0] += 10.0;
|
||||||
|
par_vec_sub[10] -= 10.0;
|
||||||
|
|
||||||
|
for (double i(0.); i<12.0; i+=0.003)
|
||||||
|
data09.push_back(fitter.Eval(i, par_vec_sub));
|
||||||
|
|
||||||
|
par_vec_sub[0] += 10.0;
|
||||||
|
|
||||||
|
for (double i(0.); i<12.0; i+=0.003)
|
||||||
|
data10.push_back(fitter.Eval(i, par_vec_sub));
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// par_vec.clear();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user