Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4CylinderCellContainer.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4CylinderCellContainer.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4DETECTORS_PHG4CYLINDERCELLCONTAINER_H
4 #define G4DETECTORS_PHG4CYLINDERCELLCONTAINER_H
5 
6 #include "PHG4CylinderCellDefs.h" // for keytype
7 
8 #include <phool/PHObject.h>
9 
10 #include <iostream> // for cout, ostream
11 #include <map>
12 #include <set>
13 #include <utility> // for pair, make_pair
14 
15 class PHG4CylinderCell;
16 
18 {
19  public:
20  typedef std::map<PHG4CylinderCellDefs::keytype, PHG4CylinderCell *> Map;
21  typedef Map::iterator Iterator;
22  typedef Map::const_iterator ConstIterator;
23  typedef std::pair<Iterator, Iterator> Range;
24  typedef std::pair<ConstIterator, ConstIterator> ConstRange;
25  typedef std::set<int>::const_iterator LayerIter;
26  typedef std::pair<LayerIter, LayerIter> LayerRange;
27 
29 
31 
32  // from PHObject
33  void identify(std::ostream &os = std::cout) const override;
34  void Reset() override;
35 
36  ConstIterator AddCylinderCell(const unsigned int detid, PHG4CylinderCell *newcylinderCell);
38 
41  {
42  cellmap.erase(key);
43  }
44 
47  {
48  Iterator its = cellmap.begin();
49  Iterator last = cellmap.end();
50  for (; its != last;)
51  {
52  if (its->second == cell)
53  {
54  cellmap.erase(its++);
55  }
56  else
57  {
58  ++its;
59  }
60  }
61  }
62 
64 
65  PHG4CylinderCellDefs::keytype genkey(const unsigned int detid);
66 
68  ConstRange getCylinderCells(const unsigned int detid) const;
69 
71  ConstRange getCylinderCells(void) const;
72 
74 
75  unsigned int size(void) const
76  {
77  return cellmap.size();
78  }
79  unsigned int num_layers(void) const
80  {
81  return layers.size();
82  }
84  {
85  return make_pair(layers.begin(), layers.end());
86  }
87 
88  double getTotalEdep() const;
89 
90  protected:
92  std::set<int> layers; // layers is not reset since layers must not change event by event
93 
94  ClassDefOverride(PHG4CylinderCellContainer, 1)
95 };
96 
97 #endif