ATLAS Offline Software
Loading...
Searching...
No Matches
Geo2G4Svc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "Geo2G4Svc.h"
8
9Geo2G4Svc::Geo2G4Svc(const std::string& name, ISvcLocator* svcLocator)
10 : base_class(name,svcLocator)
12 , m_getTopTransform(true)
13 , m_G4AssemblyFactory(nullptr)
14{
15 ATH_MSG_VERBOSE ("Creating the Geo2G4Svc.");
16 declareProperty("GetTopTransform", m_getTopTransform);
17}
18
21
22StatusCode Geo2G4Svc::initialize()
23{
24 ATH_MSG_VERBOSE ("Initializing the Geo2G4Svc");
25 m_G4AssemblyFactory = std::make_unique<Geo2G4AssemblyFactory>();
26
27 // Initialize builders
28 const std::string nameBuilder = "Extended_Parameterised_Volume_Builder"; //TODO Configurable property??
29 m_builders.emplace(nameBuilder,
30 std::make_unique<ExtParameterisedVolumeBuilder>(nameBuilder, m_G4AssemblyFactory.get()));
31
32 this->SetDefaultBuilder(nameBuilder);
33 if(msgLvl(MSG::VERBOSE)) {
34 ATH_MSG_VERBOSE (nameBuilder << " --> set as default builder" );
35 ATH_MSG_VERBOSE (nameBuilder << " --> ParamOn flag = " << GetDefaultBuilder()->GetParam());
36 this->ListVolumeBuilders();
37 }
38
39 return StatusCode::SUCCESS;
40}
41
43{
44 ATH_MSG_INFO("---- List of all Volume Builders registered with Geo2G4Svc ----");
45 ATH_MSG_INFO("---------------------------------------------------------------");
46 for (const auto& builder : m_builders)
47 {
48 ATH_MSG_INFO(" Volume Builder: "<<builder.second->GetKey());
49 }
50 ATH_MSG_INFO("---------------------------------------------------------------");
51 ATH_MSG_INFO(" default builder is "<<GetDefaultBuilder()->GetKey());
52}
53
55{
56 const auto builderItr(m_builders.find(s));
57 if (builderItr!=m_builders.end())
58 {
59 return builderItr->second.get();
60 }
61 else
62 {
63 ATH_MSG_ERROR ("Trying to retrieve a not existing builder "<<s);
64 ATH_MSG_ERROR ("\treturning Default Builder");
65 }
66 return GetDefaultBuilder();
67}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
virtual ~Geo2G4Svc()
Definition Geo2G4Svc.cxx:19
virtual void SetDefaultBuilder(std::string n) override final
Geo2G4SvcBase methods.
Definition Geo2G4Svc.h:30
BuilderMap m_builders
Definition Geo2G4Svc.h:40
Geo2G4Svc(const std::string &, ISvcLocator *)
Definition Geo2G4Svc.cxx:9
bool m_getTopTransform
Definition Geo2G4Svc.h:41
std::unique_ptr< Geo2G4AssemblyFactory > m_G4AssemblyFactory
Definition Geo2G4Svc.h:42
virtual VolumeBuilder * GetDefaultBuilder() const override final
Definition Geo2G4Svc.h:32
std::string m_defaultBuilder
Definition Geo2G4Svc.h:39
virtual VolumeBuilder * GetVolumeBuilder(std::string s) const override final
Definition Geo2G4Svc.cxx:54
virtual void ListVolumeBuilders() const override final
Definition Geo2G4Svc.cxx:42