Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4TpcCylinderGeomContainer.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4TpcCylinderGeomContainer.cc
2 
3 #include "PHG4TpcCylinderGeom.h"
4 
6 {
7  while (layergeoms.begin() != layergeoms.end())
8  {
9  delete layergeoms.begin()->second;
10  layergeoms.erase(layergeoms.begin());
11  }
12  return;
13 }
14 
15 void PHG4TpcCylinderGeomContainer::identify(std::ostream &os) const
16 {
17  std::map<int, PHG4TpcCylinderGeom *>::const_iterator iter;
18  for (iter = layergeoms.begin(); iter != layergeoms.end(); ++iter)
19  {
20  std::cout << "layer " << iter->first << std::endl;
21  (iter->second)->identify(os);
22  }
23  return;
24 }
25 
27 {
28  if (layergeoms.find(i) != layergeoms.end())
29  {
30  std::cout << "layer " << i << " already added to PHCylinderCellGeomContainer" << std::endl;
31  return -1;
32  }
33  mygeom->set_layer(i);
34  layergeoms[i] = mygeom;
35  return 0;
36 }
37 
39 {
40  int layer = mygeom->get_layer();
41  if (layergeoms.find(layer) != layergeoms.end())
42  {
43  std::cout << "layer " << layer << " already added to PHCylinderCellGeomContainer" << std::endl;
44  return -1;
45  }
46  layergeoms[layer] = mygeom;
47  return 0;
48 }
49 
52 {
53  std::map<int, PHG4TpcCylinderGeom *>::const_iterator iter = layergeoms.find(i);
54  if (iter != layergeoms.end())
55  {
56  return iter->second;
57  }
58  std::cout << "Could not locate layer " << i << " in PHG4TpcCylinderGeomContainer" << std::endl;
59  return nullptr;
60 }
61 
64 {
65  if (layergeoms.empty())
66  {
67  return nullptr;
68  }
69  return layergeoms.begin()->second;
70 }