Class Reference for E1039 Core & Analysis Software
PHG4BlockGeomContainer.cc
Go to the documentation of this file.
2 #include "PHG4BlockGeom.h"
3 #include <cmath>
4 
5 using namespace std;
6 
8 {
9  _magfield = NAN;
10  return;
11 }
12 
14 {
15  while(_layergeoms.begin() != _layergeoms.end())
16  {
17  delete _layergeoms.begin()->second;
18  _layergeoms.erase(_layergeoms.begin());
19  }
20  return;
21 }
22 
23 void
24 PHG4BlockGeomContainer::identify(std::ostream& os) const
25 {
26  os << "mag field: " << _magfield << endl;
27  os << "number of layers: " << _layergeoms.size() << endl;
28  map<int,PHG4BlockGeom *>::const_iterator iter;
29  for (iter=_layergeoms.begin(); iter != _layergeoms.end(); ++iter)
30  {
31  (iter->second)->identify(os);
32  }
33  return;
34 }
35 
36 int
38 {
39  if (_layergeoms.find(i) != _layergeoms.end())
40  {
41  cout << "layer " << i << " already added to PHBlockGeomContainer" << endl;
42  return -1;
43  }
44  mygeom->set_layer(i);
45  _layergeoms[i] = mygeom;
46  return 0;
47 }
48 
49 int
51 {
52  int layer = mygeom->get_layer();
53  if (_layergeoms.find(layer) != _layergeoms.end())
54  {
55  cout << "layer " << layer << " already added to PHBlockGeomContainer" << endl;
56  return -1;
57  }
58  _layergeoms[layer] = mygeom;
59  return 0;
60 }
61 
64 {
65  map<int,PHG4BlockGeom *>::const_iterator iter = _layergeoms.find(i);
66  if (iter != _layergeoms.end())
67  {
68  return iter->second;
69  }
70  cout << "Could not locate layer " << i << " in PHG4BlockGeomContainer" << endl;
71  return NULL;
72 }
73 
#define NULL
Definition: Pdb.h:9
void identify(std::ostream &os=std::cout) const
int AddLayerGeom(const int i, PHG4BlockGeom *mygeom)
PHG4BlockGeom * GetLayerGeom(const int i)
virtual void set_layer(const int i)
Definition: PHG4BlockGeom.h:32
virtual int get_layer() const
Definition: PHG4BlockGeom.h:17