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

Module: store local ROOT directory in module object itself

parent 83836048
......@@ -46,6 +46,24 @@ ModuleIdentifier Module::get_identifier() const {
return identifier_;
* @throws InvalidModuleActionException If this method is called from the constructor or destructor
* @warning Cannot be used from the constructor, because the instantiation logic has not finished yet
* @warning This method should not be accessed from the destructor (the file is then already closed)
* @note It is not needed to change directory to this file explicitly in the module, this is done automatically.
TDirectory* Module::getROOTDirectory() const {
// The directory will only be a null pointer if this method is executed from the constructor or destructor
if(directory_ == nullptr) {
throw InvalidModuleActionException("Cannot access ROOT directory in constructor or destructor");
return directory_;
void Module::set_ROOT_directory(TDirectory* directory) {
directory_ = directory;
std::shared_ptr<Detector> Module::get_detector(std::string name) {
auto it = find_if(
m_detectors.begin(), m_detectors.end(), [&name](std::shared_ptr<Detector> obj) { return obj->name() == name; });
......@@ -120,6 +120,12 @@ namespace corryvreckan {
virtual void finalise(){};
* @brief Get ROOT directory which should be used to output histograms et cetera
* @return ROOT directory for storage
TDirectory* getROOTDirectory() const;
// Configuration of this module
Configuration m_config;
......@@ -177,6 +183,13 @@ namespace corryvreckan {
ModuleIdentifier get_identifier() const;
ModuleIdentifier identifier_;
* @brief Set the output ROOT directory for this module
* @param directory ROOT directory for storage
void set_ROOT_directory(TDirectory* directory);
TDirectory* directory_{nullptr};
// Configure the reference detector:
void setReference(std::shared_ptr<Detector> reference) { m_reference = reference; };
std::shared_ptr<Detector> m_reference;
Supports Markdown
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