fully reorganized menu handling
This commit is contained in:
parent
5392bf41c8
commit
0770939f92
@ -107,6 +107,7 @@ short term:
|
||||
**CHECKED AND FIXED** 08-11-12
|
||||
|
||||
* implement FFT with msr-interface
|
||||
**DONE** 2009-01
|
||||
|
||||
---------------------
|
||||
intermediate term:
|
||||
|
@ -571,14 +571,66 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
|
||||
//cout << "x : " << (char)x << endl;
|
||||
//cout << "px: " << (char)fMainCanvas->GetEventX() << endl;
|
||||
|
||||
// handle keys and popup menu entries
|
||||
bool relevantKey = false;
|
||||
if (x == 'q') {
|
||||
Done(0);
|
||||
} else if (x == 'd') {
|
||||
HandleDifference();
|
||||
relevantKey = true;
|
||||
// toggle difference tag
|
||||
fDifferenceView = !fDifferenceView;
|
||||
// set the popup menu entry properly
|
||||
if (fDifferenceView) {
|
||||
fPopupMain->CheckEntry(P_MENU_ID_DIFFERENCE+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
} else {
|
||||
fPopupMain->UnCheckEntry(P_MENU_ID_DIFFERENCE+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
}
|
||||
} else if (x == 'f') {
|
||||
relevantKey = true;
|
||||
if (fCurrentPlotView == PV_DATA) { // current view is data view
|
||||
// uncheck data popup entry
|
||||
fPopupMain->UnCheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
// get default fourier tag and update fourier popup menu
|
||||
switch (fFourier.fPlotTag) {
|
||||
case FOURIER_PLOT_REAL:
|
||||
fCurrentPlotView = PV_FOURIER_REAL;
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL);
|
||||
break;
|
||||
case FOURIER_PLOT_IMAG:
|
||||
fCurrentPlotView = PV_FOURIER_IMAG;
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_IMAG);
|
||||
break;
|
||||
case FOURIER_PLOT_REAL_AND_IMAG:
|
||||
fCurrentPlotView = PV_FOURIER_REAL_AND_IMAG;
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL_AND_IMAG);
|
||||
break;
|
||||
case FOURIER_PLOT_POWER:
|
||||
fCurrentPlotView = PV_FOURIER_PWR;
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PWR);
|
||||
break;
|
||||
case FOURIER_PLOT_PHASE:
|
||||
fCurrentPlotView = PV_FOURIER_PHASE;
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else { // current view is one of the Fourier views
|
||||
// set the current plot view to data
|
||||
fCurrentPlotView = PV_DATA;
|
||||
// uncheck all fourier popup menu items
|
||||
fPopupFourier->UnCheckEntries();
|
||||
// check the data entry
|
||||
fPopupMain->CheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
// set the current view to data
|
||||
fCurrentPlotView = PV_DATA;
|
||||
}
|
||||
/*
|
||||
if (fPlotType != MSR_PLOT_NON_MUSR) {
|
||||
fPopupMain->UnCheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
HandleFourier(-1);
|
||||
}
|
||||
*/
|
||||
} else if (x == '+') {
|
||||
if (fCurrentPlotView != PV_DATA)
|
||||
IncrementFourierPhase();
|
||||
@ -589,6 +641,47 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
|
||||
fMainCanvas->Update();
|
||||
}
|
||||
|
||||
// call the apropriate functions if necessary
|
||||
if (relevantKey) {
|
||||
if (fDifferenceView) { // difference view
|
||||
switch (fCurrentPlotView) {
|
||||
case PV_DATA:
|
||||
cout << endl << ">> HandleCmdKey(): fDifferenceView==true, fCurrentPlotView==PV_DATA -> HandleDifference()" << endl;
|
||||
CleanupFourierDifference();
|
||||
HandleDifference();
|
||||
break;
|
||||
case PV_FOURIER_REAL:
|
||||
case PV_FOURIER_IMAG:
|
||||
case PV_FOURIER_REAL_AND_IMAG:
|
||||
case PV_FOURIER_PWR:
|
||||
case PV_FOURIER_PHASE:
|
||||
cout << endl << ">> HandleCmdKey(): fDifferenceView==true, fCurrentPlotView==" << fCurrentPlotView << " -> HandleFourierDifference()" << endl;
|
||||
HandleFourierDifference();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else { // not a difference view
|
||||
switch (fCurrentPlotView) {
|
||||
case PV_DATA:
|
||||
cout << endl << ">> HandleCmdKey(): fDifferenceView==false, fCurrentPlotView==PV_DATA -> PlotData()" << endl;
|
||||
CleanupDifference();
|
||||
CleanupFourier();
|
||||
PlotData();
|
||||
break;
|
||||
case PV_FOURIER_REAL:
|
||||
case PV_FOURIER_IMAG:
|
||||
case PV_FOURIER_REAL_AND_IMAG:
|
||||
case PV_FOURIER_PWR:
|
||||
case PV_FOURIER_PHASE:
|
||||
cout << endl << ">> HandleCmdKey(): fDifferenceView==false, fCurrentPlotView==" << fCurrentPlotView << " -> HandleFourier()" << endl;
|
||||
HandleFourier();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// check if phase increment/decrement needs to be ghost
|
||||
if (fCurrentPlotView == PV_DATA) {
|
||||
fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS);
|
||||
@ -598,6 +691,7 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// HandleMenuPopup (SLOT)
|
||||
@ -608,47 +702,168 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
|
||||
*/
|
||||
void PMusrCanvas::HandleMenuPopup(Int_t id)
|
||||
{
|
||||
if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL) {
|
||||
if (id == P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber) {
|
||||
// set appropriate plot view
|
||||
fCurrentPlotView = PV_DATA;
|
||||
// check data item
|
||||
fPopupMain->CheckEntry(id);
|
||||
// uncheck fourier popup items
|
||||
fPopupFourier->UnCheckEntries();
|
||||
// call data handling routine
|
||||
if (!fDifferenceView) {
|
||||
CleanupDifference();
|
||||
CleanupFourier();
|
||||
PlotData();
|
||||
} else {
|
||||
HandleDifference();
|
||||
}
|
||||
} else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL) {
|
||||
// set appropriate plot view
|
||||
fCurrentPlotView = PV_FOURIER_REAL;
|
||||
// uncheck data
|
||||
fPopupMain->UnCheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
// check appropriate fourier popup item
|
||||
fPopupFourier->UnCheckEntries();
|
||||
fPopupFourier->CheckEntry(id);
|
||||
// enable phase increment/decrement
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS);
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
|
||||
HandleFourier(FOURIER_PLOT_REAL);
|
||||
// handle fourier real
|
||||
if (!fDifferenceView) {
|
||||
HandleFourier();
|
||||
} else {
|
||||
HandleFourierDifference();
|
||||
}
|
||||
} else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_IMAG) {
|
||||
// set appropriate plot view
|
||||
fCurrentPlotView = PV_FOURIER_IMAG;
|
||||
// uncheck data
|
||||
fPopupMain->UnCheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
// check appropriate fourier popup item
|
||||
fPopupFourier->UnCheckEntries();
|
||||
fPopupFourier->CheckEntry(id);
|
||||
// enable phase increment/decrement
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS);
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
|
||||
HandleFourier(FOURIER_PLOT_IMAG);
|
||||
// handle fourier imag
|
||||
if (!fDifferenceView) {
|
||||
HandleFourier();
|
||||
} else {
|
||||
HandleFourierDifference();
|
||||
}
|
||||
} else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL_AND_IMAG) {
|
||||
// set appropriate plot view
|
||||
fCurrentPlotView = PV_FOURIER_REAL_AND_IMAG;
|
||||
// uncheck data
|
||||
fPopupMain->UnCheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
// check appropriate fourier popup item
|
||||
fPopupFourier->UnCheckEntries();
|
||||
fPopupFourier->CheckEntry(id);
|
||||
// enable phase increment/decrement
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS);
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
|
||||
HandleFourier(FOURIER_PLOT_REAL_AND_IMAG);
|
||||
// handle fourier real and imag
|
||||
if (!fDifferenceView) {
|
||||
HandleFourier();
|
||||
} else {
|
||||
HandleFourierDifference();
|
||||
}
|
||||
} else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PWR) {
|
||||
// set appropriate plot view
|
||||
fCurrentPlotView = PV_FOURIER_PWR;
|
||||
// uncheck data
|
||||
fPopupMain->UnCheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
// check appropriate fourier popup item
|
||||
fPopupFourier->UnCheckEntries();
|
||||
fPopupFourier->CheckEntry(id);
|
||||
// enable phase increment/decrement
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS);
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
|
||||
HandleFourier(FOURIER_PLOT_POWER);
|
||||
// handle fourier power
|
||||
if (!fDifferenceView) {
|
||||
HandleFourier();
|
||||
} else {
|
||||
HandleFourierDifference();
|
||||
}
|
||||
} else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE) {
|
||||
// set appropriate plot view
|
||||
fCurrentPlotView = PV_FOURIER_PHASE;
|
||||
// uncheck data
|
||||
fPopupMain->UnCheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
// check appropriate fourier popup item
|
||||
fPopupFourier->UnCheckEntries();
|
||||
fPopupFourier->CheckEntry(id);
|
||||
// enable phase increment/decrement
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS);
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
|
||||
HandleFourier(FOURIER_PLOT_PHASE);
|
||||
// handle fourier phase
|
||||
if (!fDifferenceView) {
|
||||
HandleFourier();
|
||||
} else {
|
||||
HandleFourierDifference();
|
||||
}
|
||||
} else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS) {
|
||||
IncrementFourierPhase();
|
||||
} else if (id == P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS) {
|
||||
DecrementFourierPhase();
|
||||
} else if (id == P_MENU_ID_DIFFERENCE+P_MENU_PLOT_OFFSET*fPlotNumber) {
|
||||
// toggle difference tag
|
||||
fDifferenceView = !fDifferenceView;
|
||||
// set the popup menu entry properly
|
||||
if (fDifferenceView) {
|
||||
fPopupMain->CheckEntry(id);
|
||||
} else {
|
||||
fPopupMain->UnCheckEntry(id);
|
||||
}
|
||||
// handle data, diff, Fourier
|
||||
if (fDifferenceView) {
|
||||
switch (fCurrentPlotView) {
|
||||
case PV_DATA:
|
||||
CleanupFourierDifference();
|
||||
HandleDifference();
|
||||
break;
|
||||
case PV_FOURIER_REAL:
|
||||
case PV_FOURIER_IMAG:
|
||||
case PV_FOURIER_REAL_AND_IMAG:
|
||||
case PV_FOURIER_PWR:
|
||||
case PV_FOURIER_PHASE:
|
||||
HandleFourierDifference();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else { // not a difference view
|
||||
switch (fCurrentPlotView) {
|
||||
case PV_DATA:
|
||||
CleanupDifference();
|
||||
CleanupFourier();
|
||||
PlotData();
|
||||
break;
|
||||
case PV_FOURIER_REAL:
|
||||
case PV_FOURIER_IMAG:
|
||||
case PV_FOURIER_REAL_AND_IMAG:
|
||||
case PV_FOURIER_PWR:
|
||||
case PV_FOURIER_PHASE:
|
||||
HandleFourier();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (id == P_MENU_ID_SAVE_DATA+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_SAVE_ASCII) {
|
||||
SaveDataAscii();
|
||||
} else if (id == P_MENU_ID_SAVE_DATA+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_SAVE_DB) {
|
||||
SaveDataDb();
|
||||
}
|
||||
|
||||
// check if phase increment/decrement needs to be ghost
|
||||
if (fCurrentPlotView == PV_DATA) {
|
||||
fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS);
|
||||
fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
|
||||
} else {
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS);
|
||||
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -748,6 +963,9 @@ void PMusrCanvas::InitMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, In
|
||||
fPopupMain = fBar->AddPopup("&Musrfit");
|
||||
|
||||
fPopupFourier = new TGPopupMenu();
|
||||
fPopupMain->AddEntry("&Data", P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
fPopupMain->AddSeparator();
|
||||
|
||||
fPopupMain->AddPopup("&Fourier", fPopupFourier);
|
||||
fPopupFourier->AddEntry("Show Real", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL);
|
||||
fPopupFourier->AddEntry("Show Imag", P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_IMAG);
|
||||
@ -760,7 +978,7 @@ void PMusrCanvas::InitMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, In
|
||||
fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS);
|
||||
fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
|
||||
|
||||
fPopupMain->AddEntry("&Difference", P_MENU_ID_DIFFERENCE+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
fPopupMain->AddEntry("D&ifference", P_MENU_ID_DIFFERENCE+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
fPopupMain->AddSeparator();
|
||||
|
||||
fPopupSave = new TGPopupMenu();
|
||||
@ -773,6 +991,8 @@ void PMusrCanvas::InitMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, In
|
||||
|
||||
fPopupMain->Connect("TGPopupMenu", "Activated(Int_t)", "PMusrCanvas", this, "HandleMenuPopup(Int_t)");
|
||||
|
||||
fPopupMain->CheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
|
||||
// divide the canvas into 4 pads
|
||||
// title pad
|
||||
fTitlePad = new TPaveText(0.0, YTITLE, 1.0, 1.0, "NDC");
|
||||
@ -1204,21 +1424,9 @@ void PMusrCanvas::HandleNonMusrDataSet(unsigned int plotNo, unsigned int runNo,
|
||||
*/
|
||||
void PMusrCanvas::HandleDifference()
|
||||
{
|
||||
// toggle difference view flag
|
||||
fDifferenceView = !fDifferenceView;
|
||||
|
||||
// handle popup menu entry
|
||||
if (fDifferenceView)
|
||||
fPopupMain->CheckEntry(P_MENU_ID_DIFFERENCE+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
else
|
||||
fPopupMain->UnCheckEntry(P_MENU_ID_DIFFERENCE+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
|
||||
// difference plot wished hence feed difference data and plot them
|
||||
if (fDifferenceView) {
|
||||
switch (fCurrentPlotView) {
|
||||
case PV_DATA:
|
||||
// check if it is necessary to calculate diff data
|
||||
if ((fPlotType != MSR_PLOT_NON_MUSR) && (fData[0].diff == 0)) {
|
||||
cout << endl << ">> calculate diff ..." << endl;
|
||||
TH1F *diffHisto;
|
||||
TString name;
|
||||
// loop over all histos
|
||||
@ -1307,37 +1515,7 @@ void PMusrCanvas::HandleDifference()
|
||||
fNonMusrData[0].diff->GetXaxis()->SetRangeUser(xmin, xmax);
|
||||
}
|
||||
|
||||
// plot difference
|
||||
PlotDifference();
|
||||
break;
|
||||
case PV_FOURIER_REAL:
|
||||
case PV_FOURIER_IMAG:
|
||||
case PV_FOURIER_REAL_AND_IMAG:
|
||||
case PV_FOURIER_PWR:
|
||||
case PV_FOURIER_PHASE:
|
||||
if (fPlotType != MSR_PLOT_NON_MUSR) { // muSR Data
|
||||
HandleFourier(fCurrentPlotView);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else { // switch back to the "normal" view
|
||||
switch (fCurrentPlotView) {
|
||||
case PV_DATA:
|
||||
PlotData();
|
||||
break;
|
||||
case PV_FOURIER_REAL:
|
||||
case PV_FOURIER_IMAG:
|
||||
case PV_FOURIER_REAL_AND_IMAG:
|
||||
case PV_FOURIER_PWR:
|
||||
case PV_FOURIER_PHASE:
|
||||
PlotFourier();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -1345,37 +1523,126 @@ void PMusrCanvas::HandleDifference()
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param tag
|
||||
*/
|
||||
void PMusrCanvas::HandleFourier(int tag)
|
||||
void PMusrCanvas::HandleFourier()
|
||||
{
|
||||
// if fourier was invoked via the 'f' cmd key, take the default plot tag
|
||||
if (tag == -1) { // called via cmd key 'f'
|
||||
tag = fFourier.fPlotTag;
|
||||
switch (tag) {
|
||||
case FOURIER_PLOT_REAL:
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL);
|
||||
break;
|
||||
case FOURIER_PLOT_IMAG:
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_IMAG);
|
||||
break;
|
||||
case FOURIER_PLOT_REAL_AND_IMAG:
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL_AND_IMAG);
|
||||
break;
|
||||
case FOURIER_PLOT_POWER:
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PWR);
|
||||
break;
|
||||
case FOURIER_PLOT_PHASE:
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
// check if plot type is appropriate for fourier
|
||||
if (fPlotType == MSR_PLOT_NON_MUSR)
|
||||
return;
|
||||
|
||||
cout << endl << ">> in HandleFourier ..." << endl;
|
||||
|
||||
// check if fourier needs to be calculated
|
||||
if (fData[0].dataFourierRe == 0) {
|
||||
int bin;
|
||||
bin = fData[0].data->GetXaxis()->GetFirst();
|
||||
double startTime = fData[0].data->GetBinCenter(bin);
|
||||
bin = fData[0].data->GetXaxis()->GetLast();
|
||||
double endTime = fData[0].data->GetBinCenter(bin);
|
||||
//cout << endl << ">> startTime = " << startTime << ", endTime = " << endTime << endl;
|
||||
for (unsigned int i=0; i<fData.size(); i++) {
|
||||
// calculate fourier transform of the data
|
||||
PFourier fourierData(fData[i].data, fFourier.fUnits, startTime, endTime, fFourier.fFourierPower);
|
||||
if (!fourierData.IsValid()) {
|
||||
cout << endl << "**SEVERE ERROR** PMusrCanvas::HandleFourier: couldn't invoke PFourier to calculate the Fourier data ..." << endl;
|
||||
return;
|
||||
}
|
||||
fourierData.Transform(fFourier.fApodization);
|
||||
double scale;
|
||||
scale = sqrt(fData[0].data->GetBinWidth(1)/(endTime-startTime));
|
||||
//cout << endl << ">> data scale = " << scale;
|
||||
// get real part of the data
|
||||
fData[i].dataFourierRe = fourierData.GetRealFourier(scale);
|
||||
//cout << endl << ">> i: " << i << ", fData[i].dataFourierRe = " << fData[i].dataFourierRe;
|
||||
// get imaginary part of the data
|
||||
fData[i].dataFourierIm = fourierData.GetImaginaryFourier(scale);
|
||||
// get power part of the data
|
||||
fData[i].dataFourierPwr = fourierData.GetPowerFourier(scale);
|
||||
// get phase part of the data
|
||||
fData[i].dataFourierPhase = fourierData.GetPhaseFourier();
|
||||
|
||||
// set marker and line color
|
||||
fData[i].dataFourierRe->SetMarkerColor(fData[i].data->GetMarkerColor());
|
||||
fData[i].dataFourierRe->SetLineColor(fData[i].data->GetLineColor());
|
||||
fData[i].dataFourierIm->SetMarkerColor(fData[i].data->GetMarkerColor());
|
||||
fData[i].dataFourierIm->SetLineColor(fData[i].data->GetLineColor());
|
||||
fData[i].dataFourierPwr->SetMarkerColor(fData[i].data->GetMarkerColor());
|
||||
fData[i].dataFourierPwr->SetLineColor(fData[i].data->GetLineColor());
|
||||
fData[i].dataFourierPhase->SetMarkerColor(fData[i].data->GetMarkerColor());
|
||||
fData[i].dataFourierPhase->SetLineColor(fData[i].data->GetLineColor());
|
||||
|
||||
// set marker size
|
||||
fData[i].dataFourierRe->SetMarkerSize(1);
|
||||
fData[i].dataFourierIm->SetMarkerSize(1);
|
||||
fData[i].dataFourierPwr->SetMarkerSize(1);
|
||||
fData[i].dataFourierPhase->SetMarkerSize(1);
|
||||
// set marker type
|
||||
fData[i].dataFourierRe->SetMarkerStyle(fData[i].data->GetMarkerStyle());
|
||||
fData[i].dataFourierIm->SetMarkerStyle(fData[i].data->GetMarkerStyle());
|
||||
fData[i].dataFourierPwr->SetMarkerStyle(fData[i].data->GetMarkerStyle());
|
||||
fData[i].dataFourierPhase->SetMarkerStyle(fData[i].data->GetMarkerStyle());
|
||||
|
||||
// calculate fourier transform of the theory
|
||||
int powerPad = (int)round(log((endTime-startTime)/fData[i].theory->GetBinWidth(1))/log(2))+3;
|
||||
cout << endl << ">> powerPad = " << powerPad;
|
||||
PFourier fourierTheory(fData[i].theory, fFourier.fUnits, startTime, endTime, powerPad);
|
||||
if (!fourierTheory.IsValid()) {
|
||||
cout << endl << "**SEVERE ERROR** PMusrCanvas::HandleFourier: couldn't invoke PFourier to calculate the Fourier theory ..." << endl;
|
||||
return;
|
||||
}
|
||||
fourierTheory.Transform(fFourier.fApodization);
|
||||
scale = sqrt(fData[0].theory->GetBinWidth(1)/(endTime-startTime)*fData[0].theory->GetBinWidth(1)/fData[0].data->GetBinWidth(1));
|
||||
cout << endl << ">> theory scale = " << scale << ", data.res/theory.res = " << fData[0].theory->GetBinWidth(1)/fData[0].data->GetBinWidth(1);
|
||||
// get real part of the data
|
||||
fData[i].theoryFourierRe = fourierTheory.GetRealFourier(scale);
|
||||
//cout << endl << ">> i: " << i << ", fData[i].dataFourierRe = " << fData[i].dataFourierRe;
|
||||
// get imaginary part of the data
|
||||
fData[i].theoryFourierIm = fourierTheory.GetImaginaryFourier(scale);
|
||||
// get power part of the data
|
||||
fData[i].theoryFourierPwr = fourierTheory.GetPowerFourier(scale);
|
||||
// get phase part of the data
|
||||
fData[i].theoryFourierPhase = fourierTheory.GetPhaseFourier();
|
||||
|
||||
// set line colors for the theory
|
||||
fData[i].theoryFourierRe->SetLineColor(fData[i].theory->GetLineColor());
|
||||
fData[i].theoryFourierIm->SetLineColor(fData[i].theory->GetLineColor());
|
||||
fData[i].theoryFourierPwr->SetLineColor(fData[i].theory->GetLineColor());
|
||||
fData[i].theoryFourierPhase->SetLineColor(fData[i].theory->GetLineColor());
|
||||
}
|
||||
|
||||
// apply global phase
|
||||
if (fFourier.fPhase != 0.0) {
|
||||
double re, im;
|
||||
const double cp = TMath::Cos(fFourier.fPhase/180.0*TMath::Pi());
|
||||
const double sp = TMath::Sin(fFourier.fPhase/180.0*TMath::Pi());
|
||||
|
||||
// if the current view is a data plot, fourier needs to be calculated
|
||||
fCurrentFourierPhase = fFourier.fPhase;
|
||||
|
||||
for (unsigned int i=0; i<fData.size(); i++) { // loop over all data sets
|
||||
if ((fData[i].dataFourierRe != 0) && (fData[i].dataFourierIm != 0)) {
|
||||
for (int j=0; j<fData[i].dataFourierRe->GetNbinsX(); j++) { // loop over a fourier data set
|
||||
// calculate new fourier data set value
|
||||
re = fData[i].dataFourierRe->GetBinContent(j) * cp + fData[i].dataFourierIm->GetBinContent(j) * sp;
|
||||
im = fData[i].dataFourierIm->GetBinContent(j) * cp - fData[i].dataFourierRe->GetBinContent(j) * sp;
|
||||
// overwrite fourier data set value
|
||||
fData[i].dataFourierRe->SetBinContent(j, re);
|
||||
fData[i].dataFourierIm->SetBinContent(j, im);
|
||||
}
|
||||
}
|
||||
if ((fData[i].theoryFourierRe != 0) && (fData[i].theoryFourierIm != 0)) {
|
||||
for (int j=0; j<fData[i].theoryFourierRe->GetNbinsX(); j++) { // loop over a fourier data set
|
||||
// calculate new fourier data set value
|
||||
re = fData[i].theoryFourierRe->GetBinContent(j) * cp + fData[i].theoryFourierIm->GetBinContent(j) * sp;
|
||||
im = fData[i].theoryFourierIm->GetBinContent(j) * cp - fData[i].theoryFourierRe->GetBinContent(j) * sp;
|
||||
// overwrite fourier data set value
|
||||
fData[i].theoryFourierRe->SetBinContent(j, re);
|
||||
fData[i].theoryFourierIm->SetBinContent(j, im);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (fCurrentPlotView == PV_DATA) {
|
||||
if (!fDifferenceView) { // data view
|
||||
// delete fourier components
|
||||
@ -1614,40 +1881,189 @@ cout << endl << ">> data scale = " << scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int plotView = -1;
|
||||
switch (tag) { // called via popup menu
|
||||
case FOURIER_PLOT_REAL:
|
||||
plotView = PV_FOURIER_REAL;
|
||||
break;
|
||||
case FOURIER_PLOT_IMAG:
|
||||
plotView = PV_FOURIER_IMAG;
|
||||
break;
|
||||
case FOURIER_PLOT_REAL_AND_IMAG:
|
||||
plotView = PV_FOURIER_REAL_AND_IMAG;
|
||||
break;
|
||||
case FOURIER_PLOT_POWER:
|
||||
plotView = PV_FOURIER_PWR;
|
||||
break;
|
||||
case FOURIER_PLOT_PHASE:
|
||||
plotView = PV_FOURIER_PHASE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
*/
|
||||
PlotFourier();
|
||||
}
|
||||
|
||||
if (plotView == fCurrentPlotView) { // twice checked the same -> switch back to data view
|
||||
fCurrentPlotView = PV_DATA;
|
||||
// uncheck fourier menu entries
|
||||
fPopupFourier->UnCheckEntries();
|
||||
// plot data
|
||||
if (!fDifferenceView)
|
||||
PlotData();
|
||||
else
|
||||
PlotDifference();
|
||||
} else { // plot fourier
|
||||
fCurrentPlotView = plotView;
|
||||
PlotFourier();
|
||||
//--------------------------------------------------------------------------
|
||||
// HandleFourierDifference (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
void PMusrCanvas::HandleFourierDifference()
|
||||
{
|
||||
// check if plot type is appropriate for fourier
|
||||
if (fPlotType == MSR_PLOT_NON_MUSR)
|
||||
return;
|
||||
|
||||
cout << endl << ">> in HandleFourierDifference ..." << endl;
|
||||
|
||||
// check if fourier needs to be calculated
|
||||
if (fData[0].diffFourierRe == 0) {
|
||||
int bin;
|
||||
bin = fData[0].diff->GetXaxis()->GetFirst();
|
||||
double startTime = fData[0].diff->GetBinCenter(bin);
|
||||
bin = fData[0].diff->GetXaxis()->GetLast();
|
||||
double endTime = fData[0].diff->GetBinCenter(bin);
|
||||
cout << endl << ">> startTime = " << startTime << ", endTime = " << endTime << endl;
|
||||
for (unsigned int i=0; i<fData.size(); i++) {
|
||||
// calculate fourier transform of the data
|
||||
PFourier fourierData(fData[i].diff, fFourier.fUnits, startTime, endTime, fFourier.fFourierPower);
|
||||
if (!fourierData.IsValid()) {
|
||||
cout << endl << "**SEVERE ERROR** PMusrCanvas::HandleFourier: couldn't invoke PFourier to calculate the Fourier diff ..." << endl;
|
||||
return;
|
||||
}
|
||||
fourierData.Transform(fFourier.fApodization);
|
||||
double scale;
|
||||
scale = sqrt(fData[0].diff->GetBinWidth(1)/(endTime-startTime));
|
||||
cout << endl << ">> data scale = " << scale;
|
||||
// get real part of the data
|
||||
fData[i].diffFourierRe = fourierData.GetRealFourier(scale);
|
||||
//cout << endl << ">> i: " << i << ", fData[i].diffFourierRe = " << fData[i].diffFourierRe;
|
||||
// get imaginary part of the data
|
||||
fData[i].diffFourierIm = fourierData.GetImaginaryFourier(scale);
|
||||
// get power part of the data
|
||||
fData[i].diffFourierPwr = fourierData.GetPowerFourier(scale);
|
||||
// get phase part of the data
|
||||
fData[i].diffFourierPhase = fourierData.GetPhaseFourier();
|
||||
|
||||
// set marker and line color
|
||||
fData[i].diffFourierRe->SetMarkerColor(fData[i].diff->GetMarkerColor());
|
||||
fData[i].diffFourierRe->SetLineColor(fData[i].diff->GetLineColor());
|
||||
fData[i].diffFourierIm->SetMarkerColor(fData[i].diff->GetMarkerColor());
|
||||
fData[i].diffFourierIm->SetLineColor(fData[i].diff->GetLineColor());
|
||||
fData[i].diffFourierPwr->SetMarkerColor(fData[i].diff->GetMarkerColor());
|
||||
fData[i].diffFourierPwr->SetLineColor(fData[i].diff->GetLineColor());
|
||||
fData[i].diffFourierPhase->SetMarkerColor(fData[i].diff->GetMarkerColor());
|
||||
fData[i].diffFourierPhase->SetLineColor(fData[i].diff->GetLineColor());
|
||||
|
||||
// set marker size
|
||||
fData[i].diffFourierRe->SetMarkerSize(1);
|
||||
fData[i].diffFourierIm->SetMarkerSize(1);
|
||||
fData[i].diffFourierPwr->SetMarkerSize(1);
|
||||
fData[i].diffFourierPhase->SetMarkerSize(1);
|
||||
// set marker type
|
||||
fData[i].diffFourierRe->SetMarkerStyle(fData[i].diff->GetMarkerStyle());
|
||||
fData[i].diffFourierIm->SetMarkerStyle(fData[i].diff->GetMarkerStyle());
|
||||
fData[i].diffFourierPwr->SetMarkerStyle(fData[i].diff->GetMarkerStyle());
|
||||
fData[i].diffFourierPhase->SetMarkerStyle(fData[i].diff->GetMarkerStyle());
|
||||
}
|
||||
|
||||
// apply global phase
|
||||
if (fFourier.fPhase != 0.0) {
|
||||
double re, im;
|
||||
const double cp = TMath::Cos(fFourier.fPhase/180.0*TMath::Pi());
|
||||
const double sp = TMath::Sin(fFourier.fPhase/180.0*TMath::Pi());
|
||||
|
||||
fCurrentFourierPhase = fFourier.fPhase;
|
||||
|
||||
for (unsigned int i=0; i<fData.size(); i++) { // loop over all data sets
|
||||
if ((fData[i].diffFourierRe != 0) && (fData[i].diffFourierIm != 0)) {
|
||||
for (int j=0; j<fData[i].diffFourierRe->GetNbinsX(); j++) { // loop over a fourier data set
|
||||
// calculate new fourier data set value
|
||||
re = fData[i].diffFourierRe->GetBinContent(j) * cp + fData[i].diffFourierIm->GetBinContent(j) * sp;
|
||||
im = fData[i].diffFourierIm->GetBinContent(j) * cp - fData[i].diffFourierRe->GetBinContent(j) * sp;
|
||||
// overwrite fourier data set value
|
||||
fData[i].diffFourierRe->SetBinContent(j, re);
|
||||
fData[i].diffFourierIm->SetBinContent(j, im);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlotFourierDifference();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// CleanupDifference (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
void PMusrCanvas::CleanupDifference()
|
||||
{
|
||||
for (unsigned int i=0; i<fData.size(); i++) {
|
||||
if (fData[i].diff != 0) {
|
||||
delete fData[i].diff;
|
||||
fData[i].diff = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// CleanupFourier (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
void PMusrCanvas::CleanupFourier()
|
||||
{
|
||||
for (unsigned int i=0; i<fData.size(); i++) {
|
||||
if (fData[i].dataFourierRe != 0) {
|
||||
delete fData[i].dataFourierRe;
|
||||
fData[i].dataFourierRe = 0;
|
||||
}
|
||||
if (fData[i].dataFourierIm != 0) {
|
||||
delete fData[i].dataFourierIm;
|
||||
fData[i].dataFourierIm = 0;
|
||||
}
|
||||
if (fData[i].dataFourierPwr != 0) {
|
||||
delete fData[i].dataFourierPwr;
|
||||
fData[i].dataFourierPwr = 0;
|
||||
}
|
||||
if (fData[i].dataFourierPhase != 0) {
|
||||
delete fData[i].dataFourierPhase;
|
||||
fData[i].dataFourierPhase = 0;
|
||||
}
|
||||
if (fData[i].theoryFourierRe != 0) {
|
||||
delete fData[i].theoryFourierRe;
|
||||
fData[i].theoryFourierRe = 0;
|
||||
}
|
||||
if (fData[i].theoryFourierIm != 0) {
|
||||
delete fData[i].theoryFourierIm;
|
||||
fData[i].theoryFourierIm = 0;
|
||||
}
|
||||
if (fData[i].theoryFourierPwr != 0) {
|
||||
delete fData[i].theoryFourierPwr;
|
||||
fData[i].theoryFourierPwr = 0;
|
||||
}
|
||||
if (fData[i].theoryFourierPhase != 0) {
|
||||
delete fData[i].theoryFourierPhase;
|
||||
fData[i].theoryFourierPhase = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// CleanupFourierDifference (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
void PMusrCanvas::CleanupFourierDifference()
|
||||
{
|
||||
for (unsigned int i=0; i<fData.size(); i++) {
|
||||
if (fData[i].diffFourierRe != 0) {
|
||||
delete fData[i].diffFourierRe;
|
||||
fData[i].diffFourierRe = 0;
|
||||
}
|
||||
if (fData[i].diffFourierIm != 0) {
|
||||
delete fData[i].diffFourierIm;
|
||||
fData[i].diffFourierIm = 0;
|
||||
}
|
||||
if (fData[i].diffFourierPwr != 0) {
|
||||
delete fData[i].diffFourierPwr;
|
||||
fData[i].diffFourierPwr = 0;
|
||||
}
|
||||
if (fData[i].diffFourierPhase != 0) {
|
||||
delete fData[i].diffFourierPhase;
|
||||
fData[i].diffFourierPhase = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1885,7 +2301,7 @@ void PMusrCanvas::PlotDifference()
|
||||
return;
|
||||
|
||||
if (fPlotType != MSR_PLOT_NON_MUSR) {
|
||||
cout << endl << ">> going to plot diff spectra ... (" << fData[0].diff->GetNbinsX() << ")" << endl;
|
||||
cout << endl << ">> PlotDifference(): going to plot diff spectra ... (" << fData[0].diff->GetNbinsX() << ")" << endl;
|
||||
fData[0].diff->Draw("pe");
|
||||
// set x-axis label
|
||||
fData[0].diff->GetXaxis()->SetTitle("time (#mus)");
|
||||
@ -1949,10 +2365,8 @@ cout << endl << ">> in PlotFourier() ..." << endl;
|
||||
xAxisTitle = TString("??");
|
||||
}
|
||||
|
||||
|
||||
// plot data
|
||||
double min, max, binContent;
|
||||
if (!fDifferenceView) { // not a difference view
|
||||
switch (fCurrentPlotView) {
|
||||
case PV_FOURIER_REAL:
|
||||
//cout << endl << ">> fData[0].dataFourierRe->GetNbinsX() = " << fData[0].dataFourierRe->GetNbinsX();
|
||||
@ -2206,7 +2620,46 @@ cout << endl << ">> in PlotFourier() ..." << endl;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else { // difference view
|
||||
|
||||
fDataTheoryPad->Update();
|
||||
|
||||
fMainCanvas->cd();
|
||||
fMainCanvas->Update();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// PlotFourierDifference (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
void PMusrCanvas::PlotFourierDifference()
|
||||
{
|
||||
cout << endl << ">> in PlotFourierDifference() ..." << endl;
|
||||
|
||||
fDataTheoryPad->cd();
|
||||
|
||||
if (fPlotType < 0) // plot type not defined
|
||||
return;
|
||||
|
||||
if (fData.size() == 0) // no data to be plotted
|
||||
return;
|
||||
|
||||
// define x-axis title
|
||||
TString xAxisTitle("");
|
||||
if (fFourier.fUnits == FOURIER_UNIT_FIELD) {
|
||||
xAxisTitle = TString("Field (G)");
|
||||
} else if (fFourier.fUnits == FOURIER_UNIT_FREQ) {
|
||||
xAxisTitle = TString("Frequency (MHz)");
|
||||
} else if (fFourier.fUnits == FOURIER_UNIT_CYCLES) {
|
||||
xAxisTitle = TString("Frequency (Mc/s)");
|
||||
} else {
|
||||
xAxisTitle = TString("??");
|
||||
}
|
||||
|
||||
// plot data
|
||||
double min, max, binContent;
|
||||
switch (fCurrentPlotView) {
|
||||
case PV_FOURIER_REAL:
|
||||
//cout << endl << ">> fData[0].diffFourierRe->GetNbinsX() = " << fData[0].diffFourierRe->GetNbinsX();
|
||||
@ -2436,7 +2889,6 @@ cout << endl << ">> in PlotFourier() ..." << endl;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fDataTheoryPad->Update();
|
||||
|
||||
@ -2518,6 +2970,16 @@ void PMusrCanvas::IncrementFourierPhase()
|
||||
fData[i].theoryFourierIm->SetBinContent(j, im);
|
||||
}
|
||||
}
|
||||
if ((fData[i].diffFourierRe != 0) && (fData[i].diffFourierIm != 0)) {
|
||||
for (int j=0; j<fData[i].diffFourierRe->GetNbinsX(); j++) { // loop over a fourier diff data set
|
||||
// calculate new fourier diff data set value
|
||||
re = fData[i].diffFourierRe->GetBinContent(j) * cp + fData[i].diffFourierIm->GetBinContent(j) * sp;
|
||||
im = fData[i].diffFourierIm->GetBinContent(j) * cp - fData[i].diffFourierRe->GetBinContent(j) * sp;
|
||||
// overwrite fourier diff data set value
|
||||
fData[i].diffFourierRe->SetBinContent(j, re);
|
||||
fData[i].diffFourierIm->SetBinContent(j, im);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2559,6 +3021,16 @@ void PMusrCanvas::DecrementFourierPhase()
|
||||
fData[i].theoryFourierIm->SetBinContent(j, im);
|
||||
}
|
||||
}
|
||||
if ((fData[i].diffFourierRe != 0) && (fData[i].diffFourierIm != 0)) {
|
||||
for (int j=0; j<fData[i].diffFourierRe->GetNbinsX(); j++) { // loop over a fourier diff data set
|
||||
// calculate new fourier diff data set value
|
||||
re = fData[i].diffFourierRe->GetBinContent(j) * cp - fData[i].diffFourierIm->GetBinContent(j) * sp;
|
||||
im = fData[i].diffFourierIm->GetBinContent(j) * cp + fData[i].diffFourierRe->GetBinContent(j) * sp;
|
||||
// overwrite fourier diff data set value
|
||||
fData[i].diffFourierRe->SetBinContent(j, re);
|
||||
fData[i].diffFourierIm->SetBinContent(j, im);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,9 +64,10 @@
|
||||
#define PV_FOURIER_PHASE 6
|
||||
|
||||
// Canvas menu id's
|
||||
#define P_MENU_ID_FOURIER 10001
|
||||
#define P_MENU_ID_DIFFERENCE 10002
|
||||
#define P_MENU_ID_SAVE_DATA 10003
|
||||
#define P_MENU_ID_DATA 10001
|
||||
#define P_MENU_ID_FOURIER 10002
|
||||
#define P_MENU_ID_DIFFERENCE 10003
|
||||
#define P_MENU_ID_SAVE_DATA 10004
|
||||
|
||||
#define P_MENU_PLOT_OFFSET 1000
|
||||
|
||||
@ -218,7 +219,11 @@ class PMusrCanvas : public TObject, public TQObject
|
||||
virtual void HandleDataSet(unsigned int plotNo, unsigned int runNo, PRunData *data);
|
||||
virtual void HandleNonMusrDataSet(unsigned int plotNo, unsigned int runNo, PRunData *data);
|
||||
virtual void HandleDifference();
|
||||
virtual void HandleFourier(int tag);
|
||||
virtual void HandleFourier();
|
||||
virtual void HandleFourierDifference();
|
||||
virtual void CleanupDifference();
|
||||
virtual void CleanupFourier();
|
||||
virtual void CleanupFourierDifference();
|
||||
|
||||
virtual double CalculateDiff(const double x, const double y, TH1F *theo);
|
||||
virtual double CalculateDiff(const double x, const double y, TGraphErrors *theo);
|
||||
@ -230,6 +235,7 @@ class PMusrCanvas : public TObject, public TQObject
|
||||
virtual void PlotData();
|
||||
virtual void PlotDifference();
|
||||
virtual void PlotFourier();
|
||||
virtual void PlotFourierDifference();
|
||||
virtual void PlotFourierPhaseValue();
|
||||
virtual void IncrementFourierPhase();
|
||||
virtual void DecrementFourierPhase();
|
||||
|
Loading…
x
Reference in New Issue
Block a user