can plot trace at FSUDAQ
This commit is contained in:
parent
826c54ed52
commit
58cb570542
|
@ -334,7 +334,7 @@ void Digitizer::ReadData(){
|
||||||
|
|
||||||
ret = CAEN_DGTZ_ReadData(handle, CAEN_DGTZ_SLAVE_TERMINATED_READOUT_MBLT, data->buffer, &(data->nByte));
|
ret = CAEN_DGTZ_ReadData(handle, CAEN_DGTZ_SLAVE_TERMINATED_READOUT_MBLT, data->buffer, &(data->nByte));
|
||||||
uint32_t EventSize = ReadRegister(Register::DPP::EventSize); // Is it as same as data->nByte?
|
uint32_t EventSize = ReadRegister(Register::DPP::EventSize); // Is it as same as data->nByte?
|
||||||
//printf("Read Buffer size %d byte, Event Size : %d byte \n", data->nByte, EventSize);
|
printf("Read Buffer size %d byte, Event Size : %d byte \n", data->nByte, EventSize);
|
||||||
|
|
||||||
if (ret || data->nByte == 0) {
|
if (ret || data->nByte == 0) {
|
||||||
ErrorMsg(__func__);
|
ErrorMsg(__func__);
|
||||||
|
@ -582,8 +582,8 @@ int Digitizer::ProgramPHABoard(){
|
||||||
ret = CAEN_DGTZ_Reset(handle);
|
ret = CAEN_DGTZ_Reset(handle);
|
||||||
printf("======== program board PHA\n");
|
printf("======== program board PHA\n");
|
||||||
|
|
||||||
ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::RecordLength_G + 0x7000, 625);
|
ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::RecordLength_G + 0x7000, 250);
|
||||||
ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::BoardConfiguration, 0x4E8115);
|
ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::BoardConfiguration, 0x84F8115);
|
||||||
|
|
||||||
//TODO change to write register
|
//TODO change to write register
|
||||||
ret = CAEN_DGTZ_SetAcquisitionMode(handle, CAEN_DGTZ_SW_CONTROLLED); /// software command
|
ret = CAEN_DGTZ_SetAcquisitionMode(handle, CAEN_DGTZ_SW_CONTROLLED); /// software command
|
||||||
|
|
74
FSUDAQ.cpp
74
FSUDAQ.cpp
|
@ -114,10 +114,11 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
fMain->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,10));
|
fMain->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,10));
|
||||||
///================= Log massage
|
///================= Log massage
|
||||||
TGGroupFrame * groupLog = new TGGroupFrame(fMain, "Log Message", kHorizontalFrame);
|
TGGroupFrame * groupLog = new TGGroupFrame(fMain, "Log Message", kHorizontalFrame);
|
||||||
fMain->AddFrame(groupLog, new TGLayoutHints(kLHintsCenterX, 5,5,0,5) );
|
fMain->AddFrame(groupLog, new TGLayoutHints(kLHintsExpandX, 10,10,10,10) );
|
||||||
|
|
||||||
teLog = new TGTextEdit(groupLog, w, 100);
|
teLog = new TGTextEdit(groupLog, w, 100); groupLog->AddFrame(teLog, new TGLayoutHints(kLHintsExpandX, 2,2,10,0) );
|
||||||
groupLog->AddFrame(teLog, new TGLayoutHints(kLHintsNormal, 0,0,10,0));
|
|
||||||
|
|
||||||
/// Set a name to the main frame
|
/// Set a name to the main frame
|
||||||
fMain->SetWindowName("FSU DAQ");
|
fMain->SetWindowName("FSU DAQ");
|
||||||
/// Map all subwindows of main frame
|
/// Map all subwindows of main frame
|
||||||
|
@ -146,6 +147,12 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
//HandleMenu(M_CH_SETTING_PHA);
|
//HandleMenu(M_CH_SETTING_PHA);
|
||||||
//HandleMenu(M_CH_SETTING_PSD);
|
//HandleMenu(M_CH_SETTING_PSD);
|
||||||
|
|
||||||
|
gAnaTrace1 = NULL;
|
||||||
|
gAnaTrace2 = NULL;
|
||||||
|
gDigiTrace1 = NULL;
|
||||||
|
gDigiTrace2 = NULL;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
delete fMenuBar;
|
delete fMenuBar;
|
||||||
|
@ -168,8 +175,12 @@ MainWindow::~MainWindow() {
|
||||||
//
|
//
|
||||||
//delete saveDataThread;
|
//delete saveDataThread;
|
||||||
//delete fillHistThread;
|
//delete fillHistThread;
|
||||||
//
|
|
||||||
//delete gTrace;
|
delete gAnaTrace1;
|
||||||
|
delete gAnaTrace2;
|
||||||
|
delete gDigiTrace1;
|
||||||
|
delete gDigiTrace2;
|
||||||
|
|
||||||
|
|
||||||
/// Clean up used widgets: frames, buttons, layout hints
|
/// Clean up used widgets: frames, buttons, layout hints
|
||||||
fMain->Cleanup();
|
fMain->Cleanup();
|
||||||
|
@ -367,6 +378,59 @@ void MainWindow::LogMsg(char * msg){
|
||||||
void MainWindow::PlotTrace(){
|
void MainWindow::PlotTrace(){
|
||||||
printf("=== %s\n", __func__);
|
printf("=== %s\n", __func__);
|
||||||
|
|
||||||
|
Data * data = digi[0]->GetData();
|
||||||
|
data->AllocateMemory();
|
||||||
|
data->DPPType = digi[0]->GetDPPType();
|
||||||
|
|
||||||
|
int ch2ns = (int) digi[0]->GetCh2ns();
|
||||||
|
|
||||||
|
digi[0]->StartACQ();
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
while(count < 10){
|
||||||
|
//sleep(1);
|
||||||
|
usleep(500*1000); /// wait half sec
|
||||||
|
digi[0]->ReadData();
|
||||||
|
|
||||||
|
if( data->nByte > 0 ){
|
||||||
|
data->DecodeBuffer(1);
|
||||||
|
|
||||||
|
data->PrintStat();
|
||||||
|
|
||||||
|
delete gAnaTrace1; gAnaTrace1 = new TGraph();
|
||||||
|
delete gDigiTrace1; gDigiTrace1 = new TGraph();
|
||||||
|
|
||||||
|
int traceLength = (data->Waveform1[0][0]).size();
|
||||||
|
|
||||||
|
printf("0----------%d \n", traceLength);
|
||||||
|
|
||||||
|
if( traceLength == 0 ) {
|
||||||
|
LogMsg("no trace");
|
||||||
|
}else{
|
||||||
|
for( int i = 0; i < traceLength ; i++) {
|
||||||
|
//printf("%d, ", (data->Waveform1[0][0])[i]);
|
||||||
|
gAnaTrace1->SetPoint(i, i*ch2ns, (data->Waveform1[0][0])[i]);
|
||||||
|
gDigiTrace1->SetPoint(i, i*ch2ns, 2000*(data->DigiWaveform1[0][0])[i] + 2000);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data->ClearData();
|
||||||
|
|
||||||
|
fEcanvas->GetCanvas()->cd();
|
||||||
|
gAnaTrace1->Draw("APL");
|
||||||
|
gDigiTrace1->Draw("L");
|
||||||
|
fEcanvas->GetCanvas()->Update();
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
count++;
|
||||||
|
|
||||||
|
};
|
||||||
|
digi[0]->StopACQ();
|
||||||
|
if( count == 10 ) LogMsg("Plot Trace TimeOut, please check setting");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//############################################
|
//############################################
|
||||||
|
|
7
FSUDAQ.h
7
FSUDAQ.h
|
@ -69,8 +69,11 @@ private:
|
||||||
//static TH1F * hEnergy[MAXMOD][MAXCH];
|
//static TH1F * hEnergy[MAXMOD][MAXCH];
|
||||||
//static TH1F * hChannel[MAXMOD];
|
//static TH1F * hChannel[MAXMOD];
|
||||||
//static bool isEnergyHistFilled;
|
//static bool isEnergyHistFilled;
|
||||||
//TGraph * gTrace;
|
|
||||||
//
|
TGraph * gAnaTrace1; /// analogy trace 1
|
||||||
|
TGraph * gAnaTrace2; /// analogy trace 2
|
||||||
|
TGraph * gDigiTrace1; /// digital trace 1
|
||||||
|
TGraph * gDigiTrace2; /// digital trace 1
|
||||||
//TGTextEditor * configEditor;
|
//TGTextEditor * configEditor;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -917,7 +917,7 @@ void BoardSetting::ChangeBoard(){
|
||||||
cbDP1->AddEntry("Armed (Triggered)", 1);
|
cbDP1->AddEntry("Armed (Triggered)", 1);
|
||||||
cbDP1->AddEntry("Peak Run", 2);
|
cbDP1->AddEntry("Peak Run", 2);
|
||||||
cbDP1->AddEntry("Pile-Up", 3);
|
cbDP1->AddEntry("Pile-Up", 3);
|
||||||
cbDP1->AddEntry("Peaking", 4);
|
///cbDP1->AddEntry("Peaking", 4); Duplicated?
|
||||||
cbDP1->AddEntry("TRG Validation Win.", 5);
|
cbDP1->AddEntry("TRG Validation Win.", 5);
|
||||||
cbDP1->AddEntry("Baseline freeze", 6);
|
cbDP1->AddEntry("Baseline freeze", 6);
|
||||||
cbDP1->AddEntry("TRG holdoff", 7);
|
cbDP1->AddEntry("TRG holdoff", 7);
|
||||||
|
@ -1080,7 +1080,7 @@ void BoardSetting::SetBoardConfiguration(){
|
||||||
uint32_t bit = (3 << 18); /// timestamp and energy recording
|
uint32_t bit = (3 << 18); /// timestamp and energy recording
|
||||||
if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ) {
|
if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ) {
|
||||||
|
|
||||||
bit += (18 << 3) ; /// Reserved must be 0010010 for bit[10:3]
|
bit += (34 << 3) ; /// Reserved must be 0010010 for bit[10:3]
|
||||||
if( bAutoDataFlush->GetState() == kButtonDown ) { bit += 1;};
|
if( bAutoDataFlush->GetState() == kButtonDown ) { bit += 1;};
|
||||||
if( bDecimateWF->GetState() == kButtonDown ) bit += (1 << 1);
|
if( bDecimateWF->GetState() == kButtonDown ) bit += (1 << 1);
|
||||||
if( bWFRecord->GetState() == kButtonDown ) bit += ( 1 << 16);
|
if( bWFRecord->GetState() == kButtonDown ) bit += ( 1 << 16);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user