// You can try to increase the font size in $(ROOTSYS)/etc/system.rootrc or in your own custom ~/.rootrc
#include <TApplication.h>
#include <TGClient.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGSimpleTableInterface.h>
#include <TGTable.h>
#include <TGLabel.h>
#include <TGFrame.h>
#include <TGNumberEntry.h>
#include <TGLayout.h>
#include <TGStatusBar.h>
#include <TGTableLayout.h>
#include <TGTextEntry.h>
#include <TGComboBox.h>
#include <TGButton.h>
#include <TGTab.h>
#include <TTimer.h>
#include <TColor.h>
#include <TH2F.h>
#include <TFile.h>
#include <TStyle.h>
#include "Feb_Gui.h"
#include <stdint.h>
#include "dataio.h"
#include "sa02lib.h"
#include <sys/time.h>
#include <sys/stat.h>
#include <signal.h>
#define TRUE 1
#define FALSE 0
#define TIMEOUT 3
int timer_out;
struct sigaction oact;
int ctrl_c=0;
void
set_plot_style()
{
const Int_t NRGBs = 5;
const Int_t NCont = 255;
Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
gStyle->SetNumberContours(NCont);
}
void sa02Timerast (int signumber)
{
timer_out = TRUE;
sa02TimerOut = TRUE;
sa02Printf("->>> TIMEOUT !!!\n");
ctrl_c = 1;
}
void tmlnk (int tout)
{
timer_out = FALSE;
struct sigaction act;
struct itimerval tdelay;
act.sa_handler = sa02Timerast;
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
tdelay.it_value.tv_sec = tout / 100;
tdelay.it_value.tv_usec = 10000 * (tout % 100);
tdelay.it_interval.tv_sec = 0;
tdelay.it_interval.tv_usec = 0;
if (sigaction (SIGALRM, &act, &oact) < 0)
{
}
if (setitimer (ITIMER_REAL, &tdelay, NULL) < 0)
{
}
}
void tmulk ()
{
struct itimerval tdelay;
tdelay.it_value.tv_sec = 0;
tdelay.it_value.tv_usec = 0;
tdelay.it_interval.tv_sec = 0;
tdelay.it_interval.tv_usec = 0;
if (setitimer (ITIMER_REAL, &tdelay, NULL) < 0)
{
}
if (sigaction (SIGALRM, &oact, NULL) < 0)
{
}
}
int GetTime(char *x)
{
time_t rawtime;
struct tm * timeinfo;
if (len) x[len-1]=0;
return 0;
}
void sa02Tmlnk (int tout)
{
sa02TimerOut = FALSE;
tmlnk (tout);
// ResetTimer (p1h, P1_DAQ_TIMEOUT);
}
void sa02Tmulk ()
{
tmulk();
}
void FebMainFrame::GuiTimer()
{
char cmd[100];
GetTime(cmd);
fStatusBar->SetText(cmd,0);
/* Canvas ni thread safe
if (gCanvas){
gCanvas->GetCanvas()->Modified();
gCanvas->GetCanvas()->Update();
}
*/
}
int FebMainFrame::FillHistogram(float y, unsigned int *rdata)
{
for (int ich=0; ich<144*4; ich++){
int xch = (143 - ich%144) + ich/144*144;
//fHisto->Fill(xch,y,rdata[2+ich]);
fHisto->Fill(xch,y,ich%144);
}
return 0;
}
//----------------------------------------------------
void FebMainFrame::StartDaq(int mode)
{
int daqmode =(fDaqMode)? (int ) fDaqMode->GetSelected(): 0;
const char *sdaqmode= (fDaqMode)? fDaqMode->GetSelectedEntry()->GetTitle(): NULL;
int tpenb = fTpEnb->IsOn();
unsigned int addr= (fAddress)? fAddress->GetNumber() : 0;
sa02BoardType= (fBoardType)? fBoardType->GetNumber() : 0;
unsigned int boardnumber= (fBoardNumber)? fBoardNumber->GetNumber(): 0;
int sa02BoardMask = (1<< boardnumber);
const char * fname = (fFilename)? fFilename->GetText(): NULL;
unsigned int neve= (fNeve)? fNeve->GetNumber(): 0;
unsigned int nx = (fNx)? fNx->GetNumber(): 0;
unsigned int x0 = (fX0)? fX0->GetNumber(): 0;
unsigned int dx = (fDx)? fDx->GetNumber(): 0;
unsigned int chip = (fAsicChip)? fAsicChip->GetNumber(): 0;
unsigned int channel= (fAsicChannel)? fAsicChannel->GetNumber(): 0;
unsigned int trgtype = (fTriggerType)? (int ) fTriggerType->GetSelected(): 0;
unsigned int trglen = (fTrgLen)? fTrgLen->GetNumber(): 0;
unsigned int data = (fData)? fData->GetNumber(): 0;
unsigned int offset = (fOffset)? fOffset->GetNumber(): 0;
TGTextLBEntry *fp = (fFPGACmd)? (TGTextLBEntry *)fFPGACmd->GetSelectedEntry(): NULL;
const char *cmd= (fp)? fp->GetTitle(): NULL;
int icmd
= (strlen(cmd
))?sa02GetCmdCode
((char *) cmd
) : 0;
TGTextLBEntry *febout = (fFEBOut1)? (TGTextLBEntry *)fFEBOut1->GetSelectedEntry(): NULL;
const char *sfebout= (febout)? febout->GetTitle(): NULL;
int sindex = (fFEBOut1)? (int ) fFEBOut1->GetSelected(): 0;
sindex--;
int vmeinterface= (fVmeInterface)? (int ) fVmeInterface->GetSelected(): 0;
if (mode<3){
printf("Interface %d\t address 0x%0x\t", vmeinterface
, addr
);
printf("board type %d\t", sa02BoardType
);
printf("number %d tpenb %d\n", boardnumber
, tpenb
);
}
uint32_t response[2]= {0,0};
if (vmeinterface == ZYNQ_XILLINUX) addr =0;
sa02SetAddress(addr);
VME_START(vmeinterface);
switch (mode) {
case 1:{
printf("channel %d\n", channel
);
sa02Cmd(boardnumber, icmd, x0, chip, channel,1,response);
break;
}
case 2: {
char serial[255];
double sdata[20];
sa02Status( boardnumber, serial,sdata);
if (fStatusBar) fStatusBar->SetText(serial,2);
break;
}
case 3:{
printf("Selecting NIM Output %s index= %d\n", sfebout
, sindex
);
if (sindex>=0) Sa02SetPtsOutput(sindex);
break;
}
case 4:{
printf("TrgType %d\n", trgtype
);
printf("TrgLen %d\n", trglen
);
uint32_t r = Sa02SelectTriggerWithMaskAndLength (trgtype, sa02BoardMask , trglen);
printf("In 0x%08x Out 0x%08x\n", trgtype
| (sa02BoardMask
<< 4) | (trglen
<< 16) ,r
);
break;
}
case 5:{
const char * fparam = (fParamFile)? fParamFile->GetText(): NULL;
printf("ASIC Parameter File %s\n", fparam
);
sa02LoadParametersFromFile( fparam , sa02BoardMask );
break;
}
case 6:{
printf("Read addr 0x%04x\t", offset
);
VME_A32D32_R(addr+offset,&data);
printf("data 0x%08x\n", data
);
break;
}
case 7:{
printf("Write to addr 0x%04x\t", offset
);
printf("data 0x%08x\n", data
);
VME_A32D32_W(addr+offset,data);
break;
}
case 0:{
printf("scan FEB cmd %s\t", cmd
);
printf("channel %d\n", channel
);
printf("output filename %s\n", fname
);
gStyle->SetOptStat(0);
TCanvas *c = (fEcanvas)? fEcanvas->GetCanvas(): NULL;
if (fHisto) delete fHisto;
fHisto = new TH2F(cmd,cmd,144,-0.5,143.5,nx,x0-dx*0.5, x0+(nx-0.5)*dx);
if (c){
c->cd();
fHisto->Draw("colz");
c->Modified();
c->Update();
}
ctrl_c = 0;
int maxsize = 144*10;
uint32_t rdata[maxsize];
printf("Start daqmode=%d %s\n", daqmode
,sdaqmode
);
Sa02DaqMode (daqmode);
time_t t,told;
told = t;
for (int ix=0; ix<nx; ix++){
uint32_t data = ix*dx+x0;
for (int board=0; board<4; board++){
sa02Cmd(board, icmd, data, chip, channel,1,response);
Sa02TestPulseEnable(board, tpenb); // Enable/disable test pulse
}
Sa02SetNeve(neve);
sa02Reset();
int nb=0;
do {
if (trgtype == 1) Sa02SoftwareTrigger();
nb=1;
//nb = sa02Read(sa02BoardMask, rdata );
}
while ( nb==0 && !ctrl_c);
if (ctrl_c) break;
FillHistogram(data,rdata);
if (t!=told){
if (c){ c->Modified(); c->Update(); }
told=t;
}
}
if (c){ c->Modified(); c->Update(); }
TFile *rootfile= new TFile(fname,"RECREATE");
fHisto->Write();
rootfile->Write();
rootfile->ls();
rootfile->Close();
delete rootfile;
break;
}
}
VME_STOP();
//if (ctrl_c) gApplication->Terminate();
}
void FebMainFrame::CanvasPrint()
{
if (fEcanvas)
{
TCanvas *c = fEcanvas->GetCanvas();
if (c) c->SaveAs("sa02_gui.pdf");
else
{
printf("canvas does not exist....!\n");
}
}
}
void FebMainFrame::Table( TGCompositeFrame *p, UInt_t w, UInt_t h )
{
// Create an array to hold a bunch of numbers
Int_t i = 0, j = 0;
UInt_t nrows = 6, ncolumns = 5;
Double_t** data = new Double_t*[nrows];
for (i = 0; i < nrows; i++)
{
data[i] = new Double_t[ncolumns];
for (j = 0; j < ncolumns; j++)
{
data[i][j] = 10 * i + j;
}
}
// Create an interface
TGSimpleTableInterface *iface = new TGSimpleTableInterface(data, w, h);
// Create the table
TGTable *table = new TGTable(p, 999, iface);
// Add the table to the main frame
p->AddFrame(table, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
//Update data
data[5][1] = 3.01;
//update the table view
table->Update();
// return mainframe;
}
/*
class MyTable : public TGMainFrame {
private:
TGTextEntry *fTEItem[12];
...
MyTable::MyTable(const TGWindow *p, UInt_t w, UInt_t h)
: TGMainFrame(p, w, h){
Int_t ncols = 3, nrows = 0;
fLMMatrix = new TGMatrixLayout(this, nrows, ncols);
this->SetLayoutManager(fLMMatrix);
fLO1 = new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2);
char text[10];
for(Int_t i=0; i < 12; i++){
fTEItem[i] = new TGTextEntry
(this, fTBItem[i] = new TGTextBuffer(100));
sprintf(text,"Entry %i", i+1);
fTBItem[i]->AddText(0,text);
fTEItem[i]->Resize(120, fTEItem[i]->GetDefaultHeight());
this->AddFrame(fTEItem[i], fLO1);
}
*/
TGFrame * TGLabeledWidget(TGFrame *main, const char* text, TGFrame *widget, TGLayoutHints *layout)
{
TGHorizontalFrame *fH=new TGHorizontalFrame(main, 200,40);
widget->ReparentWindow(fH);
fH->AddFrame(new TGLabel( fH ,text), layout);
widget->Resize(150,widget->GetDefaultHeight());
fH->AddFrame(widget, layout);
return fH;
}
void FebMainFrame::ScanFrame( TGCompositeFrame *p,UInt_t w,UInt_t h)
{
// Creates widgets of the example
fEcanvas = new TRootEmbeddedCanvas ("Ecanvas",p,600,400);
p->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
TGHorizontalFrame *hframe=new TGHorizontalFrame(p, 200,40);
TGTextButton *start = new TGTextButton(hframe,"&Start");
start->Connect("Clicked()","FebMainFrame",this,"StartDaq(=0)");
start->ChangeOptions(start->GetOptions() | kFixedWidth); // | kFixedSize
start->SetWrapLength(-1);
start->Resize(80,start->GetDefaultHeight());
hframe->AddFrame(start, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
TGTextButton *stop = new TGTextButton(hframe,"&Stop");
stop->Connect("Clicked()","FebMainFrame",this,"StopDaq()");
stop->ChangeOptions(stop->GetOptions() | kFixedWidth); // | kFixedSize
stop->SetWrapLength(-1);
stop->Resize(80,stop->GetDefaultHeight());
hframe->AddFrame(stop, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
TGTextButton *single = new TGTextButton(hframe,"&Single Cmd");
single->Connect("Clicked()","FebMainFrame",this,"StartDaq(=1)");
single->ChangeOptions(single->GetOptions() | kFixedWidth); // | kFixedSize
single->Resize(80,single->GetDefaultHeight());
hframe->AddFrame(single, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
TGTextButton *status = new TGTextButton(hframe,"&Status");
status->Connect("Clicked()","FebMainFrame",this,"StartDaq(=2)");
status->ChangeOptions(status->GetOptions() | kFixedWidth); // | kFixedSize
status->Resize(80,status->GetDefaultHeight());
hframe->AddFrame(status, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
TGTextButton *febout = new TGTextButton(hframe,"&Set Out1");
febout->Connect("Clicked()","FebMainFrame",this,"StartDaq(=3)");
febout->ChangeOptions(febout->GetOptions() | kFixedWidth); // | kFixedSize
febout->Resize(80,febout->GetDefaultHeight());
hframe->AddFrame(febout, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
TGTextButton *settrg = new TGTextButton(hframe,"&Set Trigger");
settrg->Connect("Clicked()","FebMainFrame",this,"StartDaq(=4)");
settrg->ChangeOptions(settrg->GetOptions() | kFixedWidth); // | kFixedSize
settrg->Resize(80,settrg->GetDefaultHeight());
hframe->AddFrame(settrg, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
TGTextButton *loadpar = new TGTextButton(hframe,"&Load Pars");
loadpar->Connect("Clicked()","FebMainFrame",this,"StartDaq(=5)");
loadpar->ChangeOptions(loadpar->GetOptions() | kFixedWidth); // | kFixedSize
loadpar->Resize(80,loadpar->GetDefaultHeight());
hframe->AddFrame(loadpar, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
TGTextButton *print = new TGTextButton(hframe,"&Print");
print->Connect("Clicked()","FebMainFrame",this,"CanvasPrint()");
print->ChangeOptions(print->GetOptions() | kFixedWidth); // | kFixedSize
print->Resize(80,print->GetDefaultHeight());
hframe->AddFrame(print, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
p->AddFrame(hframe,new TGLayoutHints(kLHintsCenterX,2,2,2,2));
//TGGroupFrame *trg=new TGGroupFrame(p, "Trigger Parameters");
const Int_t ncols = 2, nrows = 13;
TGGroupFrame *matrika=new TGGroupFrame(p, "Run Parameters");
TGTableLayout *fLMMatrix = new TGTableLayout(matrika, (nrows+1)/2, ncols*2);
matrika->SetLayoutManager(fLMMatrix);
TGNumberEntry *gEntry[nrows];
char name[0xff]="";
char labels[nrows][20]= {
"FEB Out1","DAQ Mode","Trigger Type","Trigger Length",
"FPGA Command", "Initial Value", "Step size","Number of steps",
"Number of events",
"Asic Chip","Asic Channel",
"Filename","ASIC Parameters"
};
int initial_values[nrows]= {0,0,0,1000,0,400,10,40,100,0,0,0};
const char sfebout[55][64]={
"Digital Feb0","Digital Feb1","Digital Feb2","Digital Feb3",
"Error 0", "Error 1", "Error 2", "Error 3",
"BellePtsTrigger", "Veto", "write_t", "read_t",
"dataBufFul", "hwe", "softtrigger", "hardtrigger", "reset_t",
"DATA_FRAME0", "DATA_FRAME1", "DATA_FRAME1", "DATA_FRAME1",
"RX_FRAME0", "RX_FRAME1", "RX_FRAME2", "RX_FRAME3",
"TX_FRAME0", "TX_FRAME1", "TX_FRAME2", "TX_FRAME3",
"DATA_CLK0", "DATA_CLK1", "DATA_CLK2", "DATA_CLK3",
"RX_CLK0", "RX_CLK1", "RX_CLK2", "RX_CLK3",
"TX_CLK0", "TX_CLK1", "TX_CLK2", "TX_CLK3",
"DATA_DATA0", "DATA_DATA1", "DATA_DATA2", "DATA_DATA3",
"RX_DATA0", "RX_DATA1", "RX_DATA2", "RX_DATA3",
"TX_DATA0", "TX_DATA1", "TX_DATA2", "TX_DATA3",
"lclk", "outTrigger"
};
const char fpgastr[18][10]= { "FE","TP","DLY0","MUX","MUXASIC",
"VTH0","VTH1","TPLVL0","TPLVL1","GREG","CREG",
"CMON","TMON0","TMON1", "ADC_READ", "ADC_RESET","DMON"};
for (int i=0; i<nrows; i++)
{
TGLabel *label = new TGLabel( matrika ,labels[i]);
int dx = i/((nrows+1)/2)*2;
int dy = i%((nrows+1)/2);
//label->Resize(100+i*10,label->GetDefaultHeight());
matrika->AddFrame(label,new TGTableLayoutHints(dx,dx+1,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,0,0));
switch (i)
{
case 1:{
// combo box layout hints
TGLayoutHints *fLcombo = new TGLayoutHints(kLHintsTop | kLHintsLeft,5,5,5,5);
// combo box widget
fDaqMode = new TGComboBox(matrika,100);
fDaqMode->AddEntry("Event Mode", 0);
fDaqMode->AddEntry("Scaler Mode", 1);
fDaqMode->AddEntry("Test Mode - Nresponse frames", 2);
fDaqMode->AddEntry("Test Mode - channel address", 3);
fDaqMode->Resize(100, 20);
// Entry3 is selected as current
fDaqMode->Select(1);
matrika->AddFrame(fDaqMode, new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));
break;
}
case 4:
{
// combo box layout hints
TGLayoutHints *fLcombo = new TGLayoutHints(kLHintsTop | kLHintsLeft,5,5,5,5);
// combo box widget
fFPGACmd = new TGComboBox(matrika,100);
for (int k = 0; k < 17; k++) fFPGACmd->AddEntry(fpgastr[k], k+1);
fFPGACmd->Resize(100, 20);
// Entry3 is selected as current
fFPGACmd->Select(7);
matrika->AddFrame(fFPGACmd, new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));
break;
}
case 2:
{
// combo box layout hints
TGLayoutHints *fLcombo = new TGLayoutHints(kLHintsTop | kLHintsLeft,5,5,5,5);
// combo box widget
fTriggerType = new TGComboBox(matrika,100);
fTriggerType->AddEntry("Software", 1);
fTriggerType->AddEntry("External", 2);
fTriggerType->AddEntry("Internal", 3);
fTriggerType->Resize(100, 20);
// Entry3 is selected as current
fTriggerType->Select(3);
matrika->AddFrame(fTriggerType, new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));
break;
}
case 0:
{
// combo box layout hints
TGLayoutHints *fLcombo = new TGLayoutHints(kLHintsTop | kLHintsLeft,5,5,5,5);
// combo box widget
fFEBOut1 = new TGComboBox(matrika,100);
for (int k = 0; k < 55; k++) fFEBOut1->AddEntry(sfebout[k], k+1);
fFEBOut1->Resize(100, 20);
// Entry3 is selected as current
fFEBOut1->Select(1);
matrika->AddFrame(fFEBOut1, new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));
break;
}
case nrows-2:
{
fFilename = new TGTextEntry( matrika,"feb.root");
fFilename->Resize(200,fFilename->GetDefaultHeight());
matrika->AddFrame( fFilename, new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));
break;
}
case nrows-1:
{
fParamFile = new TGTextEntry( matrika,"../parameters/feb1_0-default.param");
fParamFile->Resize(200,fParamFile->GetDefaultHeight());
matrika->AddFrame( fParamFile, new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));
break;
}
default:
gEntry[i]= new TGNumberEntry( matrika,initial_values[i]);
gEntry[i]->Resize(50,gEntry[i]->GetDefaultHeight());
gEntry[i]->SetFormat(TGNumberFormat::kNESInteger,TGNumberFormat::kNEANonNegative);
matrika->AddFrame(gEntry[i],new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));
break;
}
}
p->AddFrame(matrika,new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2));
fTrgLen =gEntry[3];
fX0 =gEntry[5];
fDx =gEntry[6];
fNx =gEntry[7];
fNeve =gEntry[8];
fAsicChip =gEntry[9];
fAsicChannel=gEntry[10];
}
void FebMainFrame::ScanXYFrame( TGCompositeFrame *p,UInt_t w,UInt_t h)
{
}
void FebMainFrame::LowLevelFrame( TGCompositeFrame *p,UInt_t w,UInt_t h)
{
TGLayoutHints *f0 = new TGLayoutHints(kLHintsLeft| kLHintsTop,5,5,3,4);
TGHorizontalFrame *hframe=new TGHorizontalFrame(p, 200,40);
hframe->AddFrame( TGLabeledWidget(hframe, "Offset",fOffset = new TGNumberEntry( hframe ,0 ) , f0));
fOffset->SetFormat(TGNumberFormat::kNESHex);
fOffset->SetNumber(0x0FFC);
TGTextButton *read = new TGTextButton(hframe,"&Read");
read->Connect("Clicked()","FebMainFrame",this,"StartDaq(=6)");
read->ChangeOptions(read->GetOptions() | kFixedWidth); // | kFixedSize
read->SetWrapLength(-1);
read->Resize(80,read->GetDefaultHeight());
hframe->AddFrame(read, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
hframe->AddFrame( TGLabeledWidget(hframe, "Data", fData = new TGNumberEntry( hframe ,0 ) , f0));
fData->SetFormat(TGNumberFormat::kNESHex);
fData->SetNumber(0xFAF5);
TGTextButton *write = new TGTextButton(hframe,"&Write");
write->Connect("Clicked()","FebMainFrame",this,"StartDaq(=7)");
write->ChangeOptions(write->GetOptions() | kFixedWidth); // | kFixedSize
write->SetWrapLength(-1);
write->Resize(80,write->GetDefaultHeight());
hframe->AddFrame(write, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
p->AddFrame(hframe,new TGLayoutHints(kLHintsCenterX,2,2,2,2));
}
void FebMainFrame::SettingsFrame( TGCompositeFrame *p,UInt_t w,UInt_t h)
{
Table(p, 6 ,5 );
}
FebMainFrame::FebMainFrame( TGWindow *p,UInt_t w,UInt_t h) : TGMainFrame(p,w,h)
{
TGLayoutHints *f0 = new TGLayoutHints(kLHintsLeft| kLHintsTop,5,5,3,4);
TGHorizontalFrame *topframe=new TGHorizontalFrame(this, 200,40);
topframe->AddFrame( TGLabeledWidget(topframe, "Interface", fVmeInterface = new TGComboBox( topframe ,0 ) , f0));
fVmeInterface->AddEntry("CAEN_V1718", 0);
fVmeInterface->AddEntry("WIENER_VMEMM", 1);
fVmeInterface->AddEntry("WIENER_VMUSB", 2);
fVmeInterface->AddEntry("ZYNQ_XILLINUX", 3);
fVmeInterface->Select(3);
fVmeInterface->Resize(120, 20);
topframe->AddFrame( TGLabeledWidget(topframe, "VMEAddr", fAddress = new TGNumberEntry( topframe ,0 ) , f0));
topframe->AddFrame( TGLabeledWidget(topframe, "Board No",fBoardNumber = new TGNumberEntry( topframe ,0 ) , f0));
fBoardNumber->Resize(50,fBoardNumber->GetDefaultHeight());
topframe->AddFrame( TGLabeledWidget(topframe, "Type", fBoardType = new TGNumberEntry( topframe ,2 ) , f0));
fAddress->SetFormat(TGNumberFormat::kNESHex);
fAddress->SetNumber(0x26000000);
fAddress->Resize(100,fAddress->GetDefaultHeight());
fBoardNumber->SetFormat(TGNumberFormat::kNESInteger,TGNumberFormat::kNEANonNegative);
fBoardType->SetFormat(TGNumberFormat::kNESInteger,TGNumberFormat::kNEANonNegative);
fBoardType->Resize(50,fBoardType->GetDefaultHeight());
fTpEnb = new TGCheckButton(topframe,"TpEnb",1);
fTpEnb->SetToolTipText("Enable or disable test pulse generation");
topframe->AddFrame( fTpEnb , f0 );
TGTextButton
*exit = new TGTextButton
(topframe
,"&Exit", "gApplication->Terminate()");
exit->ChangeOptions(exit->GetOptions() | kFixedWidth); // | kFixedSize
exit->Resize(80,exit->GetDefaultHeight());
topframe
->AddFrame
(exit, new TGLayoutHints
(kLHintsCenterX
,5,5,3,4));
AddFrame(topframe, f0);
// tab widget
TGTab *fTab = new TGTab(this,w,h);
// container of "Tab1"
TGCompositeFrame * fCompositeFrame0 = fTab->AddTab("Threshold Scan");
fCompositeFrame0->SetLayoutManager(new TGVerticalLayout(fCompositeFrame0));
ScanFrame(fCompositeFrame0 ,w,h);
// container of "Tab2"
TGCompositeFrame *fCompositeFrame1 = fTab->AddTab("Low Level");
fCompositeFrame1->SetLayoutManager(new TGVerticalLayout(fCompositeFrame1));
LowLevelFrame(fCompositeFrame1 ,w,h);
// container of "Tab3"
TGCompositeFrame *fCompositeFrame2 = fTab->AddTab("XY Scan");
fCompositeFrame2->SetLayoutManager(new TGVerticalLayout(fCompositeFrame2));
ScanXYFrame(fCompositeFrame2 ,w,h);
// container of "Tab4"
TGCompositeFrame *fCompositeFrame3 = fTab->AddTab("ASIC Parameters");
fCompositeFrame3->SetLayoutManager(new TGVerticalLayout(fCompositeFrame3));
SettingsFrame(fCompositeFrame3 ,w,h);
fTab->SetTab(0);
fTab->Resize(fTab->GetDefaultSize());
AddFrame(fTab, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
//fTab->MoveResize(2,8,486,328);
// status bar
Int_t parts[] = {33, 10, 10, 47};
fStatusBar = new TGStatusBar(this,50,10,kHorizontalFrame);
fStatusBar->SetParts(parts,4);
AddFrame(fStatusBar,new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX,0,0,2,0));
// fill status bar fields with information; selected is the object
// below the cursor; atext contains pixel coordinates info
/*
fStatusBar->SetText(selected->GetTitle(),0);
fStatusBar->SetText(selected->GetName(),1);
fStatusBar->SetText(atext,2);
StatusBar->SetText(selected->GetObjectInfo(px,py),3);
TGStatusBar *fStatusBar = new TGStatusBar(this, 3,w,24);
fStatusBar->SetName("fStatusBar");
AddFrame(fStatusBar, new TGLayoutHints(kLHintsBottom| kLHintsLeft | kLHintsExpandX));
*/
//fStatusBar1332->MoveResize(0,344,480,24);
// Sets window name and shows the main frame
SetWindowName("ARICH FEB User Interface");
MapSubwindows();
Resize(GetDefaultSize());
MapWindow();
fTimer = new TTimer(1000, kFALSE);
fTimer->Connect("Timeout()", "FebMainFrame", this, "GuiTimer()");
fTimer->TurnOn();
fTimer->Start(1000, kFALSE); // 1 second single-shot if kTRUE
// intercept routine
if (signal (SIGINT, sa02Timerast) == SIG_ERR)
{
}
fHisto=NULL;
set_plot_style();
}