ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
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
#include <cmath>
4
5
using namespace
std;
6
7
PHG4CylinderGeomContainer::PHG4CylinderGeomContainer
():
8
magfield
(NAN)
9
{}
10
11
PHG4CylinderGeomContainer::~PHG4CylinderGeomContainer
()
12
{
13
while
(
layergeoms
.begin() !=
layergeoms
.end())
14
{
15
delete
layergeoms
.begin()->second;
16
layergeoms
.erase(
layergeoms
.begin());
17
}
18
return
;
19
}
20
21
void
22
PHG4CylinderGeomContainer::identify
(std::ostream& os)
const
23
{
24
os <<
"mag field: "
<<
magfield
<< endl;
25
os <<
"number of layers: "
<<
layergeoms
.size() << endl;
26
map<int,PHG4CylinderGeom *>::const_iterator iter;
27
for
(iter=
layergeoms
.begin(); iter !=
layergeoms
.end(); ++iter)
28
{
29
(iter->second)->
identify
(os);
30
}
31
32
return
;
33
}
34
35
int
36
PHG4CylinderGeomContainer::AddLayerGeom
(
const
int
i,
PHG4CylinderGeom
*mygeom)
37
{
38
if
(
layergeoms
.find(i) !=
layergeoms
.end())
39
{
40
cout <<
"layer "
<< i <<
" already added to PHCylinderGeomContainer"
<< endl;
41
return
-1;
42
}
43
mygeom->
set_layer
(i);
44
layergeoms
[i] = mygeom;
45
return
0;
46
}
47
48
int
49
PHG4CylinderGeomContainer::AddLayerGeom
(
PHG4CylinderGeom
*mygeom)
50
{
51
int
layer
= mygeom->
get_layer
();
52
if
(
layergeoms
.find(layer) !=
layergeoms
.end())
53
{
54
cout <<
"layer "
<< layer <<
" already added to PHCylinderGeomContainer"
<< endl;
55
return
-1;
56
}
57
layergeoms
[
layer
] = mygeom;
58
return
0;
59
}
60
61
PHG4CylinderGeom
*
62
PHG4CylinderGeomContainer::GetLayerGeom
(
const
int
i)
63
{
64
map<int,PHG4CylinderGeom *>::const_iterator iter =
layergeoms
.find(i);
65
if
(iter !=
layergeoms
.end())
66
{
67
return
iter->second;
68
}
69
cout <<
"Could not locate layer "
<< i <<
" in PHG4CylinderGeomContainer"
<< endl;
70
return
nullptr
;
71
}
72
73
PHG4CylinderGeom
*
74
PHG4CylinderGeomContainer::GetFirstLayerGeom
()
75
{
76
if
(
layergeoms
.empty())
77
{
78
return
nullptr
;
79
}
80
return
layergeoms
.begin()->second;
81
}
82
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4CylinderGeomContainer.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:41
using
1.8.2 with
ECCE GitHub integration