Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
c7a9d5e7
Commit
c7a9d5e7
authored
Oct 28, 2018
by
Simon Spannagel
Browse files
Module: store local ROOT directory in module object itself
parent
83836048
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/core/module/Module.cpp
View file @
c7a9d5e7
...
...
@@ -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
;
});
...
...
src/core/module/Module.hpp
View file @
c7a9d5e7
...
...
@@ -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
;
protected:
// 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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment