Draw("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