diff --git a/Alignment/LaserAlignmentSimulation/src/LaserOpticalPhysicsList.cc b/Alignment/LaserAlignmentSimulation/src/LaserOpticalPhysicsList.cc index d84a8ba8f0609..4ad7ded0e18a4 100644 --- a/Alignment/LaserAlignmentSimulation/src/LaserOpticalPhysicsList.cc +++ b/Alignment/LaserAlignmentSimulation/src/LaserOpticalPhysicsList.cc @@ -93,7 +93,6 @@ void LaserOpticalPhysicsList::ConstructProcess() { pManager->AddDiscreteProcess(theBoundaryProcess); pManager->AddDiscreteProcess(theWLSProcess); - theScintProcess->SetScintillationYieldFactor(1.); theScintProcess->SetTrackSecondariesFirst(true); G4ParticleTable *table = G4ParticleTable::GetParticleTable(); diff --git a/SimG4Core/Notification/src/GenParticleInfoExtractor.cc b/SimG4Core/Notification/src/GenParticleInfoExtractor.cc index fee005bfd4bab..0546198f3f35c 100644 --- a/SimG4Core/Notification/src/GenParticleInfoExtractor.cc +++ b/SimG4Core/Notification/src/GenParticleInfoExtractor.cc @@ -3,16 +3,17 @@ const GenParticleInfo &GenParticleInfoExtractor::operator()(const G4PrimaryParticle *p) const { G4VUserPrimaryParticleInformation *up = p->GetUserInformation(); - if (up == nullptr) + GenParticleInfo *gpi = dynamic_cast(up); + if (up == nullptr) { G4Exception("SimG4Core/Notification", "mc001", FatalException, "GenParticleInfoExtractor: G4PrimaryParticle has no user information"); - GenParticleInfo *gpi = dynamic_cast(up); - if (gpi == nullptr) + } else if (gpi == nullptr) { G4Exception("SimG4Core/Notification", "mc001", FatalException, "GenParticleInfoExtractor: user information in G4PrimaryParticle is not of GenParticleInfo type"); + } return *gpi; } diff --git a/SimG4Core/Notification/src/NewTrackAction.cc b/SimG4Core/Notification/src/NewTrackAction.cc index 7cf90f9de1251..e6ed0dc397dcd 100644 --- a/SimG4Core/Notification/src/NewTrackAction.cc +++ b/SimG4Core/Notification/src/NewTrackAction.cc @@ -6,8 +6,6 @@ #include "G4Track.hh" -//#define DebugLog - NewTrackAction::NewTrackAction() {} void NewTrackAction::primary(const G4Track *aTrack) const { primary(const_cast(aTrack)); } @@ -19,18 +17,18 @@ void NewTrackAction::secondary(const G4Track *aSecondary, const G4Track &mother, } void NewTrackAction::secondary(G4Track *aSecondary, const G4Track &mother, int flag) const { - if (aSecondary->GetParentID() != mother.GetTrackID()) + if (aSecondary->GetParentID() != mother.GetTrackID()) { G4Exception("SimG4Core/Notification", "mc001", FatalException, "NewTrackAction: secondary parent ID does not match mother id"); - TrackInformationExtractor extractor; - const TrackInformation &motherInfo(extractor(mother)); - addUserInfoToSecondary(aSecondary, motherInfo, flag); -#ifdef DebugLog - LogDebug("SimTrackManager") << "NewTrackAction: Add track " << aSecondary->GetTrackID() << " from mother " - << mother.GetTrackID(); -#endif + } else { + TrackInformationExtractor extractor; + const TrackInformation &motherInfo(extractor(mother)); + addUserInfoToSecondary(aSecondary, motherInfo, flag); + LogDebug("SimTrackManager") << "NewTrackAction: Add track " << aSecondary->GetTrackID() << " from mother " + << mother.GetTrackID(); + } } void NewTrackAction::addUserInfoToPrimary(G4Track *aTrack) const { @@ -44,13 +42,9 @@ void NewTrackAction::addUserInfoToPrimary(G4Track *aTrack) const { } void NewTrackAction::addUserInfoToSecondary(G4Track *aTrack, const TrackInformation &motherInfo, int flag) const { - // ralf.ulrich@kit.edu: it is more efficient to use the constructor to copy all data and modify later only when needed - TrackInformation *trkInfo = new TrackInformation(); - // LogDebug("SimG4CoreApplication") << "NewTrackAction called for " - // << aTrack->GetTrackID() - // << " mother " << motherInfo.isPrimary() - // << " flag " << flag; + LogDebug("SimG4CoreApplication") << "NewTrackAction called for " << aTrack->GetTrackID() << " mother " + << motherInfo.isPrimary() << " flag " << flag; // Take care of cascade decays if (flag == 1) { diff --git a/SimG4Core/Notification/src/TrackInformationExtractor.cc b/SimG4Core/Notification/src/TrackInformationExtractor.cc index 894399666ff88..b19e024bdc644 100644 --- a/SimG4Core/Notification/src/TrackInformationExtractor.cc +++ b/SimG4Core/Notification/src/TrackInformationExtractor.cc @@ -4,21 +4,23 @@ const TrackInformation &TrackInformationExtractor::operator()(const G4Track >k) const { G4VUserTrackInformation *gui = gtk.GetUserInformation(); - if (gui == nullptr) - missing(gtk); const TrackInformation *tkInfo = dynamic_cast(gui); - if (tkInfo == nullptr) + if (gui == nullptr) { + missing(gtk); + } else if (tkInfo == nullptr) { wrongType(); + } return *tkInfo; } TrackInformation &TrackInformationExtractor::operator()(G4Track >k) const { G4VUserTrackInformation *gui = gtk.GetUserInformation(); - if (gui == nullptr) - missing(gtk); TrackInformation *tkInfo = dynamic_cast(gui); - if (tkInfo == nullptr) + if (gui == nullptr) { + missing(gtk); + } else if (tkInfo == nullptr) { wrongType(); + } return *tkInfo; }