Skip to content

Commit

Permalink
Code check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Jan 11, 2022
1 parent 55854df commit 5264a14
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion SimG4CMS/Forward/interface/ForwardName.h
Expand Up @@ -7,6 +7,6 @@

namespace ForwardName {
std::string getName(const G4String &);
}; // namespace ForwardName
}; // namespace ForwardName

#endif
8 changes: 4 additions & 4 deletions SimG4CMS/Forward/src/ForwardName.cc
@@ -1,12 +1,12 @@
#include "SimG4CMS/Forward/interface/ForwardName.h"

std::string ForwardName::getName(const G4String & namx) {
std::string ForwardName::getName(const G4String& namx) {
std::string name = static_cast<std::string>(namx);
if (name.find(":") == std::string::npos) {
if (name.find(':') == std::string::npos) {
return name;
} else {
std::size_t first =name.find(":") + 1;
std::size_t last = name.rfind("_");
std::size_t first = name.find(':') + 1;
std::size_t last = name.rfind('_');
std::size_t length = (last != std::string::npos) ? (last - first) : (name.size() - first);
return name.substr(first, length);
}
Expand Down
4 changes: 2 additions & 2 deletions SimG4CMS/Forward/src/TotemT1Organization.cc
Expand Up @@ -62,9 +62,9 @@ uint32_t TotemT1Organization ::getUnitID(const G4Step* aStep) {
std::string dName = ForwardName::getName(physVol->GetName());
if (dName == "TotemT1") {
if (physVol->GetCopyNo() == 1)
_currentDetectorPosition = 1;
_currentDetectorPosition = 1;
else if (physVol->GetCopyNo() == 2)
_currentDetectorPosition = 2;
_currentDetectorPosition = 2;
}
}

Expand Down
2 changes: 1 addition & 1 deletion SimG4CMS/Forward/src/TotemT2OrganizationGem.cc
Expand Up @@ -47,7 +47,7 @@ uint32_t TotemT2OrganizationGem ::getUnitID(const G4Step* aStep) const {

physVol = touch->GetVolume(0);

std::string dName = ForwardName::getName(physVol->GetName());
std::string dName = ForwardName::getName(physVol->GetName());
if (dName == "TotemT2gem")
UNITA = 10 + physVol->GetCopyNo();
else if (dName == "TotemT2gem_supporto")
Expand Down

0 comments on commit 5264a14

Please sign in to comment.