From ca48941deb5fe765b508a00abfa76c6534b771f5 Mon Sep 17 00:00:00 2001 From: Suter Andreas Date: Tue, 17 Feb 2015 12:46:30 +0100 Subject: [PATCH] bug fixing towards a musrFT feature complete state. --- src/classes/PFourier.cpp | 17 ++++++ src/classes/PFourierCanvas.cpp | 16 ++--- src/classes/PMsrHandler.cpp | 5 +- src/classes/PMusrCanvas.cpp | 30 +++++----- src/classes/PPrepFourier.cpp | 84 +++++++++++++++----------- src/include/PFourier.h | 1 + src/include/PPrepFourier.h | 22 +++---- src/musrFT.cpp | 105 ++++++++++++++++++++++----------- 8 files changed, 180 insertions(+), 100 deletions(-) diff --git a/src/classes/PFourier.cpp b/src/classes/PFourier.cpp index a660e141..38f94d12 100644 --- a/src/classes/PFourier.cpp +++ b/src/classes/PFourier.cpp @@ -200,6 +200,23 @@ void PFourier::Transform(UInt_t apodizationTag) } } +//-------------------------------------------------------------------------- +// GetMaxFreq +//-------------------------------------------------------------------------- +/** + *

returns the maximal frequency in units choosen, i.e. Gauss, Tesla, MHz, Mc/s + */ +Double_t PFourier::GetMaxFreq() +{ + UInt_t noOfFourierBins = 0; + if (fNoOfBins % 2 == 0) + noOfFourierBins = fNoOfBins/2; + else + noOfFourierBins = (fNoOfBins+1)/2; + + return fResolution*noOfFourierBins; +} + //-------------------------------------------------------------------------- // GetRealFourier //-------------------------------------------------------------------------- diff --git a/src/classes/PFourierCanvas.cpp b/src/classes/PFourierCanvas.cpp index 9c33bd04..b31cc3e6 100644 --- a/src/classes/PFourierCanvas.cpp +++ b/src/classes/PFourierCanvas.cpp @@ -43,8 +43,8 @@ using namespace std; #define YINFO 0.2 #define YTITLE 0.95 -static const char *gFiletypes[] = { "All files", "*", - "Data files", "*.dat", +static const char *gFiletypes[] = { "Data files", "*.dat", + "All files", "*", 0, 0 }; ClassImpQ(PFourierCanvas) @@ -119,7 +119,7 @@ PFourierCanvas::PFourierCanvas(vector &fourier, const Char_t* title, CreateXaxisTitle(); CreateStyle(); InitFourierDataSets(); - InitFourierCanvas(title, wtopx, wtopy, ww, wh); + InitFourierCanvas(fTitle, wtopx, wtopy, ww, wh); gStyle->SetHistMinimumZero(kTRUE); // needed to enforce proper bar option handling } @@ -163,7 +163,7 @@ PFourierCanvas::PFourierCanvas(vector &fourier, const Char_t* title, CreateXaxisTitle(); CreateStyle(); InitFourierDataSets(); - InitFourierCanvas(title, wtopx, wtopy, ww, wh); + InitFourierCanvas(fTitle, wtopx, wtopy, ww, wh); gStyle->SetHistMinimumZero(kTRUE); // needed to enforce proper bar option handling } @@ -856,7 +856,7 @@ void PFourierCanvas::InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t w if (!fBatchMode) { fImp = (TRootCanvas*)fMainCanvas->GetCanvasImp(); fBar = fImp->GetMenuBar(); - fPopupMain = fBar->AddPopup("&MusrFT"); + fPopupMain = fBar->AddPopup("MusrFT"); fPopupFourier = new TGPopupMenu(); @@ -918,7 +918,7 @@ void PFourierCanvas::InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t w fTitlePad->Draw(); // fourier pad - fFourierPad = new TPad("fourierPad", "fourierPad", 0.0, YINFO, 1.0, YTITLE); + fFourierPad = new TPad("fFourierPad", "fFourierPad", 0.0, YINFO, 1.0, YTITLE); if (fFourierPad == 0) { cerr << endl << "PFourierCanvas::PFourierCanvas: **PANIC ERROR**: Couldn't invoke fFourierPad"; cerr << endl; @@ -1345,8 +1345,8 @@ void PFourierCanvas::DecrementFourierPhase() if ((fFourierHistos[i].dataFourierRe != 0) && (fFourierHistos[i].dataFourierIm != 0)) { for (Int_t j=0; jGetNbinsX(); j++) { // loop over a fourier data set // calculate new fourier data set value - re = fFourierHistos[i].dataFourierRe->GetBinContent(j) * cp + fFourierHistos[i].dataFourierIm->GetBinContent(j) * sp; - im = fFourierHistos[i].dataFourierIm->GetBinContent(j) * cp - fFourierHistos[i].dataFourierRe->GetBinContent(j) * sp; + re = fFourierHistos[i].dataFourierRe->GetBinContent(j) * cp - fFourierHistos[i].dataFourierIm->GetBinContent(j) * sp; + im = fFourierHistos[i].dataFourierIm->GetBinContent(j) * cp + fFourierHistos[i].dataFourierRe->GetBinContent(j) * sp; // overwrite fourier data set value fFourierHistos[i].dataFourierRe->SetBinContent(j, re); fFourierHistos[i].dataFourierIm->SetBinContent(j, im); diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index 9a91f134..0819bd22 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -5054,7 +5054,7 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() cerr << endl << ">> forward parameter number not defined. Necessary for single histogram fits." << endl; return false; } - if (fRuns[i].GetNormParamNo() > static_cast(fParam.size())) { + if ((fRuns[i].GetNormParamNo() > static_cast(fParam.size())) && !fFourierOnly) { // check if forward histogram number is a function if (fRuns[i].GetNormParamNo() - MSR_PARAM_FUN_OFFSET > static_cast(fParam.size())) { cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; @@ -5338,6 +5338,9 @@ Bool_t PMsrHandler::CheckFuncs() { Bool_t result = true; + if (fFourierOnly) + return result; + PIntVector funVec; PIntVector funBlock; PIntVector funLineBlockNo; diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index 125f2b64..9cdbe4d3 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -3793,7 +3793,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].data, fData[0].data->GetBinCenter(i)); } fDataAvg.data->SetBinContent(i, dval/fData.size()); } @@ -3807,7 +3807,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].dataFourierRe, fData[0].dataFourierRe->GetBinCenter(i)); } fDataAvg.dataFourierRe->SetBinContent(i, dval/fData.size()); } @@ -3821,7 +3821,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].dataFourierIm, fData[0].dataFourierIm->GetBinCenter(i)); } fDataAvg.dataFourierIm->SetBinContent(i, dval/fData.size()); } @@ -3835,7 +3835,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].dataFourierPwr, fData[0].dataFourierPwr->GetBinCenter(i)); } fDataAvg.dataFourierPwr->SetBinContent(i, dval/fData.size()); } @@ -3849,7 +3849,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].dataFourierPhase, fData[0].dataFourierPhase->GetBinCenter(i)); } fDataAvg.dataFourierPhase->SetBinContent(i, dval/fData.size()); } @@ -3863,7 +3863,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].theory, fData[0].theory->GetBinCenter(i)); } fDataAvg.theory->SetBinContent(i, dval/fData.size()); } @@ -3873,7 +3873,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].theoryFourierRe, fData[0].theoryFourierRe->GetBinCenter(i)); } fDataAvg.theoryFourierRe->SetBinContent(i, dval/fData.size()); } @@ -3887,7 +3887,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].theoryFourierIm, fData[0].theoryFourierIm->GetBinCenter(i)); } fDataAvg.theoryFourierIm->SetBinContent(i, dval/fData.size()); } @@ -3901,7 +3901,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].theoryFourierPwr, fData[0].theoryFourierPwr->GetBinCenter(i)); } fDataAvg.theoryFourierPwr->SetBinContent(i, dval/fData.size()); } @@ -3915,7 +3915,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].theoryFourierPhase, fData[0].theoryFourierPhase->GetBinCenter(i)); } fDataAvg.theoryFourierPhase->SetBinContent(i, dval/fData.size()); } @@ -3929,7 +3929,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].diff, fData[0].diff->GetBinCenter(i)); } fDataAvg.diff->SetBinContent(i, dval/fData.size()); } @@ -3943,7 +3943,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].diffFourierRe, fData[0].diffFourierRe->GetBinCenter(i)); } fDataAvg.diffFourierRe->SetBinContent(i, dval/fData.size()); } @@ -3957,7 +3957,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].diffFourierIm, fData[0].diffFourierIm->GetBinCenter(i)); } fDataAvg.diffFourierIm->SetBinContent(i, dval/fData.size()); } @@ -3971,7 +3971,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].diffFourierPwr, fData[0].diffFourierPwr->GetBinCenter(i)); } fDataAvg.diffFourierPwr->SetBinContent(i, dval/fData.size()); } @@ -3985,7 +3985,7 @@ void PMusrCanvas::HandleAverage() for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jGetBinContent(i)); + dval += GetInterpolatedValue(fData[j].diffFourierPhase, fData[0].diffFourierPhase->GetBinCenter(i)); } fDataAvg.diffFourierPhase->SetBinContent(i, dval/fData.size()); } diff --git a/src/classes/PPrepFourier.cpp b/src/classes/PPrepFourier.cpp index 907689e9..4af9c662 100644 --- a/src/classes/PPrepFourier.cpp +++ b/src/classes/PPrepFourier.cpp @@ -50,10 +50,11 @@ PPrepFourier::PPrepFourier() /** *

Constructor. */ -PPrepFourier::PPrepFourier(const Int_t *bkgRange, const Int_t packing) : +PPrepFourier::PPrepFourier(const Int_t packing, const Int_t *bkgRange, PDoubleVector bkg) : fPacking(packing) { SetBkgRange(bkgRange); + SetBkg(bkg); } //-------------------------------------------------------------------------- @@ -114,6 +115,20 @@ void PPrepFourier::SetBkgRange(const Int_t *bkgRange) } } +//-------------------------------------------------------------------------- +// SetBkgRange +//-------------------------------------------------------------------------- +/** + *

set the background values for all the histos. + * + * \param bkg vector + */ +void PPrepFourier::SetBkg(PDoubleVector bkg) +{ + for (unsigned int i=0; i= fRawData[i].rawData.size()) || (fBkgRange[1] >= fRawData[i].rawData.size())) { - cerr << endl << "PPrepFourier::DoBkgCorrection() **ERROR** bkg-range out of data-range!"; + if ((fBkgRange[0] != -1) && (fBkgRange[1] != -1)) { // background range is given + // make sure that the bkg range is ok + for (unsigned int i=0; i= fRawData[i].rawData.size()) || (fBkgRange[1] >= fRawData[i].rawData.size())) { + cerr << endl << "PPrepFourier::DoBkgCorrection() **ERROR** bkg-range out of data-range!"; + return; + } + } + + Double_t bkg=0.0; + for (unsigned int i=0; i background " << i << ": " << bkg << endl; + + // correct data + for (unsigned int j=0; jNot implemented yet. - */ -void PPrepFourier::DoFiltering() -{ - // make sure fData are already present, and if not create the necessary data sets - if (fData.size() != fRawData.size()) { - InitData(); - } -} - //-------------------------------------------------------------------------- // DoLifeTimeCorrection //-------------------------------------------------------------------------- @@ -419,7 +437,7 @@ TH1F *PPrepFourier::GetData(const UInt_t idx) } //-------------------------------------------------------------------------- -// InitData +// InitData (private) //-------------------------------------------------------------------------- /** *

Copy raw-data to internal data from t0 to the size of raw-data. diff --git a/src/include/PFourier.h b/src/include/PFourier.h index 787450e1..868b1d09 100644 --- a/src/include/PFourier.h +++ b/src/include/PFourier.h @@ -55,6 +55,7 @@ class PFourier virtual const char* GetDataTitle() { return fData->GetTitle(); } virtual const Int_t GetUnitTag() { return fUnitTag; } virtual Double_t GetResolution() { return fResolution; } + virtual Double_t GetMaxFreq(); virtual TH1F* GetRealFourier(const Double_t scale = 1.0); virtual TH1F* GetImaginaryFourier(const Double_t scale = 1.0); virtual TH1F* GetPowerFourier(const Double_t scale = 1.0); diff --git a/src/include/PPrepFourier.h b/src/include/PPrepFourier.h index d1066809..de945f4b 100644 --- a/src/include/PPrepFourier.h +++ b/src/include/PPrepFourier.h @@ -34,7 +34,8 @@ #include using namespace std; -#include "TH1F.h" +#include +#include #include "PMusr.h" @@ -59,16 +60,16 @@ typedef struct { class PPrepFourier { public: PPrepFourier(); - PPrepFourier(const Int_t *bkgRange, const Int_t packing); + PPrepFourier(const Int_t packing, const Int_t *bkgRange, PDoubleVector bkg); virtual ~PPrepFourier(); - void SetBkgRange(const Int_t *bkgRange); - void SetPacking(const Int_t packing); - void AddData(musrFT_data &data); - void DoBkgCorrection(); - void DoPacking(); - void DoFiltering(); - void DoLifeTimeCorrection(Double_t fudge); + virtual void SetBkgRange(const Int_t *bkgRange); + virtual void SetBkg(PDoubleVector bkg); + virtual void SetPacking(const Int_t packing); + virtual void AddData(musrFT_data &data); + virtual void DoBkgCorrection(); + virtual void DoPacking(); + virtual void DoLifeTimeCorrection(Double_t fudge); TString GetInfo(const UInt_t idx); UInt_t GetNoOfData() { return fRawData.size(); } @@ -79,9 +80,10 @@ class PPrepFourier { vector fRawData; vectorfData; Int_t fBkgRange[2]; + PDoubleVector fBkg; Int_t fPacking; - void InitData(); + virtual void InitData(); }; #endif // _PPREPFOURIER_H_ diff --git a/src/musrFT.cpp b/src/musrFT.cpp index 68d3c47b..ca8bde92 100644 --- a/src/musrFT.cpp +++ b/src/musrFT.cpp @@ -65,7 +65,8 @@ typedef struct { TString graphicFormat; ///< format for the graphical output dump TString dumpFln; ///< dump file name for Fourier data output TString msrFlnOut; ///< dump file name for msr-file generation - int bkg[2]; ///< background range + int bkg_range[2]; ///< background range + vector bkg; ///< background value TString fourierOpt; ///< Fourier options, i.e. real, imag, power, phase TString apodization; ///< apodization setting: none, weak, medium, strong int fourierPower; ///< Fourier power for zero padding, i.e. 2^fourierPower points @@ -106,13 +107,13 @@ void musrFT_syntax() cout << endl << " Supported graphic-format-extension: eps, pdf, gif, jpg, png, svg, xpm, root"; cout << endl << " --dump : rather than starting a root session and showing Fourier graphs of the data,"; cout << endl << " it will output the Fourier data in an ascii file ."; - cout << endl << " --filter : filter and filter-specific-information -- ***TO BE WRITTEN YET***."; - cout << endl << " -b, --background : background interval used to estimate the backround to be"; + cout << endl << " -br, --background-range : background interval used to estimate the backround to be"; cout << endl << " subtracted before the Fourier transform. , to be given in bins."; + cout << endl << " -bg, --background : gives the background explicit for each histogram."; cout << endl << " -fo, --fourier-option : can be 'real', 'imag', 'real+imag', 'power', or 'phase'."; cout << endl << " If this is not defined (neither on the command line nor in the musrFT_startup.xml),"; cout << endl << " default will be 'power'."; - cout << endl << " -apod, --apodization : can be either 'none', 'weak', 'medium', 'strong'."; + cout << endl << " -ap, --apodization : can be either 'none', 'weak', 'medium', 'strong'."; cout << endl << " Default will be 'none'."; cout << endl << " -fp, --fourier-power : being the Fourier power, i.e. 2^ used for zero padding."; cout << endl << " Default is -1, i.e. no zero padding will be performed."; @@ -160,8 +161,8 @@ void musrFT_init(musrFT_startup_param &startupParam) startupParam.graphicFormat = TString(""); startupParam.dumpFln = TString(""); startupParam.msrFlnOut = TString(""); - startupParam.bkg[0] = -1; - startupParam.bkg[1] = -1; + startupParam.bkg_range[0] = -1; + startupParam.bkg_range[1] = -1; startupParam.fourierOpt = TString("??"); startupParam.apodization = TString("none"); startupParam.fourierPower = -1; @@ -321,27 +322,44 @@ int musrFT_parse_options(int argc, char *argv[], musrFT_startup_param &startupPa } startupParam.dumpFln = argv[i+1]; i++; - } else if (tstr.Contains("--filter")) { - cout << endl << "debug> found option filter. NOT YET ANY FUNCTIONALITY." << endl; - } else if (tstr.Contains("-b") || tstr.Contains("--background")) { + } else if (tstr.Contains("-br") || tstr.Contains("--background-range")) { if (i+2 >= argc) { // something is wrong since there needs to be two arguments here - cerr << endl << ">> musrFT **ERROR** found option --background with wrong number of arguments." << endl; + cerr << endl << ">> musrFT **ERROR** found option --background-range with wrong number of arguments." << endl; return 2; } - TString bkg[2]; - bkg[0] = argv[i+1]; - bkg[1] = argv[i+2]; - if (!bkg[0].IsDigit()) { - cerr << endl << ">> musrFT **ERROR** bin of option --background is NOT an int-number! ('" << bkg[0] << "')." << endl; + TString bkgRange[2]; + bkgRange[0] = argv[i+1]; + bkgRange[1] = argv[i+2]; + if (!bkgRange[0].IsDigit()) { + cerr << endl << ">> musrFT **ERROR** bin of option --background-range is NOT an int-number! ('" << bkgRange[0] << "')." << endl; return 2; } - if (!bkg[1].IsDigit()) { - cerr << endl << ">> musrFT **ERROR** bin of option --background is NOT an int-number! ('" << bkg[1] << "')." << endl; + if (!bkgRange[1].IsDigit()) { + cerr << endl << ">> musrFT **ERROR** bin of option --background-range is NOT an int-number! ('" << bkgRange[1] << "')." << endl; return 2; } - startupParam.bkg[0] = bkg[0].Atoi(); - startupParam.bkg[1] = bkg[1].Atoi(); + startupParam.bkg_range[0] = bkgRange[0].Atoi(); + startupParam.bkg_range[1] = bkgRange[1].Atoi(); i += 2; + } else if (tstr.BeginsWith("-bg") || !tstr.CompareTo("--background")) { + TString topt(""); + while (++i < argc) { + if (argv[i][0] == '-') { + --i; + break; + } else { + topt = argv[i]; + if (!topt.IsFloat()) { + cerr << endl << ">> musrFT **ERROR** found option --background='" << topt << "' which is not a float" << endl; + return 2; + } + startupParam.bkg.push_back(topt.Atoi()); + } + } + if (startupParam.bkg.size() == 0) { // something is wrong since there needs to be an argument here + cerr << endl << ">> musrFT **ERROR** found option --background without argument!" << endl; + return 2; + } } else if (tstr.BeginsWith("-fo") || tstr.BeginsWith("--fourier-option")) { if (i+1 >= argc) { // something is wrong since there needs to be two arguments here cerr << endl << ">> musrFT **ERROR** found option --fourier-option without arguments." << endl; @@ -354,7 +372,7 @@ int musrFT_parse_options(int argc, char *argv[], musrFT_startup_param &startupPa } startupParam.fourierOpt = topt; i++; - } else if (tstr.BeginsWith("-apod") || tstr.BeginsWith("--apodization")) { + } else if (tstr.BeginsWith("-ap") || tstr.BeginsWith("--apodization")) { if (i+1 >= argc) { // something is wrong since there needs to be two arguments here cerr << endl << ">> musrFT **ERROR** found option --apodization without arguments." << endl; return 2; @@ -453,7 +471,7 @@ int musrFT_parse_options(int argc, char *argv[], musrFT_startup_param &startupPa startupParam.t0.push_back(topt.Atoi()); } } - if (startupParam.dataFln.size() == 0) { // something is wrong since there needs to be an argument here + if (startupParam.t0.size() == 0) { // something is wrong since there needs to be an argument here cerr << endl << ">> musrFT **ERROR** found option --t0 without argument!" << endl; return 2; } @@ -550,11 +568,11 @@ int musrFT_parse_options(int argc, char *argv[], musrFT_startup_param &startupPa cerr << endl << ">> musrFT **ERROR** neither nor defined." << endl; return 2; } - if (startupParam.bkg[0] > startupParam.bkg[1]) { - cerr << endl << ">> musrFT **WARNING** in --background, start=" << startupParam.bkg[0] << " > end=" << startupParam.bkg[1] << ", will swap them." << endl; - double swap = startupParam.bkg[0]; - startupParam.bkg[0] = startupParam.bkg[1]; - startupParam.bkg[1] = swap; + if (startupParam.bkg_range[0] > startupParam.bkg_range[1]) { + cerr << endl << ">> musrFT **WARNING** in --background-range, start=" << startupParam.bkg_range[0] << " > end=" << startupParam.bkg_range[1] << ", will swap them." << endl; + double swap = startupParam.bkg_range[0]; + startupParam.bkg_range[0] = startupParam.bkg_range[1]; + startupParam.bkg_range[1] = swap; } if (startupParam.fourierRange[0] > startupParam.fourierRange[1]) { cerr << endl << ">> musrFT **WARNING** in --fourier-range, start=" << startupParam.fourierRange[0] << " > end=" << startupParam.fourierRange[1] << ", will swap them." << endl; @@ -875,8 +893,8 @@ void musrFT_dumpMsrFile(musrFT_startup_param ¶m) if ((param.t0.size() > 1) && (j < param.t0.size())) { fout << "t0 " << param.t0[j] << endl; } - if ((param.bkg[0] > -1) && (param.bkg[1] > -1)) - fout << "background " << param.bkg[0] << " " << param.bkg[1] << endl; + if ((param.bkg_range[0] > -1) && (param.bkg_range[1] > -1)) + fout << "background " << param.bkg_range[0] << " " << param.bkg_range[1] << endl; fout << "#--------------------------------------------------------------" << endl; } } @@ -1027,7 +1045,7 @@ int main(int argc, char *argv[]) startupHandler->SetStartupOptions(startup_options); // defines the raw time-domain data vector - PPrepFourier data(startupParam.bkg, startupParam.packing); + PPrepFourier data(startupParam.packing, startupParam.bkg_range, startupParam.bkg); // load msr-file(s) vector msrHandler; @@ -1146,6 +1164,24 @@ int main(int argc, char *argv[]) if (fourierBlock->fFourierBlockPresent) { // get units unitTag = fourierBlock->fUnits; + if (startupParam.fourierUnits.BeginsWith("??")) { + switch (unitTag) { + case FOURIER_UNIT_GAUSS: + startupParam.fourierUnits = TString("Gauss"); + break; + case FOURIER_UNIT_TESLA: + startupParam.fourierUnits = TString("Tesla"); + break; + case FOURIER_UNIT_FREQ: + startupParam.fourierUnits = TString("MHz"); + break; + case FOURIER_UNIT_CYCLES: + startupParam.fourierUnits = TString("Mc/s"); + break; + default: + break; + } + } // get fourier power if (startupParam.fourierPower == -1) { // no Fourier power given from the command line, hence check FOURIER block if (fourierBlock->fFourierPower > 1) @@ -1277,9 +1313,6 @@ int main(int argc, char *argv[]) // calculate background levels and subtract them from the data data.DoBkgCorrection(); - // do the time domain filtering now - data.DoFiltering(); - // do lifetime correction if (startupParam.lifetimecorrection != 0.0) data.DoLifeTimeCorrection(startupParam.lifetimecorrection); @@ -1321,7 +1354,13 @@ int main(int argc, char *argv[]) fourier[i]->Transform(apodTag); } double end = millitime(); - cout << endl << "debug> after FFT. calculation time: " << (end-start)/1.0e3 << " (sec)." << endl; + cout << endl << "info> after FFT. calculation time: " << (end-start)/1.0e3 << " (sec)." << endl; + + // make sure that a Fourier range is provided, if not calculate one + if ((startupParam.fourierRange[0] == -1.0) && (startupParam.fourierRange[1] == -1.0)) { + startupParam.fourierRange[0] = 0.0; + startupParam.fourierRange[1] = fourier[0]->GetMaxFreq(); + } PFourierCanvas *fourierCanvas = 0;