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