Belle II Software  release-05-01-25
RecoTrackColorMapping.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/display/RecoTrackColorMapping.h>
11 
12 #include <tracking/mcMatcher/TrackMatchLookUp.h>
13 
14 #include <tracking/dataobjects/RecoTrack.h>
15 
16 using namespace Belle2;
17 using namespace TrackFindingCDC;
18 
19 const std::string c_bkgRecoTrackColor = "orange";
20 
21 std::string RecoTrackMatchingStatusColorMap::map(int index __attribute__((unused)),
22  const RecoTrack& recoTrack)
23 {
24  using MatchingStatus = RecoTrack::MatchingStatus;
25  MatchingStatus matchingStatus = recoTrack.getMatchingStatus();
26  switch (matchingStatus) {
27  case MatchingStatus::c_matched:
28  B2DEBUG(100, "Draw RecoTrack " << index << " as matched");
29  return "green";
30  break;
31 
32  case MatchingStatus::c_background:
33  B2DEBUG(100, "Draw RecoTrack " << index << " as background");
34  return "purple";
35  break;
36 
37  case MatchingStatus::c_clone:
38  B2DEBUG(100, "Draw RecoTrack " << index << " as clone");
39  return "blue";
40  break;
41 
42  case MatchingStatus::c_ghost:
43  B2DEBUG(100, "Draw RecoTrack " << index << " as ghost");
44  return "red";
45  break;
46 
47  default:
48  B2WARNING("Undefined matching status");
49  return c_bkgRecoTrackColor;
50  break;
51  }
52 }
53 
55 {
56  return "Matching status:\n green <-> match\n blue <-> clone\n red <-> ghost\n purple <-> background.";
57 }
58 
59 std::string MCRecoTrackMatchingStatusColorMap::map(int index __attribute__((unused)),
60  const RecoTrack& recoTrack)
61 {
62  const std::string mcRecoTrackStoreArrayName = "MCRecoTracks";
63  TrackMatchLookUp trackMatchLookUp(mcRecoTrackStoreArrayName);
64  using MCToPRMatchInfo = TrackMatchLookUp::MCToPRMatchInfo;
65  MCToPRMatchInfo mcMatchInfo = trackMatchLookUp.getMCToPRMatchInfo(recoTrack);
66  MCParticle* mcParticle = recoTrack.getRelatedTo<MCParticle>();
67  bool isPrimary = mcParticle->isPrimaryParticle();
68  switch (mcMatchInfo) {
69  case MCToPRMatchInfo::c_Matched:
70  return isPrimary ? "green" : "limegreen";
71  break;
72 
73  case MCToPRMatchInfo::c_Merged:
74  return isPrimary ? "blue" : "cornflowerblue";
75  break;
76 
77  case MCToPRMatchInfo::c_Missing:
78  return isPrimary ? "darkred" : "crimson";
79  break;
80 
81  default:
82  B2WARNING("Undefined matching status");
83  return c_bkgRecoTrackColor;
84  break;
85  }
86 }
87 
89 {
90  return "Matching status:\n green <-> match\n blue <-> merged\n red <-> missing.";
91 }
Belle2::TrackMatchLookUp::MCToPRMatchInfo
MCToPRMatchInfo
Matching categories for the Monte Carlo tracks.
Definition: TrackMatchLookUp.h:49
Belle2::RelationsInterface::getRelatedTo
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
Definition: RelationsObject.h:250
Belle2::TrackMatchLookUp
Class to provide convenient methods to look up matching information between pattern recognition and M...
Definition: TrackMatchLookUp.h:43
Belle2::RecoTrack::getMatchingStatus
MatchingStatus getMatchingStatus() const
Return the matching status set by the TrackMatcher module.
Definition: RecoTrack.h:718
Belle2::MCParticle::isPrimaryParticle
bool isPrimaryParticle() const
Check if particle is a primary particle which was created by the generator (and not,...
Definition: MCParticle.h:588
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::TrackFindingCDC::MCRecoTrackMatchingStatusColorMap::info
std::string info() override
Short description of the coloring scheme.
Definition: RecoTrackColorMapping.cc:88
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackMatchLookUp::getMCToPRMatchInfo
MCToPRMatchInfo getMCToPRMatchInfo(const RecoTrack &mcRecoTrack) const
Gets the matching category of Monte Carlo track.
Definition: TrackMatchLookUp.h:123
Belle2::TrackFindingCDC::MCRecoTrackMatchingStatusColorMap::map
std::string map(int index, const RecoTrack &recoTrack) override
Function call to map a reco tracks object to a color.
Definition: RecoTrackColorMapping.cc:59
Belle2::MCParticle
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:43
Belle2::TrackFindingCDC::RecoTrackMatchingStatusColorMap::info
std::string info() override
Short description of the coloring scheme.
Definition: RecoTrackColorMapping.cc:54
Belle2::RecoTrack::MatchingStatus
MatchingStatus
Enum for the matching status of this reco track (set by the matching modules in the tracking package)...
Definition: RecoTrack.h:104
Belle2::TrackFindingCDC::RecoTrackMatchingStatusColorMap::map
std::string map(int index, const RecoTrack &recoTrack) override
Function call to map a reco tracks object to a color.
Definition: RecoTrackColorMapping.cc:21