CDCHit to color map by the associated MCParticle::getPDG()
More...
#include <HitColorMapping.h>
|
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.
|
|
CDCHit to color map by the associated MCParticle::getPDG()
Definition at line 140 of file HitColorMapping.h.
◆ info()
Informal string summarizing the translation from pdg codes to colors.
Reimplemented from Mapping< const CDCHit >.
Definition at line 286 of file HitColorMapping.cc.
287{
288 std::ostringstream oss;
289 oss << "\nLegend:";
290
291 std::map<std::string, std::set<int>> pdgCodeByColor;
292
293 for (auto item : c_colorByPDGCode) {
294 pdgCodeByColor[item.second].insert(item.first);
295 }
296
297 for (auto item : pdgCodeByColor) {
298 oss << '\n' << item.first << "->[";
299 oss << join(", ", item.second);
300 oss << ']';
301 }
302 oss << '\n';
303 return oss.str();
304}
◆ 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 272 of file HitColorMapping.cc.
273{
274 MCParticle* mcParticle = hit.getRelated<MCParticle>("MCParticles");
275 int pdgCode = mcParticle !=
nullptr ? mcParticle->
getPDG() : -999;
276
277 auto itFound = c_colorByPDGCode.find(pdgCode);
278 if (itFound != c_colorByPDGCode.end()) {
279 return itFound->second;
280 } else {
281 B2WARNING("Unknown PDG code " << pdgCode);
282 return c_missingPDGColor;
283 }
284}
int getPDG() const
Return PDG code of particle.
The documentation for this class was generated from the following files: