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 162 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 348 of file HitColorMapping.cc.

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

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

336{
337 CDCSimHit* simHit = hit.getRelated<CDCSimHit>("CDCSimHits");
338 int pdgCode = simHit != nullptr ? simHit->getPDGCode() : -999;
339 auto itFound = c_colorByPDGCode.find(pdgCode);
340 if (itFound != c_colorByPDGCode.end()) {
341 return itFound->second;
342 } else {
343 B2WARNING("Unknown PDG code " << pdgCode);
344 return c_missingPDGColor;
345 }
346}
int getPDGCode() const
The method to get PDG code.
Definition CDCSimHit.h:177
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.

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