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

@@ -24,11 +24,13 @@ double millitime()
//---------------------------------------------------
void dks_fourierTest_syntax()
{
cout << endl << "usage: dks_fourierTest [useFFTW, N, L | --help] ";
cout << endl << "usage: dks_fourierTest [useFFTW N L [dumpAll] | --help] ";
cout << endl << " useFFTW : flag, if true -> FFTW, otherwise -> DKS";
cout << endl << " N : number of histos";
cout << endl << " L : histo length";
cout << endl << " if not given, useFFTW=true, N=8, L=2^20=1048576";
cout << endl << " dumpAll : flag, if true writes the data into a ROOT dump file 'dks_FourierTest.root'";
cout << endl << " if false, writes only the first and last data set.";
cout << endl << " if not given, useFFTW=true, N=8, L=2^20=1048576, dumpAll=false.";
cout << endl << " --help: this help";
cout << endl << endl;
}
@@ -42,6 +44,7 @@ int main(int argc, char *argv[])
int N=8, L=1048576;
Bool_t useFFTW = true;
Bool_t dumpAll = false;
switch (argc) {
case 1:
@@ -58,6 +61,26 @@ int main(int argc, char *argv[])
N = strtol(argv[2], 0, 10);
L = strtol(argv[3], 0, 10);
break;
case 5:
if (!strcmp(argv[1], "true") || !strcmp(argv[1], "1"))
useFFTW = true;
else if (!strcmp(argv[1], "false") || !strcmp(argv[1], "0"))
useFFTW = false;
else {
dks_fourierTest_syntax();
return 1;
}
N = strtol(argv[2], 0, 10);
L = strtol(argv[3], 0, 10);
if (!strcmp(argv[4], "true") || !strcmp(argv[4], "1"))
dumpAll = true;
else if (!strcmp(argv[4], "false") || !strcmp(argv[4], "0"))
dumpAll = false;
else {
dks_fourierTest_syntax();
return 1;
}
break;
default:
dks_fourierTest_syntax();
return 1;
@@ -124,9 +147,18 @@ int main(int argc, char *argv[])
cout << endl << "---" << endl;
}
TFile fout("dks_fourierTest.root", "recreate");
for (unsigned int i=0; i<fourierPowerHistos.size(); i++) {
data[i]->Write();
fourierPowerHistos[i]->Write();
if (dumpAll) {
for (unsigned int i=0; i<fourierPowerHistos.size(); i++) {
data[i]->Write();
fourierPowerHistos[i]->Write();
}
} else {
data[0]->Write();
fourierPowerHistos[0]->Write();
if (data.size() > 1) {
data[data.size()-1]->Write();
fourierPowerHistos[fourierPowerHistos.size()-1]->Write();
}
}
fout.Close();