Belle II Software development
MCPrimaryColorMap Class Reference

CDCHit to color map by the isPrimary information as well as the secondary process type in case the particle is not primary. More...

#include <HitColorMapping.h>

Inheritance diagram for MCPrimaryColorMap:
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 secondary process codes to colors.
 

Detailed Description

CDCHit to color map by the isPrimary information as well as the secondary process type in case the particle is not primary.

Definition at line 152 of file HitColorMapping.h.

Member Function Documentation

◆ info()

std::string info ( )
overridevirtual

Informal string summarizing the translation from secondary process codes to colors.

Reimplemented from Mapping< const CDCHit >.

Definition at line 327 of file HitColorMapping.cc.

328{
329 return "Legend:\n"
330 "blue->primary\n"
331 "green->secondary decay in flight\n"
332 "orange->beam background\n";
333}

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

308{
309 MCParticle* mcParticle = hit.getRelated<MCParticle>("MCParticles");
310 if (mcParticle != nullptr) {
311 unsigned short int primaryFlag = 1;
312 bool isPrimary = mcParticle->hasStatus(primaryFlag);
313 int secondaryProcess = mcParticle->getSecondaryPhysicsProcess();
314
315 if (isPrimary) {
316 return "blue";
317 } else if (secondaryProcess > 200) {
318 return "green"; // decay in flight
319 } else {
320 return "red";
321 }
322 } else {
323 return c_bkgHitColor;
324 }
325}
bool hasStatus(unsigned short int bitmask) const
Return if specific status bit is set.
Definition MCParticle.h:118
int getSecondaryPhysicsProcess() const
Returns the physics process type of a secondary particle.
Definition MCParticle.h:286
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: