Skip to content

Avoid string matching in sensitive detector handling #1643

@gaponenko

Description

@gaponenko

The code that activates GEANT4 sensitive detectors is fragile, as it relies on string comparison to guess what volumes should be made sensitive. For example,

if (LVname.find("EMFModule") != std::string::npos) {

There are many more instances of that in Mu2eWorld.cc

This has already caused a problem (PR #1640).

A better approach is to store pointers to volumes that need to be made sensitive at the volume creation time and pass the pointers to the code that activates sensitive detectors.

Metadata

Metadata

Assignees

Labels

LowIssue with Low Prioritycleanupimprove code quality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions