This commit is contained in:
Ryan Tang 2022-03-15 19:59:36 -04:00
parent afa71abb74
commit f8fb0a04ed
8 changed files with 240 additions and 45 deletions

View File

@ -51,7 +51,7 @@ pixieDAQ.o : pixieDict.cxx pixieDAQ.cpp pixieDAQ.h
mainSettings.o : mainSettings.cpp mainSettings.h
@echo "--------- creating mainSettings.o"
$(CC) $(CFLAGS) mainSettings.cpp $(ROOT_FLAG)
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) Pixie16Class.o mainSettings.cpp $(ROOT_FLAG)

View File

@ -23,14 +23,14 @@ F 25 0 /usr/opt/Pixie16/pixie16_revf_general_16b250m_35921_201
F 25 1 /usr/opt/Pixie16/pixie16_revf_general_16b250m_35921_2017-01-09/firmware/fippixie16_revfgeneral_16b250m_r36563.bin
F 25 2 /usr/opt/Pixie16/pixie16_revf_general_16b250m_35921_2017-01-09/dsp/Pixie16DSP_revfgeneral_16b250m_r35921.ldr
F 25 3 /usr/opt/Pixie16/pixie16_revf_general_16b250m_35921_2017-01-09/dsp/Pixie16DSP_revfgeneral_16b250m_r35921.var
F 25 4 /home/ryan/Pixie16/ryan/test_ryan.set
F 25 4 test_ryan.set
#250MHz 12-bit
F 12 0 /usr/opt/Pixie16/pixie16_revf_general_12b250m_41847_2019-05-18/firmware/syspixie16_revfgeneral_adc250mhz_r33339.bin
F 12 1 /usr/opt/Pixie16/pixie16_revf_general_12b250m_41847_2019-05-18/firmware/fippixie16_revfgeneral_12b250m_r42081.bin
F 12 2 /usr/opt/Pixie16/pixie16_revf_general_12b250m_41847_2019-05-18/dsp/Pixie16DSP_revfgeneral_12b250m_r41847.ldr
F 12 3 /usr/opt/Pixie16/pixie16_revf_general_12b250m_41847_2019-05-18/dsp/Pixie16DSP_revfgeneral_12b250m_r41847.var
F 12 4 /home/ryan/Pixie16/ryan/test_ryan.set
F 12 4 test_ryan.set
########################################################################################################################
#120 space buffer limit

View File

@ -171,6 +171,12 @@ void Pixie16::LoadConfigFile(bool verbose, std::string fileName){
DSPParFile = new char* [NumModules];
DSPVarFile = new char* [NumModules];
ModRev = new unsigned short [NumModules];
ModSerNum = new unsigned int [NumModules];
ModADCBits = new unsigned short [NumModules];
ModADCMSPS = new unsigned short [NumModules];
numChannels = new unsigned short [NumModules];
OfflineMode = 0;
BootPattern = 0x7F;
@ -255,23 +261,20 @@ void Pixie16::CheckHardware(){
void Pixie16::GetDigitizerInfo(unsigned short modID){
unsigned short ModRev;
unsigned int ModSerNum;
unsigned short ModADCBits;
unsigned short ModADCMSPS;
unsigned short numChannels;
retval = Pixie16ReadModuleInfo(modID, &ModRev, &ModSerNum, &ModADCBits, &ModADCMSPS, &numChannels);
//retval = Pixie16ReadModuleInfo(modID, &ModRev, &ModSerNum, &ModADCBits, &ModADCMSPS, &numChannels);
retval = Pixie16ReadModuleInfo(modID, &ModRev[modID], &ModSerNum[modID], &ModADCBits[modID], &ModADCMSPS[modID], &numChannels[modID]);
if( CheckError("Pixie16ReadModuleInfo") < 0 ) return ;
printf("------------ Module-%d \n", modID);
printf(" Revision : %d \n", ModRev);
printf(" Serial Num : %d \n", ModSerNum);
printf(" ADC Bits : %d \n", ModADCBits);
printf("ADC sampling rate : %d \n", ModADCMSPS);
printf(" # channels : %d \n", numChannels);
printf(" Revision : %d \n", ModRev[modID]);
printf(" Serial Num : %d \n", ModSerNum[modID]);
printf(" ADC Bits : %d \n", ModADCBits[modID]);
printf("ADC sampling rate : %d \n", ModADCMSPS[modID]);
printf(" # channels : %d \n", numChannels[modID]);
ch2ns[modID] = 1000/ModADCMSPS;
ch2ns[modID] = 1000/ModADCMSPS[modID];
}

View File

@ -50,8 +50,6 @@ private:
unsigned short * PXISlotMap;
unsigned short OfflineMode;
unsigned short * ch2ns;
char ** ComFPGAConfigFile;
char ** SPFPGAConfigFile;
char ** TrigFPGAConfigFile;
@ -59,6 +57,14 @@ private:
char ** DSPParFile;
char ** DSPVarFile;
unsigned short * ModRev;
unsigned int * ModSerNum;
unsigned short * ModADCBits;
unsigned short * ModADCMSPS;
unsigned short * numChannels;
unsigned short * ch2ns;
unsigned short BootPattern ;
int retval;
@ -111,6 +117,12 @@ public:
///========================= Setting
unsigned int GetNumModule() {return NumModules;}
unsigned int GetDigitizerSerialNumber(unsigned short modID) { return ModSerNum[modID];}
unsigned short GetDigitizerRev(unsigned short modID) { return ModRev[modID];}
unsigned short GetDigitizerADCBits(unsigned short modID) { return ModADCBits[modID];}
unsigned short GetDigitizerNumChannel(unsigned short modID) { return numChannels[modID];}
unsigned int GetDigitizerSetting(std::string parName, unsigned short modID, bool verbose = false);
void PrintDigitizerSettings(unsigned short modID);

View File

@ -5,19 +5,100 @@
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGLabel.h>
#include <TGNumberEntry.h>
#include <TGComboBox.h>
#include <TGComboBox.h>
#include "mainSettings.h"
MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h){
MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie){
this->pixie = pixie;
/// Create a main frame
fMain = new TGMainFrame(p,w,h);
fMain->SetWindowName("Pixie16 Channel Settings ");
fMain->Connect("CloseWindow()", "MainSettings", this, "CloseWindow()");
/// Set a name to the main frame
fMain->SetWindowName("Pixie16 Main Settings");
/// Map main frame
///Module choose
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain, w, 50 );
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
TGLabel * lb1 = new TGLabel(hframe, "Module ID : ");
//lb1->SetWidth(50); lb1->ChangeOptions( kFixedSize);
hframe->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
TGNumberEntry * modIDEntry = new TGNumberEntry(hframe, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
modIDEntry->SetWidth(50);
modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1);
hframe->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
///Show Setting
TGVerticalFrame *hframeSettings = new TGVerticalFrame(fMain, w, 600 );
fMain->AddFrame(hframeSettings, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
int modID = modIDEntry->GetNumber();
int maxCh = pixie->GetDigitizerNumChannel(modID);
//int numItems = 3;
//TString labelText[numItems] = {"CH", "ON/off", "Gain"};
//TGLabel ** labelItems = new TGLabel * [numItems];
//TGVerticalFrame ** hframeItems = new TGVerticalFrame * [numItems];
//
//for( int j = 0; i < numItems; j++){
//
// hframeItems[j] = new TGVerticalFrame(hframeSettings, 100, 600);
// hframeSettings->AddFrame(hframeItems[j], new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
//
//
//
//
//
//}
//
//for( int i = 0; i < 3; i++){
// labelItems[i] = new TGLabel(hframeLabel, Form("%s", labelText[i].Data()));
// hframeLabel->AddFrame(labelItems[i],new TGLayoutHints(kLHintsCenterX, 2,2,2,2) );
//}
TGHorizontalFrame ** hframeCh = new TGHorizontalFrame * [maxCh];
TGLabel ** lbCh = new TGLabel * [maxCh];
TGComboBox ** cbOnOff = new TGComboBox * [maxCh];
TGComboBox ** cbGain = new TGComboBox * [maxCh];
for( int i = 0; i < maxCh ; i ++){
hframeCh[i] = new TGHorizontalFrame(hframeSettings, w, 600 );
hframeSettings->AddFrame(hframeCh[i], new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
lbCh[i] = new TGLabel(hframeCh[i] , Form("%02d", i));
hframeCh[i]->AddFrame(lbCh[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
cbOnOff[i] = new TGComboBox(hframeCh[i], i);
cbOnOff[i]->AddEntry("ON", 1);
cbOnOff[i]->AddEntry("off", 2);
cbOnOff[i]->Resize(50, 20);
pixie->GetChannelOnOff(modID, i) ? cbOnOff[i]->Select(1) : cbOnOff[i]->Select(2);
hframeCh[i]->AddFrame(cbOnOff[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
cbGain[i] = new TGComboBox(hframeCh[i], i);
cbGain[i]->AddEntry("x1", 1);
cbGain[i]->AddEntry("x1/4", 2);
cbGain[i]->Resize(50, 20);
pixie->GetChannelGain(modID, i) ? cbGain[i]->Select(1) : cbGain[i]->Select(2);
hframeCh[i]->AddFrame(cbGain[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
//TGNumberEntry * modIDEntry = new TGNumberEntry(hframe, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
}
fMain->MapSubwindows();
fMain->Resize(fMain->GetDefaultSize());
fMain->MapWindow();
}

View File

@ -3,6 +3,8 @@
#include <TQObject.h>
#include "Pixie16Class.h"
class TGWindow;
class TGMainFrame;
@ -10,10 +12,15 @@ class MainSettings{
private:
TGMainFrame * fMain;
Pixie16 * pixie;
public:
MainSettings(const TGWindow *p, UInt_t w, UInt_t h);
MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie);
virtual ~MainSettings();
void CloseWindow() { printf("close window\n"); delete this; }
};

View File

@ -5,11 +5,25 @@
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGMenu.h>
#include <TGLabel.h>
#include <TGNumberEntry.h>
#include <TGraph.h>
#include <TAxis.h>
#include "pixieDAQ.h"
enum MenuIdentifiers{
M_FILE_OPEN,
M_EXIT,
M_MAIN_CH_SETTINGS,
M_CH_SETTING,
M_DIGITIZER_SETTINGS,
M_DIGITIZER_INFOS
};
MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
openPixie();
@ -17,21 +31,65 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
/// Create a main frame
fMain = new TGMainFrame(p,w,h);
///fMain->SetWMPosition(500, 500); //does not work
fMain->Connect("CloseWindow()", "MainWindow", this, "GoodBye()");
///menu
fMenuBar = new TGMenuBar(fMain, 1, 1, kHorizontalFrame);
fMain->AddFrame(fMenuBar, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
fMenuFile = new TGPopupMenu(gClient->GetRoot());
fMenuFile->AddEntry("&Open...", M_FILE_OPEN);
fMenuFile->AddSeparator();
fMenuFile->AddEntry("E&xit", M_EXIT);
fMenuFile->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)");
fMenuBar->AddPopup("&File", fMenuFile, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
fMenuSettings = new TGPopupMenu(gClient->GetRoot());
fMenuSettings->AddEntry("&Main Ch Settings", M_MAIN_CH_SETTINGS);
fMenuSettings->AddEntry("&Channel Setting", M_CH_SETTING);
fMenuSettings->AddSeparator();
fMenuSettings->AddEntry("Digitizer &Settings", M_DIGITIZER_SETTINGS);
fMenuSettings->AddEntry("Digitizer &Info", M_DIGITIZER_INFOS);
fMenuSettings->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)");
fMenuBar->AddPopup("&Settings", fMenuSettings, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
/// Create a horizontal frame widget with buttons
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain,200,40);
TGLabel * lb1 = new TGLabel(hframe, "Module ID :");
hframe->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
modIDEntry = new TGNumberEntry(hframe, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
modIDEntry->SetWidth(50);
modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1);
hframe->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
TGLabel * lb2 = new TGLabel(hframe, "Ch :");
hframe->AddFrame(lb2, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
chEntry = new TGNumberEntry(hframe, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
chEntry->SetWidth(50);
chEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetDigitizerNumChannel(0));
hframe->AddFrame(chEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
TGTextButton *bGetADCTrace = new TGTextButton(hframe,"&Get ADC Trace");
bGetADCTrace->Connect("Clicked()","MainWindow",this,"getADCTrace()");
hframe->AddFrame(bGetADCTrace, new TGLayoutHints(kLHintsCenterX, 5,5,3,4));
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2));
/// 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,"getADCTrace()");
hframe->AddFrame(draw, new TGLayoutHints(kLHintsCenterX, 5,5,3,4));
TGTextButton *exit = new TGTextButton(hframe,"&Exit");
exit->Connect("Clicked()", "MainWindow", this, "GoodBye()");
//===== TODO add msg box
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("Pixie16 DAQ");
@ -45,7 +103,6 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
/// Map main frame
fMain->MapWindow();
///================ pixie
///printf("Removing Pixie16Msg.log \n");
///remove( "Pixie16Msg.log");
@ -60,6 +117,28 @@ MainWindow::~MainWindow() {
/// Clean up used widgets: frames, buttons, layout hints
fMain->Cleanup();
delete fMain;
delete fMenuBar;
delete fMenuFile;
delete fMenuSettings;
}
void MainWindow::HandleMenu(Int_t id){
switch(id){
case M_FILE_OPEN:{
}break;
case M_EXIT: GoodBye(); break;
case M_MAIN_CH_SETTINGS: {
mainSettings = new MainSettings(gClient->GetRoot(), 600, 600, pixie);
}break;
}
}
void MainWindow::openPixie(){
@ -76,20 +155,14 @@ void MainWindow::openPixie(){
}
void MainWindow::getADCTrace() {
/// Draws function graphics in randomly chosen interval
///TF1 *f1 = new TF1("f1","sin(x)/x",0,gRandom->Rndm()*10);
///f1->SetLineWidth(3);
///f1->Draw();
mainSettings = new MainSettings(gClient->GetRoot(), 800, 600);
printf("--------- get ADCTrace \n");
int ch = 6;
pixie->CaptureADCTrace(0, ch);
int modID = modIDEntry->GetNumber();
int ch = chEntry->GetNumber();
pixie->CaptureADCTrace(modID, ch);
unsigned short * haha = pixie->GetADCTrace();
double dt = pixie->GetChannelSetting("XDT", 0, ch);
double dt = pixie->GetChannelSetting("XDT", modID, ch);
TGraph * gTrace = new TGraph();
@ -106,6 +179,7 @@ void MainWindow::getADCTrace() {
}
void MainWindow::GoodBye(){
pixie->CloseDigitizers();

View File

@ -1,12 +1,18 @@
#include <TQObject.h>
#include <RQ_OBJECT.h>
#include <TROOT.h>
#include <TClass.h>
#include <TGClient.h>
#include <TGMenu.h>
#include "Pixie16Class.h"
#include "mainSettings.h"
class TGWindow;
class TGMainFrame;
class TRootEmbeddedCanvas;
class TGNumberEntry;
class MainWindow {
RQ_OBJECT("MainWindow")
@ -14,20 +20,32 @@ private:
TGMainFrame *fMain;
TRootEmbeddedCanvas *fEcanvas;
TGMenuBar *fMenuBar;
TGPopupMenu *fMenuFile, *fMenuSettings;
TGNumberEntry * modIDEntry, *chEntry;
Pixie16 * pixie;
MainSettings * mainSettings;
public:
MainWindow(const TGWindow *p, UInt_t w, UInt_t h);
virtual ~MainWindow();
void HandleMenu(Int_t id);
void openPixie();
void getADCTrace();
void openMainSettings();
void GoodBye();
};