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.
 

Detailed Description

CDCHit to color map by their Monte Carlo segment id.

Definition at line 91 of file HitColorMapping.h.

Member Function Documentation

◆ info()

virtual std::string info ( )
inlinevirtualinherited

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

Reimplemented in RLColorMap, PosFlagColorMap, BackgroundTagColorMap, MCParticleColorMap, MCPDGCodeColorMap, MCPrimaryColorMap, 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 179 of file HitColorMapping.cc.

180{
182 mcHitLookUp.getInstance();
183 TrackFindingCDC::Index inTrackiSegment = mcHitLookUp.getInTrackSegmentId(&hit);
184
185 if (inTrackiSegment < 0) {
186 return (c_bkgHitColor);
187 } else {
188 // values are all fractions of their respective scale
189 double hue = 50 * inTrackiSegment % 360 / 360.0;
190 double saturation = 0.75, lightness = 0.5;
191 std::array<double, 3> rgb = Colors::hlsToRgb(hue, lightness, saturation);
192 std::ostringstream oss;
193 std::string color;
194 oss << "rgb(" << rgb[0] * 100 << "%, " << rgb[1] * 100 << "%, " << rgb[2] * 100 << "%)";
195 color = oss.str();
196 return color;
197 }
198}
Interface class to the Monte Carlo information for individual hits.
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: