Found a nice plugin for musrfit which I've never had committed to the svn...
This commit is contained in:
parent
72f858b89a
commit
05786d468a
146
src/external/libCalcMeanFieldsLEM/Makefile.libCalcMeanFieldsLEM
vendored
Normal file
146
src/external/libCalcMeanFieldsLEM/Makefile.libCalcMeanFieldsLEM
vendored
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
#---------------------------------------------------
|
||||||
|
# Makefile.libCalcMeanFieldsLEM
|
||||||
|
#
|
||||||
|
# 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++
|
||||||
|
CXXFLAGS = -g -O3 -fopenmp -Wall -Wno-trigraphs -fPIC
|
||||||
|
PMUSRPATH = $(ROOTSYS)/include
|
||||||
|
LOCALPATH = .
|
||||||
|
INCLUDES = -I$(LOCALPATH) -I$(PMUSRPATH)
|
||||||
|
LD = g++
|
||||||
|
LDFLAGS = -O -fopenmp
|
||||||
|
SOFLAGS = -shared
|
||||||
|
SHLIB = libCalcMeanFieldsLEM.so
|
||||||
|
endif
|
||||||
|
|
||||||
|
# -- Windows/Cygwin
|
||||||
|
ifeq ($(OS),WIN32GCC)
|
||||||
|
CXX = g++
|
||||||
|
CXXFLAGS = -O3 -Wall -Wno-trigraphs -D_DLL
|
||||||
|
PMUSRPATH = $(ROOTSYS)/include
|
||||||
|
LOCALPATH = .
|
||||||
|
INCLUDES = -I$(LOCALPATH) -I$(PMUSRPATH)
|
||||||
|
LD = g++
|
||||||
|
LDFLAGS = -O -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc
|
||||||
|
SOFLAGS = -shared -Wl,--export-all-symbols
|
||||||
|
SHLIB = libCalcMeanFieldsLEM.dll
|
||||||
|
endif
|
||||||
|
|
||||||
|
# -- MacOSX/Darwin
|
||||||
|
ifeq ($(OS),DARWIN)
|
||||||
|
CXX = g++
|
||||||
|
CXXFLAGS = -O3 -Wall -Wno-trigraphs -fPIC
|
||||||
|
PMUSRPATH = $(ROOTSYS)/include
|
||||||
|
LOCALPATH = .
|
||||||
|
INCLUDES = -I$(LOCALPATH) -I$(PMUSRPATH)
|
||||||
|
LD = g++
|
||||||
|
LDFLAGS = -O -Xlinker -bind_at_load
|
||||||
|
SOFLAGS = -dynamiclib -flat_namespace -undefined suppress -Wl,-x
|
||||||
|
SHLIB = libCalcMeanFieldsLEM.dylib
|
||||||
|
endif
|
||||||
|
|
||||||
|
# the output from the root-config script:
|
||||||
|
CXXFLAGS += $(ROOTCFLAGS)
|
||||||
|
LDFLAGS +=
|
||||||
|
|
||||||
|
# the ROOT libraries (G = graphic)
|
||||||
|
LIBS = $(ROOTLIBS)
|
||||||
|
GLIBS = $(ROOTGLIBS)
|
||||||
|
|
||||||
|
# PMusr libs
|
||||||
|
PMUSRLIB = -L$(ROOTSYS)/lib -lPMusr -lTFitPofB
|
||||||
|
|
||||||
|
ifeq ($(OS),WIN32GCC)
|
||||||
|
PMUSRLIB = $(PMUSRLIB) -lMathMore
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OS),DARWIN)
|
||||||
|
PMUSRLIB = $(PMUSRLIB) -lMathMore
|
||||||
|
endif
|
||||||
|
|
||||||
|
# some definitions: headers (used to generate *Dict* stuff), sources, objects,...
|
||||||
|
OBJS =
|
||||||
|
OBJS += TCalcMeanFieldsLEM.o TCalcMeanFieldsLEMDict.o
|
||||||
|
|
||||||
|
INST_HEADER =
|
||||||
|
INST_HEADER += ./TCalcMeanFieldsLEM.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)
|
||||||
|
@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
|
||||||
|
|
||||||
|
TCalcMeanFieldsLEMDict.cpp: ./TCalcMeanFieldsLEM.h ./TCalcMeanFieldsLEMLinkDef.h
|
||||||
|
@echo "Generating dictionary $@..."
|
||||||
|
rootcint -f $@ -c -p -I$(PMUSRPATH) $^
|
||||||
|
|
||||||
|
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
|
427
src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.cpp
vendored
Normal file
427
src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.cpp
vendored
Normal file
@ -0,0 +1,427 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
TCalcMeanFieldsLEM.cpp
|
||||||
|
|
||||||
|
Author: Bastian M. Wojek
|
||||||
|
e-mail: bastian.wojek@psi.ch
|
||||||
|
|
||||||
|
2009/11/27
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* 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 <algorithm>
|
||||||
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <TSAXParser.h>
|
||||||
|
#include "TFitPofBStartupHandler.h"
|
||||||
|
|
||||||
|
#include "TCalcMeanFieldsLEM.h"
|
||||||
|
|
||||||
|
ClassImp(TMeanFieldsForScHalfSpace)
|
||||||
|
ClassImp(TMeanFieldsForScSingleLayer)
|
||||||
|
ClassImp(TMeanFieldsForScBilayer)
|
||||||
|
ClassImp(TMeanFieldsForScTrilayer)
|
||||||
|
|
||||||
|
// Constructor: Read the energies from the xml-file and load the according TRIM.SP-data files
|
||||||
|
|
||||||
|
TMeanFieldsForScHalfSpace::TMeanFieldsForScHalfSpace() {
|
||||||
|
|
||||||
|
// read startup file
|
||||||
|
string startup_path_name("TFitPofB_startup.xml");
|
||||||
|
|
||||||
|
TSAXParser *saxParser = new TSAXParser();
|
||||||
|
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler();
|
||||||
|
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler);
|
||||||
|
int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
|
// check for parse errors
|
||||||
|
if (status) { // error
|
||||||
|
cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
string rge_path(startupHandler->GetDataPath());
|
||||||
|
vector< pair<double, string> > energy_vec(startupHandler->GetEnergies());
|
||||||
|
|
||||||
|
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
||||||
|
fImpProfile = x;
|
||||||
|
x = 0;
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
if (saxParser) {
|
||||||
|
delete saxParser;
|
||||||
|
saxParser = 0;
|
||||||
|
}
|
||||||
|
if (startupHandler) {
|
||||||
|
delete startupHandler;
|
||||||
|
startupHandler = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Operator-method that returns the mean field for a given implantation energy
|
||||||
|
// Parameters: field, deadlayer, lambda
|
||||||
|
|
||||||
|
double TMeanFieldsForScHalfSpace::operator()(double E, const vector<double> &par_vec) const{
|
||||||
|
|
||||||
|
// Calculate field profile
|
||||||
|
vector<double> parForBofZ(par_vec);
|
||||||
|
|
||||||
|
TLondon1D_HS BofZ(parForBofZ);
|
||||||
|
|
||||||
|
vector<double> energies(fImpProfile->Energy());
|
||||||
|
vector<double>::const_iterator energyIter;
|
||||||
|
energyIter = find(energies.begin(), energies.end(), E);
|
||||||
|
|
||||||
|
if (energyIter != energies.end()) { // implantation profile found - no interpolation needed
|
||||||
|
return CalcMeanB(E, BofZ);
|
||||||
|
} else {
|
||||||
|
if (E < *energies.begin())
|
||||||
|
return CalcMeanB(*energies.begin(), BofZ);
|
||||||
|
if (E > *(energies.end()-1))
|
||||||
|
return CalcMeanB(*(energies.end()-1), BofZ);
|
||||||
|
|
||||||
|
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
|
||||||
|
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
|
||||||
|
|
||||||
|
double E1(*(energyIter - 1));
|
||||||
|
double E2(*(energyIter));
|
||||||
|
|
||||||
|
double B1(CalcMeanB(E1, BofZ));
|
||||||
|
double B2(CalcMeanB(E2, BofZ));
|
||||||
|
|
||||||
|
return B1 + (B2-B1)/(E2-E1)*(E-E1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
double TMeanFieldsForScHalfSpace::CalcMeanB (double E, const TLondon1D_HS& BofZ) const {
|
||||||
|
//calcData->UseHighResolution(E);
|
||||||
|
|
||||||
|
fImpProfile->Normalize(E);
|
||||||
|
|
||||||
|
vector<double> z(fImpProfile->DataZ(E));
|
||||||
|
vector<double> nz(fImpProfile->DataNZ(E));
|
||||||
|
|
||||||
|
// calculate mean field
|
||||||
|
|
||||||
|
double meanB(0.);
|
||||||
|
|
||||||
|
for (unsigned int i(0); i<z.size(); i++) {
|
||||||
|
meanB += (z[1]-z[0])*nz[i]*BofZ.GetBofZ(z[i]/10.);
|
||||||
|
}
|
||||||
|
return meanB;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constructor: Read the energies from the xml-file and load the according TRIM.SP-data files
|
||||||
|
|
||||||
|
TMeanFieldsForScSingleLayer::TMeanFieldsForScSingleLayer() {
|
||||||
|
|
||||||
|
// read startup file
|
||||||
|
string startup_path_name("TFitPofB_startup.xml");
|
||||||
|
|
||||||
|
TSAXParser *saxParser = new TSAXParser();
|
||||||
|
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler();
|
||||||
|
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler);
|
||||||
|
int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
|
// check for parse errors
|
||||||
|
if (status) { // error
|
||||||
|
cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
string rge_path(startupHandler->GetDataPath());
|
||||||
|
vector< pair<double, string> > energy_vec(startupHandler->GetEnergies());
|
||||||
|
|
||||||
|
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
||||||
|
fImpProfile = x;
|
||||||
|
x = 0;
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
if (saxParser) {
|
||||||
|
delete saxParser;
|
||||||
|
saxParser = 0;
|
||||||
|
}
|
||||||
|
if (startupHandler) {
|
||||||
|
delete startupHandler;
|
||||||
|
startupHandler = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Operator-method that returns the mean field for a given implantation energy
|
||||||
|
// Parameters: field, deadlayer, thicknessSC, lambda
|
||||||
|
|
||||||
|
double TMeanFieldsForScSingleLayer::operator()(double E, const vector<double> &par_vec) const{
|
||||||
|
|
||||||
|
// Calculate field profile
|
||||||
|
vector<double> parForBofZ(par_vec);
|
||||||
|
|
||||||
|
TLondon1D_1L BofZ(parForBofZ);
|
||||||
|
|
||||||
|
vector<double> energies(fImpProfile->Energy());
|
||||||
|
vector<double>::const_iterator energyIter;
|
||||||
|
energyIter = find(energies.begin(), energies.end(), E);
|
||||||
|
|
||||||
|
if (energyIter != energies.end()) { // implantation profile found - no interpolation needed
|
||||||
|
return CalcMeanB(E, BofZ);
|
||||||
|
} else {
|
||||||
|
if (E < *energies.begin())
|
||||||
|
return CalcMeanB(*energies.begin(), BofZ);
|
||||||
|
if (E > *(energies.end()-1))
|
||||||
|
return CalcMeanB(*(energies.end()-1), BofZ);
|
||||||
|
|
||||||
|
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
|
||||||
|
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
|
||||||
|
|
||||||
|
double E1(*(energyIter - 1));
|
||||||
|
double E2(*(energyIter));
|
||||||
|
|
||||||
|
double B1(CalcMeanB(E1, BofZ));
|
||||||
|
double B2(CalcMeanB(E2, BofZ));
|
||||||
|
|
||||||
|
return B1 + (B2-B1)/(E2-E1)*(E-E1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double TMeanFieldsForScSingleLayer::CalcMeanB (double E, const TLondon1D_1L& BofZ) const {
|
||||||
|
//calcData->UseHighResolution(E);
|
||||||
|
|
||||||
|
fImpProfile->Normalize(E);
|
||||||
|
|
||||||
|
vector<double> z(fImpProfile->DataZ(E));
|
||||||
|
vector<double> nz(fImpProfile->DataNZ(E));
|
||||||
|
|
||||||
|
// calculate mean field
|
||||||
|
|
||||||
|
double meanB(0.);
|
||||||
|
|
||||||
|
for (unsigned int i(0); i<z.size(); i++) {
|
||||||
|
meanB += (z[1]-z[0])*nz[i]*BofZ.GetBofZ(z[i]/10.);
|
||||||
|
}
|
||||||
|
return meanB;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constructor: Read the energies from the xml-file and load the according TRIM.SP-data files
|
||||||
|
|
||||||
|
TMeanFieldsForScBilayer::TMeanFieldsForScBilayer() {
|
||||||
|
|
||||||
|
// read startup file
|
||||||
|
string startup_path_name("TFitPofB_startup.xml");
|
||||||
|
|
||||||
|
TSAXParser *saxParser = new TSAXParser();
|
||||||
|
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler();
|
||||||
|
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler);
|
||||||
|
int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
|
// check for parse errors
|
||||||
|
if (status) { // error
|
||||||
|
cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
string rge_path(startupHandler->GetDataPath());
|
||||||
|
vector< pair<double, string> > energy_vec(startupHandler->GetEnergies());
|
||||||
|
|
||||||
|
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
||||||
|
fImpProfile = x;
|
||||||
|
x = 0;
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
if (saxParser) {
|
||||||
|
delete saxParser;
|
||||||
|
saxParser = 0;
|
||||||
|
}
|
||||||
|
if (startupHandler) {
|
||||||
|
delete startupHandler;
|
||||||
|
startupHandler = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Operator-method that returns the mean field for a given implantation energy
|
||||||
|
// Parameters: field, deadlayer, layer1, layer2, lambda1, lambda2, weight1 (deadlayer), weight2, weight3, weight4 (substrate)
|
||||||
|
|
||||||
|
double TMeanFieldsForScBilayer::operator()(double E, const vector<double> &par_vec) const{
|
||||||
|
|
||||||
|
vector<double> interfaces;
|
||||||
|
interfaces.push_back(par_vec[1]);
|
||||||
|
interfaces.push_back(par_vec[1]+par_vec[2]);
|
||||||
|
interfaces.push_back(par_vec[1]+par_vec[2]+par_vec[3]);
|
||||||
|
|
||||||
|
vector<double> weights;
|
||||||
|
weights.push_back(par_vec[6]);
|
||||||
|
weights.push_back(par_vec[7]);
|
||||||
|
weights.push_back(par_vec[8]);
|
||||||
|
weights.push_back(par_vec[9]);
|
||||||
|
|
||||||
|
// Calculate field profile
|
||||||
|
vector<double> parForBofZ;
|
||||||
|
for (unsigned int i(0); i<6; i++)
|
||||||
|
parForBofZ.push_back(par_vec[i]);
|
||||||
|
|
||||||
|
TLondon1D_2L BofZ(parForBofZ);
|
||||||
|
|
||||||
|
vector<double> energies(fImpProfile->Energy());
|
||||||
|
vector<double>::const_iterator energyIter;
|
||||||
|
energyIter = find(energies.begin(), energies.end(), E);
|
||||||
|
|
||||||
|
if (energyIter != energies.end()) { // implantation profile found - no interpolation needed
|
||||||
|
return CalcMeanB(E, interfaces, weights, BofZ);
|
||||||
|
} else {
|
||||||
|
if (E < *energies.begin())
|
||||||
|
return CalcMeanB(*energies.begin(), interfaces, weights, BofZ);
|
||||||
|
if (E > *(energies.end()-1))
|
||||||
|
return CalcMeanB(*(energies.end()-1), interfaces, weights, BofZ);
|
||||||
|
|
||||||
|
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
|
||||||
|
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
|
||||||
|
|
||||||
|
double E1(*(energyIter - 1));
|
||||||
|
double E2(*(energyIter));
|
||||||
|
|
||||||
|
double B1(CalcMeanB(E1, interfaces, weights, BofZ));
|
||||||
|
double B2(CalcMeanB(E2, interfaces, weights, BofZ));
|
||||||
|
|
||||||
|
return B1 + (B2-B1)/(E2-E1)*(E-E1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double TMeanFieldsForScBilayer::CalcMeanB (double E, const vector<double>& interfaces, const vector<double>& weights, const TLondon1D_2L& BofZ) const {
|
||||||
|
//calcData->UseHighResolution(E);
|
||||||
|
fImpProfile->WeightLayers(E, interfaces, weights);
|
||||||
|
fImpProfile->Normalize(E);
|
||||||
|
|
||||||
|
vector<double> z(fImpProfile->DataZ(E));
|
||||||
|
vector<double> nz(fImpProfile->DataNZ(E));
|
||||||
|
|
||||||
|
// calculate mean field
|
||||||
|
|
||||||
|
double meanB(0.);
|
||||||
|
|
||||||
|
for (unsigned int i(0); i<z.size(); i++) {
|
||||||
|
meanB += (z[1]-z[0])*nz[i]*BofZ.GetBofZ(z[i]/10.);
|
||||||
|
}
|
||||||
|
return meanB;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constructor: Read the energies from the xml-file and load the according TRIM.SP-data files
|
||||||
|
|
||||||
|
TMeanFieldsForScTrilayer::TMeanFieldsForScTrilayer() {
|
||||||
|
|
||||||
|
// read startup file
|
||||||
|
string startup_path_name("TFitPofB_startup.xml");
|
||||||
|
|
||||||
|
TSAXParser *saxParser = new TSAXParser();
|
||||||
|
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler();
|
||||||
|
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler);
|
||||||
|
int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
|
// check for parse errors
|
||||||
|
if (status) { // error
|
||||||
|
cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
string rge_path(startupHandler->GetDataPath());
|
||||||
|
vector< pair<double, string> > energy_vec(startupHandler->GetEnergies());
|
||||||
|
|
||||||
|
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
||||||
|
fImpProfile = x;
|
||||||
|
x = 0;
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
if (saxParser) {
|
||||||
|
delete saxParser;
|
||||||
|
saxParser = 0;
|
||||||
|
}
|
||||||
|
if (startupHandler) {
|
||||||
|
delete startupHandler;
|
||||||
|
startupHandler = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Operator-method that returns the mean field for a given implantation energy
|
||||||
|
// Parameters: field, deadlayer, layer1, layer2, layer3, lambda1, lambda2, lambda3, weight1, weight2, weight3, weight4, weight5
|
||||||
|
|
||||||
|
double TMeanFieldsForScTrilayer::operator()(double E, const vector<double> &par_vec) const{
|
||||||
|
|
||||||
|
vector<double> interfaces;
|
||||||
|
interfaces.push_back(par_vec[1]);
|
||||||
|
interfaces.push_back(par_vec[1]+par_vec[2]);
|
||||||
|
interfaces.push_back(par_vec[1]+par_vec[2]+par_vec[3]);
|
||||||
|
interfaces.push_back(par_vec[1]+par_vec[2]+par_vec[3]+par_vec[4]);
|
||||||
|
|
||||||
|
vector<double> weights;
|
||||||
|
weights.push_back(par_vec[8]);
|
||||||
|
weights.push_back(par_vec[9]);
|
||||||
|
weights.push_back(par_vec[10]);
|
||||||
|
weights.push_back(par_vec[11]);
|
||||||
|
weights.push_back(par_vec[12]);
|
||||||
|
|
||||||
|
// Calculate field profile
|
||||||
|
vector<double> parForBofZ;
|
||||||
|
for (unsigned int i(0); i<8; i++)
|
||||||
|
parForBofZ.push_back(par_vec[i]);
|
||||||
|
|
||||||
|
TLondon1D_3L BofZ(parForBofZ);
|
||||||
|
|
||||||
|
vector<double> energies(fImpProfile->Energy());
|
||||||
|
vector<double>::const_iterator energyIter;
|
||||||
|
energyIter = find(energies.begin(), energies.end(), E);
|
||||||
|
|
||||||
|
if (energyIter != energies.end()) { // implantation profile found - no interpolation needed
|
||||||
|
return CalcMeanB(E, interfaces, weights, BofZ);
|
||||||
|
} else {
|
||||||
|
if (E < *energies.begin())
|
||||||
|
return CalcMeanB(*energies.begin(), interfaces, weights, BofZ);
|
||||||
|
if (E > *(energies.end()-1))
|
||||||
|
return CalcMeanB(*(energies.end()-1), interfaces, weights, BofZ);
|
||||||
|
|
||||||
|
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
|
||||||
|
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
|
||||||
|
|
||||||
|
double E1(*(energyIter - 1));
|
||||||
|
double E2(*(energyIter));
|
||||||
|
|
||||||
|
double B1(CalcMeanB(E1, interfaces, weights, BofZ));
|
||||||
|
double B2(CalcMeanB(E2, interfaces, weights, BofZ));
|
||||||
|
|
||||||
|
return B1 + (B2-B1)/(E2-E1)*(E-E1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double TMeanFieldsForScTrilayer::CalcMeanB (double E, const vector<double>& interfaces, const vector<double>& weights, const TLondon1D_3L& BofZ) const {
|
||||||
|
//calcData->UseHighResolution(E);
|
||||||
|
fImpProfile->WeightLayers(E, interfaces, weights);
|
||||||
|
fImpProfile->Normalize(E);
|
||||||
|
|
||||||
|
vector<double> z(fImpProfile->DataZ(E));
|
||||||
|
vector<double> nz(fImpProfile->DataNZ(E));
|
||||||
|
|
||||||
|
// calculate mean field
|
||||||
|
|
||||||
|
double meanB(0.);
|
||||||
|
|
||||||
|
for (unsigned int i(0); i<z.size(); i++) {
|
||||||
|
meanB += (z[1]-z[0])*nz[i]*BofZ.GetBofZ(z[i]/10.);
|
||||||
|
}
|
||||||
|
return meanB;
|
||||||
|
}
|
101
src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.h
vendored
Normal file
101
src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.h
vendored
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
TCalcMeanFieldsLEM.h
|
||||||
|
|
||||||
|
Author: Bastian M. Wojek
|
||||||
|
e-mail: bastian.wojek@psi.ch
|
||||||
|
|
||||||
|
2009/11/27
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* 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 _TCalcMeanFieldsLEM_H_
|
||||||
|
#define _TCalcMeanFieldsLEM_H_
|
||||||
|
|
||||||
|
#include "TLondon1D.h"
|
||||||
|
|
||||||
|
class TMeanFieldsForScHalfSpace : public PUserFcnBase {
|
||||||
|
|
||||||
|
public:
|
||||||
|
// default constructor
|
||||||
|
TMeanFieldsForScHalfSpace();
|
||||||
|
~TMeanFieldsForScHalfSpace() {delete fImpProfile; fImpProfile = 0;}
|
||||||
|
|
||||||
|
double operator()(double, const vector<double>&) const;
|
||||||
|
double CalcMeanB (double, const TLondon1D_HS&) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
TTrimSPData *fImpProfile;
|
||||||
|
|
||||||
|
ClassDef(TMeanFieldsForScHalfSpace,1)
|
||||||
|
};
|
||||||
|
|
||||||
|
class TMeanFieldsForScSingleLayer : public PUserFcnBase {
|
||||||
|
|
||||||
|
public:
|
||||||
|
// default constructor
|
||||||
|
TMeanFieldsForScSingleLayer();
|
||||||
|
~TMeanFieldsForScSingleLayer() {delete fImpProfile; fImpProfile = 0;}
|
||||||
|
|
||||||
|
double operator()(double, const vector<double>&) const;
|
||||||
|
double CalcMeanB (double, const TLondon1D_1L&) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
TTrimSPData *fImpProfile;
|
||||||
|
|
||||||
|
ClassDef(TMeanFieldsForScSingleLayer,1)
|
||||||
|
};
|
||||||
|
|
||||||
|
class TMeanFieldsForScBilayer : public PUserFcnBase {
|
||||||
|
|
||||||
|
public:
|
||||||
|
// default constructor
|
||||||
|
TMeanFieldsForScBilayer();
|
||||||
|
~TMeanFieldsForScBilayer() {delete fImpProfile; fImpProfile = 0;}
|
||||||
|
|
||||||
|
double operator()(double, const vector<double>&) const;
|
||||||
|
double CalcMeanB (double, const vector<double>&, const vector<double>&, const TLondon1D_2L&) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
TTrimSPData *fImpProfile;
|
||||||
|
|
||||||
|
ClassDef(TMeanFieldsForScBilayer,1)
|
||||||
|
};
|
||||||
|
|
||||||
|
class TMeanFieldsForScTrilayer : public PUserFcnBase {
|
||||||
|
|
||||||
|
public:
|
||||||
|
// default constructor
|
||||||
|
TMeanFieldsForScTrilayer();
|
||||||
|
~TMeanFieldsForScTrilayer() {delete fImpProfile; fImpProfile = 0;}
|
||||||
|
|
||||||
|
double operator()(double, const vector<double>&) const;
|
||||||
|
double CalcMeanB (double, const vector<double>&, const vector<double>&, const TLondon1D_3L&) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
TTrimSPData *fImpProfile;
|
||||||
|
|
||||||
|
ClassDef(TMeanFieldsForScTrilayer,1)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* _TCalcMeanFieldsLEM_H_ */
|
46
src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEMLinkDef.h
vendored
Normal file
46
src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEMLinkDef.h
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
TCalcMeanFieldsLEMLinkDef.h
|
||||||
|
|
||||||
|
Author: Bastian M. Wojek
|
||||||
|
e-mail: bastian.wojek@psi.ch
|
||||||
|
|
||||||
|
2009/11/27
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* 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 --------------------------------------------------
|
||||||
|
#ifdef __CINT__
|
||||||
|
|
||||||
|
#pragma link off all globals;
|
||||||
|
#pragma link off all classes;
|
||||||
|
#pragma link off all functions;
|
||||||
|
|
||||||
|
#pragma link C++ class TMeanFieldsForScHalfSpace+;
|
||||||
|
#pragma link C++ class TMeanFieldsForScSingleLayer+;
|
||||||
|
#pragma link C++ class TMeanFieldsForScBilayer+;
|
||||||
|
#pragma link C++ class TMeanFieldsForScTrilayer+;
|
||||||
|
|
||||||
|
#endif //__CINT__
|
||||||
|
// root dictionary stuff --------------------------------------------------
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user