Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KFParticle_Container.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file KFParticle_Container.h
1 #ifndef KFPARTICLESPHENIX_KFPARTICLECONTAINER_H
2 #define KFPARTICLESPHENIX_KFPARTICLECONTAINER_H
3 
4 #include <phool/PHObject.h>
5 
6 #include <cstddef> // for size_t
7 #include <iostream> // for cout, ostream
8 #include <iterator>
9 #include <map>
10 
11 class KFParticle;
12 
19 // using ConstIter = Map::const_iterator;
20 // typedef std::map<int, KFParticle*>::const_iterator ConstIter;
21 
23 {
24  public:
25  using Map = std::map<unsigned int, KFParticle*>;
26  using ConstIter = Map::const_iterator;
27  using Iter = Map::iterator;
28 
30  KFParticle_Container(const KFParticle_Container& kfparticlemap);
32  ~KFParticle_Container() override;
33 
34  void identify(std::ostream& os = std::cout) const override;
35  // cppcheck-suppress [virtualCallInConstructor]
36  void Reset() override;
37  int isValid() const override { return 1; }
38  PHObject* CloneMe() const override { return new KFParticle_Container(*this); }
39 
40  bool empty() const { return m_kfpmap.empty(); }
41  size_t size() const { return m_kfpmap.size(); }
42  size_t count(unsigned int key) const { return m_kfpmap.count(key); }
43  void clear() { Reset(); }
44 
45  const KFParticle* get(unsigned int key) const;
46  KFParticle* get(unsigned int key);
47 
48  ConstIter begin() const { return m_kfpmap.begin(); }
49  ConstIter find(unsigned int key) const { return m_kfpmap.find(key); }
50  ConstIter end() const { return m_kfpmap.end(); }
51 
52  Iter begin() { return m_kfpmap.begin(); }
53  Iter find(unsigned int key) { return m_kfpmap.find(key); }
54  Iter end() { return m_kfpmap.end(); }
55 
59 
61  Map returnParticlesByPDGid(int PDGid);
62 
63  size_t erase(unsigned int key);
64 
65  private:
67 
68  ClassDefOverride(KFParticle_Container, 1)
69 };
70 
71 #endif // KFPARTICLESPHENIX_KFPARTICLECONTAINER_H