added global_macro.h, new thread for filling histogram
This commit is contained in:
parent
66e2b9d8f6
commit
b1f5157f68
10
Makefile
10
Makefile
|
@ -48,23 +48,23 @@ pixieDict.cxx : pixieDAQ.h pixieDAQLinkDef.h
|
|||
@echo "--------- creating pcm and cxx "
|
||||
@rootcling -f pixieDict.cxx -c pixieDAQ.h -p $(PIXIE_LIB_PATH) pixieDAQLinkDef.h
|
||||
|
||||
pixieDAQ.o : pixieDict.cxx pixieDAQ.cpp pixieDAQ.h
|
||||
pixieDAQ.o : pixieDict.cxx pixieDAQ.cpp pixieDAQ.h global_macro.h
|
||||
@echo "--------- creating pixieDAQ.o"
|
||||
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) pixieDAQ.cpp Pixie16Class.cpp pixieDict.cxx $(ROOT_FLAG)
|
||||
|
||||
settingsSummary.o : settingsSummary.cpp settingsSummary.h
|
||||
settingsSummary.o : settingsSummary.cpp settingsSummary.h global_macro.h
|
||||
@echo "--------- creating settingsSummary.o"
|
||||
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) settingsSummary.cpp $(ROOT_FLAG)
|
||||
|
||||
scalarPanel.o : scalarPanel.cpp scalarPanel.h
|
||||
scalarPanel.o : scalarPanel.cpp scalarPanel.h global_macro.h
|
||||
@echo "--------- creating scalarPanel.o.o"
|
||||
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) scalarPanel.cpp $(ROOT_FLAG)
|
||||
|
||||
moduleSetting.o : moduleSetting.cpp moduleSetting.h
|
||||
moduleSetting.o : moduleSetting.cpp moduleSetting.h global_macro.h
|
||||
@echo "--------- creating moduleSetting.o"
|
||||
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) moduleSetting.cpp $(ROOT_FLAG)
|
||||
|
||||
channelSetting.o : channelSetting.cpp channelSetting.h
|
||||
channelSetting.o : channelSetting.cpp channelSetting.h global_macro.h
|
||||
@echo "--------- creating channelSetting.o"
|
||||
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) channelSetting.cpp $(ROOT_FLAG)
|
||||
|
||||
|
|
|
@ -56,8 +56,11 @@ Pixie16::Pixie16(){
|
|||
|
||||
FIFOEnergies = new unsigned short[MAXFIFODATABLOCK];
|
||||
FIFOChannels = new unsigned short[MAXFIFODATABLOCK];
|
||||
FIFOMods = new unsigned short[MAXFIFODATABLOCK];
|
||||
FIFOTimestamps = new unsigned long long[MAXFIFODATABLOCK];
|
||||
FIFONumDataBlock = 0;
|
||||
AccumulatedFIFONumDataBlock = 0;
|
||||
FIFOisUsed = false;
|
||||
|
||||
data = new DataBlock();
|
||||
nextWord = 0;
|
||||
|
@ -72,6 +75,7 @@ Pixie16::~Pixie16(){
|
|||
|
||||
delete FIFOEnergies;
|
||||
delete FIFOChannels;
|
||||
delete FIFOMods;
|
||||
delete FIFOTimestamps;
|
||||
|
||||
delete PXISlotMap;
|
||||
|
@ -380,10 +384,12 @@ void Pixie16::StartRun(bool listMode){
|
|||
if( listMode ){
|
||||
///listmode
|
||||
totNumFIFOWords = 0;
|
||||
AccumulatedFIFONumDataBlock = 0;
|
||||
nextWord = 0;
|
||||
retval = Pixie16StartListModeRun(NumModules, LIST_MODE_RUN, mode);
|
||||
if( CheckError("Pixie16StartListModeRun") < 0 ) return;
|
||||
printf("\033[32m LIST_MODE run\033[0m\n");
|
||||
|
||||
}else{
|
||||
///MCA mode
|
||||
retval = Pixie16StartHistogramRun(NumModules, mode);
|
||||
|
@ -392,8 +398,6 @@ void Pixie16::StartRun(bool listMode){
|
|||
}
|
||||
|
||||
isRunning = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -427,15 +431,15 @@ void Pixie16::ReadData(unsigned short modID){
|
|||
retval = Pixie16ReadDataFromExternalFIFO(ExtFIFO_Data, nFIFOWords, modID);
|
||||
CheckError("Pixie16ReadDataFromExternalFIFO");
|
||||
totNumFIFOWords += nFIFOWords;
|
||||
FIFONumDataBlock = 0;
|
||||
}
|
||||
}else{
|
||||
printf("Pixie16 is not running.\n");
|
||||
///printf("Pixie16 is not running.\n");
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int Pixie16::ScanNumDataBlockInExtFIFO(){
|
||||
|
||||
unsigned int FIFONumDataBlock = 0;
|
||||
unsigned int nextWordtemp = nextWord;
|
||||
|
||||
///if( nextWordtemp < nFIFOWords ) printf("============= FIFOWord : %u \n", nFIFOWords);
|
||||
|
@ -445,6 +449,7 @@ unsigned int Pixie16::ScanNumDataBlockInExtFIFO(){
|
|||
|
||||
FIFOEnergies[FIFONumDataBlock] = (ExtFIFO_Data[nextWordtemp + 3] & 0xFFFF );
|
||||
FIFOChannels[FIFONumDataBlock] = (ExtFIFO_Data[nextWordtemp] & 0xF );
|
||||
FIFOMods[FIFONumDataBlock] = ((ExtFIFO_Data[nextWordtemp] >> 4) & 0xF) - 2;
|
||||
FIFOTimestamps[FIFONumDataBlock] = ((unsigned long long)(ExtFIFO_Data[nextWordtemp+2] & 0xFFFF) << 32) + ExtFIFO_Data[nextWordtemp+1];
|
||||
|
||||
nextWordtemp += eventLen;
|
||||
|
@ -453,6 +458,7 @@ unsigned int Pixie16::ScanNumDataBlockInExtFIFO(){
|
|||
}
|
||||
|
||||
nextWord = nextWordtemp - nFIFOWords ;
|
||||
AccumulatedFIFONumDataBlock += FIFONumDataBlock;
|
||||
|
||||
return FIFONumDataBlock;
|
||||
}
|
||||
|
|
|
@ -79,10 +79,13 @@ private:
|
|||
unsigned int * Statistics;
|
||||
unsigned int totNumFIFOWords;
|
||||
|
||||
unsigned short * FIFOMods;
|
||||
unsigned short * FIFOChannels;
|
||||
unsigned short * FIFOEnergies;
|
||||
unsigned long long * FIFOTimestamps;
|
||||
unsigned int FIFONumDataBlock;
|
||||
unsigned int AccumulatedFIFONumDataBlock;
|
||||
bool FIFOisUsed;
|
||||
|
||||
double Baselines[3640], TimeStamps[3640]; ///for baseline
|
||||
unsigned short ADCTrace[8192];
|
||||
|
@ -209,11 +212,16 @@ public:
|
|||
|
||||
int ProcessSingleData();
|
||||
unsigned int ScanNumDataBlockInExtFIFO(); /// also fill the FIFOEnergies, FIFOChannels, FIFOTimestamps, output FIFONumDataBlock
|
||||
unsigned int GetAccumulatedFIFONumDataBlock() {return AccumulatedFIFONumDataBlock;}
|
||||
unsigned int GetFIFONumDataBlock() {return FIFONumDataBlock;}
|
||||
unsigned short * GetFIFOEnergies() {return FIFOEnergies;}
|
||||
unsigned short * GetFIFOChannels() {return FIFOChannels;}
|
||||
unsigned short * GetFIFOMods() {return FIFOMods;}
|
||||
unsigned long long * GetFIFOTimestamps() {return FIFOTimestamps;}
|
||||
|
||||
/// FIFOisUsed is not used in this Class, it is for sync in thread
|
||||
void SetFIFOisUsed(bool isUsed) {this->FIFOisUsed = isUsed;};
|
||||
bool GetFIFOisUsed() {return FIFOisUsed;}
|
||||
|
||||
void PrintExtFIFOWords() {
|
||||
unsigned int nWords = (ExtFIFO_Data[nextWord] >> 17) & 0x3FFF;
|
||||
|
|
|
@ -7,13 +7,11 @@
|
|||
#include <TGLabel.h>
|
||||
|
||||
#include "Pixie16Class.h"
|
||||
#include "global_macro.h"
|
||||
|
||||
class TGWindow;
|
||||
class TGMainFrame;
|
||||
|
||||
#define MAXCH 16
|
||||
#define NUM_CHANNEL_SETTING 25
|
||||
|
||||
class ChannelSetting{
|
||||
private:
|
||||
TGMainFrame * fMain;
|
||||
|
|
10
global_macro.h
Normal file
10
global_macro.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef GLOBAL_MACRO_H
|
||||
#define GLOBAL_MACRO_H
|
||||
|
||||
#define MAXCH 16
|
||||
#define MAXMOD 13
|
||||
|
||||
#define NUM_MOD_SETTING 13
|
||||
#define NUM_CHANNEL_SETTING 25
|
||||
|
||||
#endif
|
|
@ -7,13 +7,11 @@
|
|||
#include <TGLabel.h>
|
||||
|
||||
#include "Pixie16Class.h"
|
||||
#include "global_macro.h"
|
||||
|
||||
class TGWindow;
|
||||
class TGMainFrame;
|
||||
|
||||
#define MAXCH 16
|
||||
#define NUM_MOD_SETTING 13
|
||||
|
||||
class ModuleSetting{
|
||||
private:
|
||||
TGMainFrame * fMain;
|
||||
|
|
161
pixieDAQ.cpp
161
pixieDAQ.cpp
|
@ -37,7 +37,10 @@ enum MenuIdentifiers{
|
|||
Pixie16 * MainWindow::pixie = NULL;
|
||||
TGTextEdit * MainWindow::teLog = NULL;
|
||||
TRootEmbeddedCanvas * MainWindow::fEcanvas = NULL;
|
||||
TH1F * MainWindow::h1[13][16]={NULL};
|
||||
TGNumberEntry * MainWindow::modIDEntry = NULL;
|
||||
TGNumberEntry * MainWindow::chEntry = NULL;
|
||||
TH1F * MainWindow::hEnergy[MAXMOD][MAXCH]={NULL};
|
||||
bool MainWindow::isEnergyHistFilled = false;
|
||||
|
||||
MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||
|
||||
|
@ -50,6 +53,12 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
|||
GoodBye();
|
||||
}
|
||||
|
||||
for( unsigned int i = 0; i < pixie->GetNumModule() ; i++){
|
||||
for( int j = 0; j < MAXCH ; j++){
|
||||
hEnergy[i][j] = new TH1F(Form("hEnergy%02d_%02d", i, j), Form("Energy mod:%02d ch:%02d", i, j), 200, 0, 160000);
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a main frame
|
||||
fMain = new TGMainFrame(p,w,h);
|
||||
///fMain->SetWMPosition(500, 500); //does not work
|
||||
|
@ -96,6 +105,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
|||
modIDEntry = new TGNumberEntry(hframe1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
||||
modIDEntry->SetWidth(50);
|
||||
modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1);
|
||||
modIDEntry->Connect("Modified()", "MainWindow", this, "ChangeMod()");
|
||||
hframe1->AddFrame(modIDEntry, uniLayoutHints);
|
||||
|
||||
TGLabel * lb2 = new TGLabel(hframe1, "Ch :");
|
||||
|
@ -104,6 +114,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
|||
chEntry = new TGNumberEntry(hframe1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
||||
chEntry->SetWidth(50);
|
||||
chEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetDigitizerNumChannel(0));
|
||||
chEntry->Connect("Modified()", "MainWindow", this, "ChangeChannel()");
|
||||
hframe1->AddFrame(chEntry, uniLayoutHints);
|
||||
|
||||
TGTextButton *bGetADCTrace = new TGTextButton(hframe1,"Get &ADC Trace");
|
||||
|
@ -131,10 +142,19 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
|||
TGHorizontalFrame *hframe2 = new TGHorizontalFrame(group2,200,30);
|
||||
group2->AddFrame(hframe2);
|
||||
|
||||
tePath = new TGTextEntry(hframe2, new TGTextBuffer(10));
|
||||
tePath->SetText("haha.evt");
|
||||
TGLabel * lb1Prefix = new TGLabel(hframe2, "Save Prefix:");
|
||||
hframe2->AddFrame(lb1Prefix, uniLayoutHints);
|
||||
|
||||
tePath = new TGTextEntry(hframe2, new TGTextBuffer(30));
|
||||
tePath->SetWidth(50);
|
||||
tePath->SetText("haha");
|
||||
hframe2->AddFrame(tePath, uniLayoutHints);
|
||||
|
||||
runIDEntry = new TGNumberEntry(hframe2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
||||
runIDEntry->SetWidth(50);
|
||||
runIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 999);
|
||||
hframe2->AddFrame(runIDEntry, uniLayoutHints);
|
||||
|
||||
bStartRun = new TGTextButton(hframe2,"Start &Run");
|
||||
bStartRun->Connect("Clicked()","MainWindow",this,"StartRun()");
|
||||
hframe2->AddFrame(bStartRun, uniLayoutHints);
|
||||
|
@ -186,10 +206,8 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
|||
/// Map main frame
|
||||
fMain->MapWindow();
|
||||
|
||||
|
||||
|
||||
/// setup thread
|
||||
thread = new TThread("hahaha", SaveData, (void *) 1);
|
||||
saveDataThread = new TThread("hahaha", SaveData, (void *) 1);
|
||||
fillHistThread = new TThread("kakaka", FillHistogram, (void *) 1);
|
||||
|
||||
settingsSummary = NULL;
|
||||
|
@ -229,10 +247,11 @@ MainWindow::~MainWindow() {
|
|||
delete channelSetting;
|
||||
delete scalarPanel;
|
||||
|
||||
delete thread;
|
||||
delete saveDataThread;
|
||||
delete fillHistThread;
|
||||
|
||||
delete gTrace;
|
||||
|
||||
/// Clean up used widgets: frames, buttons, layout hints
|
||||
fMain->Cleanup();
|
||||
delete fMain;
|
||||
|
@ -307,11 +326,10 @@ void MainWindow::GetADCTrace() {
|
|||
}
|
||||
gTrace->GetXaxis()->SetTitle("time [us]");
|
||||
gTrace->GetXaxis()->SetRangeUser(0, pixie->GetADCTraceLength()*dt);
|
||||
gTrace->Draw("APL");
|
||||
|
||||
TCanvas *fCanvas = fEcanvas->GetCanvas();
|
||||
fCanvas->cd();
|
||||
fCanvas->Update();
|
||||
fEcanvas->GetCanvas()->cd();
|
||||
gTrace->Draw("APL");
|
||||
fEcanvas->GetCanvas()->Update();
|
||||
|
||||
}
|
||||
|
||||
|
@ -333,11 +351,10 @@ void MainWindow::GetBaseLine(){
|
|||
gTrace->SetPoint(i, baselineTime[i]*1000, baseline[i]);
|
||||
}
|
||||
gTrace->GetXaxis()->SetTitle("time [ns]");
|
||||
gTrace->Draw("APL");
|
||||
|
||||
TCanvas *fCanvas = fEcanvas->GetCanvas();
|
||||
fCanvas->cd();
|
||||
fCanvas->Update();
|
||||
fEcanvas->GetCanvas()->cd();
|
||||
gTrace->Draw("APL");
|
||||
fEcanvas->GetCanvas()->Update();
|
||||
|
||||
}
|
||||
|
||||
|
@ -388,11 +405,10 @@ void MainWindow::Scope(){
|
|||
gTrace->GetXaxis()->SetTitle("time [ns]");
|
||||
gTrace->GetXaxis()->SetRangeUser(0, data->trace_length * dt);
|
||||
gTrace->SetTitle(Form("mod-%d, ch-%02d\n", modID, ch));
|
||||
gTrace->Draw("APL");
|
||||
|
||||
TCanvas *fCanvas = fEcanvas->GetCanvas();
|
||||
fCanvas->cd();
|
||||
fCanvas->Update();
|
||||
fEcanvas->GetCanvas()->cd();
|
||||
gTrace->Draw("APL");
|
||||
fEcanvas->GetCanvas()->Update();
|
||||
|
||||
bFitTrace->SetEnabled(true);
|
||||
|
||||
|
@ -466,11 +482,9 @@ void MainWindow::FitTrace(){
|
|||
|
||||
gTrace->Fit("fit", "qR0");
|
||||
|
||||
fEcanvas->GetCanvas()->cd();
|
||||
traceFunc->Draw("same");
|
||||
|
||||
TCanvas *fCanvas = fEcanvas->GetCanvas();
|
||||
fCanvas->cd();
|
||||
fCanvas->Update();
|
||||
fEcanvas->GetCanvas()->Update();
|
||||
|
||||
LogMsg("========= fit result");
|
||||
TString text[5] ={"start time", "rise time", "decay time", "amp", "baseline"};
|
||||
|
@ -497,12 +511,23 @@ void MainWindow::GoodBye(){
|
|||
|
||||
void MainWindow::StartRun(){
|
||||
|
||||
pixie->OpenFile(tePath->GetText(), false);
|
||||
TString saveFileName = Form("%s_%03lu.evt", tePath->GetText(), runIDEntry->GetIntNumber());
|
||||
|
||||
LogMsg(Form("Start Run. Save data at %s.\n", tePath->GetText()));
|
||||
pixie->OpenFile(saveFileName.Data(), false);
|
||||
|
||||
LogMsg(Form("Start Run. Save data at %s.\n", saveFileName.Data()));
|
||||
|
||||
///clear histogram;
|
||||
isEnergyHistFilled = false;
|
||||
for( unsigned int iMod = 0 ; iMod < pixie->GetNumModule(); iMod++){
|
||||
for( int j = 0; j < MAXCH ; j++){
|
||||
hEnergy[iMod][j]->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
pixie->StartRun(1);
|
||||
if( pixie->IsRunning() ) thread->Run(); /// call SaveData()
|
||||
if( pixie->IsRunning() ) saveDataThread->Run(); /// call SaveData()
|
||||
if( pixie->IsRunning() ) fillHistThread->Run(); /// call SaveData()
|
||||
|
||||
bStartRun->SetEnabled(false);
|
||||
bStopRun->SetEnabled(true);
|
||||
|
@ -523,6 +548,8 @@ void MainWindow::StopRun(){
|
|||
bStartRun->SetEnabled(true);
|
||||
bStopRun->SetEnabled(false);
|
||||
|
||||
runIDEntry->SetIntNumber(runIDEntry->GetIntNumber()+1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -536,6 +563,25 @@ void MainWindow::OpenScalar(){
|
|||
}
|
||||
|
||||
|
||||
void MainWindow::ChangeMod(){
|
||||
|
||||
if( isEnergyHistFilled ){
|
||||
int modID = modIDEntry->GetNumber();
|
||||
int ch = chEntry->GetNumber();
|
||||
|
||||
fEcanvas->GetCanvas()->cd();
|
||||
hEnergy[modID][ch]->Draw();
|
||||
fEcanvas->GetCanvas()->Update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::ChangeChannel(){
|
||||
ChangeMod();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::LogMsg(TString msg){
|
||||
|
||||
time_t now = time(0);
|
||||
|
@ -576,16 +622,20 @@ void * MainWindow::SaveData(void* ptr){
|
|||
|
||||
if( pixie->GetnFIFOWords() > 0 ) {
|
||||
pixie->SaveData();
|
||||
///ScanNumDataBlockInExtFIFO() should be here after ReadData(). becasue not a whlole dataBlock is in FIFO.
|
||||
pixie->ScanNumDataBlockInExtFIFO(); //TODO need to check the time comsumtion
|
||||
pixie->SetFIFOisUsed(false);
|
||||
|
||||
localClock.Stop("timer");
|
||||
newTime = localClock.GetRealTime("timer"); /// sec
|
||||
localClock.Start("timer");
|
||||
|
||||
if( newTime - oldTime > 1 ) {
|
||||
//double MByteRead = pixie->GetnFIFOWords()*4./1024./1024.;
|
||||
//if( MByteRead > 70 && pauseTime > 10) pauseTime = pauseTime - 20;
|
||||
///printf("Thread[SaveData] , FIFO: %u nData %u | %f\n", pixie->GetnFIFOWords(), nData, newTime);
|
||||
|
||||
if( newTime - oldTime > 1 ) {
|
||||
///double MByteRead = pixie->GetnFIFOWords()*4./1024./1024.;
|
||||
///if( MByteRead > 70 && pauseTime > 10) pauseTime = pauseTime - 20;
|
||||
|
||||
//TODO Fill HISTORGRAM;
|
||||
time_t now = time(0);
|
||||
tm * ltm = localtime(&now);
|
||||
int year = 1900 + ltm->tm_year;
|
||||
|
@ -601,10 +651,10 @@ void * MainWindow::SaveData(void* ptr){
|
|||
oldFileSize = newFileSize;
|
||||
oldTime = newTime;
|
||||
|
||||
//teLog->AddLine(Form("[%4d-%02d-%02d %02d:%02d:%02d] File Size : %.2f MB [%.2f MB/s], %.2f MB readed",
|
||||
// year, month, day, hour, minute, secound, newFileSize, rate, MByteRead));
|
||||
teLog->AddLine(Form("[%4d-%02d-%02d %02d:%02d:%02d] File Size : %.2f MB [%.2f MB/s]",
|
||||
year, month, day, hour, minute, secound, newFileSize, rate));
|
||||
///teLog->AddLine(Form("[%4d-%02d-%02d %02d:%02d:%02d] File Size : %.2f MB [%.2f MB/s], %.2f MB readed",
|
||||
/// year, month, day, hour, minute, secound, newFileSize, rate, MByteRead));
|
||||
teLog->AddLine(Form("[%4d-%02d-%02d %02d:%02d:%02d] File Size : %.2f MB [%.2f MB/s] Number of events recorded : %u",
|
||||
year, month, day, hour, minute, secound, newFileSize, rate, pixie->GetAccumulatedFIFONumDataBlock()));
|
||||
teLog->LineDown();
|
||||
}
|
||||
}
|
||||
|
@ -621,9 +671,50 @@ void * MainWindow::SaveData(void* ptr){
|
|||
|
||||
void * MainWindow::FillHistogram(void *ptr){
|
||||
|
||||
//using evtReader or process from ExtFIFOword, but in case in complete data
|
||||
///double oldTime = 0, newTime = 0;
|
||||
///TBenchmark localClock;
|
||||
///localClock.Reset();
|
||||
///localClock.Start("timer");
|
||||
|
||||
while( pixie->IsRunning() ){
|
||||
|
||||
if( pixie->GetFIFOisUsed() == false && pixie->GetnFIFOWords() > 0 && pixie->GetFIFONumDataBlock() > 0 ) {
|
||||
|
||||
///localClock.Stop("timer");
|
||||
///newTime = localClock.GetRealTime("timer"); /// sec
|
||||
///localClock.Start("timer");
|
||||
|
||||
///unsigned int nextWord = pixie->GetNextWord();
|
||||
unsigned int nData = pixie->GetFIFONumDataBlock();
|
||||
unsigned short channels[nData];
|
||||
unsigned short energies[nData];
|
||||
unsigned short mods[nData];
|
||||
long long int timestamps[nData];
|
||||
std::memcpy(mods, pixie->GetFIFOMods(), sizeof(unsigned short) * nData);
|
||||
std::memcpy(channels, pixie->GetFIFOChannels(), sizeof(unsigned short) * nData);
|
||||
std::memcpy(energies, pixie->GetFIFOEnergies(), sizeof(unsigned short) * nData);
|
||||
std::memcpy(timestamps, pixie->GetFIFOTimestamps(), sizeof(long long int) * nData);
|
||||
|
||||
///printf("Thread[FillHistogram] ============= %u, nData : %d | %f\n",pixie->GetnFIFOWords(), nData, newTime);
|
||||
for( unsigned int i = 0; i < nData; i++){
|
||||
///printf("%3u| %2u, %3u, %7u, %llu \n", i, mods[i], channels[i], energies[i], timestamps[i]);
|
||||
hEnergy[mods[i]][channels[i]]->Fill(energies[i]);
|
||||
}
|
||||
isEnergyHistFilled = true;
|
||||
pixie->SetFIFOisUsed(true);
|
||||
|
||||
}
|
||||
|
||||
int modID = modIDEntry->GetNumber();
|
||||
int ch = chEntry->GetNumber();
|
||||
|
||||
fEcanvas->GetCanvas()->cd();
|
||||
hEnergy[modID][ch]->Draw();
|
||||
fEcanvas->GetCanvas()->Update();
|
||||
|
||||
///usleep(300*1000);
|
||||
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
|
14
pixieDAQ.h
14
pixieDAQ.h
|
@ -12,6 +12,7 @@
|
|||
#include <TBenchmark.h>
|
||||
|
||||
#include "Pixie16Class.h"
|
||||
#include "global_macro.h"
|
||||
#include "settingsSummary.h"
|
||||
#include "scalarPanel.h"
|
||||
#include "moduleSetting.h"
|
||||
|
@ -31,8 +32,11 @@ private:
|
|||
TGMenuBar *fMenuBar;
|
||||
TGPopupMenu *fMenuFile, *fMenuSettings;
|
||||
|
||||
TGNumberEntry * modIDEntry, *chEntry;
|
||||
static TGNumberEntry * modIDEntry, *chEntry;
|
||||
|
||||
TGNumberEntry * runIDEntry;
|
||||
TGTextEntry * tePath;
|
||||
|
||||
static TGTextEdit * teLog;
|
||||
|
||||
TGTextButton *bStartRun;
|
||||
|
@ -47,11 +51,11 @@ private:
|
|||
ChannelSetting * channelSetting;
|
||||
ScalarPanel * scalarPanel;
|
||||
|
||||
TThread * thread;
|
||||
|
||||
TThread * saveDataThread;
|
||||
TThread * fillHistThread;
|
||||
|
||||
static TH1F * h1[13][16];
|
||||
static TH1F * hEnergy[MAXMOD][MAXCH];
|
||||
static bool isEnergyHistFilled;
|
||||
|
||||
TGraph * gTrace;
|
||||
|
||||
|
@ -74,6 +78,8 @@ public:
|
|||
void OpenScalar();
|
||||
|
||||
static void * FillHistogram(void * ptr); /// thread
|
||||
void ChangeMod();
|
||||
void ChangeChannel();
|
||||
|
||||
|
||||
void LogMsg(TString msg);
|
||||
|
|
|
@ -34,7 +34,7 @@ ScalarPanel::ScalarPanel(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie)
|
|||
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain, w, 50 );
|
||||
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
|
||||
|
||||
int width = 30;
|
||||
int width = 35;
|
||||
|
||||
///------ Channel labels
|
||||
TGVerticalFrame * hChannelLabels = new TGVerticalFrame(hframe);
|
||||
|
|
|
@ -8,13 +8,11 @@
|
|||
#include <TGLabel.h>
|
||||
|
||||
#include "Pixie16Class.h"
|
||||
#include "global_macro.h"
|
||||
|
||||
class TGWindow;
|
||||
class TGMainFrame;
|
||||
|
||||
#define MAXCH 16
|
||||
#define MAXMOD 13
|
||||
|
||||
class ScalarPanel{
|
||||
private:
|
||||
TGMainFrame * fMain;
|
||||
|
|
|
@ -8,12 +8,11 @@
|
|||
#include <TGLabel.h>
|
||||
|
||||
#include "Pixie16Class.h"
|
||||
#include "global_macro.h"
|
||||
|
||||
class TGWindow;
|
||||
class TGMainFrame;
|
||||
|
||||
#define MAXCH 16
|
||||
|
||||
class SettingsSummary{
|
||||
private:
|
||||
TGMainFrame * fMain;
|
||||
|
|
Loading…
Reference in New Issue
Block a user