Belle II Software development
MCSegmentIdColorMap Class Reference

CDCHit to color map by their Monte Carlo segment id. More...

#include <HitColorMapping.h>

Inheritance diagram for MCSegmentIdColorMap:
Mapping< const CDCHit >

Public Member Functions

std::string map (int index, const CDCHit &hit) override
 Function call to map the CDCHit id and object to a color.
 
virtual std::string info ()
 Informal string summarizing the translation from the object to the attribute value.
 
virtual std::string info ()
 Informal string summarizing the translation from the object to the attribute value.
 

Detailed Description

CDCHit to color map by their Monte Carlo segment id.

Definition at line 93 of file HitColorMapping.h.

Member Function Documentation

◆ info() [1/2]

virtual std::string info ( )
inlinevirtualinherited

Informal string summarizing the translation from the object to the attribute value.

Reimplemented in BackgroundTagColorMap, MCParticleColorMap, MCPDGCodeColorMap, MCPrimaryColorMap, PosFlagColorMap, RLColorMap, and SimHitPDGCodeColorMap.

Definition at line 37 of file Mapping.h.

38 {
39 return "(no info available)\n";
40 }

◆ info() [2/2]

virtual std::string info ( )
inlinevirtualinherited

Informal string summarizing the translation from the object to the attribute value.

Reimplemented in BackgroundTagColorMap, MCParticleColorMap, MCPDGCodeColorMap, MCPrimaryColorMap, PosFlagColorMap, RLColorMap, and SimHitPDGCodeColorMap.

Definition at line 37 of file Mapping.h.

38 {
39 return "(no info available)\n";
40 }

◆ map()

std::string map ( int index,
const CDCHit & hit )
overridevirtual

Function call to map the CDCHit id and object to a color.

Reimplemented from Mapping< const CDCHit >.

Definition at line 180 of file HitColorMapping.cc.

181{
182 TrackFindingCDC::CDCMCHitLookUp mcHitLookUp;
183 mcHitLookUp.getInstance();
184 Index inTrackiSegment = mcHitLookUp.getInTrackSegmentId(&hit);
185
186 if (inTrackiSegment < 0) {
187 return (c_bkgHitColor);
188 } else {
189 // values are all fractions of their respective scale
190 double hue = 50 * inTrackiSegment % 360 / 360.0;
191 double saturation = 0.75, lightness = 0.5;
192 std::array<double, 3> rgb = Colors::hlsToRgb(hue, lightness, saturation);
193 std::ostringstream oss;
194 std::string color;
195 oss << "rgb(" << rgb[0] * 100 << "%, " << rgb[1] * 100 << "%, " << rgb[2] * 100 << "%)";
196 color = oss.str();
197 return color;
198 }
199}
TrackingUtilities::Index getInTrackSegmentId(const CDCHit *ptrHit) const
Returns the id of the segment in the track.
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
static std::array< double, 3 > hlsToRgb(double h, double l, double s)
Transforms a Color given in the HLS System to RGB.
Definition Colors.cc:56

The documentation for this class was generated from the following files: