Sourced out some more specifications to be made by the user to the XML-startup-file
This commit is contained in:
parent
e4e561d9b6
commit
c721589cde
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/05/30
|
||||
2008/06/03
|
||||
|
||||
based upon:
|
||||
$Id: PStartupHandler.cpp 3340 2008-04-30 12:27:01Z nemu $
|
||||
@ -46,7 +46,7 @@ ClassImpQ(TFitPofBStartupHandler)
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
TFitPofBStartupHandler::TFitPofBStartupHandler()
|
||||
TFitPofBStartupHandler::TFitPofBStartupHandler() : fDeltat(0.), fDeltaB(0.)
|
||||
{
|
||||
}
|
||||
|
||||
@ -100,6 +100,12 @@ void TFitPofBStartupHandler::OnStartElement(const char *str, const TList *attrib
|
||||
fKey = eDataPath;
|
||||
} else if (!strcmp(str, "energy")) {
|
||||
fKey = eEnergy;
|
||||
} else if (!strcmp(str, "delta_t")) {
|
||||
fKey = eDeltat;
|
||||
} else if (!strcmp(str, "delta_B")) {
|
||||
fKey = eDeltaB;
|
||||
} else if (!strcmp(str, "wisdom")) {
|
||||
fKey = eWisdomFile;
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,6 +141,18 @@ void TFitPofBStartupHandler::OnCharacters(const char *str)
|
||||
// add str to the energy list
|
||||
fEnergyList.push_back(str);
|
||||
break;
|
||||
case eDeltat:
|
||||
// convert str to double and assign it to the deltat-member
|
||||
fDeltat = atof(str);
|
||||
break;
|
||||
case eDeltaB:
|
||||
// convert str to double and assign it to the deltaB-member
|
||||
fDeltaB = atof(str);
|
||||
break;
|
||||
case eWisdomFile:
|
||||
// set the wisdom file to the given name
|
||||
fWisdomFile = str;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -229,7 +247,7 @@ void TFitPofBStartupHandler::CheckLists()
|
||||
// check if any energies are given
|
||||
cout << endl << ">> check energy list ..." << endl;
|
||||
if (!fEnergyList.size()) {
|
||||
cout << endl << ">> Energy list empty! Setting the default list.";
|
||||
cout << endl << ">> Energy list empty! Setting the default list." << endl;
|
||||
char eChar[5];
|
||||
for(unsigned int i(0); i<33; i++) {
|
||||
for(unsigned int j(0); j<10; j++) {
|
||||
@ -238,6 +256,28 @@ void TFitPofBStartupHandler::CheckLists()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if delta_t is given, if not set default
|
||||
cout << endl << ">> check specified time resolution ..." << endl;
|
||||
if(!fDeltat) {
|
||||
cout << endl << ">> You did not specify the time resolution. Setting the default." << endl;
|
||||
fDeltat = 0.01;
|
||||
}
|
||||
|
||||
// check if delta_B is given, if not set default
|
||||
cout << endl << ">> check specified field resolution ..." << endl;
|
||||
if(!fDeltaB) {
|
||||
cout << endl << ">> You did not specify the field resolution. Setting the default." << endl;
|
||||
fDeltaB = 0.05;
|
||||
}
|
||||
|
||||
// check if any wisdom-file is specified
|
||||
cout << endl << ">> check wisdom-file ..." << endl;
|
||||
if (!fWisdomFile.size()) {
|
||||
cout << endl << ">> You did not specify a wisdom file. Setting the default." << endl;
|
||||
fWisdomFile = "WordsOfWisdom.dat";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// end ---------------------------------------------------------------------
|
||||
|
282
src/external/TFitPofB-lib/classes/TLondon1D.cpp
vendored
282
src/external/TFitPofB-lib/classes/TLondon1D.cpp
vendored
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/05/30
|
||||
2008/06/03
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -27,6 +27,9 @@ ClassImp(TLondon1D3LS)
|
||||
|
||||
TLondon1D::~TLondon1D() {
|
||||
fPar.clear();
|
||||
fParForBofZ.clear();
|
||||
fParForPofB.clear();
|
||||
fParForPofT.clear();
|
||||
delete fImpProfile;
|
||||
fImpProfile = 0;
|
||||
delete fPofT;
|
||||
@ -56,22 +59,28 @@ TLondon1D1L::TLondon1D1L(const vector<unsigned int> &parNo, const vector<double>
|
||||
if (status) { // error
|
||||
cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl;
|
||||
}
|
||||
startupHandler->CheckLists();
|
||||
|
||||
fWisdom = startupHandler->GetWisdomFile();
|
||||
string rge_path(startupHandler->GetDataPath());
|
||||
vector<string> energy_vec(startupHandler->GetEnergyList());
|
||||
|
||||
fParForPofT.push_back(fPar[0]);
|
||||
fParForPofT.push_back(startupHandler->GetDeltat());
|
||||
fParForPofT.push_back(startupHandler->GetDeltaB());
|
||||
|
||||
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;
|
||||
|
||||
vector<double> par_for_PofT;
|
||||
|
||||
for (unsigned int i(0); i<3; i++)
|
||||
par_for_PofT.push_back(fPar[i]);
|
||||
|
||||
TPofTCalc *y = new TPofTCalc(par_for_PofT);
|
||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
||||
fPofT = y;
|
||||
y = 0;
|
||||
delete y;
|
||||
@ -105,10 +114,7 @@ double TLondon1D1L::Eval(double t, const vector<double> &par) const {
|
||||
if( fPar[i]-par[i] ) {
|
||||
fPar[i] = par[i];
|
||||
par_changed = true;
|
||||
if(i == 1 || i == 2) {
|
||||
cout << "You are varying dt or dB! These parameters have to be fixed! Quitting..." << endl;
|
||||
exit(-1);
|
||||
} else if (i == 0) {
|
||||
if (i == 0) {
|
||||
only_phase_changed = true;
|
||||
} else {
|
||||
only_phase_changed = false;
|
||||
@ -119,54 +125,30 @@ double TLondon1D1L::Eval(double t, const vector<double> &par) const {
|
||||
if (par_changed)
|
||||
fCalcNeeded = true;
|
||||
|
||||
/* DEBUGGING CODE COMMENTED -- quite a mess... sorry*/
|
||||
|
||||
// if model parameters have changed, recalculate B(z), P(B) and P(t)
|
||||
|
||||
if (fCalcNeeded) {
|
||||
|
||||
vector<double> par_for_PofT;
|
||||
|
||||
// cout << "par_for_PofT: ";
|
||||
|
||||
for (unsigned int i(0); i<3; i++) {
|
||||
par_for_PofT.push_back(par[i]);
|
||||
// cout << par[i] << " ";
|
||||
}
|
||||
// cout << endl;
|
||||
fParForPofT[0] = par[0]; // phase
|
||||
|
||||
if(!only_phase_changed) {
|
||||
|
||||
cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl;
|
||||
|
||||
vector<double> par_for_BofZ;
|
||||
vector<double> par_for_PofB;
|
||||
for (unsigned int i(2); i<par.size(); i++)
|
||||
fParForBofZ[i-2] = par[i];
|
||||
|
||||
// cout << "par_for_BofZ: ";
|
||||
fParForPofB[2] = par[1]; // energy
|
||||
|
||||
for (unsigned int i(4); i<par.size(); i++) {
|
||||
par_for_BofZ.push_back(par[i]);
|
||||
// cout << par[i] << " ";
|
||||
}
|
||||
// cout << endl;
|
||||
|
||||
// cout << "par_for_PofB: ";
|
||||
|
||||
for (unsigned int i(1); i<4; i++) {
|
||||
par_for_PofB.push_back(par[i]);
|
||||
// cout << par[i] << " ";
|
||||
}
|
||||
// cout << endl;
|
||||
|
||||
TLondon1D_1L BofZ1(par_for_BofZ);
|
||||
TPofBCalc PofB1(BofZ1, *fImpProfile, par_for_PofB);
|
||||
TLondon1D_1L BofZ1(fParForBofZ);
|
||||
TPofBCalc PofB1(BofZ1, *fImpProfile, fParForPofB);
|
||||
fPofT->DoFFT(PofB1);
|
||||
|
||||
} else {
|
||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||
}
|
||||
|
||||
fPofT->CalcPol(par_for_PofT);
|
||||
fPofT->CalcPol(fParForPofT);
|
||||
|
||||
fCalcNeeded = false;
|
||||
}
|
||||
@ -198,27 +180,32 @@ TLondon1D2L::TLondon1D2L(const vector<unsigned int> &parNo, const vector<double>
|
||||
if (status) { // error
|
||||
cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl;
|
||||
}
|
||||
startupHandler->CheckLists();
|
||||
|
||||
fWisdom = startupHandler->GetWisdomFile();
|
||||
string rge_path(startupHandler->GetDataPath());
|
||||
vector<string> energy_vec(startupHandler->GetEnergyList());
|
||||
|
||||
fParForPofT.push_back(fPar[0]);
|
||||
fParForPofT.push_back(startupHandler->GetDeltat());
|
||||
fParForPofT.push_back(startupHandler->GetDeltaB());
|
||||
|
||||
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;
|
||||
|
||||
vector<double> par_for_PofT;
|
||||
|
||||
for (unsigned int i(0); i<3; i++)
|
||||
par_for_PofT.push_back(fPar[i]);
|
||||
|
||||
TPofTCalc *y = new TPofTCalc(par_for_PofT);
|
||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
||||
fPofT = y;
|
||||
y = 0;
|
||||
delete y;
|
||||
|
||||
|
||||
// clean up
|
||||
if (saxParser) {
|
||||
delete saxParser;
|
||||
@ -247,10 +234,7 @@ double TLondon1D2L::Eval(double t, const vector<double> &par) const {
|
||||
if( fPar[i]-par[i] ) {
|
||||
fPar[i] = par[i];
|
||||
par_changed = true;
|
||||
if(i == 1 || i == 2) {
|
||||
cout << "You are varying dt or dB! These parameters have to be fixed! Quitting..." << endl;
|
||||
exit(-1);
|
||||
} else if (i == 0) {
|
||||
if (i == 0) {
|
||||
only_phase_changed = true;
|
||||
} else {
|
||||
only_phase_changed = false;
|
||||
@ -263,66 +247,42 @@ double TLondon1D2L::Eval(double t, const vector<double> &par) const {
|
||||
if (par_changed)
|
||||
fCalcNeeded = true;
|
||||
|
||||
/* DEBUGGING CODE COMMENTED -- quite a mess... sorry*/
|
||||
|
||||
// if model parameters have changed, recalculate B(z), P(B) and P(t)
|
||||
|
||||
if (fCalcNeeded) {
|
||||
|
||||
vector<double> par_for_PofT;
|
||||
|
||||
// cout << "par_for_PofT: ";
|
||||
|
||||
for (unsigned int i(0); i<3; i++) {
|
||||
par_for_PofT.push_back(par[i]);
|
||||
// cout << par[i] << " ";
|
||||
}
|
||||
// cout << endl;
|
||||
fParForPofT[0] = par[0]; // phase
|
||||
|
||||
if(!only_phase_changed) {
|
||||
|
||||
cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl;
|
||||
|
||||
vector<double> par_for_BofZ;
|
||||
vector<double> par_for_PofB;
|
||||
for (unsigned int i(2); i<par.size(); i++)
|
||||
fParForBofZ[i-2] = par[i];
|
||||
|
||||
// cout << "par_for_BofZ: ";
|
||||
|
||||
for (unsigned int i(4); i<par.size()-2; i++) {
|
||||
par_for_BofZ.push_back(par[i]);
|
||||
// cout << par[i] << " ";
|
||||
}
|
||||
// cout << endl;
|
||||
|
||||
// cout << "par_for_PofB: ";
|
||||
|
||||
for (unsigned int i(1); i<4; i++) {
|
||||
par_for_PofB.push_back(par[i]);
|
||||
// cout << par[i] << " ";
|
||||
}
|
||||
// cout << endl;
|
||||
fParForPofB[2] = par[1]; // energy
|
||||
|
||||
if(fLastTwoChanged) {
|
||||
vector<double> interfaces;
|
||||
interfaces.push_back(par[5]+par[6]);
|
||||
interfaces.push_back(par[3]+par[4]);
|
||||
|
||||
vector<double> weights;
|
||||
for(unsigned int i(par.size()-2); i<par.size(); i++)
|
||||
weights.push_back(par[i]);
|
||||
|
||||
cout << "Weighting has changed, re-calculating n(z) now..." << endl;
|
||||
fImpProfile->WeightLayers(par[3], interfaces, weights);
|
||||
fImpProfile->WeightLayers(par[1], interfaces, weights);
|
||||
}
|
||||
|
||||
TLondon1D_2L BofZ2(par_for_BofZ);
|
||||
TPofBCalc PofB2(BofZ2, *fImpProfile, par_for_PofB);
|
||||
TLondon1D_2L BofZ2(fParForBofZ);
|
||||
TPofBCalc PofB2(BofZ2, *fImpProfile, fParForPofB);
|
||||
fPofT->DoFFT(PofB2);
|
||||
|
||||
} else {
|
||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||
}
|
||||
|
||||
fPofT->CalcPol(par_for_PofT);
|
||||
fPofT->CalcPol(fParForPofT);
|
||||
|
||||
fCalcNeeded = false;
|
||||
fLastTwoChanged = false;
|
||||
@ -355,22 +315,28 @@ TLondon1D3L::TLondon1D3L(const vector<unsigned int> &parNo, const vector<double>
|
||||
if (status) { // error
|
||||
cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl;
|
||||
}
|
||||
startupHandler->CheckLists();
|
||||
|
||||
fWisdom = startupHandler->GetWisdomFile();
|
||||
string rge_path(startupHandler->GetDataPath());
|
||||
vector<string> energy_vec(startupHandler->GetEnergyList());
|
||||
|
||||
fParForPofT.push_back(fPar[0]);
|
||||
fParForPofT.push_back(startupHandler->GetDeltat());
|
||||
fParForPofT.push_back(startupHandler->GetDeltaB());
|
||||
|
||||
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;
|
||||
|
||||
vector<double> par_for_PofT;
|
||||
|
||||
for (unsigned int i(0); i<3; i++)
|
||||
par_for_PofT.push_back(fPar[i]);
|
||||
|
||||
TPofTCalc *y = new TPofTCalc(par_for_PofT);
|
||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
||||
fPofT = y;
|
||||
y = 0;
|
||||
delete y;
|
||||
@ -404,10 +370,7 @@ double TLondon1D3L::Eval(double t, const vector<double> &par) const {
|
||||
if( fPar[i]-par[i] ) {
|
||||
fPar[i] = par[i];
|
||||
par_changed = true;
|
||||
if(i == 1 || i == 2) {
|
||||
cout << "You are varying dt or dB! These parameters have to be fixed! Quitting..." << endl;
|
||||
exit(-1);
|
||||
} else if (i == 0) {
|
||||
if (i == 0) {
|
||||
only_phase_changed = true;
|
||||
} else {
|
||||
only_phase_changed = false;
|
||||
@ -420,67 +383,57 @@ double TLondon1D3L::Eval(double t, const vector<double> &par) const {
|
||||
if (par_changed)
|
||||
fCalcNeeded = true;
|
||||
|
||||
/* DEBUGGING CODE COMMENTED -- quite a mess... sorry*/
|
||||
|
||||
// if model parameters have changed, recalculate B(z), P(B) and P(t)
|
||||
|
||||
if (fCalcNeeded) {
|
||||
|
||||
vector<double> par_for_PofT;
|
||||
|
||||
// cout << "par_for_PofT: ";
|
||||
|
||||
for (unsigned int i(0); i<3; i++) {
|
||||
par_for_PofT.push_back(par[i]);
|
||||
// cout << par[i] << " ";
|
||||
}
|
||||
// cout << endl;
|
||||
fParForPofT[0] = par[0]; // phase
|
||||
|
||||
if(!only_phase_changed) {
|
||||
|
||||
cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl;
|
||||
|
||||
vector<double> par_for_BofZ;
|
||||
vector<double> par_for_PofB;
|
||||
for (unsigned int i(2); i<par.size(); i++)
|
||||
fParForBofZ[i-2] = par[i];
|
||||
|
||||
// cout << "par_for_BofZ: ";
|
||||
fParForPofB[2] = par[1]; // energy
|
||||
|
||||
for (unsigned int i(4); i<par.size()-2; i++) {
|
||||
par_for_BofZ.push_back(par[i]);
|
||||
// cout << par[i] << " ";
|
||||
/* DEBUG ---------------------------
|
||||
for(unsigned int i(0); i<fParForBofZ.size(); i++) {
|
||||
cout << "ParForBofZ[" << i << "] = " << fParForBofZ[i] << endl;
|
||||
}
|
||||
// cout << endl;
|
||||
|
||||
// cout << "par_for_PofB: ";
|
||||
|
||||
for (unsigned int i(1); i<4; i++) {
|
||||
par_for_PofB.push_back(par[i]);
|
||||
// cout << par[i] << " ";
|
||||
for(unsigned int i(0); i<fParForPofB.size(); i++) {
|
||||
cout << "ParForPofB[" << i << "] = " << fParForPofB[i] << endl;
|
||||
}
|
||||
// cout << endl;
|
||||
|
||||
for(unsigned int i(0); i<fParForPofT.size(); i++) {
|
||||
cout << "ParForPofT[" << i << "] = " << fParForPofT[i] << endl;
|
||||
}
|
||||
------------------------------------*/
|
||||
|
||||
if(fLastThreeChanged) {
|
||||
vector<double> interfaces;
|
||||
interfaces.push_back(par[5]+par[6]);
|
||||
interfaces.push_back(par[5]+par[6]+par[7]);
|
||||
interfaces.push_back(par[3]+par[4]);
|
||||
interfaces.push_back(par[3]+par[4]+par[5]);
|
||||
|
||||
vector<double> weights;
|
||||
for(unsigned int i(par.size()-3); i<par.size(); i++)
|
||||
weights.push_back(par[i]);
|
||||
|
||||
cout << "Weighting has changed, re-calculating n(z) now..." << endl;
|
||||
fImpProfile->WeightLayers(par[3], interfaces, weights);
|
||||
fImpProfile->WeightLayers(par[1], interfaces, weights);
|
||||
}
|
||||
|
||||
TLondon1D_3L BofZ3(par_for_BofZ);
|
||||
TPofBCalc PofB3(BofZ3, *fImpProfile, par_for_PofB);
|
||||
TLondon1D_3L BofZ3(fParForBofZ);
|
||||
TPofBCalc PofB3(BofZ3, *fImpProfile, fParForPofB);
|
||||
fPofT->DoFFT(PofB3);
|
||||
|
||||
} else {
|
||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||
}
|
||||
|
||||
fPofT->CalcPol(par_for_PofT);
|
||||
fPofT->CalcPol(fParForPofT);
|
||||
|
||||
fCalcNeeded = false;
|
||||
fLastThreeChanged = false;
|
||||
@ -495,7 +448,7 @@ double TLondon1D3L::Eval(double t, const vector<double> &par) const {
|
||||
// creates (a pointer to) the TPofTCalc object (with the FFT plan)
|
||||
//------------------
|
||||
|
||||
TLondon1D3LS::TLondon1D3LS(const vector<unsigned int> &parNo, const vector<double> &par) {
|
||||
TLondon1D3LS::TLondon1D3LS(const vector<unsigned int> &parNo, const vector<double> &par) : fLastThreeChanged(true) {
|
||||
|
||||
// extract function parameters
|
||||
for(unsigned int i(0); i<parNo.size(); i++) {
|
||||
@ -513,22 +466,28 @@ TLondon1D3LS::TLondon1D3LS(const vector<unsigned int> &parNo, const vector<doubl
|
||||
if (status) { // error
|
||||
cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl;
|
||||
}
|
||||
startupHandler->CheckLists();
|
||||
|
||||
fWisdom = startupHandler->GetWisdomFile();
|
||||
string rge_path(startupHandler->GetDataPath());
|
||||
vector<string> energy_vec(startupHandler->GetEnergyList());
|
||||
|
||||
fParForPofT.push_back(fPar[0]);
|
||||
fParForPofT.push_back(startupHandler->GetDeltat());
|
||||
fParForPofT.push_back(startupHandler->GetDeltaB());
|
||||
|
||||
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;
|
||||
|
||||
vector<double> par_for_PofT;
|
||||
|
||||
for (unsigned int i(0); i<3; i++)
|
||||
par_for_PofT.push_back(fPar[i]);
|
||||
|
||||
TPofTCalc *y = new TPofTCalc(par_for_PofT);
|
||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
||||
fPofT = y;
|
||||
y = 0;
|
||||
delete y;
|
||||
@ -562,10 +521,7 @@ double TLondon1D3LS::Eval(double t, const vector<double> &par) const {
|
||||
if( fPar[i]-par[i] ) {
|
||||
fPar[i] = par[i];
|
||||
par_changed = true;
|
||||
if(i == 1 || i == 2) {
|
||||
cout << "You are varying dt or dB! These parameters have to be fixed! Quitting..." << endl;
|
||||
exit(-1);
|
||||
} else if (i == 0) {
|
||||
if (i == 0) {
|
||||
only_phase_changed = true;
|
||||
} else {
|
||||
only_phase_changed = false;
|
||||
@ -578,67 +534,43 @@ double TLondon1D3LS::Eval(double t, const vector<double> &par) const {
|
||||
if (par_changed)
|
||||
fCalcNeeded = true;
|
||||
|
||||
/* DEBUGGING CODE COMMENTED -- quite a mess... sorry*/
|
||||
|
||||
// if model parameters have changed, recalculate B(z), P(B) and P(t)
|
||||
|
||||
if (fCalcNeeded) {
|
||||
|
||||
vector<double> par_for_PofT;
|
||||
|
||||
// cout << "par_for_PofT: ";
|
||||
|
||||
for (unsigned int i(0); i<3; i++) {
|
||||
par_for_PofT.push_back(par[i]);
|
||||
// cout << par[i] << " ";
|
||||
}
|
||||
// cout << endl;
|
||||
fParForPofT[0] = par[0]; // phase
|
||||
|
||||
if(!only_phase_changed) {
|
||||
|
||||
cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl;
|
||||
|
||||
vector<double> par_for_BofZ;
|
||||
vector<double> par_for_PofB;
|
||||
for (unsigned int i(2); i<par.size(); i++)
|
||||
fParForBofZ[i-2] = par[i];
|
||||
|
||||
// cout << "par_for_BofZ: ";
|
||||
|
||||
for (unsigned int i(4); i<par.size()-2; i++) {
|
||||
par_for_BofZ.push_back(par[i]);
|
||||
// cout << par[i] << " ";
|
||||
}
|
||||
// cout << endl;
|
||||
|
||||
// cout << "par_for_PofB: ";
|
||||
|
||||
for (unsigned int i(1); i<4; i++) {
|
||||
par_for_PofB.push_back(par[i]);
|
||||
// cout << par[i] << " ";
|
||||
}
|
||||
// cout << endl;
|
||||
fParForPofB[2] = par[1]; // energy
|
||||
|
||||
if(fLastThreeChanged) {
|
||||
vector<double> interfaces;
|
||||
interfaces.push_back(par[5]+par[6]);
|
||||
interfaces.push_back(par[5]+par[6]+par[7]);
|
||||
interfaces.push_back(par[3]+par[4]);
|
||||
interfaces.push_back(par[3]+par[4]+par[5]);
|
||||
|
||||
vector<double> weights;
|
||||
for(unsigned int i(par.size()-3); i<par.size(); i++)
|
||||
weights.push_back(par[i]);
|
||||
|
||||
cout << "Weighting has changed, re-calculating n(z) now..." << endl;
|
||||
fImpProfile->WeightLayers(par[3], interfaces, weights);
|
||||
fImpProfile->WeightLayers(par[1], interfaces, weights);
|
||||
}
|
||||
|
||||
TLondon1D_3LS BofZ3S(par_for_BofZ);
|
||||
TPofBCalc PofB3S(BofZ3S, *fImpProfile, par_for_PofB);
|
||||
TLondon1D_3LS BofZ3S(fParForBofZ);
|
||||
TPofBCalc PofB3S(BofZ3S, *fImpProfile, fParForPofB);
|
||||
fPofT->DoFFT(PofB3S);
|
||||
|
||||
} else {
|
||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||
}
|
||||
|
||||
fPofT->CalcPol(par_for_PofT);
|
||||
fPofT->CalcPol(fParForPofT);
|
||||
|
||||
fCalcNeeded = false;
|
||||
fLastThreeChanged = false;
|
||||
|
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/05/27
|
||||
2008/06/03
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -58,6 +58,7 @@ TPofBCalc::TPofBCalc( const TBofZCalc &BofZ, const TTrimSPData &dataTrimSP, cons
|
||||
|
||||
if (n > 0) {
|
||||
ofstream of(debugfile);
|
||||
assure(of, debugfile);
|
||||
|
||||
for (unsigned int i(0); i<bofzZ.size(); i++) {
|
||||
of << bofzZ[i] << " " << bofzBZ[i] << endl;
|
||||
@ -70,6 +71,7 @@ TPofBCalc::TPofBCalc( const TBofZCalc &BofZ, const TTrimSPData &dataTrimSP, cons
|
||||
|
||||
if (n1 > 0) {
|
||||
ofstream of1(debugfile1);
|
||||
assure(of1, debugfile1);
|
||||
|
||||
for (unsigned int i(0); i<dataTrimSP.DataZ(para[2]).size(); i++) {
|
||||
of1 << dataTrimSP.DataZ(para[2])[i] << " " << dataTrimSP.DataNZ(para[2])[i] << " " << dataTrimSP.OrigDataNZ(para[2])[i] << endl;
|
||||
|
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/05/26
|
||||
2008/06/03
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
// Parameters: phase, dt, dB
|
||||
//------------------
|
||||
|
||||
TPofTCalc::TPofTCalc (const vector<double> &par) {
|
||||
TPofTCalc::TPofTCalc (const string &wisdom, const vector<double> &par) : fWisdom(wisdom) {
|
||||
|
||||
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);
|
||||
fTBin = 1.0/gBar/double(fNFFT-1)/par[2];
|
||||
@ -40,7 +40,7 @@ TPofTCalc::TPofTCalc (const vector<double> &par) {
|
||||
int wisdomLoaded(0);
|
||||
|
||||
FILE *wordsOfWisdomR;
|
||||
wordsOfWisdomR = fopen("WordsOfWisdom.dat", "r");
|
||||
wordsOfWisdomR = fopen(fWisdom.c_str(), "r");
|
||||
if (wordsOfWisdomR == NULL) {
|
||||
cout << "Couldn't open wisdom file ..." << endl;
|
||||
} else {
|
||||
@ -142,7 +142,7 @@ TPofTCalc::~TPofTCalc() {
|
||||
// export wisdom so it has not to be checked for the FFT-plan next time
|
||||
|
||||
FILE *wordsOfWisdomW;
|
||||
wordsOfWisdomW = fopen("WordsOfWisdom.dat", "w");
|
||||
wordsOfWisdomW = fopen(fWisdom.c_str(), "w");
|
||||
if (wordsOfWisdomW == NULL) {
|
||||
cout << "couldn't open file ... No wisdom is exported..." << endl;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/05/30
|
||||
2008/06/03
|
||||
|
||||
based upon:
|
||||
$Id: PStartupHandler.h 3396 2008-05-29 14:41:33Z nemu $
|
||||
@ -61,14 +61,20 @@ class TFitPofBStartupHandler : public TQObject {
|
||||
|
||||
virtual const string GetDataPath() const { return fDataPath; }
|
||||
virtual vector<string> GetEnergyList() const { return fEnergyList; }
|
||||
virtual const double GetDeltat() const { return fDeltat; }
|
||||
virtual const double GetDeltaB() const { return fDeltaB; }
|
||||
virtual const string GetWisdomFile() const { return fWisdomFile; }
|
||||
|
||||
private:
|
||||
enum EKeyWords {eEmpty, eComment, eDataPath, eEnergy, eEnergyList};
|
||||
enum EKeyWords {eEmpty, eComment, eDataPath, eEnergy, eEnergyList, eDeltat, eDeltaB, eWisdomFile};
|
||||
|
||||
EKeyWords fKey;
|
||||
|
||||
string fDataPath;
|
||||
vector<string> fEnergyList;
|
||||
double fDeltat;
|
||||
double fDeltaB;
|
||||
string fWisdomFile;
|
||||
|
||||
ClassDef(TFitPofBStartupHandler, 1)
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/05/30
|
||||
2008/06/03
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -29,6 +29,10 @@ protected:
|
||||
TTrimSPData *fImpProfile;
|
||||
TPofTCalc *fPofT;
|
||||
mutable bool fCalcNeeded;
|
||||
mutable vector<double> fParForPofT;
|
||||
mutable vector<double> fParForBofZ;
|
||||
mutable vector<double> fParForPofB;
|
||||
string fWisdom;
|
||||
|
||||
ClassDef(TLondon1D,1)
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/05/25
|
||||
2008/06/03
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
|
||||
#include "TPofBCalc.h"
|
||||
#include "fftw3.h"
|
||||
#include <string>
|
||||
|
||||
#define PI 3.14159265358979323846
|
||||
|
||||
@ -21,7 +22,7 @@ class TPofTCalc {
|
||||
|
||||
public:
|
||||
|
||||
TPofTCalc(const vector<double>&);
|
||||
TPofTCalc(const string&, const vector<double>&);
|
||||
~TPofTCalc();
|
||||
|
||||
vector<double> DataT() const {return fT;}
|
||||
@ -38,6 +39,7 @@ private:
|
||||
vector<double> fPT;
|
||||
double fTBin;
|
||||
unsigned int fNFFT;
|
||||
const string fWisdom;
|
||||
|
||||
};
|
||||
|
||||
|
@ -2,16 +2,19 @@
|
||||
<TFitPofB>
|
||||
<comment>
|
||||
TFitPofB_startup.xml
|
||||
Defines path and energies of TrimSP-rge-files to be read in
|
||||
Defines path and energies (keV, format: %02u_%1u) of TrimSP-rge-files, path to the FFTW-wisdom-file and time/field binning (us/G)
|
||||
</comment>
|
||||
<data_path>/home/l_wojek/TrimSP/AuYBCO_2005/AuYBCO-500000-</data_path>
|
||||
<wisdom>WordsOfWisdom.dat</wisdom>
|
||||
<delta_t>0.01</delta_t>
|
||||
<delta_B>0.01</delta_B>
|
||||
<energy_list>
|
||||
<energy>04_6</energy>
|
||||
<energy>09_6</energy>
|
||||
<energy>14_6</energy>
|
||||
<energy>18_6</energy>
|
||||
<energy>21_6</energy>
|
||||
<energy>24_6</energy>
|
||||
<energy>28_7</energy>
|
||||
<energy>04_6</energy>
|
||||
<energy>09_6</energy>
|
||||
<energy>14_6</energy>
|
||||
<energy>18_6</energy>
|
||||
<energy>21_6</energy>
|
||||
<energy>24_6</energy>
|
||||
<energy>28_7</energy>
|
||||
</energy_list>
|
||||
</TFitPofB>
|
||||
|
12
src/external/TFitPofB-lib/test/test.cpp
vendored
12
src/external/TFitPofB-lib/test/test.cpp
vendored
@ -134,9 +134,9 @@ int main(){
|
||||
|
||||
************************************************************************/
|
||||
|
||||
/**************** Test TLondon1D3LS *********************************/
|
||||
/**************** Test TLondon1D3L *********************************/
|
||||
|
||||
unsigned int parNo_arr[] = {1, 3, 5, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
|
||||
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])));
|
||||
@ -188,8 +188,8 @@ int main(){
|
||||
}
|
||||
of01.close();
|
||||
|
||||
par_vec_sub[3] = 9.6;
|
||||
par_vec_sub[10] = 300.0;
|
||||
par_vec_sub[1] = 9.6;
|
||||
par_vec_sub[8] = 300.0;
|
||||
|
||||
for (double i(0.); i<12.0; i+=0.003) {
|
||||
of02 << i << " " << fitter.Eval(i, par_vec_sub) << endl;
|
||||
@ -203,14 +203,14 @@ int main(){
|
||||
}
|
||||
of03.close();
|
||||
|
||||
par_vec_sub[13] = 0.3;
|
||||
par_vec_sub[11] = 0.3;
|
||||
|
||||
for (double i(0.); i<12.0; i+=0.003) {
|
||||
of04 << i << " " << fitter.Eval(i, par_vec_sub) << endl;
|
||||
}
|
||||
of04.close();
|
||||
|
||||
par_vec_sub[11] = 500.0;
|
||||
par_vec_sub[9] = 500.0;
|
||||
|
||||
for (double i(0.); i<12.0; i+=0.003) {
|
||||
of05 << i << " " << fitter.Eval(i, par_vec_sub) << endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user