ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Utilities
Geo2G4
src
Geo2G4LVFactory.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 "
Geo2G4LVFactory.h
"
6
#include "
Geo2G4SolidFactory.h
"
7
#include "
GeoMaterial2G4/Geo2G4MaterialFactory.h
"
8
9
#include "GeoModelKernel/GeoLogVol.h"
10
#include "GeoModelKernel/GeoFullPhysVol.h"
11
12
#include "G4LogicalVolume.hh"
13
#include "G4Material.hh"
14
15
#include <iostream>
16
#include <map>
17
18
typedef
std::map<const GeoLogVol*, G4LogicalVolume*, std::less<const GeoLogVol*> >
leafVMap
;
19
typedef
std::map<const GeoVPhysVol*, G4LogicalVolume*, std::less<const GeoVPhysVol*> >
branchVMap
;
20
21
typedef
std::map<const GeoFullPhysVol*, G4LogicalVolume*, std::less<const GeoFullPhysVol*> >
fullPVMap
;
22
23
Geo2G4LVFactory::Geo2G4LVFactory
()
24
{
25
}
26
27
G4LogicalVolume* Geo2G4LVFactory::Build
ATLAS_NOT_THREAD_SAFE
(
const
PVConstLink& thePhys,
28
bool
&
descend
)
29
{
30
static
Geo2G4SolidFactory
theSolidFactory;
31
static
Geo2G4MaterialFactory
theMaterialFactory;
32
33
static
leafVMap
sharedLeafLV;
34
static
branchVMap
sharedBranchLV;
35
static
fullPVMap
clonedLV;
36
37
const
GeoFullPhysVol* fullPV =
dynamic_cast<
const
GeoFullPhysVol*
>
(&(*thePhys));
38
const
GeoFullPhysVol* clonePV=0;
39
40
const
GeoLogVol* theLog = thePhys->getLogVol();
41
G4LogicalVolume *theG4Log=0;
42
G4Material* theG4Mat=0;
43
G4VSolid* theG4Solid=0;
44
45
descend
=
true
;
46
bool
putLeaf =
false
;
47
bool
putBranch =
false
;
48
bool
putFullPV =
false
;
49
50
// Check if it is a leaf node of Geo tree
51
if
(thePhys->getNChildVols() == 0)
52
{
53
descend
=
false
;
54
55
if
(sharedLeafLV.find(theLog) != sharedLeafLV.end())
56
return
sharedLeafLV[theLog];
57
else
// here supposed to be ---> else if(theLog->refCount() > 1)
58
putLeaf =
true
;
59
}
60
// Work with the Full Physical Volumes
61
else
if
(fullPV)
62
{
63
clonePV = fullPV->cloneOrigin();
64
if
(clonedLV.find(clonePV)==clonedLV.end())
65
{
66
if
(clonePV) putFullPV =
true
;
67
}
68
else
69
{
70
descend
=
false
;
71
return
clonedLV[clonePV];
72
}
73
}
74
else
75
{
76
if
(sharedBranchLV.find(&(*thePhys)) == sharedBranchLV.end())
77
putBranch =
true
;
78
else
79
{
80
descend
=
false
;
81
return
sharedBranchLV[&(*thePhys)];
82
}
83
}
84
// Actually build the G4Log
85
86
theG4Mat=theMaterialFactory.
Build
(theLog->getMaterial());
87
theG4Solid = theSolidFactory.Build(theLog->getShape(),theLog->getName());
88
89
theG4Log =
new
G4LogicalVolume(theG4Solid,
90
theG4Mat,
91
theLog->getName(),
92
0,0,0);
93
94
if
(putLeaf) sharedLeafLV[theLog] = theG4Log;
95
if
(putBranch) sharedBranchLV[&(*thePhys)] = theG4Log;
96
if
(putFullPV) clonedLV[clonePV] = theG4Log;
97
98
return
theG4Log;
99
}
fullPVMap
std::map< const GeoFullPhysVol *, G4LogicalVolume *, std::less< const GeoFullPhysVol * > > fullPVMap
Definition
Geo2G4LVFactory.cxx:21
leafVMap
std::map< const GeoLogVol *, G4LogicalVolume *, std::less< const GeoLogVol * > > leafVMap
Definition
Geo2G4LVFactory.cxx:18
branchVMap
std::map< const GeoVPhysVol *, G4LogicalVolume *, std::less< const GeoVPhysVol * > > branchVMap
Definition
Geo2G4LVFactory.cxx:19
Geo2G4LVFactory.h
Geo2G4MaterialFactory.h
Geo2G4SolidFactory.h
descend
void descend(TDirectory *d, int level, int maxdepth, const std::vector< std::string > &labels)
Definition
chains.cxx:107
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition
checker_macros.h:212
Geo2G4LVFactory::Geo2G4LVFactory
Geo2G4LVFactory()
Definition
Geo2G4LVFactory.cxx:23
Geo2G4MaterialFactory
Definition
Geo2G4MaterialFactory.h:15
Geo2G4MaterialFactory::Build
G4Material * Build(const GeoMaterial *)
Definition
Geo2G4MaterialFactory.cxx:29
Geo2G4SolidFactory
Definition
Geo2G4SolidFactory.h:23
Generated on
for ATLAS Offline Software by
1.17.0