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