File indexing completed on 2025-12-17 09:20:15
0001 #ifndef KFPARTICLESPHENIX_KFPARTICLECONTAINER_H
0002 #define KFPARTICLESPHENIX_KFPARTICLECONTAINER_H
0003
0004 #include <phool/PHObject.h>
0005
0006 #include <cstddef> // for size_t
0007 #include <iostream> // for cout, ostream
0008 #include <map>
0009
0010 class KFParticle;
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 class KFParticle_Container : public PHObject
0022 {
0023 public:
0024 using Map = std::map<unsigned int, KFParticle*>;
0025 using ConstIter = Map::const_iterator;
0026 using Iter = Map::iterator;
0027
0028 KFParticle_Container();
0029 KFParticle_Container(const KFParticle_Container& kfparticlemap);
0030 KFParticle_Container& operator=(const KFParticle_Container& kfparticlemap);
0031 ~KFParticle_Container() override;
0032
0033 void identify(std::ostream& os = std::cout) const override;
0034
0035 void Reset() override;
0036 int isValid() const override { return 1; }
0037 PHObject* CloneMe() const override { return new KFParticle_Container(*this); }
0038
0039 bool empty() const { return m_kfpmap.empty(); }
0040 size_t size() const { return m_kfpmap.size(); }
0041 size_t count(unsigned int key) const { return m_kfpmap.count(key); }
0042 void clear() { Reset(); }
0043
0044 const KFParticle* get(unsigned int key) const;
0045 KFParticle* get(unsigned int key);
0046
0047 ConstIter begin() const { return m_kfpmap.begin(); }
0048 ConstIter find(unsigned int key) const { return m_kfpmap.find(key); }
0049 ConstIter end() const { return m_kfpmap.end(); }
0050
0051 Iter begin() { return m_kfpmap.begin(); }
0052 Iter find(unsigned int key) { return m_kfpmap.find(key); }
0053 Iter end() { return m_kfpmap.end(); }
0054
0055 KFParticle* insert(const KFParticle* particle);
0056 ConstIter addParticle(KFParticle* particle);
0057 ConstIter addParticleSpecifyKey(unsigned int key, KFParticle* particle);
0058
0059
0060 Map returnParticlesByPDGid(int PDGid);
0061
0062 size_t erase(unsigned int key);
0063
0064 private:
0065 Map m_kfpmap;
0066
0067 ClassDefOverride(KFParticle_Container, 1)
0068 };
0069
0070 #endif