/* EVBApp.cpp Class which represents the API of the event building environment. Wraps together the core concepts of the event builder, from conversion to plotting. Even intended to be able to archive data. Currently under development. Written by G.W. McCann Oct. 2020 */ #include #include "EVBApp.h" #include "RunCollector.h" #include "CompassRun.h" #include "SlowSort.h" #include "FastSort.h" #include "SFPAnalyzer.h" #include "SFPPlotter.h" namespace EventBuilder { 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_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) { SetProgressCallbackFunc(BIND_PROGRESS_CALLBACK_FUNCTION(EVBApp::DefaultProgressCallback)); } 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) { EVB_INFO("Reading in EVB configuration from file {0}...", fullpath); std::ifstream input(fullpath); if(!input.is_open()) { EVB_WARN("Read of EVB config failed, unable to open input file!"); return false; } std::string junk; std::getline(input, junk); input>>junk>>m_workspace; input>>junk; std::getline(input, junk); std::getline(input, junk); input>>junk>>m_mapfile; input>>junk>>m_scalerfile; input>>junk>>m_cutList; input>>junk>>m_ZT>>junk>>m_AT; input>>junk>>m_ZP>>junk>>m_AP; input>>junk>>m_ZE>>junk>>m_AE; input>>junk>>m_B; input>>junk>>m_BKE; input>>junk>>m_Theta; input>>junk; std::getline(input, junk); std::getline(input, junk); input>>junk>>m_shiftfile; input>>junk>>m_SlowWindow; input>>junk>>m_FastWindowIonCh; input>>junk>>m_FastWindowSABRE; input>>junk; std::getline(input, junk); std::getline(input, junk); input>>junk>>m_rmin; input>>junk>>m_rmax; input.close(); EVB_INFO("Successfully loaded EVB config."); return true; } void EVBApp::WriteConfigFile(const std::string& fullpath) { EVB_INFO("Writing EVB config to file {0}...",fullpath); std::ofstream output(fullpath); if(!output.is_open()) { EVB_WARN("Failed to write to config to file {0}, unable to open file!", fullpath); return; } output<<"-------Data Location----------"<