Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PHG4CylinderGeomContainer.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4CylinderGeomContainer.cc
1
#include "
PHG4CylinderGeomContainer.h
"
2
#include "
PHG4CylinderGeom.h
"
3
4
#include <cmath>
5
6
PHG4CylinderGeomContainer::~PHG4CylinderGeomContainer
()
7
{
8
while
(
layergeoms
.begin() !=
layergeoms
.end())
9
{
10
delete
layergeoms
.begin()->second;
11
layergeoms
.erase(
layergeoms
.begin());
12
}
13
return
;
14
}
15
16
void
PHG4CylinderGeomContainer::identify
(std::ostream &
os
)
const
17
{
18
os <<
"mag field: "
<<
magfield
<< std::endl;
19
os <<
"number of layers: "
<<
layergeoms
.size() << std::endl;
20
std::map<int, PHG4CylinderGeom *>::const_iterator iter;
21
for
(iter =
layergeoms
.begin(); iter !=
layergeoms
.end(); ++iter)
22
{
23
(iter->second)->
identify
(os);
24
}
25
26
return
;
27
}
28
29
int
PHG4CylinderGeomContainer::AddLayerGeom
(
const
int
i
,
PHG4CylinderGeom
*mygeom)
30
{
31
if
(
layergeoms
.find(i) !=
layergeoms
.end())
32
{
33
std::cout <<
"layer "
<< i <<
" already added to PHCylinderGeomContainer"
<< std::endl;
34
return
-1;
35
}
36
mygeom->
set_layer
(i);
37
layergeoms
[
i
] = mygeom;
38
return
0;
39
}
40
41
int
PHG4CylinderGeomContainer::AddLayerGeom
(
PHG4CylinderGeom
*mygeom)
42
{
43
int
layer
= mygeom->
get_layer
();
44
if
(
layergeoms
.find(layer) !=
layergeoms
.end())
45
{
46
std::cout <<
"layer "
<< layer <<
" already added to PHCylinderGeomContainer"
<< std::endl;
47
return
-1;
48
}
49
layergeoms
[
layer
] = mygeom;
50
return
0;
51
}
52
53
PHG4CylinderGeom
*
54
PHG4CylinderGeomContainer::GetLayerGeom
(
const
int
i
)
55
{
56
std::map<int, PHG4CylinderGeom *>::const_iterator iter =
layergeoms
.find(i);
57
if
(iter !=
layergeoms
.end())
58
{
59
return
iter->second;
60
}
61
std::cout <<
"Could not locate layer "
<< i <<
" in PHG4CylinderGeomContainer"
<< std::endl;
62
return
nullptr
;
63
}
64
65
PHG4CylinderGeom
*
66
PHG4CylinderGeomContainer::GetFirstLayerGeom
()
67
{
68
if
(
layergeoms
.empty())
69
{
70
return
nullptr
;
71
}
72
return
layergeoms
.begin()->second;
73
}
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4CylinderGeomContainer.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:12
using
1.8.2 with
sPHENIX GitHub integration