testing with digitizers

This commit is contained in:
carina@hades 2022-09-26 14:22:15 -04:00
parent bdd55557c9
commit 995b19a262
3 changed files with 74 additions and 44 deletions

View File

@ -20,7 +20,7 @@
enum MenuIdentifiers{
M_DIGITIZER_SCAN,
M_DIGITIZER_OPEN,
M_FILE_OPEN,
M_EXIT,
M_TRIGGER_SUMMARY,
@ -60,7 +60,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
fMenuBar->AddPopup("&File", fMenuFile, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
fMenuDigitizers = new TGPopupMenu(gClient->GetRoot());
fMenuDigitizers->AddEntry("Scan &Digitizers", M_DIGITIZER_SCAN);
fMenuDigitizers->AddEntry("&Open Digitizers", M_DIGITIZER_OPEN);
fMenuDigitizers->AddEntry("&Trigger Summary", M_TRIGGER_SUMMARY);
fMenuDigitizers->AddSeparator();
fMenuDigitizers->AddEntry("Digitizer &Settings", M_BOARD_SETTINGS);
@ -89,7 +89,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
///================= Open digitizers
TGTextButton *bOpenDigitizers = new TGTextButton(hframe,"Open Digitizers");
bOpenDigitizers->Connect("Clicked()","MainWindow",this,"DetectDigitizer()");
bOpenDigitizers->Connect("Clicked()","MainWindow",this,"OpenDigitizers()");
hframe->AddFrame(bOpenDigitizers, uniLayoutHints);
///================= Start Run
@ -136,7 +136,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
LogMsg("Please \"Open Digitizers\" to start.");
//HandleMenu(M_DIGITIZER_SCAN);
//HandleMenu(M_DIGITIZER_OPEN);
//
//HandleMenu(M_BOARD_SETTINGS);
//HandleMenu(M_CH_SETTING_PHA);
@ -175,43 +175,14 @@ void MainWindow::HandleMenu(Int_t id){
switch(id){
///========================= Scan digitizers
case M_DIGITIZER_SCAN:{
case M_DIGITIZER_OPEN:{
LogMsg("============= detect digitizers \n");
DetectDigitizer();
printf("============= Connect %d digitizers...\n", nDigi);
if( nDigi > 0 ) {
digi = new Digitizer * [nDigi];
//pha = new DigitizerPHA * [nPHA];
//psd = new DigitizerPHA * [nPSD];
//
//iPHA = 0;
//iPSD = 0;
for( int i = 0; i < nDigi; i++){
printf("------------ %d \n", i);
if( DPPType[i] == V1730_DPP_PSD_CODE ) {
digi[i] = new DigitizerPSD(boardID[i], portID[i]);
printf("Open as PSD\n");
}else if( DPPType[i] == V1730_DPP_PHA_CODE ){
digi[i] = new DigitizerPHA(boardID[i], portID[i]);
printf("Open as PHA\n");
}else{
digi[i] = new Digitizer(boardID[i], portID[i]);
printf("Open as Ordinary Digitizer\n");
}
digi[i]->CreateAndSaveSettingBinary("setting_" + to_string(digi[i]->GetSerialNumber()) + ".bin");
}
OpenDigitizers();
//fMenuDigitizers->EnableEntry( M_TRIGGER_SUMMARY);
//fMenuDigitizers->EnableEntry( M_BOARD_SETTINGS);
//fMenuDigitizers->EnableEntry( M_CH_SETTING);
}
}break;
///========================= File Open
@ -277,8 +248,9 @@ void MainWindow::HandleMenu(Int_t id){
}
void MainWindow::DetectDigitizer(){
void MainWindow::OpenDigitizers(){
LogMsg("============= detect digitizers \n");
DPPType.clear();
portID.clear();
boardID.clear();
@ -302,12 +274,41 @@ void MainWindow::DetectDigitizer(){
}
}
LogMsg(Form("========== found %d digitizer \n", nDigi));
LogMsg(Form("========== found %d digitizer", nDigi));
for( int i = 0 ; i < nDigi ; i++){
LogMsg(Form("port: %d, board: %d, DPP Type : %d \n", portID[i], boardID[i], DPPType[i]));
LogMsg(Form("port: %d, board: %d, DPP Type : %d", portID[i], boardID[i], DPPType[i]));
}
LogMsg(Form("Number of PHA : %d", nPHA));
LogMsg(Form("Number of PSD : %d", nPSD));
if( nDigi > 0 ) {
LogMsg(Form("============= Connect %d digitizers...", nDigi));
digi = new Digitizer * [nDigi];
//pha = new DigitizerPHA * [nPHA];
//psd = new DigitizerPHA * [nPSD];
//
//iPHA = 0;
//iPSD = 0;
for( int i = 0; i < nDigi; i++){
printf("------------ %d \n", i);
if( DPPType[i] == V1730_DPP_PSD_CODE ) {
digi[i] = new DigitizerPSD(boardID[i], portID[i]);
printf("Open as PSD\n");
}else if( DPPType[i] == V1730_DPP_PHA_CODE ){
digi[i] = new DigitizerPHA(boardID[i], portID[i]);
printf("Open as PHA\n");
}else{
digi[i] = new Digitizer(boardID[i], portID[i]);
printf("Open as Ordinary Digitizer\n");
}
digi[i]->CreateAndSaveSettingBinary("setting_" + to_string(digi[i]->GetSerialNumber()) + ".bin");
}
}
LogMsg(Form("Number of PHA : %d \n", nPHA));
LogMsg(Form("Number of PSD : %d \n", nPSD));
}

View File

@ -78,7 +78,7 @@ public:
void HandleMenu(Int_t id);
void DetectDigitizer();
void OpenDigitizers();
//void GetADCTrace();
//void GetBaseLine();

29
settingSummary.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef SETTING_SUMMARY_H
#define SETTING_SUMMARY_H
#include <TQObject.h>
#include <RQ_OBJECT.h>
#include <TGNumberEntry.h>
#include <TGButton.h>
#include <TGComboBox.h>
#include <TThread.h>
#include <TGLabel.h>
#include "DigitizerPHA.h"
#include "DigitizerPSD.h"
#include "macro.h"
class TGWindow;
class TGMainFrame;
class SettingSummary{
private:
public:
SettingSummary(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard, uint32_t address);
virtual ~SettingSummary();
}
#endif