change pixie as global vaible. enable threading for taking data
This commit is contained in:
parent
5c3749570e
commit
336ac43827
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -8,6 +8,7 @@ test
|
||||||
example
|
example
|
||||||
read-set
|
read-set
|
||||||
|
|
||||||
|
*.evt
|
||||||
*.root
|
*.root
|
||||||
*.cxx
|
*.cxx
|
||||||
*.pcm
|
*.pcm
|
||||||
|
|
18
Makefile
18
Makefile
|
@ -1,6 +1,6 @@
|
||||||
PLXBASE = /usr/opt/PlxSdk/PlxApi/Library/
|
PLXBASE = /usr/opt/PlxSdk/PlxApi/Library/
|
||||||
CC = g++
|
CC = g++
|
||||||
CFLAGS = -c -Wall
|
CFLAGS = -c -Wall -lpthread
|
||||||
LDFLAGS = -ldl -lm
|
LDFLAGS = -ldl -lm
|
||||||
ROOT_FLAG = `root-config --cflags --glibs`
|
ROOT_FLAG = `root-config --cflags --glibs`
|
||||||
|
|
||||||
|
@ -29,12 +29,15 @@ APIBASE = /usr/opt/xia/PixieSDK/lib/
|
||||||
LIBS = $(APIBASE)libPixie16Api.so $(APIBASE)libPixieSDK.a $(PLXBASE)PlxApi.a
|
LIBS = $(APIBASE)libPixie16Api.so $(APIBASE)libPixieSDK.a $(PLXBASE)PlxApi.a
|
||||||
|
|
||||||
|
|
||||||
|
OBJS = pixieDAQ.o Pixie16Class.o settingsSummary.o scalarPanel.o
|
||||||
|
|
||||||
|
|
||||||
all: testing/test testing/example pixieDAQ
|
all: testing/test testing/example pixieDAQ
|
||||||
|
|
||||||
#--------------------------
|
#--------------------------
|
||||||
pixieDAQ : pixieDAQ.o pixieDict.o pixieDict.cxx Pixie16Class.o mainSettings.o
|
pixieDAQ : pixieDict.cxx $(OBJS)
|
||||||
@echo "-------- making pixieDAQ "
|
@echo "-------- making pixieDAQ "
|
||||||
$(CC) $(PIXIE_LIB_PATH) pixieDAQ.o Pixie16Class.o mainSettings.o pixieDict.cxx $(LIBS) -o pixieDAQ $(ROOT_FLAG)
|
$(CC) $(PIXIE_LIB_PATH) $(OBJS) pixieDict.cxx $(LIBS) -o pixieDAQ $(ROOT_FLAG)
|
||||||
|
|
||||||
#--------------------------#need to export LD_LIBRARY_PATH
|
#--------------------------#need to export LD_LIBRARY_PATH
|
||||||
Pixie16Class.o : Pixie16Class.h Pixie16Class.cpp DataBlock.h
|
Pixie16Class.o : Pixie16Class.h Pixie16Class.cpp DataBlock.h
|
||||||
|
@ -49,10 +52,13 @@ pixieDAQ.o : pixieDict.cxx pixieDAQ.cpp pixieDAQ.h
|
||||||
@echo "--------- creating pixieDAQ.o"
|
@echo "--------- creating pixieDAQ.o"
|
||||||
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) pixieDAQ.cpp Pixie16Class.cpp pixieDict.cxx $(ROOT_FLAG)
|
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) pixieDAQ.cpp Pixie16Class.cpp pixieDict.cxx $(ROOT_FLAG)
|
||||||
|
|
||||||
mainSettings.o : mainSettings.cpp mainSettings.h
|
settingsSummary.o : settingsSummary.cpp settingsSummary.h
|
||||||
@echo "--------- creating mainSettings.o"
|
@echo "--------- creating settingsSummary.o"
|
||||||
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) mainSettings.cpp $(ROOT_FLAG)
|
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) settingsSummary.cpp $(ROOT_FLAG)
|
||||||
|
|
||||||
|
scalarPanel.o : scalarPanel.cpp scalarPanel.h
|
||||||
|
@echo "--------- creating scalarPanel.o.o"
|
||||||
|
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) scalarPanel.cpp $(ROOT_FLAG)
|
||||||
|
|
||||||
#--------------------------
|
#--------------------------
|
||||||
testing/example : testing/example.o
|
testing/example : testing/example.o
|
||||||
|
|
|
@ -50,6 +50,7 @@ Pixie16::Pixie16(){
|
||||||
BootDigitizers();
|
BootDigitizers();
|
||||||
|
|
||||||
nFIFOWords = 0;
|
nFIFOWords = 0;
|
||||||
|
totNumFIFOWords = 0;
|
||||||
ExtFIFO_Data = NULL;
|
ExtFIFO_Data = NULL;
|
||||||
Statistics = NULL;
|
Statistics = NULL;
|
||||||
|
|
||||||
|
@ -369,6 +370,8 @@ void Pixie16::StartRun(bool listMode){
|
||||||
|
|
||||||
if( listMode ){
|
if( listMode ){
|
||||||
///listmode
|
///listmode
|
||||||
|
totNumFIFOWords = 0;
|
||||||
|
nextWord = 0;
|
||||||
retval = Pixie16StartListModeRun(NumModules, LIST_MODE_RUN, mode);
|
retval = Pixie16StartListModeRun(NumModules, LIST_MODE_RUN, mode);
|
||||||
if( CheckError("Pixie16StartListModeRun") < 0 ) return;
|
if( CheckError("Pixie16StartListModeRun") < 0 ) return;
|
||||||
printf("\033[32m LIST_MODE run\033[0m\n");
|
printf("\033[32m LIST_MODE run\033[0m\n");
|
||||||
|
@ -403,11 +406,12 @@ void Pixie16::ReadData(unsigned short modID){
|
||||||
if( CheckError("Pixie16CheckExternalFIFOStatus") < 0 ) return;
|
if( CheckError("Pixie16CheckExternalFIFOStatus") < 0 ) return;
|
||||||
///if(nFIFOWords *1.0 / EXTERNAL_FIFO_LENGTH > 0.2) {
|
///if(nFIFOWords *1.0 / EXTERNAL_FIFO_LENGTH > 0.2) {
|
||||||
if(nFIFOWords > 0) {
|
if(nFIFOWords > 0) {
|
||||||
printf("\033[1;31m####### READ DATA \033[m: number of word in module-%d FIFO : %d \n", modID, nFIFOWords);
|
//printf("\033[1;31m####### READ DATA \033[m: number of word in module-%d FIFO : %d \n", modID, nFIFOWords);
|
||||||
if( ExtFIFO_Data != NULL ) delete ExtFIFO_Data;
|
if( ExtFIFO_Data != NULL ) delete ExtFIFO_Data;
|
||||||
ExtFIFO_Data = new unsigned int [nFIFOWords];
|
ExtFIFO_Data = new unsigned int [nFIFOWords];
|
||||||
retval = Pixie16ReadDataFromExternalFIFO(ExtFIFO_Data, nFIFOWords, modID);
|
retval = Pixie16ReadDataFromExternalFIFO(ExtFIFO_Data, nFIFOWords, modID);
|
||||||
CheckError("Pixie16ReadDataFromExternalFIFO");
|
CheckError("Pixie16ReadDataFromExternalFIFO");
|
||||||
|
totNumFIFOWords += nFIFOWords;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
printf("Pixie16 is not running.\n");
|
printf("Pixie16 is not running.\n");
|
||||||
|
@ -460,6 +464,7 @@ bool Pixie16::ProcessSingleData(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int Pixie16::GetDigitizerSetting(std::string parName, unsigned short modID, bool verbose){
|
unsigned int Pixie16::GetDigitizerSetting(std::string parName, unsigned short modID, bool verbose){
|
||||||
unsigned int ParData;
|
unsigned int ParData;
|
||||||
retval = Pixie16ReadSglModPar (const_cast<char*> (parName.c_str()), &ParData, modID);
|
retval = Pixie16ReadSglModPar (const_cast<char*> (parName.c_str()), &ParData, modID);
|
||||||
|
@ -630,7 +635,7 @@ void Pixie16::PrintChannelAllSettings(unsigned short modID, unsigned short ch){
|
||||||
printf("=====================================\n");
|
printf("=====================================\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pixie16::PrintChannelsMainSettings(unsigned short modID){
|
void Pixie16::PrintChannelSettingsSummary(unsigned short modID){
|
||||||
|
|
||||||
printf("====+=====+======+========+========+===========+==========+==========+==========+=======+=========+=========+=======+====== \n");
|
printf("====+=====+======+========+========+===========+==========+==========+==========+=======+=========+=========+=======+====== \n");
|
||||||
printf(" ch | En | Gain | Trig_L | Trig_G | Threshold | Polarity | Energy_L | Energy_G | Tau | Trace | Trace_d | Voff | BL \n");
|
printf(" ch | En | Gain | Trig_L | Trig_G | Threshold | Polarity | Energy_L | Energy_G | Tau | Trace | Trace_d | Voff | BL \n");
|
||||||
|
@ -740,6 +745,8 @@ void Pixie16::PrintStatistics(unsigned short modID){
|
||||||
printf(" %7d |", (int) (ICR * liveTime) );
|
printf(" %7d |", (int) (ICR * liveTime) );
|
||||||
printf(" %7d \n", (int) (OCR * realTime) );
|
printf(" %7d \n", (int) (OCR * realTime) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@ private:
|
||||||
char ** DSPParFile;
|
char ** DSPParFile;
|
||||||
char ** DSPVarFile;
|
char ** DSPVarFile;
|
||||||
|
|
||||||
|
|
||||||
unsigned short * ModRev;
|
unsigned short * ModRev;
|
||||||
unsigned int * ModSerNum;
|
unsigned int * ModSerNum;
|
||||||
unsigned short * ModADCBits;
|
unsigned short * ModADCBits;
|
||||||
|
@ -76,6 +75,9 @@ private:
|
||||||
unsigned int nFIFOWords;
|
unsigned int nFIFOWords;
|
||||||
unsigned int * ExtFIFO_Data;
|
unsigned int * ExtFIFO_Data;
|
||||||
unsigned int * Statistics;
|
unsigned int * Statistics;
|
||||||
|
unsigned int totNumFIFOWords;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
double Baselines[3640], TimeStamps[3640]; ///for baseline
|
double Baselines[3640], TimeStamps[3640]; ///for baseline
|
||||||
unsigned short ADCTrace[8192];
|
unsigned short ADCTrace[8192];
|
||||||
|
@ -152,7 +154,7 @@ public:
|
||||||
bool GetChannelGain(unsigned short modID, unsigned short ch, bool verbose = false) {return GetCSRA(CSRA_BIT::INPUT_RELAY, modID, ch, verbose);}
|
bool GetChannelGain(unsigned short modID, unsigned short ch, bool verbose = false) {return GetCSRA(CSRA_BIT::INPUT_RELAY, modID, ch, verbose);}
|
||||||
|
|
||||||
void PrintChannelAllSettings(unsigned short modID, unsigned short ch);
|
void PrintChannelAllSettings(unsigned short modID, unsigned short ch);
|
||||||
void PrintChannelsMainSettings(unsigned short modID);
|
void PrintChannelSettingsSummary(unsigned short modID);
|
||||||
|
|
||||||
|
|
||||||
void SetChannelSetting(std::string parName, double val, unsigned short modID, unsigned short ch, bool verbose = false);
|
void SetChannelSetting(std::string parName, double val, unsigned short modID, unsigned short ch, bool verbose = false);
|
||||||
|
@ -192,10 +194,12 @@ public:
|
||||||
|
|
||||||
void ReadData(unsigned short modID);
|
void ReadData(unsigned short modID);
|
||||||
|
|
||||||
|
unsigned int GetTotalNumWords() {return totNumFIFOWords;}
|
||||||
unsigned int GetnFIFOWords() {return nFIFOWords;}
|
unsigned int GetnFIFOWords() {return nFIFOWords;}
|
||||||
unsigned int GetNextWord() {return nextWord;}
|
unsigned int GetNextWord() {return nextWord;}
|
||||||
DataBlock * GetData() {return data;}
|
DataBlock * GetData() {return data;}
|
||||||
bool ProcessSingleData();
|
bool ProcessSingleData();
|
||||||
|
|
||||||
void PrintExtFIFOWords() {
|
void PrintExtFIFOWords() {
|
||||||
unsigned int nWords = (ExtFIFO_Data[nextWord] >> 17) & 0x3FFF;
|
unsigned int nWords = (ExtFIFO_Data[nextWord] >> 17) & 0x3FFF;
|
||||||
printf("------------------- print dataBlock, nWords = %d\n", nWords);
|
printf("------------------- print dataBlock, nWords = %d\n", nWords);
|
||||||
|
|
185
pixieDAQ.cpp
185
pixieDAQ.cpp
|
@ -9,7 +9,16 @@
|
||||||
#include <TGLabel.h>
|
#include <TGLabel.h>
|
||||||
#include <TGNumberEntry.h>
|
#include <TGNumberEntry.h>
|
||||||
#include <TGraph.h>
|
#include <TGraph.h>
|
||||||
|
#include <TGTextEditor.h>
|
||||||
#include <TAxis.h>
|
#include <TAxis.h>
|
||||||
|
#include <TBenchmark.h>
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "Pixie16Class.h"
|
||||||
|
static Pixie16 * pixie = new Pixie16();
|
||||||
|
|
||||||
#include "pixieDAQ.h"
|
#include "pixieDAQ.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,66 +77,79 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
group1->AddFrame(hframe1);
|
group1->AddFrame(hframe1);
|
||||||
|
|
||||||
TGLabel * lb1 = new TGLabel(hframe1, "Module ID :");
|
TGLabel * lb1 = new TGLabel(hframe1, "Module ID :");
|
||||||
hframe1->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2, 2, 2, 2));
|
hframe1->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2, 2, 5, 0));
|
||||||
|
|
||||||
modIDEntry = new TGNumberEntry(hframe1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
modIDEntry = new TGNumberEntry(hframe1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
||||||
modIDEntry->SetWidth(50);
|
modIDEntry->SetWidth(50);
|
||||||
modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1);
|
modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1);
|
||||||
hframe1->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 2, 2, 3, 2));
|
hframe1->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 2, 2, 5, 0));
|
||||||
|
|
||||||
TGLabel * lb2 = new TGLabel(hframe1, "Ch :");
|
TGLabel * lb2 = new TGLabel(hframe1, "Ch :");
|
||||||
hframe1->AddFrame(lb2, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2, 2, 3, 2));
|
hframe1->AddFrame(lb2, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2, 2, 5, 0));
|
||||||
|
|
||||||
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, 3, 2));
|
hframe1->AddFrame(chEntry, new TGLayoutHints(kLHintsCenterX , 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,3,2));
|
hframe1->AddFrame(bGetADCTrace, new TGLayoutHints(kLHintsCenterX, 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,3,2));
|
hframe1->AddFrame(bGetBaseLine, new TGLayoutHints(kLHintsCenterX, 2,2,5,0));
|
||||||
|
|
||||||
|
TGTextButton *bScope = new TGTextButton(hframe1,"&Scope");
|
||||||
|
bScope->Connect("Clicked()","MainWindow",this,"Scope()");
|
||||||
|
hframe1->AddFrame(bScope, new TGLayoutHints(kLHintsCenterX, 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,3,3) );
|
hframe->AddFrame(group2, new TGLayoutHints(kLHintsCenterX, 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->SetText("haha.evt");
|
||||||
|
hframe2->AddFrame(tePath, new TGLayoutHints(kLHintsCenterX, 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,3,2));
|
hframe2->AddFrame(bStartRun, new TGLayoutHints(kLHintsCenterX, 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,3,4));
|
hframe2->AddFrame(bStopRun, new TGLayoutHints(kLHintsCenterX, 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,"getADCTrace()");
|
||||||
hframe2->AddFrame(bScalar, new TGLayoutHints(kLHintsCenterX, 2,2,3,2));
|
hframe2->AddFrame(bScalar, new TGLayoutHints(kLHintsCenterX, 2,2,5,0));
|
||||||
|
|
||||||
|
|
||||||
///================= Read evt group
|
///================= Read evt group
|
||||||
TGGroupFrame * group3 = new TGGroupFrame(hframe, "Read Evt", kHorizontalFrame);
|
TGGroupFrame * group3 = new TGGroupFrame(hframe, "Read Evt", kHorizontalFrame);
|
||||||
hframe->AddFrame(group3, new TGLayoutHints(kLHintsCenterX, 2,2,3,3) );
|
hframe->AddFrame(group3, new TGLayoutHints(kLHintsCenterX, 2,2,5,0) );
|
||||||
|
|
||||||
TGHorizontalFrame *hframe3 = new TGHorizontalFrame(group3,200,30);
|
TGHorizontalFrame *hframe3 = new TGHorizontalFrame(group3,200,30);
|
||||||
group3->AddFrame(hframe3);
|
group3->AddFrame(hframe3);
|
||||||
|
|
||||||
TGTextButton *bOpenEVT = new TGTextButton(hframe3,"OpenEvt");
|
TGTextButton *bOpenEVT = new TGTextButton(hframe3,"OpenEvt");
|
||||||
//bOpenEVT->Connect("Clicked()","MainWindow",this,"StartRun()");
|
//bOpenEVT->Connect("Clicked()","MainWindow",this,"StartRun()");
|
||||||
hframe3->AddFrame(bOpenEVT, new TGLayoutHints(kLHintsCenterX, 2,2,3,2));
|
hframe3->AddFrame(bOpenEVT, new TGLayoutHints(kLHintsCenterX, 2,2,5,0));
|
||||||
|
|
||||||
|
|
||||||
/// Create canvas widget
|
///================= Create canvas widget
|
||||||
fEcanvas = new TRootEmbeddedCanvas("Ecanvas",fMain,800,400);
|
fEcanvas = new TRootEmbeddedCanvas("Ecanvas",fMain,800,400);
|
||||||
fMain->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
|
fMain->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
|
||||||
|
|
||||||
//===== TODO add msg box
|
///================= Log massage
|
||||||
|
TGGroupFrame * groupLog = new TGGroupFrame(fMain, "Log Message", kHorizontalFrame);
|
||||||
|
fMain->AddFrame(groupLog, new TGLayoutHints(kLHintsCenterX, 5,5,3,3) );
|
||||||
|
|
||||||
|
teLog = new TGTextEdit(groupLog, w, 60);
|
||||||
|
groupLog->AddFrame(teLog, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0,0,5,0));
|
||||||
|
|
||||||
|
|
||||||
/// Set a name to the main frame
|
/// Set a name to the main frame
|
||||||
|
@ -142,17 +164,12 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
/// Map main frame
|
/// Map main frame
|
||||||
fMain->MapWindow();
|
fMain->MapWindow();
|
||||||
|
|
||||||
|
/// setup thread
|
||||||
|
thread = new TThread("hahaha", SaveData, (void *) 1);
|
||||||
|
|
||||||
|
|
||||||
///HandleMenu(M_MAIN_CH_SETTINGS);
|
///HandleMenu(M_MAIN_CH_SETTINGS);
|
||||||
|
|
||||||
///================ pixie
|
|
||||||
///printf("Removing Pixie16Msg.log \n");
|
|
||||||
///remove( "Pixie16Msg.log");
|
|
||||||
|
|
||||||
///pixie = new Pixie16();
|
|
||||||
///if ( pixie->GetStatus() < 0 ) {
|
|
||||||
/// GoodBye();
|
|
||||||
///}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
|
@ -175,10 +192,9 @@ 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 MainSettings(gClient->GetRoot(), 600, 600, pixie);
|
mainSettings = new SettingsSummary(gClient->GetRoot(), 600, 600, pixie);
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -188,7 +204,6 @@ void MainWindow::openPixie(){
|
||||||
printf("Removing Pixie16Msg.log \n");
|
printf("Removing Pixie16Msg.log \n");
|
||||||
remove( "Pixie16Msg.log");
|
remove( "Pixie16Msg.log");
|
||||||
|
|
||||||
pixie = new Pixie16();
|
|
||||||
if ( pixie->GetStatus() < 0 ) {
|
if ( pixie->GetStatus() < 0 ) {
|
||||||
printf("Exiting program... \n");
|
printf("Exiting program... \n");
|
||||||
GoodBye();
|
GoodBye();
|
||||||
|
@ -196,7 +211,7 @@ void MainWindow::openPixie(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::getADCTrace() {
|
void MainWindow::GetADCTrace() {
|
||||||
printf("--------- get ADCTrace \n");
|
printf("--------- get ADCTrace \n");
|
||||||
|
|
||||||
int modID = modIDEntry->GetNumber();
|
int modID = modIDEntry->GetNumber();
|
||||||
|
@ -220,21 +235,15 @@ void MainWindow::getADCTrace() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::getBaseLine(){
|
void MainWindow::GetBaseLine(){
|
||||||
|
|
||||||
printf("1 %s \n", pixie->GetSettingFile(0).c_str());
|
|
||||||
|
|
||||||
int modID = modIDEntry->GetNumber();
|
int modID = modIDEntry->GetNumber();
|
||||||
int ch = chEntry->GetNumber();
|
int ch = chEntry->GetNumber();
|
||||||
pixie->CaptureBaseLine(modID, ch);
|
pixie->CaptureBaseLine(modID, ch);
|
||||||
|
|
||||||
printf("2 %s \n", pixie->GetSettingFile(0).c_str());
|
|
||||||
|
|
||||||
double * baseline = pixie->GetBasline();
|
double * baseline = pixie->GetBasline();
|
||||||
double * baselineTime = pixie->GetBaselineTimestamp();
|
double * baselineTime = pixie->GetBaselineTimestamp();
|
||||||
|
|
||||||
printf("3 %s \n", pixie->GetSettingFile(0).c_str());
|
|
||||||
|
|
||||||
TGraph * gTrace = new TGraph();
|
TGraph * gTrace = new TGraph();
|
||||||
|
|
||||||
for( int i = 0 ; i < pixie->GetBaslineLength(); i++){
|
for( int i = 0 ; i < pixie->GetBaslineLength(); i++){
|
||||||
|
@ -243,15 +252,72 @@ void MainWindow::getBaseLine(){
|
||||||
gTrace->GetXaxis()->SetTitle("time [ns]");
|
gTrace->GetXaxis()->SetTitle("time [ns]");
|
||||||
gTrace->Draw("APL");
|
gTrace->Draw("APL");
|
||||||
|
|
||||||
printf("4 %s \n", pixie->GetSettingFile(0).c_str());
|
|
||||||
|
|
||||||
|
|
||||||
TCanvas *fCanvas = fEcanvas->GetCanvas();
|
TCanvas *fCanvas = fEcanvas->GetCanvas();
|
||||||
fCanvas->cd();
|
fCanvas->cd();
|
||||||
fCanvas->Update();
|
fCanvas->Update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
pixie->StartRun(1);
|
||||||
|
|
||||||
|
usleep(100*1000);
|
||||||
|
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");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::GoodBye(){
|
void MainWindow::GoodBye(){
|
||||||
|
|
||||||
|
@ -265,10 +331,41 @@ void MainWindow::GoodBye(){
|
||||||
|
|
||||||
void MainWindow::StartRun(){
|
void MainWindow::StartRun(){
|
||||||
|
|
||||||
|
pixie->OpenFile(tePath->GetText(), false);
|
||||||
|
|
||||||
pixie->StartRun(1);
|
pixie->StartRun(1);
|
||||||
|
|
||||||
///start a loop that show scalar, plot
|
//Emit("StartRun()");
|
||||||
|
|
||||||
|
///start a loop that show scalar, plot
|
||||||
|
//TBenchmark clock;
|
||||||
|
//clock.Reset();
|
||||||
|
//clock.Start("timer");
|
||||||
|
|
||||||
|
if( pixie->IsRunning() ) thread->Run();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void * MainWindow::SaveData(void* ptr){
|
||||||
|
|
||||||
|
printf("Save Data()\n");
|
||||||
|
|
||||||
|
while( pixie->IsRunning() ){
|
||||||
|
|
||||||
|
usleep(500*1000);
|
||||||
|
|
||||||
|
pixie->ReadData(0);
|
||||||
|
pixie->SaveData();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pixie->ReadData(0);
|
||||||
|
pixie->SaveData();
|
||||||
|
|
||||||
|
printf("finished Save Data.\n");
|
||||||
|
|
||||||
|
return ptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,15 +373,23 @@ void MainWindow::StopRun(){
|
||||||
|
|
||||||
pixie->StopRun();
|
pixie->StopRun();
|
||||||
|
|
||||||
|
pixie->CloseFile();
|
||||||
|
|
||||||
pixie->PrintStatistics(0);
|
pixie->PrintStatistics(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::LogMsg(TString msg){
|
||||||
|
teLog->AddLine(msg);
|
||||||
|
teLog->LineDown();
|
||||||
|
teLog->End();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
printf(" Welcome to pixie16 DQ \n");
|
printf(" Welcome to pixie16 DQ \n");
|
||||||
|
|
||||||
TApplication theApp("App",&argc,argv);
|
TApplication theApp("App",&argc,argv);
|
||||||
new MainWindow(gClient->GetRoot(),800,600);
|
new MainWindow(gClient->GetRoot(),800,800);
|
||||||
theApp.Run();
|
theApp.Run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
25
pixieDAQ.h
25
pixieDAQ.h
|
@ -5,16 +5,18 @@
|
||||||
#include <TClass.h>
|
#include <TClass.h>
|
||||||
#include <TGClient.h>
|
#include <TGClient.h>
|
||||||
#include <TGMenu.h>
|
#include <TGMenu.h>
|
||||||
|
#include <TGTextEdit.h>
|
||||||
|
#include <TThread.h>
|
||||||
|
|
||||||
#include "Pixie16Class.h"
|
#include "Pixie16Class.h"
|
||||||
#include "mainSettings.h"
|
#include "settingsSummary.h"
|
||||||
|
|
||||||
class TGWindow;
|
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:
|
||||||
TGMainFrame *fMain;
|
TGMainFrame *fMain;
|
||||||
|
@ -24,10 +26,12 @@ private:
|
||||||
TGPopupMenu *fMenuFile, *fMenuSettings;
|
TGPopupMenu *fMenuFile, *fMenuSettings;
|
||||||
|
|
||||||
TGNumberEntry * modIDEntry, *chEntry;
|
TGNumberEntry * modIDEntry, *chEntry;
|
||||||
|
TGTextEntry * tePath;
|
||||||
|
TGTextEdit * teLog;
|
||||||
|
|
||||||
Pixie16 * pixie;
|
SettingsSummary * mainSettings;
|
||||||
|
|
||||||
MainSettings * mainSettings;
|
TThread * thread;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -39,12 +43,19 @@ public:
|
||||||
|
|
||||||
void openPixie();
|
void openPixie();
|
||||||
|
|
||||||
void getADCTrace();
|
void GetADCTrace();
|
||||||
void getBaseLine();
|
void GetBaseLine();
|
||||||
|
void Scope();
|
||||||
|
|
||||||
|
void StartRun(); // *SIGNAL*
|
||||||
|
|
||||||
|
static void * SaveData(void* ptr ); /// thread
|
||||||
|
|
||||||
void StartRun();
|
|
||||||
void StopRun();
|
void StopRun();
|
||||||
|
|
||||||
|
|
||||||
|
void LogMsg(TString msg);
|
||||||
|
|
||||||
void GoodBye();
|
void GoodBye();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,14 +5,13 @@
|
||||||
#include <TRandom.h>
|
#include <TRandom.h>
|
||||||
#include <TGButton.h>
|
#include <TGButton.h>
|
||||||
#include <TRootEmbeddedCanvas.h>
|
#include <TRootEmbeddedCanvas.h>
|
||||||
#include <TGLabel.h>
|
|
||||||
#include <TGTableContainer.h>
|
#include <TGTableContainer.h>
|
||||||
#include <TGFileDialog.h>
|
#include <TGFileDialog.h>
|
||||||
|
|
||||||
#include "mainSettings.h"
|
#include "settingsSummary.h"
|
||||||
|
|
||||||
|
|
||||||
MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie){
|
SettingsSummary::SettingsSummary(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie){
|
||||||
|
|
||||||
this->pixie = pixie;
|
this->pixie = pixie;
|
||||||
|
|
||||||
|
@ -20,7 +19,10 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
|
||||||
|
|
||||||
fMain = new TGMainFrame(p,w,h);
|
fMain = new TGMainFrame(p,w,h);
|
||||||
fMain->SetWindowName("Pixie16 Channel Settings ");
|
fMain->SetWindowName("Pixie16 Channel Settings ");
|
||||||
fMain->Connect("CloseWindow()", "MainSettings", this, "CloseWindow()");
|
fMain->Connect("CloseWindow()", "SettingsSummary", this, "CloseWindow()");
|
||||||
|
|
||||||
|
gClient->GetColorByName("red", red);
|
||||||
|
gClient->GetColorByName("black", black);
|
||||||
|
|
||||||
///Module choose
|
///Module choose
|
||||||
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain, w, 50 );
|
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain, w, 50 );
|
||||||
|
@ -32,7 +34,7 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
|
||||||
modIDEntry = new TGNumberEntry(hframe, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
modIDEntry = new TGNumberEntry(hframe, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
||||||
modIDEntry->SetWidth(50);
|
modIDEntry->SetWidth(50);
|
||||||
modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1);
|
modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1);
|
||||||
modIDEntry->Connect("Modified()", "MainSettings", this, "ChangeMod()");
|
modIDEntry->Connect("Modified()", "SettingsSummary", this, "ChangeMod()");
|
||||||
hframe->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
hframe->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||||
|
|
||||||
TGLabel * lb2 = new TGLabel(hframe, "Setting File :");
|
TGLabel * lb2 = new TGLabel(hframe, "Setting File :");
|
||||||
|
@ -44,11 +46,11 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
|
||||||
hframe->AddFrame(teFileName, new TGLayoutHints(kLHintsCenterX, 5,5,3,4));
|
hframe->AddFrame(teFileName, new TGLayoutHints(kLHintsCenterX, 5,5,3,4));
|
||||||
|
|
||||||
TGTextButton * bOpen = new TGTextButton(hframe,"&Open");
|
TGTextButton * bOpen = new TGTextButton(hframe,"&Open");
|
||||||
bOpen->Connect("Clicked()","MainSettings",this, "OpenFile()");
|
bOpen->Connect("Clicked()","SettingsSummary",this, "OpenFile()");
|
||||||
hframe->AddFrame(bOpen, new TGLayoutHints(kLHintsCenterX, 5,5,3,4));
|
hframe->AddFrame(bOpen, new TGLayoutHints(kLHintsCenterX, 5,5,3,4));
|
||||||
|
|
||||||
TGTextButton * bSave = new TGTextButton(hframe,"&Save");
|
TGTextButton * bSave = new TGTextButton(hframe,"&Save");
|
||||||
bSave->Connect("Clicked()","MainSettings",this, "SaveSetting()");
|
bSave->Connect("Clicked()","SettingsSummary",this, "SaveSetting()");
|
||||||
hframe->AddFrame(bSave, new TGLayoutHints(kLHintsCenterX, 5,5,3,4));
|
hframe->AddFrame(bSave, new TGLayoutHints(kLHintsCenterX, 5,5,3,4));
|
||||||
|
|
||||||
/// Setting
|
/// Setting
|
||||||
|
@ -74,7 +76,6 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
|
||||||
}
|
}
|
||||||
|
|
||||||
TGHorizontalFrame ** hframeCh = new TGHorizontalFrame * [MAXCH];
|
TGHorizontalFrame ** hframeCh = new TGHorizontalFrame * [MAXCH];
|
||||||
TGLabel ** lbCh = new TGLabel * [MAXCH];
|
|
||||||
|
|
||||||
for( int i = 0; i < MAXCH ; i ++){
|
for( int i = 0; i < MAXCH ; i ++){
|
||||||
|
|
||||||
|
@ -85,6 +86,7 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
|
||||||
int col = 0;
|
int col = 0;
|
||||||
lbCh[i] = new TGLabel(hframeCh[i] , Form("%02d", i));
|
lbCh[i] = new TGLabel(hframeCh[i] , Form("%02d", i));
|
||||||
lbCh[i]->SetWidth(width[col]);
|
lbCh[i]->SetWidth(width[col]);
|
||||||
|
lbCh[i]->SetTextColor(red);
|
||||||
hframeCh[i]->AddFrame(lbCh[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(lbCh[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
|
@ -92,8 +94,14 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
|
||||||
cbOnOff[i]->AddEntry("ON", 1);
|
cbOnOff[i]->AddEntry("ON", 1);
|
||||||
cbOnOff[i]->AddEntry("off", 0);
|
cbOnOff[i]->AddEntry("off", 0);
|
||||||
cbOnOff[i]->Resize(width[col], 20);
|
cbOnOff[i]->Resize(width[col], 20);
|
||||||
pixie->GetChannelOnOff(modID, i) ? cbOnOff[i]->Select(1) : cbOnOff[i]->Select(0);
|
if( pixie->GetChannelOnOff(modID, i) ){
|
||||||
cbOnOff[i]->Connect("Selected(Int_t, Int_t)", "MainSettings", this, Form("ChangeOnOff(=%d)", i));
|
cbOnOff[i]->Select(1);
|
||||||
|
lbCh[i]->SetTextColor(red);
|
||||||
|
}else{
|
||||||
|
cbOnOff[i]->Select(0);
|
||||||
|
lbCh[i]->SetTextColor(black);
|
||||||
|
}
|
||||||
|
cbOnOff[i]->Connect("Selected(Int_t, Int_t)", "SettingsSummary", this, Form("ChangeOnOff(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(cbOnOff[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(cbOnOff[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
|
@ -102,28 +110,28 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
|
||||||
cbGain[i]->AddEntry("x1/4", 0);
|
cbGain[i]->AddEntry("x1/4", 0);
|
||||||
cbGain[i]->Resize(width[col], 20);
|
cbGain[i]->Resize(width[col], 20);
|
||||||
pixie->GetChannelGain(modID, i) ? cbGain[i]->Select(1) : cbGain[i]->Select(0);
|
pixie->GetChannelGain(modID, i) ? cbGain[i]->Select(1) : cbGain[i]->Select(0);
|
||||||
cbGain[i]->Connect("Selected(Int_t, Int_t)", "MainSettings", this, Form("ChangeGain(=%d)", i));
|
cbGain[i]->Connect("Selected(Int_t, Int_t)", "SettingsSummary", this, Form("ChangeGain(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(cbGain[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(cbGain[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
neTrigL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerRiseTime(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
|
neTrigL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerRiseTime(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
|
||||||
neTrigL[i]->SetWidth(width[col]);
|
neTrigL[i]->SetWidth(width[col]);
|
||||||
neTrigL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 2.0);
|
neTrigL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 2.0);
|
||||||
neTrigL[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTrigL(=%d)", i));
|
neTrigL[i]->Connect("Modified()", "SettingsSummary", this, Form("ChangeTrigL(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(neTrigL[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(neTrigL[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
neTrigG[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerFlatTop(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
|
neTrigG[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerFlatTop(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
|
||||||
neTrigG[i]->SetWidth(width[col]);
|
neTrigG[i]->SetWidth(width[col]);
|
||||||
neTrigG[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 2.0);
|
neTrigG[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 2.0);
|
||||||
neTrigG[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTrigG(=%d)", i));
|
neTrigG[i]->Connect("Modified()", "SettingsSummary", this, Form("ChangeTrigG(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(neTrigG[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(neTrigG[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
neThreshold[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerThreshold(modID, i), 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
neThreshold[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerThreshold(modID, i), 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
||||||
neThreshold[i]->SetWidth(width[col]);
|
neThreshold[i]->SetWidth(width[col]);
|
||||||
neThreshold[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 4000);
|
neThreshold[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 4000);
|
||||||
neThreshold[i]->Connect("Modified()", "MainSettings", this, Form("ChangeThreshold(=%d)", i));
|
neThreshold[i]->Connect("Modified()", "SettingsSummary", this, Form("ChangeThreshold(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(neThreshold[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(neThreshold[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
|
@ -132,28 +140,28 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
|
||||||
cbPol[i]->AddEntry("Neg -", 0);
|
cbPol[i]->AddEntry("Neg -", 0);
|
||||||
cbPol[i]->Resize(width[col], 20);
|
cbPol[i]->Resize(width[col], 20);
|
||||||
pixie->GetChannelPolarity(modID, i) ? cbPol[i]->Select(1) : cbPol[i]->Select(0);
|
pixie->GetChannelPolarity(modID, i) ? cbPol[i]->Select(1) : cbPol[i]->Select(0);
|
||||||
cbPol[i]->Connect("Selected(Int_t, Int_t)", "MainSettings", this, Form("ChangePol(=%d)", i));
|
cbPol[i]->Connect("Selected(Int_t, Int_t)", "SettingsSummary", this, Form("ChangePol(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(cbPol[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(cbPol[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
neEngL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyRiseTime(modID, i), 0, 0, TGNumberFormat::kNESRealOne, TGNumberFormat::kNEANonNegative);
|
neEngL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyRiseTime(modID, i), 0, 0, TGNumberFormat::kNESRealOne, TGNumberFormat::kNEANonNegative);
|
||||||
neEngL[i]->SetWidth(width[col]);
|
neEngL[i]->SetWidth(width[col]);
|
||||||
neEngL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 10.0);
|
neEngL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 10.0);
|
||||||
neEngL[i]->Connect("Modified()", "MainSettings", this, Form("ChangeEngL(=%d)", i));
|
neEngL[i]->Connect("Modified()", "SettingsSummary", this, Form("ChangeEngL(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(neEngL[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(neEngL[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
neEngG[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyFlatTop(modID, i), 0, 0, TGNumberFormat::kNESRealOne, TGNumberFormat::kNEANonNegative);
|
neEngG[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyFlatTop(modID, i), 0, 0, TGNumberFormat::kNESRealOne, TGNumberFormat::kNEANonNegative);
|
||||||
neEngG[i]->SetWidth(width[col]);
|
neEngG[i]->SetWidth(width[col]);
|
||||||
neEngG[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 10.0);
|
neEngG[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 10.0);
|
||||||
neEngG[i]->Connect("Modified()", "MainSettings", this, Form("ChangeEngG(=%d)", i));
|
neEngG[i]->Connect("Modified()", "SettingsSummary", this, Form("ChangeEngG(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(neEngG[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(neEngG[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
neTau[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyTau(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
|
neTau[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyTau(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
|
||||||
neTau[i]->SetWidth(width[col]);
|
neTau[i]->SetWidth(width[col]);
|
||||||
neTau[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 300.0);
|
neTau[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 300.0);
|
||||||
neTau[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTau(=%d)", i));
|
neTau[i]->Connect("Modified()", "SettingsSummary", this, Form("ChangeTau(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(neTau[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(neTau[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
|
@ -162,7 +170,7 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
|
||||||
neTraceLength[i] = new TGNumberEntry(hframeCh[i], tracelen, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
|
neTraceLength[i] = new TGNumberEntry(hframeCh[i], tracelen, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
|
||||||
neTraceLength[i]->SetWidth(width[col]);
|
neTraceLength[i]->SetWidth(width[col]);
|
||||||
neTraceLength[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 20.0);
|
neTraceLength[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 20.0);
|
||||||
neTraceLength[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTraceLenght(=%d)", i));
|
neTraceLength[i]->Connect("Modified()", "SettingsSummary", this, Form("ChangeTraceLenght(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(neTraceLength[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(neTraceLength[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
|
@ -171,21 +179,21 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
|
||||||
neTraceDelay[i] = new TGNumberEntry(hframeCh[i], tracedel, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
|
neTraceDelay[i] = new TGNumberEntry(hframeCh[i], tracedel, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
|
||||||
neTraceDelay[i]->SetWidth(width[col]);
|
neTraceDelay[i]->SetWidth(width[col]);
|
||||||
neTraceDelay[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 20.0);
|
neTraceDelay[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 20.0);
|
||||||
neTraceDelay[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTraceDelay(=%d)", i));
|
neTraceDelay[i]->Connect("Modified()", "SettingsSummary", this, Form("ChangeTraceDelay(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(neTraceDelay[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(neTraceDelay[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
neVoff[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelVOffset(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEAAnyNumber);
|
neVoff[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelVOffset(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEAAnyNumber);
|
||||||
neVoff[i]->SetWidth(width[col]);
|
neVoff[i]->SetWidth(width[col]);
|
||||||
neVoff[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, -2, 2);
|
neVoff[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, -2, 2);
|
||||||
neVoff[i]->Connect("Modified()", "MainSettings", this, Form("ChangeVoff(=%d)", i));
|
neVoff[i]->Connect("Modified()", "SettingsSummary", this, Form("ChangeVoff(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(neVoff[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(neVoff[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
neBL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelBaseLinePrecent(modID, i), 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
neBL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelBaseLinePrecent(modID, i), 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
||||||
neBL[i]->SetWidth(width[col]);
|
neBL[i]->SetWidth(width[col]);
|
||||||
neBL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 100);
|
neBL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 100);
|
||||||
neBL[i]->Connect("Modified()", "MainSettings", this, Form("ChangeBL(=%d)", i));
|
neBL[i]->Connect("Modified()", "SettingsSummary", this, Form("ChangeBL(=%d)", i));
|
||||||
hframeCh[i]->AddFrame(neBL[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
hframeCh[i]->AddFrame(neBL[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,9 +203,10 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MainSettings::~MainSettings(){
|
SettingsSummary::~SettingsSummary(){
|
||||||
|
|
||||||
for (int i = 0; i< MAXCH; i++) {
|
for (int i = 0; i< MAXCH; i++) {
|
||||||
|
delete lbCh[i];
|
||||||
delete cbOnOff[i] ;
|
delete cbOnOff[i] ;
|
||||||
delete cbGain[i] ;
|
delete cbGain[i] ;
|
||||||
delete cbPol[i] ;
|
delete cbPol[i] ;
|
||||||
|
@ -223,68 +232,73 @@ MainSettings::~MainSettings(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainSettings::ChangeOnOff(unsigned short ch){
|
void SettingsSummary::ChangeOnOff(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
int val = cbOnOff[ch]->GetSelected();
|
int val = cbOnOff[ch]->GetSelected();
|
||||||
pixie->SetChannelOnOff(val, modID, ch);
|
pixie->SetChannelOnOff(val, modID, ch);
|
||||||
|
if( val ) {
|
||||||
|
lbCh[ch]->SetTextColor(red);
|
||||||
|
}else{
|
||||||
|
lbCh[ch]->SetTextColor(black);
|
||||||
|
}
|
||||||
teFileName->SetText(settingFileName + " (not saved)");
|
teFileName->SetText(settingFileName + " (not saved)");
|
||||||
}
|
}
|
||||||
void MainSettings::ChangeGain(unsigned short ch){
|
void SettingsSummary::ChangeGain(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
int val = cbGain[ch]->GetSelected();
|
int val = cbGain[ch]->GetSelected();
|
||||||
pixie->SetChannelGain(val, modID, ch);
|
pixie->SetChannelGain(val, modID, ch);
|
||||||
teFileName->SetText(settingFileName + " (not saved)");
|
teFileName->SetText(settingFileName + " (not saved)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::ChangePol(unsigned short ch){
|
void SettingsSummary::ChangePol(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
int val = cbPol[ch]->GetSelected();
|
int val = cbPol[ch]->GetSelected();
|
||||||
pixie->SetChannelPositivePolarity(val, modID, ch);
|
pixie->SetChannelPositivePolarity(val, modID, ch);
|
||||||
teFileName->SetText(settingFileName + " (not saved)");
|
teFileName->SetText(settingFileName + " (not saved)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::ChangeTrigL(unsigned short ch){
|
void SettingsSummary::ChangeTrigL(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
double val = neTrigL[ch]->GetNumber();
|
double val = neTrigL[ch]->GetNumber();
|
||||||
pixie->SetChannelTriggerRiseTime(val, modID, ch);
|
pixie->SetChannelTriggerRiseTime(val, modID, ch);
|
||||||
teFileName->SetText(settingFileName + " (not saved)");
|
teFileName->SetText(settingFileName + " (not saved)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::ChangeTrigG(unsigned short ch){
|
void SettingsSummary::ChangeTrigG(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
double val = neTrigG[ch]->GetNumber();
|
double val = neTrigG[ch]->GetNumber();
|
||||||
pixie->SetChannelTriggerFlatTop(val, modID, ch);
|
pixie->SetChannelTriggerFlatTop(val, modID, ch);
|
||||||
teFileName->SetText(settingFileName + " (not saved)");
|
teFileName->SetText(settingFileName + " (not saved)");
|
||||||
}
|
}
|
||||||
void MainSettings::ChangeThreshold(unsigned short ch){
|
void SettingsSummary::ChangeThreshold(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
double val = neThreshold[ch]->GetNumber();
|
double val = neThreshold[ch]->GetNumber();
|
||||||
pixie->SetChannelTriggerThreshold(val, modID, ch);
|
pixie->SetChannelTriggerThreshold(val, modID, ch);
|
||||||
teFileName->SetText(settingFileName + " (not saved)");
|
teFileName->SetText(settingFileName + " (not saved)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::ChangeEngL(unsigned short ch){
|
void SettingsSummary::ChangeEngL(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
double val = neEngL[ch]->GetNumber();
|
double val = neEngL[ch]->GetNumber();
|
||||||
pixie->SetChannelEnergyRiseTime(val, modID, ch);
|
pixie->SetChannelEnergyRiseTime(val, modID, ch);
|
||||||
teFileName->SetText(settingFileName + " (not saved)");
|
teFileName->SetText(settingFileName + " (not saved)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::ChangeEngG(unsigned short ch){
|
void SettingsSummary::ChangeEngG(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
double val = neEngG[ch]->GetNumber();
|
double val = neEngG[ch]->GetNumber();
|
||||||
pixie->SetChannelEnergyFlatTop(val, modID, ch);
|
pixie->SetChannelEnergyFlatTop(val, modID, ch);
|
||||||
teFileName->SetText(settingFileName + " (not saved)");
|
teFileName->SetText(settingFileName + " (not saved)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::ChangeTau(unsigned short ch){
|
void SettingsSummary::ChangeTau(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
double val = neTau[ch]->GetNumber();
|
double val = neTau[ch]->GetNumber();
|
||||||
pixie->SetChannelEnergyTau(val, modID, ch);
|
pixie->SetChannelEnergyTau(val, modID, ch);
|
||||||
teFileName->SetText(settingFileName + " (not saved)");
|
teFileName->SetText(settingFileName + " (not saved)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::ChangeTraceLenght(unsigned short ch){
|
void SettingsSummary::ChangeTraceLenght(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
double val = neTraceLength[ch]->GetNumber();
|
double val = neTraceLength[ch]->GetNumber();
|
||||||
if( val > 0 ){
|
if( val > 0 ){
|
||||||
|
@ -298,7 +312,7 @@ void MainSettings::ChangeTraceLenght(unsigned short ch){
|
||||||
teFileName->SetText(settingFileName + " (not saved)");
|
teFileName->SetText(settingFileName + " (not saved)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::ChangeTraceDelay(unsigned short ch){
|
void SettingsSummary::ChangeTraceDelay(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
double val = neTraceDelay[ch]->GetNumber();
|
double val = neTraceDelay[ch]->GetNumber();
|
||||||
|
|
||||||
|
@ -313,14 +327,14 @@ void MainSettings::ChangeTraceDelay(unsigned short ch){
|
||||||
teFileName->SetText(settingFileName + " (not saved)");
|
teFileName->SetText(settingFileName + " (not saved)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::ChangeVoff(unsigned short ch){
|
void SettingsSummary::ChangeVoff(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
double val = neVoff[ch]->GetNumber();
|
double val = neVoff[ch]->GetNumber();
|
||||||
pixie->SetChannelVOffset(val, modID, ch);
|
pixie->SetChannelVOffset(val, modID, ch);
|
||||||
teFileName->SetText(settingFileName + " (not saved)");
|
teFileName->SetText(settingFileName + " (not saved)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::ChangeBL(unsigned short ch){
|
void SettingsSummary::ChangeBL(unsigned short ch){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
double val = neBL[ch]->GetNumber();
|
double val = neBL[ch]->GetNumber();
|
||||||
pixie->SetChannelBaseLinePrecent(val, modID, ch);
|
pixie->SetChannelBaseLinePrecent(val, modID, ch);
|
||||||
|
@ -328,13 +342,13 @@ void MainSettings::ChangeBL(unsigned short ch){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainSettings::ChangeMod(){
|
void SettingsSummary::ChangeMod(){
|
||||||
short modID = modIDEntry->GetNumber();
|
short modID = modIDEntry->GetNumber();
|
||||||
settingFileName = pixie->GetSettingFile(modID);
|
settingFileName = pixie->GetSettingFile(modID);
|
||||||
teFileName->SetText(settingFileName);
|
teFileName->SetText(settingFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::OpenFile(){
|
void SettingsSummary::OpenFile(){
|
||||||
|
|
||||||
static TString dir(".");
|
static TString dir(".");
|
||||||
TGFileInfo fi;
|
TGFileInfo fi;
|
||||||
|
@ -352,7 +366,7 @@ void MainSettings::OpenFile(){
|
||||||
dir = fi.fIniDir;
|
dir = fi.fIniDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::SaveSetting(){
|
void SettingsSummary::SaveSetting(){
|
||||||
printf("save button is pressed.\n");
|
printf("save button is pressed.\n");
|
||||||
pixie->SaveSettings(settingFileName.Data());
|
pixie->SaveSettings(settingFileName.Data());
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#ifndef MAIN_SETTING_H
|
#ifndef SETTINGS_SUMMARY_H
|
||||||
#define MAIN_SETTING_H
|
#define SETTINGS_SUMMARY_H
|
||||||
|
|
||||||
#include <TQObject.h>
|
#include <TQObject.h>
|
||||||
///#include <RQ_OBJECT.h>
|
///#include <RQ_OBJECT.h>
|
||||||
|
|
||||||
#include <TGNumberEntry.h>
|
#include <TGNumberEntry.h>
|
||||||
#include <TGComboBox.h>
|
#include <TGComboBox.h>
|
||||||
|
#include <TGLabel.h>
|
||||||
|
|
||||||
#include "Pixie16Class.h"
|
#include "Pixie16Class.h"
|
||||||
|
|
||||||
|
@ -14,8 +15,8 @@ class TGMainFrame;
|
||||||
|
|
||||||
#define MAXCH 16
|
#define MAXCH 16
|
||||||
|
|
||||||
class MainSettings{
|
class SettingsSummary{
|
||||||
/// RQ_OBJECT("MainSettings")
|
/// RQ_OBJECT("SettingsSummary")
|
||||||
private:
|
private:
|
||||||
TGMainFrame * fMain;
|
TGMainFrame * fMain;
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ private:
|
||||||
TGComboBox * cbGain[MAXCH] ;
|
TGComboBox * cbGain[MAXCH] ;
|
||||||
TGComboBox * cbPol[MAXCH] ;
|
TGComboBox * cbPol[MAXCH] ;
|
||||||
|
|
||||||
|
TGLabel * lbCh[MAXCH];
|
||||||
TGNumberEntry * neTrigL[MAXCH] ;
|
TGNumberEntry * neTrigL[MAXCH] ;
|
||||||
TGNumberEntry * neTrigG[MAXCH] ;
|
TGNumberEntry * neTrigG[MAXCH] ;
|
||||||
TGNumberEntry * neThreshold[MAXCH] ;
|
TGNumberEntry * neThreshold[MAXCH] ;
|
||||||
|
@ -42,11 +44,15 @@ private:
|
||||||
|
|
||||||
Pixie16 * pixie;
|
Pixie16 * pixie;
|
||||||
|
|
||||||
|
Pixel_t red;
|
||||||
|
Pixel_t black;
|
||||||
|
|
||||||
|
|
||||||
int maxCh;
|
int maxCh;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie);
|
SettingsSummary(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie);
|
||||||
virtual ~MainSettings();
|
virtual ~SettingsSummary();
|
||||||
|
|
||||||
|
|
||||||
void CloseWindow() { printf("close window\n"); delete this; }
|
void CloseWindow() { printf("close window\n"); delete this; }
|
|
@ -11,7 +11,7 @@
|
||||||
1,
|
1,
|
||||||
8,
|
8,
|
||||||
32,
|
32,
|
||||||
1,
|
106,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
|
@ -93,15 +93,15 @@
|
||||||
120
|
120
|
||||||
],
|
],
|
||||||
"ChanCSRa": [
|
"ChanCSRa": [
|
||||||
2212,
|
2208,
|
||||||
16544,
|
16544,
|
||||||
16544,
|
16544,
|
||||||
16544,
|
16544,
|
||||||
16544,
|
16544,
|
||||||
16804,
|
16800,
|
||||||
16804,
|
16804,
|
||||||
16544,
|
16544,
|
||||||
16544,
|
420,
|
||||||
16544,
|
16544,
|
||||||
16544,
|
16544,
|
||||||
16544,
|
16544,
|
||||||
|
@ -263,7 +263,7 @@
|
||||||
65535,
|
65535,
|
||||||
4000,
|
4000,
|
||||||
65535,
|
65535,
|
||||||
65535,
|
4000,
|
||||||
65535,
|
65535,
|
||||||
65535,
|
65535,
|
||||||
65535,
|
65535,
|
||||||
|
@ -425,7 +425,7 @@
|
||||||
32768,
|
32768,
|
||||||
21845,
|
21845,
|
||||||
32768,
|
32768,
|
||||||
32768,
|
21845,
|
||||||
32768,
|
32768,
|
||||||
32768,
|
32768,
|
||||||
32768,
|
32768,
|
||||||
|
@ -443,7 +443,7 @@
|
||||||
1018,
|
1018,
|
||||||
666,
|
666,
|
||||||
1768,
|
1768,
|
||||||
1768,
|
1018,
|
||||||
1768,
|
1768,
|
||||||
1792,
|
1792,
|
||||||
1768,
|
1768,
|
||||||
|
@ -767,7 +767,7 @@
|
||||||
5000,
|
5000,
|
||||||
2504,
|
2504,
|
||||||
5000,
|
5000,
|
||||||
5000,
|
3750,
|
||||||
5000,
|
5000,
|
||||||
5000,
|
5000,
|
||||||
5000,
|
5000,
|
||||||
|
@ -1016,7 +1016,7 @@
|
||||||
"ChanNum": 0,
|
"ChanNum": 0,
|
||||||
"CoincPattern": 0,
|
"CoincPattern": 0,
|
||||||
"CoincWait": 0,
|
"CoincWait": 0,
|
||||||
"ControlTask": 0,
|
"ControlTask": 5,
|
||||||
"CrateID": 0,
|
"CrateID": 0,
|
||||||
"FIFOLength": 8188,
|
"FIFOLength": 8188,
|
||||||
"FastFilterRange": 0,
|
"FastFilterRange": 0,
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
#ifndef EVTREADER_H
|
#ifndef EVTREADER_H
|
||||||
#define EVTREADER_H
|
#define EVTREADER_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h> /// for FILE
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "TSystem.h"
|
|
||||||
#include "TObject.h"
|
|
||||||
#include "TFile.h"
|
|
||||||
#include "TTree.h"
|
|
||||||
#include "TString.h"
|
#include "TString.h"
|
||||||
#include "TBenchmark.h"
|
#include "TBenchmark.h"
|
||||||
|
#include "TMath.h"
|
||||||
|
|
||||||
#include "../DataBlock.h"
|
#include "../DataBlock.h"
|
||||||
|
|
||||||
|
@ -41,6 +38,9 @@ class evtReader{
|
||||||
|
|
||||||
TBenchmark gClock;
|
TBenchmark gClock;
|
||||||
|
|
||||||
|
long int inFilePosPrecent[10];
|
||||||
|
Long64_t blockIDPrecent[10];
|
||||||
|
|
||||||
///============================================ Methods
|
///============================================ Methods
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ class evtReader{
|
||||||
~evtReader();
|
~evtReader();
|
||||||
|
|
||||||
void OpenFile(TString inFileName);
|
void OpenFile(TString inFileName);
|
||||||
|
void CloseFile();
|
||||||
|
|
||||||
void UpdateFileSize();
|
void UpdateFileSize();
|
||||||
bool IsEndOfFile();
|
bool IsEndOfFile();
|
||||||
|
@ -59,10 +60,12 @@ class evtReader{
|
||||||
Long64_t GetBlockID() {return blockID;}
|
Long64_t GetBlockID() {return blockID;}
|
||||||
Long64_t GetNumberOfBlock() {return nBlock;}
|
Long64_t GetNumberOfBlock() {return nBlock;}
|
||||||
|
|
||||||
|
|
||||||
int ReadBlock(int opt = 0); /// 0 = default, fill data
|
int ReadBlock(int opt = 0); /// 0 = default, fill data
|
||||||
/// 1 = no fill data
|
/// 1 = no fill data
|
||||||
|
|
||||||
void ScanNumberOfBlock();
|
void ScanNumberOfBlock();
|
||||||
|
void JumptoPrecent(int precent); ///this is offset by 1 block
|
||||||
void PrintStatus(int mod);
|
void PrintStatus(int mod);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -81,6 +84,7 @@ evtReader::evtReader(){
|
||||||
blockID = -1;
|
blockID = -1;
|
||||||
endOfFile = false;
|
endOfFile = false;
|
||||||
isOpened = false;
|
isOpened = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,6 +128,17 @@ void evtReader::OpenFile(TString inFileName){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void evtReader::CloseFile(){
|
||||||
|
fclose(inFile);
|
||||||
|
isOpened = false;
|
||||||
|
data->Clear();
|
||||||
|
inFileSize = 0;
|
||||||
|
inFilePos = 0;
|
||||||
|
nBlock = 0;
|
||||||
|
blockID = -1;
|
||||||
|
endOfFile = false;
|
||||||
|
};
|
||||||
|
|
||||||
void evtReader::UpdateFileSize(){
|
void evtReader::UpdateFileSize(){
|
||||||
if( inFile == NULL ) return;
|
if( inFile == NULL ) return;
|
||||||
fseek(inFile, 0L, SEEK_END);
|
fseek(inFile, 0L, SEEK_END);
|
||||||
|
@ -242,8 +257,16 @@ int evtReader::ReadBlock(int opt){
|
||||||
void evtReader::ScanNumberOfBlock(){
|
void evtReader::ScanNumberOfBlock(){
|
||||||
|
|
||||||
nBlock = 0;
|
nBlock = 0;
|
||||||
|
int count = 0;
|
||||||
while( ReadBlock(1) != -1 ){
|
while( ReadBlock(1) != -1 ){
|
||||||
nBlock ++;
|
nBlock ++;
|
||||||
|
int haha = (inFilePos*10/inFileSize)%10;
|
||||||
|
if( haha == count ) {
|
||||||
|
inFilePosPrecent[count] = inFilePos;
|
||||||
|
blockIDPrecent[count] = blockID;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
PrintStatus(10000);
|
PrintStatus(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,6 +281,17 @@ void evtReader::ScanNumberOfBlock(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void evtReader::JumptoPrecent(int precent){
|
||||||
|
|
||||||
|
if( precent < 0 || precent > 10 ) {
|
||||||
|
printf("input precent should be 0 to 10\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fseek(inFile, inFilePosPrecent[precent], SEEK_SET);
|
||||||
|
blockID = blockIDPrecent[precent];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void evtReader::PrintStatus(int mod){
|
void evtReader::PrintStatus(int mod){
|
||||||
|
|
||||||
|
|
220
testing/test.cpp
220
testing/test.cpp
|
@ -34,6 +34,12 @@
|
||||||
#include "TRootCanvas.h"
|
#include "TRootCanvas.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include "evtReader.h"
|
||||||
|
|
||||||
long get_time();
|
long get_time();
|
||||||
static struct termios g_old_kbd_mode;
|
static struct termios g_old_kbd_mode;
|
||||||
static void cooked(void); ///set keyboard behaviour as wait-for-enter
|
static void cooked(void); ///set keyboard behaviour as wait-for-enter
|
||||||
|
@ -44,6 +50,13 @@ int keyboardhit();
|
||||||
|
|
||||||
bool QuitFlag = false;
|
bool QuitFlag = false;
|
||||||
|
|
||||||
|
Pixie16 * pixie = 0;
|
||||||
|
TGraph * gTrace = 0;
|
||||||
|
TCanvas * canvas = 0;
|
||||||
|
TH1F * hch = 0;
|
||||||
|
TH1F * hE = 0;
|
||||||
|
int ch2ns;
|
||||||
|
|
||||||
void PrintCommands(){
|
void PrintCommands(){
|
||||||
|
|
||||||
if (QuitFlag) return;
|
if (QuitFlag) return;
|
||||||
|
@ -58,13 +71,106 @@ void PrintCommands(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetADCTrace(int ch){
|
||||||
|
|
||||||
|
pixie->CaptureADCTrace(0, ch);
|
||||||
|
unsigned short * haha = pixie->GetADCTrace();
|
||||||
|
double dt = pixie->GetChannelSetting("XDT", 0, ch);
|
||||||
|
for( int i = 0 ; i < pixie->GetADCTraceLength(); i++){
|
||||||
|
gTrace->SetPoint(i, i*dt, haha[i]);
|
||||||
|
}
|
||||||
|
gTrace->GetXaxis()->SetTitle("time [us]");
|
||||||
|
canvas->cd(3); gTrace->Draw("APL");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetBaseline(int ch){
|
||||||
|
|
||||||
|
pixie->CaptureBaseLine(0, ch);
|
||||||
|
double * baseline = pixie->GetBasline();
|
||||||
|
double * baselineTime = pixie->GetBaselineTimestamp();
|
||||||
|
for( int i = 0 ; i < pixie->GetBaslineLength(); i++){
|
||||||
|
gTrace->SetPoint(i, baselineTime[i]*1000, baseline[i]);
|
||||||
|
//printf("%5d | %f, %f \n", i, baselineTime[i]*1000, baseline[i]);
|
||||||
|
}
|
||||||
|
canvas->cd(2); gTrace->Draw("APL");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ProcessData(){
|
||||||
|
|
||||||
|
printf("========== new thread of processing data\n");
|
||||||
|
|
||||||
|
evtReader * evt = new evtReader("haha.evt");
|
||||||
|
DataBlock * data = evt->data;
|
||||||
|
|
||||||
|
int jaja = 0;
|
||||||
|
|
||||||
|
while(true){
|
||||||
|
|
||||||
|
evt->UpdateFileSize();
|
||||||
|
|
||||||
|
while( evt->GetFileSize() > 0 && evt->GetFileSize() > evt->GetFilePos() ){
|
||||||
|
|
||||||
|
int status = evt->ReadBlock();
|
||||||
|
|
||||||
|
|
||||||
|
//printf("%d, %ld, %ld, %lld\n", status, evt->GetFilePos(), evt->GetFileSize(), evt->GetBlockID());
|
||||||
|
//data->Print(0);
|
||||||
|
|
||||||
|
hch->Fill( data->ch);
|
||||||
|
hE->Fill( data->energy );
|
||||||
|
|
||||||
|
if( data->eventID %100 == 0 ){
|
||||||
|
if( data->trace_length > 0 ) {
|
||||||
|
for( int i = 0 ; i < data->trace_length; i++){
|
||||||
|
gTrace->SetPoint(i, i*ch2ns, data->trace[i]);
|
||||||
|
}
|
||||||
|
//gTrace->GetYaxis()->SetRangeUser(0, 5000);
|
||||||
|
canvas->cd(3); gTrace->Draw("APL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( data->eventID %200 == 0 ){
|
||||||
|
//data->Print(0);
|
||||||
|
canvas->cd(1); hch->Draw();
|
||||||
|
canvas->cd(2); hE->Draw();
|
||||||
|
canvas->Modified();
|
||||||
|
canvas->Update();
|
||||||
|
gSystem->ProcessEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(500*1000);
|
||||||
|
evt->UpdateFileSize();
|
||||||
|
|
||||||
|
jaja++;
|
||||||
|
//printf("%10d, %d, %ld, %ld \n", jaja, pixie->IsRunning(), evt->GetFilePos(), evt->GetFileSize());
|
||||||
|
//if( jaja > 1000) break;
|
||||||
|
if( !pixie->IsRunning() && evt->GetFilePos() == evt->GetFileSize()) break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
printf("========= finished ProcessData()\n");
|
||||||
|
canvas->cd(1); hch->Draw();
|
||||||
|
canvas->cd(2); hE->Draw();
|
||||||
|
canvas->Modified();
|
||||||
|
canvas->Update();
|
||||||
|
gSystem->ProcessEvents();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
///##################################################
|
///##################################################
|
||||||
int main(int argc, char *argv[]){
|
int main(int argc, char *argv[]){
|
||||||
|
|
||||||
printf("Removing Pixie16Msg.log \n");
|
printf("Removing Pixie16Msg.log \n");
|
||||||
remove( "Pixie16Msg.log");
|
remove( "Pixie16Msg.log");
|
||||||
|
|
||||||
Pixie16 * pixie = new Pixie16();
|
pixie = new Pixie16();
|
||||||
if ( pixie->GetStatus() < 0 ) {
|
if ( pixie->GetStatus() < 0 ) {
|
||||||
QuitFlag = true;
|
QuitFlag = true;
|
||||||
printf("Exiting program... \n");
|
printf("Exiting program... \n");
|
||||||
|
@ -73,45 +179,27 @@ int main(int argc, char *argv[]){
|
||||||
|
|
||||||
TApplication * app = new TApplication("app", &argc, argv);
|
TApplication * app = new TApplication("app", &argc, argv);
|
||||||
|
|
||||||
TCanvas * canvas = new TCanvas("canvas", "Canvas", 1800, 400);
|
canvas = new TCanvas("canvas", "Canvas", 1800, 400);
|
||||||
canvas->Divide(3,1);
|
canvas->Divide(3,1);
|
||||||
|
|
||||||
TH1F * hch = new TH1F("hch", "channel", 16, 0, 16);
|
hch = new TH1F("hch", "channel", 16, 0, 16);
|
||||||
TH1F * hE = new TH1F("hE", "energy", 400, 0, 30000);
|
hE = new TH1F("hE", "energy", 400, 0, 30000);
|
||||||
TGraph * gTrace = new TGraph();
|
gTrace = new TGraph();
|
||||||
|
|
||||||
int ch2ns = pixie->GetCh2ns(0);
|
ch2ns = pixie->GetCh2ns(0);
|
||||||
gTrace->GetXaxis()->SetTitle("time [ns]");
|
gTrace->GetXaxis()->SetTitle("time [ns]");
|
||||||
|
|
||||||
|
|
||||||
//pixie->SetDigitizerPresetRunTime(100000, 0);
|
//pixie->SetDigitizerPresetRunTime(100000, 0);
|
||||||
//pixie->SetDigitizerSynchWait(0, 0); // not simultaneously
|
//pixie->SetDigitizerSynchWait(0, 0); // not simultaneously
|
||||||
//pixie->SetDigitizerInSynch(1, 0); //not simultaneously
|
//pixie->SetDigitizerInSynch(1, 0); //not simultaneously
|
||||||
|
|
||||||
pixie->PrintDigitizerSettings(0);
|
pixie->PrintDigitizerSettings(0);
|
||||||
|
|
||||||
/*
|
|
||||||
pixie->GetPolarity(0, 6, 1);
|
|
||||||
pixie->SetPolarity(false, 0, 6);
|
|
||||||
pixie->GetPolarity(0, 6, 1);
|
|
||||||
pixie->SetPolarity(true, 0, 6);
|
|
||||||
pixie->GetPolarity(0, 6, 1);
|
|
||||||
*/
|
|
||||||
|
|
||||||
int ch = 6;
|
int ch = 6;
|
||||||
double time = 1.0; ///sec
|
double time = 10.0; ///sec
|
||||||
|
|
||||||
/*
|
|
||||||
for( int i = 0; i < 16; i++){
|
|
||||||
pixie->SetChannelTriggerThreshold(5000, 0, i);
|
|
||||||
pixie->SetChannelOnOff(false, 0, i);
|
|
||||||
pixie->SetChannelTraceOnOff(false, 0, i);
|
|
||||||
pixie->SetChannelVOffset(0, 0, i);
|
|
||||||
}
|
|
||||||
* */
|
|
||||||
//pixie->AdjustOffset();
|
//pixie->AdjustOffset();
|
||||||
|
|
||||||
|
|
||||||
//pixie->SetChannelEnergyRiseTime(2, 0, ch);
|
//pixie->SetChannelEnergyRiseTime(2, 0, ch);
|
||||||
//pixie->SetChannelTriggerThreshold(300, 0, ch);
|
//pixie->SetChannelTriggerThreshold(300, 0, ch);
|
||||||
//pixie->SetChannelEnergyTau(50, 0, ch);
|
//pixie->SetChannelEnergyTau(50, 0, ch);
|
||||||
|
@ -128,94 +216,46 @@ int main(int argc, char *argv[]){
|
||||||
|
|
||||||
pixie->PrintChannelAllSettings(0, ch);
|
pixie->PrintChannelAllSettings(0, ch);
|
||||||
|
|
||||||
pixie->PrintChannelsMainSettings(0);
|
pixie->PrintChannelSettingsSummary(0);
|
||||||
|
|
||||||
|
|
||||||
//pixie->CaptureADCTrace(0, ch);
|
|
||||||
//unsigned short * haha = pixie->GetADCTrace();
|
|
||||||
//double dt = pixie->GetChannelSetting("XDT", 0, ch);
|
|
||||||
//for( int i = 0 ; i < pixie->GetADCTraceLength(); i++){
|
|
||||||
// gTrace->SetPoint(i, i*dt, haha[i]);
|
|
||||||
//}
|
|
||||||
//gTrace->GetXaxis()->SetTitle("time [us]");
|
|
||||||
//canvas->cd(3); gTrace->Draw("APL");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//pixie->CaptureBaseLine(0, ch);
|
|
||||||
//double * baseline = pixie->GetBasline();
|
|
||||||
//double * baselineTime = pixie->GetBaselineTimestamp();
|
|
||||||
//for( int i = 0 ; i < pixie->GetBaslineLength(); i++){
|
|
||||||
// gTrace->SetPoint(i, baselineTime[i]*1000, baseline[i]);
|
|
||||||
// //printf("%5d | %f, %f \n", i, baselineTime[i]*1000, baseline[i]);
|
|
||||||
//}
|
|
||||||
//canvas->cd(2); gTrace->Draw("APL");
|
|
||||||
|
|
||||||
|
|
||||||
pixie->OpenFile("haha.evt", false);
|
pixie->OpenFile("haha.evt", false);
|
||||||
|
|
||||||
printf("start run for %f sec\n", time);
|
printf("start run for %f sec\n", time);
|
||||||
|
|
||||||
uint32_t StartTime = get_time(), CurrentTime = get_time();
|
uint32_t StartTime = get_time(), CurrentTime = get_time();
|
||||||
|
uint32_t ElapsedTime = 0, PresenTime = StartTime;
|
||||||
|
|
||||||
pixie->StartRun(1);
|
pixie->StartRun(1);
|
||||||
|
|
||||||
DataBlock * data = pixie->GetData();
|
std::thread kakakaka(ProcessData);
|
||||||
|
|
||||||
while( CurrentTime - StartTime < time * 1000 ){
|
while( CurrentTime - StartTime < time * 1000 ){
|
||||||
|
|
||||||
pixie->ReadData(0);
|
pixie->ReadData(0);
|
||||||
pixie->SaveData();
|
pixie->SaveData();
|
||||||
|
|
||||||
while( pixie->GetNextWord() < pixie->GetnFIFOWords() ){
|
if( ElapsedTime > 1000 ) {
|
||||||
|
pixie->PrintStatistics(0);
|
||||||
//if( data->eventID %100 == 99 ) pixie->PrintExtFIFOWords();
|
PresenTime = CurrentTime;
|
||||||
bool breakFlag = pixie->ProcessSingleData();
|
ElapsedTime = 0;
|
||||||
|
|
||||||
//data->Print(0);
|
|
||||||
//printf("--------------next word : %d (%d) | event lenght : %d \n", pixie->GetNextWord(), pixie->GetnFIFOWords(), data->eventLength);
|
|
||||||
|
|
||||||
hch->Fill( data->ch);
|
|
||||||
hE->Fill( data->energy );
|
|
||||||
|
|
||||||
if( data->eventID %10 == 0 ){
|
|
||||||
if( data->trace_length > 0 ) {
|
|
||||||
for( int i = 0 ; i < data->trace_length; i++){
|
|
||||||
gTrace->SetPoint(i, i*ch2ns, data->trace[i]);
|
|
||||||
}
|
|
||||||
//gTrace->GetYaxis()->SetRangeUser(0, 5000);
|
|
||||||
canvas->cd(3); gTrace->Draw("APL");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( data->eventID %100 == 0 ){
|
|
||||||
//data->Print(0);
|
|
||||||
canvas->cd(1); hch->Draw();
|
|
||||||
canvas->cd(2); hE->Draw();
|
|
||||||
canvas->Modified();
|
|
||||||
canvas->Update();
|
|
||||||
gSystem->ProcessEvents();
|
|
||||||
}
|
|
||||||
if( breakFlag ) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentTime = get_time();
|
CurrentTime = get_time();
|
||||||
|
|
||||||
|
ElapsedTime = CurrentTime - PresenTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pixie->StopRun();
|
pixie->StopRun();
|
||||||
pixie->CloseFile();
|
pixie->CloseFile();
|
||||||
|
|
||||||
canvas->cd(1); hch->Draw();
|
|
||||||
canvas->cd(2); hE->Draw();
|
|
||||||
canvas->Modified();
|
|
||||||
canvas->Update();
|
|
||||||
gSystem->ProcessEvents();
|
|
||||||
|
|
||||||
//pixie->PrintData();
|
|
||||||
|
|
||||||
|
|
||||||
printf("===================================\n");
|
printf("===================================\n");
|
||||||
pixie->PrintStatistics(0);
|
pixie->PrintStatistics(0);
|
||||||
|
|
||||||
|
unsigned int haha = pixie->GetTotalNumWords();
|
||||||
|
printf("=========== total nFIFO words : %d (%f) \n", haha, haha/1256.);
|
||||||
|
|
||||||
|
//kakakaka.join();
|
||||||
|
|
||||||
//pixie->SaveSettings("/home/ryan/Pixie16/ryan/test_ryan.set");
|
//pixie->SaveSettings("/home/ryan/Pixie16/ryan/test_ryan.set");
|
||||||
|
|
||||||
|
@ -303,13 +343,15 @@ int main(int argc, char *argv[]){
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/**/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//delete pixie;
|
//delete pixie;
|
||||||
|
|
||||||
app->Run();
|
app->Run();
|
||||||
|
|
||||||
|
QuitFlag = true;
|
||||||
|
|
||||||
printf("================ end of program. \n");
|
printf("================ end of program. \n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user