Belle II Software  release-06-00-14
CDCMCCloneLookUp.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
11 #include <tracking/trackFindingCDC/mclookup/ITrackType.h>
12 
13 #include <tracking/trackFindingCDC/mclookup/CDCMCTrackLookUp.h>
14 #include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
15 
16 #include <map>
17 #include <vector>
18 
19 namespace Belle2 {
24  namespace TrackFindingCDC {
25 
36 
37  public:
39  static CDCMCCloneLookUp& getInstance();
42  CDCMCCloneLookUp& operator=(const CDCMCCloneLookUp&) = delete;
43 
45  void fill(std::vector<CDCTrack>& cdcTracks);
46 
48  void clear();
49 
51  bool isTrackClone(const CDCTrack& cdcTrack);
52 
53  private:
55  CDCMCCloneLookUp() = default;
56 
59  std::map<const ITrackType, std::vector<CDCTrack*>> getMatchedCDCTracksByMCID(
60  std::vector<CDCTrack>& cdcTracks);
61 
65  CDCTrack* findBestMatchedTrack(std::vector<CDCTrack*> matchedTrackPtrs);
66 
68  std::map<const CDCTrack*, bool> m_cdcTrackIsCloneMap;
69  };
70 
74  operator FunctorTag();
75 
78  CompareCDCTracks(const CDCMCTrackLookUp& cdcMCTrackLookUp,
79  const CDCMCHitLookUp& cdcMCHitLookUp)
80  : m_CDCMCTrackLookUp(cdcMCTrackLookUp)
81  , m_CDCMCHitLookUp(cdcMCHitLookUp) {};
82 
83 
89  bool operator()(const CDCTrack* ptrCDCTrack1, const CDCTrack* ptrCDCTrack2) const;
90 
91  private:
93  unsigned int getNumberOfCorrectHits(const CDCTrack* ptrCDCTrack) const;
94 
99  };
100  } // namespace TrackFindingCDC
102 } // namespace Belle2
Class providing information whether a PR CDC track is the best match or a clone.
bool isTrackClone(const CDCTrack &cdcTrack)
getter for information from m_cdcTrackIsCloneMap
CDCMCCloneLookUp()=default
Singleton: Default ctor only available to getInstance method.
CDCMCCloneLookUp(CDCMCCloneLookUp &)=delete
Singleton: Delete copy constructor and assignment operator.
std::map< const ITrackType, std::vector< CDCTrack * > > getMatchedCDCTracksByMCID(std::vector< CDCTrack > &cdcTracks)
Helper function which returns a map of MCTrackIDs to vectors of CDTrack pointers.
static CDCMCCloneLookUp & getInstance()
Getter for the singletone instance.
std::map< const CDCTrack *, bool > m_cdcTrackIsCloneMap
Map of track pointers to isClone indicator from MCTruth-based assumption.
void clear()
Clear eventwise lookup tables.
CDCTrack * findBestMatchedTrack(std::vector< CDCTrack * > matchedTrackPtrs)
Helper function which takes a vector of pointers to CDCTracks which are matched to the same MC partic...
void fill(std::vector< CDCTrack > &cdcTracks)
fill with all cdcTracks in an event
Interface class to the Monte Carlo information for individual hits.
Specialisation of the lookup for the truth values of reconstructed tracks.
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
Abstract base class for different kinds of events.
Functor which which decides which of two tracks to declare as best match.
bool operator()(const CDCTrack *ptrCDCTrack1, const CDCTrack *ptrCDCTrack2) const
Compare both CDC tracks to get the better matched one.
unsigned int getNumberOfCorrectHits(const CDCTrack *ptrCDCTrack) const
Get number of hits in track that are correctly matched.
CompareCDCTracks(const CDCMCTrackLookUp &cdcMCTrackLookUp, const CDCMCHitLookUp &cdcMCHitLookUp)
Constructor of the CDC track comparer to get the better match, taking references to MC lookup singlet...
const CDCMCHitLookUp & m_CDCMCHitLookUp
Reference to a CDCMCHitLookUp instance, assigned in the constructor of this functor.
const CDCMCTrackLookUp & m_CDCMCTrackLookUp
Reference to a CDCMCTrackLookUp instance, assigned in the constructor of this functor.
Tag class to facilitate marking of class as a functor in the sense of this code.
Definition: FunctorTag.h:20