ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Atlas
G4AtlasTools
src
BoxEnvelope.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Base class
6
#include "
G4AtlasTools/DetectorGeometryBase.h
"
7
#include "
G4AtlasTools/BoxEnvelope.h
"
8
9
#include "G4NistManager.hh"
10
#include "G4LogicalVolume.hh"
11
#include "G4PVPlacement.hh"
12
#include "G4SystemOfUnits.hh"
13
#include "G4Box.hh"
14
#include "G4SubtractionSolid.hh"
15
16
// Geant4 includes used in functions
17
18
BoxEnvelope::BoxEnvelope
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent)
19
:
DetectorGeometryBase
(
type
,name,parent)
20
{
21
}
22
23
void
BoxEnvelope::BuildGeometry
()
24
{
25
ATH_MSG_VERBOSE
(
"BoxEnvelope::BuildGeometry: Name "
<< this->name() );
26
ATH_MSG_VERBOSE
(
"BoxEnvelope::BuildGeometry: "
<<
m_dX
<<
" "
<<
m_dY
<<
" "
<<
m_dZ
);
27
28
// Get nist material manager
29
G4NistManager *nist = G4NistManager::Instance();
30
31
G4Material *mat = nist->FindOrBuildMaterial(
m_materialName
.value());
32
33
G4VSolid *
solid
=
new
G4Box(
m_detectorName
.value(),
m_dX
,
m_dY
,
m_dZ
);
34
if
(
m_numberOfHoles
)
35
{
36
if
(
m_holeNames
.size() !=
m_numberOfHoles
)
37
{
38
ATH_MSG_ERROR
(
"Size of m_holeNames("
<<
m_holeNames
.size()<<
") differs from no. of holes "
<<
m_numberOfHoles
<<
"!!!"
);
39
}
40
if
(
m_hole_dX
.size() !=
m_numberOfHoles
)
41
{
42
ATH_MSG_ERROR
(
"Size of m_hole_dX("
<<
m_hole_dX
.size()<<
") differs from no. of holes "
<<
m_numberOfHoles
<<
"!!!"
);
43
}
44
if
(
m_hole_dY
.size() !=
m_numberOfHoles
)
45
{
46
ATH_MSG_ERROR
(
"Size of m_hole_dY("
<<
m_hole_dY
.size()<<
") differs from no. of holes "
<<
m_numberOfHoles
<<
"!!!"
);
47
}
48
if
(
m_hole_dZ
.size() !=
m_numberOfHoles
)
49
{
50
ATH_MSG_ERROR
(
"Size of m_hole_dZ("
<<
m_hole_dZ
.size()<<
") differs from no. of holes "
<<
m_numberOfHoles
<<
"!!!"
);
51
}
52
if
(
m_holePosX
.size() !=
m_numberOfHoles
)
53
{
54
ATH_MSG_ERROR
(
"Size of m_holePosX("
<<
m_holePosX
.size()<<
") differs from no. of holes "
<<
m_numberOfHoles
<<
"!!!"
);
55
}
56
if
(
m_holePosY
.size() !=
m_numberOfHoles
)
57
{
58
ATH_MSG_ERROR
(
"Size of m_holePosY("
<<
m_holePosY
.size()<<
") differs from no. of holes "
<<
m_numberOfHoles
<<
"!!!"
);
59
}
60
if
(
m_holePosZ
.size() !=
m_numberOfHoles
)
61
{
62
ATH_MSG_ERROR
(
"Size of m_holePosZ("
<<
m_holePosZ
.size()<<
") differs from no. of holes "
<<
m_numberOfHoles
<<
"!!!"
);
63
}
64
for
(
unsigned
int
nSub(0); nSub<
m_numberOfHoles
; ++nSub)
65
{
66
G4ThreeVector
size
=G4ThreeVector();
67
std::string n=
m_holeNames
.value().at(nSub);
68
G4VSolid *temp=
new
G4Box(
""
,
m_hole_dX
.value().at(nSub),
m_hole_dY
.value().at(nSub),
m_hole_dZ
.value().at(nSub));
69
G4ThreeVector tPos=G4ThreeVector(
m_holePosX
.value().at(nSub),
m_holePosY
.value().at(nSub),
m_holePosZ
.value().at(nSub));
70
solid
=
new
G4SubtractionSolid(
m_detectorName
.value(),
solid
,temp,0,tPos);
71
}
72
}
73
74
G4LogicalVolume* logicWorld =
new
G4LogicalVolume(
solid
,mat,
m_detectorName
.value());
75
76
m_envelope
.theEnvelope=logicWorld;
77
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
BoxEnvelope.h
DetectorGeometryBase.h
solid
static std::map< double, LArWheelSliceSolid * > solid
Definition
LArWheelSliceSolidTests.cxx:522
size
size_t size() const
Number of registered mappings.
BoxEnvelope::m_holePosZ
Gaudi::Property< std::vector< double > > m_holePosZ
Definition
BoxEnvelope.h:43
BoxEnvelope::m_dY
Gaudi::Property< double > m_dY
Definition
BoxEnvelope.h:33
BoxEnvelope::m_materialName
Gaudi::Property< std::string > m_materialName
Definition
BoxEnvelope.h:35
BoxEnvelope::BoxEnvelope
BoxEnvelope(const std::string &type, const std::string &name, const IInterface *parent)
Basic constructor and destructor.
Definition
BoxEnvelope.cxx:18
BoxEnvelope::m_hole_dZ
Gaudi::Property< std::vector< double > > m_hole_dZ
Definition
BoxEnvelope.h:40
BoxEnvelope::BuildGeometry
virtual void BuildGeometry() override final
virtual methods being implemented here
Definition
BoxEnvelope.cxx:23
BoxEnvelope::m_hole_dY
Gaudi::Property< std::vector< double > > m_hole_dY
Definition
BoxEnvelope.h:39
BoxEnvelope::m_holePosX
Gaudi::Property< std::vector< double > > m_holePosX
Definition
BoxEnvelope.h:41
BoxEnvelope::m_numberOfHoles
Gaudi::Property< unsigned int > m_numberOfHoles
Definition
BoxEnvelope.h:36
BoxEnvelope::m_holeNames
Gaudi::Property< std::vector< std::string > > m_holeNames
Definition
BoxEnvelope.h:37
BoxEnvelope::m_dX
Gaudi::Property< double > m_dX
Definition
BoxEnvelope.h:32
BoxEnvelope::m_holePosY
Gaudi::Property< std::vector< double > > m_holePosY
Definition
BoxEnvelope.h:42
BoxEnvelope::m_dZ
Gaudi::Property< double > m_dZ
Definition
BoxEnvelope.h:34
BoxEnvelope::m_hole_dX
Gaudi::Property< std::vector< double > > m_hole_dX
Definition
BoxEnvelope.h:38
DetectorGeometryBase::DetectorGeometryBase
DetectorGeometryBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition
DetectorGeometryBase.cxx:13
DetectorGeometryBase::m_envelope
Envelope m_envelope
Definition
DetectorGeometryBase.h:70
DetectorGeometryBase::m_detectorName
Gaudi::Property< std::string > m_detectorName
Definition
DetectorGeometryBase.h:71
type
Generated on
for ATLAS Offline Software by
1.17.0