-
Notifications
You must be signed in to change notification settings - Fork 184
/
PHG4TpcCylinderGeomContainer.cc
70 lines (63 loc) · 1.74 KB
/
PHG4TpcCylinderGeomContainer.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "PHG4TpcCylinderGeomContainer.h"
#include "PHG4TpcCylinderGeom.h"
PHG4TpcCylinderGeomContainer::~PHG4TpcCylinderGeomContainer()
{
while (layergeoms.begin() != layergeoms.end())
{
delete layergeoms.begin()->second;
layergeoms.erase(layergeoms.begin());
}
return;
}
void PHG4TpcCylinderGeomContainer::identify(std::ostream &os) const
{
std::map<int, PHG4TpcCylinderGeom *>::const_iterator iter;
for (iter = layergeoms.begin(); iter != layergeoms.end(); ++iter)
{
std::cout << "layer " << iter->first << std::endl;
(iter->second)->identify(os);
}
return;
}
int PHG4TpcCylinderGeomContainer::AddLayerCellGeom(const int i, PHG4TpcCylinderGeom *mygeom)
{
if (layergeoms.find(i) != layergeoms.end())
{
std::cout << "layer " << i << " already added to PHCylinderCellGeomContainer" << std::endl;
return -1;
}
mygeom->set_layer(i);
layergeoms[i] = mygeom;
return 0;
}
int PHG4TpcCylinderGeomContainer::AddLayerCellGeom(PHG4TpcCylinderGeom *mygeom)
{
int layer = mygeom->get_layer();
if (layergeoms.find(layer) != layergeoms.end())
{
std::cout << "layer " << layer << " already added to PHCylinderCellGeomContainer" << std::endl;
return -1;
}
layergeoms[layer] = mygeom;
return 0;
}
PHG4TpcCylinderGeom *
PHG4TpcCylinderGeomContainer::GetLayerCellGeom(const int i)
{
std::map<int, PHG4TpcCylinderGeom *>::const_iterator iter = layergeoms.find(i);
if (iter != layergeoms.end())
{
return iter->second;
}
std::cout << "Could not locate layer " << i << " in PHG4TpcCylinderGeomContainer" << std::endl;
return nullptr;
}
PHG4TpcCylinderGeom *
PHG4TpcCylinderGeomContainer::GetFirstLayerCellGeom()
{
if (layergeoms.empty())
{
return nullptr;
}
return layergeoms.begin()->second;
}