Skip to content

Commit

Permalink
more clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
civanch committed Jan 21, 2022
1 parent f493738 commit a4ef2e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
12 changes: 5 additions & 7 deletions SimG4Core/Notification/src/GenParticleInfoExtractor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ const GenParticleInfo &GenParticleInfoExtractor::operator()(const G4PrimaryParti
"mc001",
FatalException,
"GenParticleInfoExtractor: G4PrimaryParticle has no user information");
} else {
GenParticleInfo *gpi = dynamic_cast<GenParticleInfo *>(up);
if (gpi == nullptr)
G4Exception("SimG4Core/Notification",
"mc001",
FatalException,
"GenParticleInfoExtractor: user information in G4PrimaryParticle is not of GenParticleInfo type");
} else if (gpi == nullptr) {
G4Exception("SimG4Core/Notification",
"mc001",
FatalException,
"GenParticleInfoExtractor: user information in G4PrimaryParticle is not of GenParticleInfo type");
}
return *gpi;
}
10 changes: 4 additions & 6 deletions SimG4Core/Notification/src/TrackInformationExtractor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ const TrackInformation &TrackInformationExtractor::operator()(const G4Track &gtk
const TrackInformation *tkInfo = dynamic_cast<const TrackInformation *>(gui);
if (gui == nullptr) {
missing(gtk);
} else {
if (tkInfo == nullptr)
wrongType();
} else if (tkInfo == nullptr) {
wrongType();
}
return *tkInfo;
}
Expand All @@ -19,9 +18,8 @@ TrackInformation &TrackInformationExtractor::operator()(G4Track &gtk) const {
TrackInformation *tkInfo = dynamic_cast<TrackInformation *>(gui);
if (gui == nullptr) {
missing(gtk);
} else {
if (tkInfo == nullptr)
wrongType();
} else if (tkInfo == nullptr) {
wrongType();
}
return *tkInfo;
}
Expand Down

0 comments on commit a4ef2e9

Please sign in to comment.