Belle II Software  release-08-01-10
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:
38 
40  static CDCMCCloneLookUp& getInstance();
41 
44 
47 
49  void fill(std::vector<CDCTrack>& cdcTracks);
50 
52  void clear();
53 
55  bool isTrackClone(const CDCTrack& cdcTrack);
56 
57  private:
59  CDCMCCloneLookUp() = default;
60 
63  std::map<const ITrackType, std::vector<CDCTrack*>> getMatchedCDCTracksByMCID(
64  std::vector<CDCTrack>& cdcTracks);
65 
69  CDCTrack* findBestMatchedTrack(std::vector<CDCTrack*> matchedTrackPtrs);
70 
72  std::map<const CDCTrack*, bool> m_cdcTrackIsCloneMap;
73  };
74 
78  operator FunctorTag();
79 
82  CompareCDCTracks(const CDCMCTrackLookUp& cdcMCTrackLookUp,
83  const CDCMCHitLookUp& cdcMCHitLookUp)
84  : m_CDCMCTrackLookUp(cdcMCTrackLookUp)
85  , m_CDCMCHitLookUp(cdcMCHitLookUp) {};
86 
87 
93  bool operator()(const CDCTrack* ptrCDCTrack1, const CDCTrack* ptrCDCTrack2) const;
94 
95  private:
97  unsigned int getNumberOfCorrectHits(const CDCTrack* ptrCDCTrack) const;
98 
103  };
104  } // namespace TrackFindingCDC
106 } // 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.
CDCMCCloneLookUp & operator=(const CDCMCCloneLookUp &)=delete
Operator =.
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