added scalar pannel
This commit is contained in:
parent
336ac43827
commit
f4e217aa8e
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -13,3 +13,5 @@ read-set
|
||||||
*.cxx
|
*.cxx
|
||||||
*.pcm
|
*.pcm
|
||||||
pixieDAQ
|
pixieDAQ
|
||||||
|
|
||||||
|
script*
|
||||||
|
|
46
pixieDAQ.cpp
46
pixieDAQ.cpp
|
@ -90,42 +90,42 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
chEntry = new TGNumberEntry(hframe1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
chEntry = new TGNumberEntry(hframe1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
||||||
chEntry->SetWidth(50);
|
chEntry->SetWidth(50);
|
||||||
chEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetDigitizerNumChannel(0));
|
chEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetDigitizerNumChannel(0));
|
||||||
hframe1->AddFrame(chEntry, new TGLayoutHints(kLHintsCenterX , 2, 2, 5, 0));
|
hframe1->AddFrame(chEntry, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2, 2, 5, 0));
|
||||||
|
|
||||||
TGTextButton *bGetADCTrace = new TGTextButton(hframe1,"Get &ADC Trace");
|
TGTextButton *bGetADCTrace = new TGTextButton(hframe1,"Get &ADC Trace");
|
||||||
bGetADCTrace->Connect("Clicked()","MainWindow",this,"GetADCTrace()");
|
bGetADCTrace->Connect("Clicked()","MainWindow",this,"GetADCTrace()");
|
||||||
hframe1->AddFrame(bGetADCTrace, new TGLayoutHints(kLHintsCenterX, 2,2,5,0));
|
hframe1->AddFrame(bGetADCTrace, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,5,0));
|
||||||
|
|
||||||
TGTextButton *bGetBaseLine = new TGTextButton(hframe1,"Get &BaseLine");
|
TGTextButton *bGetBaseLine = new TGTextButton(hframe1,"Get &BaseLine");
|
||||||
bGetBaseLine->Connect("Clicked()","MainWindow",this,"GetBaseLine()");
|
bGetBaseLine->Connect("Clicked()","MainWindow",this,"GetBaseLine()");
|
||||||
hframe1->AddFrame(bGetBaseLine, new TGLayoutHints(kLHintsCenterX, 2,2,5,0));
|
hframe1->AddFrame(bGetBaseLine, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,5,0));
|
||||||
|
|
||||||
TGTextButton *bScope = new TGTextButton(hframe1,"&Scope");
|
TGTextButton *bScope = new TGTextButton(hframe1,"&Scope");
|
||||||
bScope->Connect("Clicked()","MainWindow",this,"Scope()");
|
bScope->Connect("Clicked()","MainWindow",this,"Scope()");
|
||||||
hframe1->AddFrame(bScope, new TGLayoutHints(kLHintsCenterX, 2,2,5,0));
|
hframe1->AddFrame(bScope, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,5,0));
|
||||||
|
|
||||||
///================= Start Run group
|
///================= Start Run group
|
||||||
TGGroupFrame * group2 = new TGGroupFrame(hframe, "Start run", kHorizontalFrame);
|
TGGroupFrame * group2 = new TGGroupFrame(hframe, "Start run", kHorizontalFrame);
|
||||||
hframe->AddFrame(group2, new TGLayoutHints(kLHintsCenterX, 2,2,5,0) );
|
hframe->AddFrame(group2, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,5,0) );
|
||||||
|
|
||||||
TGHorizontalFrame *hframe2 = new TGHorizontalFrame(group2,200,30);
|
TGHorizontalFrame *hframe2 = new TGHorizontalFrame(group2,200,30);
|
||||||
group2->AddFrame(hframe2);
|
group2->AddFrame(hframe2);
|
||||||
|
|
||||||
tePath = new TGTextEntry(hframe2, new TGTextBuffer(10));
|
tePath = new TGTextEntry(hframe2, new TGTextBuffer(10));
|
||||||
tePath->SetText("haha.evt");
|
tePath->SetText("haha.evt");
|
||||||
hframe2->AddFrame(tePath, new TGLayoutHints(kLHintsCenterX, 2,2,5,0));
|
hframe2->AddFrame(tePath, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,5,0));
|
||||||
|
|
||||||
TGTextButton *bStartRun = new TGTextButton(hframe2,"Start &Run");
|
TGTextButton *bStartRun = new TGTextButton(hframe2,"Start &Run");
|
||||||
bStartRun->Connect("Clicked()","MainWindow",this,"StartRun()");
|
bStartRun->Connect("Clicked()","MainWindow",this,"StartRun()");
|
||||||
hframe2->AddFrame(bStartRun, new TGLayoutHints(kLHintsCenterX, 2,2,5,0));
|
hframe2->AddFrame(bStartRun, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,5,0));
|
||||||
|
|
||||||
TGTextButton *bStopRun = new TGTextButton(hframe2,"Stop Run");
|
TGTextButton *bStopRun = new TGTextButton(hframe2,"Stop Run");
|
||||||
bStopRun->Connect("Clicked()","MainWindow",this,"StopRun()");
|
bStopRun->Connect("Clicked()","MainWindow",this,"StopRun()");
|
||||||
hframe2->AddFrame(bStopRun, new TGLayoutHints(kLHintsCenterX, 2,2,5,0));
|
hframe2->AddFrame(bStopRun, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,5,0));
|
||||||
|
|
||||||
TGTextButton *bScalar = new TGTextButton(hframe2,"Scalar");
|
TGTextButton *bScalar = new TGTextButton(hframe2,"Scalar");
|
||||||
//bScalar->Connect("Clicked()","MainWindow",this,"getADCTrace()");
|
bScalar->Connect("Clicked()","MainWindow",this,"OpenScalar()");
|
||||||
hframe2->AddFrame(bScalar, new TGLayoutHints(kLHintsCenterX, 2,2,5,0));
|
hframe2->AddFrame(bScalar, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,5,0));
|
||||||
|
|
||||||
|
|
||||||
///================= Read evt group
|
///================= Read evt group
|
||||||
|
@ -167,6 +167,8 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
/// setup thread
|
/// setup thread
|
||||||
thread = new TThread("hahaha", SaveData, (void *) 1);
|
thread = new TThread("hahaha", SaveData, (void *) 1);
|
||||||
|
|
||||||
|
mainSettings = NULL;
|
||||||
|
scalarPanel = NULL;
|
||||||
|
|
||||||
///HandleMenu(M_MAIN_CH_SETTINGS);
|
///HandleMenu(M_MAIN_CH_SETTINGS);
|
||||||
|
|
||||||
|
@ -192,7 +194,13 @@ void MainWindow::HandleMenu(Int_t id){
|
||||||
case M_EXIT: GoodBye(); break;
|
case M_EXIT: GoodBye(); break;
|
||||||
|
|
||||||
case M_MAIN_CH_SETTINGS: {
|
case M_MAIN_CH_SETTINGS: {
|
||||||
mainSettings = new SettingsSummary(gClient->GetRoot(), 600, 600, pixie);
|
if( mainSettings == NULL ) {
|
||||||
|
mainSettings = new SettingsSummary(gClient->GetRoot(), 600, 600, pixie);
|
||||||
|
}else{
|
||||||
|
if( !mainSettings->isOpened ) {
|
||||||
|
mainSettings = new SettingsSummary(gClient->GetRoot(), 600, 600, pixie);
|
||||||
|
}
|
||||||
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -333,6 +341,8 @@ void MainWindow::StartRun(){
|
||||||
|
|
||||||
pixie->OpenFile(tePath->GetText(), false);
|
pixie->OpenFile(tePath->GetText(), false);
|
||||||
|
|
||||||
|
LogMsg(Form("Start Run. Save data at %s.\n", tePath->GetText()));
|
||||||
|
|
||||||
pixie->StartRun(1);
|
pixie->StartRun(1);
|
||||||
|
|
||||||
//Emit("StartRun()");
|
//Emit("StartRun()");
|
||||||
|
@ -353,7 +363,7 @@ void * MainWindow::SaveData(void* ptr){
|
||||||
|
|
||||||
while( pixie->IsRunning() ){
|
while( pixie->IsRunning() ){
|
||||||
|
|
||||||
usleep(500*1000);
|
usleep(500*1000); /// 500 msec
|
||||||
|
|
||||||
pixie->ReadData(0);
|
pixie->ReadData(0);
|
||||||
pixie->SaveData();
|
pixie->SaveData();
|
||||||
|
@ -375,9 +385,21 @@ void MainWindow::StopRun(){
|
||||||
|
|
||||||
pixie->CloseFile();
|
pixie->CloseFile();
|
||||||
|
|
||||||
|
LogMsg("Stop Run");
|
||||||
|
|
||||||
pixie->PrintStatistics(0);
|
pixie->PrintStatistics(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::LogMsg(TString msg){
|
void MainWindow::LogMsg(TString msg){
|
||||||
teLog->AddLine(msg);
|
teLog->AddLine(msg);
|
||||||
teLog->LineDown();
|
teLog->LineDown();
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include "Pixie16Class.h"
|
#include "Pixie16Class.h"
|
||||||
#include "settingsSummary.h"
|
#include "settingsSummary.h"
|
||||||
|
#include "scalarPanel.h"
|
||||||
|
|
||||||
class TGWindow;
|
class TGWindow;
|
||||||
class TGMainFrame;
|
class TGMainFrame;
|
||||||
|
@ -31,6 +32,8 @@ private:
|
||||||
|
|
||||||
SettingsSummary * mainSettings;
|
SettingsSummary * mainSettings;
|
||||||
|
|
||||||
|
ScalarPanel * scalarPanel;
|
||||||
|
|
||||||
TThread * thread;
|
TThread * thread;
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,11 +51,11 @@ public:
|
||||||
void Scope();
|
void Scope();
|
||||||
|
|
||||||
void StartRun(); // *SIGNAL*
|
void StartRun(); // *SIGNAL*
|
||||||
|
|
||||||
static void * SaveData(void* ptr ); /// thread
|
static void * SaveData(void* ptr ); /// thread
|
||||||
|
|
||||||
void StopRun();
|
void StopRun();
|
||||||
|
|
||||||
|
void OpenScalar();
|
||||||
|
|
||||||
|
|
||||||
void LogMsg(TString msg);
|
void LogMsg(TString msg);
|
||||||
|
|
||||||
|
|
123
scalarPanel.cpp
Normal file
123
scalarPanel.cpp
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
#include <TApplication.h>
|
||||||
|
#include <TGClient.h>
|
||||||
|
#include <TCanvas.h>
|
||||||
|
#include <TF1.h>
|
||||||
|
#include <TRandom.h>
|
||||||
|
#include <TGButton.h>
|
||||||
|
#include <TRootEmbeddedCanvas.h>
|
||||||
|
#include <TGLabel.h>
|
||||||
|
#include <TGTableContainer.h>
|
||||||
|
#include <TGFileDialog.h>
|
||||||
|
|
||||||
|
#include "scalarPanel.h"
|
||||||
|
|
||||||
|
|
||||||
|
Pixie16 * ScalarPanel::pixie = NULL;
|
||||||
|
bool ScalarPanel::updateFlag = true;
|
||||||
|
int ScalarPanel::nMod = 0;
|
||||||
|
TGTextEntry * ScalarPanel::teRate[][MAXCH] = {NULL};
|
||||||
|
|
||||||
|
|
||||||
|
ScalarPanel::ScalarPanel(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie){
|
||||||
|
|
||||||
|
this->pixie = pixie;
|
||||||
|
|
||||||
|
nMod = pixie->GetNumModule();
|
||||||
|
|
||||||
|
fMain = new TGMainFrame(p,w,h);
|
||||||
|
fMain->SetWindowName("Scalar Panel");
|
||||||
|
fMain->Connect("CloseWindow()", "ScalarPanel", this, "CloseWindow()");
|
||||||
|
|
||||||
|
///Module choose
|
||||||
|
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain, w, 50 );
|
||||||
|
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
|
||||||
|
|
||||||
|
int width = 30;
|
||||||
|
|
||||||
|
///------ Channel labels
|
||||||
|
TGVerticalFrame * hChannelLabels = new TGVerticalFrame(hframe);
|
||||||
|
hframe->AddFrame(hChannelLabels, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
|
||||||
|
|
||||||
|
TGLabel * labelCh[MAXCH];
|
||||||
|
for( int ch = 0; ch < MAXCH; ch ++){
|
||||||
|
labelCh[ch] = new TGLabel(hChannelLabels, Form("%02d", ch));
|
||||||
|
labelCh[ch]->SetWidth(width);
|
||||||
|
labelCh[ch]->Resize(width, 50);
|
||||||
|
hChannelLabels->AddFrame(labelCh[ch], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,5,5));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TGVerticalFrame * hScalarMod[nMod];
|
||||||
|
|
||||||
|
for ( int mod = 0 ; mod < nMod ; mod ++){
|
||||||
|
hScalarMod[mod] = new TGVerticalFrame(hframe);
|
||||||
|
hframe->AddFrame(hScalarMod[mod], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
|
||||||
|
|
||||||
|
for( int ch = 0 ; ch < MAXCH ; ch ++){
|
||||||
|
teRate[mod][ch] = new TGTextEntry(hScalarMod[mod], new TGTextBuffer(10));
|
||||||
|
teRate[mod][ch]->SetAlignment(kTextRight);
|
||||||
|
hScalarMod[mod]->AddFrame(teRate[mod][ch], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fMain->MapSubwindows();
|
||||||
|
fMain->Resize(fMain->GetDefaultSize());
|
||||||
|
fMain->MapWindow();
|
||||||
|
|
||||||
|
isOpened = true;
|
||||||
|
updateFlag = true;
|
||||||
|
thread = new TThread("kakaka", UpdateScalar, (void *) 0);
|
||||||
|
thread->Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ScalarPanel::~ScalarPanel(){
|
||||||
|
|
||||||
|
updateFlag = false;
|
||||||
|
isOpened = false;
|
||||||
|
|
||||||
|
for( int i = 0; i < MAXMOD; i++){
|
||||||
|
for( int j = 0; j < MAXCH; j++ ){
|
||||||
|
delete teRate[i][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// fMain must be delete last;
|
||||||
|
fMain->Cleanup();
|
||||||
|
delete fMain;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void * ScalarPanel::UpdateScalar(void * ptr){
|
||||||
|
|
||||||
|
while(updateFlag){
|
||||||
|
|
||||||
|
int ss = Pixie16GetStatisticsSize();
|
||||||
|
unsigned int statistics[ss];
|
||||||
|
|
||||||
|
for( int mod = 0; mod < nMod; mod++){
|
||||||
|
|
||||||
|
Pixie16ReadStatisticsFromModule (statistics, mod);
|
||||||
|
|
||||||
|
for( int ch = 0; ch < MAXCH ; ch ++){
|
||||||
|
|
||||||
|
double ICR = Pixie16ComputeInputCountRate (statistics, mod, ch);
|
||||||
|
double OCR = Pixie16ComputeOutputCountRate (statistics, mod, ch);
|
||||||
|
|
||||||
|
teRate[mod][ch]->SetText(Form("%.2f[%.2f]", ICR, OCR));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
gSystem->Sleep(500); ///0.5 sec
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("quite Update Scalar\n");
|
||||||
|
|
||||||
|
return ptr;
|
||||||
|
|
||||||
|
}
|
45
scalarPanel.h
Normal file
45
scalarPanel.h
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#ifndef SCALAR_PANEL_H
|
||||||
|
#define SCALAR_PANEL_H
|
||||||
|
|
||||||
|
#include <TQObject.h>
|
||||||
|
#include <TThread.h>
|
||||||
|
#include <TGNumberEntry.h>
|
||||||
|
#include <TGComboBox.h>
|
||||||
|
#include <TGLabel.h>
|
||||||
|
|
||||||
|
#include "Pixie16Class.h"
|
||||||
|
|
||||||
|
class TGWindow;
|
||||||
|
class TGMainFrame;
|
||||||
|
|
||||||
|
#define MAXCH 16
|
||||||
|
#define MAXMOD 13
|
||||||
|
|
||||||
|
class ScalarPanel{
|
||||||
|
private:
|
||||||
|
TGMainFrame * fMain;
|
||||||
|
|
||||||
|
static int nMod;
|
||||||
|
static Pixie16 * pixie;
|
||||||
|
|
||||||
|
static bool updateFlag;
|
||||||
|
|
||||||
|
TThread * thread;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ScalarPanel(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie);
|
||||||
|
virtual ~ScalarPanel();
|
||||||
|
|
||||||
|
static void * UpdateScalar(void * ptr);
|
||||||
|
|
||||||
|
void CloseWindow() { printf("close window\n"); delete this; }
|
||||||
|
|
||||||
|
bool isOpened;
|
||||||
|
|
||||||
|
static TGTextEntry * teRate[MAXMOD][MAXCH];
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -66,7 +66,7 @@ SettingsSummary::SettingsSummary(const TGWindow *p, UInt_t w, UInt_t h, Pixie16
|
||||||
TGHorizontalFrame * hframeLabel = new TGHorizontalFrame(hframeSettings, w, 50);
|
TGHorizontalFrame * hframeLabel = new TGHorizontalFrame(hframeSettings, w, 50);
|
||||||
hframeSettings->AddFrame(hframeLabel, new TGLayoutHints(kLHintsExpandX, 2,2,2,2));
|
hframeSettings->AddFrame(hframeLabel, new TGLayoutHints(kLHintsExpandX, 2,2,2,2));
|
||||||
|
|
||||||
TGLabel ** labelItems = new TGLabel * [numItems];
|
TGLabel * labelItems[numItems];
|
||||||
|
|
||||||
for(int i = 0; i < numItems; i++){
|
for(int i = 0; i < numItems; i++){
|
||||||
labelItems[i] = new TGLabel(hframeLabel, Form("%s", labelText[i].Data()));
|
labelItems[i] = new TGLabel(hframeLabel, Form("%s", labelText[i].Data()));
|
||||||
|
@ -75,7 +75,7 @@ SettingsSummary::SettingsSummary(const TGWindow *p, UInt_t w, UInt_t h, Pixie16
|
||||||
hframeLabel->AddFrame(labelItems[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
hframeLabel->AddFrame(labelItems[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
TGHorizontalFrame ** hframeCh = new TGHorizontalFrame * [MAXCH];
|
TGHorizontalFrame * hframeCh[MAXCH];
|
||||||
|
|
||||||
for( int i = 0; i < MAXCH ; i ++){
|
for( int i = 0; i < MAXCH ; i ++){
|
||||||
|
|
||||||
|
@ -200,11 +200,15 @@ SettingsSummary::SettingsSummary(const TGWindow *p, UInt_t w, UInt_t h, Pixie16
|
||||||
fMain->MapSubwindows();
|
fMain->MapSubwindows();
|
||||||
fMain->Resize(fMain->GetDefaultSize());
|
fMain->Resize(fMain->GetDefaultSize());
|
||||||
fMain->MapWindow();
|
fMain->MapWindow();
|
||||||
|
|
||||||
|
isOpened = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SettingsSummary::~SettingsSummary(){
|
SettingsSummary::~SettingsSummary(){
|
||||||
|
|
||||||
|
isOpened = false;
|
||||||
|
|
||||||
for (int i = 0; i< MAXCH; i++) {
|
for (int i = 0; i< MAXCH; i++) {
|
||||||
delete lbCh[i];
|
delete lbCh[i];
|
||||||
delete cbOnOff[i] ;
|
delete cbOnOff[i] ;
|
||||||
|
|
|
@ -46,9 +46,10 @@ private:
|
||||||
|
|
||||||
Pixel_t red;
|
Pixel_t red;
|
||||||
Pixel_t black;
|
Pixel_t black;
|
||||||
|
|
||||||
|
|
||||||
int maxCh;
|
int maxCh;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SettingsSummary(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie);
|
SettingsSummary(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie);
|
||||||
|
@ -75,6 +76,8 @@ public:
|
||||||
void OpenFile();
|
void OpenFile();
|
||||||
void SaveSetting();
|
void SaveSetting();
|
||||||
|
|
||||||
|
bool isOpened;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user