Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:42

0001 #include "PHG4BlockCellGeomContainer.h"
0002 
0003 #include "PHG4BlockCellGeom.h"
0004 
0005 using namespace std;
0006 
0007 PHG4BlockCellGeomContainer::~PHG4BlockCellGeomContainer()
0008 {
0009   while (layergeoms.begin() != layergeoms.end())
0010   {
0011     delete layergeoms.begin()->second;
0012     layergeoms.erase(layergeoms.begin());
0013   }
0014   return;
0015 }
0016 
0017 void PHG4BlockCellGeomContainer::identify(std::ostream &os) const
0018 {
0019   map<int, PHG4BlockCellGeom *>::const_iterator iter;
0020   for (iter = layergeoms.begin(); iter != layergeoms.end(); ++iter)
0021   {
0022     cout << "layer " << iter->first << endl;
0023     (iter->second)->identify(os);
0024   }
0025   return;
0026 }
0027 
0028 int PHG4BlockCellGeomContainer::AddLayerCellGeom(const int i, PHG4BlockCellGeom *mygeom)
0029 {
0030   if (layergeoms.find(i) != layergeoms.end())
0031   {
0032     cout << "layer " << i << " already added to PHBlockCellGeomContainer" << endl;
0033     return -1;
0034   }
0035   mygeom->set_layer(i);
0036   layergeoms[i] = mygeom;
0037   return 0;
0038 }
0039 
0040 int PHG4BlockCellGeomContainer::AddLayerCellGeom(PHG4BlockCellGeom *mygeom)
0041 {
0042   int layer = mygeom->get_layer();
0043   if (layergeoms.find(layer) != layergeoms.end())
0044   {
0045     cout << "layer " << layer << " already added to PHBlockCellGeomContainer" << endl;
0046     return -1;
0047   }
0048   layergeoms[layer] = mygeom;
0049   return 0;
0050 }
0051 
0052 PHG4BlockCellGeom *
0053 PHG4BlockCellGeomContainer::GetLayerCellGeom(const int i)
0054 {
0055   map<int, PHG4BlockCellGeom *>::const_iterator iter = layergeoms.find(i);
0056   if (iter != layergeoms.end())
0057   {
0058     return iter->second;
0059   }
0060   cout << "Could not locate layer " << i << " in PHG4BlockCellGeomContainer" << endl;
0061   return nullptr;
0062 }