added some UI elements, can fill histogram when StartRUN
This commit is contained in:
parent
f29dfb1438
commit
e0b922000b
16
ClassData.h
16
ClassData.h
|
@ -20,6 +20,7 @@ class Data{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int DPPType;
|
int DPPType;
|
||||||
|
float ch2ns;
|
||||||
unsigned int nByte; /// number of byte
|
unsigned int nByte; /// number of byte
|
||||||
char *buffer; /// readout buffer
|
char *buffer; /// readout buffer
|
||||||
uint32_t AllocatedSize;
|
uint32_t AllocatedSize;
|
||||||
|
@ -80,6 +81,7 @@ class Data{
|
||||||
|
|
||||||
inline Data::Data(){
|
inline Data::Data(){
|
||||||
|
|
||||||
|
ch2ns = 2.0;
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
for ( int i = 0; i < MaxNChannels; i++) TotNumEvents[i] = 0;
|
for ( int i = 0; i < MaxNChannels; i++) TotNumEvents[i] = 0;
|
||||||
ClearData();
|
ClearData();
|
||||||
|
@ -98,17 +100,19 @@ inline Data::~Data(){
|
||||||
|
|
||||||
inline void Data::AllocateMemory(){
|
inline void Data::AllocateMemory(){
|
||||||
|
|
||||||
|
//delete buffer;
|
||||||
BufferSize = 1000000; /// 1M byte
|
BufferSize = 1000000; /// 1M byte
|
||||||
buffer = (char *) malloc( BufferSize);
|
buffer = (char *) malloc( BufferSize);
|
||||||
printf("Allocated %d byte for buffer \n", BufferSize);
|
printf("Allocated %d byte for buffer \n", BufferSize);
|
||||||
///for( int i = 0 ; i < MaxNChannels ; i++ ) Events[i] = (CAEN_DGTZ_DPP_PHA_Event_t *) malloc( BufferSize);
|
///for( int i = 0 ; i < MaxNChannels ; i++ ) Events[i] = (CAEN_DGTZ_DPP_PHA_Event_t *) malloc( BufferSize);
|
||||||
///printf("Allocated %d byte for Events for each channel \n", BufferSize);
|
///printf("Allocated %d byte for Events for each channel \n", BufferSize);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Data::FreeMemory(){
|
inline void Data::FreeMemory(){
|
||||||
printf("======= Free memory\n");
|
printf("======= Free memory\n");
|
||||||
//if( buffer != NULL ) delete buffer;
|
//delete buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Data::ClearData(){
|
inline void Data::ClearData(){
|
||||||
|
@ -154,9 +158,15 @@ inline void Data::SaveBuffer(const char * fileName){
|
||||||
|
|
||||||
inline void Data::PrintStat(){
|
inline void Data::PrintStat(){
|
||||||
|
|
||||||
for(int i = 0; i < MaxNChannels; i++){
|
printf("%2s | %6s | %9s | %6s\n", "ch", "# Evt.", "Rate [Hz]", "Tot. Evt.");
|
||||||
printf("%2d | %6d | %6lu\n", i, NumEvents[i], TotNumEvents[i]);
|
printf("---+--------+-----------+----------\n");
|
||||||
|
for(int ch = 0; ch < MaxNChannels; ch++){
|
||||||
|
unsigned long long dTime = Timestamp[ch][NumEvents[ch]-1] - Timestamp[ch][0];
|
||||||
|
double sec = dTime * ch2ns / 1e9;
|
||||||
|
|
||||||
|
printf("%2d | %6d | %9.2f | %6lu\n", ch, NumEvents[ch], NumEvents[ch]/sec, TotNumEvents[ch]);
|
||||||
}
|
}
|
||||||
|
printf("---+--------+-----------+----------\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,8 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose
|
||||||
case CAEN_DGTZ_V1730: ch2ns = 2.0; break; ///ns -> 500 MSamples/s
|
case CAEN_DGTZ_V1730: ch2ns = 2.0; break; ///ns -> 500 MSamples/s
|
||||||
case CAEN_DGTZ_V1725: ch2ns = 4.0; break; ///ns -> 250 MSamples/s
|
case CAEN_DGTZ_V1725: ch2ns = 4.0; break; ///ns -> 250 MSamples/s
|
||||||
}
|
}
|
||||||
|
data->ch2ns = ch2ns;
|
||||||
|
|
||||||
ADCbits = BoardInfo.ADC_NBits;
|
ADCbits = BoardInfo.ADC_NBits;
|
||||||
ADCFullSize = (unsigned int)( pow(2, ADCbits) -1 );
|
ADCFullSize = (unsigned int)( pow(2, ADCbits) -1 );
|
||||||
|
|
||||||
|
@ -114,6 +116,7 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose
|
||||||
|
|
||||||
///====================== Check DPP firmware revision
|
///====================== Check DPP firmware revision
|
||||||
sscanf(BoardInfo.AMC_FirmwareRel, "%d", &DPPType);
|
sscanf(BoardInfo.AMC_FirmwareRel, "%d", &DPPType);
|
||||||
|
data->DPPType = DPPType;
|
||||||
switch (DPPType){
|
switch (DPPType){
|
||||||
case V1724_DPP_PHA_CODE: DPPTypeStr = "DPP-PHA x724"; break;
|
case V1724_DPP_PHA_CODE: DPPTypeStr = "DPP-PHA x724"; break;
|
||||||
case V1720_DPP_CI_CODE : DPPTypeStr = "DPP-CI x720"; break;
|
case V1720_DPP_CI_CODE : DPPTypeStr = "DPP-CI x720"; break;
|
||||||
|
@ -333,8 +336,8 @@ 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__);
|
||||||
|
@ -583,7 +586,7 @@ int Digitizer::ProgramPHABoard(){
|
||||||
printf("======== program board PHA\n");
|
printf("======== program board PHA\n");
|
||||||
|
|
||||||
ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::RecordLength_G + 0x7000, 250);
|
ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::RecordLength_G + 0x7000, 250);
|
||||||
ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::BoardConfiguration, 0x84F8115);
|
ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::BoardConfiguration, 0x0F8115);
|
||||||
|
|
||||||
//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
|
||||||
|
|
|
@ -91,7 +91,7 @@ class Digitizer{
|
||||||
unsigned int ReadBits(uint32_t address, unsigned int bitLength, unsigned int bitSmallestPos, int ch = -1 );
|
unsigned int ReadBits(uint32_t address, unsigned int bitLength, unsigned int bitSmallestPos, int ch = -1 );
|
||||||
unsigned int GetDPPAlgorithmControl(int ch = -1) {return ReadRegister(Register::DPP::DPPAlgorithmControl, ch);}
|
unsigned int GetDPPAlgorithmControl(int ch = -1) {return ReadRegister(Register::DPP::DPPAlgorithmControl, ch);}
|
||||||
|
|
||||||
bool isACQRunning() {return AcqRun;}
|
bool IsRunning() {return AcqRun;}
|
||||||
|
|
||||||
uint32_t PrintRegister(uint32_t address, std::string msg);
|
uint32_t PrintRegister(uint32_t address, std::string msg);
|
||||||
|
|
||||||
|
|
270
FSUDAQ.cpp
270
FSUDAQ.cpp
|
@ -1,5 +1,7 @@
|
||||||
#include <TApplication.h>
|
#include <TApplication.h>
|
||||||
#include <TGClient.h>
|
#include <TGClient.h>
|
||||||
|
#include <TSystem.h>
|
||||||
|
#include <TStyle.h>
|
||||||
#include <TCanvas.h>
|
#include <TCanvas.h>
|
||||||
#include <TF1.h>
|
#include <TF1.h>
|
||||||
#include <TRandom.h>
|
#include <TRandom.h>
|
||||||
|
@ -13,8 +15,7 @@
|
||||||
#include <TF1.h>
|
#include <TF1.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include "DigitizerPHA.h"
|
|
||||||
#include "DigitizerPSD.h"
|
|
||||||
#include "FSUDAQ.h"
|
#include "FSUDAQ.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,12 +33,26 @@ enum MenuIdentifiers{
|
||||||
M_PROGRAM_SETTINGS,
|
M_PROGRAM_SETTINGS,
|
||||||
M_FINDPEAKS,
|
M_FINDPEAKS,
|
||||||
M_SHOW_CHANNELS_RATE
|
M_SHOW_CHANNELS_RATE
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ModeIdentifiers{
|
||||||
|
|
||||||
|
Mode_EnergyHist,
|
||||||
|
Mode_CountHist,
|
||||||
|
Mode_Oscilloscope,
|
||||||
|
Mode_DataRun
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///make static members
|
///make static members
|
||||||
Digitizer ** MainWindow::digi = NULL;
|
Digitizer ** MainWindow::digi = NULL;
|
||||||
TGTextEdit * MainWindow::teLog = NULL;
|
TGTextEdit * MainWindow::teLog = NULL;
|
||||||
TRootEmbeddedCanvas * MainWindow::fEcanvas = NULL;
|
TRootEmbeddedCanvas * MainWindow::fEcanvas = NULL;
|
||||||
|
TGNumberEntry * MainWindow::boardIDEntry = NULL;
|
||||||
|
TGNumberEntry * MainWindow::chIDEntry = NULL;
|
||||||
|
|
||||||
|
TH1F * MainWindow::hEnergy[MaxNBoards][MaxNChannels] = {NULL};
|
||||||
|
TH1F * MainWindow::hChannel[MaxNBoards] = {NULL};
|
||||||
|
|
||||||
MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
|
|
||||||
|
@ -87,57 +102,82 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain); fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2));
|
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain); fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2));
|
||||||
|
|
||||||
{///================= Create a horizontal frame widget with buttons
|
{///================= Create a horizontal frame widget with buttons
|
||||||
TGGroupFrame * group0 = new TGGroupFrame(hframe, "Hahaha", kHorizontalFrame); hframe->AddFrame(group0 );
|
TGGroupFrame * group0 = new TGGroupFrame(hframe, "Run Control", kHorizontalFrame); hframe->AddFrame(group0 );
|
||||||
TGHorizontalFrame *hfg0 = new TGHorizontalFrame(group0,200,30); group0->AddFrame(hfg0 ,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
|
|
||||||
|
TGVerticalFrame * vframe = new TGVerticalFrame(group0); group0->AddFrame(vframe);
|
||||||
|
|
||||||
|
TGHorizontalFrame *hfg0 = new TGHorizontalFrame(vframe); vframe->AddFrame(hfg0 ,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
|
||||||
|
|
||||||
TGLayoutHints * uniLayoutHints = new TGLayoutHints(kLHintsNormal, 2,2,10,0); ///left, right, top, bottom
|
TGLayoutHints * uniLayoutHints = new TGLayoutHints(kLHintsNormal, 2,2,10,0); ///left, right, top, bottom
|
||||||
|
|
||||||
bOpenDigitizers = new TGTextButton(hfg0,"Open Digitizers"); hfg0->AddFrame(bOpenDigitizers, uniLayoutHints);
|
bOpenDigitizers = new TGTextButton(hfg0,"Open Digitizers"); hfg0->AddFrame(bOpenDigitizers, uniLayoutHints);
|
||||||
bOpenDigitizers->Connect("Clicked()","MainWindow",this,"OpenDigitizers()");
|
bOpenDigitizers->Connect("Clicked()","MainWindow",this,"OpenDigitizers()");
|
||||||
|
|
||||||
TGTextButton *bStartRun = new TGTextButton(hfg0,"Start Run"); hfg0->AddFrame(bStartRun, uniLayoutHints);
|
bStartRun = new TGTextButton(hfg0,"Start Run"); hfg0->AddFrame(bStartRun, uniLayoutHints);
|
||||||
bStartRun->Connect("Clicked()", "MainWindow", this, "StartRun()");
|
bStartRun->Connect("Clicked()", "MainWindow", this, "StartRun()");
|
||||||
|
bStartRun->SetEnabled(false);
|
||||||
|
|
||||||
TGTextButton *bStopRun = new TGTextButton(hfg0,"Stop Run"); hfg0->AddFrame(bStopRun, uniLayoutHints);
|
bStopRun = new TGTextButton(hfg0,"Stop Run"); hfg0->AddFrame(bStopRun, uniLayoutHints);
|
||||||
bStopRun->Connect("Clicked()", "MainWindow", this, "StopRun()");
|
bStopRun->Connect("Clicked()", "MainWindow", this, "StopRun()");
|
||||||
|
bStopRun->SetEnabled(false);
|
||||||
|
|
||||||
TGCheckButton* bSaveData = new TGCheckButton(hfg0, "ACQ Start/Arm", 1); hfg0->AddFrame(bSaveData, uniLayoutHints);
|
TGLabel * lbMode = new TGLabel(hfg0, "Mode"); hfg0->AddFrame(lbMode, uniLayoutHints);
|
||||||
bSaveData->SetState(kButtonDown);
|
cbMode = new TGComboBox(hfg0); hfg0->AddFrame(cbMode, uniLayoutHints);
|
||||||
|
cbMode->AddEntry("Energy Hist.", Mode_EnergyHist);
|
||||||
|
cbMode->AddEntry("Count Hist.", Mode_CountHist);
|
||||||
|
cbMode->AddEntry("Ocsilloscope.", Mode_Oscilloscope);
|
||||||
|
cbMode->AddEntry("Data Run", Mode_DataRun);
|
||||||
|
cbMode->Select(1, false);
|
||||||
|
cbMode->Resize(80, 20);
|
||||||
|
|
||||||
|
TGHorizontalFrame *hfg1 = new TGHorizontalFrame(vframe); vframe->AddFrame(hfg1 ,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
|
||||||
|
|
||||||
|
TGLabel * lbDataPath = new TGLabel(hfg1, "Save Data Prefix"); hfg1->AddFrame(lbDataPath, uniLayoutHints);
|
||||||
|
dataPrefix = new TGTextEntry(hfg1, "test"); hfg1->AddFrame(dataPrefix,uniLayoutHints);
|
||||||
|
dataPrefix->Resize(100, 20);
|
||||||
|
|
||||||
|
TGLabel * lbRunNum = new TGLabel(hfg1, "Run"); hfg1->AddFrame(lbRunNum, uniLayoutHints);
|
||||||
|
runIDEntry = new TGNumberEntry(hfg1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hfg1->AddFrame(runIDEntry, uniLayoutHints);
|
||||||
|
runIDEntry->SetWidth(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
{///================= sigle Channel group
|
{///================= single Channel group
|
||||||
TGGroupFrame * group1 = new TGGroupFrame(hframe, "Single Channel", kHorizontalFrame); hframe->AddFrame(group1 );
|
TGGroupFrame * group1 = new TGGroupFrame(hframe, "Single Channel", kHorizontalFrame); hframe->AddFrame(group1 );
|
||||||
TGHorizontalFrame *hfg1 = new TGHorizontalFrame(group1,200,30); group1->AddFrame(hfg1 ,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
|
TGHorizontalFrame *hfg1 = new TGHorizontalFrame(group1,200,30); group1->AddFrame(hfg1 ,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
|
||||||
|
|
||||||
TGLayoutHints * haha = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 10, 0); ///left, right, top, bottom
|
TGLayoutHints * haha = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 10, 0); ///left, right, top, bottom
|
||||||
|
|
||||||
|
|
||||||
TGLabel * lb0 = new TGLabel(hfg1, "Board"); hfg1->AddFrame(lb0, haha);
|
TGLabel * lb0 = new TGLabel(hfg1, "Board"); hfg1->AddFrame(lb0, haha);
|
||||||
TGNumberEntry * boardIDEntry = new TGNumberEntry(hfg1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hfg1->AddFrame(boardIDEntry, haha);
|
boardIDEntry = new TGNumberEntry(hfg1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hfg1->AddFrame(boardIDEntry, haha);
|
||||||
boardIDEntry->SetWidth(50);
|
boardIDEntry->SetWidth(50);
|
||||||
//boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nBoard-1);
|
boardIDEntry->SetState(false);
|
||||||
|
boardIDEntry->Connect("Modified()", "MainWindow", this, "ChangeBoard()");
|
||||||
|
|
||||||
TGLabel * lb1 = new TGLabel(hfg1, "Channel"); hfg1->AddFrame(lb1, haha);
|
TGLabel * lb1 = new TGLabel(hfg1, "Channel"); hfg1->AddFrame(lb1, haha);
|
||||||
TGNumberEntry* chIDEntry = new TGNumberEntry(hfg1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber); hfg1->AddFrame(chIDEntry, haha);
|
chIDEntry = new TGNumberEntry(hfg1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber); hfg1->AddFrame(chIDEntry, haha);
|
||||||
chIDEntry->SetWidth(50);
|
chIDEntry->SetWidth(50);
|
||||||
|
chIDEntry->SetState(false);
|
||||||
|
|
||||||
TGLabel * lbMode = new TGLabel(hfg1, "Mode"); hfg1->AddFrame(lbMode, haha);
|
bPlotSingleTrace = new TGTextButton(hfg1,"Plot Trace"); hfg1->AddFrame(bPlotSingleTrace, haha);
|
||||||
TGComboBox* cbMode = new TGComboBox(hfg1); hfg1->AddFrame(cbMode, haha);
|
bPlotSingleTrace->Connect("Clicked()", "MainWindow", this, "PlotSingleTrace()");
|
||||||
cbMode->AddEntry("Energy Hist", 0);
|
bPlotSingleTrace->SetEnabled(false);
|
||||||
cbMode->AddEntry("Ocs.", 1);
|
|
||||||
cbMode->Select(1, false);
|
bFitTrace = new TGTextButton(hfg1,"Fit Trace"); hfg1->AddFrame(bFitTrace, haha);
|
||||||
cbMode->Resize(80, 20);
|
bFitTrace->Connect("Clicked()", "MainWindow", this, "FitTrace()");
|
||||||
|
bFitTrace->SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
///================= canvas widget
|
{///================= canvas widget
|
||||||
fEcanvas = new TRootEmbeddedCanvas("Ecanvas",fMain,900,400);
|
fEcanvas = new TRootEmbeddedCanvas("Ecanvas",fMain,900,400);
|
||||||
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(kLHintsExpandX, 10,10,10,10) );
|
fMain->AddFrame(groupLog, new TGLayoutHints(kLHintsExpandX, 10,10,10,10) );
|
||||||
|
|
||||||
teLog = new TGTextEdit(groupLog, w, 100); groupLog->AddFrame(teLog, new TGLayoutHints(kLHintsExpandX, 2,2,10,0) );
|
teLog = new TGTextEdit(groupLog, w, 100); groupLog->AddFrame(teLog, new TGLayoutHints(kLHintsExpandX, 2,2,10,0) );
|
||||||
|
}
|
||||||
|
|
||||||
/// Set a name to the main frame
|
/// Set a name to the main frame
|
||||||
fMain->SetWindowName("FSU DAQ");
|
fMain->SetWindowName("FSU DAQ");
|
||||||
|
@ -152,17 +192,16 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
|
|
||||||
/// setup thread
|
/// setup thread
|
||||||
//saveDataThread = new TThread("hahaha", SaveData, (void *) 1);
|
//saveDataThread = new TThread("hahaha", SaveData, (void *) 1);
|
||||||
//fillHistThread = new TThread("kakaka", FillHistogram, (void *) 1);
|
fillHistThread = new TThread("kakaka", FillHistogram, (void *) 1);
|
||||||
|
|
||||||
///settingsSummary = NULL;
|
|
||||||
boardSetting = NULL;
|
boardSetting = NULL;
|
||||||
channelSettingPHA = NULL;
|
channelSettingPHA = NULL;
|
||||||
|
///settingsSummary = NULL;
|
||||||
///scalarPanel = NULL;
|
///scalarPanel = NULL;
|
||||||
|
|
||||||
LogMsg("Please \"Open Digitizers\" to start.");
|
LogMsg((char*)"Please \"Open Digitizers\" to start.");
|
||||||
|
|
||||||
//HandleMenu(M_DIGITIZER_OPEN);
|
|
||||||
|
|
||||||
|
HandleMenu(M_DIGITIZER_OPEN);
|
||||||
//HandleMenu(M_BOARD_SETTINGS);
|
//HandleMenu(M_BOARD_SETTINGS);
|
||||||
//HandleMenu(M_CH_SETTING_PHA);
|
//HandleMenu(M_CH_SETTING_PHA);
|
||||||
//HandleMenu(M_CH_SETTING_PSD);
|
//HandleMenu(M_CH_SETTING_PSD);
|
||||||
|
@ -172,6 +211,8 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
gDigiTrace1 = NULL;
|
gDigiTrace1 = NULL;
|
||||||
gDigiTrace2 = NULL;
|
gDigiTrace2 = NULL;
|
||||||
|
|
||||||
|
gStyle->SetOptStat("neiou");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
|
@ -180,27 +221,41 @@ MainWindow::~MainWindow() {
|
||||||
delete fMenuDigitizers;
|
delete fMenuDigitizers;
|
||||||
delete fMenuUtility;
|
delete fMenuUtility;
|
||||||
|
|
||||||
//delete boardIDEntry;
|
delete boardIDEntry;
|
||||||
//delete chEntry;
|
delete chIDEntry;
|
||||||
//delete tePath;
|
|
||||||
delete teLog;
|
|
||||||
|
|
||||||
if( digi != NULL ) delete [] digi;
|
delete teLog;
|
||||||
|
//delete tePath;
|
||||||
|
|
||||||
|
delete bOpenDigitizers;
|
||||||
|
delete bStartRun;
|
||||||
|
delete bStopRun;
|
||||||
|
delete cbMode;
|
||||||
|
|
||||||
|
delete bPlotSingleTrace;
|
||||||
|
delete bFitTrace;
|
||||||
|
|
||||||
|
delete [] digi;
|
||||||
|
|
||||||
delete boardSetting;
|
delete boardSetting;
|
||||||
delete channelSettingPHA;
|
delete channelSettingPHA;
|
||||||
|
delete channelSettingPSD;
|
||||||
|
|
||||||
//delete settingsSummary;
|
//delete settingsSummary;
|
||||||
//delete scalarPanel;
|
//delete scalarPanel;
|
||||||
//
|
|
||||||
//delete saveDataThread;
|
//delete saveDataThread;
|
||||||
//delete fillHistThread;
|
delete fillHistThread;
|
||||||
|
|
||||||
delete gAnaTrace1;
|
delete gAnaTrace1;
|
||||||
delete gAnaTrace2;
|
delete gAnaTrace2;
|
||||||
delete gDigiTrace1;
|
delete gDigiTrace1;
|
||||||
delete gDigiTrace2;
|
delete gDigiTrace2;
|
||||||
|
|
||||||
|
for( int i = 0; i < MaxNBoards; i++){
|
||||||
|
delete hChannel[i];
|
||||||
|
for( int j = 0; j < MaxNChannels; j++) delete hEnergy[i][j];
|
||||||
|
}
|
||||||
|
|
||||||
/// Clean up used widgets: frames, buttons, layout hints
|
/// Clean up used widgets: frames, buttons, layout hints
|
||||||
fMain->Cleanup();
|
fMain->Cleanup();
|
||||||
|
@ -256,7 +311,7 @@ void MainWindow::HandleMenu(Int_t id){
|
||||||
|
|
||||||
///========================= Program setting
|
///========================= Program setting
|
||||||
case M_PROGRAM_SETTINGS:{
|
case M_PROGRAM_SETTINGS:{
|
||||||
LogMsg("[Program settings] Not impelmented");
|
LogMsg((char*)"[Program settings] Not impelmented");
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
///====================== Show channel rate;
|
///====================== Show channel rate;
|
||||||
|
@ -264,11 +319,10 @@ void MainWindow::HandleMenu(Int_t id){
|
||||||
|
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
|
||||||
///====================== Fit Gaussian
|
///====================== Fit Gaussian
|
||||||
case M_FINDPEAKS:{
|
case M_FINDPEAKS:{
|
||||||
|
|
||||||
LogMsg("[Find Peaks] Not impelmented");
|
LogMsg((char*)"[Find Gaussian Peaks] Not impelmented");
|
||||||
|
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
@ -278,7 +332,7 @@ void MainWindow::HandleMenu(Int_t id){
|
||||||
|
|
||||||
void MainWindow::OpenDigitizers(){
|
void MainWindow::OpenDigitizers(){
|
||||||
|
|
||||||
LogMsg("============= detect digitizers");
|
LogMsg((char*)"============= detect digitizers");
|
||||||
vector<int> DPPType;
|
vector<int> DPPType;
|
||||||
DPPType.clear();
|
DPPType.clear();
|
||||||
portID.clear();
|
portID.clear();
|
||||||
|
@ -286,7 +340,7 @@ void MainWindow::OpenDigitizers(){
|
||||||
nDigi = 0;
|
nDigi = 0;
|
||||||
|
|
||||||
Digitizer * dig = new Digitizer();
|
Digitizer * dig = new Digitizer();
|
||||||
LogMsg("Finding Digitizer for 4 ports and 3 boards for each port...");
|
LogMsg((char*)"Finding Digitizer for 4 ports and 3 boards for each port...");
|
||||||
for( int port = 0; port < 4 ; port ++){
|
for( int port = 0; port < 4 ; port ++){
|
||||||
for( int board = 0; board < 3 ; board ++){
|
for( int board = 0; board < 3 ; board ++){
|
||||||
dig->OpenDigitizer(board, port);
|
dig->OpenDigitizer(board, port);
|
||||||
|
@ -326,25 +380,29 @@ void MainWindow::OpenDigitizers(){
|
||||||
fMenuDigitizers->EnableEntry( M_TRIGGER_SUMMARY);
|
fMenuDigitizers->EnableEntry( M_TRIGGER_SUMMARY);
|
||||||
bOpenDigitizers->SetEnabled(false);
|
bOpenDigitizers->SetEnabled(false);
|
||||||
|
|
||||||
|
bStartRun->SetEnabled(true);
|
||||||
|
|
||||||
|
boardIDEntry->SetState(true);
|
||||||
|
chIDEntry->SetState(true);
|
||||||
|
boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nDigi-1);
|
||||||
|
|
||||||
|
boardIDEntry->SetNumber(0, false);
|
||||||
|
chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, digi[0]->GetNChannel() -1 );
|
||||||
|
|
||||||
|
bPlotSingleTrace->SetEnabled(true);
|
||||||
|
|
||||||
|
for( int i = 0; i < nDigi; i++){
|
||||||
|
hChannel[i] = new TH1F(Form("hBd%02d", i),Form("hBd%02d; ch; count", i), digi[i]->GetNChannel(), 0, digi[i]->GetNChannel()-1);
|
||||||
|
for( int j = 0; j < MaxNChannels; j++) hEnergy[i][j] = new TH1F(Form("hE%02dch%02d", i, j),Form("hE bd-%02d ch-%02d; Energy[ch]; count", i, j), 400, 0, 20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Double_t standardPulse(Double_t *x, Double_t * par){
|
|
||||||
|
|
||||||
/// par[0] = start time
|
|
||||||
/// par[1] = rise time
|
|
||||||
/// par[2] = decay time
|
|
||||||
/// par[3] = amplitude
|
|
||||||
/// par[4] = baseline
|
|
||||||
|
|
||||||
Double_t z = x[0] - par[0];
|
|
||||||
|
|
||||||
if( z <= 0 ) {
|
|
||||||
return par[4];
|
|
||||||
}else{
|
|
||||||
return par[3]*(1-TMath::Exp(-1*z/par[1]))*TMath::Exp(-1*z/par[2]) + par[4];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::ChangeBoard(){
|
||||||
|
int boardID = boardIDEntry->GetNumber();
|
||||||
|
chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, digi[boardID]->GetNChannel() -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::GoodBye(){
|
void MainWindow::GoodBye(){
|
||||||
|
@ -359,9 +417,19 @@ void MainWindow::StartRun(){
|
||||||
LogMsg(Form("%s",__func__));
|
LogMsg(Form("%s",__func__));
|
||||||
if( digi == NULL) return;
|
if( digi == NULL) return;
|
||||||
|
|
||||||
|
for( int bd = 0; bd < nDigi; bd++){
|
||||||
|
for( int ch = 0; ch < MaxNChannels; ch++){
|
||||||
|
hEnergy[bd][ch]->Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bStartRun->SetEnabled(false);
|
||||||
|
bStopRun->SetEnabled(true);
|
||||||
|
|
||||||
|
|
||||||
digi[0]->StartACQ();
|
digi[0]->StartACQ();
|
||||||
|
|
||||||
|
if( digi[0]->IsRunning() ) fillHistThread->Run();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,6 +437,15 @@ void MainWindow::StopRun(){
|
||||||
LogMsg(Form("%s",__func__));
|
LogMsg(Form("%s",__func__));
|
||||||
if( digi == NULL) return;
|
if( digi == NULL) return;
|
||||||
|
|
||||||
|
digi[0]->StopACQ();
|
||||||
|
|
||||||
|
bStartRun->SetEnabled(true);
|
||||||
|
bStopRun->SetEnabled(false);
|
||||||
|
|
||||||
|
if( cbMode->GetSelected() == Mode_DataRun ){
|
||||||
|
int runID = runIDEntry->GetNumber();
|
||||||
|
runIDEntry->SetNumber(runID +1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OpenChannelSetting(Int_t boardID){
|
void MainWindow::OpenChannelSetting(Int_t boardID){
|
||||||
|
@ -378,7 +455,7 @@ void MainWindow::OpenChannelSetting(Int_t boardID){
|
||||||
if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ){
|
if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ){
|
||||||
channelSettingPHA = new ChannelSettingPHA(gClient->GetRoot(), 600, 600, digi, nDigi, boardID);
|
channelSettingPHA = new ChannelSettingPHA(gClient->GetRoot(), 600, 600, digi, nDigi, boardID);
|
||||||
channelSettingPHA->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)");
|
channelSettingPHA->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)");
|
||||||
channelSettingPHA->Connect("SendPlotTraceCmd()", "MainWindow", this, "PlotTrace()");
|
channelSettingPHA->Connect("SendPlotTraceCmd()", "MainWindow", this, "PlotSingleTrace()");
|
||||||
}
|
}
|
||||||
|
|
||||||
if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE ){
|
if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE ){
|
||||||
|
@ -407,44 +484,45 @@ void MainWindow::LogMsg(char * msg){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::PlotTrace(){
|
void MainWindow::PlotSingleTrace(){
|
||||||
printf("=== %s\n", __func__);
|
printf("=== %s\n", __func__);
|
||||||
|
|
||||||
Data * data = digi[0]->GetData();
|
if( digi == NULL ) return;
|
||||||
|
|
||||||
|
int boardID = boardIDEntry->GetNumber();
|
||||||
|
int chID = chIDEntry->GetNumber();
|
||||||
|
|
||||||
|
Data * data = digi[boardID]->GetData();
|
||||||
data->AllocateMemory();
|
data->AllocateMemory();
|
||||||
data->DPPType = digi[0]->GetDPPType();
|
|
||||||
|
|
||||||
int ch2ns = (int) digi[0]->GetCh2ns();
|
int ch2ns = (int) digi[boardID]->GetCh2ns();
|
||||||
|
|
||||||
digi[0]->StartACQ();
|
digi[boardID]->StartACQ();
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
while(count < 10){
|
while(count < 10){
|
||||||
//sleep(1);
|
usleep(100*1000); /// wait half sec
|
||||||
usleep(500*1000); /// wait half sec
|
digi[boardID]->ReadData();
|
||||||
digi[0]->ReadData();
|
|
||||||
|
|
||||||
if( data->nByte > 0 ){
|
if( data->nByte > 0 ){
|
||||||
data->DecodeBuffer(1);
|
data->DecodeBuffer(0);
|
||||||
|
|
||||||
data->PrintStat();
|
data->PrintStat();
|
||||||
|
|
||||||
delete gAnaTrace1; gAnaTrace1 = new TGraph();
|
delete gAnaTrace1; gAnaTrace1 = new TGraph();
|
||||||
delete gDigiTrace1; gDigiTrace1 = new TGraph();
|
delete gDigiTrace1; gDigiTrace1 = new TGraph(); gDigiTrace1->SetLineColor(4);
|
||||||
|
|
||||||
int traceLength = (data->Waveform1[0][0]).size();
|
int traceLength = (data->Waveform1[chID][0]).size();
|
||||||
|
|
||||||
printf("0----------%d \n", traceLength);
|
printf("0----------%d \n", traceLength);
|
||||||
|
|
||||||
if( traceLength == 0 ) {
|
if( traceLength == 0 ) {
|
||||||
LogMsg((char *)"no trace");
|
LogMsg((char *)"no trace");
|
||||||
|
bFitTrace->SetEnabled(false);
|
||||||
}else{
|
}else{
|
||||||
for( int i = 0; i < traceLength ; i++) {
|
for( int i = 0; i < traceLength ; i++) {
|
||||||
//printf("%d, ", (data->Waveform1[0][0])[i]);
|
gAnaTrace1->SetPoint(i, i*ch2ns, (data->Waveform1[chID][0])[i]);
|
||||||
gAnaTrace1->SetPoint(i, i*ch2ns, (data->Waveform1[0][0])[i]);
|
gDigiTrace1->SetPoint(i, i*ch2ns, 2000*(data->DigiWaveform1[chID][0])[i] + 2000);
|
||||||
gDigiTrace1->SetPoint(i, i*ch2ns, 2000*(data->DigiWaveform1[0][0])[i] + 2000);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->ClearData();
|
data->ClearData();
|
||||||
|
@ -455,16 +533,64 @@ void MainWindow::PlotTrace(){
|
||||||
fEcanvas->GetCanvas()->Update();
|
fEcanvas->GetCanvas()->Update();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
bFitTrace->SetEnabled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
};
|
};
|
||||||
digi[0]->StopACQ();
|
digi[0]->StopACQ();
|
||||||
if( count == 10 ) LogMsg("Plot Trace TimeOut, please check setting");
|
if( count == 10 ) LogMsg((char*)"Plot Trace TimeOut, please check setting");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::FitTrace(){
|
||||||
|
printf("=== %s not impletement.\n", __func__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void * MainWindow::FillHistogram(void * ptr){
|
||||||
|
printf("=== %s\n", __func__);
|
||||||
|
|
||||||
|
if( digi == NULL ) return 0;
|
||||||
|
|
||||||
|
//int boardID = boardIDEntry->GetNumber();
|
||||||
|
//int ch = chIDEntry->GetNumber();
|
||||||
|
int boardID = 0;
|
||||||
|
int ch = 0;
|
||||||
|
|
||||||
|
|
||||||
|
Data * data = digi[boardID]->GetData();
|
||||||
|
data->AllocateMemory();
|
||||||
|
|
||||||
|
while(digi[boardID]->IsRunning()){
|
||||||
|
|
||||||
|
usleep(100*1000); /// wait half sec
|
||||||
|
digi[boardID]->ReadData();
|
||||||
|
|
||||||
|
if( data->nByte > 0 ){
|
||||||
|
data->DecodeBuffer(0);
|
||||||
|
data->PrintStat();
|
||||||
|
|
||||||
|
//for( int ch = 0; ch < digi[boardID]->GetNChannel(); ch++){
|
||||||
|
for( int i = 0; i < data->NumEvents[ch]; i++){
|
||||||
|
hEnergy[boardID][ch]->Fill( data->Energy[ch][i]);
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
|
||||||
|
data->ClearData();
|
||||||
|
|
||||||
|
fEcanvas->GetCanvas()->cd();
|
||||||
|
hEnergy[boardID][ch]->Draw();
|
||||||
|
fEcanvas->GetCanvas()->Update();
|
||||||
|
gSystem->ProcessEvents();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
//############################################
|
//############################################
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
printf(" Welcome to FSU DQ \n");
|
printf(" Welcome to FSU DQ \n");
|
||||||
|
|
51
FSUDAQ.h
51
FSUDAQ.h
|
@ -10,11 +10,13 @@
|
||||||
#include <TGraph.h>
|
#include <TGraph.h>
|
||||||
#include <TBenchmark.h>
|
#include <TBenchmark.h>
|
||||||
#include <TGTextEditor.h>
|
#include <TGTextEditor.h>
|
||||||
|
#include <TGTextEntry.h>
|
||||||
|
|
||||||
|
|
||||||
#include "CAENDigitizer.h"
|
#include "CAENDigitizer.h"
|
||||||
|
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
#include "DigitizerPHA.h"
|
#include "ClassDigitizer.h"
|
||||||
#include "DigitizerPSD.h"
|
|
||||||
|
|
||||||
#include "boardSetting.h"
|
#include "boardSetting.h"
|
||||||
#include "channelSettingPHA.h"
|
#include "channelSettingPHA.h"
|
||||||
|
@ -26,6 +28,7 @@ class TGWindow;
|
||||||
class TGMainFrame;
|
class TGMainFrame;
|
||||||
class TRootEmbeddedCanvas;
|
class TRootEmbeddedCanvas;
|
||||||
class TGNumberEntry;
|
class TGNumberEntry;
|
||||||
|
|
||||||
class MainWindow{
|
class MainWindow{
|
||||||
RQ_OBJECT("MainWindow")
|
RQ_OBJECT("MainWindow")
|
||||||
private:
|
private:
|
||||||
|
@ -35,17 +38,19 @@ private:
|
||||||
TGMenuBar *fMenuBar;
|
TGMenuBar *fMenuBar;
|
||||||
TGPopupMenu *fMenuFile, *fMenuDigitizers, *fMenuUtility;
|
TGPopupMenu *fMenuFile, *fMenuDigitizers, *fMenuUtility;
|
||||||
|
|
||||||
//static TGNumberEntry * boardIDEntry, *chEntry;
|
static TGNumberEntry * boardIDEntry, *chIDEntry;
|
||||||
//TGNumberEntry * runIDEntry;
|
|
||||||
//TGTextEntry * tePath;
|
|
||||||
//
|
|
||||||
static TGTextEdit * teLog;
|
static TGTextEdit * teLog;
|
||||||
//
|
|
||||||
//TGTextButton *bStartRun;
|
|
||||||
//TGTextButton *bStopRun;
|
|
||||||
//TGTextButton *bFitTrace;
|
|
||||||
|
|
||||||
TGTextButton *bOpenDigitizers;
|
TGTextButton *bOpenDigitizers;
|
||||||
|
TGTextButton *bStartRun;
|
||||||
|
TGTextButton *bStopRun;
|
||||||
|
TGComboBox* cbMode;
|
||||||
|
TGTextEntry * dataPrefix;
|
||||||
|
TGNumberEntry * runIDEntry;
|
||||||
|
|
||||||
|
TGTextButton *bPlotSingleTrace;
|
||||||
|
TGTextButton *bFitTrace;
|
||||||
|
|
||||||
unsigned short nDigi;
|
unsigned short nDigi;
|
||||||
vector<int> portID;
|
vector<int> portID;
|
||||||
|
@ -61,9 +66,10 @@ private:
|
||||||
//ScalarPanel * scalarPanel;
|
//ScalarPanel * scalarPanel;
|
||||||
//
|
//
|
||||||
//TThread * saveDataThread;
|
//TThread * saveDataThread;
|
||||||
//TThread * fillHistThread;
|
TThread * fillHistThread;
|
||||||
//static TH1F * hEnergy[MAXMOD][MAXCH];
|
|
||||||
//static TH1F * hChannel[MAXMOD];
|
static TH1F * hEnergy [MaxNBoards][MaxNChannels];
|
||||||
|
static TH1F * hChannel[MaxNBoards];
|
||||||
|
|
||||||
TGraph * gAnaTrace1; /// analogy trace 1
|
TGraph * gAnaTrace1; /// analogy trace 1
|
||||||
TGraph * gAnaTrace2; /// analogy trace 2
|
TGraph * gAnaTrace2; /// analogy trace 2
|
||||||
|
@ -77,20 +83,19 @@ public:
|
||||||
void HandleMenu(Int_t id);
|
void HandleMenu(Int_t id);
|
||||||
|
|
||||||
void OpenDigitizers();
|
void OpenDigitizers();
|
||||||
|
void ChangeBoard();
|
||||||
|
|
||||||
//void GetADCTrace();
|
|
||||||
//void GetBaseLine();
|
|
||||||
//void Scope();
|
|
||||||
//void FitTrace();
|
|
||||||
void StartRun();
|
void StartRun();
|
||||||
//static void * SaveData(void* ptr ); /// thread
|
|
||||||
void StopRun();
|
void StopRun();
|
||||||
//void OpenScalar();
|
//static void * SaveData(void* ptr ); /// thread
|
||||||
//static void * FillHistogram(void * ptr); /// thread
|
|
||||||
//void ChangeMod();
|
|
||||||
//void ChangeChannel();
|
|
||||||
|
|
||||||
void PlotTrace();
|
//void OpenScalar();
|
||||||
|
static void * FillHistogram(void * ptr); /// thread
|
||||||
|
|
||||||
|
void PlotSingleTrace();
|
||||||
|
void FitTrace();
|
||||||
|
|
||||||
|
void Oscilloscope();
|
||||||
|
|
||||||
void OpenChannelSetting(Int_t);
|
void OpenChannelSetting(Int_t);
|
||||||
void LogMsg(char * );
|
void LogMsg(char * );
|
||||||
|
|
|
@ -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); Duplicated?
|
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);
|
||||||
|
|
2
macro.h
2
macro.h
|
@ -1,7 +1,7 @@
|
||||||
#ifndef MACRO_H
|
#ifndef MACRO_H
|
||||||
#define MACRO_H
|
#define MACRO_H
|
||||||
|
|
||||||
|
#define MaxNBoards 22
|
||||||
#define MaxNChannels 16
|
#define MaxNChannels 16
|
||||||
#define MaxRecordLength 0x3fff * 8
|
#define MaxRecordLength 0x3fff * 8
|
||||||
|
|
||||||
|
|
37
test.cpp
37
test.cpp
|
@ -120,7 +120,6 @@ int main(int argc, char* argv[]){
|
||||||
|
|
||||||
Data * data = dig[0]->GetData();
|
Data * data = dig[0]->GetData();
|
||||||
data->AllocateMemory();
|
data->AllocateMemory();
|
||||||
data->DPPType = dig[0]->GetDPPType();
|
|
||||||
|
|
||||||
dig[0]->StartACQ();
|
dig[0]->StartACQ();
|
||||||
|
|
||||||
|
@ -143,24 +142,10 @@ int main(int argc, char* argv[]){
|
||||||
data->SaveBuffer("test.bin");
|
data->SaveBuffer("test.bin");
|
||||||
data->DecodeBuffer(0);
|
data->DecodeBuffer(0);
|
||||||
|
|
||||||
for(int i = 0; i < dig[0]->GetNChannel(); i++){
|
unsigned short nData = data->NumEvents[0]; //channel-0
|
||||||
//printf("%2d | %d \n", i, data->NumEvents[i]);
|
haha = data->Waveform1[0][nData-1];
|
||||||
h1->Fill(i, data->NumEvents[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for( int i = 0; i < data->NumEvents[0]; i++){
|
|
||||||
//printf("%2d | %d, %llu\n", i, data->Energy[0][i], data->Timestamp[0][i]);
|
|
||||||
h2->Fill( data->Energy[0][i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
haha = data->Waveform1[0][0];
|
|
||||||
for( int i = 0; i < waveFormLength; i++) g1->SetPoint(i, i*ch2ns, haha[i]);
|
for( int i = 0; i < waveFormLength; i++) g1->SetPoint(i, i*ch2ns, haha[i]);
|
||||||
|
|
||||||
data->ClearData();
|
|
||||||
|
|
||||||
|
|
||||||
canvas->cd(1); h1->Draw("hist");
|
|
||||||
canvas->cd(2); h2->Draw();
|
|
||||||
canvas->cd(3); g1->Draw("AP");
|
canvas->cd(3); g1->Draw("AP");
|
||||||
|
|
||||||
canvas->Modified();
|
canvas->Modified();
|
||||||
|
@ -175,7 +160,25 @@ int main(int argc, char* argv[]){
|
||||||
if( ElapsedTime > 1000 ){
|
if( ElapsedTime > 1000 ){
|
||||||
int temp = system("clear");
|
int temp = system("clear");
|
||||||
data->PrintStat();
|
data->PrintStat();
|
||||||
|
|
||||||
|
for(int i = 0; i < dig[0]->GetNChannel(); i++){
|
||||||
|
h1->Fill(i, data->NumEvents[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int i = 0; i < data->NumEvents[0]; i++){
|
||||||
|
h2->Fill( data->Energy[0][i]);
|
||||||
|
}
|
||||||
|
data->ClearData();
|
||||||
|
|
||||||
|
canvas->cd(1); h1->Draw("hist");
|
||||||
|
canvas->cd(2); h2->Draw();
|
||||||
|
canvas->Modified();
|
||||||
|
canvas->Update();
|
||||||
|
gSystem->ProcessEvents();
|
||||||
|
|
||||||
PreviousTime = CurrentTime;
|
PreviousTime = CurrentTime;
|
||||||
|
|
||||||
|
printf("Press any key to Stop\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user