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