graphical dump without X

This commit is contained in:
nemu 2009-05-06 05:35:26 +00:00
parent 97ef877c64
commit 8e8081a75b
3 changed files with 67 additions and 45 deletions

View File

@ -88,8 +88,9 @@ PMusrCanvas::PMusrCanvas()
* *
*/ */
PMusrCanvas::PMusrCanvas(const int number, const char* title, PMusrCanvas::PMusrCanvas(const int number, const char* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh) : Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
fPlotNumber(number) const Bool_t batch) :
fBatchMode(batch), fPlotNumber(number)
{ {
fMultiGraphData = 0; fMultiGraphData = 0;
fMultiGraphDiff = 0; fMultiGraphDiff = 0;
@ -111,7 +112,9 @@ PMusrCanvas::PMusrCanvas(const int number, const char* title,
PMusrCanvas::PMusrCanvas(const int number, const char* title, PMusrCanvas::PMusrCanvas(const int number, const char* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
PMsrFourierStructure fourierDefault, PMsrFourierStructure fourierDefault,
const PIntVector markerList, const PIntVector colorList) : const PIntVector markerList, const PIntVector colorList,
const Bool_t batch) :
fBatchMode(batch),
fPlotNumber(number), fFourier(fourierDefault), fPlotNumber(number), fFourier(fourierDefault),
fMarkerList(markerList), fColorList(colorList) fMarkerList(markerList), fColorList(colorList)
{ {
@ -443,6 +446,7 @@ void PMusrCanvas::UpdateDataTheoryPad()
} }
// handle data // handle data
HandleNonMusrDataSet(i, runNo, data); HandleNonMusrDataSet(i, runNo, data);
if (!fBatchMode) {
// disable Fourier menus // disable Fourier menus
fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL); fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL);
fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_IMAG); fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_IMAG);
@ -451,6 +455,7 @@ void PMusrCanvas::UpdateDataTheoryPad()
fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE); fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE);
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_PLUS);
fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS); fPopupFourier->DisableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
}
break; break;
default: default:
fValid = false; fValid = false;
@ -596,6 +601,9 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
if (event != kKeyPress) if (event != kKeyPress)
return; return;
if (fBatchMode)
return;
// cout << ">this " << this << endl; // cout << ">this " << this << endl;
// cout << ">fMainCanvas " << fMainCanvas << endl; // cout << ">fMainCanvas " << fMainCanvas << endl;
// cout << ">selected " << selected << endl; // cout << ">selected " << selected << endl;
@ -726,6 +734,9 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
*/ */
void PMusrCanvas::HandleMenuPopup(Int_t id) void PMusrCanvas::HandleMenuPopup(Int_t id)
{ {
if (fBatchMode)
return;
if (id == P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber) { if (id == P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber) {
// set appropriate plot view // set appropriate plot view
fCurrentPlotView = PV_DATA; fCurrentPlotView = PV_DATA;
@ -1031,7 +1042,8 @@ void PMusrCanvas::InitMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, In
return; return;
} }
// add canvas menu // add canvas menu if not in batch mode
if (!fBatchMode) {
fImp = (TRootCanvas*)fMainCanvas->GetCanvasImp(); fImp = (TRootCanvas*)fMainCanvas->GetCanvasImp();
fBar = fImp->GetMenuBar(); fBar = fImp->GetMenuBar();
fPopupMain = fBar->AddPopup("&Musrfit"); fPopupMain = fBar->AddPopup("&Musrfit");
@ -1066,6 +1078,7 @@ 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->Connect("TGPopupMenu", "Activated(Int_t)", "PMusrCanvas", this, "HandleMenuPopup(Int_t)");
fPopupMain->CheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber); fPopupMain->CheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
}
// divide the canvas into 4 pads // divide the canvas into 4 pads
// title pad // title pad
@ -2178,8 +2191,10 @@ void PMusrCanvas::PlotData()
{ {
fDataTheoryPad->cd(); fDataTheoryPad->cd();
if (!fBatchMode) {
// uncheck fourier menu entries // uncheck fourier menu entries
fPopupFourier->UnCheckEntries(); fPopupFourier->UnCheckEntries();
}
if (fPlotType < 0) // plot type not defined if (fPlotType < 0) // plot type not defined
return; return;

View File

@ -149,11 +149,11 @@ class PMusrCanvas : public TObject, public TQObject
public: public:
PMusrCanvas(); PMusrCanvas();
PMusrCanvas(const int number, const char* title, PMusrCanvas(const int number, const char* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh); Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const Bool_t batch);
PMusrCanvas(const int number, const char* title, PMusrCanvas(const int number, const char* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
PMsrFourierStructure fourierDefault, PMsrFourierStructure fourierDefault,
const PIntVector markerList, const PIntVector colorList); const PIntVector markerList, const PIntVector colorList, const Bool_t batch);
virtual ~PMusrCanvas(); virtual ~PMusrCanvas();
virtual Bool_t IsValid() { return fValid; } virtual Bool_t IsValid() { return fValid; }
@ -175,6 +175,7 @@ class PMusrCanvas : public TObject, public TQObject
virtual void SaveGraphicsAndQuit(char *fileName, char *graphicsFormat); virtual void SaveGraphicsAndQuit(char *fileName, char *graphicsFormat);
private: private:
Bool_t fBatchMode; /// musrview in ROOT batch mode
Bool_t fValid; Bool_t fValid;
Bool_t fDifferenceView; /// tag showing that the shown data, fourier, are the difference between data and theory Bool_t fDifferenceView; /// tag showing that the shown data, fourier, are the difference between data and theory
Int_t fCurrentPlotView; /// tag showing what the current plot view is: data, fourier, ... Int_t fCurrentPlotView; /// tag showing what the current plot view is: data, fourier, ...

View File

@ -250,6 +250,11 @@ cout << endl;
if (success) { if (success) {
// generate Root application needed for PMusrCanvas // generate Root application needed for PMusrCanvas
if (graphicsOutput) {
argv[argc] = (char*)malloc(16*sizeof(char));
strcpy(argv[argc], "-b");
argc++;
}
TApplication app("App", &argc, argv); TApplication app("App", &argc, argv);
vector<PMusrCanvas*> canvasVector; vector<PMusrCanvas*> canvasVector;
@ -263,10 +268,11 @@ cout << endl;
10+i*100, 10+i*100, 800, 600, 10+i*100, 10+i*100, 800, 600,
startupHandler->GetFourierDefaults(), startupHandler->GetFourierDefaults(),
startupHandler->GetMarkerList(), startupHandler->GetMarkerList(),
startupHandler->GetColorList()); startupHandler->GetColorList(),
graphicsOutput);
else else
musrCanvas = new PMusrCanvas(i, msrHandler->GetMsrTitle()->Data(), musrCanvas = new PMusrCanvas(i, msrHandler->GetMsrTitle()->Data(),
10+i*100, 10+i*100, 800, 600); 10+i*100, 10+i*100, 800, 600, graphicsOutput);
if (!musrCanvas->IsValid()) { if (!musrCanvas->IsValid()) {
cout << endl << "**SEVERE ERROR** Couldn't invoke all necessary objects, will quit."; cout << endl << "**SEVERE ERROR** Couldn't invoke all necessary objects, will quit.";