Adjusted a few things to get the thing working with musrfit

This commit is contained in:
Bastian M. Wojek 2008-06-12 18:06:50 +00:00
parent 120574c5a2
commit ce3078db6d
5 changed files with 338 additions and 252 deletions

View File

@ -5,7 +5,7 @@ ROOTCFLAGS = $(shell $(ROOTSYS)/bin/root-config --cflags)
#--------------------------------------------------- #---------------------------------------------------
OS = LINUX
CXX = g++ CXX = g++
CXXFLAGS = -g -Wall -Wno-trigraphs -fPIC CXXFLAGS = -g -Wall -Wno-trigraphs -fPIC
MUSRFITINCLUDE = ../../../include MUSRFITINCLUDE = ../../../include
@ -63,3 +63,9 @@ TFitPofBStartupHandlerDict.cpp: ../include/TFitPofBStartupHandler.h ../include/T
@echo "Generating dictionary $@..." @echo "Generating dictionary $@..."
rootcint -f $@ -c -p $^ 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

View File

@ -16,16 +16,54 @@ using namespace std;
#include <TSAXParser.h> #include <TSAXParser.h>
#include "TFitPofBStartupHandler.h" #include "TFitPofBStartupHandler.h"
ClassImp(TLondon1D)
ClassImp(TLondon1D1L) ClassImp(TLondon1D1L)
ClassImp(TLondon1D2L) ClassImp(TLondon1D2L)
ClassImp(TLondon1D3L)
ClassImp(TLondon1D3LS) ClassImp(TLondon1D3LS)
//------------------ //------------------
// Destructor of the TLondon1D class -- cleaning up // Destructor of the TLondon1D1L/2L/3L/3LS classes -- cleaning up
//------------------ //------------------
TLondon1D::~TLondon1D() { TLondon1D1L::~TLondon1D1L() {
cout << "This is the TLondon1D1L-destructor. Jippieh!" << endl;
fPar.clear();
fParForBofZ.clear();
fParForPofB.clear();
fParForPofT.clear();
delete fImpProfile;
fImpProfile = 0;
delete fPofT;
fPofT = 0;
}
TLondon1D2L::~TLondon1D2L() {
cout << "This is the TLondon1D2L-destructor. Jippieh!" << endl;
fPar.clear();
fParForBofZ.clear();
fParForPofB.clear();
fParForPofT.clear();
delete fImpProfile;
fImpProfile = 0;
delete fPofT;
fPofT = 0;
}
TLondon1D3L::~TLondon1D3L() {
cout << "This is the TLondon1D3L-destructor. Jippieh!" << endl;
fPar.clear();
fParForBofZ.clear();
fParForPofB.clear();
fParForPofT.clear();
delete fImpProfile;
fImpProfile = 0;
delete fPofT;
fPofT = 0;
}
TLondon1D3LS::~TLondon1D3LS() {
cout << "This is the TLondon1D3LS-destructor. Jippieh!" << endl;
fPar.clear(); fPar.clear();
fParForBofZ.clear(); fParForBofZ.clear();
fParForPofB.clear(); fParForPofB.clear();
@ -41,63 +79,53 @@ TLondon1D::~TLondon1D() {
// creates (a pointer to) the TPofTCalc object (with the FFT plan) // creates (a pointer to) the TPofTCalc object (with the FFT plan)
//------------------ //------------------
TLondon1D1L::TLondon1D1L(const vector<double> &par) { TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) {
cout << "This is the TLondon1D1L-constructor. Juhu!" << endl;
// extract function parameters // read startup file
// for(unsigned int i(0); i<parNo.size(); i++) { string startup_path_name("TFitPofB_startup.xml");
// fPar.push_back(par[parNo[i]-1]);
// }
fPar = par; 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;
}
// read startup file fNSteps = startupHandler->GetNSteps();
string startup_path_name("TFitPofB_startup.xml"); fWisdom = startupHandler->GetWisdomFile();
string rge_path(startupHandler->GetDataPath());
vector<string> energy_vec(startupHandler->GetEnergyList());
TSAXParser *saxParser = new TSAXParser(); fParForPofT.push_back(0.0);
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); fParForPofT.push_back(startupHandler->GetDeltat());
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); fParForPofT.push_back(startupHandler->GetDeltaB());
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;
}
fNSteps = startupHandler->GetNSteps(); fParForPofB.push_back(startupHandler->GetDeltat());
fWisdom = startupHandler->GetWisdomFile(); fParForPofB.push_back(startupHandler->GetDeltaB());
string rge_path(startupHandler->GetDataPath()); fParForPofB.push_back(0.0);
vector<string> energy_vec(startupHandler->GetEnergyList());
fParForPofT.push_back(fPar[0]); TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
fParForPofT.push_back(startupHandler->GetDeltat()); fImpProfile = x;
fParForPofT.push_back(startupHandler->GetDeltaB()); x = 0;
delete x;
for (unsigned int i(2); i<fPar.size(); i++) TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
fParForBofZ.push_back(fPar[i]); fPofT = y;
y = 0;
delete y;
fParForPofB.push_back(startupHandler->GetDeltat()); // clean up
fParForPofB.push_back(startupHandler->GetDeltaB()); if (saxParser) {
fParForPofB.push_back(fPar[1]); delete saxParser;
saxParser = 0;
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec); }
fImpProfile = x; if (startupHandler) {
x = 0; delete startupHandler;
delete x; startupHandler = 0;
}
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
fPofT = y;
y = 0;
delete y;
// clean up
if (saxParser) {
delete saxParser;
saxParser = 0;
}
if (startupHandler) {
delete startupHandler;
startupHandler = 0;
}
} }
//------------------ //------------------
@ -107,6 +135,25 @@ TLondon1D1L::TLondon1D1L(const vector<double> &par) {
//------------------ //------------------
double TLondon1D1L::operator()(double t, const vector<double> &par) const { double TLondon1D1L::operator()(double t, const vector<double> &par) const {
if(t<0.0)
return 0.0;
// check if the function is called the first time and if yes, read in parameters
if(fFirstCall){
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++){
fParForBofZ.push_back(fPar[i]);
cout << "fParForBofZ[" << i-2 << "] = " << fParForBofZ[i-2] << endl;
}
fFirstCall=false;
cout << this << endl;
}
// check if any parameter has changed // check if any parameter has changed
@ -136,9 +183,9 @@ double TLondon1D1L::operator()(double t, const vector<double> &par) const {
if(!only_phase_changed) { if(!only_phase_changed) {
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;
for (unsigned int i(2); i<par.size(); i++) for (unsigned int i(2); i<fPar.size(); i++)
fParForBofZ[i-2] = par[i]; fParForBofZ[i-2] = par[i];
fParForPofB[2] = par[1]; // energy fParForPofB[2] = par[1]; // energy
@ -147,9 +194,9 @@ double TLondon1D1L::operator()(double t, const vector<double> &par) const {
TPofBCalc PofB1(BofZ1, *fImpProfile, fParForPofB); TPofBCalc PofB1(BofZ1, *fImpProfile, fParForPofB);
fPofT->DoFFT(PofB1); fPofT->DoFFT(PofB1);
} 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;
} }*/
fPofT->CalcPol(fParForPofT); fPofT->CalcPol(fParForPofT);
@ -165,62 +212,51 @@ double TLondon1D1L::operator()(double t, const vector<double> &par) const {
// creates (a pointer to) the TPofTCalc object (with the FFT plan) // creates (a pointer to) the TPofTCalc object (with the FFT plan)
//------------------ //------------------
TLondon1D2L::TLondon1D2L(const vector<double> &par) : fLastTwoChanged(true) { TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true), fLastTwoChanged(true) {
// extract function parameters
// for(unsigned int i(0); i<parNo.size(); i++) {
// fPar.push_back(par[parNo[i]-1]);
// }
fPar = par;
// read startup file // read startup file
string startup_path_name("TFitPofB_startup.xml"); string startup_path_name("TFitPofB_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler();
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler);
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl; cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl;
} }
fNSteps = startupHandler->GetNSteps(); fNSteps = startupHandler->GetNSteps();
fWisdom = startupHandler->GetWisdomFile(); fWisdom = startupHandler->GetWisdomFile();
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(fPar[0]); fParForPofT.push_back(0.0);
fParForPofT.push_back(startupHandler->GetDeltat()); fParForPofT.push_back(startupHandler->GetDeltat());
fParForPofT.push_back(startupHandler->GetDeltaB()); fParForPofT.push_back(startupHandler->GetDeltaB());
for (unsigned int i(2); i<fPar.size(); i++) fParForPofB.push_back(startupHandler->GetDeltat());
fParForBofZ.push_back(fPar[i]); fParForPofB.push_back(startupHandler->GetDeltaB());
fParForPofB.push_back(0.0);
fParForPofB.push_back(startupHandler->GetDeltat()); TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
fParForPofB.push_back(startupHandler->GetDeltaB()); fImpProfile = x;
fParForPofB.push_back(fPar[1]); x = 0;
delete x;
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec); TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
fImpProfile = x; fPofT = y;
x = 0; y = 0;
delete x; delete y;
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT); // clean up
fPofT = y; if (saxParser) {
y = 0; delete saxParser;
delete y; saxParser = 0;
}
// clean up if (startupHandler) {
if (saxParser) { delete startupHandler;
delete saxParser; startupHandler = 0;
saxParser = 0; }
}
if (startupHandler) {
delete startupHandler;
startupHandler = 0;
}
} }
//------------------ //------------------
@ -230,6 +266,24 @@ TLondon1D2L::TLondon1D2L(const vector<double> &par) : fLastTwoChanged(true) {
//------------------ //------------------
double TLondon1D2L::operator()(double t, const vector<double> &par) const { double TLondon1D2L::operator()(double t, const vector<double> &par) const {
if(t<0.0)
return 0.0;
// check if the function is called the first time and if yes, read in parameters
if(fFirstCall){
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++){
fParForBofZ.push_back(fPar[i]);
cout << "fParForBofZ[" << i-2 << "] = " << fParForBofZ[i-2] << endl;
}
fFirstCall=false;
}
// check if any parameter has changed // check if any parameter has changed
@ -261,7 +315,7 @@ double TLondon1D2L::operator()(double t, const vector<double> &par) const {
if(!only_phase_changed) { if(!only_phase_changed) {
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;
for (unsigned int i(2); i<par.size(); i++) for (unsigned int i(2); i<par.size(); i++)
fParForBofZ[i-2] = par[i]; fParForBofZ[i-2] = par[i];
@ -284,9 +338,9 @@ double TLondon1D2L::operator()(double t, const vector<double> &par) const {
TPofBCalc PofB2(BofZ2, *fImpProfile, fParForPofB); TPofBCalc PofB2(BofZ2, *fImpProfile, fParForPofB);
fPofT->DoFFT(PofB2); fPofT->DoFFT(PofB2);
} 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;
} }*/
fPofT->CalcPol(fParForPofT); fPofT->CalcPol(fParForPofT);
@ -303,63 +357,51 @@ double TLondon1D2L::operator()(double t, const vector<double> &par) const {
// creates (a pointer to) the TPofTCalc object (with the FFT plan) // creates (a pointer to) the TPofTCalc object (with the FFT plan)
//------------------ //------------------
TLondon1D3L::TLondon1D3L(const vector<double> &par) : fLastThreeChanged(true) { TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true), fLastThreeChanged(true) {
// read startup file
string startup_path_name("TFitPofB_startup.xml");
// extract function parameters TSAXParser *saxParser = new TSAXParser();
// for(unsigned int i(0); i<parNo.size(); i++) { TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler();
// fPar.push_back(par[parNo[i]-1]); 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;
}
fPar = par; fNSteps = startupHandler->GetNSteps();
fWisdom = startupHandler->GetWisdomFile();
string rge_path(startupHandler->GetDataPath());
vector<string> energy_vec(startupHandler->GetEnergyList());
// read startup file fParForPofT.push_back(0.0);
string startup_path_name("TFitPofB_startup.xml"); fParForPofT.push_back(startupHandler->GetDeltat());
fParForPofT.push_back(startupHandler->GetDeltaB());
TSAXParser *saxParser = new TSAXParser(); fParForPofB.push_back(startupHandler->GetDeltat());
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); fParForPofB.push_back(startupHandler->GetDeltaB());
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); fParForPofB.push_back(0.0);
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;
}
fNSteps = startupHandler->GetNSteps(); TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
fWisdom = startupHandler->GetWisdomFile(); fImpProfile = x;
string rge_path(startupHandler->GetDataPath()); x = 0;
vector<string> energy_vec(startupHandler->GetEnergyList()); delete x;
fParForPofT.push_back(fPar[0]); TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
fParForPofT.push_back(startupHandler->GetDeltat()); fPofT = y;
fParForPofT.push_back(startupHandler->GetDeltaB()); y = 0;
delete y;
for (unsigned int i(2); i<fPar.size(); i++)
fParForBofZ.push_back(fPar[i]);
fParForPofB.push_back(startupHandler->GetDeltat());
fParForPofB.push_back(startupHandler->GetDeltaB());
fParForPofB.push_back(fPar[1]);
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
fImpProfile = x;
x = 0;
delete x;
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
fPofT = y;
y = 0;
delete y;
// clean up
if (saxParser) {
delete saxParser;
saxParser = 0;
}
if (startupHandler) {
delete startupHandler;
startupHandler = 0;
}
// clean up
if (saxParser) {
delete saxParser;
saxParser = 0;
}
if (startupHandler) {
delete startupHandler;
startupHandler = 0;
}
} }
//------------------ //------------------
@ -369,6 +411,24 @@ TLondon1D3L::TLondon1D3L(const vector<double> &par) : fLastThreeChanged(true) {
//------------------ //------------------
double TLondon1D3L::operator()(double t, const vector<double> &par) const { double TLondon1D3L::operator()(double t, const vector<double> &par) const {
if(t<0.0)
return 0.0;
// check if the function is called the first time and if yes, read in parameters
if(fFirstCall){
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++){
fParForBofZ.push_back(fPar[i]);
cout << "fParForBofZ[" << i-2 << "] = " << fParForBofZ[i-2] << endl;
}
fFirstCall=false;
}
// check if any parameter has changed // check if any parameter has changed
@ -400,7 +460,7 @@ double TLondon1D3L::operator()(double t, const vector<double> &par) const {
if(!only_phase_changed) { if(!only_phase_changed) {
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;
for (unsigned int i(2); i<par.size(); i++) for (unsigned int i(2); i<par.size(); i++)
fParForBofZ[i-2] = par[i]; fParForBofZ[i-2] = par[i];
@ -438,9 +498,9 @@ double TLondon1D3L::operator()(double t, const vector<double> &par) const {
TPofBCalc PofB3(BofZ3, *fImpProfile, fParForPofB); TPofBCalc PofB3(BofZ3, *fImpProfile, fParForPofB);
fPofT->DoFFT(PofB3); fPofT->DoFFT(PofB3);
} 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;
} }*/
fPofT->CalcPol(fParForPofT); fPofT->CalcPol(fParForPofT);
@ -457,63 +517,51 @@ double TLondon1D3L::operator()(double t, const vector<double> &par) const {
// creates (a pointer to) the TPofTCalc object (with the FFT plan) // creates (a pointer to) the TPofTCalc object (with the FFT plan)
//------------------ //------------------
TLondon1D3LS::TLondon1D3LS(const vector<double> &par) : fLastThreeChanged(true) { TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true), fLastThreeChanged(true) {
// read startup file
string startup_path_name("TFitPofB_startup.xml");
// extract function parameters TSAXParser *saxParser = new TSAXParser();
// for(unsigned int i(0); i<parNo.size(); i++) { TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler();
// fPar.push_back(par[parNo[i]-1]); 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;
}
fPar = par; fNSteps = startupHandler->GetNSteps();
fWisdom = startupHandler->GetWisdomFile();
string rge_path(startupHandler->GetDataPath());
vector<string> energy_vec(startupHandler->GetEnergyList());
// read startup file fParForPofT.push_back(0.0);
string startup_path_name("TFitPofB_startup.xml"); fParForPofT.push_back(startupHandler->GetDeltat());
fParForPofT.push_back(startupHandler->GetDeltaB());
TSAXParser *saxParser = new TSAXParser(); fParForPofB.push_back(startupHandler->GetDeltat());
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler(); fParForPofB.push_back(startupHandler->GetDeltaB());
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler); fParForPofB.push_back(0.0);
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;
}
fNSteps = startupHandler->GetNSteps(); TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
fWisdom = startupHandler->GetWisdomFile(); fImpProfile = x;
string rge_path(startupHandler->GetDataPath()); x = 0;
vector<string> energy_vec(startupHandler->GetEnergyList()); delete x;
fParForPofT.push_back(fPar[0]); TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
fParForPofT.push_back(startupHandler->GetDeltat()); fPofT = y;
fParForPofT.push_back(startupHandler->GetDeltaB()); y = 0;
delete y;
for (unsigned int i(2); i<fPar.size(); i++)
fParForBofZ.push_back(fPar[i]);
fParForPofB.push_back(startupHandler->GetDeltat());
fParForPofB.push_back(startupHandler->GetDeltaB());
fParForPofB.push_back(fPar[1]);
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
fImpProfile = x;
x = 0;
delete x;
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
fPofT = y;
y = 0;
delete y;
// clean up
if (saxParser) {
delete saxParser;
saxParser = 0;
}
if (startupHandler) {
delete startupHandler;
startupHandler = 0;
}
// clean up
if (saxParser) {
delete saxParser;
saxParser = 0;
}
if (startupHandler) {
delete startupHandler;
startupHandler = 0;
}
} }
//------------------ //------------------
@ -523,6 +571,24 @@ TLondon1D3LS::TLondon1D3LS(const vector<double> &par) : fLastThreeChanged(true)
//------------------ //------------------
double TLondon1D3LS::operator()(double t, const vector<double> &par) const { double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
if(t<0.0)
return 0.0;
// check if the function is called the first time and if yes, read in parameters
if(fFirstCall){
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++){
fParForBofZ.push_back(fPar[i]);
cout << "fParForBofZ[" << i-2 << "] = " << fParForBofZ[i-2] << endl;
}
fFirstCall=false;
}
// check if any parameter has changed // check if any parameter has changed
@ -554,7 +620,7 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
if(!only_phase_changed) { if(!only_phase_changed) {
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;
for (unsigned int i(2); i<par.size(); i++) for (unsigned int i(2); i<par.size(); i++)
fParForBofZ[i-2] = par[i]; fParForBofZ[i-2] = par[i];
@ -578,9 +644,9 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
TPofBCalc PofB3S(BofZ3S, *fImpProfile, fParForPofB); TPofBCalc PofB3S(BofZ3S, *fImpProfile, fParForPofB);
fPofT->DoFFT(PofB3S); fPofT->DoFFT(PofB3S);
} 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;
} }*/
fPofT->CalcPol(fParForPofT); fPofT->CalcPol(fParForPofT);

View File

@ -53,7 +53,7 @@ TPofTCalc::TPofTCalc (const string &wisdom, const vector<double> &par) : fWisdom
} }
fFFTplan = fftw_plan_dft_r2c_1d(fNFFT, fFFTin, fFFTout, FFTW_EXHAUSTIVE); fFFTplan = fftw_plan_dft_r2c_1d(fNFFT, fFFTin, fFFTout, FFTW_EXHAUSTIVE);
cout << &fFFTplan << endl;
} }
//-------------- //--------------
@ -93,7 +93,7 @@ void TPofTCalc::DoFFT(const TPofBCalc &PofB) {
fFFTout[i][1] = 0.0; fFFTout[i][1] = 0.0;
} }
cout << "perform the Fourier transform..." << endl; // cout << "perform the Fourier transform..." << endl;
fftw_execute(fFFTplan); fftw_execute(fFFTplan);
@ -154,7 +154,7 @@ TPofTCalc::~TPofTCalc() {
fftw_destroy_plan(fFFTplan); fftw_destroy_plan(fFFTplan);
free(fFFTin); free(fFFTin);
fftw_free(fFFTout); fftw_free(fFFTout);
fftw_cleanup(); // fftw_cleanup();
fT.clear(); fT.clear();
fPT.clear(); fPT.clear();

View File

@ -15,86 +15,101 @@
#include "PUserFcnBase.h" #include "PUserFcnBase.h"
#include "TPofTCalc.h" #include "TPofTCalc.h"
class TLondon1D : public PUserFcnBase { class TLondon1D1L : public PUserFcnBase {
public: public:
// default conctructor only for the ROOT dictionary - DO NOT USE IT OTHERWISE! // default conctructor
TLondon1D() : fCalcNeeded(true) {} TLondon1D1L();
virtual ~TLondon1D(); ~TLondon1D1L();
virtual double operator()(double, const vector<double>&) const = 0; double operator()(double, const vector<double>&) const;
protected: private:
mutable vector<double> fPar; mutable vector<double> fPar;
TTrimSPData *fImpProfile; TTrimSPData *fImpProfile;
TPofTCalc *fPofT; TPofTCalc *fPofT;
mutable bool fCalcNeeded; mutable bool fCalcNeeded;
mutable bool fFirstCall;
mutable vector<double> fParForPofT; mutable vector<double> fParForPofT;
mutable vector<double> fParForBofZ; mutable vector<double> fParForBofZ;
mutable vector<double> fParForPofB; mutable vector<double> fParForPofB;
string fWisdom; string fWisdom;
unsigned int fNSteps; unsigned int fNSteps;
ClassDef(TLondon1D,1)
};
class TLondon1D1L : public TLondon1D {
public:
// default conctructor only for the ROOT dictionary - DO NOT USE IT OTHERWISE!
TLondon1D1L() {}
TLondon1D1L(const vector<double>&);
~TLondon1D1L() {}
double operator()(double, const vector<double>&) const;
ClassDef(TLondon1D1L,1) ClassDef(TLondon1D1L,1)
}; };
class TLondon1D2L : public TLondon1D { class TLondon1D2L : public PUserFcnBase {
public: public:
// default conctructor only for the ROOT dictionary - DO NOT USE IT OTHERWISE! // default conctructor
TLondon1D2L() : fLastTwoChanged(true) {} TLondon1D2L();
TLondon1D2L(const vector<double>&); ~TLondon1D2L();
~TLondon1D2L() {}
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
mutable vector<double> fPar;
TTrimSPData *fImpProfile;
TPofTCalc *fPofT;
mutable bool fCalcNeeded;
mutable bool fFirstCall;
mutable vector<double> fParForPofT;
mutable vector<double> fParForBofZ;
mutable vector<double> fParForPofB;
string fWisdom;
unsigned int fNSteps;
mutable bool fLastTwoChanged; mutable bool fLastTwoChanged;
ClassDef(TLondon1D2L,1) ClassDef(TLondon1D2L,1)
}; };
class TLondon1D3L : public TLondon1D { class TLondon1D3L : public PUserFcnBase {
public: public:
// default conctructor only for the ROOT dictionary - DO NOT USE IT OTHERWISE! // default conctructor
TLondon1D3L() : fLastThreeChanged(true) {} TLondon1D3L();
TLondon1D3L(const vector<double>&); ~TLondon1D3L();
~TLondon1D3L() {}
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
mutable vector<double> fPar;
TTrimSPData *fImpProfile;
TPofTCalc *fPofT;
mutable bool fCalcNeeded;
mutable bool fFirstCall;
mutable vector<double> fParForPofT;
mutable vector<double> fParForBofZ;
mutable vector<double> fParForPofB;
string fWisdom;
unsigned int fNSteps;
mutable bool fLastThreeChanged; mutable bool fLastThreeChanged;
ClassDef(TLondon1D3L,1) ClassDef(TLondon1D3L,1)
}; };
class TLondon1D3LS : public TLondon1D { class TLondon1D3LS : public PUserFcnBase {
public: public:
// default conctructor only for the ROOT dictionary - DO NOT USE IT OTHERWISE! // default conctructor
TLondon1D3LS() : fLastThreeChanged(true) {} TLondon1D3LS();
TLondon1D3LS(const vector<double>&); ~TLondon1D3LS();
~TLondon1D3LS() {}
double operator()(double, const vector<double>&) const; double operator()(double, const vector<double>&) const;
private: private:
mutable vector<double> fPar;
TTrimSPData *fImpProfile;
TPofTCalc *fPofT;
mutable bool fCalcNeeded;
mutable bool fFirstCall;
mutable vector<double> fParForPofT;
mutable vector<double> fParForBofZ;
mutable vector<double> fParForPofB;
string fWisdom;
unsigned int fNSteps;
mutable bool fLastThreeChanged; mutable bool fLastThreeChanged;
ClassDef(TLondon1D3LS,1) ClassDef(TLondon1D3LS,1)

View File

@ -16,7 +16,6 @@
#pragma link off all classes; #pragma link off all classes;
#pragma link off all functions; #pragma link off all functions;
#pragma link C++ class TLondon1D+;
#pragma link C++ class TLondon1D1L+; #pragma link C++ class TLondon1D1L+;
#pragma link C++ class TLondon1D2L+; #pragma link C++ class TLondon1D2L+;
#pragma link C++ class TLondon1D3L+; #pragma link C++ class TLondon1D3L+;