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
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
PHG4BlockGeomContainer::~PHG4BlockGeomContainer
()
14
{
15
while
(
_layergeoms
.begin() !=
_layergeoms
.end())
16
{
17
delete
_layergeoms
.begin()->second;
18
_layergeoms
.erase(
_layergeoms
.begin());
19
}
20
return
;
21
}
22
23
void
24
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
37
PHG4BlockGeomContainer::AddLayerGeom
(
const
int
i,
PHG4BlockGeom
*mygeom)
38
{
39
if
(
_layergeoms
.find(i) !=
_layergeoms
.end())
40
{
41
cout <<
"layer "
<< i <<
" already added to PHBlockGeomContainer"
<< endl;
42
return
-1;
43
}
44
mygeom->
set_layer
(i);
45
_layergeoms
[i] = mygeom;
46
return
0;
47
}
48
49
int
50
PHG4BlockGeomContainer::AddLayerGeom
(
PHG4BlockGeom
*mygeom)
51
{
52
int
layer
= mygeom->
get_layer
();
53
if
(
_layergeoms
.find(layer) !=
_layergeoms
.end())
54
{
55
cout <<
"layer "
<< layer <<
" already added to PHBlockGeomContainer"
<< endl;
56
return
-1;
57
}
58
_layergeoms
[
layer
] = mygeom;
59
return
0;
60
}
61
62
PHG4BlockGeom
*
63
PHG4BlockGeomContainer::GetLayerGeom
(
const
int
i)
64
{
65
map<int,PHG4BlockGeom *>::const_iterator iter =
_layergeoms
.find(i);
66
if
(iter !=
_layergeoms
.end())
67
{
68
return
iter->second;
69
}
70
cout <<
"Could not locate layer "
<< i <<
" in PHG4BlockGeomContainer"
<< endl;
71
return
nullptr
;
72
}
73
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4BlockGeomContainer.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:40
using
1.8.2 with
ECCE GitHub integration