ECCE @ EIC 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 
6 using namespace std;
7 
9 {
10  while(layergeoms.begin() != layergeoms.end())
11  {
12  delete layergeoms.begin()->second;
13  layergeoms.erase(layergeoms.begin());
14  }
15  return;
16 }
17 
18 void
20 {
21  map<int,PHG4CylinderCellGeom *>::const_iterator iter;
22  for (iter=layergeoms.begin(); iter != layergeoms.end(); ++iter)
23  {
24  cout << "layer " << iter->first << endl;
25  (iter->second)->identify(os);
26  }
27  return;
28 }
29 
30 int
32 {
33  if (layergeoms.find(i) != layergeoms.end())
34  {
35  cout << "layer " << i << " already added to PHCylinderCellGeomContainer" << endl;
36  return -1;
37  }
38  mygeom->set_layer(i);
39  layergeoms[i] = mygeom;
40  return 0;
41 }
42 
43 int
45 {
46  int layer = mygeom->get_layer();
47  if (layergeoms.find(layer) != layergeoms.end())
48  {
49  cout << "layer " << layer << " already added to PHCylinderCellGeomContainer" << endl;
50  return -1;
51  }
52  layergeoms[layer] = mygeom;
53  return 0;
54 }
55 
58 {
59  map<int,PHG4CylinderCellGeom *>::const_iterator iter = layergeoms.find(i);
60  if (iter != layergeoms.end())
61  {
62  return iter->second;
63  }
64  cout << "Could not locate layer " << i << " in PHG4CylinderCellGeomContainer" << endl;
65  return nullptr;
66 }
67 
70 {
71  if (layergeoms.empty())
72  {
73  return nullptr;
74  }
75  return layergeoms.begin()->second;
76 }
77