ECCE @ EIC 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
18 PHG4BlockCellGeomContainer::identify(std::ostream& os) const
19 {
20  map<int,PHG4BlockCellGeom *>::const_iterator iter;
21  for (iter=layergeoms.begin(); iter != layergeoms.end(); ++iter)
22  {
23  cout << "layer " << iter->first << endl;
24  (iter->second)->identify(os);
25  }
26  return;
27 }
28 
29 int
31 {
32  if (layergeoms.find(i) != layergeoms.end())
33  {
34  cout << "layer " << i << " already added to PHBlockCellGeomContainer" << endl;
35  return -1;
36  }
37  mygeom->set_layer(i);
38  layergeoms[i] = mygeom;
39  return 0;
40 }
41 
42 int
44 {
45  int layer = mygeom->get_layer();
46  if (layergeoms.find(layer) != layergeoms.end())
47  {
48  cout << "layer " << layer << " already added to PHBlockCellGeomContainer" << endl;
49  return -1;
50  }
51  layergeoms[layer] = mygeom;
52  return 0;
53 }
54 
57 {
58  map<int,PHG4BlockCellGeom *>::const_iterator iter = layergeoms.find(i);
59  if (iter != layergeoms.end())
60  {
61  return iter->second;
62  }
63  cout << "Could not locate layer " << i << " in PHG4BlockCellGeomContainer" << endl;
64  return nullptr;
65 }
66