diff --git a/ChangeLog b/ChangeLog index 60c674e9..7f4dc8b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ changes since 0.13.0 =================================== +NEW 2015-02-23 implemented an average-per-data-set option for musrFT. NEW 2015-02-20 add a switch to musrview that it plots initially the Fouier data rather than the time domain data. NEW 2015-02-19 added a first preliminary user interface for musrFT within musredit. diff --git a/doc/html/user/MUSR/BmwLibs.html b/doc/html/user/MUSR/BmwLibs.html index 3ee693e6..97119e33 100644 --- a/doc/html/user/MUSR/BmwLibs.html +++ b/doc/html/user/MUSR/BmwLibs.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -144,7 +144,7 @@ pre {
- Edit | Attach | Print version | PDF | History: r5 < r4 < r3 < r2 | Backlinks | View wiki text | Refresh | More topic actions + Edit | Attach | Print version | PDF | History: r5 < r4 < r3 < r2 | Backlinks | View wiki text | Refresh | More topic actions
Topic revision: r5 - 10 Jul 2011, wojek
@@ -194,7 +194,7 @@ pre { - +

diff --git a/doc/html/user/MUSR/CiteMusrFit.html b/doc/html/user/MUSR/CiteMusrFit.html index 6db84c60..13eee7f6 100644 --- a/doc/html/user/MUSR/CiteMusrFit.html +++ b/doc/html/user/MUSR/CiteMusrFit.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -142,7 +142,7 @@ Since quite some effort is going into the development and maintenance of the
- Edit | Attach | Print version | PDF | History: r2 < r1 | Backlinks | View wiki text | Refresh | More topic actions + Edit | Attach | Print version | PDF | History: r2 < r1 | Backlinks | View wiki text | Refresh | More topic actions
Topic revision: r2 - 19 Jun 2012, AndreasSuter
@@ -192,7 +192,7 @@ Since quite some effort is going into the development and maintenance of the - +

diff --git a/doc/html/user/MUSR/LibFitPofB.html b/doc/html/user/MUSR/LibFitPofB.html index 66a1108f..b3263699 100644 --- a/doc/html/user/MUSR/LibFitPofB.html +++ b/doc/html/user/MUSR/LibFitPofB.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -420,7 +420,7 @@ An example XML file looks as follows:
Topic revision: r16 - 10 Jul 2011, wojek
@@ -470,7 +470,7 @@ An example XML file looks as follows: - +

diff --git a/doc/html/user/MUSR/LibZFRelaxation.html b/doc/html/user/MUSR/LibZFRelaxation.html index 6ee6e133..3f8ac815 100644 --- a/doc/html/user/MUSR/LibZFRelaxation.html +++ b/doc/html/user/MUSR/LibZFRelaxation.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -225,7 +225,7 @@ The parameters are:
    Topic revision: r2 - 10 Jul 2011, wojek
    @@ -275,7 +275,7 @@ The parameters are:
      - +

      diff --git a/doc/html/user/MUSR/Msr2Data.html b/doc/html/user/MUSR/Msr2Data.html index d290fd3a..3f264332 100644 --- a/doc/html/user/MUSR/Msr2Data.html +++ b/doc/html/user/MUSR/Msr2Data.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -349,7 +349,7 @@ For reporting bugs or requesting new features and improvements please use the - @@ -421,7 +421,7 @@ For reporting bugs or requesting new features and improvements please use the - +

      diff --git a/doc/html/user/MUSR/MusrFit.html b/doc/html/user/MUSR/MusrFit.html index 395627be..33099c71 100644 --- a/doc/html/user/MUSR/MusrFit.html +++ b/doc/html/user/MUSR/MusrFit.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -243,7 +243,8 @@ If called from within a shell it accepts the following parameters:
      -fr, --fourier-range <start> <end>
      Fourier range. <start>, <end> are interpreted in the units given. Default will be -1.0 for both which means, take the full Fourier range.
      -tr, --time-range <start> <end>
      time domain range to be used for Fourier transform. <start>, <end> are to be given in (μsec). If nothing is given, the full time range found in the data file(s) will be used.
      --histo <list>
      give the <list> of histograms to be used for the Fourier transform. E.g. musrFT -df lem15_his_01234.root --histo 1 3, will only be needed together with the option --data-file. If multiple data file are given, <list> will apply to all data-files given. If --histo is not given, all histos of a data file will be used. <list> can be anything like: 2 3 6, or 2-17, or 1-6 9, etc. -
      -a, --average
      show the average of all Fourier transformed data. +
      -a, --average
      show the average of all ALL Fourier transformed data. +
      -ad, --average-per-data-set
      show the average of per data set Fourier transformed data.
      --t0 <list>
      A list of t0's can be provided. This in conjunction with --data-file and --fourier-option real allows to get the proper initial phase if t0's are known. If a single t0 for multiple histos is given, it is assume, that this t0 is common to all histos. Example: musrFT -df lem15_his_01234.root -fo real --t0 2750 --histo 1 3.
      -pa, --packing <N>
      if <N> (an integer), the time domain data will first be packed/rebinned by <N>.
      --title <title>
      give a global title for the plot. @@ -261,12 +262,14 @@ Within the drawn canvas all standard actions applicable to ROOT can In the menu bar the MusrFT menu can be found. From there some musrFT-specific actions might be taken:
      Fourier
      allows to switch between different Fourier transform representations 'Power', 'Real', ...
      Average
      toggle between the current view and the averaged data view. +
      Average per Data Set
      toggle between the current view and the per data set average view.
      Export Data
      saves the selected data in a simple multi-column ASCII file

      Additionally, some functions can be accessed using key-shortcuts:
      q
      quits musrFT
      a
      toggle between average of the presented data and single Fourier histos, e.g. the averaged Fourier power spectra of various detectors. +
      d
      toggle between average per data set and single Fourier histos, e.g. the averaged Fourier power spectra of various detectors for the different data sets given.
      u
      reset the plotting range to the area given in the msr-file or the form the command line ("unzoom")

      @@ -1599,9 +1602,9 @@ For reporting bugs or requesting new features and improvements please use the
      -
      Topic revision: r123 - 19 Feb 2015, AndreasSuter
      +
      Topic revision: r124 - 23 Feb 2015, AndreasSuter
      @@ -1649,7 +1652,7 @@ For reporting bugs or requesting new features and improvements please use the
      - +

      diff --git a/doc/html/user/MUSR/MusrFitAcknowledgements.html b/doc/html/user/MUSR/MusrFitAcknowledgements.html index 1bfe6d00..a55d42df 100644 --- a/doc/html/user/MUSR/MusrFitAcknowledgements.html +++ b/doc/html/user/MUSR/MusrFitAcknowledgements.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -142,7 +142,7 @@ pre {
      Topic revision: r4 - 10 Jul 2011, wojek
      @@ -192,7 +192,7 @@ pre { - +

      diff --git a/doc/html/user/MUSR/MusrFitSetup.html b/doc/html/user/MUSR/MusrFitSetup.html index e36c8315..b1bb4f09 100644 --- a/doc/html/user/MUSR/MusrFitSetup.html +++ b/doc/html/user/MUSR/MusrFitSetup.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -846,7 +846,7 @@ musrview test-histo-ROOT-NPP.msr
      Topic revision: r60 - 25 Oct 2014, AndreasSuter
      @@ -896,7 +896,7 @@ musrview test-histo-ROOT-NPP.msr - +

      diff --git a/doc/html/user/MUSR/MusrGui.html b/doc/html/user/MUSR/MusrGui.html index c76fb0d9..00e0dc69 100644 --- a/doc/html/user/MUSR/MusrGui.html +++ b/doc/html/user/MUSR/MusrGui.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -327,7 +327,7 @@ For reporting bugs or requesting new features and improvements please use the - @@ -399,7 +399,7 @@ For reporting bugs or requesting new features and improvements please use the - +

      diff --git a/doc/html/user/MUSR/MusrRoot.html b/doc/html/user/MUSR/MusrRoot.html index 8d53c6cd..b81830ac 100644 --- a/doc/html/user/MUSR/MusrRoot.html +++ b/doc/html/user/MUSR/MusrRoot.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -1038,7 +1038,7 @@ Result in the RunHeader/SampleEnvironmentInfo: -
      + @@ -1110,7 +1110,7 @@ Result in the RunHeader/SampleEnvironmentInfo:
      - +

      diff --git a/doc/html/user/MUSR/QuickStart.html b/doc/html/user/MUSR/QuickStart.html index b7f0eccd..51ed59d0 100644 --- a/doc/html/user/MUSR/QuickStart.html +++ b/doc/html/user/MUSR/QuickStart.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -280,7 +280,7 @@ RUN 2008/lem08_his_8472 MUE4 PSI ROOT-NPP (name beamline institute dat
      Topic revision: r7 - 10 Jul 2011, wojek
      @@ -330,7 +330,7 @@ RUN 2008/lem08_his_8472 MUE4 PSI ROOT-NPP (name beamline institute dat - +

      diff --git a/doc/html/user/MUSR/TutorialSingleHisto.html b/doc/html/user/MUSR/TutorialSingleHisto.html index 4a4a5f62..e9a6f154 100644 --- a/doc/html/user/MUSR/TutorialSingleHisto.html +++ b/doc/html/user/MUSR/TutorialSingleHisto.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -281,7 +281,7 @@ This page only summarizes the very basic features and options of the programs co -
      +

      Attachments (6)

       
      @@ -303,7 +303,7 @@ This page only summarizes the very basic features and options of the programs co
      Topic revision: r9 - 02 Sep 2011, wojek
      @@ -353,7 +353,7 @@ This page only summarizes the very basic features and options of the programs co
      - +

      diff --git a/doc/html/user/MUSR/WebHome.html b/doc/html/user/MUSR/WebHome.html index 9318645f..77ceaaaa 100644 --- a/doc/html/user/MUSR/WebHome.html +++ b/doc/html/user/MUSR/WebHome.html @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -156,7 +156,7 @@ pre {
      Topic revision: r49 - 19 Feb 2015, AndreasSuter
      @@ -206,7 +206,7 @@ pre { - +

      diff --git a/src/classes/PFourierCanvas.cpp b/src/classes/PFourierCanvas.cpp index b31cc3e6..38bb4a79 100644 --- a/src/classes/PFourierCanvas.cpp +++ b/src/classes/PFourierCanvas.cpp @@ -43,9 +43,9 @@ using namespace std; #define YINFO 0.2 #define YTITLE 0.95 -static const char *gFiletypes[] = { "Data files", "*.dat", - "All files", "*", - 0, 0 }; +static const Char_t *gFiletypes[] = { "Data files", "*.dat", + "All files", "*", + 0, 0 }; ClassImpQ(PFourierCanvas) @@ -61,6 +61,7 @@ PFourierCanvas::PFourierCanvas() fBatchMode = false; fValid = false; fAveragedView = false; + fAveragedViewPerDataSet = false; fCurrentPlotView = FOURIER_PLOT_NOT_GIVEN; fInitialXRange[0] = 0.0; fInitialXRange[1] = 0.0; @@ -99,12 +100,14 @@ PFourierCanvas::PFourierCanvas() * \param wh * \param batch */ -PFourierCanvas::PFourierCanvas(vector &fourier, const Char_t* title, const Bool_t showAverage, +PFourierCanvas::PFourierCanvas(vector &fourier, PIntVector dataSetTag, const Char_t* title, + const Bool_t showAverage, const Bool_t showAveragePerDataSet, const Int_t fourierPlotOpt, Double_t fourierXrange[], Double_t phase, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const Bool_t batch) : - fBatchMode(batch), fAveragedView(showAverage), fCurrentPlotView(fourierPlotOpt), - fTitle(title), fFourier(fourier), fCurrentFourierPhase(phase) + fBatchMode(batch), fAveragedView(showAverage), fAveragedViewPerDataSet(showAveragePerDataSet), + fDataSetTag(dataSetTag), fCurrentPlotView(fourierPlotOpt), fTitle(title), fFourier(fourier), + fCurrentFourierPhase(phase) { fInitialXRange[0] = fourierXrange[0]; fInitialXRange[1] = fourierXrange[1]; @@ -116,6 +119,17 @@ PFourierCanvas::PFourierCanvas(vector &fourier, const Char_t* title, fCurrentFourierPhaseText = 0; + // generate fMarkerList and fColorList, since they are not provided + TRandom rand; + Int_t style, color; + for (UInt_t i=0; i &fourier, const Char_t* title, * \param colorList * \param batch */ -PFourierCanvas::PFourierCanvas(vector &fourier, const Char_t* title, const Bool_t showAverage, +PFourierCanvas::PFourierCanvas(vector &fourier, PIntVector dataSetTag, const Char_t* title, + const Bool_t showAverage, const Bool_t showAveragePerDataSet, const Int_t fourierPlotOpt, Double_t fourierXrange[], Double_t phase, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const PIntVector markerList, const PIntVector colorList, const Bool_t batch) : - fBatchMode(batch), fAveragedView(showAverage), fCurrentPlotView(fourierPlotOpt), - fTitle(title), fFourier(fourier), fCurrentFourierPhase(phase), - fMarkerList(markerList), fColorList(colorList) + fBatchMode(batch), fAveragedView(showAverage), fAveragedViewPerDataSet(showAveragePerDataSet), + fDataSetTag(dataSetTag), fCurrentPlotView(fourierPlotOpt), fTitle(title), fFourier(fourier), + fCurrentFourierPhase(phase), fMarkerList(markerList), fColorList(colorList) { fInitialXRange[0] = fourierXrange[0]; fInitialXRange[1] = fourierXrange[1]; @@ -160,6 +175,20 @@ PFourierCanvas::PFourierCanvas(vector &fourier, const Char_t* title, fCurrentFourierPhaseText = 0; + // generate fMarkerList and fColorList, since they are not provided + TRandom rand; + Int_t style, color; + for (UInt_t i=fMarkerList.size(); i 0) { - for (unsigned int i=0; iClear(); + delete fLegAvgPerDataSet; + fLegAvgPerDataSet = 0; + } + /* if (fMainCanvas) { delete fMainCanvas; @@ -267,19 +302,40 @@ void PFourierCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *select if (x == 'q') { // quit Done(0); } else if (x == 'u') { // unzoom - if (fAveragedView) + if (fAveragedView || fAveragedViewPerDataSet) PlotAverage(); else PlotFourier(); } else if (x == 'a') { // toggle between average view and single histo view // toggle average view flag fAveragedView = !fAveragedView; + // unset average per data set view flag + fAveragedViewPerDataSet = false; // update menu if (fAveragedView) { fPopupMain->CheckEntry(P_MENU_ID_AVERAGE); + fPopupMain->UnCheckEntry(P_MENU_ID_AVERAGE_PER_DATA_SET); HandleAverage(); PlotAverage(); } else { + fPopupMain->UnCheckEntry(P_MENU_ID_AVERAGE); + fPopupMain->UnCheckEntry(P_MENU_ID_AVERAGE_PER_DATA_SET); + CleanupAverage(); + PlotFourier(); + } + } else if (x == 'd') { // toggle between average view per data set and single histo view + // toggle average per data set view flag + fAveragedViewPerDataSet = !fAveragedViewPerDataSet; + // unset average view flag + fAveragedView = false; + // update menu + if (fAveragedViewPerDataSet) { + fPopupMain->CheckEntry(P_MENU_ID_AVERAGE_PER_DATA_SET); + fPopupMain->UnCheckEntry(P_MENU_ID_AVERAGE); + HandleAverage(); + PlotAverage(); + } else { + fPopupMain->UnCheckEntry(P_MENU_ID_AVERAGE_PER_DATA_SET); fPopupMain->UnCheckEntry(P_MENU_ID_AVERAGE); CleanupAverage(); PlotFourier(); @@ -337,12 +393,33 @@ void PFourierCanvas::HandleMenuPopup(Int_t id) } else if (id == P_MENU_ID_AVERAGE) { // toggle average view flag fAveragedView = !fAveragedView; + // unset average per data set view flag + fAveragedViewPerDataSet = false; // update menu if (fAveragedView) { fPopupMain->CheckEntry(P_MENU_ID_AVERAGE); + fPopupMain->UnCheckEntry(P_MENU_ID_AVERAGE_PER_DATA_SET); HandleAverage(); PlotAverage(); } else { + fPopupMain->UnCheckEntry(P_MENU_ID_AVERAGE); + fPopupMain->UnCheckEntry(P_MENU_ID_AVERAGE_PER_DATA_SET); + CleanupAverage(); + PlotFourier(); + } + } else if (id == P_MENU_ID_AVERAGE_PER_DATA_SET) { + // toggle average per data set view flag + fAveragedViewPerDataSet = !fAveragedViewPerDataSet; + // unset average view flag + fAveragedView = false; + // update menu + if (fAveragedViewPerDataSet) { + fPopupMain->CheckEntry(P_MENU_ID_AVERAGE_PER_DATA_SET); + fPopupMain->UnCheckEntry(P_MENU_ID_AVERAGE); + HandleAverage(); + PlotAverage(); + } else { + fPopupMain->UnCheckEntry(P_MENU_ID_AVERAGE_PER_DATA_SET); fPopupMain->UnCheckEntry(P_MENU_ID_AVERAGE); CleanupAverage(); PlotFourier(); @@ -385,7 +462,7 @@ void PFourierCanvas::UpdateFourierPad() if (!fValid) return; - if (fAveragedView) + if (fAveragedView || fAveragedViewPerDataSet) PlotAverage(); else PlotFourier(); @@ -408,14 +485,14 @@ void PFourierCanvas::UpdateInfoPad() // write header line TDatime dt; - char dtStr[128]; + Char_t dtStr[128]; strncpy(dtStr, dt.AsSQLString(), sizeof(dtStr)); TString str("musrFT: "); str += dtStr; fInfoPad->SetHeader(str); - char title[1024]; - for (unsigned int i=0; iGetDataTitle(), sizeof(title)); // add entry fInfoPad->AddEntry(fFourierHistos[i].dataFourierRe, title, "p"); @@ -563,24 +640,24 @@ void PFourierCanvas::ExportData(const Char_t *pathFileName) // write header fout << "% " << pfn << endl; fout << "% averaged data of:" << endl; - for (unsigned int i=0; iGetTitle() << endl; } fout << "%------------" << endl; fout << "% " << xAxis << ", " << yAxis << endl; - for (int i=xMinBin; iGetBinCenter(i) << ", " << fFourierAverage.dataFourierRe->GetBinContent(i) << endl; + fout << fFourierAverage[0].dataFourierRe->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierRe->GetBinContent(i) << endl; break; case FOURIER_PLOT_IMAG: - fout << fFourierAverage.dataFourierIm->GetBinCenter(i) << ", " << fFourierAverage.dataFourierIm->GetBinContent(i) << endl; + fout << fFourierAverage[0].dataFourierIm->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierIm->GetBinContent(i) << endl; break; case FOURIER_PLOT_POWER: - fout << fFourierAverage.dataFourierPwr->GetBinCenter(i) << ", " << fFourierAverage.dataFourierPwr->GetBinContent(i) << endl; + fout << fFourierAverage[0].dataFourierPwr->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierPwr->GetBinContent(i) << endl; break; case FOURIER_PLOT_PHASE: - fout << fFourierAverage.dataFourierPhase->GetBinCenter(i) << ", " << fFourierAverage.dataFourierPhase->GetBinContent(i) << endl; + fout << fFourierAverage[0].dataFourierPhase->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierPhase->GetBinContent(i) << endl; break; default: break; @@ -590,19 +667,19 @@ void PFourierCanvas::ExportData(const Char_t *pathFileName) // write header fout << "% " << pfn << endl; fout << "% data of:" << endl; - for (unsigned int i=0; iGetTitle() << endl; } fout << "%------------" << endl; fout << "% "; - for (unsigned int i=0; iGetBinCenter(i) << ", " << fFourierHistos[j].dataFourierRe->GetBinContent(i) << ", "; @@ -695,7 +772,7 @@ void PFourierCanvas::InitFourierDataSets() { // get all the Fourier histos fFourierHistos.resize(fFourier.size()); - for (unsigned int i=0; iGetRealFourier(); fFourierHistos[i].dataFourierIm = fFourier[i]->GetImaginaryFourier(); fFourierHistos[i].dataFourierPwr = fFourier[i]->GetPowerFourier(); @@ -707,116 +784,86 @@ void PFourierCanvas::InitFourierDataSets() Int_t start = fFourierHistos[0].dataFourierRe->FindBin(fInitialXRange[0]); Int_t end = fFourierHistos[0].dataFourierRe->FindBin(fInitialXRange[1]); // real - for (unsigned int i=0; iGetBinContent(j); if (fabs(dval) > max) max = dval; } } - for (unsigned int i=0; iGetNbinsX(); j++) { + for (UInt_t i=0; iGetNbinsX(); j++) { fFourierHistos[i].dataFourierRe->SetBinContent(j, fFourierHistos[i].dataFourierRe->GetBinContent(j)/fabs(max)); } } // imaginary - for (unsigned int i=0; iGetBinContent(j); if (fabs(dval) > max) max = dval; } } - for (unsigned int i=0; iGetNbinsX(); j++) { + for (UInt_t i=0; iGetNbinsX(); j++) { fFourierHistos[i].dataFourierIm->SetBinContent(j, fFourierHistos[i].dataFourierIm->GetBinContent(j)/fabs(max)); } } // power max = 0.0; - for (unsigned int i=0; iGetBinContent(j); if (fabs(dval) > max) max = dval; } } - for (unsigned int i=0; iGetNbinsX(); j++) { + for (UInt_t i=0; iGetNbinsX(); j++) { fFourierHistos[i].dataFourierPwr->SetBinContent(j, fFourierHistos[i].dataFourierPwr->GetBinContent(j)/fabs(max)); } } // phase max = 0.0; - for (unsigned int i=0; iGetBinContent(j); if (fabs(dval) > max) max = dval; } } - for (unsigned int i=0; iGetNbinsX(); j++) { + for (UInt_t i=0; iGetNbinsX(); j++) { fFourierHistos[i].dataFourierPhase->SetBinContent(j, fFourierHistos[i].dataFourierPhase->GetBinContent(j)/fabs(max)); } } // set the marker and line color - for (unsigned int i=0; iSetMarkerColor(fColorList[i]); - fFourierHistos[i].dataFourierRe->SetLineColor(fColorList[i]); - fFourierHistos[i].dataFourierIm->SetMarkerColor(fColorList[i]); - fFourierHistos[i].dataFourierIm->SetLineColor(fColorList[i]); - fFourierHistos[i].dataFourierPwr->SetMarkerColor(fColorList[i]); - fFourierHistos[i].dataFourierPwr->SetLineColor(fColorList[i]); - fFourierHistos[i].dataFourierPhase->SetMarkerColor(fColorList[i]); - fFourierHistos[i].dataFourierPhase->SetLineColor(fColorList[i]); - } else { - TRandom rand(i); - Int_t color = TColor::GetColor((Int_t)rand.Integer(255), (Int_t)rand.Integer(255), (Int_t)rand.Integer(255)); - fFourierHistos[i].dataFourierRe->SetMarkerColor(color); - fFourierHistos[i].dataFourierRe->SetLineColor(color); - fFourierHistos[i].dataFourierIm->SetMarkerColor(color); - fFourierHistos[i].dataFourierIm->SetLineColor(color); - fFourierHistos[i].dataFourierPwr->SetMarkerColor(color); - fFourierHistos[i].dataFourierPwr->SetLineColor(color); - fFourierHistos[i].dataFourierPhase->SetMarkerColor(color); - fFourierHistos[i].dataFourierPhase->SetLineColor(color); - } + for (UInt_t i=0; iSetMarkerColor(fColorList[i]); + fFourierHistos[i].dataFourierRe->SetLineColor(fColorList[i]); + fFourierHistos[i].dataFourierIm->SetMarkerColor(fColorList[i]); + fFourierHistos[i].dataFourierIm->SetLineColor(fColorList[i]); + fFourierHistos[i].dataFourierPwr->SetMarkerColor(fColorList[i]); + fFourierHistos[i].dataFourierPwr->SetLineColor(fColorList[i]); + fFourierHistos[i].dataFourierPhase->SetMarkerColor(fColorList[i]); + fFourierHistos[i].dataFourierPhase->SetLineColor(fColorList[i]); } // set the marker symbol and size - Int_t style; - for (unsigned int i=0; iSetMarkerStyle(fMarkerList[i]); - fFourierHistos[i].dataFourierRe->SetMarkerSize(0.7); - fFourierHistos[i].dataFourierIm->SetMarkerStyle(fMarkerList[i]); - fFourierHistos[i].dataFourierIm->SetMarkerSize(0.7); - fFourierHistos[i].dataFourierPwr->SetMarkerStyle(fMarkerList[i]); - fFourierHistos[i].dataFourierPwr->SetMarkerSize(0.7); - fFourierHistos[i].dataFourierPhase->SetMarkerStyle(fMarkerList[i]); - fFourierHistos[i].dataFourierPhase->SetMarkerSize(0.7); - } else { - TRandom rand(i); - style = 20+(Int_t)rand.Integer(10); - fFourierHistos[i].dataFourierRe->SetMarkerStyle(style); - fFourierHistos[i].dataFourierRe->SetMarkerSize(0.7); - fFourierHistos[i].dataFourierIm->SetMarkerStyle(style); - fFourierHistos[i].dataFourierIm->SetMarkerSize(0.7); - fFourierHistos[i].dataFourierPwr->SetMarkerStyle(style); - fFourierHistos[i].dataFourierPwr->SetMarkerSize(0.7); - fFourierHistos[i].dataFourierPhase->SetMarkerStyle(style); - fFourierHistos[i].dataFourierPhase->SetMarkerSize(0.7); - } + for (UInt_t i=0; iSetMarkerStyle(fMarkerList[i]); + fFourierHistos[i].dataFourierRe->SetMarkerSize(0.7); + fFourierHistos[i].dataFourierIm->SetMarkerStyle(fMarkerList[i]); + fFourierHistos[i].dataFourierIm->SetMarkerSize(0.7); + fFourierHistos[i].dataFourierPwr->SetMarkerStyle(fMarkerList[i]); + fFourierHistos[i].dataFourierPwr->SetMarkerSize(0.7); + fFourierHistos[i].dataFourierPhase->SetMarkerStyle(fMarkerList[i]); + fFourierHistos[i].dataFourierPhase->SetMarkerSize(0.7); } // initialize average histos - fFourierAverage.dataFourierRe = 0; - fFourierAverage.dataFourierIm = 0; - fFourierAverage.dataFourierPwr = 0; - fFourierAverage.dataFourierPhase = 0; + CleanupAverage(); } //-------------------------------------------------------------------------- @@ -895,6 +942,9 @@ void PFourierCanvas::InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t w fPopupMain->AddEntry("Average", P_MENU_ID_AVERAGE); if (fAveragedView) fPopupMain->CheckEntry(P_MENU_ID_AVERAGE); + fPopupMain->AddEntry("Average per Data Set", P_MENU_ID_AVERAGE_PER_DATA_SET); + if (fAveragedViewPerDataSet) + fPopupMain->CheckEntry(P_MENU_ID_AVERAGE_PER_DATA_SET); fPopupMain->AddSeparator(); fPopupMain->AddEntry("Export Data", P_MENU_ID_EXPORT_DATA); @@ -937,8 +987,15 @@ void PFourierCanvas::InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t w fInfoPad->SetFillColor(TColor::GetColor(255,255,255)); fInfoPad->SetTextAlign(12); // middle, left + fLegAvgPerDataSet = 0; + fValid = true; + if ((fFourier.size() != fDataSetTag.size()) && fAveragedViewPerDataSet) { + fValid = false; + cerr << endl << "PFourierCanvas::PFourierCanvas: **PANIC ERROR**: # Fourier != # Data Set Tags." << endl; + } + fMainCanvas->cd(); fMainCanvas->Show(); @@ -955,22 +1012,25 @@ void PFourierCanvas::InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t w */ void PFourierCanvas::CleanupAverage() { - if (fFourierAverage.dataFourierRe != 0) { - delete fFourierAverage.dataFourierRe; - fFourierAverage.dataFourierRe = 0; - } - if (fFourierAverage.dataFourierIm) { - delete fFourierAverage.dataFourierIm; - fFourierAverage.dataFourierIm = 0; - } - if (fFourierAverage.dataFourierPwr) { - delete fFourierAverage.dataFourierPwr; - fFourierAverage.dataFourierPwr = 0; - } - if (fFourierAverage.dataFourierPhase) { - delete fFourierAverage.dataFourierPhase; - fFourierAverage.dataFourierPhase = 0; + for (UInt_t i=0; iGetTitle()) + "_avg"; - fFourierAverage.dataFourierRe = new TH1F(name, name, fFourierHistos[0].dataFourierRe->GetNbinsX(), - fFourierHistos[0].dataFourierRe->GetXaxis()->GetXmin(), - fFourierHistos[0].dataFourierRe->GetXaxis()->GetXmax()); - - name = TString(fFourierHistos[0].dataFourierIm->GetTitle()) + "_avg"; - fFourierAverage.dataFourierIm = new TH1F(name, name, fFourierHistos[0].dataFourierIm->GetNbinsX(), - fFourierHistos[0].dataFourierIm->GetXaxis()->GetXmin(), - fFourierHistos[0].dataFourierIm->GetXaxis()->GetXmax()); - - name = TString(fFourierHistos[0].dataFourierPwr->GetTitle()) + "_avg"; - fFourierAverage.dataFourierPwr = new TH1F(name, name, fFourierHistos[0].dataFourierPwr->GetNbinsX(), - fFourierHistos[0].dataFourierPwr->GetXaxis()->GetXmin(), - fFourierHistos[0].dataFourierPwr->GetXaxis()->GetXmax()); - - name = TString(fFourierHistos[0].dataFourierPhase->GetTitle()) + "_avg"; - fFourierAverage.dataFourierPhase = new TH1F(name, name, fFourierHistos[0].dataFourierPhase->GetNbinsX(), - fFourierHistos[0].dataFourierPhase->GetXaxis()->GetXmin(), - fFourierHistos[0].dataFourierPhase->GetXaxis()->GetXmax()); - Double_t dval=0.0; - // real average - for (Int_t j=0; jGetNbinsX(); j++) { - dval = 0.0; - for (unsigned int i=0; iGetNbinsX()) - dval += GetInterpolatedValue(fFourierHistos[i].dataFourierRe, fFourierHistos[0].dataFourierRe->GetBinCenter(j)); - } - fFourierAverage.dataFourierRe->SetBinContent(j, dval/fFourierHistos.size()); - } - // set marker color, line color, maker size, marker type - fFourierAverage.dataFourierRe->SetMarkerColor(kBlack); - fFourierAverage.dataFourierRe->SetLineColor(kBlack); - fFourierAverage.dataFourierRe->SetMarkerSize(0.8); - fFourierAverage.dataFourierRe->SetMarkerStyle(22); // closed up triangle - // imaginary average - for (Int_t j=0; jGetNbinsX(); j++) { - dval = 0.0; - for (unsigned int i=0; iGetNbinsX()) - dval += GetInterpolatedValue(fFourierHistos[i].dataFourierIm, fFourierHistos[0].dataFourierIm->GetBinCenter(j)); - } - fFourierAverage.dataFourierIm->SetBinContent(j, dval/fFourierHistos.size()); - } - // set marker color, line color, maker size, marker type - fFourierAverage.dataFourierIm->SetMarkerColor(kBlack); - fFourierAverage.dataFourierIm->SetLineColor(kBlack); - fFourierAverage.dataFourierIm->SetMarkerSize(0.8); - fFourierAverage.dataFourierIm->SetMarkerStyle(22); // closed up triangle + // check if ALL data shall be averaged + if (fAveragedView) { + fFourierAverage.resize(1); - // power average - for (Int_t j=0; jGetNbinsX(); j++) { - dval = 0.0; - for (unsigned int i=0; iGetNbinsX()) - dval += GetInterpolatedValue(fFourierHistos[i].dataFourierPwr, fFourierHistos[0].dataFourierPwr->GetBinCenter(j)); - } - fFourierAverage.dataFourierPwr->SetBinContent(j, dval/fFourierHistos.size()); - } - // set marker color, line color, maker size, marker type - fFourierAverage.dataFourierPwr->SetMarkerColor(kBlack); - fFourierAverage.dataFourierPwr->SetLineColor(kBlack); - fFourierAverage.dataFourierPwr->SetMarkerSize(0.8); - fFourierAverage.dataFourierPwr->SetMarkerStyle(22); // closed up triangle + // create average histograms + name = TString(fFourierHistos[0].dataFourierRe->GetTitle()) + "_avg"; + fFourierAverage[0].dataFourierRe = new TH1F(name, name, fFourierHistos[0].dataFourierRe->GetNbinsX(), + fFourierHistos[0].dataFourierRe->GetXaxis()->GetXmin(), + fFourierHistos[0].dataFourierRe->GetXaxis()->GetXmax()); - // phase average - for (Int_t j=0; jGetNbinsX(); j++) { - dval = 0.0; - for (unsigned int i=0; iGetNbinsX()) - dval += GetInterpolatedValue(fFourierHistos[i].dataFourierPhase, fFourierHistos[0].dataFourierPhase->GetBinCenter(j)); + name = TString(fFourierHistos[0].dataFourierIm->GetTitle()) + "_avg"; + fFourierAverage[0].dataFourierIm = new TH1F(name, name, fFourierHistos[0].dataFourierIm->GetNbinsX(), + fFourierHistos[0].dataFourierIm->GetXaxis()->GetXmin(), + fFourierHistos[0].dataFourierIm->GetXaxis()->GetXmax()); + + name = TString(fFourierHistos[0].dataFourierPwr->GetTitle()) + "_avg"; + fFourierAverage[0].dataFourierPwr = new TH1F(name, name, fFourierHistos[0].dataFourierPwr->GetNbinsX(), + fFourierHistos[0].dataFourierPwr->GetXaxis()->GetXmin(), + fFourierHistos[0].dataFourierPwr->GetXaxis()->GetXmax()); + + name = TString(fFourierHistos[0].dataFourierPhase->GetTitle()) + "_avg"; + fFourierAverage[0].dataFourierPhase = new TH1F(name, name, fFourierHistos[0].dataFourierPhase->GetNbinsX(), + fFourierHistos[0].dataFourierPhase->GetXaxis()->GetXmin(), + fFourierHistos[0].dataFourierPhase->GetXaxis()->GetXmax()); + + // real average + for (Int_t j=0; jGetNbinsX(); j++) { + dval = 0.0; + for (UInt_t i=0; iGetNbinsX()) + dval += GetInterpolatedValue(fFourierHistos[i].dataFourierRe, fFourierHistos[0].dataFourierRe->GetBinCenter(j)); + } + fFourierAverage[0].dataFourierRe->SetBinContent(j, dval/fFourierHistos.size()); + } + // set marker color, line color, maker size, marker type + fFourierAverage[0].dataFourierRe->SetMarkerColor(kBlack); + fFourierAverage[0].dataFourierRe->SetLineColor(kBlack); + fFourierAverage[0].dataFourierRe->SetMarkerSize(0.8); + fFourierAverage[0].dataFourierRe->SetMarkerStyle(22); // closed up triangle + + // imaginary average + for (Int_t j=0; jGetNbinsX(); j++) { + dval = 0.0; + for (UInt_t i=0; iGetNbinsX()) + dval += GetInterpolatedValue(fFourierHistos[i].dataFourierIm, fFourierHistos[0].dataFourierIm->GetBinCenter(j)); + } + fFourierAverage[0].dataFourierIm->SetBinContent(j, dval/fFourierHistos.size()); + } + // set marker color, line color, maker size, marker type + fFourierAverage[0].dataFourierIm->SetMarkerColor(kBlack); + fFourierAverage[0].dataFourierIm->SetLineColor(kBlack); + fFourierAverage[0].dataFourierIm->SetMarkerSize(0.8); + fFourierAverage[0].dataFourierIm->SetMarkerStyle(22); // closed up triangle + + // power average + for (Int_t j=0; jGetNbinsX(); j++) { + dval = 0.0; + for (UInt_t i=0; iGetNbinsX()) + dval += GetInterpolatedValue(fFourierHistos[i].dataFourierPwr, fFourierHistos[0].dataFourierPwr->GetBinCenter(j)); + } + fFourierAverage[0].dataFourierPwr->SetBinContent(j, dval/fFourierHistos.size()); + } + // set marker color, line color, maker size, marker type + fFourierAverage[0].dataFourierPwr->SetMarkerColor(kBlack); + fFourierAverage[0].dataFourierPwr->SetLineColor(kBlack); + fFourierAverage[0].dataFourierPwr->SetMarkerSize(0.8); + fFourierAverage[0].dataFourierPwr->SetMarkerStyle(22); // closed up triangle + + // phase average + for (Int_t j=0; jGetNbinsX(); j++) { + dval = 0.0; + for (UInt_t i=0; iGetNbinsX()) + dval += GetInterpolatedValue(fFourierHistos[i].dataFourierPhase, fFourierHistos[0].dataFourierPhase->GetBinCenter(j)); + } + fFourierAverage[0].dataFourierPhase->SetBinContent(j, dval/fFourierHistos.size()); + } + // set marker color, line color, maker size, marker type + fFourierAverage[0].dataFourierPhase->SetMarkerColor(kBlack); + fFourierAverage[0].dataFourierPhase->SetLineColor(kBlack); + fFourierAverage[0].dataFourierPhase->SetMarkerSize(0.8); + fFourierAverage[0].dataFourierPhase->SetMarkerStyle(22); + } + + // check if per data set shall be averaged + if (fAveragedViewPerDataSet) { + // check what size is required + UInt_t count = 1; + Int_t currentTag = fDataSetTag[0]; + for (UInt_t i=1; i 0) + start = j-1; + else + start = 0; + } + if (currentTag != fDataSetTag[j]) { + if (count == i) { + end = j-1; + break; + } + count++; + currentTag = fDataSetTag[j]; + } + } + if (end == -1) + end = fDataSetTag.size()-1; + + // create average histograms + name = TString(fFourierHistos[start].dataFourierRe->GetTitle()) + "_avg"; + fFourierAverage[i].dataFourierRe = new TH1F(name, name, fFourierHistos[0].dataFourierRe->GetNbinsX(), + fFourierHistos[0].dataFourierRe->GetXaxis()->GetXmin(), + fFourierHistos[0].dataFourierRe->GetXaxis()->GetXmax()); + + name = TString(fFourierHistos[start].dataFourierIm->GetTitle()) + "_avg"; + fFourierAverage[i].dataFourierIm = new TH1F(name, name, fFourierHistos[0].dataFourierIm->GetNbinsX(), + fFourierHistos[0].dataFourierIm->GetXaxis()->GetXmin(), + fFourierHistos[0].dataFourierIm->GetXaxis()->GetXmax()); + + name = TString(fFourierHistos[start].dataFourierPwr->GetTitle()) + "_avg"; + fFourierAverage[i].dataFourierPwr = new TH1F(name, name, fFourierHistos[0].dataFourierPwr->GetNbinsX(), + fFourierHistos[0].dataFourierPwr->GetXaxis()->GetXmin(), + fFourierHistos[0].dataFourierPwr->GetXaxis()->GetXmax()); + + name = TString(fFourierHistos[start].dataFourierPhase->GetTitle()) + "_avg"; + fFourierAverage[i].dataFourierPhase = new TH1F(name, name, fFourierHistos[0].dataFourierPhase->GetNbinsX(), + fFourierHistos[0].dataFourierPhase->GetXaxis()->GetXmin(), + fFourierHistos[0].dataFourierPhase->GetXaxis()->GetXmax()); + + // real average + for (Int_t j=0; jGetNbinsX(); j++) { + dval = 0.0; + for (Int_t k=start; kGetNbinsX()) + dval += GetInterpolatedValue(fFourierHistos[k].dataFourierRe, fFourierHistos[0].dataFourierRe->GetBinCenter(j)); + } + fFourierAverage[i].dataFourierRe->SetBinContent(j, dval/(end-start+1)); + } + // set marker color, line color, maker size, marker type + fFourierAverage[i].dataFourierRe->SetMarkerColor(fColorList[i]); + fFourierAverage[i].dataFourierRe->SetLineColor(fColorList[i]); + fFourierAverage[i].dataFourierRe->SetMarkerSize(0.8); + fFourierAverage[i].dataFourierRe->SetMarkerStyle(22); // closed up triangle + + // imaginary average + for (Int_t j=0; jGetNbinsX(); j++) { + dval = 0.0; + for (Int_t k=start; kGetNbinsX()) + dval += GetInterpolatedValue(fFourierHistos[k].dataFourierIm, fFourierHistos[0].dataFourierIm->GetBinCenter(j)); + } + fFourierAverage[i].dataFourierIm->SetBinContent(j, dval/(end-start+1)); + } + // set marker color, line color, maker size, marker type + fFourierAverage[i].dataFourierIm->SetMarkerColor(fColorList[i]); + fFourierAverage[i].dataFourierIm->SetLineColor(fColorList[i]); + fFourierAverage[i].dataFourierIm->SetMarkerSize(0.8); + fFourierAverage[i].dataFourierIm->SetMarkerStyle(22); // closed up triangle + + // power average + for (Int_t j=0; jGetNbinsX(); j++) { + dval = 0.0; + for (Int_t k=start; kGetNbinsX()) + dval += GetInterpolatedValue(fFourierHistos[k].dataFourierPwr, fFourierHistos[0].dataFourierPwr->GetBinCenter(j)); + } + fFourierAverage[i].dataFourierPwr->SetBinContent(j, dval/(end-start+1)); + } + // set marker color, line color, maker size, marker type + fFourierAverage[i].dataFourierPwr->SetMarkerColor(fColorList[i]); + fFourierAverage[i].dataFourierPwr->SetLineColor(fColorList[i]); + fFourierAverage[i].dataFourierPwr->SetMarkerSize(0.8); + fFourierAverage[i].dataFourierPwr->SetMarkerStyle(22); // closed up triangle + + // phase average + for (Int_t j=0; jGetNbinsX(); j++) { + dval = 0.0; + for (Int_t k=start; kGetNbinsX()) + dval += GetInterpolatedValue(fFourierHistos[k].dataFourierPhase, fFourierHistos[0].dataFourierPhase->GetBinCenter(j)); + } + fFourierAverage[i].dataFourierPhase->SetBinContent(j, dval/(end-start+1)); + } + // set marker color, line color, maker size, marker type + fFourierAverage[i].dataFourierPhase->SetMarkerColor(fColorList[i]); + fFourierAverage[i].dataFourierPhase->SetLineColor(fColorList[i]); + fFourierAverage[i].dataFourierPhase->SetMarkerSize(0.8); + fFourierAverage[i].dataFourierPhase->SetMarkerStyle(22); // closed up triangle } - fFourierAverage.dataFourierPhase->SetBinContent(j, dval/fFourierHistos.size()); } - // set marker color, line color, maker size, marker type - fFourierAverage.dataFourierPhase->SetMarkerColor(kBlack); - fFourierAverage.dataFourierPhase->SetLineColor(kBlack); - fFourierAverage.dataFourierPhase->SetMarkerSize(0.8); - fFourierAverage.dataFourierPhase->SetMarkerStyle(22); } //-------------------------------------------------------------------------- @@ -1087,104 +1273,114 @@ void PFourierCanvas::PlotFourier() Double_t ymin=0, ymax=0; switch (fCurrentPlotView) { - case FOURIER_PLOT_REAL: - fFourierHistos[0].dataFourierRe->GetXaxis()->SetRangeUser(xmin, xmax); - ymin = GetMinimum(fFourierHistos[0].dataFourierRe, xmin, xmax); - ymax = GetMaximum(fFourierHistos[0].dataFourierRe, xmin, xmax); - for (unsigned int i=1; i ymax) - ymax = GetMaximum(fFourierHistos[i].dataFourierRe, xmin, xmax); - if (GetMinimum(fFourierHistos[i].dataFourierRe, xmin, xmax) < ymin) - ymin = GetMinimum(fFourierHistos[i].dataFourierRe, xmin, xmax); - } - fFourierHistos[0].dataFourierRe->GetYaxis()->SetRangeUser(1.05*ymin, 1.05*ymax); - fFourierHistos[0].dataFourierRe->GetYaxis()->SetTitle("Real"); - fFourierHistos[0].dataFourierRe->GetXaxis()->SetTitle(fXaxisTitle.Data()); - fFourierHistos[0].dataFourierRe->Draw("p"); - for (unsigned int i=1; iDraw("psame"); - } - break; - case FOURIER_PLOT_IMAG: - fFourierHistos[0].dataFourierIm->GetXaxis()->SetRangeUser(xmin, xmax); - ymin = GetMinimum(fFourierHistos[0].dataFourierIm, xmin, xmax); - ymax = GetMaximum(fFourierHistos[0].dataFourierIm, xmin, xmax); - for (unsigned int i=1; i ymax) - ymax = GetMaximum(fFourierHistos[i].dataFourierIm, xmin, xmax); - if (GetMinimum(fFourierHistos[i].dataFourierIm, xmin, xmax) < ymin) - ymin = GetMinimum(fFourierHistos[i].dataFourierIm, xmin, xmax); - } - fFourierHistos[0].dataFourierIm->GetYaxis()->SetRangeUser(1.05*ymin, 1.05*ymax); - fFourierHistos[0].dataFourierIm->GetYaxis()->SetTitle("Imag"); - fFourierHistos[0].dataFourierIm->GetXaxis()->SetTitle(fXaxisTitle.Data()); - fFourierHistos[0].dataFourierIm->Draw("p"); - for (unsigned int i=1; iDraw("psame"); - } - break; - case FOURIER_PLOT_REAL_AND_IMAG: - fFourierHistos[0].dataFourierRe->GetXaxis()->SetRangeUser(xmin, xmax); - ymin = GetMinimum(fFourierHistos[0].dataFourierRe, xmin, xmax); - ymax = GetMaximum(fFourierHistos[0].dataFourierRe, xmin, xmax); - for (unsigned int i=1; i ymax) - ymax = GetMaximum(fFourierHistos[i].dataFourierRe, xmin, xmax); - if (GetMaximum(fFourierHistos[i].dataFourierIm, xmin, xmax) > ymax) - ymax = GetMaximum(fFourierHistos[i].dataFourierIm, xmin, xmax); - if (GetMinimum(fFourierHistos[i].dataFourierRe, xmin, xmax) < ymin) - ymin = GetMinimum(fFourierHistos[i].dataFourierRe, xmin, xmax); - if (GetMinimum(fFourierHistos[i].dataFourierIm, xmin, xmax) < ymin) - ymin = GetMinimum(fFourierHistos[i].dataFourierIm, xmin, xmax); - } - fFourierHistos[0].dataFourierRe->GetYaxis()->SetRangeUser(1.05*ymin, 1.05*ymax); - fFourierHistos[0].dataFourierRe->GetYaxis()->SetTitle("Real"); - fFourierHistos[0].dataFourierRe->GetXaxis()->SetTitle(fXaxisTitle.Data()); - fFourierHistos[0].dataFourierRe->Draw("p"); - for (unsigned int i=1; iDraw("psame"); - } - for (unsigned int i=0; iDraw("psame"); - } - break; - case FOURIER_PLOT_POWER: - // get maximum of Fourier data in the range - fFourierHistos[0].dataFourierPwr->GetXaxis()->SetRangeUser(xmin, xmax); - ymin = 0.0; - ymax = GetMaximum(fFourierHistos[0].dataFourierPwr, xmin, xmax); - for (unsigned int i=1; i ymax) - ymax = GetMaximum(fFourierHistos[i].dataFourierPwr, xmin, xmax); - } - fFourierHistos[0].dataFourierPwr->GetYaxis()->SetRangeUser(ymin, 1.03*ymax); - fFourierHistos[0].dataFourierPwr->GetYaxis()->SetTitle("Power"); - fFourierHistos[0].dataFourierPwr->GetXaxis()->SetTitle(fXaxisTitle.Data()); - fFourierHistos[0].dataFourierPwr->Draw("p"); - for (unsigned int i=1; iDraw("psame"); - } - break; - case FOURIER_PLOT_PHASE: - fFourierHistos[0].dataFourierPhase->GetXaxis()->SetRangeUser(xmin, xmax); - ymin = GetMinimum(fFourierHistos[0].dataFourierPhase, xmin, xmax); - ymax = GetMaximum(fFourierHistos[0].dataFourierPhase, xmin, xmax); - for (unsigned int i=1; i ymax) - ymax = GetMaximum(fFourierHistos[i].dataFourierPhase, xmin, xmax); - if (GetMinimum(fFourierHistos[i].dataFourierPhase, xmin, xmax) < ymin) - ymin = GetMinimum(fFourierHistos[i].dataFourierPhase, xmin, xmax); - } - fFourierHistos[0].dataFourierRe->GetYaxis()->SetRangeUser(1.05*ymin, 1.05*ymax); - fFourierHistos[0].dataFourierPhase->GetYaxis()->SetTitle("Phase"); - fFourierHistos[0].dataFourierPhase->GetXaxis()->SetTitle(fXaxisTitle.Data()); - fFourierHistos[0].dataFourierPhase->Draw("p"); - for (unsigned int i=1; iDraw("psame"); - } - break; - default: - break; + case FOURIER_PLOT_REAL: + fFourierHistos[0].dataFourierRe->GetXaxis()->SetRangeUser(xmin, xmax); + ymin = GetMinimum(fFourierHistos[0].dataFourierRe, xmin, xmax); + ymax = GetMaximum(fFourierHistos[0].dataFourierRe, xmin, xmax); + for (UInt_t i=1; i ymax) + ymax = GetMaximum(fFourierHistos[i].dataFourierRe, xmin, xmax); + if (GetMinimum(fFourierHistos[i].dataFourierRe, xmin, xmax) < ymin) + ymin = GetMinimum(fFourierHistos[i].dataFourierRe, xmin, xmax); + } + fFourierHistos[0].dataFourierRe->GetYaxis()->SetRangeUser(1.05*ymin, 1.05*ymax); + fFourierHistos[0].dataFourierRe->GetYaxis()->SetTitle("Real"); + fFourierHistos[0].dataFourierRe->GetYaxis()->SetTitleOffset(1.3); + fFourierHistos[0].dataFourierRe->GetYaxis()->SetDecimals(kTRUE); + fFourierHistos[0].dataFourierRe->GetXaxis()->SetTitle(fXaxisTitle.Data()); + fFourierHistos[0].dataFourierRe->Draw("p"); + for (UInt_t i=1; iDraw("psame"); + } + break; + case FOURIER_PLOT_IMAG: + fFourierHistos[0].dataFourierIm->GetXaxis()->SetRangeUser(xmin, xmax); + ymin = GetMinimum(fFourierHistos[0].dataFourierIm, xmin, xmax); + ymax = GetMaximum(fFourierHistos[0].dataFourierIm, xmin, xmax); + for (UInt_t i=1; i ymax) + ymax = GetMaximum(fFourierHistos[i].dataFourierIm, xmin, xmax); + if (GetMinimum(fFourierHistos[i].dataFourierIm, xmin, xmax) < ymin) + ymin = GetMinimum(fFourierHistos[i].dataFourierIm, xmin, xmax); + } + fFourierHistos[0].dataFourierIm->GetYaxis()->SetRangeUser(1.05*ymin, 1.05*ymax); + fFourierHistos[0].dataFourierIm->GetYaxis()->SetTitleOffset(1.3); + fFourierHistos[0].dataFourierIm->GetYaxis()->SetDecimals(kTRUE); + fFourierHistos[0].dataFourierIm->GetYaxis()->SetTitle("Imag"); + fFourierHistos[0].dataFourierIm->GetXaxis()->SetTitle(fXaxisTitle.Data()); + fFourierHistos[0].dataFourierIm->Draw("p"); + for (UInt_t i=1; iDraw("psame"); + } + break; + case FOURIER_PLOT_REAL_AND_IMAG: + fFourierHistos[0].dataFourierRe->GetXaxis()->SetRangeUser(xmin, xmax); + ymin = GetMinimum(fFourierHistos[0].dataFourierRe, xmin, xmax); + ymax = GetMaximum(fFourierHistos[0].dataFourierRe, xmin, xmax); + for (UInt_t i=1; i ymax) + ymax = GetMaximum(fFourierHistos[i].dataFourierRe, xmin, xmax); + if (GetMaximum(fFourierHistos[i].dataFourierIm, xmin, xmax) > ymax) + ymax = GetMaximum(fFourierHistos[i].dataFourierIm, xmin, xmax); + if (GetMinimum(fFourierHistos[i].dataFourierRe, xmin, xmax) < ymin) + ymin = GetMinimum(fFourierHistos[i].dataFourierRe, xmin, xmax); + if (GetMinimum(fFourierHistos[i].dataFourierIm, xmin, xmax) < ymin) + ymin = GetMinimum(fFourierHistos[i].dataFourierIm, xmin, xmax); + } + fFourierHistos[0].dataFourierRe->GetYaxis()->SetRangeUser(1.05*ymin, 1.05*ymax); + fFourierHistos[0].dataFourierRe->GetYaxis()->SetTitleOffset(1.3); + fFourierHistos[0].dataFourierRe->GetYaxis()->SetDecimals(kTRUE); + fFourierHistos[0].dataFourierRe->GetYaxis()->SetTitle("Real"); + fFourierHistos[0].dataFourierRe->GetXaxis()->SetTitle(fXaxisTitle.Data()); + fFourierHistos[0].dataFourierRe->Draw("p"); + for (UInt_t i=1; iDraw("psame"); + } + for (UInt_t i=0; iDraw("psame"); + } + break; + case FOURIER_PLOT_POWER: + // get maximum of Fourier data in the range + fFourierHistos[0].dataFourierPwr->GetXaxis()->SetRangeUser(xmin, xmax); + ymin = 0.0; + ymax = GetMaximum(fFourierHistos[0].dataFourierPwr, xmin, xmax); + for (UInt_t i=1; i ymax) + ymax = GetMaximum(fFourierHistos[i].dataFourierPwr, xmin, xmax); + } + fFourierHistos[0].dataFourierPwr->GetYaxis()->SetRangeUser(ymin, 1.03*ymax); + fFourierHistos[0].dataFourierPwr->GetYaxis()->SetTitle("Power"); + fFourierHistos[0].dataFourierPwr->GetYaxis()->SetTitleOffset(1.3); + fFourierHistos[0].dataFourierPwr->GetYaxis()->SetDecimals(kTRUE); + fFourierHistos[0].dataFourierPwr->GetXaxis()->SetTitle(fXaxisTitle.Data()); + fFourierHistos[0].dataFourierPwr->Draw("p"); + for (UInt_t i=1; iDraw("psame"); + } + break; + case FOURIER_PLOT_PHASE: + fFourierHistos[0].dataFourierPhase->GetXaxis()->SetRangeUser(xmin, xmax); + ymin = GetMinimum(fFourierHistos[0].dataFourierPhase, xmin, xmax); + ymax = GetMaximum(fFourierHistos[0].dataFourierPhase, xmin, xmax); + for (UInt_t i=1; i ymax) + ymax = GetMaximum(fFourierHistos[i].dataFourierPhase, xmin, xmax); + if (GetMinimum(fFourierHistos[i].dataFourierPhase, xmin, xmax) < ymin) + ymin = GetMinimum(fFourierHistos[i].dataFourierPhase, xmin, xmax); + } + fFourierHistos[0].dataFourierPhase->GetYaxis()->SetRangeUser(1.05*ymin, 1.05*ymax); + fFourierHistos[0].dataFourierPhase->GetYaxis()->SetTitleOffset(1.3); + fFourierHistos[0].dataFourierPhase->GetYaxis()->SetDecimals(kTRUE); + fFourierHistos[0].dataFourierPhase->GetYaxis()->SetTitle("Phase"); + fFourierHistos[0].dataFourierPhase->GetXaxis()->SetTitle(fXaxisTitle.Data()); + fFourierHistos[0].dataFourierPhase->Draw("p"); + for (UInt_t i=1; iDraw("psame"); + } + break; + default: + break; } fFourierPad->Update(); @@ -1207,7 +1403,7 @@ void PFourierCanvas::PlotFourierPhaseValue() fCurrentFourierPhaseText = 0; } - double x, y; + Double_t x, y; TString str; // plot Fourier phase @@ -1238,49 +1434,147 @@ void PFourierCanvas::PlotAverage() { fFourierPad->cd(); - if (fFourierAverage.dataFourierRe == 0) { // ups, HandlerAverage never called! + if (fFourierAverage.size() == 0) { // ups, HandleAverage never called! HandleAverage(); } - Double_t xmin=0, xmax=0; + Double_t xmin=0.0, xmax=0.0; xmin = fInitialXRange[0]; xmax = fInitialXRange[1]; + Double_t ymin=0.0, ymax=0.0; + + if (fLegAvgPerDataSet) { + fLegAvgPerDataSet->Clear(); + delete fLegAvgPerDataSet; + fLegAvgPerDataSet = 0; + } switch (fCurrentPlotView) { - case FOURIER_PLOT_REAL: - fFourierAverage.dataFourierRe->GetYaxis()->SetTitle(""); - fFourierAverage.dataFourierRe->GetXaxis()->SetTitle(fXaxisTitle.Data()); - fFourierAverage.dataFourierRe->GetXaxis()->SetRangeUser(xmin, xmax); - fFourierAverage.dataFourierRe->Draw("p"); - break; - case FOURIER_PLOT_IMAG: - fFourierAverage.dataFourierIm->GetYaxis()->SetTitle(""); - fFourierAverage.dataFourierIm->GetXaxis()->SetTitle(fXaxisTitle.Data()); - fFourierAverage.dataFourierIm->GetXaxis()->SetRangeUser(xmin, xmax); - fFourierAverage.dataFourierIm->Draw("p"); - break; - case FOURIER_PLOT_REAL_AND_IMAG: - fFourierAverage.dataFourierRe->GetYaxis()->SetTitle(""); - fFourierAverage.dataFourierRe->GetXaxis()->SetTitle(fXaxisTitle.Data()); - fFourierAverage.dataFourierRe->GetXaxis()->SetRangeUser(xmin, xmax); - fFourierAverage.dataFourierRe->Draw("p"); - fFourierAverage.dataFourierIm->Draw("psame"); + case FOURIER_PLOT_REAL: + fFourierAverage[0].dataFourierRe->GetXaxis()->SetRangeUser(xmin, xmax); + ymin = GetMinimum(fFourierAverage[0].dataFourierRe, xmin, xmax); + ymax = GetMaximum(fFourierAverage[0].dataFourierRe, xmin, xmax); + for (UInt_t i=1; i ymax) + ymax = GetMaximum(fFourierAverage[i].dataFourierRe, xmin, xmax); + if (GetMinimum(fFourierAverage[i].dataFourierRe, xmin, xmax) < ymin) + ymin = GetMinimum(fFourierAverage[i].dataFourierRe, xmin, xmax); + } + fFourierAverage[0].dataFourierRe->GetYaxis()->SetRangeUser(1.03*ymin, 1.03*ymax); + fFourierAverage[0].dataFourierRe->GetYaxis()->SetTitleOffset(1.3); + fFourierAverage[0].dataFourierRe->GetYaxis()->SetDecimals(kTRUE); + fFourierAverage[0].dataFourierRe->GetYaxis()->SetTitle(""); + fFourierAverage[0].dataFourierRe->GetXaxis()->SetTitle(fXaxisTitle.Data()); + fFourierAverage[0].dataFourierRe->GetXaxis()->SetRangeUser(xmin, xmax); + fFourierAverage[0].dataFourierRe->Draw("p"); break; - case FOURIER_PLOT_POWER: - // get maximum of Fourier data in the range - fFourierAverage.dataFourierPwr->GetXaxis()->SetRangeUser(xmin, xmax); - fFourierAverage.dataFourierPwr->GetYaxis()->SetTitle(""); - fFourierAverage.dataFourierPwr->GetXaxis()->SetTitle(fXaxisTitle.Data()); - fFourierAverage.dataFourierPwr->Draw("p"); - break; - case FOURIER_PLOT_PHASE: - fFourierAverage.dataFourierPhase->GetYaxis()->SetTitle(""); - fFourierAverage.dataFourierPhase->GetXaxis()->SetTitle(fXaxisTitle.Data()); - fFourierAverage.dataFourierPhase->GetXaxis()->SetRangeUser(xmin, xmax); - fFourierAverage.dataFourierPhase->Draw("p"); - break; - default: - break; + case FOURIER_PLOT_IMAG: + fFourierAverage[0].dataFourierIm->GetXaxis()->SetRangeUser(xmin, xmax); + ymin = GetMinimum(fFourierAverage[0].dataFourierIm, xmin, xmax); + ymax = GetMaximum(fFourierAverage[0].dataFourierIm, xmin, xmax); + for (UInt_t i=1; i ymax) + ymax = GetMaximum(fFourierAverage[i].dataFourierIm, xmin, xmax); + if (GetMinimum(fFourierAverage[i].dataFourierIm, xmin, xmax) < ymin) + ymin = GetMinimum(fFourierAverage[i].dataFourierIm, xmin, xmax); + } + fFourierAverage[0].dataFourierIm->GetYaxis()->SetRangeUser(1.03*ymin, 1.03*ymax); + fFourierAverage[0].dataFourierIm->GetYaxis()->SetTitleOffset(1.3); + fFourierAverage[0].dataFourierIm->GetYaxis()->SetDecimals(kTRUE); + fFourierAverage[0].dataFourierIm->GetYaxis()->SetTitle(""); + fFourierAverage[0].dataFourierIm->GetXaxis()->SetTitle(fXaxisTitle.Data()); + fFourierAverage[0].dataFourierIm->GetXaxis()->SetRangeUser(xmin, xmax); + fFourierAverage[0].dataFourierIm->Draw("p"); + break; + case FOURIER_PLOT_REAL_AND_IMAG: + fFourierAverage[0].dataFourierRe->GetXaxis()->SetRangeUser(xmin, xmax); + ymin = GetMinimum(fFourierAverage[0].dataFourierRe, xmin, xmax); + ymax = GetMaximum(fFourierAverage[0].dataFourierRe, xmin, xmax); + for (UInt_t i=1; i ymax) + ymax = GetMaximum(fFourierAverage[i].dataFourierRe, xmin, xmax); + if (GetMinimum(fFourierAverage[i].dataFourierRe, xmin, xmax) < ymin) + ymin = GetMinimum(fFourierAverage[i].dataFourierRe, xmin, xmax); + } + fFourierAverage[0].dataFourierRe->GetYaxis()->SetRangeUser(1.03*ymin, 1.03*ymax); + fFourierAverage[0].dataFourierRe->GetYaxis()->SetTitleOffset(1.3); + fFourierAverage[0].dataFourierRe->GetYaxis()->SetDecimals(kTRUE); + fFourierAverage[0].dataFourierRe->GetYaxis()->SetTitle(""); + fFourierAverage[0].dataFourierRe->GetXaxis()->SetTitle(fXaxisTitle.Data()); + fFourierAverage[0].dataFourierRe->GetXaxis()->SetRangeUser(xmin, xmax); + fFourierAverage[0].dataFourierRe->Draw("p"); + fFourierAverage[0].dataFourierIm->Draw("psame"); + break; + case FOURIER_PLOT_POWER: + // get maximum of Fourier data in the range + fFourierAverage[0].dataFourierPwr->GetXaxis()->SetRangeUser(xmin, xmax); + ymin = 0.0; + ymax = GetMaximum(fFourierAverage[0].dataFourierPwr, xmin, xmax); + for (UInt_t i=1; i ymax) + ymax = GetMaximum(fFourierAverage[i].dataFourierPwr, xmin, xmax); + } + fFourierAverage[0].dataFourierPwr->GetYaxis()->SetRangeUser(ymin, 1.03*ymax); + fFourierAverage[0].dataFourierPwr->GetYaxis()->SetTitleOffset(1.3); + fFourierAverage[0].dataFourierPwr->GetYaxis()->SetDecimals(kTRUE); + fFourierAverage[0].dataFourierPwr->GetYaxis()->SetTitle(""); + fFourierAverage[0].dataFourierPwr->GetXaxis()->SetTitle(fXaxisTitle.Data()); + fFourierAverage[0].dataFourierPwr->Draw("p"); + break; + case FOURIER_PLOT_PHASE: + fFourierAverage[0].dataFourierPhase->GetXaxis()->SetRangeUser(xmin, xmax); + ymin = GetMinimum(fFourierAverage[0].dataFourierPhase, xmin, xmax); + ymax = GetMaximum(fFourierAverage[0].dataFourierPhase, xmin, xmax); + for (UInt_t i=1; i ymax) + ymax = GetMaximum(fFourierAverage[i].dataFourierPhase, xmin, xmax); + if (GetMinimum(fFourierAverage[i].dataFourierPhase, xmin, xmax) < ymin) + ymin = GetMinimum(fFourierAverage[i].dataFourierPhase, xmin, xmax); + } + fFourierAverage[0].dataFourierPhase->GetYaxis()->SetRangeUser(1.03*ymin, 1.03*ymax); + fFourierAverage[0].dataFourierPhase->GetYaxis()->SetTitleOffset(1.3); + fFourierAverage[0].dataFourierPhase->GetYaxis()->SetDecimals(kTRUE); + fFourierAverage[0].dataFourierPhase->GetYaxis()->SetTitle(""); + fFourierAverage[0].dataFourierPhase->GetXaxis()->SetTitle(fXaxisTitle.Data()); + fFourierAverage[0].dataFourierPhase->GetXaxis()->SetRangeUser(xmin, xmax); + fFourierAverage[0].dataFourierPhase->Draw("p"); + break; + default: + break; + } + + if (fAveragedViewPerDataSet) { // plot all the rest + fLegAvgPerDataSet = new TLegend(0.55, 0.4, 0.85, 0.6); + TString str = GetDataSetName(fFourierAverage[0].dataFourierPwr->GetTitle()); + TString label = TString::Format("<%s>", str.Data()); + fLegAvgPerDataSet->AddEntry(fFourierAverage[0].dataFourierPwr, label.Data()); + for (UInt_t i=1; iDraw("psame"); + break; + case FOURIER_PLOT_IMAG: + fFourierAverage[i].dataFourierIm->Draw("psame"); + break; + case FOURIER_PLOT_REAL_AND_IMAG: + fFourierAverage[i].dataFourierRe->Draw("psame"); + fFourierAverage[i].dataFourierIm->Draw("psame"); + break; + case FOURIER_PLOT_POWER: + fFourierAverage[i].dataFourierPwr->Draw("psame"); + break; + case FOURIER_PLOT_PHASE: + fFourierAverage[i].dataFourierPhase->Draw("psame"); + break; + default: + break; + } + // add legend ?!?! + str = GetDataSetName(fFourierAverage[i].dataFourierPwr->GetTitle()); + label = TString::Format("<%s>", str.Data()); + fLegAvgPerDataSet->AddEntry(fFourierAverage[i].dataFourierPwr, label.Data()); + } + fLegAvgPerDataSet->Draw(); } fFourierPad->Update(); @@ -1300,10 +1594,10 @@ void PFourierCanvas::IncrementFourierPhase() if ((fCurrentPlotView == FOURIER_PLOT_POWER) || (fCurrentPlotView == FOURIER_PLOT_PHASE)) return; - double re, im; - double inc = 1.0; - const double cp = TMath::Cos(inc/180.0*TMath::Pi()); - const double sp = TMath::Sin(inc/180.0*TMath::Pi()); + Double_t re, im; + Double_t inc = 1.0; + const Double_t cp = TMath::Cos(inc/180.0*TMath::Pi()); + const Double_t sp = TMath::Sin(inc/180.0*TMath::Pi()); fCurrentFourierPhase += inc; PlotFourierPhaseValue(); @@ -1333,10 +1627,10 @@ void PFourierCanvas::DecrementFourierPhase() if ((fCurrentPlotView == FOURIER_PLOT_POWER) || (fCurrentPlotView == FOURIER_PLOT_PHASE)) return; - double re, im; - double inc = 1.0; - const double cp = TMath::Cos(inc/180.0*TMath::Pi()); - const double sp = TMath::Sin(inc/180.0*TMath::Pi()); + Double_t re, im; + Double_t inc = 1.0; + const Double_t cp = TMath::Cos(inc/180.0*TMath::Pi()); + const Double_t sp = TMath::Sin(inc/180.0*TMath::Pi()); fCurrentFourierPhase -= inc; PlotFourierPhaseValue(); @@ -1478,3 +1772,26 @@ Double_t PFourierCanvas::GetInterpolatedValue(TH1F* histo, Double_t xVal) return (y1-y0)*(xVal-x0)/(x1-x0)+y0; } + +//-------------------------------------------------------------------------- +// GetDataSetName (private) +//-------------------------------------------------------------------------- +/** + *

      filters out the data set name from the title + * + * return: + * - data set name + * + * \param title title of the Fourier histogram + */ +TString PFourierCanvas::GetDataSetName(TString title) +{ + TString str(title); + + Ssiz_t idx = str.First(':'); + str.Remove(0, idx+1); + idx = str.First(','); + str.Remove(idx); + + return str; +} diff --git a/src/classes/PPrepFourier.cpp b/src/classes/PPrepFourier.cpp index 4af9c662..1b542c5b 100644 --- a/src/classes/PPrepFourier.cpp +++ b/src/classes/PPrepFourier.cpp @@ -79,7 +79,7 @@ PPrepFourier::~PPrepFourier() */ void PPrepFourier::SetBkgRange(const Int_t *bkgRange) { - int err=0; + Int_t err=0; if (bkgRange[0] >= -1) { fBkgRange[0] = bkgRange[0]; } else { @@ -125,7 +125,7 @@ void PPrepFourier::SetBkgRange(const Int_t *bkgRange) */ 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!"; return; @@ -188,16 +188,16 @@ void PPrepFourier::DoBkgCorrection() } Double_t bkg=0.0; - for (unsigned int i=0; i background " << i << ": " << bkg << endl; + cout << "info> background " << i << ": " << bkg << endl; // correct data - for (unsigned int j=0; jReturns the data set tag of the object + * + * \param idx index of the object + */ +Int_t PPrepFourier::GetDataSetTag(const UInt_t idx) +{ + Int_t result = -1; + + if (idx < fRawData.size()) + result = fRawData[idx].dataSetTag; + + return result; +} + //-------------------------------------------------------------------------- // GetData //-------------------------------------------------------------------------- @@ -337,7 +355,7 @@ vector PPrepFourier::GetData() UInt_t startIdx; UInt_t endIdx; - for (unsigned int i=0; i PPrepFourier::GetData() } data[i] = new TH1F(name.Data(), fRawData[i].info.Data(), size, start, end); - for (unsigned int j=startIdx; jSetBinContent(j-startIdx+1, fData[i][j]); } @@ -430,7 +448,7 @@ TH1F *PPrepFourier::GetData(const UInt_t idx) } TH1F *data = new TH1F(name.Data(), fRawData[idx].info.Data(), size, start, end); - for (unsigned int i=startIdx; iSetBinContent(i-startIdx+1, fData[idx][i]); return data; @@ -445,13 +463,13 @@ TH1F *PPrepFourier::GetData(const UInt_t idx) void PPrepFourier::InitData() { fData.resize(fRawData.size()); - unsigned int t0; - for (unsigned int i=0; i= 0) t0 = fRawData[i].t0; else t0 = 0; - for (unsigned int j=t0; j &fourier, const Char_t* title, const Bool_t showAverage, + PFourierCanvas(vector &fourier, PIntVector dataSetTag, const Char_t* title, + const Bool_t showAverage, const Bool_t showAveragePerDataSet, const Int_t fourierPlotOpt, Double_t fourierXrange[2], Double_t phase, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const Bool_t batch); - PFourierCanvas(vector &fourier, const Char_t* title, const Bool_t showAverage, + PFourierCanvas(vector &fourier, PIntVector dataSetTag, const Char_t* title, + const Bool_t showAverage, const Bool_t showAveragePerDataSet, const Int_t fourierPlotOpt, Double_t fourierXrange[2], Double_t phase, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const PIntVector markerList, const PIntVector colorList, const Bool_t batch); @@ -103,7 +106,9 @@ class PFourierCanvas : public TObject, public TQObject Int_t fTimeout; ///< timeout after which the Done signal should be emited. If timeout <= 0, no timeout is taking place Bool_t fBatchMode; ///< musrview in ROOT batch mode Bool_t fValid; ///< if true, everything looks OK - Bool_t fAveragedView; ///< tag showing that the averaged view or normal view should be presented. + Bool_t fAveragedView; ///< tag showing that the averaged view for ALL data or normal view should be presented. + Bool_t fAveragedViewPerDataSet; ///< tag showing that the averaged view for individual data sets or normal view should be presented. + PIntVector fDataSetTag; ///< vector holding the data set tags Int_t fCurrentPlotView; ///< tag showing what the current plot view is: real, imag, power, phase, ... Double_t fInitialXRange[2]; ///< keeps the initial x-range Double_t fInitialYRange[2]; ///< keeps the initial y-range @@ -112,7 +117,7 @@ class PFourierCanvas : public TObject, public TQObject TString fXaxisTitle; vector fFourier; ///< keeps all the Fourier data, ownership is with the caller PFourierCanvasDataList fFourierHistos; ///< keeps all the Fourier histos - PFourierCanvasDataSet fFourierAverage; ///< keeps the average of the Fourier histos + PFourierCanvasDataList fFourierAverage; ///< keeps the average of the Fourier histos Double_t fCurrentFourierPhase; ///< keeps the current Fourier phase (real/imag) TLatex *fCurrentFourierPhaseText; ///< used in Re/Im Fourier to show the current phase in the pad @@ -134,6 +139,7 @@ class PFourierCanvas : public TObject, public TQObject TPaveText *fTitlePad; ///< title pad used to display a title TPad *fFourierPad; ///< fourier pad used to display the fourier TLegend *fInfoPad; ///< info pad used to display a legend of the data plotted + TLegend *fLegAvgPerDataSet; ///< legend used for averaged per data set view virtual void CreateXaxisTitle(); virtual void CreateStyle(); @@ -151,6 +157,7 @@ class PFourierCanvas : public TObject, public TQObject virtual Double_t GetMaximum(TH1F* histo, Double_t xmin=-1.0, Double_t xmax=-1.0); virtual Double_t GetMinimum(TH1F* histo, Double_t xmin=-1.0, Double_t xmax=-1.0); virtual Double_t GetInterpolatedValue(TH1F* histo, Double_t xVal); + virtual TString GetDataSetName(TString title); ClassDef(PFourierCanvas, 1) }; diff --git a/src/include/PPrepFourier.h b/src/include/PPrepFourier.h index de945f4b..12f2b5f4 100644 --- a/src/include/PPrepFourier.h +++ b/src/include/PPrepFourier.h @@ -45,11 +45,12 @@ using namespace std; * necessary meta information. */ typedef struct { - TString info; ///< keeps all the meta information - double timeResolution; ///< time resolution in (usec) - int t0; ///< keep the t0 bin - Double_t timeRange[2]; ///< time range to be used, given in (usec). - PDoubleVector rawData; ///< a single time domain data vector + Int_t dataSetTag; ///< tag to label the data set. Needed for average-per-data-set + TString info; ///< keeps all the meta information + Double_t timeResolution; ///< time resolution in (usec) + Int_t t0; ///< keep the t0 bin + Double_t timeRange[2]; ///< time range to be used, given in (usec). + PDoubleVector rawData; ///< a single time domain data vector } musrFT_data; //---------------------------------------------------------------------------- @@ -72,6 +73,7 @@ class PPrepFourier { virtual void DoLifeTimeCorrection(Double_t fudge); TString GetInfo(const UInt_t idx); + Int_t GetDataSetTag(const UInt_t idx); UInt_t GetNoOfData() { return fRawData.size(); } vector GetData(); TH1F *GetData(const UInt_t idx); diff --git a/src/musrFT.cpp b/src/musrFT.cpp index c0f0b230..ee72846b 100644 --- a/src/musrFT.cpp +++ b/src/musrFT.cpp @@ -59,27 +59,28 @@ using namespace std; *

      Structure keeping the command line options. */ typedef struct { - vector msrFln; ///< msr-file names to be used. - vector dataFln; ///< raw-data-file names to be used. - vector dataFileFormat; ///< file format guess + PStringVector msrFln; ///< msr-file names to be used. + PStringVector dataFln; ///< raw-data-file names to be used. + PStringVector dataFileFormat; ///< file format guess 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_range[2]; ///< background range - vector bkg; ///< background value + Int_t bkg_range[2]; ///< background range + PDoubleVector 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 + Int_t fourierPower; ///< Fourier power for zero padding, i.e. 2^fourierPower points TString fourierUnits; ///< wished Fourier units: Gauss, Tesla, MHz, Mc/s - double initialPhase; ///< inital Fourier phase for Real/Imag - double fourierRange[2]; ///< Fourier range to be plotted. Given in the choosen units. - double timeRange[2]; ///< time range used for the Fourier - vector histo; ///< selection of the histos used from at data file for Fourier - bool showAverage; ///< flag indicating if initially the Fourier average over the given histos shall be plotted. - vector t0; ///< t0 vector for the histos. If not given t0's will be estimated. - int packing; ///< packing for rebinning the time histograms before Fourier transform. + Double_t initialPhase; ///< inital Fourier phase for Real/Imag + Double_t fourierRange[2]; ///< Fourier range to be plotted. Given in the choosen units. + Double_t timeRange[2]; ///< time range used for the Fourier + PIntVector histo; ///< selection of the histos used from at data file for Fourier + Bool_t showAverage; ///< flag indicating if initially the Fourier average over the given histos shall be plotted, this over ALL data sets. + Bool_t showAveragePerDataSet; ///< flag indicating if initially the Fourier average over the given histos shall be plotted, this per data set. + PIntVector t0; ///< t0 vector for the histos. If not given t0's will be estimated. + Int_t packing; ///< packing for rebinning the time histograms before Fourier transform. TString title; ///< title to be shown for the Fourier plot. - double lifetimecorrection; ///< is == 0.0 for NO life time correction, otherwise it holds the fudge factor + Double_t lifetimecorrection; ///< is == 0.0 for NO life time correction, otherwise it holds the fudge factor Int_t timeout; ///< timeout in (sec) after which musrFT will terminate. if <= 0, no automatic termination will take place. } musrFT_startup_param; @@ -134,7 +135,8 @@ void musrFT_syntax() cout << endl << " the option --data-file. If multiple data file are given, will apply"; cout << endl << " to all data-files given. If --histo is not given, all histos of a data file will be used."; cout << endl << " can be anything like: 2 3 6, or 2-17, or 1-6 9, etc."; - cout << endl << " -a, --average : show the average of all Fourier transformed data."; + cout << endl << " -a, --average : show the average of ALL Fourier transformed data."; + cout << endl << " -ad, --average-per-data-set : show the average of the Fourier transformed data per data set."; cout << endl << " --t0 : A list of t0's can be provided. This in conjunction with --data-file and"; cout << endl << " --fourier-option real allows to get the proper initial phase if t0's are known."; cout << endl << " If a single t0 for multiple histos is given, it is assume, that this t0 is common"; @@ -174,6 +176,7 @@ void musrFT_init(musrFT_startup_param &startupParam) startupParam.timeRange[0] = -1.0; startupParam.timeRange[1] = -1.0; startupParam.showAverage = false; + startupParam.showAveragePerDataSet = false; startupParam.packing = 1; startupParam.title = TString(""); startupParam.lifetimecorrection = 0.0; @@ -196,9 +199,9 @@ void musrFT_init(musrFT_startup_param &startupParam) * \param argv list of command line tokens * \param startupParam startup parameter structure */ -bool musrFT_filter_histo(int &i, int argc, char *argv[], musrFT_startup_param &startupParam) +Bool_t musrFT_filter_histo(Int_t &i, Int_t argc, Char_t *argv[], musrFT_startup_param &startupParam) { - int start = i+1, end = 0; + Int_t start = i+1, end = 0; // find last element of histo option while (++i < argc) { @@ -217,7 +220,7 @@ bool musrFT_filter_histo(int &i, int argc, char *argv[], musrFT_startup_param &s // handle histo arguments TString tstr(""); - for (int j=start; j(tok->At(0)); sstr = ostr->GetString(); if (sstr.IsDigit()) { @@ -264,7 +267,7 @@ bool musrFT_filter_histo(int &i, int argc, char *argv[], musrFT_startup_param &s return false; } - for (int k=first; k<=last; k++) { + for (Int_t k=first; k<=last; k++) { startupParam.histo.push_back(k); } @@ -287,11 +290,11 @@ bool musrFT_filter_histo(int &i, int argc, char *argv[], musrFT_startup_param &s * \param argv command line argument array * \param startupParam command line data structure */ -int musrFT_parse_options(int argc, char *argv[], musrFT_startup_param &startupParam) +Int_t musrFT_parse_options(Int_t argc, Char_t *argv[], musrFT_startup_param &startupParam) { TString tstr(""); - for (int i=1; i 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]; + Double_t 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; - double swap = startupParam.fourierRange[0]; + Double_t swap = startupParam.fourierRange[0]; startupParam.fourierRange[0] = startupParam.fourierRange[1]; startupParam.fourierRange[1] = swap; } + if (startupParam.showAverage && startupParam.showAveragePerDataSet) { + cerr << endl << ">> musrFT **WARNING** Options: --average and --average-per-data-set exclude each other, will choose the latter." << endl; + startupParam.showAverage = false; + } return 0; } @@ -595,7 +604,7 @@ int musrFT_parse_options(int argc, char *argv[], musrFT_startup_param &startupPa */ void musrFT_getMetaInfo(const TString fln, PRawRunData *rawRunData, TString &metaInfo) { - double dval; + Double_t dval; TString str = fln; // file name // trunc it in case a path-name is given @@ -644,12 +653,12 @@ void musrFT_estimateT0(musrFT_data &rd) cout << endl << " '" << rd.info << "'"; cout << endl << " NO warranty this is sensible!" << endl; - unsigned int idx = 0; - double max = rd.rawData[0]; - for (unsigned int i=1; i max) { max = rd.rawData[i]; - idx = (int)i; + idx = (Int_t)i; } } cout << endl << ">> musrFT_estimateT0: estimated t0=" << idx << endl; @@ -679,7 +688,7 @@ void musrFT_cleanup(TH1F *h) * \param start starting point from where the data shall be written to file. * \param end ending point up to where the data shall be written to file. */ -int musrFT_dumpData(TString fln, vector &fourierData, double start, double end) +Int_t musrFT_dumpData(TString fln, vector &fourierData, Double_t start, Double_t end) { vector data; PDoubleVector freq; @@ -697,19 +706,19 @@ int musrFT_dumpData(TString fln, vector &fourierData, double start, d end = hRe->GetBinCenter(hRe->GetNbinsX()); } - unsigned int minSize = hRe->GetNbinsX()-1; + UInt_t minSize = hRe->GetNbinsX()-1; musrFT_cleanup(hRe); - for (unsigned int i=1; iGetRealFourier(); if (hRe->GetNbinsX()-1 < minSize) minSize = hRe->GetNbinsX()-1; musrFT_cleanup(hRe); } - for (unsigned int i=0; iGetRealFourier(); hIm = fourierData[i]->GetImaginaryFourier(); - for (int j=1; jGetBinCenter(j); if ((dval >= start) && (dval <= end)) { freq.push_back(dval); @@ -735,13 +744,13 @@ int musrFT_dumpData(TString fln, vector &fourierData, double start, d // write header fout << "% "; - for (unsigned int i=0; i &fourierData, double start, d * \param run reference to the relevant RUN block of the msr-file * \param rd data collection which will hold the grouped histograms. */ -int musrFT_groupHistos(PRunDataHandler *runDataHandler, PMsrGlobalBlock *global, PMsrRunBlock &run, musrFT_data &rd) +Int_t musrFT_groupHistos(PRunDataHandler *runDataHandler, PMsrGlobalBlock *global, PMsrRunBlock &run, musrFT_data &rd) { // get proper raw run data set TString runName = *(run.GetRunName()); @@ -773,7 +782,7 @@ int musrFT_groupHistos(PRunDataHandler *runDataHandler, PMsrGlobalBlock *global, // keep histo list PIntVector histoList; - for (unsigned int i=0; iGetT0BinSize(); i++) { + for (UInt_t i=0; iGetT0BinSize(); i++) { if (i >= t0.size()) { // something is VERY strange cerr << endl << ">> musrFT_groupHistos **WARNING** found #t0's in GLOBAL block > #histos!"; cerr << endl << ">> This should NEVER happen. Will ignore these entries."; @@ -794,7 +803,7 @@ int musrFT_groupHistos(PRunDataHandler *runDataHandler, PMsrGlobalBlock *global, } } // 2nd: check in the run block - for (unsigned int i=0; i= t0.size()) { // something is VERY strange cerr << endl << ">> musrFT_groupHistos **WARNING** found #t0's in RUN block > #histos!"; cerr << endl << ">> This should NEVER happen. Will ignore these entries."; @@ -804,15 +813,15 @@ int musrFT_groupHistos(PRunDataHandler *runDataHandler, PMsrGlobalBlock *global, } } // if still some t0's are == -1, estimate t0 - unsigned int idx; - double max; - for (unsigned int i=0; i> musrFT_groupHistos **WARNING** try to estimate t0 from maximum in the data set"; cout << endl << ">> '" << runName << "', histo " << histoList[i] << ". NO warranty this is sensible!"; idx = 0; max = rawRunData->GetDataBin(histoList[i])->at(0); - for (unsigned int j=1; jGetDataBin(histoList[i])->size(); j++) { + for (UInt_t j=1; jGetDataBin(histoList[i])->size(); j++) { if (rawRunData->GetDataBin(histoList[i])->at(j) > max) { max = rawRunData->GetDataBin(histoList[i])->at(j); idx = j; @@ -825,8 +834,8 @@ int musrFT_groupHistos(PRunDataHandler *runDataHandler, PMsrGlobalBlock *global, // group histos PDoubleVector data = *(rawRunData->GetDataBin(histoList[0])); - for (unsigned int i=1; i= 0) && (j+t0[i]-t0[0] < rawRunData->GetDataBin(histoList[i])->size())) { data[j] += rawRunData->GetDataBin(histoList[i])->at(j); } @@ -835,7 +844,7 @@ int musrFT_groupHistos(PRunDataHandler *runDataHandler, PMsrGlobalBlock *global, rd.rawData.clear(); rd.rawData = data; - rd.t0 = (int)t0[0]; + rd.t0 = (Int_t)t0[0]; return 0; } @@ -881,14 +890,14 @@ void musrFT_dumpMsrFile(musrFT_startup_param ¶m) // write RUN block // get extension of the data file TString fileFormat("MUSR-ROOT"); - for (unsigned int i=0; i 1) && (j < param.t0.size())) { @@ -908,7 +917,7 @@ void musrFT_dumpMsrFile(musrFT_startup_param ¶m) fout << "runs 1" << endl; } else { fout << "runs "; - for (unsigned int i=0; ireturn: time stamp with msec resolution. */ -double millitime() +Double_t millitime() { struct timeval now; gettimeofday(&now, 0); - return ((double)now.tv_sec * 1.0e6 + (double)now.tv_usec)/1.0e3; + return ((Double_t)now.tv_sec * 1.0e6 + (Double_t)now.tv_usec)/1.0e3; } //------------------------------------------------------------------------- @@ -968,7 +977,7 @@ double millitime() * \param argc number of command line arguments * \param argv command line argument array */ -int main(int argc, char *argv[]) +Int_t main(Int_t argc, Char_t *argv[]) { Int_t unitTag = FOURIER_UNIT_NOT_GIVEN; Int_t apodTag = F_APODIZATION_NONE; @@ -985,9 +994,9 @@ int main(int argc, char *argv[]) musrFT_init(startupParam); // parse command line options - int status = musrFT_parse_options(argc, argv, startupParam); + Int_t status = musrFT_parse_options(argc, argv, startupParam); if (status != 0) { - int retVal = PMUSR_SUCCESS; + Int_t retVal = PMUSR_SUCCESS; if (status == 2) { musrFT_syntax(); retVal = PMUSR_WRONG_STARTUP_SYNTAX; @@ -1002,7 +1011,7 @@ int main(int argc, char *argv[]) } // read startup file - char startup_path_name[128]; + Char_t startup_path_name[128]; PStartupOptions startup_options; startup_options.writeExpectedChisq = false; startup_options.estimateN0 = true; @@ -1051,7 +1060,7 @@ int main(int argc, char *argv[]) // load msr-file(s) vector msrHandler; msrHandler.resize(startupParam.msrFln.size()); - for (unsigned int i=0; iGetStartupOptions(), true); status = msrHandler[i]->ReadMsrFile(); if (status != PMUSR_SUCCESS) { @@ -1073,7 +1082,7 @@ int main(int argc, char *argv[]) vector runDataHandler; runDataHandler.resize(startupParam.msrFln.size()+startupParam.dataFln.size()); // resize to the total number of run data provided // load data-file(s) related to msr-file - for (unsigned int i=0; iGetDataPathList()); @@ -1082,7 +1091,7 @@ int main(int argc, char *argv[]) } // load data-file(s) provided directly - for (unsigned int i=msrHandler.size(); iGetDataPathList()); @@ -1091,7 +1100,14 @@ int main(int argc, char *argv[]) } // read all the data files - for (unsigned int i=0; iReadData(); if (!runDataHandler[i]->IsAllDataAvailable()) { @@ -1116,8 +1132,8 @@ int main(int argc, char *argv[]) // first check of histo list makes sense if (i >= msrHandler.size()) { // only check if originating from data-files (not msr-files) - for (unsigned int j=0; j rawRunData->GetNoOfHistos()) { + for (UInt_t j=0; j rawRunData->GetNoOfHistos()) { cerr << endl << ">> musrFT **ERROR** found histo no " << startupParam.histo[j] << " > # of histo in the file ("; cerr << startupParam.dataFln[i] << " // # histo: " << rawRunData->GetNoOfHistos() << ")." << endl; return PMUSR_DATA_FILE_READ_ERROR; @@ -1125,15 +1141,18 @@ int main(int argc, char *argv[]) } if (startupParam.histo.size() == 0) { // no histo list given // set histo list to ALL available histos for the data file - for (unsigned int j=0; jGetNoOfHistos(); j++) + for (UInt_t j=0; jGetNoOfHistos(); j++) startupParam.histo.push_back(j+1); } } - musrFT_data rd; - TString str(""), fln(""); - unsigned int idx=0; // get meta info, time resolution, time range, raw data sets + // check if the data set path-name has changed + if (prevDataSetPathName.CompareTo(runDataHandler[i]->GetRunPathName())) { // i.e. data set path-name changed + rd.dataSetTag = dataSetTagCounter++; + prevDataSetPathName = runDataHandler[i]->GetRunPathName(); + } + if (i < msrHandler.size()) { // obtain info from msr-files // keep title if not overwritten by the command line if (startupParam.title.Length() == 0) @@ -1206,11 +1225,11 @@ int main(int argc, char *argv[]) PIntVector runList = plot->at(0).fRuns; // loop over all runs listed in the msr-file PLOT block - for (unsigned int j=0; jat(runList[j]-1).GetForwardHistoNoSize(); k++) { + for (UInt_t k=0; kat(runList[j]-1).GetForwardHistoNoSize(); k++) { histoList.push_back(runs->at(runList[j]-1).GetForwardHistoNo(k)); } @@ -1219,7 +1238,7 @@ int main(int argc, char *argv[]) musrFT_getMetaInfo(fln, rawRunData, str); TString hh(""); hh = TString::Format("h%d", histoList[0]); - for (unsigned int k=1; k fourier; fourier.resize(histo.size()); - for (unsigned int i=0; iTransform(apodTag); } - double end = millitime(); + Double_t end = millitime(); 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 @@ -1374,7 +1399,7 @@ int main(int argc, char *argv[]) Bool_t batch = false; if (startupParam.graphicFormat.Length() != 0) { batch = true; - argv[argc] = (char*)malloc(16*sizeof(char)); + argv[argc] = (Char_t*)malloc(16*sizeof(Char_t)); strcpy(argv[argc], "-b"); argc++; } @@ -1383,17 +1408,17 @@ int main(int argc, char *argv[]) TApplication app("App", &argc, argv); if (startupHandler) { - fourierCanvas = new PFourierCanvas(fourier, startupParam.title.Data(), - startupParam.showAverage, fourierPlotTag, - startupParam.fourierRange, startupParam.initialPhase, + fourierCanvas = new PFourierCanvas(fourier, dataSetTag, startupParam.title.Data(), + startupParam.showAverage, startupParam.showAveragePerDataSet, + fourierPlotTag, startupParam.fourierRange, startupParam.initialPhase, 10, 10, 800, 800, startupHandler->GetMarkerList(), startupHandler->GetColorList(), batch); } else { - fourierCanvas = new PFourierCanvas(fourier, startupParam.title.Data(), - startupParam.showAverage, fourierPlotTag, - startupParam.fourierRange, startupParam.initialPhase, + fourierCanvas = new PFourierCanvas(fourier, dataSetTag, startupParam.title.Data(), + startupParam.showAverage, startupParam.showAveragePerDataSet, + fourierPlotTag, startupParam.fourierRange, startupParam.initialPhase, 10, 10, 800, 800, batch); } @@ -1443,23 +1468,23 @@ int main(int argc, char *argv[]) if (startupHandler) delete startupHandler; - for (unsigned int i=0; i 0) { - for (unsigned int i=0; i 0) { - for (unsigned int i=0; isetText(line); } - // average tag + // average ALL tag if (prevCmd[i] == "-a") { fAveragedView_checkBox->setCheckState(Qt::Checked); } + // average per data set tag + if (prevCmd[i] == "-ad") { + fAveragePerDataSet_checkBox->setCheckState(Qt::Checked); + } // t0 list if (prevCmd[i] == "--t0") { i++; @@ -239,6 +243,8 @@ PGetMusrFTOptionsDialog::PGetMusrFTOptionsDialog(QString currentMsrFile, QString connect(fMsrFileNameClear_pushButton, SIGNAL (clicked() ), this, SLOT( clearMsrFileNames() ) ); connect(fDataFileNameClear_pushButton, SIGNAL (clicked() ), this, SLOT( clearDataFileNames() ) ); connect(fResetAll_pushButton, SIGNAL( clicked() ), this, SLOT( resetAll() ) ); + connect(fAveragedView_checkBox, SIGNAL ( stateChanged(int) ), this, SLOT( averagedAll(int) ) ); + connect(fAveragePerDataSet_checkBox, SIGNAL ( stateChanged(int) ), this, SLOT( averagedPerDataSet(int) ) ); } //---------------------------------------------------------------------------------------------------- @@ -329,10 +335,14 @@ QStringList PGetMusrFTOptionsDialog::getMusrFTOptions() cmd << strList[i]; } - // averaged view + // averaged view ALL if (fAveragedView_checkBox->checkState() == Qt::Checked) cmd << "-a"; + // averaged view per data set + if (fAveragePerDataSet_checkBox->checkState() == Qt::Checked) + cmd << "-ad"; + // t0 list if (fT0_lineEdit->text().length() > 0) { cmd << "--t0"; @@ -546,6 +556,26 @@ void PGetMusrFTOptionsDialog::resetAll() fFourierTitle_lineEdit->setText(""); } +//---------------------------------------------------------------------------------------------------- +/** + *

      SLOT called when averaged view for ALL data is checked. + */ +void PGetMusrFTOptionsDialog::averagedAll(int state) +{ + if ((state == Qt::Checked) && fAveragePerDataSet_checkBox->isChecked()) + fAveragePerDataSet_checkBox->setCheckState(Qt::Unchecked); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

      SLOT called when averaged view per data set is checked. + */ +void PGetMusrFTOptionsDialog::averagedPerDataSet(int state) +{ + if ((state == Qt::Checked) && fAveragedView_checkBox->isChecked()) + fAveragedView_checkBox->setCheckState(Qt::Unchecked); +} + //---------------------------------------------------------------------------------------------------- /** *

      Generates a help content window showing the description for musrFT. diff --git a/src/musredit/PGetMusrFTOptionsDialog.h b/src/musredit/PGetMusrFTOptionsDialog.h index 8d3e0942..bea14f7f 100644 --- a/src/musredit/PGetMusrFTOptionsDialog.h +++ b/src/musredit/PGetMusrFTOptionsDialog.h @@ -55,6 +55,8 @@ class PGetMusrFTOptionsDialog : public QDialog, private Ui::PGetMusrFTOptionsDia void clearDataFileNames(); void createMsrFileChanged(int state); void resetAll(); + void averagedAll(int state); + void averagedPerDataSet(int state); private: QStringList fMsrFilePaths; ///< list keeping all the paths from the msr-file path-name list diff --git a/src/musredit/forms/PGetMusrFTOptionsDialog.ui b/src/musredit/forms/PGetMusrFTOptionsDialog.ui index d2cf38be..75966be9 100644 --- a/src/musredit/forms/PGetMusrFTOptionsDialog.ui +++ b/src/musredit/forms/PGetMusrFTOptionsDialog.ui @@ -34,11 +34,11 @@ Fourier - + - 20 - 30 + 21 + 31 641 156 @@ -264,7 +264,14 @@ p, li { white-space: pre-wrap; } - Averaged View + Average All + + + + + + + Average per Data Set @@ -275,7 +282,7 @@ p, li { white-space: pre-wrap; } - 278 + 88 20 @@ -644,7 +651,14 @@ p, li { white-space: pre-wrap; } - + + + + 0 + 23 + + + @@ -668,7 +682,14 @@ p, li { white-space: pre-wrap; } - + + + + 0 + 23 + + + @@ -685,7 +706,7 @@ p, li { white-space: pre-wrap; } - + 20