Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EmbRecoMatchContainerv1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EmbRecoMatchContainerv1.h
1 #ifndef TRACKBASE_EMBRECOMATCHCONTAINERV1_H
2 #define TRACKBASE_EMBRECOMATCHCONTAINERV1_H
3 
5 #include <vector>
6 
7 class EmbRecoMatch;
8 
10 {
11  public:
12  void Reset() override;
13 
15  unsigned short nMatches() const override { return m_data.size(); };
16  unsigned short nTruthUnmatched() const override { return m_idsTruthUnmatched.size(); };
17  std::vector<unsigned short>& ids_TruthUnmatched() override { return m_idsTruthUnmatched; };
18  std::vector<unsigned short> ids_TruthMatched() const override;
19  std::vector<unsigned short> ids_RecoMatched() const override;
20 
21  std::map<unsigned short, unsigned short>& map_nRecoPerTruth() override { return m_nRecoPerTruth; };
22  std::map<unsigned short, unsigned short>& map_nTruthPerReco() override { return m_nTruthPerReco; };
23 
24  ConstRange getMatchedRange() const override { return std::make_pair(m_data.begin(), m_data.end()); };
25  Vector& getMatches() override { return m_data; };
26 
27  void addMatch(EmbRecoMatch* match) override;
28  bool hasTruthMatch(unsigned short idEmb) override;
29  bool hasRecoMatch(unsigned short idReco) override;
30  EmbRecoMatch* getMatchTruth(unsigned short idEmb, unsigned short offset=0) override;
31  EmbRecoMatch* getMatchReco (unsigned short idEmb, unsigned short offset=0) override;
32 
33  // PHObject virtual overload
34  void identify(std::ostream& os = std::cout) const override;
35 
36  struct CompShortToPair {
37  bool operator() (const unsigned short lhs, const std::pair<unsigned short, unsigned short> rhs) const
38  {return lhs < rhs.first;}
39  bool operator() (const std::pair<unsigned short, unsigned short> lhs, const unsigned short rhs) const
40  {return lhs.first < rhs;}
41  };
42 
43  void sort() override;
44  void checkfill_idsTruthUnmatched(unsigned short) override; // add tracks one-by-one and add to m_idsTruthUnmatched if not matched
45 
46  private:
47  Vector m_data; // using Vector = std::vector<EmbRecoMatch*>;
48  std::vector<std::pair<unsigned short, unsigned short>> m_RecoToTruth;
49  std::vector<unsigned short> m_idsTruthUnmatched;
52  ClassDefOverride(EmbRecoMatchContainerv1, 1)
53 };
54 
55 #endif // TRACKBASE_EMBRECOMATCHCONTAINERV1_H
56