2022-03-07 16:22:04 -05:00
|
|
|
#include <TApplication.h>
|
|
|
|
#include <TGClient.h>
|
|
|
|
#include <TCanvas.h>
|
|
|
|
#include <TF1.h>
|
|
|
|
#include <TRandom.h>
|
|
|
|
#include <TGButton.h>
|
|
|
|
#include <TRootEmbeddedCanvas.h>
|
2022-03-15 19:59:36 -04:00
|
|
|
#include <TGMenu.h>
|
|
|
|
#include <TGLabel.h>
|
|
|
|
#include <TGNumberEntry.h>
|
2022-03-15 14:38:58 -04:00
|
|
|
#include <TGraph.h>
|
2022-03-30 13:13:24 -04:00
|
|
|
#include <TGTextEditor.h>
|
2022-03-15 14:38:58 -04:00
|
|
|
#include <TAxis.h>
|
2022-03-30 13:13:24 -04:00
|
|
|
#include <TBenchmark.h>
|
|
|
|
|
|
|
|
#include <thread>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "Pixie16Class.h"
|
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
#include "pixieDAQ.h"
|
|
|
|
|
|
|
|
|
2022-03-15 19:59:36 -04:00
|
|
|
enum MenuIdentifiers{
|
|
|
|
|
|
|
|
M_FILE_OPEN,
|
|
|
|
M_EXIT,
|
2022-03-30 18:33:44 -04:00
|
|
|
M_CH_SETTINGS_SUMMARY,
|
2022-03-15 19:59:36 -04:00
|
|
|
M_CH_SETTING,
|
2022-03-30 18:33:44 -04:00
|
|
|
M_MODULE_SETTINGS
|
2022-03-15 19:59:36 -04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-03-30 16:13:26 -04:00
|
|
|
///make static members
|
|
|
|
Pixie16 * MainWindow::pixie = NULL;
|
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
2022-03-15 14:38:58 -04:00
|
|
|
|
2022-03-30 16:13:26 -04:00
|
|
|
printf("Removing Pixie16Msg.log \n");
|
|
|
|
remove( "Pixie16Msg.log");
|
|
|
|
|
|
|
|
pixie = new Pixie16();
|
|
|
|
if ( pixie->GetStatus() < 0 ) {
|
|
|
|
printf("Exiting program... \n");
|
|
|
|
GoodBye();
|
|
|
|
}
|
2022-03-15 14:38:58 -04:00
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
/// Create a main frame
|
|
|
|
fMain = new TGMainFrame(p,w,h);
|
2022-03-15 14:38:58 -04:00
|
|
|
///fMain->SetWMPosition(500, 500); //does not work
|
2022-03-15 19:59:36 -04:00
|
|
|
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());
|
2022-03-30 18:33:44 -04:00
|
|
|
fMenuSettings->AddEntry("&Settings Summary", M_CH_SETTINGS_SUMMARY);
|
2022-03-15 19:59:36 -04:00
|
|
|
fMenuSettings->AddEntry("&Channel Setting", M_CH_SETTING);
|
|
|
|
fMenuSettings->AddSeparator();
|
2022-03-30 18:33:44 -04:00
|
|
|
fMenuSettings->AddEntry("Digitizer &Settings", M_MODULE_SETTINGS);
|
2022-03-15 19:59:36 -04:00
|
|
|
|
|
|
|
fMenuSettings->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)");
|
|
|
|
fMenuBar->AddPopup("&Settings", fMenuSettings, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
|
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
TGLayoutHints * uniLayoutHints = new TGLayoutHints(kLHintsNormal, 2,2,10,0); ///left, right, top, bottom
|
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
/// Create a horizontal frame widget with buttons
|
|
|
|
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain,200,40);
|
2022-03-16 21:10:12 -04:00
|
|
|
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2));
|
|
|
|
|
|
|
|
///================= signal Channel group
|
|
|
|
TGGroupFrame * group1 = new TGGroupFrame(hframe, "Single Channel", kHorizontalFrame);
|
2022-03-30 18:33:44 -04:00
|
|
|
hframe->AddFrame(group1 );
|
2022-03-16 21:10:12 -04:00
|
|
|
|
|
|
|
TGHorizontalFrame *hframe1 = new TGHorizontalFrame(group1,200,30);
|
2022-03-30 18:33:44 -04:00
|
|
|
group1->AddFrame(hframe1 );
|
2022-03-07 16:22:04 -05:00
|
|
|
|
2022-03-16 21:10:12 -04:00
|
|
|
TGLabel * lb1 = new TGLabel(hframe1, "Module ID :");
|
2022-03-30 18:33:44 -04:00
|
|
|
hframe1->AddFrame(lb1, uniLayoutHints);
|
2022-03-15 19:59:36 -04:00
|
|
|
|
2022-03-16 21:10:12 -04:00
|
|
|
modIDEntry = new TGNumberEntry(hframe1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
2022-03-15 19:59:36 -04:00
|
|
|
modIDEntry->SetWidth(50);
|
|
|
|
modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1);
|
2022-03-30 18:33:44 -04:00
|
|
|
hframe1->AddFrame(modIDEntry, uniLayoutHints);
|
2022-03-15 19:59:36 -04:00
|
|
|
|
2022-03-16 21:10:12 -04:00
|
|
|
TGLabel * lb2 = new TGLabel(hframe1, "Ch :");
|
2022-03-30 18:33:44 -04:00
|
|
|
hframe1->AddFrame(lb2, uniLayoutHints);
|
2022-03-15 19:59:36 -04:00
|
|
|
|
2022-03-16 21:10:12 -04:00
|
|
|
chEntry = new TGNumberEntry(hframe1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
2022-03-15 19:59:36 -04:00
|
|
|
chEntry->SetWidth(50);
|
|
|
|
chEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetDigitizerNumChannel(0));
|
2022-03-30 18:33:44 -04:00
|
|
|
hframe1->AddFrame(chEntry, uniLayoutHints);
|
2022-03-15 19:59:36 -04:00
|
|
|
|
2022-03-16 21:10:12 -04:00
|
|
|
TGTextButton *bGetADCTrace = new TGTextButton(hframe1,"Get &ADC Trace");
|
2022-03-30 13:13:24 -04:00
|
|
|
bGetADCTrace->Connect("Clicked()","MainWindow",this,"GetADCTrace()");
|
2022-03-30 18:33:44 -04:00
|
|
|
hframe1->AddFrame(bGetADCTrace, uniLayoutHints);
|
2022-03-15 19:59:36 -04:00
|
|
|
|
2022-03-16 21:10:12 -04:00
|
|
|
TGTextButton *bGetBaseLine = new TGTextButton(hframe1,"Get &BaseLine");
|
2022-03-30 13:13:24 -04:00
|
|
|
bGetBaseLine->Connect("Clicked()","MainWindow",this,"GetBaseLine()");
|
2022-03-30 18:33:44 -04:00
|
|
|
hframe1->AddFrame(bGetBaseLine, uniLayoutHints);
|
2022-03-30 13:13:24 -04:00
|
|
|
|
|
|
|
TGTextButton *bScope = new TGTextButton(hframe1,"&Scope");
|
|
|
|
bScope->Connect("Clicked()","MainWindow",this,"Scope()");
|
2022-03-30 18:33:44 -04:00
|
|
|
hframe1->AddFrame(bScope, uniLayoutHints);
|
2022-03-15 19:59:36 -04:00
|
|
|
|
2022-03-16 21:10:12 -04:00
|
|
|
///================= Start Run group
|
|
|
|
TGGroupFrame * group2 = new TGGroupFrame(hframe, "Start run", kHorizontalFrame);
|
2022-03-30 18:33:44 -04:00
|
|
|
//hframe->AddFrame(group2, new TGLayoutHints(kLHintsCenterX, 5,5,3,3) );
|
|
|
|
hframe->AddFrame(group2);
|
2022-03-16 21:10:12 -04:00
|
|
|
|
|
|
|
TGHorizontalFrame *hframe2 = new TGHorizontalFrame(group2,200,30);
|
|
|
|
group2->AddFrame(hframe2);
|
|
|
|
|
2022-03-30 13:13:24 -04:00
|
|
|
tePath = new TGTextEntry(hframe2, new TGTextBuffer(10));
|
|
|
|
tePath->SetText("haha.evt");
|
2022-03-30 18:33:44 -04:00
|
|
|
hframe2->AddFrame(tePath, uniLayoutHints);
|
2022-03-30 13:13:24 -04:00
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
bStartRun = new TGTextButton(hframe2,"Start &Run");
|
2022-03-16 21:10:12 -04:00
|
|
|
bStartRun->Connect("Clicked()","MainWindow",this,"StartRun()");
|
2022-03-30 18:33:44 -04:00
|
|
|
hframe2->AddFrame(bStartRun, uniLayoutHints);
|
2022-03-16 21:10:12 -04:00
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
bStopRun = new TGTextButton(hframe2,"Stop Run");
|
2022-03-16 21:10:12 -04:00
|
|
|
bStopRun->Connect("Clicked()","MainWindow",this,"StopRun()");
|
2022-03-30 18:33:44 -04:00
|
|
|
hframe2->AddFrame(bStopRun, uniLayoutHints);
|
2022-03-16 21:10:12 -04:00
|
|
|
|
|
|
|
TGTextButton *bScalar = new TGTextButton(hframe2,"Scalar");
|
2022-03-30 16:09:12 -04:00
|
|
|
bScalar->Connect("Clicked()","MainWindow",this,"OpenScalar()");
|
2022-03-30 18:33:44 -04:00
|
|
|
hframe2->AddFrame(bScalar, uniLayoutHints);
|
2022-03-16 21:10:12 -04:00
|
|
|
|
|
|
|
|
|
|
|
///================= Read evt group
|
2022-03-30 18:33:44 -04:00
|
|
|
//TGGroupFrame * group3 = new TGGroupFrame(hframe, "Read Evt", kHorizontalFrame);
|
|
|
|
////hframe->AddFrame(group3, new TGLayoutHints(kLHintsCenterX, 5,5,3,3) );
|
|
|
|
//hframe->AddFrame(group3);
|
|
|
|
//
|
|
|
|
//TGHorizontalFrame *hframe3 = new TGHorizontalFrame(group3,200,30);
|
|
|
|
//group3->AddFrame(hframe3);
|
|
|
|
//
|
|
|
|
//TGTextButton *bOpenEVT = new TGTextButton(hframe3,"OpenEvt");
|
|
|
|
////bOpenEVT->Connect("Clicked()","MainWindow",this,"StartRun()");
|
|
|
|
//hframe3->AddFrame(bOpenEVT, uniLayoutHints);
|
2022-03-30 13:13:24 -04:00
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
|
2022-03-30 13:13:24 -04:00
|
|
|
///================= Create canvas widget
|
2022-03-30 18:33:44 -04:00
|
|
|
fEcanvas = new TRootEmbeddedCanvas("Ecanvas",fMain,900,400);
|
|
|
|
fMain->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,10));
|
2022-03-15 19:59:36 -04:00
|
|
|
|
2022-03-30 13:13:24 -04:00
|
|
|
///================= Log massage
|
|
|
|
TGGroupFrame * groupLog = new TGGroupFrame(fMain, "Log Message", kHorizontalFrame);
|
2022-03-30 18:33:44 -04:00
|
|
|
fMain->AddFrame(groupLog, new TGLayoutHints(kLHintsCenterX, 5,5,0,5) );
|
2022-03-30 13:13:24 -04:00
|
|
|
|
|
|
|
teLog = new TGTextEdit(groupLog, w, 60);
|
2022-03-30 18:33:44 -04:00
|
|
|
groupLog->AddFrame(teLog, new TGLayoutHints(kLHintsNormal, 0,0,10,0));
|
2022-03-15 19:59:36 -04:00
|
|
|
|
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
/// Set a name to the main frame
|
2022-03-15 14:38:58 -04:00
|
|
|
fMain->SetWindowName("Pixie16 DAQ");
|
2022-03-07 16:22:04 -05:00
|
|
|
|
|
|
|
/// Map all subwindows of main frame
|
|
|
|
fMain->MapSubwindows();
|
|
|
|
|
|
|
|
/// Initialize the layout algorithm
|
|
|
|
fMain->Resize(fMain->GetDefaultSize());
|
|
|
|
|
|
|
|
/// Map main frame
|
|
|
|
fMain->MapWindow();
|
|
|
|
|
2022-03-30 13:13:24 -04:00
|
|
|
/// setup thread
|
|
|
|
thread = new TThread("hahaha", SaveData, (void *) 1);
|
2022-03-16 16:13:18 -04:00
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
settingsSummary = NULL;
|
|
|
|
moduleSetting = NULL;
|
2022-03-30 18:48:58 -04:00
|
|
|
channelSetting = NULL;
|
2022-03-30 16:09:12 -04:00
|
|
|
scalarPanel = NULL;
|
2022-03-16 16:13:18 -04:00
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
bStopRun->SetEnabled(false);
|
|
|
|
|
|
|
|
///HandleMenu(M_CH_SETTINGS_SUMMARY);
|
2022-03-30 13:13:24 -04:00
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
MainWindow::~MainWindow() {
|
|
|
|
/// Clean up used widgets: frames, buttons, layout hints
|
|
|
|
fMain->Cleanup();
|
|
|
|
delete fMain;
|
2022-03-15 19:59:36 -04:00
|
|
|
delete fMenuBar;
|
|
|
|
delete fMenuFile;
|
|
|
|
delete fMenuSettings;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::HandleMenu(Int_t id){
|
|
|
|
switch(id){
|
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
///========================= File Open
|
2022-03-15 19:59:36 -04:00
|
|
|
case M_FILE_OPEN:{
|
|
|
|
|
|
|
|
}break;
|
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
///========================= Exit
|
2022-03-15 19:59:36 -04:00
|
|
|
case M_EXIT: GoodBye(); break;
|
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
///========================= Channel setting summary
|
|
|
|
case M_CH_SETTINGS_SUMMARY: {
|
|
|
|
if( settingsSummary == NULL ) {
|
|
|
|
settingsSummary = new SettingsSummary(gClient->GetRoot(), 600, 600, pixie);
|
2022-03-30 16:09:12 -04:00
|
|
|
}else{
|
2022-03-30 18:33:44 -04:00
|
|
|
if( !settingsSummary->isOpened ) {
|
|
|
|
settingsSummary = new SettingsSummary(gClient->GetRoot(), 600, 600, pixie);
|
2022-03-30 16:09:12 -04:00
|
|
|
}
|
|
|
|
}
|
2022-03-15 19:59:36 -04:00
|
|
|
}break;
|
|
|
|
|
2022-03-30 18:48:58 -04:00
|
|
|
case M_CH_SETTING:{
|
|
|
|
if( channelSetting == NULL ) {
|
|
|
|
channelSetting = new ChannelSetting(gClient->GetRoot(), 600, 600, pixie);
|
|
|
|
}else{
|
|
|
|
if( !channelSetting->isOpened ) {
|
|
|
|
channelSetting = new ChannelSetting(gClient->GetRoot(), 600, 600, pixie);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}break;
|
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
///========================= Module setting
|
|
|
|
case M_MODULE_SETTINGS:{
|
|
|
|
if( moduleSetting == NULL ) {
|
|
|
|
moduleSetting = new ModuleSetting(gClient->GetRoot(), 600, 600, pixie);
|
|
|
|
}else{
|
|
|
|
if( !moduleSetting->isOpened ) {
|
|
|
|
moduleSetting = new ModuleSetting(gClient->GetRoot(), 600, 600, pixie);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}break;
|
|
|
|
|
2022-03-15 19:59:36 -04:00
|
|
|
}
|
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
}
|
|
|
|
|
2022-03-15 14:38:58 -04:00
|
|
|
|
2022-03-30 13:13:24 -04:00
|
|
|
void MainWindow::GetADCTrace() {
|
2022-03-15 14:38:58 -04:00
|
|
|
printf("--------- get ADCTrace \n");
|
|
|
|
|
2022-03-15 19:59:36 -04:00
|
|
|
int modID = modIDEntry->GetNumber();
|
|
|
|
int ch = chEntry->GetNumber();
|
|
|
|
pixie->CaptureADCTrace(modID, ch);
|
2022-03-15 14:38:58 -04:00
|
|
|
|
|
|
|
unsigned short * haha = pixie->GetADCTrace();
|
2022-03-15 19:59:36 -04:00
|
|
|
double dt = pixie->GetChannelSetting("XDT", modID, ch);
|
2022-03-15 14:38:58 -04:00
|
|
|
|
|
|
|
TGraph * gTrace = new TGraph();
|
2022-03-16 21:10:12 -04:00
|
|
|
|
2022-03-15 14:38:58 -04:00
|
|
|
for( int i = 0 ; i < pixie->GetADCTraceLength(); i++){
|
|
|
|
gTrace->SetPoint(i, i*dt, haha[i]);
|
|
|
|
}
|
|
|
|
gTrace->GetXaxis()->SetTitle("time [us]");
|
2022-03-16 21:10:12 -04:00
|
|
|
gTrace->Draw("APL");
|
2022-03-15 14:38:58 -04:00
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
TCanvas *fCanvas = fEcanvas->GetCanvas();
|
|
|
|
fCanvas->cd();
|
|
|
|
fCanvas->Update();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-03-30 13:13:24 -04:00
|
|
|
void MainWindow::GetBaseLine(){
|
2022-03-16 21:10:12 -04:00
|
|
|
|
|
|
|
int modID = modIDEntry->GetNumber();
|
|
|
|
int ch = chEntry->GetNumber();
|
|
|
|
pixie->CaptureBaseLine(modID, ch);
|
|
|
|
|
|
|
|
double * baseline = pixie->GetBasline();
|
|
|
|
double * baselineTime = pixie->GetBaselineTimestamp();
|
|
|
|
|
|
|
|
TGraph * gTrace = new TGraph();
|
|
|
|
|
|
|
|
for( int i = 0 ; i < pixie->GetBaslineLength(); i++){
|
|
|
|
gTrace->SetPoint(i, baselineTime[i]*1000, baseline[i]);
|
|
|
|
}
|
|
|
|
gTrace->GetXaxis()->SetTitle("time [ns]");
|
|
|
|
gTrace->Draw("APL");
|
|
|
|
|
|
|
|
TCanvas *fCanvas = fEcanvas->GetCanvas();
|
|
|
|
fCanvas->cd();
|
|
|
|
fCanvas->Update();
|
|
|
|
|
|
|
|
}
|
2022-03-07 16:22:04 -05:00
|
|
|
|
2022-03-30 13:13:24 -04:00
|
|
|
void MainWindow::Scope(){
|
|
|
|
|
|
|
|
int modID = modIDEntry->GetNumber();
|
|
|
|
int ch = chEntry->GetNumber();
|
|
|
|
|
|
|
|
if( pixie->GetChannelOnOff(modID, ch) == false ){
|
|
|
|
LogMsg(Form("ch-%d is disabled\n", ch));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double dt = pixie->GetCh2ns(modID);
|
|
|
|
|
|
|
|
DataBlock * data = pixie->GetData();
|
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
LogMsg("Take data for 200 msec.");
|
2022-03-30 13:13:24 -04:00
|
|
|
pixie->StartRun(1);
|
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
usleep(200*1000);
|
2022-03-30 13:13:24 -04:00
|
|
|
pixie->ReadData(0);
|
|
|
|
pixie->StopRun();
|
|
|
|
|
|
|
|
TGraph * gTrace = new TGraph();
|
|
|
|
|
|
|
|
printf(" next word : %u\n", pixie->GetNextWord());
|
|
|
|
printf("number of word received : %u\n", pixie->GetnFIFOWords());
|
|
|
|
|
|
|
|
//TODO add statistics, like trigger rate
|
|
|
|
|
|
|
|
while(!pixie->ProcessSingleData()){
|
|
|
|
|
|
|
|
if( pixie->GetNextWord() >= pixie->GetnFIFOWords() ) break;
|
|
|
|
if( data->slot < 2 ) break;
|
|
|
|
if( data->eventID >= pixie->GetnFIFOWords() ) break;
|
|
|
|
|
|
|
|
printf("mod:%d, ch:%d, event:%llu, %u, %u\n", data->slot-2, data->ch, data->eventID, pixie->GetNextWord(), pixie->GetnFIFOWords() );
|
|
|
|
|
|
|
|
if( data->ch == ch && data->slot == modID + 2 ){
|
|
|
|
|
|
|
|
for( int i = 0 ; i < data->trace_length; i++){
|
|
|
|
gTrace->SetPoint(i, i*dt, (data->trace)[i]);
|
|
|
|
}
|
|
|
|
gTrace->GetXaxis()->SetTitle("time [us]");
|
|
|
|
gTrace->SetTitle(Form("mod:%d, ch:%d, event:%llu\n", modID, ch, data->eventID));
|
|
|
|
gTrace->Draw("APL");
|
|
|
|
|
|
|
|
TCanvas *fCanvas = fEcanvas->GetCanvas();
|
|
|
|
fCanvas->cd();
|
|
|
|
fCanvas->Update();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
printf("=============== finished \n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-03-15 19:59:36 -04:00
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
void MainWindow::GoodBye(){
|
2022-03-15 14:38:58 -04:00
|
|
|
|
|
|
|
pixie->CloseDigitizers();
|
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
printf("----- bye bye ---- \n");
|
2022-03-15 14:38:58 -04:00
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
gApplication->Terminate(0);
|
2022-03-15 14:38:58 -04:00
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
}
|
|
|
|
|
2022-03-16 21:10:12 -04:00
|
|
|
void MainWindow::StartRun(){
|
|
|
|
|
2022-03-30 13:13:24 -04:00
|
|
|
pixie->OpenFile(tePath->GetText(), false);
|
|
|
|
|
2022-03-30 16:09:12 -04:00
|
|
|
LogMsg(Form("Start Run. Save data at %s.\n", tePath->GetText()));
|
|
|
|
|
2022-03-16 21:10:12 -04:00
|
|
|
pixie->StartRun(1);
|
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
if( pixie->IsRunning() ) thread->Run(); /// call SaveData()
|
2022-03-30 13:13:24 -04:00
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
bStartRun->SetEnabled(false);
|
|
|
|
bStopRun->SetEnabled(true);
|
2022-03-30 13:13:24 -04:00
|
|
|
}
|
|
|
|
|
2022-03-16 21:10:12 -04:00
|
|
|
|
2022-03-30 13:13:24 -04:00
|
|
|
void * MainWindow::SaveData(void* ptr){
|
|
|
|
|
|
|
|
printf("Save Data()\n");
|
|
|
|
|
|
|
|
while( pixie->IsRunning() ){
|
|
|
|
|
2022-03-30 16:09:12 -04:00
|
|
|
usleep(500*1000); /// 500 msec
|
2022-03-30 13:13:24 -04:00
|
|
|
|
|
|
|
pixie->ReadData(0);
|
|
|
|
pixie->SaveData();
|
|
|
|
|
2022-03-30 18:33:44 -04:00
|
|
|
//TODO Get file size, Fill HISTORGRAM;
|
|
|
|
|
2022-03-30 13:13:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
pixie->ReadData(0);
|
|
|
|
pixie->SaveData();
|
|
|
|
|
|
|
|
printf("finished Save Data.\n");
|
|
|
|
|
|
|
|
return ptr;
|
2022-03-16 21:10:12 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::StopRun(){
|
|
|
|
|
|
|
|
pixie->StopRun();
|
|
|
|
|
2022-03-30 13:13:24 -04:00
|
|
|
pixie->CloseFile();
|
|
|
|
|
2022-03-30 16:09:12 -04:00
|
|
|
LogMsg("Stop Run");
|
|
|
|
|
2022-03-16 21:10:12 -04:00
|
|
|
pixie->PrintStatistics(0);
|
2022-03-30 18:33:44 -04:00
|
|
|
bStartRun->SetEnabled(true);
|
|
|
|
bStopRun->SetEnabled(false);
|
2022-03-16 21:10:12 -04:00
|
|
|
}
|
|
|
|
|
2022-03-30 16:09:12 -04:00
|
|
|
|
|
|
|
void MainWindow::OpenScalar(){
|
|
|
|
|
|
|
|
if( scalarPanel == NULL ) {
|
|
|
|
scalarPanel = new ScalarPanel(gClient->GetRoot(), 600, 600, pixie);
|
|
|
|
}else{
|
|
|
|
if( !scalarPanel->isOpened ) scalarPanel = new ScalarPanel(gClient->GetRoot(), 600, 600, pixie);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-30 13:13:24 -04:00
|
|
|
void MainWindow::LogMsg(TString msg){
|
|
|
|
teLog->AddLine(msg);
|
|
|
|
teLog->LineDown();
|
|
|
|
teLog->End();
|
|
|
|
}
|
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
printf(" Welcome to pixie16 DQ \n");
|
2022-03-15 14:38:58 -04:00
|
|
|
|
2022-03-07 16:22:04 -05:00
|
|
|
TApplication theApp("App",&argc,argv);
|
2022-03-30 13:13:24 -04:00
|
|
|
new MainWindow(gClient->GetRoot(),800,800);
|
2022-03-07 16:22:04 -05:00
|
|
|
theApp.Run();
|
|
|
|
return 0;
|
|
|
|
}
|