ECCE @ EIC 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 
20  public:
21  typedef std::map<PHG4CylinderCellDefs::keytype,PHG4CylinderCell *> Map;
22  typedef Map::iterator Iterator;
23  typedef Map::const_iterator ConstIterator;
24  typedef std::pair<Iterator, Iterator> Range;
25  typedef std::pair<ConstIterator, ConstIterator> ConstRange;
26  typedef std::set<int>::const_iterator LayerIter;
27  typedef std::pair<LayerIter, LayerIter> LayerRange;
28 
30 
32 
33 // from PHObject
34  void identify(std::ostream& os = std::cout) const override;
35  void Reset() override;
36 
37  ConstIterator AddCylinderCell(const unsigned int detid, PHG4CylinderCell *newcylinderCell);
39 
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 
63 
65 
66  PHG4CylinderCellDefs::keytype genkey(const unsigned int detid);
67 
69  ConstRange getCylinderCells(const unsigned int detid) const;
70 
72  ConstRange getCylinderCells( void ) const;
73 
75 
76  unsigned int size( void ) const
77  { return cellmap.size(); }
78  unsigned int num_layers(void) const
79  { return layers.size(); }
81  { return make_pair(layers.begin(), layers.end());}
82 
83  double getTotalEdep() const;
84 
85  protected:
87  std::set<int> layers; // layers is not reset since layers must not change event by event
88 
89  ClassDefOverride(PHG4CylinderCellContainer,1)
90 };
91 
92 #endif