Belle II Software development
SimHitPDGCodeColorMap Class Reference

CDCHit to color map by the associated CDCSimHit::getPDG(). More...

#include <HitColorMapping.h>

Inheritance diagram for SimHitPDGCodeColorMap:
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.
 
std::string info () override
 Informal string summarizing the translation from pdg codes to colors.
 

Detailed Description

CDCHit to color map by the associated CDCSimHit::getPDG().

Definition at line 160 of file HitColorMapping.h.

Member Function Documentation

◆ info()

std::string info ( )
overridevirtual

Informal string summarizing the translation from pdg codes to colors.

Reimplemented from Mapping< const CDCHit >.

Definition at line 347 of file HitColorMapping.cc.

348{
349 std::ostringstream oss;
350 oss << "\nLegend:";
351
352 std::map<std::string, std::set<int>> pdgCodeByColor;
353
354 for (auto item : c_colorByPDGCode) {
355 pdgCodeByColor[item.second].insert(item.first);
356 }
357
358 for (auto item : pdgCodeByColor) {
359 oss << '\n' << item.first << "->[";
360 oss << join(", ", item.second);
361 oss << ']';
362 }
363 oss << '\n';
364 return oss.str();
365}

◆ 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 334 of file HitColorMapping.cc.

335{
336 CDCSimHit* simHit = hit.getRelated<CDCSimHit>("CDCSimHits");
337 int pdgCode = simHit != nullptr ? simHit->getPDGCode() : -999;
338 auto itFound = c_colorByPDGCode.find(pdgCode);
339 if (itFound != c_colorByPDGCode.end()) {
340 return itFound->second;
341 } else {
342 B2WARNING("Unknown PDG code " << pdgCode);
343 return c_missingPDGColor;
344 }
345}
Example Detector.
Definition: CDCSimHit.h:21
int getPDGCode() const
The method to get PDG code.
Definition: CDCSimHit.h:178

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