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
PHG4BlockGeomContainer.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4BlockGeomContainer.cc
1
#include "
PHG4BlockGeomContainer.h
"
2
3
#include "
PHG4BlockGeom.h
"
4
5
#include <cmath>
6
7
using namespace
std;
8
9
PHG4BlockGeomContainer::PHG4BlockGeomContainer
()
10
: _magfield(NAN)
11
{
12
}
13
14
PHG4BlockGeomContainer::~PHG4BlockGeomContainer
()
15
{
16
while
(
_layergeoms
.begin() !=
_layergeoms
.end())
17
{
18
delete
_layergeoms
.begin()->second;
19
_layergeoms
.erase(
_layergeoms
.begin());
20
}
21
return
;
22
}
23
24
void
PHG4BlockGeomContainer::identify
(std::ostream &
os
)
const
25
{
26
os <<
"mag field: "
<<
_magfield
<< endl;
27
os <<
"number of layers: "
<<
_layergeoms
.size() << endl;
28
map<int, PHG4BlockGeom *>::const_iterator iter;
29
for
(iter =
_layergeoms
.begin(); iter !=
_layergeoms
.end(); ++iter)
30
{
31
(iter->second)->
identify
(os);
32
}
33
return
;
34
}
35
36
int
PHG4BlockGeomContainer::AddLayerGeom
(
const
int
i
,
PHG4BlockGeom
*mygeom)
37
{
38
if
(
_layergeoms
.find(i) !=
_layergeoms
.end())
39
{
40
cout <<
"layer "
<< i <<
" already added to PHBlockGeomContainer"
<< endl;
41
return
-1;
42
}
43
mygeom->
set_layer
(i);
44
_layergeoms
[
i
] = mygeom;
45
return
0;
46
}
47
48
int
PHG4BlockGeomContainer::AddLayerGeom
(
PHG4BlockGeom
*mygeom)
49
{
50
int
layer
= mygeom->
get_layer
();
51
if
(
_layergeoms
.find(layer) !=
_layergeoms
.end())
52
{
53
cout <<
"layer "
<< layer <<
" already added to PHBlockGeomContainer"
<< endl;
54
return
-1;
55
}
56
_layergeoms
[
layer
] = mygeom;
57
return
0;
58
}
59
60
PHG4BlockGeom
*
61
PHG4BlockGeomContainer::GetLayerGeom
(
const
int
i
)
62
{
63
map<int, PHG4BlockGeom *>::const_iterator iter =
_layergeoms
.find(i);
64
if
(iter !=
_layergeoms
.end())
65
{
66
return
iter->second;
67
}
68
cout <<
"Could not locate layer "
<< i <<
" in PHG4BlockGeomContainer"
<< endl;
69
return
nullptr
;
70
}
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4BlockGeomContainer.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:12
using
1.8.2 with
sPHENIX GitHub integration