Added progress callback system to avoid infecting evb with gui components. Switched in ROOT made file gui where possible, reorganzied main window to be prettier

This commit is contained in:
Gordon McCann 2021-12-16 17:38:58 -05:00
parent bd9e2cb520
commit 8c6278217c
11 changed files with 272 additions and 258 deletions

View File

@ -11,6 +11,7 @@
#include <TGTextViewStream.h> #include <TGTextViewStream.h>
#include <TGProgressBar.h> #include <TGProgressBar.h>
#include <TTimer.h> #include <TTimer.h>
#include <TGFileDialog.h>
#include <TGComboBox.h> #include <TGComboBox.h>
#include "../evb/EVBApp.h" #include "../evb/EVBApp.h"
@ -46,6 +47,7 @@ public:
void RunMerge(const char* dir, const char* file); void RunMerge(const char* dir, const char* file);
void DisableAllInput(); void DisableAllInput();
void EnableAllInput(); void EnableAllInput();
void SetProgressBarPosition(long value, long total);
enum WidgetId enum WidgetId
@ -94,6 +96,8 @@ private:
TGPopupMenu *fFileMenu; TGPopupMenu *fFileMenu;
TGFileInfo* fInfo;
EventBuilder::EVBApp fBuilder; EventBuilder::EVBApp fBuilder;
int counter; int counter;

View File

@ -19,13 +19,12 @@
namespace EventBuilder { namespace EventBuilder {
CompassRun::CompassRun() : CompassRun::CompassRun() :
m_directory(""), m_scalerinput(""), m_runNum(0), m_scaler_flag(false), m_pb(nullptr) m_directory(""), m_scalerinput(""), m_runNum(0), m_scaler_flag(false), m_progressFraction(0.1)
{ {
} }
CompassRun::CompassRun(const std::string& dir) : CompassRun::CompassRun(const std::string& dir) :
m_directory(dir), m_scalerinput(""), m_runNum(0), m_scaler_flag(false), m_pb(nullptr) m_directory(dir), m_scalerinput(""), m_runNum(0), m_scaler_flag(false), m_progressFraction(0.1)
{ {
} }
@ -186,12 +185,7 @@ namespace EventBuilder {
return; return;
} }
unsigned int count = 0, flush = m_totalHits*0.1, flush_count = 0; unsigned int count = 0, flush = m_totalHits*m_progressFraction, flush_count = 0;
if(m_pb)
{
flush = m_totalHits*0.01;
SetProgressBar();
}
startIndex = 0; //Reset the startIndex startIndex = 0; //Reset the startIndex
if(flush == 0) if(flush == 0)
@ -201,18 +195,9 @@ namespace EventBuilder {
count++; count++;
if(count == flush) if(count == flush)
{ //Progress Log { //Progress Log
if(m_pb)
{
m_pb->Increment(count);
gSystem->ProcessEvents();
count=0;
}
else
{
count = 0; count = 0;
flush_count++; flush_count++;
EVB_INFO("Percent of run built: {0} %",flush_count*10); m_progressCallback(flush_count*flush, m_totalHits);
}
} }
if(!GetHitsFromFiles()) if(!GetHitsFromFiles())
@ -248,12 +233,7 @@ namespace EventBuilder {
return; return;
} }
unsigned int count = 0, flush = m_totalHits*0.1, flush_count = 0; unsigned int count = 0, flush = m_totalHits*m_progressFraction, flush_count = 0;
if(m_pb)
{
flush = m_totalHits*0.01;
SetProgressBar();
}
startIndex = 0; startIndex = 0;
SlowSort coincidizer(window, mapfile); SlowSort coincidizer(window, mapfile);
@ -264,19 +244,10 @@ namespace EventBuilder {
{ {
count++; count++;
if(count == flush) if(count == flush)
{
if(m_pb)
{
m_pb->Increment(count);
gSystem->ProcessEvents();
count=0;
}
else
{ {
count = 0; count = 0;
flush_count++; flush_count++;
EVB_INFO("Percent of run built: {0} %",flush_count*10); m_progressCallback(count, m_totalHits);
}
} }
if(!GetHitsFromFiles()) if(!GetHitsFromFiles())
@ -324,12 +295,7 @@ namespace EventBuilder {
return; return;
} }
unsigned int count = 0, flush = m_totalHits*0.1, flush_count = 0; unsigned int count = 0, flush = m_totalHits*m_progressFraction, flush_count = 0;
if(m_pb)
{
flush = m_totalHits*0.01;
SetProgressBar();
}
startIndex = 0; startIndex = 0;
CoincEvent this_event; CoincEvent this_event;
@ -346,19 +312,10 @@ namespace EventBuilder {
{ {
count++; count++;
if(count == flush) if(count == flush)
{
if(m_pb)
{
m_pb->Increment(count);
gSystem->ProcessEvents();
count=0;
}
else
{ {
count = 0; count = 0;
flush_count++; flush_count++;
EVB_INFO("Percent of run built: {0} %",flush_count*10); m_progressCallback(count, m_totalHits);
}
} }
if(!GetHitsFromFiles()) if(!GetHitsFromFiles())
@ -419,12 +376,7 @@ namespace EventBuilder {
return; return;
} }
unsigned int count = 0, flush = m_totalHits*0.1, flush_count = 0; unsigned int count = 0, flush = m_totalHits*m_progressFraction, flush_count = 0;
if(m_pb)
{
flush = m_totalHits*0.01;
SetProgressBar();
}
startIndex = 0; startIndex = 0;
CoincEvent this_event; CoincEvent this_event;
@ -450,19 +402,10 @@ namespace EventBuilder {
{ {
count++; count++;
if(count == flush) if(count == flush)
{
if(m_pb)
{
m_pb->Increment(count);
gSystem->ProcessEvents();
count=0;
}
else
{ {
count = 0; count = 0;
flush_count++; flush_count++;
EVB_INFO("Percent of run built: {0} %",flush_count*10); m_progressCallback(count, m_totalHits);
}
} }
if(!GetHitsFromFiles()) if(!GetHitsFromFiles())
@ -521,12 +464,7 @@ namespace EventBuilder {
return; return;
} }
unsigned int count = 0, flush = m_totalHits*0.1, flush_count = 0; unsigned int count = 0, flush = m_totalHits*m_progressFraction, flush_count = 0;
if(m_pb)
{
flush = m_totalHits*0.01;
SetProgressBar();
}
startIndex = 0; startIndex = 0;
CoincEvent this_event; CoincEvent this_event;
@ -556,19 +494,10 @@ namespace EventBuilder {
{ {
count++; count++;
if(count == flush) if(count == flush)
{
if(m_pb)
{
m_pb->Increment(count);
gSystem->ProcessEvents();
count=0;
}
else
{ {
count = 0; count = 0;
flush_count++; flush_count++;
EVB_INFO("Percent of run built: {0} %",flush_count*10); m_progressCallback(flush_count*flush, m_totalHits);
}
} }
if(!GetHitsFromFiles()) if(!GetHitsFromFiles())
@ -610,13 +539,4 @@ namespace EventBuilder {
analyzer.ClearHashTable(); analyzer.ClearHashTable();
output->Close(); output->Close();
} }
void CompassRun::SetProgressBar()
{
m_pb->SetMax(m_totalHits);
m_pb->SetMin(0);
m_pb->SetPosition(0);
gSystem->ProcessEvents();
}
} }

View File

@ -14,9 +14,8 @@
#include "DataStructs.h" #include "DataStructs.h"
#include "RunCollector.h" #include "RunCollector.h"
#include "ShiftMap.h" #include "ShiftMap.h"
#include "ProgressCallback.h"
#include <TParameter.h> #include <TParameter.h>
#include <TGProgressBar.h>
#include <TSystem.h>
namespace EventBuilder { namespace EventBuilder {
@ -39,14 +38,14 @@ namespace EventBuilder {
void Convert2FastAnalyzedRoot(const std::string& name, const std::string& mapfile, double window, double fsi_window, double fic_window, void Convert2FastAnalyzedRoot(const std::string& name, const std::string& mapfile, double window, double fsi_window, double fic_window,
int zt, int at, int zp, int ap, int ze, int ae, double bke, double b, double theta); int zt, int at, int zp, int ap, int ze, int ae, double bke, double b, double theta);
inline void AttachProgressBar(TGProgressBar* pb) { m_pb = pb; } inline void SetProgressCallbackFunc(const ProgressCallbackFunc& function) { m_progressCallback = function; }
inline void SetProgressFraction(double frac) { m_progressFraction = frac; }
private: private:
bool GetBinaryFiles(); bool GetBinaryFiles();
bool GetHitsFromFiles(); bool GetHitsFromFiles();
void SetScalers(); void SetScalers();
void ReadScalerData(const std::string& filename); void ReadScalerData(const std::string& filename);
void SetProgressBar();
std::string m_directory, m_scalerinput; std::string m_directory, m_scalerinput;
std::vector<CompassFile> m_datafiles; std::vector<CompassFile> m_datafiles;
@ -66,8 +65,8 @@ namespace EventBuilder {
//Scaler switch //Scaler switch
bool m_scaler_flag; bool m_scaler_flag;
//GUI progress bar, if attached ProgressCallbackFunc m_progressCallback;
TGProgressBar* m_pb; double m_progressFraction;
}; };
} }

View File

@ -19,15 +19,21 @@ namespace EventBuilder {
EVBApp::EVBApp() : EVBApp::EVBApp() :
m_rmin(0), m_rmax(0), m_ZT(0), m_AT(0), m_ZP(0), m_AP(0), m_ZE(0), m_AE(0), m_ZR(0), m_AR(0), m_rmin(0), m_rmax(0), m_ZT(0), m_AT(0), m_ZP(0), m_AP(0), m_ZE(0), m_AE(0), m_ZR(0), m_AR(0),
m_B(0), m_Theta(0), m_BKE(0), m_workspace("none"), m_mapfile("none"), m_shiftfile("none"), m_B(0), m_Theta(0), m_BKE(0), m_progressFraction(0.1), m_workspace("none"), m_mapfile("none"), m_shiftfile("none"),
m_cutList("none"), m_SlowWindow(0), m_FastWindowIonCh(0), m_FastWindowSABRE(0), m_pb(nullptr) m_cutList("none"), m_SlowWindow(0), m_FastWindowIonCh(0), m_FastWindowSABRE(0) {
{ SetProgressCallbackFunc(BIND_PROGRESS_CALLBACK_FUNCTION(EVBApp::DefaultProgressCallback));
} }
EVBApp::~EVBApp() EVBApp::~EVBApp()
{ {
} }
void EVBApp::DefaultProgressCallback(long curVal, long totalVal)
{
double fraction = curVal/totalVal;
EVB_INFO("Percent of run built: {0}", fraction*100);
}
bool EVBApp::ReadConfigFile(const std::string& fullpath) bool EVBApp::ReadConfigFile(const std::string& fullpath)
{ {
EVB_INFO("Reading in EVB configuration from file {0}...", fullpath); EVB_INFO("Reading in EVB configuration from file {0}...", fullpath);
@ -123,12 +129,12 @@ namespace EventBuilder {
std::string analyze_dir = m_workspace+"/analyzed/"; std::string analyze_dir = m_workspace+"/analyzed/";
std::string plot_file = m_workspace+"/histograms/run_"+std::to_string(m_rmin)+"_"+std::to_string(m_rmax)+".root"; std::string plot_file = m_workspace+"/histograms/run_"+std::to_string(m_rmin)+"_"+std::to_string(m_rmax)+".root";
SFPPlotter grammer; SFPPlotter grammer;
grammer.SetProgressCallbackFunc(m_progressCallback);
grammer.SetProgressFraction(m_progressFraction);
grammer.ApplyCutlist(m_cutList); grammer.ApplyCutlist(m_cutList);
EVB_INFO("Generating histograms from analyzed runs [{0}, {1}] with Cut List {2}...", m_rmin, m_rmax, m_cutList); EVB_INFO("Generating histograms from analyzed runs [{0}, {1}] with Cut List {2}...", m_rmin, m_rmax, m_cutList);
EVB_INFO("Output file will be named {0}",plot_file); EVB_INFO("Output file will be named {0}",plot_file);
if(m_pb)
grammer.AttachProgressBar(m_pb);
grabber.SetSearchParams(analyze_dir, "", ".root", m_rmin, m_rmax); grabber.SetSearchParams(analyze_dir, "", ".root", m_rmin, m_rmax);
if(grabber.GrabFilesInRange()) if(grabber.GrabFilesInRange())
{ {
@ -157,8 +163,8 @@ namespace EventBuilder {
CompassRun converter(unpack_dir); CompassRun converter(unpack_dir);
converter.SetShiftMap(m_shiftfile); converter.SetShiftMap(m_shiftfile);
converter.SetScalerInput(m_scalerfile); converter.SetScalerInput(m_scalerfile);
if(m_pb) converter.SetProgressCallbackFunc(m_progressCallback);
converter.AttachProgressBar(m_pb); converter.SetProgressFraction(m_progressFraction);
EVB_INFO("Beginning conversion..."); EVB_INFO("Beginning conversion...");
for(int i=m_rmin; i<=m_rmax; i++) for(int i=m_rmin; i<=m_rmax; i++)
@ -214,8 +220,8 @@ namespace EventBuilder {
CompassRun converter(unpack_dir); CompassRun converter(unpack_dir);
converter.SetShiftMap(m_shiftfile); converter.SetShiftMap(m_shiftfile);
converter.SetScalerInput(m_scalerfile); converter.SetScalerInput(m_scalerfile);
if(m_pb) converter.SetProgressCallbackFunc(m_progressCallback);
converter.AttachProgressBar(m_pb); converter.SetProgressFraction(m_progressFraction);
EVB_INFO("Beginning conversion..."); EVB_INFO("Beginning conversion...");
@ -258,8 +264,8 @@ namespace EventBuilder {
CompassRun converter(unpack_dir); CompassRun converter(unpack_dir);
converter.SetShiftMap(m_shiftfile); converter.SetShiftMap(m_shiftfile);
converter.SetScalerInput(m_scalerfile); converter.SetScalerInput(m_scalerfile);
if(m_pb) converter.SetProgressCallbackFunc(m_progressCallback);
converter.AttachProgressBar(m_pb); converter.SetProgressFraction(m_progressFraction);
EVB_INFO("Beginning conversion..."); EVB_INFO("Beginning conversion...");
int count=0; int count=0;
@ -301,8 +307,8 @@ namespace EventBuilder {
CompassRun converter(unpack_dir); CompassRun converter(unpack_dir);
converter.SetShiftMap(m_shiftfile); converter.SetShiftMap(m_shiftfile);
converter.SetScalerInput(m_scalerfile); converter.SetScalerInput(m_scalerfile);
if(m_pb) converter.SetProgressCallbackFunc(m_progressCallback);
converter.AttachProgressBar(m_pb); converter.SetProgressFraction(m_progressFraction);
EVB_INFO("Beginning conversion..."); EVB_INFO("Beginning conversion...");
int count=0; int count=0;
@ -345,8 +351,8 @@ namespace EventBuilder {
CompassRun converter(unpack_dir); CompassRun converter(unpack_dir);
converter.SetShiftMap(m_shiftfile); converter.SetShiftMap(m_shiftfile);
converter.SetScalerInput(m_scalerfile); converter.SetScalerInput(m_scalerfile);
if(m_pb) converter.SetProgressCallbackFunc(m_progressCallback);
converter.AttachProgressBar(m_pb); converter.SetProgressFraction(m_progressFraction);
EVB_INFO("Beginning conversion..."); EVB_INFO("Beginning conversion...");
int count=0; int count=0;

View File

@ -10,12 +10,13 @@
#define EVBAPP_H #define EVBAPP_H
#include "RunCollector.h" #include "RunCollector.h"
#include <TGProgressBar.h> #include "ProgressCallback.h"
namespace EventBuilder { namespace EventBuilder {
class EVBApp { class EVBApp {
public: public:
EVBApp(); EVBApp();
~EVBApp(); ~EVBApp();
@ -63,7 +64,9 @@ namespace EventBuilder {
inline std::string GetCutList() const { return m_cutList; } inline std::string GetCutList() const { return m_cutList; }
inline std::string GetScalerFile() const { return m_scalerfile; } inline std::string GetScalerFile() const { return m_scalerfile; }
inline void AttachProgressBar(TGProgressBar* pb) { m_pb = pb; } void DefaultProgressCallback(long curVal, long totalVal);
inline void SetProgressCallbackFunc(const ProgressCallbackFunc& function) { m_progressCallback = function; }
inline void SetProgressFraction(double frac) { m_progressFraction = frac; }
enum Operation enum Operation
{ {
@ -81,6 +84,7 @@ namespace EventBuilder {
int m_rmin, m_rmax; int m_rmin, m_rmax;
int m_ZT, m_AT, m_ZP, m_AP, m_ZE, m_AE, m_ZR, m_AR; int m_ZT, m_AT, m_ZP, m_AP, m_ZE, m_AE, m_ZR, m_AR;
double m_B, m_Theta, m_BKE; double m_B, m_Theta, m_BKE;
double m_progressFraction;
std::string m_workspace; std::string m_workspace;
std::string m_mapfile, m_shiftfile; std::string m_mapfile, m_shiftfile;
@ -93,7 +97,7 @@ namespace EventBuilder {
RunCollector grabber; RunCollector grabber;
TGProgressBar* m_pb; ProgressCallbackFunc m_progressCallback;
}; };

View File

@ -0,0 +1,14 @@
#ifndef PROGRESSCALLBACK_H
#define PROGRESSCALLBACK_H
#include <functional>
#define BIND_PROGRESS_CALLBACK_FUNCTION(func) std::bind(&func, this, std::placeholders::_1, std::placeholders::_2)
namespace EventBuilder {
using ProgressCallbackFunc = std::function<void(long, long)>;
}
#endif

View File

@ -12,10 +12,9 @@
namespace EventBuilder { namespace EventBuilder {
/*Generates storage and initializes pointers*/ /*Generates storage and initializes pointers*/
SFPPlotter::SFPPlotter() SFPPlotter::SFPPlotter() :
event_address(new ProcessedEvent()), m_progressFraction(0.1)
{ {
event_address = new ProcessedEvent();
m_pb = nullptr;
} }
SFPPlotter::~SFPPlotter() SFPPlotter::~SFPPlotter()
@ -248,12 +247,7 @@ namespace EventBuilder {
THashTable* table = new THashTable(); THashTable* table = new THashTable();
long blentries = chain->GetEntries(); long blentries = chain->GetEntries();
long count=0, flush_val=blentries*0.1, flush_count=0; long count=0, flush_val=blentries*m_progressFraction, flush_count=0;
if(m_pb)
{
flush_val = blentries*0.01;
SetProgressBar(blentries);
}
for(long i=0; i<chain->GetEntries(); i++) for(long i=0; i<chain->GetEntries(); i++)
@ -261,15 +255,9 @@ namespace EventBuilder {
count++; count++;
if(count == flush_val) if(count == flush_val)
{ {
if(m_pb) {
m_pb->Increment(count);
gSystem->ProcessEvents();
count = 0;
} else {
flush_count++; flush_count++;
count=0; count=0;
EVB_INFO("Percent of data processed: {0} %",flush_count*10); m_progressCallback(flush_count*flush_val, blentries);
}
} }
chain->GetEntry(i); chain->GetEntry(i);
MakeUncutHistograms(*event_address, table); MakeUncutHistograms(*event_address, table);
@ -288,13 +276,4 @@ namespace EventBuilder {
delete outfile; delete outfile;
} }
void SFPPlotter::SetProgressBar(long total)
{
m_pb->SetMax(total);
m_pb->SetMin(0);
m_pb->SetPosition(0);
gSystem->ProcessEvents();
}
} }

View File

@ -10,8 +10,8 @@
#define SFPCLEANER_H #define SFPCLEANER_H
#include "DataStructs.h" #include "DataStructs.h"
#include "ProgressCallback.h"
#include "CutHandler.h" #include "CutHandler.h"
#include <TGProgressBar.h>
namespace EventBuilder { namespace EventBuilder {
@ -20,12 +20,12 @@ namespace EventBuilder {
public: public:
SFPPlotter(); SFPPlotter();
~SFPPlotter(); ~SFPPlotter();
inline void AttachProgressBar(TGProgressBar* pb) { m_pb = pb; }
inline void ApplyCutlist(const std::string& listname) { cutter.SetCuts(listname); } inline void ApplyCutlist(const std::string& listname) { cutter.SetCuts(listname); }
void Run(const std::vector<std::string>& files, const std::string& output); void Run(const std::vector<std::string>& files, const std::string& output);
inline void SetProgressCallbackFunc(const ProgressCallbackFunc& function) { m_progressCallback = function; }
inline void SetProgressFraction(double frac) { m_progressFraction = frac; }
private: private:
void SetProgressBar(long total);
void Chain(const std::vector<std::string>& files); //Form TChain void Chain(const std::vector<std::string>& files); //Form TChain
void MakeUncutHistograms(const ProcessedEvent& ev, THashTable* table); void MakeUncutHistograms(const ProcessedEvent& ev, THashTable* table);
void MakeCutHistograms(const ProcessedEvent& ev, THashTable* table); void MakeCutHistograms(const ProcessedEvent& ev, THashTable* table);
@ -40,7 +40,8 @@ namespace EventBuilder {
/*Cuts*/ /*Cuts*/
CutHandler cutter; CutHandler cutter;
TGProgressBar* m_pb; //GUI progress ProgressCallbackFunc m_progressCallback;
double m_progressFraction;
}; };

View File

@ -11,6 +11,7 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
SetCleanup(kDeepCleanup); SetCleanup(kDeepCleanup);
MAIN_W = w; MAIN_H = h; MAIN_W = w; MAIN_H = h;
fInfo = new TGFileInfo();
//Organization hints //Organization hints
TGLayoutHints *fchints = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,5,5,5,5); TGLayoutHints *fchints = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,5,5,5,5);
TGLayoutHints *fhints = new TGLayoutHints(kLHintsExpandX|kLHintsCenterY,5,5,5,5); TGLayoutHints *fhints = new TGLayoutHints(kLHintsExpandX|kLHintsCenterY,5,5,5,5);
@ -21,11 +22,10 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
//Make the containers and link up all signals/slots //Make the containers and link up all signals/slots
TGVerticalFrame *InputFrame = new TGVerticalFrame(this, w, h*0.9); TGGroupFrame* pathGroup = new TGGroupFrame(this, "Working Paths");
TGVerticalFrame *NameFrame = new TGVerticalFrame(pathGroup, w, h*0.3);
TGVerticalFrame *NameFrame = new TGVerticalFrame(InputFrame, w, h*0.4); TGHorizontalFrame *WorkFrame = new TGHorizontalFrame(NameFrame, w, h*0.06);
TGHorizontalFrame *WorkFrame = new TGHorizontalFrame(NameFrame, w, h*0.1);
TGLabel* workLabel = new TGLabel(WorkFrame, "Workspace Directory:"); TGLabel* workLabel = new TGLabel(WorkFrame, "Workspace Directory:");
fWorkField = new TGTextEntry(WorkFrame, new TGTextBuffer(120), WorkDir); fWorkField = new TGTextEntry(WorkFrame, new TGTextBuffer(120), WorkDir);
fWorkField->Resize(w*0.25, fWorkField->GetDefaultHeight()); fWorkField->Resize(w*0.25, fWorkField->GetDefaultHeight());
@ -36,7 +36,7 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
WorkFrame->AddFrame(fWorkField, fhints); WorkFrame->AddFrame(fWorkField, fhints);
WorkFrame->AddFrame(fOpenWorkButton, bhints); WorkFrame->AddFrame(fOpenWorkButton, bhints);
TGHorizontalFrame *CMapFrame = new TGHorizontalFrame(NameFrame, w, h*0.1); TGHorizontalFrame *CMapFrame = new TGHorizontalFrame(NameFrame, w, h*0.06);
TGLabel* cmaplabel = new TGLabel(CMapFrame, "Channel Map File:"); TGLabel* cmaplabel = new TGLabel(CMapFrame, "Channel Map File:");
fCMapField = new TGTextEntry(CMapFrame, new TGTextBuffer(120), Cmap); fCMapField = new TGTextEntry(CMapFrame, new TGTextBuffer(120), Cmap);
fCMapField->Resize(w*0.25, fCMapField->GetDefaultHeight()); fCMapField->Resize(w*0.25, fCMapField->GetDefaultHeight());
@ -47,7 +47,7 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
CMapFrame->AddFrame(fCMapField, fhints); CMapFrame->AddFrame(fCMapField, fhints);
CMapFrame->AddFrame(fOpenCMapButton, bhints); CMapFrame->AddFrame(fOpenCMapButton, bhints);
TGHorizontalFrame *SMapFrame = new TGHorizontalFrame(NameFrame, w, h*0.1); TGHorizontalFrame *SMapFrame = new TGHorizontalFrame(NameFrame, w, h*0.06);
TGLabel* smaplabel = new TGLabel(SMapFrame, "Board Shift File:"); TGLabel* smaplabel = new TGLabel(SMapFrame, "Board Shift File:");
fSMapField = new TGTextEntry(SMapFrame, new TGTextBuffer(120), Smap); fSMapField = new TGTextEntry(SMapFrame, new TGTextBuffer(120), Smap);
fSMapField->Resize(w*0.25, fSMapField->GetDefaultHeight()); fSMapField->Resize(w*0.25, fSMapField->GetDefaultHeight());
@ -58,7 +58,7 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
SMapFrame->AddFrame(fSMapField, fhints); SMapFrame->AddFrame(fSMapField, fhints);
SMapFrame->AddFrame(fOpenSMapButton, bhints); SMapFrame->AddFrame(fOpenSMapButton, bhints);
TGHorizontalFrame *ScalerFrame = new TGHorizontalFrame(NameFrame, w, h*0.1); TGHorizontalFrame *ScalerFrame = new TGHorizontalFrame(NameFrame, w, h*0.06);
TGLabel* sclabel = new TGLabel(ScalerFrame, "Scaler File: "); TGLabel* sclabel = new TGLabel(ScalerFrame, "Scaler File: ");
fScalerField = new TGTextEntry(ScalerFrame, new TGTextBuffer(120), Scaler); fScalerField = new TGTextEntry(ScalerFrame, new TGTextBuffer(120), Scaler);
fScalerField->Connect("ReturnPressed()","EVBMainFrame",this,"UpdateScaler()"); fScalerField->Connect("ReturnPressed()","EVBMainFrame",this,"UpdateScaler()");
@ -68,7 +68,7 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
ScalerFrame->AddFrame(fScalerField, fhints); ScalerFrame->AddFrame(fScalerField, fhints);
ScalerFrame->AddFrame(fOpenScalerButton, bhints); ScalerFrame->AddFrame(fOpenScalerButton, bhints);
TGHorizontalFrame *CutFrame = new TGHorizontalFrame(NameFrame, w, h*0.1); TGHorizontalFrame *CutFrame = new TGHorizontalFrame(NameFrame, w, h*0.06);
TGLabel* clabel = new TGLabel(CutFrame, "Cut List: "); TGLabel* clabel = new TGLabel(CutFrame, "Cut List: ");
fCutField = new TGTextEntry(CutFrame, new TGTextBuffer(120), Cut); fCutField = new TGTextEntry(CutFrame, new TGTextBuffer(120), Cut);
fCutField->Connect("ReturnPressed()","EVBMainFrame",this,"UpdateCut()"); fCutField->Connect("ReturnPressed()","EVBMainFrame",this,"UpdateCut()");
@ -84,62 +84,108 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
NameFrame->AddFrame(ScalerFrame, fhints); NameFrame->AddFrame(ScalerFrame, fhints);
NameFrame->AddFrame(CutFrame, fhints); NameFrame->AddFrame(CutFrame, fhints);
pathGroup->AddFrame(NameFrame, fhints);
TGHorizontalFrame *ParamFrame = new TGHorizontalFrame(InputFrame, w, h*0.1);
TGLabel *bkelabel = new TGLabel(ParamFrame, "Beam KE (MeV):");
fBKEField = new TGNumberEntryField(ParamFrame, Bke, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative);
TGLabel *bfieldlabel = new TGLabel(ParamFrame, "B-Field (G):");
fBField = new TGNumberEntryField(ParamFrame, BField, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative);
TGLabel *thetalabel = new TGLabel(ParamFrame, "Angle (deg):");
fThetaField = new TGNumberEntryField(ParamFrame, Theta, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative);
TGLabel *ztlabel = new TGLabel(ParamFrame, "ZT:");
fZTField = new TGNumberEntryField(ParamFrame, ZT, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
TGLabel *atlabel = new TGLabel(ParamFrame, "AT:");
fATField = new TGNumberEntryField(ParamFrame, AT, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
TGLabel *zplabel = new TGLabel(ParamFrame, "ZP:");
fZPField = new TGNumberEntryField(ParamFrame, ZP, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
TGLabel *aplabel = new TGLabel(ParamFrame, "AP:");
fAPField = new TGNumberEntryField(ParamFrame, AP, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
TGLabel *zelabel = new TGLabel(ParamFrame, "ZE:");
fZEField = new TGNumberEntryField(ParamFrame, ZE, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
TGLabel *aelabel = new TGLabel(ParamFrame, "AE:");
fAEField = new TGNumberEntryField(ParamFrame, AE, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
ParamFrame->AddFrame(bkelabel, lhints);
ParamFrame->AddFrame(fBKEField, fhints);
ParamFrame->AddFrame(bfieldlabel, lhints);
ParamFrame->AddFrame(fBField, fhints);
ParamFrame->AddFrame(thetalabel, lhints);
ParamFrame->AddFrame(fThetaField, fhints);
ParamFrame->AddFrame(ztlabel, lhints);
ParamFrame->AddFrame(fZTField, fhints);
ParamFrame->AddFrame(atlabel, lhints);
ParamFrame->AddFrame(fATField, fhints);
ParamFrame->AddFrame(zplabel, lhints);
ParamFrame->AddFrame(fZPField, fhints);
ParamFrame->AddFrame(aplabel, lhints);
ParamFrame->AddFrame(fAPField, fhints);
ParamFrame->AddFrame(zelabel, lhints);
ParamFrame->AddFrame(fZEField, fhints);
ParamFrame->AddFrame(aelabel, lhints);
ParamFrame->AddFrame(fAEField, fhints);
TGHorizontalFrame *WindowFrame = new TGHorizontalFrame(InputFrame, w, h*0.1); TGHorizontalFrame *ParamFrame = new TGHorizontalFrame(this, w, h*0.4);
TGLabel *slowlabel = new TGLabel(WindowFrame, "Slow Coincidence Window (ps):");
fSlowWindowField = new TGNumberEntryField(WindowFrame, SlowWind, 0, TGNumberEntry::kNESReal, TGNumberEntry::kNEANonNegative);
TGLabel *fasticlabel = new TGLabel(WindowFrame, "Fast Coincidence Window IC (ps):");
fFastICField = new TGNumberEntryField(WindowFrame, FastWind_IC, 0, TGNumberEntry::kNESReal, TGNumberEntry::kNEANonNegative);
TGLabel *fastsabrelabel = new TGLabel(WindowFrame, "Fast Coincidence Window SABRE (ps):");
fFastSABREField = new TGNumberEntryField(WindowFrame, FastWind_Sabre, 0, TGNumberEntry::kNESReal, TGNumberEntry::kNEANonNegative);
WindowFrame->AddFrame(slowlabel, lhints);
WindowFrame->AddFrame(fSlowWindowField, fhints);
WindowFrame->AddFrame(fasticlabel, lhints);
WindowFrame->AddFrame(fFastICField, fhints);
WindowFrame->AddFrame(fastsabrelabel, lhints);
WindowFrame->AddFrame(fFastSABREField, fhints);
TGHorizontalFrame *RunFrame = new TGHorizontalFrame(InputFrame, w, h*0.1); TGGroupFrame* reactionGroup = new TGGroupFrame(ParamFrame, "Reaction Inputs");
TGLabel *typelabel = new TGLabel(RunFrame, "Operation Type:"); TGHorizontalFrame* reactionFrame = new TGHorizontalFrame(reactionGroup, w*0.7, h*0.5);
fTypeBox = new TGComboBox(RunFrame, TypeBox);
TGVerticalFrame* targFrame = new TGVerticalFrame(reactionFrame, w*0.175, h*0.5);
TGHorizontalFrame* zTargFrame = new TGHorizontalFrame(targFrame, w*0.3, h*0.2);
TGLabel *ztlabel = new TGLabel(zTargFrame, "ZT:");
fZTField = new TGNumberEntryField(zTargFrame, ZT, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
zTargFrame->AddFrame(ztlabel, lhints);
zTargFrame->AddFrame(fZTField, fhints);
TGHorizontalFrame* aTargFrame = new TGHorizontalFrame(targFrame, w*0.175, h*0.2);
TGLabel *atlabel = new TGLabel(aTargFrame, "AT:");
fATField = new TGNumberEntryField(aTargFrame, AT, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
aTargFrame->AddFrame(atlabel, lhints);
aTargFrame->AddFrame(fATField, fhints);
targFrame->AddFrame(zTargFrame, fhints);
targFrame->AddFrame(aTargFrame, fhints);
TGVerticalFrame* projFrame = new TGVerticalFrame(reactionFrame, w*0.175, h*0.4);
TGHorizontalFrame* zProjFrame = new TGHorizontalFrame(projFrame, w*0.175, h*0.2);
TGLabel *zplabel = new TGLabel(zProjFrame, "ZP:");
fZPField = new TGNumberEntryField(zProjFrame, ZP, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
zProjFrame->AddFrame(zplabel, lhints);
zProjFrame->AddFrame(fZPField, fhints);
TGHorizontalFrame* aProjFrame = new TGHorizontalFrame(projFrame, w*0.175, h*0.2);
TGLabel *aplabel = new TGLabel(aProjFrame, "AP:");
fAPField = new TGNumberEntryField(aProjFrame, AP, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
aProjFrame->AddFrame(aplabel, lhints);
aProjFrame->AddFrame(fAPField, fhints);
projFrame->AddFrame(zProjFrame, fhints);
projFrame->AddFrame(aProjFrame, fhints);
TGVerticalFrame* ejectFrame = new TGVerticalFrame(reactionFrame, w*0.175, h*0.4);
TGHorizontalFrame* zEjectFrame = new TGHorizontalFrame(ejectFrame, w*0.175, h*0.2);
TGLabel *zelabel = new TGLabel(zEjectFrame, "ZE:");
fZEField = new TGNumberEntryField(zEjectFrame, ZE, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
zEjectFrame->AddFrame(zelabel, lhints);
zEjectFrame->AddFrame(fZEField, fhints);
TGHorizontalFrame* aEjectFrame = new TGHorizontalFrame(ejectFrame, w*0.175, h*0.2);
TGLabel *aelabel = new TGLabel(aEjectFrame, "AE:");
fAEField = new TGNumberEntryField(aEjectFrame, AE, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
aEjectFrame->AddFrame(aelabel, lhints);
aEjectFrame->AddFrame(fAEField, fhints);
ejectFrame->AddFrame(zEjectFrame, fhints);
ejectFrame->AddFrame(aEjectFrame, fhints);
TGVerticalFrame* extraFrame = new TGVerticalFrame(reactionFrame, w*0.175, h*0.4);
TGHorizontalFrame* beamFrame = new TGHorizontalFrame(extraFrame, w*0.175, h*0.15);
TGLabel *bkelabel = new TGLabel(beamFrame, "Beam KE (MeV):");
fBKEField = new TGNumberEntryField(beamFrame, Bke, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative);
beamFrame->AddFrame(bkelabel, lhints);
beamFrame->AddFrame(fBKEField, fhints);
TGHorizontalFrame* bfFrame = new TGHorizontalFrame(extraFrame, w*0.175, h*0.15);
TGLabel *bfieldlabel = new TGLabel(bfFrame, "B-Field (G):");
fBField = new TGNumberEntryField(bfFrame, BField, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative);
bfFrame->AddFrame(bfieldlabel, lhints);
bfFrame->AddFrame(fBField, fhints);
TGHorizontalFrame* thetaFrame = new TGHorizontalFrame(extraFrame, w*0.175, h*0.15);
TGLabel *thetalabel = new TGLabel(thetaFrame, "Angle (deg):");
fThetaField = new TGNumberEntryField(thetaFrame, Theta, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative);
thetaFrame->AddFrame(thetalabel, lhints);
thetaFrame->AddFrame(fThetaField, fhints);
extraFrame->AddFrame(beamFrame, fhints);
extraFrame->AddFrame(bfFrame, fhints);
extraFrame->AddFrame(thetaFrame, fhints);
reactionFrame->AddFrame(targFrame, fhints);
reactionFrame->AddFrame(projFrame, fhints);
reactionFrame->AddFrame(ejectFrame, fhints);
reactionFrame->AddFrame(extraFrame, fhints);
reactionGroup->AddFrame(reactionFrame, fhints);
TGGroupFrame* eventGroup = new TGGroupFrame(ParamFrame, "Event Inputs");
TGVerticalFrame* eventFrame = new TGVerticalFrame(eventGroup, w*0.3, h*0.5);
TGHorizontalFrame *slowFrame = new TGHorizontalFrame(eventFrame, w*0.4, h*0.1);
TGLabel *slowlabel = new TGLabel(slowFrame, "Slow Coincidence Window (ps):");
fSlowWindowField = new TGNumberEntryField(slowFrame, SlowWind, 0, TGNumberEntry::kNESReal, TGNumberEntry::kNEANonNegative);
slowFrame->AddFrame(slowlabel, lhints);
slowFrame->AddFrame(fSlowWindowField, fhints);
TGHorizontalFrame* fastICFrame = new TGHorizontalFrame(eventFrame, w*0.3, h*0.1);
TGLabel *fasticlabel = new TGLabel(fastICFrame, "Fast Coincidence Window IC (ps):");
fFastICField = new TGNumberEntryField(fastICFrame, FastWind_IC, 0, TGNumberEntry::kNESReal, TGNumberEntry::kNEANonNegative);
fastICFrame->AddFrame(fasticlabel, lhints);
fastICFrame->AddFrame(fFastICField, fhints);
TGHorizontalFrame* fastSABREFrame = new TGHorizontalFrame(eventFrame, w*0.3, h*0.1);
TGLabel *fastsabrelabel = new TGLabel(fastSABREFrame, "Fast Coincidence Window SABRE (ps):");
fFastSABREField = new TGNumberEntryField(fastSABREFrame, FastWind_Sabre, 0, TGNumberEntry::kNESReal, TGNumberEntry::kNEANonNegative);
fastSABREFrame->AddFrame(fastsabrelabel, lhints);
fastSABREFrame->AddFrame(fFastSABREField, fhints);
TGHorizontalFrame *opFrame = new TGHorizontalFrame(eventFrame, w*0.3, h*0.1);
TGLabel *typelabel = new TGLabel(opFrame, "Operation Type:");
fTypeBox = new TGComboBox(opFrame, TypeBox);
//Needs modification for new conversion based sorting GWM -- Dec 2020 //Needs modification for new conversion based sorting GWM -- Dec 2020
fTypeBox->AddEntry("Convert Slow", EventBuilder::EVBApp::Operation::ConvertSlow); fTypeBox->AddEntry("Convert Slow", EventBuilder::EVBApp::Operation::ConvertSlow);
fTypeBox->AddEntry("Convert Fast", EventBuilder::EVBApp::Operation::ConvertFast); fTypeBox->AddEntry("Convert Fast", EventBuilder::EVBApp::Operation::ConvertFast);
@ -150,32 +196,44 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
fTypeBox->AddEntry("Plot", EventBuilder::EVBApp::Operation::Plot); fTypeBox->AddEntry("Plot", EventBuilder::EVBApp::Operation::Plot);
fTypeBox->Resize(200,20); fTypeBox->Resize(200,20);
fTypeBox->Connect("Selected(Int_t, Int_t)","EVBMainFrame",this,"HandleTypeSelection(Int_t,Int_t)"); fTypeBox->Connect("Selected(Int_t, Int_t)","EVBMainFrame",this,"HandleTypeSelection(Int_t,Int_t)");
TGLabel *rminlabel = new TGLabel(RunFrame, "Min Run:"); opFrame->AddFrame(typelabel, lhints);
fRMinField = new TGNumberEntryField(RunFrame, RMin, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative); opFrame->AddFrame(fTypeBox, fhints);
TGLabel *rmaxlabel = new TGLabel(RunFrame, "Max Run:");
fRMaxField = new TGNumberEntryField(RunFrame, RMax, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative); TGHorizontalFrame* rminFrame = new TGHorizontalFrame(eventFrame, w*0.3, h*0.1);
fRunButton = new TGTextButton(RunFrame, "Run!"); TGLabel *rminlabel = new TGLabel(rminFrame, "Min Run:");
fRMinField = new TGNumberEntryField(rminFrame, RMin, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
rminFrame->AddFrame(rminlabel, lhints);
rminFrame->AddFrame(fRMinField, fhints);
TGHorizontalFrame* rmaxFrame = new TGHorizontalFrame(eventFrame, w*0.3, h*0.1);
TGLabel *rmaxlabel = new TGLabel(rmaxFrame, "Max Run:");
fRMaxField = new TGNumberEntryField(rmaxFrame, RMax, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
rmaxFrame->AddFrame(rmaxlabel, lhints);
rmaxFrame->AddFrame(fRMaxField, fhints);
fRunButton = new TGTextButton(eventFrame, "Run!");
fRunButton->SetState(kButtonDisabled); fRunButton->SetState(kButtonDisabled);
fRunButton->Connect("Clicked()","EVBMainFrame",this,"DoRun()"); fRunButton->Connect("Clicked()","EVBMainFrame",this,"DoRun()");
RunFrame->AddFrame(typelabel, lhints);
RunFrame->AddFrame(fTypeBox, fhints);
RunFrame->AddFrame(rminlabel, lhints);
RunFrame->AddFrame(fRMinField, fhints);
RunFrame->AddFrame(rmaxlabel, lhints);
RunFrame->AddFrame(fRMaxField, fhints);
RunFrame->AddFrame(fRunButton, bhints);
InputFrame->AddFrame(NameFrame, fhints); eventFrame->AddFrame(slowFrame, fhints);
InputFrame->AddFrame(ParamFrame, fhints); eventFrame->AddFrame(fastICFrame, fhints);
InputFrame->AddFrame(WindowFrame, fhints); eventFrame->AddFrame(fastSABREFrame, fhints);
InputFrame->AddFrame(RunFrame, fhints); eventFrame->AddFrame(opFrame, fhints);
eventFrame->AddFrame(rminFrame, fhints);
eventFrame->AddFrame(rmaxFrame, fhints);
eventFrame->AddFrame(fRunButton, bhints);
eventGroup->AddFrame(eventFrame,fhints);
ParamFrame->AddFrame(reactionGroup, fhints);
ParamFrame->AddFrame(eventGroup, new TGLayoutHints(kLHintsExpandY|kLHintsLeft,5,5,5,5));
TGVerticalFrame *PBFrame = new TGVerticalFrame(this, w, h*0.1); TGVerticalFrame *PBFrame = new TGVerticalFrame(this, w, h*0.1);
TGLabel *pbLabel = new TGLabel(PBFrame, "Build Progress"); TGLabel *pbLabel = new TGLabel(PBFrame, "Build Progress");
fProgressBar = new TGHProgressBar(PBFrame, TGProgressBar::kFancy, w); fProgressBar = new TGHProgressBar(PBFrame, TGProgressBar::kFancy, w);
fProgressBar->ShowPosition(); fProgressBar->ShowPosition();
fProgressBar->SetBarColor("lightblue"); fProgressBar->SetBarColor("lightblue");
fBuilder.AttachProgressBar(fProgressBar); //fBuilder.AttachProgressBar(fProgressBar);
PBFrame->AddFrame(pbLabel, lhints); PBFrame->AddFrame(pbLabel, lhints);
PBFrame->AddFrame(fProgressBar, fhints); PBFrame->AddFrame(fProgressBar, fhints);
@ -188,9 +246,12 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
menuBar->AddPopup("File", fFileMenu, mhints); menuBar->AddPopup("File", fFileMenu, mhints);
AddFrame(menuBar, new TGLayoutHints(kLHintsTop|kLHintsLeft,0,0,0,0)); AddFrame(menuBar, new TGLayoutHints(kLHintsTop|kLHintsLeft,0,0,0,0));
AddFrame(InputFrame, fchints); AddFrame(pathGroup, new TGLayoutHints(kLHintsTop|kLHintsExpandX,5,5,5,5));
AddFrame(ParamFrame, new TGLayoutHints(kLHintsCenterX|kLHintsExpandY,5,5,5,5));
AddFrame(PBFrame, fpbhints); AddFrame(PBFrame, fpbhints);
fBuilder.SetProgressCallbackFunc(BIND_PROGRESS_CALLBACK_FUNCTION(EVBMainFrame::SetProgressBarPosition));
fBuilder.SetProgressFraction(0.01);
SetWindowName("GWM Event Builder"); SetWindowName("GWM Event Builder");
MapSubwindows(); MapSubwindows();
Resize(); Resize();
@ -201,6 +262,7 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
EVBMainFrame::~EVBMainFrame() EVBMainFrame::~EVBMainFrame()
{ {
Cleanup(); Cleanup();
delete fInfo;
delete this; delete this;
} }
@ -212,36 +274,46 @@ void EVBMainFrame::CloseWindow()
void EVBMainFrame::HandleMenuSelection(int id) void EVBMainFrame::HandleMenuSelection(int id)
{ {
if(id == M_Save_Config) if(id == M_Save_Config)
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, M_Save_Config); {
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, fInfo);
SaveConfig(fInfo->fFilename);
}
else if(id == M_Load_Config) else if(id == M_Load_Config)
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, M_Load_Config); {
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, fInfo);
LoadConfig(fInfo->fFilename);
}
else if(id == M_Exit) else if(id == M_Exit)
CloseWindow(); CloseWindow();
} }
void EVBMainFrame::DoOpenWorkdir() void EVBMainFrame::DoOpenWorkdir()
{ {
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, WorkDir); new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H, this, WorkDir);
} }
void EVBMainFrame::DoOpenCMapfile() void EVBMainFrame::DoOpenCMapfile()
{ {
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, Cmap); new TGFileDialog(gClient->GetRoot(), this, kFDOpen, fInfo);
DisplayCMap(fInfo->fFilename);
} }
void EVBMainFrame::DoOpenSMapfile() void EVBMainFrame::DoOpenSMapfile()
{ {
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, Smap); new TGFileDialog(gClient->GetRoot(), this, kFDOpen, fInfo);
DisplaySMap(fInfo->fFilename);
} }
void EVBMainFrame::DoOpenScalerfile() void EVBMainFrame::DoOpenScalerfile()
{ {
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, Scaler); new TGFileDialog(gClient->GetRoot(), this, kFDOpen, fInfo);
DisplayScaler(fInfo->fFilename);
} }
void EVBMainFrame::DoOpenCutfile() void EVBMainFrame::DoOpenCutfile()
{ {
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, Cut); new TGFileDialog(gClient->GetRoot(), this, kFDOpen, fInfo);
DisplayCut(fInfo->fFilename);
} }
void EVBMainFrame::DoRun() void EVBMainFrame::DoRun()
@ -494,3 +566,11 @@ void EVBMainFrame::EnableAllInput()
fFastSABREField->SetState(true); fFastSABREField->SetState(true);
} }
void EVBMainFrame::SetProgressBarPosition(long val, long total)
{
fProgressBar->SetMin(0);
fProgressBar->SetMax(total);
fProgressBar->SetPosition(val);
gSystem->ProcessEvents();
}

View File

@ -11,6 +11,7 @@
#include <TGTextViewStream.h> #include <TGTextViewStream.h>
#include <TGProgressBar.h> #include <TGProgressBar.h>
#include <TTimer.h> #include <TTimer.h>
#include <TGFileDialog.h>
#include <TGComboBox.h> #include <TGComboBox.h>
#include "../evb/EVBApp.h" #include "../evb/EVBApp.h"
@ -46,6 +47,7 @@ public:
void RunMerge(const char* dir, const char* file); void RunMerge(const char* dir, const char* file);
void DisableAllInput(); void DisableAllInput();
void EnableAllInput(); void EnableAllInput();
void SetProgressBarPosition(long value, long total);
enum WidgetId enum WidgetId
@ -94,6 +96,8 @@ private:
TGPopupMenu *fFileMenu; TGPopupMenu *fFileMenu;
TGFileInfo* fInfo;
EventBuilder::EVBApp fBuilder; EventBuilder::EVBApp fBuilder;
int counter; int counter;

View File

@ -36,7 +36,7 @@ FileViewFrame::FileViewFrame(const TGWindow* p, const TGFrame* main, UInt_t w, U
/*Layout orgainization hints*/ /*Layout orgainization hints*/
TGLayoutHints *fhints = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY,5,5,5,5); TGLayoutHints *fhints = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY,5,5,5,5);
TGLayoutHints *thints = new TGLayoutHints(kLHintsExpandX|kLHintsCenterY,5,5,5,5); TGLayoutHints *thints = new TGLayoutHints(kLHintsExpandX|kLHintsBottom,5,5,5,5);
TGLayoutHints *fchints = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,5,5,5,5); TGLayoutHints *fchints = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,5,5,5,5);
TGLayoutHints *lhints = new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5); TGLayoutHints *lhints = new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5);
TGLayoutHints *fbhints = new TGLayoutHints(kLHintsCenterX|kLHintsBottom,5,5,5,5); TGLayoutHints *fbhints = new TGLayoutHints(kLHintsCenterX|kLHintsBottom,5,5,5,5);
@ -49,7 +49,7 @@ FileViewFrame::FileViewFrame(const TGWindow* p, const TGFrame* main, UInt_t w, U
fContents->Connect("DoubleClicked(TGFrame*,Int_t)","FileViewFrame",this,"DoDoubleClick(TGLVEntry*,Int_t)"); fContents->Connect("DoubleClicked(TGFrame*,Int_t)","FileViewFrame",this,"DoDoubleClick(TGLVEntry*,Int_t)");
/*Add in text options*/ /*Add in text options*/
TGVerticalFrame *NameFrame = new TGVerticalFrame(fMain, w, h*0.25); TGHorizontalFrame *NameFrame = new TGHorizontalFrame(fMain, w, h*0.25);
TGLabel *nameLabel; TGLabel *nameLabel;
if(dirFlag) if(dirFlag)
nameLabel = new TGLabel(NameFrame, "Dir:"); nameLabel = new TGLabel(NameFrame, "Dir:");
@ -71,8 +71,8 @@ FileViewFrame::FileViewFrame(const TGWindow* p, const TGFrame* main, UInt_t w, U
ButtonFrame->AddFrame(fCancelButton, fhints); ButtonFrame->AddFrame(fCancelButton, fhints);
fMain->AddFrame(fViewer, fchints); fMain->AddFrame(fViewer, fchints);
fMain->AddFrame(NameFrame, thints);
fMain->AddFrame(ButtonFrame, fbhints); fMain->AddFrame(ButtonFrame, fbhints);
fMain->AddFrame(NameFrame, thints);
/*Send signal to appropriate location*/ /*Send signal to appropriate location*/
if(type == EVBMainFrame::WorkDir) if(type == EVBMainFrame::WorkDir)
@ -92,6 +92,9 @@ FileViewFrame::FileViewFrame(const TGWindow* p, const TGFrame* main, UInt_t w, U
else if(type == EVBMainFrame::PlotF) else if(type == EVBMainFrame::PlotF)
Connect("SendText(const char*)","EVBMainFrame",parent,"RunPlot(const char*)"); Connect("SendText(const char*)","EVBMainFrame",parent,"RunPlot(const char*)");
if(dirFlag)
fMain->SetWindowName("Select Directory");
else
fMain->SetWindowName("Select File"); fMain->SetWindowName("Select File");
fMain->MapSubwindows(); fMain->MapSubwindows();
fMain->Resize(); fMain->Resize();