ATLAS Offline Software
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"
6 #include "Geo2G4AssemblyVolume.h"
8 
9 Geo2G4Svc::Geo2G4Svc(const std::string& name, ISvcLocator* svcLocator)
10  : base_class(name,svcLocator)
11  , m_defaultBuilder()
12  , m_getTopTransform(true)
13  , m_G4AssemblyFactory(nullptr)
14 {
15  ATH_MSG_VERBOSE ("Creating the Geo2G4Svc.");
16  declareProperty("GetTopTransform", m_getTopTransform);
17 }
18 
20 {}
21 
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 }
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
Geo2G4AssemblyVolume.h
Geo2G4Svc::~Geo2G4Svc
virtual ~Geo2G4Svc()
Definition: Geo2G4Svc.cxx:19
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Geo2G4Svc::m_G4AssemblyFactory
std::unique_ptr< Geo2G4AssemblyFactory > m_G4AssemblyFactory
Definition: Geo2G4Svc.h:42
initialize
void initialize()
Definition: run_EoverP.cxx:894
VolumeBuilder
Definition: Simulation/G4Utilities/Geo2G4/src/VolumeBuilder.h:20
Geo2G4Svc::GetDefaultBuilder
virtual VolumeBuilder * GetDefaultBuilder() const override final
Definition: Geo2G4Svc.h:32
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Geo2G4Svc::m_builders
BuilderMap m_builders
Definition: Geo2G4Svc.h:40
Geo2G4Svc::GetVolumeBuilder
virtual VolumeBuilder * GetVolumeBuilder(std::string s) const override final
Definition: Geo2G4Svc.cxx:54
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
createSimpleDistributions.builder
builder
Definition: createSimpleDistributions.py:52
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ExtParameterisedVolumeBuilder.h
Geo2G4Svc::Geo2G4Svc
Geo2G4Svc(const std::string &, ISvcLocator *)
Definition: Geo2G4Svc.cxx:9
Geo2G4Svc::ListVolumeBuilders
virtual void ListVolumeBuilders() const override final
Definition: Geo2G4Svc.cxx:42
Geo2G4Svc::m_getTopTransform
bool m_getTopTransform
Definition: Geo2G4Svc.h:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Geo2G4Svc::SetDefaultBuilder
virtual void SetDefaultBuilder(std::string n) override final
Geo2G4SvcBase methods.
Definition: Geo2G4Svc.h:30
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
Geo2G4Svc.h