MarlinMT  0.1.0
GeometryPlugin.cc
Go to the documentation of this file.
2 
3 // -- marlinmt headers
5 #include "marlinmt/Application.h"
6 
7 namespace marlinmt {
8 
9  GeometryPlugin::GeometryPlugin( const std::string &gtype ) :
10  Component("Geometry") {
11  setName( gtype ) ;
12  }
13 
14  //--------------------------------------------------------------------------
15 
16  void GeometryPlugin::print() const {
17  auto typeidx = typeIndex() ;
18  message() << "----------------------------------------------------------" << std::endl ;
19  message() << "-- Geometry plugin: " << name() << std::endl ;
20  message() << "-- Description: " << description() << std::endl ;
21  message() << "-- Handle at: " << handle() << std::endl ;
22  message() << "-- Type index: " << std::endl ;
23  message() << "---- name: " << typeidx.name() << std::endl ;
24  message() << "---- hash: " << typeidx.hash_code() << std::endl ;
25  if ( _dumpGeometry ) {
26  message() << "-- Geometry dump:" << std::endl ;
27  dumpGeometry() ;
28  message() << "-- End of geometry dump" << std::endl ;
29  }
30  message() << "----------------------------------------------------------" << std::endl ;
31  }
32 
33  //--------------------------------------------------------------------------
34 
36  auto &config = application().configuration() ;
37  if( config.hasSection("geometry") ) {
38  setParameters( config.section("geometry") ) ;
39  }
40  }
41 
42 } // namespace marlinmt
const std::string & name() const
Get the component name.
Definition: Component.cc:23
void setName(const std::string &n)
Set the component name.
Definition: Component.cc:29
void setParameters(const ConfigSection &section, bool throwIfNotFound=false)
Set the parameters from the configuration section.
Definition: Component.cc:124
Logging::StreamType message() const
Shortcut for log<MESSAGE>()
Definition: Component.cc:53
void print() const
Print the complete geometry plugin description.
virtual void dumpGeometry() const =0
Dump the geometry in the console.
const std::string & description() const
Get the component description.
Definition: Component.cc:35
virtual void initialize() override
Init the geometry plugin.
Component class.
Definition: Component.h:22
const Application & application() const
Get the application in which the component is registered.
Definition: Component.cc:83
virtual const void * handle() const =0
Get a handle on the geometry instance.
BoolParameter _dumpGeometry
Whether to dump the geometry on creation.
virtual std::type_index typeIndex() const =0
Get a type index object from the geometry handle.
const Configuration & configuration() const
Get the main application configuration object.
Definition: Application.cc:278