File indexing completed on 2024-04-06 12:30:01
0001 #include "SimG4CMS/Forward/interface/ForwardName.h"
0002
0003 std::string ForwardName::getName(const G4String& namx) {
0004 std::string name = static_cast<std::string>(namx);
0005 if (name.find(':') == std::string::npos) {
0006 return name;
0007 } else {
0008 std::size_t first = name.find(':') + 1;
0009 std::size_t last = name.rfind('_');
0010 std::size_t length = (last != std::string::npos) ? (last - first) : (name.size() - first);
0011 return name.substr(first, length);
0012 }
0013 }