Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4HitContainer.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4HitContainer.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4MAIN_PHG4HITCONTAINER_H
4 #define G4MAIN_PHG4HITCONTAINER_H
5 
6 #include "PHG4HitDefs.h"
7 
8 #include <phool/PHObject.h>
9 
10 #include <iostream>
11 #include <map>
12 #include <set>
13 #include <string>
14 #include <utility>
15 
16 class PHG4Hit;
17 
19 {
20 
21  public:
22  typedef std::map<PHG4HitDefs::keytype, PHG4Hit *> Map;
23  typedef Map::iterator Iterator;
24  typedef Map::const_iterator ConstIterator;
25  typedef std::pair<Iterator, Iterator> Range;
26  typedef std::pair<ConstIterator, ConstIterator> ConstRange;
27  typedef std::set<unsigned int>::const_iterator LayerIter;
28 
29  PHG4HitContainer(); //< used only by ROOT for DST readback
30  PHG4HitContainer(const std::string &nodename);
31 
32  ~PHG4HitContainer() override {}
33 
34  void Reset() override;
35 
36  void identify(std::ostream& os = std::cout) const override;
37 
39  void SetID(int i) {id = i;}
40  int GetID() const {return id;}
41 
42  ConstIterator AddHit(PHG4Hit *newhit);
43 
44  ConstIterator AddHit(const unsigned int detid, PHG4Hit *newhit);
45 
47 
49 
50  PHG4HitDefs::keytype genkey(const unsigned int detid);
51 
53  ConstRange getHits(const unsigned int detid) const;
54 
56  ConstRange getHits( void ) const;
57 
58  unsigned int size( void ) const
59  { return hitmap.size(); }
60  unsigned int num_layers(void) const
61  { return layers.size(); }
62  std::pair<LayerIter, LayerIter> getLayers() const
63  { return make_pair(layers.begin(), layers.end());}
64  void AddLayer(const unsigned int ilayer) {layers.insert(ilayer);}
65  void RemoveZeroEDep();
66  PHG4HitDefs::keytype getmaxkey(const unsigned int detid);
67 
68  protected:
69 
70  int id; //< unique identifier from hash of node name. Defined following PHG4HitDefs::get_volume_id
72  std::set<unsigned int> layers; // layers is not reset since layers must not change event by event
73 
74  ClassDefOverride(PHG4HitContainer,1)
75 };
76 
77 #endif