Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4BlockCellGeomContainer.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4BlockCellGeomContainer.cc
2 
3 #include "PHG4BlockCellGeom.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 
17 void PHG4BlockCellGeomContainer::identify(std::ostream &os) const
18 {
19  map<int, PHG4BlockCellGeom *>::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 PHBlockCellGeomContainer" << 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 PHBlockCellGeomContainer" << endl;
46  return -1;
47  }
48  layergeoms[layer] = mygeom;
49  return 0;
50 }
51 
54 {
55  map<int, PHG4BlockCellGeom *>::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 PHG4BlockCellGeomContainer" << endl;
61  return nullptr;
62 }