first working FFT including DKS.

This commit is contained in:
2015-04-13 17:21:27 +02:00
parent a393cb9ec5
commit a2601348cf
10 changed files with 87 additions and 23 deletions

View File

@@ -81,6 +81,7 @@ typedef struct {
Int_t packing; ///< packing for rebinning the time histograms before Fourier transform.
TString title; ///< title to be shown for the Fourier plot.
Double_t lifetimecorrection; ///< is == 0.0 for NO life time correction, otherwise it holds the fudge factor
Bool_t useDKS; ///< used DKS flag, true -> used DKS, false -> use FFTW
Int_t timeout; ///< timeout in (sec) after which musrFT will terminate. if <= 0, no automatic termination will take place.
} musrFT_startup_param;
@@ -148,6 +149,7 @@ void musrFT_syntax()
cout << endl << " provided. This will help on the way to a full fitting model.";
cout << endl << " -lc, --lifetimecorrection <fudge>: try to eliminate muon life time decay. Only makes sense for low";
cout << endl << " transverse fields. <fudge> is a tweaking factor and should be kept around 1.0.";
cout << endl << " --useDKS <flag> : if <flag> is true, DKS will be used, otherwise FFTW. Default: false, i.e. FFTW will be used.";
cout << endl << " --timeout <timeout> : <timeout> given in seconds after which musrFT terminates.";
cout << endl << " If <timeout> <= 0, no timeout will take place. Default <timeout> is 3600.";
cout << endl << endl;
@@ -180,6 +182,7 @@ void musrFT_init(musrFT_startup_param &startupParam)
startupParam.packing = 1;
startupParam.title = TString("");
startupParam.lifetimecorrection = 0.0;
startupParam.useDKS = false;
startupParam.timeout = 3600;
}
@@ -519,6 +522,21 @@ Int_t musrFT_parse_options(Int_t argc, Char_t *argv[], musrFT_startup_param &sta
return 2;
}
startupParam.lifetimecorrection = fudge.Atof();
} else if (tstr.BeginsWith("--useDKS")) {
if (i+1 >= argc) { // something is wrong since there needs to be an argument here
cerr << endl << ">> musrFT **ERROR** found option --useDKS without argument!" << endl;
return 2;
}
++i;
TString tt(argv[i]);
if (tt.CompareTo("yes", TString::kIgnoreCase) && tt.CompareTo("no", TString::kIgnoreCase)) {
cerr << endl << ">> musrFT **ERROR** found option --useDKS with a <flag> which is not yes/no '" << tt << "'." << endl;
return 2;
}
if (!tt.CompareTo("yes", TString::kIgnoreCase))
startupParam.useDKS = true;
else if (!tt.CompareTo("no", TString::kIgnoreCase))
startupParam.useDKS = false;
} else if (tstr.BeginsWith("--timeout")) {
if (i+1 >= argc) { // something is wrong since there needs to be an argument here
cerr << endl << ">> musrFT **ERROR** found option --timeout without argument!" << endl;
@@ -712,7 +730,7 @@ Int_t musrFT_dumpData(TString fln, vector<PFourier*> &fourierData, Double_t star
musrFT_cleanup(hRe);
for (UInt_t i=1; i<fourierData.size(); i++) {
hRe = fourierData[i]->GetRealFourier();
if (hRe->GetNbinsX()-1 < minSize)
if (hRe->GetNbinsX()-1 < (Int_t)minSize)
minSize = hRe->GetNbinsX()-1;
musrFT_cleanup(hRe);
}
@@ -720,7 +738,7 @@ Int_t musrFT_dumpData(TString fln, vector<PFourier*> &fourierData, Double_t star
for (UInt_t i=0; i<fourierData.size(); i++) {
hRe = fourierData[i]->GetRealFourier();
hIm = fourierData[i]->GetImaginaryFourier();
for (Int_t j=1; j<minSize; j++) {
for (Int_t j=1; j<(Int_t)minSize; j++) {
dval = hRe->GetBinCenter(j);
if ((dval >= start) && (dval <= end)) {
freq.push_back(dval);
@@ -1400,7 +1418,7 @@ Int_t main(Int_t argc, Char_t *argv[])
vector<PFourier*> fourier;
fourier.resize(histo.size());
for (UInt_t i=0; i<fourier.size(); i++) {
fourier[i] = new PFourier(histo[i], unitTag, 0.0, 0.0, true, startupParam.fourierPower);
fourier[i] = new PFourier(histo[i], unitTag, 0.0, 0.0, true, startupParam.fourierPower, !startupParam.useDKS);
}
// Fourier transform data