ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Atlas
G4AtlasTools
src
VoxelDensityTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Primary include
6
#include "
VoxelDensityTool.h
"
7
8
// Geant4 includes
9
#include "G4Version.hh"
10
#include "G4LogicalVolumeStore.hh"
11
12
//=============================================================================
13
// Standard constructor, initializes variables
14
//=============================================================================
15
VoxelDensityTool::VoxelDensityTool
(
const
std::string&
type
,
16
const
std::string& name,
17
const
IInterface* parent)
18
:
GeometryConfigurationToolBase
(
type
, name, parent)
19
{
20
}
21
22
StatusCode
VoxelDensityTool::preGeometryConfigure
()
const
23
{
24
ATH_MSG_DEBUG
(
"VoxelDensityTool::preGeometryConfigure()"
);
25
26
return
StatusCode::SUCCESS;
27
}
28
29
StatusCode
VoxelDensityTool::postGeometryConfigure
()
const
30
{
31
ATH_MSG_INFO
(
"VoxelDensityTool::postGeometryConfigure()"
);
32
// Set VoxelDensity
33
G4LogicalVolumeStore *logicalVolumeStore = G4LogicalVolumeStore::GetInstance();
34
if
(logicalVolumeStore->size() == 0) {
35
ATH_MSG_ERROR
(
"G4 logical volume store is empty."
);
36
}
37
const
G4String muonSys(
"Muon::MuonSys"
);
38
const
G4String embSTAC(
"LArMgr::LAr::EMB::STAC"
);
39
bool
ilvMuonSys =
false
, ilvEmbSTAC =
false
;
40
for
(
auto
* ilv : *logicalVolumeStore ) {
41
if
( ilv->GetName() == muonSys ) {
42
ilv->SetSmartless( 0.1 );
43
ATH_MSG_INFO
(
"Set VoxelDensity for Muon::MuonSys to 0.1"
);
44
ilvMuonSys =
true
;
45
}
46
else
if
( ilv->GetName() == embSTAC ) {
47
ilv->SetSmartless( 0.5 );
48
ATH_MSG_INFO
(
"Set VoxelDensity for LArMgr::LAr::EMB::STAC to 0.5"
);
49
ilvEmbSTAC =
true
;
50
}
51
52
//Now for any volumes set via job property std::pair<volume name, value>...
53
for
(
auto
& volToSet:
m_volumeVoxelDensityLevel
) {
54
#if G4VERSION_NUMBER < 1100
55
if
(ilv->GetName().contains(volToSet.first)) {
56
#else
57
if
(G4StrUtil::contains(ilv->GetName(), std::string_view(volToSet.first))) {
58
#endif
59
ilv->SetSmartless(volToSet.second);
60
ATH_MSG_INFO
(
"Set VoxelDensity for "
<<ilv->GetName()<<
" to "
<<volToSet.second);
61
}
62
}
63
64
}
65
if
(ilvMuonSys ==
false
) {
66
ATH_MSG_INFO
(
"Muon::MuonSys not in G4 logical volume store. VoxelDensity not set."
);
67
}
68
if
(ilvEmbSTAC ==
false
) {
69
ATH_MSG_INFO
(
"LArMgr::LAr::EMB::STAC not in G4 logical volume store. VoxelDensity not set."
);
70
}
71
72
return
StatusCode::SUCCESS;
73
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
VoxelDensityTool.h
GeometryConfigurationToolBase::GeometryConfigurationToolBase
GeometryConfigurationToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition
GeometryConfigurationToolBase.cxx:18
VoxelDensityTool::postGeometryConfigure
virtual StatusCode postGeometryConfigure() const override final
Definition
VoxelDensityTool.cxx:29
VoxelDensityTool::m_volumeVoxelDensityLevel
Gaudi::Property< std::map< std::string, double > > m_volumeVoxelDensityLevel
Definition
VoxelDensityTool.h:36
VoxelDensityTool::VoxelDensityTool
VoxelDensityTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition
VoxelDensityTool.cxx:15
VoxelDensityTool::preGeometryConfigure
virtual StatusCode preGeometryConfigure() const override final
Configure method.
Definition
VoxelDensityTool.cxx:22
type
Generated on
for ATLAS Offline Software by
1.17.0