added pixieDAQ for a complete GUI pixie16 control and DAQ
This commit is contained in:
parent
9e16a53075
commit
ef8355bfe1
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -9,3 +9,6 @@ example
|
||||||
read-set
|
read-set
|
||||||
|
|
||||||
*.root
|
*.root
|
||||||
|
*.cxx
|
||||||
|
*.pcm
|
||||||
|
pixieDAQ
|
||||||
|
|
27
Makefile
27
Makefile
|
@ -27,7 +27,7 @@ INCFLAGS = -I/usr/opt/xia/PixieSDK/ -I/usr/opt/xia/PixieSDK/include/ -I/usr/opt/
|
||||||
APIBASE = /usr/opt/xia/PixieSDK/lib/
|
APIBASE = /usr/opt/xia/PixieSDK/lib/
|
||||||
LIBS = $(APIBASE)libPixie16Api.so $(APIBASE)libPixieSDK.a $(PLXBASE)PlxApi.a
|
LIBS = $(APIBASE)libPixie16Api.so $(APIBASE)libPixieSDK.a $(PLXBASE)PlxApi.a
|
||||||
|
|
||||||
all: test example
|
all: test example pixieDAQ
|
||||||
|
|
||||||
example : example.o
|
example : example.o
|
||||||
$(CC) $(INCFLAGS) example.o $(LIBS) -o example
|
$(CC) $(INCFLAGS) example.o $(LIBS) -o example
|
||||||
|
@ -35,19 +35,42 @@ example : example.o
|
||||||
example.o : example.cpp
|
example.o : example.cpp
|
||||||
$(CC) $(CFLAGS) $(INCFLAGS) example.cpp
|
$(CC) $(CFLAGS) $(INCFLAGS) example.cpp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test : test.o Pixie16Class.o
|
test : test.o Pixie16Class.o
|
||||||
|
@echo "-------- making test"
|
||||||
$(CC) $(INCFLAGS) test.o Pixie16Class.o $(LIBS) -o test $(ROOT_FLAG)
|
$(CC) $(INCFLAGS) test.o Pixie16Class.o $(LIBS) -o test $(ROOT_FLAG)
|
||||||
|
|
||||||
test.o : test.cpp
|
test.o : test.cpp
|
||||||
|
@echo "-------- making test.o"
|
||||||
$(CC) $(CFLAGS) $(INCFLAGS) test.cpp $(ROOT_FLAG)
|
$(CC) $(CFLAGS) $(INCFLAGS) test.cpp $(ROOT_FLAG)
|
||||||
|
|
||||||
Pixie16Class.o : Pixie16Class.h Pixie16Class.cpp DataBlock.h
|
Pixie16Class.o : Pixie16Class.h Pixie16Class.cpp DataBlock.h
|
||||||
|
@echo "-------- making Pixie16Class.o "
|
||||||
$(CC) $(CFLAGS) $(INCFLAGS) Pixie16Class.cpp DataBlock.h $(ROOT_FLAG)
|
$(CC) $(CFLAGS) $(INCFLAGS) Pixie16Class.cpp DataBlock.h $(ROOT_FLAG)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pixieDAQ : pixieDAQ.o Pixie16Class.o pixieDict.o
|
||||||
|
@echo "-------- making pixieDAQ "
|
||||||
|
$(CC) $(INCFLAGS) pixieDAQ.o Pixie16Class.o pixieDict.cxx $(LIBS) -o pixieDAQ $(ROOT_FLAG)
|
||||||
|
|
||||||
|
pixieDAQ.o : pixieDAQ.cpp pixieDAQ.h
|
||||||
|
@echo "--------- creating pcm "
|
||||||
|
@rootcling -f pixieDict.cxx -c pixieDAQ.h pixieDAQLinkDef.h
|
||||||
|
@echo "--------- creating pixieDAQ.o"
|
||||||
|
$(CC) $(CFLAGS) $(INCFLAGS) pixieDAQ.cpp Pixie16Class.cpp pixieDict.cxx $(ROOT_FLAG)
|
||||||
|
|
||||||
|
#origin root example
|
||||||
|
#pixieDAQ:
|
||||||
|
# @rootcling -f pixieDict.cxx -c pixieDAQ.h pixieDAQLinkDef.h
|
||||||
|
# $(CC) $(CFLAGS) pixieDAQ.cpp pixieDict.cxx $(ROOT_FLAG)
|
||||||
|
|
||||||
|
|
||||||
#need to export LD_LIBRARY_PATH
|
#need to export LD_LIBRARY_PATH
|
||||||
#the pixie.ini is not needed
|
#the pixie.ini is not needed
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o test
|
rm -f *.o test *.pcm example pixieDAQ *.gch *.cxx
|
||||||
|
|
||||||
|
|
||||||
|
|
83
pixieDAQ.cpp
Normal file
83
pixieDAQ.cpp
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
#include <TApplication.h>
|
||||||
|
#include <TGClient.h>
|
||||||
|
#include <TCanvas.h>
|
||||||
|
#include <TF1.h>
|
||||||
|
#include <TRandom.h>
|
||||||
|
#include <TGButton.h>
|
||||||
|
#include <TRootEmbeddedCanvas.h>
|
||||||
|
#include "pixieDAQ.h"
|
||||||
|
|
||||||
|
#include "Pixie16Class.h"
|
||||||
|
|
||||||
|
MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
|
/// Create a main frame
|
||||||
|
fMain = new TGMainFrame(p,w,h);
|
||||||
|
|
||||||
|
/// Create canvas widget
|
||||||
|
fEcanvas = new TRootEmbeddedCanvas("Ecanvas",fMain,800,400);
|
||||||
|
fMain->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
|
||||||
|
/// Create a horizontal frame widget with buttons
|
||||||
|
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain,200,40);
|
||||||
|
TGTextButton *draw = new TGTextButton(hframe,"&Draw");
|
||||||
|
draw->Connect("Clicked()","MainWindow",this,"DoDraw()");
|
||||||
|
hframe->AddFrame(draw, new TGLayoutHints(kLHintsCenterX, 5,5,3,4));
|
||||||
|
TGTextButton *exit = new TGTextButton(hframe,"&Exit");
|
||||||
|
exit->Connect("Clicked()", "MainWindow", this, "GoodBye()");
|
||||||
|
|
||||||
|
hframe->AddFrame(exit, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
|
||||||
|
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2));
|
||||||
|
|
||||||
|
/// Set a name to the main frame
|
||||||
|
fMain->SetWindowName("Simple Example");
|
||||||
|
|
||||||
|
/// Map all subwindows of main frame
|
||||||
|
fMain->MapSubwindows();
|
||||||
|
|
||||||
|
/// Initialize the layout algorithm
|
||||||
|
fMain->Resize(fMain->GetDefaultSize());
|
||||||
|
|
||||||
|
/// Map main frame
|
||||||
|
fMain->MapWindow();
|
||||||
|
|
||||||
|
|
||||||
|
///================ pixie
|
||||||
|
///printf("Removing Pixie16Msg.log \n");
|
||||||
|
///remove( "Pixie16Msg.log");
|
||||||
|
|
||||||
|
///pixie = new Pixie16();
|
||||||
|
///if ( pixie->GetStatus() < 0 ) {
|
||||||
|
/// GoodBye();
|
||||||
|
///}
|
||||||
|
|
||||||
|
}
|
||||||
|
MainWindow::~MainWindow() {
|
||||||
|
/// Clean up used widgets: frames, buttons, layout hints
|
||||||
|
fMain->Cleanup();
|
||||||
|
delete fMain;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::DoDraw() {
|
||||||
|
/// Draws function graphics in randomly chosen interval
|
||||||
|
TF1 *f1 = new TF1("f1","sin(x)/x",0,gRandom->Rndm()*10);
|
||||||
|
f1->SetLineWidth(3);
|
||||||
|
f1->Draw();
|
||||||
|
TCanvas *fCanvas = fEcanvas->GetCanvas();
|
||||||
|
fCanvas->cd();
|
||||||
|
fCanvas->Update();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::GoodBye(){
|
||||||
|
printf("----- bye bye ---- \n");
|
||||||
|
gApplication->Terminate(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
printf(" Welcome to pixie16 DQ \n");
|
||||||
|
TApplication theApp("App",&argc,argv);
|
||||||
|
new MainWindow(gClient->GetRoot(),200,200);
|
||||||
|
theApp.Run();
|
||||||
|
return 0;
|
||||||
|
}
|
23
pixieDAQ.h
Normal file
23
pixieDAQ.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#include <TQObject.h>
|
||||||
|
#include <RQ_OBJECT.h>
|
||||||
|
|
||||||
|
class TGWindow;
|
||||||
|
class TGMainFrame;
|
||||||
|
class TRootEmbeddedCanvas;
|
||||||
|
class Pixie16;
|
||||||
|
|
||||||
|
class MainWindow {
|
||||||
|
RQ_OBJECT("MainWindow")
|
||||||
|
private:
|
||||||
|
TGMainFrame *fMain;
|
||||||
|
TRootEmbeddedCanvas *fEcanvas;
|
||||||
|
|
||||||
|
Pixie16 * pixie;
|
||||||
|
|
||||||
|
public:
|
||||||
|
MainWindow(const TGWindow *p, UInt_t w, UInt_t h);
|
||||||
|
virtual ~MainWindow();
|
||||||
|
void GoodBye();
|
||||||
|
|
||||||
|
void DoDraw();
|
||||||
|
};
|
1
pixieDAQLinkDef.h
Normal file
1
pixieDAQLinkDef.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#pragma link C++ class MainWindow;
|
Loading…
Reference in New Issue
Block a user