should focus on 1 board frist

This commit is contained in:
splitPoleDAQ 2022-08-04 18:02:03 -04:00
parent 14731d5dea
commit 35278fc37b
8 changed files with 123 additions and 112 deletions

View File

@ -39,7 +39,7 @@ void Digitizer::Reset(){
if( ret != 0 ) ErrorMsg("Reset");
}
int Digitizer::OpenDigitizer(int boardID, int portID){
int Digitizer::OpenDigitizer(int boardID, int portID, bool verbose){
this->boardID = boardID;
this->portID = portID;
@ -48,7 +48,7 @@ int Digitizer::OpenDigitizer(int boardID, int portID){
/** Open the digitizer and read board information */
/***************************************************/
printf("============= Opening Digitizer at Board %d, Port %d \n", boardID, portID);
if( verbose) printf("============= Opening Digitizer at Board %d, Port %d \n", boardID, portID);
///-------- try USB first
LinkType = CAEN_DGTZ_USB; /// Link Type
@ -59,41 +59,43 @@ int Digitizer::OpenDigitizer(int boardID, int portID){
}
if (ret != 0) {
printf("Can't open digitizer\n");
if( verbose) printf("Can't open digitizer\n");
}else{
///----- Getting Board Info
ret = (int) CAEN_DGTZ_GetInfo(handle, &BoardInfo);
if (ret != 0) {
printf("Can't read board info\n");
if( verbose) printf("Can't read board info\n");
}else{
isConnected = true;
printf("Connected to Model %s with handle %d using %s\n", BoardInfo.ModelName, handle, LinkType == CAEN_DGTZ_USB ? "USB" : "Optical Link");
NChannel = BoardInfo.Channels;
channelMask = pow(2, NChannel)-1;
switch(BoardInfo.Model){
case CAEN_DGTZ_V1730: ch2ns = 2.0; break; ///ns -> 500 MSamples/s
case CAEN_DGTZ_V1725: ch2ns = 4.0; break; ///ns -> 250 MSamples/s
}
ADCbits = BoardInfo.ADC_NBits;
ADCFullSize = (unsigned int)( pow(2, ADCbits) -1 );
if( verbose) {
printf("Connected to Model %s with handle %d using %s\n", BoardInfo.ModelName, handle, LinkType == CAEN_DGTZ_USB ? "USB" : "Optical Link");
printf("Sampling rate : %.0f MHz = %.1f ns \n", 1000/ch2ns, ch2ns);
printf("Number of Channels : %d = 0x%X\n", NChannel, channelMask);
printf("SerialNumber :\e[1m\e[33m %d\e[0m\n", BoardInfo.SerialNumber);
ADCbits = BoardInfo.ADC_NBits;
ADCFullSize = (unsigned int)( pow(2, ADCbits) -1 );
printf("ADC bit is \e[33m%d\e[0m, %d = 0x%x\n", ADCbits, ADCFullSize, ADCFullSize);
printf("ROC FPGA Release is %s\n", BoardInfo.ROC_FirmwareRel);
printf("AMC FPGA Release is %s\n", BoardInfo.AMC_FirmwareRel);
}
int DPPType;
sscanf(BoardInfo.AMC_FirmwareRel, "%d", &DPPType);
if (DPPType != V1730_DPP_PHA_CODE) {
printf("This digitizer does not have DPP-PHA firmware\n");
if( verbose) printf("This digitizer does not have DPP-PHA firmware\n");
}
}
}
// Check firmware revision (DPP firmwares cannot be used with this demo */
sscanf(BoardInfo.AMC_FirmwareRel, "%d", &DPPType);
if (DPPType >= 128) {
if (DPPType >= 128 && verbose) {
printf("\t==== This digitizer has a DPP firmware!\n");
printf("\e[32m");
switch (DPPType){
@ -115,6 +117,7 @@ int Digitizer::OpenDigitizer(int boardID, int portID){
int probes[MAX_SUPPORTED_PROBES];
int numProbes;
ret = CAEN_DGTZ_GetDPP_SupportedVirtualProbes(handle, 1, probes, &numProbes);
if( verbose ){
printf("\t==== supported virtual probe (number of Probe : %d)\n", numProbes);
for( int i = 0 ; i < numProbes; i++){
switch (probes[i]){
@ -152,6 +155,7 @@ int Digitizer::OpenDigitizer(int boardID, int portID){
case 31: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_PrgVeto \n"); break;
}
}
}
ErrorMsg("end of OpenDigitizer");
@ -164,6 +168,7 @@ int Digitizer::OpenDigitizer(int boardID, int portID){
int Digitizer::CloseDigitizer(){
isConnected = false;
printf("-------- Closing Digtizer Board : %d Port : %d \n", boardID, portID);
printf(" Model %s with handle %d using %s\n", BoardInfo.ModelName, handle, LinkType == CAEN_DGTZ_USB ? "USB" : "Optical Link");
ret = CAEN_DGTZ_SWStopAcquisition(handle);
@ -295,35 +300,12 @@ void Digitizer::SetChannelMask(uint32_t mask){
ErrorMsg("SetChannelMask");
}
void Digitizer::SetRecordLength(unsigned int nSample, int ch){
WriteRegister( Register::DPP::RecordLength, nSample / 8, ch);
ErrorMsg("SetRecordLength");
}
void Digitizer::SetEventAggregation(unsigned int numEvent, int ch){
WriteRegister( Register::DPP::NumberEventsPerAggregate, numEvent, ch);
ErrorMsg("SetEventAggregation");
}
void Digitizer::SetInputDynamicRange(unsigned int TwoVol_0_or_halfVol_1, int ch){
WriteRegister( Register::InputDynamicRange, TwoVol_0_or_halfVol_1, ch);
ErrorMsg("SetInputDynamicRange");
}
void Digitizer::SetNumSamplePreTrigger(unsigned int nSample, int ch){
WriteRegister( Register::DPP::PreTrigger, nSample / 4, ch);
ErrorMsg("SetNumSamplePreTrigger");
}
void Digitizer::SetDCOffset(float offsetPrecentage, int ch){
WriteRegister( Register::DPP::ChannelDCOffset, uint( ADCFullSize * offsetPrecentage), ch );
ErrorMsg("SetDCOffset");
}
void Digitizer::SetVetoWidth(uint32_t bit, int ch){
WriteRegister( Register::DPP::VetoWidth, bit, ch);
ErrorMsg("SetVetoWidth");
}
void Digitizer::SetRecordLength(unsigned int nSample, int ch) { WriteRegister( Register::DPP::RecordLength, nSample / 8, ch); ErrorMsg("SetRecordLength"); }
void Digitizer::SetEventAggregation(unsigned int numEvent, int ch) { WriteRegister( Register::DPP::NumberEventsPerAggregate, numEvent, ch); ErrorMsg("SetEventAggregation"); }
void Digitizer::SetInputDynamicRange(unsigned int TwoVol_0_or_halfVol_1, int ch){ WriteRegister( Register::InputDynamicRange, TwoVol_0_or_halfVol_1, ch); ErrorMsg("SetInputDynamicRange");}
void Digitizer::SetNumSamplePreTrigger(unsigned int nSample, int ch) { WriteRegister( Register::DPP::PreTrigger, nSample / 4, ch); ErrorMsg("SetNumSamplePreTrigger");}
void Digitizer::SetDCOffset(float offsetPrecentage, int ch) { WriteRegister( Register::DPP::ChannelDCOffset, uint( ADCFullSize * offsetPrecentage), ch ); ErrorMsg("SetDCOffset");}
void Digitizer::SetVetoWidth(uint32_t bit, int ch) { WriteRegister( Register::DPP::VetoWidth, bit, ch); ErrorMsg("SetVetoWidth");}
void Digitizer::SetTriggerPolarity(bool RiseingIsZero, int ch ){
if( ch < 0 ) {

View File

@ -49,7 +49,7 @@ class Digitizer{
~Digitizer();
void Reset();
int OpenDigitizer(int boardID, int portID = 0);/// portID is for optical link for using PCIe card, from 0, 1, 2, 3
int OpenDigitizer(int boardID, int portID = 0, bool verbose = false);/// portID is for optical link for using PCIe card, from 0, 1, 2, 3
int CloseDigitizer();
///=================Settings
@ -79,8 +79,10 @@ class Digitizer{
int GetChTemperature(int ch) ;
bool GetConnectionStatus() {return isConnected;}
int GetDPPType() {return DPPType;}
void PrintBoardConfiguration();
uint32_t GetChannelStatus(unsigned int ch);
///================ ACQ control
void StopACQ();

View File

@ -125,7 +125,6 @@ void DigitizerPHA::GetChannelSettingFromDigitizer(int ch){
case 4 : extra2WordOptStr = "[0:15] Total Trigger Counter [16:31] Lost Trigger Counter"; break;
case 5 : extra2WordOptStr = "[0:15] Event After the Zero Crossing [16:31] Event Before the Zero Crossing"; break;
default: extra2WordOptStr = "Reserved"; break;
}
printf(" ch2ns : %.0f ns\n", ch2ns);

View File

@ -28,15 +28,18 @@ enum MenuIdentifiers{
M_SHOW_CHANNELS_RATE
};
//TODO timed Run, //pixie->SetDigitizerPresetRunTime(100000, 0);
///make static members
DigitizerPHA * MainWindow::digi = NULL;
TGTextEdit * MainWindow::teLog = NULL;
TRootEmbeddedCanvas * MainWindow::fEcanvas = NULL;
MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
DetectDigitizer();
digi = new DigitizerPHA(0,0);
/// Create a main frame
fMain = new TGMainFrame(p,w,h);
///fMain->SetWMPosition(500, 500); //does not work
@ -45,7 +48,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
fMenuBar = new TGMenuBar(fMain, 1, 1, kHorizontalFrame);
fMain->AddFrame(fMenuBar, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
fMenuFile = new TGPopupMenu(gClient->GetRoot());
fMenuFile->AddEntry("&Open Pixie16.config", M_FILE_OPEN);
fMenuFile->AddEntry("&Open File", M_FILE_OPEN);
fMenuFile->AddSeparator();
fMenuFile->AddEntry("E&xit", M_EXIT);
fMenuFile->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)");
@ -67,7 +70,8 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
fMenuUtility->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)");
fMenuBar->AddPopup("&Utility", fMenuUtility, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
TGLayoutHints * uniLayoutHints = new TGLayoutHints(kLHintsNormal, 2,2,10,0); ///left, right, top, bottom
/// Create a horizontal frame widget with buttons
///================= Create a horizontal frame widget with buttons
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain,200,40);
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2));
@ -88,7 +92,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
teLog = new TGTextEdit(groupLog, w, 100);
groupLog->AddFrame(teLog, new TGLayoutHints(kLHintsNormal, 0,0,10,0));
/// Set a name to the main frame
fMain->SetWindowName("Pixie16 DAQ");
fMain->SetWindowName("FSU DAQ");
/// Map all subwindows of main frame
fMain->MapSubwindows();
/// Initialize the layout algorithm
@ -103,13 +107,11 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
//fillHistThread = new TThread("kakaka", FillHistogram, (void *) 1);
///settingsSummary = NULL;
///moduleSetting = NULL;
//boardSetting = NULL;
///channelSetting = NULL;
///scalarPanel = NULL;
///bStopRun->SetEnabled(false);
LogMsg("Boot OK and ready to run.");
LogMsg("Ready to run.");
///HandleMenu(M_CH_SETTINGS_SUMMARY);
@ -125,14 +127,10 @@ MainWindow::~MainWindow() {
//delete tePath;
delete teLog;
//delete bStartRun;
//delete bStopRun;
//delete bFitTrace;
delete digi;
//delete settingsSummary;
//delete moduleSetting;
//delete boardSetting;
//delete channelSetting;
//delete scalarPanel;
//
@ -140,8 +138,6 @@ MainWindow::~MainWindow() {
//delete fillHistThread;
//
//delete gTrace;
//
//delete configEditor;
/// Clean up used widgets: frames, buttons, layout hints
fMain->Cleanup();
@ -194,6 +190,35 @@ void MainWindow::HandleMenu(Int_t id){
}
void MainWindow::DetectDigitizer(){
Digitizer * dig = new Digitizer();
vector<int> DPPType;
vector<int> portID;
vector<int> boardID;
int nDigi = 0;
for( int port = 0; port < 4 ; port ++){
for( int board = 0; board < 3 ; board ++){
dig->OpenDigitizer(board, port);
if ( dig->GetConnectionStatus() ) {
nDigi++;
DPPType.push_back(dig->GetDPPType());
portID.push_back(port);
boardID.push_back(board);
dig->CloseDigitizer();
}
}
}
printf("========== found %d digitizer \n", nDigi);
for( int i = 0 ; i < nDigi ; i++){
printf("port: %d, board: %d, DPP Type : %d \n", portID[i], boardID[i], DPPType[i]);
}
}
Double_t standardPulse(Double_t *x, Double_t * par){
/// par[0] = start time
@ -213,7 +238,7 @@ Double_t standardPulse(Double_t *x, Double_t * par){
void MainWindow::GoodBye(){
//pixie->CloseDigitizers();
digi->CloseDigitizer();
printf("----- bye bye ---- \n");
@ -239,7 +264,7 @@ void MainWindow::LogMsg(TString msg){
//############################################
int main(int argc, char **argv) {
printf(" Welcome to pixie16 DQ \n");
printf(" Welcome to FSU DQ \n");
TApplication theApp("App",&argc,argv);
new MainWindow(gClient->GetRoot(),800,800);

View File

@ -16,8 +16,8 @@
///#include "global_macro.h"
///#include "settingsSummary.h"
///#include "scalarPanel.h"
///#include "moduleSetting.h"
///#include "channelSetting.h"
//#include "boardSetting.h"
//#include "channelSetting.h"
class TGWindow;
class TGMainFrame;
class TRootEmbeddedCanvas;
@ -30,7 +30,7 @@ private:
TGMenuBar *fMenuBar;
TGPopupMenu *fMenuFile, *fMenuSettings, *fMenuUtility;
//
//static TGNumberEntry * modIDEntry, *chEntry;
//TGNumberEntry * runIDEntry;
//TGTextEntry * tePath;
@ -43,9 +43,9 @@ private:
static DigitizerPHA * digi;
//
//SettingsSummary * settingsSummary;
//ModuleSetting * moduleSetting;
///ModuleSetting * moduleSetting;
//ChannelSetting * channelSetting;
//ScalarPanel * scalarPanel;
//
@ -63,6 +63,8 @@ public:
void HandleMenu(Int_t id);
void DetectDigitizer();
//void GetADCTrace();
//void GetBaseLine();
//void Scope();

Binary file not shown.

View File

@ -15,7 +15,7 @@ OBJS = DigitizerClass.o DigitizerPHA.o DigitizerPSD.o FSUDAQ.o
#########################################################################
all : test
all : test FSUDAQ
clean :
/bin/rm -f $(OBJS) test FSUDAQ FSUDAQDict.cxx *.pcm
@ -35,7 +35,8 @@ test : test.cpp DigitizerClass.o DigitizerPHA.o DigitizerPSD.o
FSUDAQDict.cxx : FSUDAQ.h FSUDAQLinkDef.h
@echo "----------- creating pcm and cxx for root"
@rootcling -f FSUDAQDict.cxx -c FSUDAQ.h -p FSUDAQLinkDef.h $(CAENLIBS)
# @rootcling -f FSUDAQDict.cxx -c FSUDAQ.h -p FSUDAQLinkDef.h $(CAENLIBS)
@rootcling -f FSUDAQDict.cxx -c FSUDAQ.h -p FSUDAQLinkDef.h
FSUDAQ.o : FSUDAQ.h FSUDAQ.cpp FSUDAQDict.cxx
@echo "----------- creating FSUDAQ.o"

View File

@ -6,8 +6,8 @@ int main(int argc, char* argv[]){
DigitizerPHA * dig = new DigitizerPHA[2];
//DigitizerPSD * psd = new DigitizerPSD();
dig[0].OpenDigitizer(0,0);
dig[1].OpenDigitizer(1,0);
dig[0].OpenDigitizer(0,0, true);
dig[1].OpenDigitizer(1,0, true);
//psd->OpenDigitizer(2,0);