From a0a6c86a91b07148215cfc1c4c06f9410b3d00b2 Mon Sep 17 00:00:00 2001 From: "Bastian M. Wojek" Date: Tue, 3 Jun 2008 16:53:42 +0000 Subject: [PATCH] Added the number of steps of the theory function to the XML-startup-file --- .../TFitPofB-lib/classes/TBofZCalc.cpp | 34 +++++++------------ .../classes/TFitPofBStartupHandler.cpp | 15 +++++++- .../TFitPofB-lib/classes/TLondon1D.cpp | 12 ++++--- src/external/TFitPofB-lib/include/TBofZCalc.h | 10 +++--- .../include/TFitPofBStartupHandler.h | 4 ++- src/external/TFitPofB-lib/include/TLondon1D.h | 1 + .../TFitPofB-lib/test/TFitPofB_startup.xml | 7 ++-- 7 files changed, 49 insertions(+), 34 deletions(-) diff --git a/src/external/TFitPofB-lib/classes/TBofZCalc.cpp b/src/external/TFitPofB-lib/classes/TBofZCalc.cpp index 6dc70e5d..c3a725cd 100644 --- a/src/external/TFitPofB-lib/classes/TBofZCalc.cpp +++ b/src/external/TFitPofB-lib/classes/TBofZCalc.cpp @@ -5,7 +5,7 @@ Author: Bastian M. Wojek e-mail: bastian.wojek@psi.ch - 2008/05/30 + 2008/06/03 ***************************************************************************/ @@ -67,16 +67,14 @@ double TBofZCalc::GetBofZ(double zz) const { // Parameters: Bext[G], deadlayer[nm], thickness[nm], lambda[nm] //------------------ -TLondon1D_1L::TLondon1D_1L(const vector ¶m) { - - unsigned int n(5000); // number of steps for the calculation +TLondon1D_1L::TLondon1D_1L(unsigned int steps, const vector ¶m) { double N(cosh(param[2]/2.0/param[3])); - fDZ = param[2]/double(n); + fDZ = param[2]/double(steps); double ZZ, BBz; - for (unsigned int j(0); j ¶m) { // Parameters: Bext[G], deadlayer[nm], thickness1[nm], thickness2[nm], lambda1[nm], lambda2[nm] //------------------ -TLondon1D_2L::TLondon1D_2L(const vector ¶m) { - - unsigned int n(5000); // number of steps for the calculation +TLondon1D_2L::TLondon1D_2L(unsigned int steps, const vector ¶m) { double N1(param[5]*cosh(param[3]/param[5])*sinh(param[2]/param[4]) + param[4]*cosh(param[2]/param[4])*sinh(param[3]/param[5])); double N2(4.0*N1); - fDZ = (param[2]+param[3])/double(n); + fDZ = (param[2]+param[3])/double(steps); double ZZ, BBz; - for (unsigned int j(0); j ¶m) { // Parameters: Bext[G], deadlayer[nm], thickness1[nm], thickness2[nm], thickness3[nm], lambda1[nm], lambda2[nm], lambda3[nm] //------------------ -TLondon1D_3L::TLondon1D_3L(const vector ¶m) { - - unsigned int n(5000); // number of steps for the calculation +TLondon1D_3L::TLondon1D_3L(unsigned int steps, const vector ¶m) { double N1(param[7]*cosh(param[4]/param[7])*((exp(2.0*param[2]/param[5])-1.0)*param[6]*cosh(param[3]/param[6]) + (1.0+exp(2.0*param[2]/param[5]))*param[5]*sinh(param[3]/param[6])) + 2.0*exp(param[2]/param[5])*param[6]*(param[5]*cosh(param[2]/param[5])*cosh(param[3]/param[6]) + param[6]*sinh(param[2]/param[5])*sinh(param[3]/param[6]))*sinh(param[4]/param[7])); @@ -132,10 +126,10 @@ TLondon1D_3L::TLondon1D_3L(const vector ¶m) { double N3(4.0*((1.0+exp(2.0*param[2]/param[5]))*param[5]*(param[7]*cosh(param[4]/param[7])*sinh(param[3]/param[6]) + param[6]*cosh(param[3]/param[6])*sinh(param[4]/param[7])) + (-1.0+exp(2.0*param[2]/param[5]))*param[6]*(param[7]*cosh(param[3]/param[6])*cosh(param[4]/param[7]) + param[6]*sinh(param[3]/param[6])*sinh(param[4]/param[7])))); - fDZ = (param[2]+param[3]+param[4])/double(n); + fDZ = (param[2]+param[3]+param[4])/double(steps); double ZZ, BBz; - for (unsigned int j(0); j ¶m) { // Parameters: Bext[G], deadlayer[nm], thickness1[nm], thickness2[nm], thickness3[nm], lambda1[nm], lambda2[nm] //------------------ -TLondon1D_3LS::TLondon1D_3LS(const vector ¶m) { - - unsigned int n(5000); // number of steps for the calculation +TLondon1D_3LS::TLondon1D_3LS(unsigned int steps, const vector ¶m) { double N1(8.0*(param[5]*param[6]*cosh(param[3]/param[6])*sinh((param[2]+param[4])/param[5]) + ((param[5]*param[5]*cosh(param[2]/param[5])*cosh(param[4]/param[5])) + (param[6]*param[6]*sinh(param[2]/param[5])*sinh(param[4]/param[5])))*sinh(param[3]/param[6]))); @@ -166,10 +158,10 @@ TLondon1D_3LS::TLondon1D_3LS(const vector ¶m) { double N3(8.0*(param[5]*param[6]*cosh(param[3]/param[6])*sinh((param[2]+param[4])/param[5]) + (param[5]*param[5]*cosh(param[2]/param[5])*cosh(param[4]/param[5]) + param[6]*param[6]*sinh(param[2]/param[5])*sinh(param[4]/param[5]))*sinh(param[3]/param[6]))); - fDZ = (param[2]+param[3]+param[4])/double(n); + fDZ = (param[2]+param[3]+param[4])/double(steps); double ZZ, BBz; - for (unsigned int j(0); j */ -TFitPofBStartupHandler::TFitPofBStartupHandler() : fDeltat(0.), fDeltaB(0.) +TFitPofBStartupHandler::TFitPofBStartupHandler() : fDeltat(0.), fDeltaB(0.), fNSteps(0) { } @@ -106,6 +106,8 @@ void TFitPofBStartupHandler::OnStartElement(const char *str, const TList *attrib fKey = eDeltaB; } else if (!strcmp(str, "wisdom")) { fKey = eWisdomFile; + } if (!strcmp(str, "N_theory")) { + fKey = eNSteps; } } @@ -153,6 +155,10 @@ void TFitPofBStartupHandler::OnCharacters(const char *str) // set the wisdom file to the given name fWisdomFile = str; break; + case eNSteps: + // convert str to int and assign it to the deltat-member + fNSteps = atoi(str); + break; default: break; } @@ -278,6 +284,13 @@ void TFitPofBStartupHandler::CheckLists() fWisdomFile = "WordsOfWisdom.dat"; } + // check if any number of steps for the theory function is specified + cout << endl << ">> check number of steps for theory ..." << endl; + if (!fNSteps) { + cout << endl << ">> You did not specify the number of steps for the theory. Setting the default." << endl; + fNSteps = 3000; + } + } // end --------------------------------------------------------------------- diff --git a/src/external/TFitPofB-lib/classes/TLondon1D.cpp b/src/external/TFitPofB-lib/classes/TLondon1D.cpp index 52a38e96..5b72ee27 100644 --- a/src/external/TFitPofB-lib/classes/TLondon1D.cpp +++ b/src/external/TFitPofB-lib/classes/TLondon1D.cpp @@ -60,6 +60,7 @@ TLondon1D1L::TLondon1D1L(const vector &parNo, const vector cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl; } + fNSteps = startupHandler->GetNSteps(); fWisdom = startupHandler->GetWisdomFile(); string rge_path(startupHandler->GetDataPath()); vector energy_vec(startupHandler->GetEnergyList()); @@ -140,7 +141,7 @@ double TLondon1D1L::Eval(double t, const vector &par) const { fParForPofB[2] = par[1]; // energy - TLondon1D_1L BofZ1(fParForBofZ); + TLondon1D_1L BofZ1(fNSteps, fParForBofZ); TPofBCalc PofB1(BofZ1, *fImpProfile, fParForPofB); fPofT->DoFFT(PofB1); @@ -181,6 +182,7 @@ TLondon1D2L::TLondon1D2L(const vector &parNo, const vector cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl; } + fNSteps = startupHandler->GetNSteps(); fWisdom = startupHandler->GetWisdomFile(); string rge_path(startupHandler->GetDataPath()); vector energy_vec(startupHandler->GetEnergyList()); @@ -274,7 +276,7 @@ double TLondon1D2L::Eval(double t, const vector &par) const { fImpProfile->WeightLayers(par[1], interfaces, weights); } - TLondon1D_2L BofZ2(fParForBofZ); + TLondon1D_2L BofZ2(fNSteps, fParForBofZ); TPofBCalc PofB2(BofZ2, *fImpProfile, fParForPofB); fPofT->DoFFT(PofB2); @@ -316,6 +318,7 @@ TLondon1D3L::TLondon1D3L(const vector &parNo, const vector cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl; } + fNSteps = startupHandler->GetNSteps(); fWisdom = startupHandler->GetWisdomFile(); string rge_path(startupHandler->GetDataPath()); vector energy_vec(startupHandler->GetEnergyList()); @@ -425,7 +428,7 @@ double TLondon1D3L::Eval(double t, const vector &par) const { fImpProfile->WeightLayers(par[1], interfaces, weights); } - TLondon1D_3L BofZ3(fParForBofZ); + TLondon1D_3L BofZ3(fNSteps, fParForBofZ); TPofBCalc PofB3(BofZ3, *fImpProfile, fParForPofB); fPofT->DoFFT(PofB3); @@ -467,6 +470,7 @@ TLondon1D3LS::TLondon1D3LS(const vector &parNo, const vectorGetNSteps(); fWisdom = startupHandler->GetWisdomFile(); string rge_path(startupHandler->GetDataPath()); vector energy_vec(startupHandler->GetEnergyList()); @@ -562,7 +566,7 @@ double TLondon1D3LS::Eval(double t, const vector &par) const { fImpProfile->WeightLayers(par[1], interfaces, weights); } - TLondon1D_3LS BofZ3S(fParForBofZ); + TLondon1D_3LS BofZ3S(fNSteps, fParForBofZ); TPofBCalc PofB3S(BofZ3S, *fImpProfile, fParForPofB); fPofT->DoFFT(PofB3S); diff --git a/src/external/TFitPofB-lib/include/TBofZCalc.h b/src/external/TFitPofB-lib/include/TBofZCalc.h index 3277a81a..dc0b4a58 100644 --- a/src/external/TFitPofB-lib/include/TBofZCalc.h +++ b/src/external/TFitPofB-lib/include/TBofZCalc.h @@ -5,7 +5,7 @@ Author: Bastian M. Wojek e-mail: bastian.wojek@psi.ch - 2008/05/30 + 2008/06/03 ***************************************************************************/ @@ -52,7 +52,7 @@ class TLondon1D_1L : public TBofZCalc { public: - TLondon1D_1L( const vector& ); + TLondon1D_1L(unsigned int, const vector& ); }; @@ -64,7 +64,7 @@ class TLondon1D_2L : public TBofZCalc { public: - TLondon1D_2L( const vector& ); + TLondon1D_2L(unsigned int, const vector& ); }; @@ -76,7 +76,7 @@ class TLondon1D_3L : public TBofZCalc { public: - TLondon1D_3L( const vector& ); + TLondon1D_3L(unsigned int, const vector& ); }; @@ -88,7 +88,7 @@ class TLondon1D_3LS : public TBofZCalc { public: - TLondon1D_3LS( const vector& ); + TLondon1D_3LS(unsigned int, const vector& ); }; diff --git a/src/external/TFitPofB-lib/include/TFitPofBStartupHandler.h b/src/external/TFitPofB-lib/include/TFitPofBStartupHandler.h index 6dba8e9c..bdd6e373 100644 --- a/src/external/TFitPofB-lib/include/TFitPofBStartupHandler.h +++ b/src/external/TFitPofB-lib/include/TFitPofBStartupHandler.h @@ -64,9 +64,10 @@ class TFitPofBStartupHandler : public TQObject { virtual const double GetDeltat() const { return fDeltat; } virtual const double GetDeltaB() const { return fDeltaB; } virtual const string GetWisdomFile() const { return fWisdomFile; } + virtual const unsigned int GetNSteps() const { return fNSteps; } private: - enum EKeyWords {eEmpty, eComment, eDataPath, eEnergy, eEnergyList, eDeltat, eDeltaB, eWisdomFile}; + enum EKeyWords {eEmpty, eComment, eDataPath, eEnergy, eEnergyList, eDeltat, eDeltaB, eWisdomFile, eNSteps}; EKeyWords fKey; @@ -75,6 +76,7 @@ class TFitPofBStartupHandler : public TQObject { double fDeltat; double fDeltaB; string fWisdomFile; + unsigned int fNSteps; ClassDef(TFitPofBStartupHandler, 1) }; diff --git a/src/external/TFitPofB-lib/include/TLondon1D.h b/src/external/TFitPofB-lib/include/TLondon1D.h index dacdc407..2ba699a4 100644 --- a/src/external/TFitPofB-lib/include/TLondon1D.h +++ b/src/external/TFitPofB-lib/include/TLondon1D.h @@ -33,6 +33,7 @@ protected: mutable vector fParForBofZ; mutable vector fParForPofB; string fWisdom; + unsigned int fNSteps; ClassDef(TLondon1D,1) }; diff --git a/src/external/TFitPofB-lib/test/TFitPofB_startup.xml b/src/external/TFitPofB-lib/test/TFitPofB_startup.xml index fd4ad4d2..57cc1bf7 100644 --- a/src/external/TFitPofB-lib/test/TFitPofB_startup.xml +++ b/src/external/TFitPofB-lib/test/TFitPofB_startup.xml @@ -2,12 +2,15 @@ TFitPofB_startup.xml - Defines path and energies (keV, format: %02u_%1u) of TrimSP-rge-files, path to the FFTW-wisdom-file and time/field binning (us/G) - + Defines path/prefix and energies (keV, format: %02u_%1u) of TrimSP-rge-files, + path/name to the FFTW-wisdom-file and time/field binning (us/G) + N_theory determines the number of points in "real space" where the theory function will be calculated + /home/l_wojek/TrimSP/AuYBCO_2005/AuYBCO-500000- WordsOfWisdom.dat 0.01 0.01 + 5000 04_6 09_6