Commit e24605ad authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Rename Analysis -> ModuleManager for clarity

parent 906e223f
......@@ -49,7 +49,7 @@ namespace corryvreckan {
* - Module::finalise(): for finalising the module at the end
*/
class Module {
friend class Analysis;
friend class ModuleManager;
public:
/**
......
......@@ -14,9 +14,9 @@
#include <TSystem.h>
// Local include files
#include "Analysis.hpp"
#include "module/exceptions.h"
#include "utils/log.h"
#include "ModuleManager.hpp"
#include "core/utils/log.h"
#include "exceptions.h"
#include <chrono>
#include <dlfcn.h>
......@@ -31,7 +31,7 @@
using namespace corryvreckan;
// Default constructor
Analysis::Analysis(std::string config_file_name, std::vector<std::string> options) : m_terminate(false) {
ModuleManager::ModuleManager(std::string config_file_name, std::vector<std::string> options) : m_terminate(false) {
LOG(TRACE) << "Loading Corryvreckan";
......@@ -98,7 +98,7 @@ Analysis::Analysis(std::string config_file_name, std::vector<std::string> option
m_clipboard = new Clipboard();
}
void Analysis::load() {
void ModuleManager::load() {
add_units();
......@@ -106,7 +106,7 @@ void Analysis::load() {
load_modules();
}
void Analysis::load_detectors() {
void ModuleManager::load_detectors() {
// Flag for the reference detector
bool found_reference = false;
......@@ -162,7 +162,7 @@ void Analysis::load_detectors() {
});
}
void Analysis::load_modules() {
void ModuleManager::load_modules() {
std::vector<Configuration> configs = conf_mgr_->getConfigurations();
// Create histogram output file
......@@ -327,7 +327,7 @@ void Analysis::load_modules() {
LOG_PROGRESS(STATUS, "MOD_LOAD_LOOP") << "Loaded " << configs.size() << " modules";
}
Module* Analysis::create_unique_module(void* library, Configuration config) {
Module* ModuleManager::create_unique_module(void* library, Configuration config) {
LOG(TRACE) << "Creating module " << config.getName() << ", using generator \"" << CORRYVRECKAN_GENERATOR_FUNCTION
<< "\"";
......@@ -389,7 +389,7 @@ Module* Analysis::create_unique_module(void* library, Configuration config) {
return module;
}
std::vector<Module*> Analysis::create_detector_modules(void* library, Configuration config, bool dut_only) {
std::vector<Module*> ModuleManager::create_detector_modules(void* library, Configuration config, bool dut_only) {
LOG(TRACE) << "Creating instantiations for module " << config.getName() << ", using generator \""
<< CORRYVRECKAN_GENERATOR_FUNCTION << "\"";
......@@ -465,7 +465,7 @@ std::vector<Module*> Analysis::create_detector_modules(void* library, Configurat
}
// Run the analysis loop - this initialises, runs and finalises all modules
void Analysis::run() {
void ModuleManager::run() {
// Check if we have an event or track limit:
int number_of_events = global_config.get<int>("number_of_events", -1);
......@@ -572,12 +572,12 @@ void Analysis::run() {
}
}
void Analysis::terminate() {
void ModuleManager::terminate() {
m_terminate = true;
}
// Initalise all modules
void Analysis::initialiseAll() {
void ModuleManager::initialiseAll() {
// Loop over all modules and initialise them
LOG(STATUS) << "=================| Initialising modules |==================";
for(auto& module : m_modules) {
......@@ -604,7 +604,7 @@ void Analysis::initialiseAll() {
}
// Finalise all modules
void Analysis::finaliseAll() {
void ModuleManager::finaliseAll() {
// Loop over all modules and finalise them
LOG(STATUS) << "===================| Finalising modules |===================";
......@@ -656,7 +656,7 @@ void Analysis::finaliseAll() {
}
// Display timing statistics for each module, over all events and per event
void Analysis::timing() {
void ModuleManager::timing() {
LOG(STATUS) << "===============| Wall-clock timing (seconds) |================";
for(auto& module : m_modules) {
LOG(STATUS) << std::setw(25) << module->getName() << " -- " << std::fixed << std::setprecision(5)
......@@ -667,7 +667,7 @@ void Analysis::timing() {
}
// Helper functions to set the module specific log settings if necessary
std::tuple<LogLevel, LogFormat> Analysis::set_module_before(const std::string&, const Configuration& config) {
std::tuple<LogLevel, LogFormat> ModuleManager::set_module_before(const std::string&, const Configuration& config) {
// Set new log level if necessary
LogLevel prev_level = Log::getReportingLevel();
if(config.has("log_level")) {
......@@ -702,7 +702,7 @@ std::tuple<LogLevel, LogFormat> Analysis::set_module_before(const std::string&,
return std::make_tuple(prev_level, prev_format);
}
void Analysis::set_module_after(std::tuple<LogLevel, LogFormat> prev) {
void ModuleManager::set_module_after(std::tuple<LogLevel, LogFormat> prev) {
// Reset the previous log level
LogLevel cur_level = Log::getReportingLevel();
LogLevel old_level = std::get<0>(prev);
......@@ -720,7 +720,7 @@ void Analysis::set_module_after(std::tuple<LogLevel, LogFormat> prev) {
}
}
void Analysis::add_units() {
void ModuleManager::add_units() {
LOG(TRACE) << "Adding physical units";
......
......@@ -17,10 +17,10 @@
#include "TDirectory.h"
#include "TFile.h"
#include "clipboard/Clipboard.hpp"
#include "config/ConfigManager.hpp"
#include "detector/Detector.hpp"
#include "module/Module.hpp"
#include "Module.hpp"
#include "core/clipboard/Clipboard.hpp"
#include "core/config/ConfigManager.hpp"
#include "core/detector/Detector.hpp"
namespace corryvreckan {
......@@ -32,12 +32,12 @@ namespace corryvreckan {
* runs each module sequentially and passes the clipboard between them (erasing it at the end of each run sequence). When
* an module returns a Failure code, the event processing will stop.
*/
class Analysis {
class ModuleManager {
public:
// Constructors and destructors
explicit Analysis(std::string config_file_name, std::vector<std::string> options = std::vector<std::string>());
virtual ~Analysis(){};
explicit ModuleManager(std::string config_file_name, std::vector<std::string> options = std::vector<std::string>());
virtual ~ModuleManager(){};
// Member functions
void load();
......
......@@ -50,7 +50,7 @@ namespace corryvreckan {
* @param detectors Vector of pointers to all detectors to be processed by this module
* @return Instantiation of the module
*
* Internal method for the dynamic loading in the central Analysis class. Forwards the supplied arguments to the
* Internal method for the dynamic loading in the central ModuleManager class. Forwards the supplied arguments to the
* constructor and returns an instantiation.
*/
Module* corryvreckan_module_generator(Configuration config, std::vector<std::shared_ptr<Detector>> detectors);
......@@ -72,7 +72,7 @@ namespace corryvreckan {
* @param detector Pointer to the Detector object this module is bound to
* @return Instantiation of the module
*
* Internal method for the dynamic loading in the central Analysis class. Forwards the supplied arguments to the
* Internal method for the dynamic loading in the central ModuleManager class. Forwards the supplied arguments to the
* constructor and returns an instantiation
*/
Module* corryvreckan_module_generator(Configuration config, std::shared_ptr<Detector> detector);
......@@ -94,7 +94,7 @@ namespace corryvreckan {
* @param detector Pointer to the Detector object this module is bound to
* @return Instantiation of the module
*
* Internal method for the dynamic loading in the central Analysis class. Forwards the supplied arguments to the
* Internal method for the dynamic loading in the central ModuleManager class. Forwards the supplied arguments to the
* constructor and returns an instantiation
*/
Module* corryvreckan_module_generator(Configuration config, std::shared_ptr<Detector> detector);
......
......@@ -6,8 +6,8 @@
#include <string>
#include <utility>
#include "core/Analysis.hpp"
#include "core/config/ConfigManager.hpp"
#include "core/module/ModuleManager.hpp"
#include "core/utils/exceptions.h"
/**
* @file
......@@ -22,7 +22,7 @@ void clean();
void abort_handler(int);
void interrupt_handler(int);
std::unique_ptr<Analysis> corry;
std::unique_ptr<ModuleManager> corry;
std::atomic<bool> cv_ready{false};
/**
......@@ -162,7 +162,7 @@ int main(int argc, const char* argv[]) {
try {
// Construct main Corryvreckan object
corry = std::make_unique<Analysis>(config_file_name, options);
corry = std::make_unique<ModuleManager>(config_file_name, options);
cv_ready = true;
// Load modules
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment