From 71187dcab0d47eace89b059f4ebe7d7bc6d7563c Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Thu, 3 Oct 2024 22:10:02 +0200 Subject: [PATCH] code review --- .../CustomPhysics/src/CMSSQNeutronAnnih.cc | 17 +++++++---------- SimG4Core/Geometry/src/CMSG4CheckOverlap.cc | 7 ------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/SimG4Core/CustomPhysics/src/CMSSQNeutronAnnih.cc b/SimG4Core/CustomPhysics/src/CMSSQNeutronAnnih.cc index 880ee82ed3b3b..4c05c21753ab0 100644 --- a/SimG4Core/CustomPhysics/src/CMSSQNeutronAnnih.cc +++ b/SimG4Core/CustomPhysics/src/CMSSQNeutronAnnih.cc @@ -86,19 +86,16 @@ G4double CMSSQNeutronAnnih::momDistr(G4double x_in) { 1}; //now interpolate the above points for x_in - G4double result = 9999; + if (x_in <= 0.0) + return 0.; + if (x_in >= 1.0) + return CDF_k[n_entries - 1]; for (int i = 1; i < n_entries; i++) { - if (x[i] > x_in) { - result = (CDF_k[i] - CDF_k[i - 1]) / (x[i] - x[i - 1]) * (x_in - x[i - 1]) + CDF_k[i - 1]; - break; + if (x[i] >= x_in) { + return (CDF_k[i] - CDF_k[i - 1]) / (x[i] - x[i - 1]) * (x_in - x[i - 1]) + CDF_k[i - 1]; } } - //ROOT::Math::Interpolator inter(n_entries, ROOT::Math::Interpolation::kAKIMA); - //inter.SetData(n_entries,x,CDF_k); - //result = inter.Eval(x_in); - - return result; - //return 1; + return 0.0; } G4HadFinalState* CMSSQNeutronAnnih::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& targetNucleus) { diff --git a/SimG4Core/Geometry/src/CMSG4CheckOverlap.cc b/SimG4Core/Geometry/src/CMSG4CheckOverlap.cc index 68a2a9112ce4c..b7a8d8bafc2b3 100644 --- a/SimG4Core/Geometry/src/CMSG4CheckOverlap.cc +++ b/SimG4Core/Geometry/src/CMSG4CheckOverlap.cc @@ -237,13 +237,6 @@ void CMSG4CheckOverlap::makeReportForOverlaps(std::ofstream& fout, << "\n"; fout << "### Check overlaps for G4Region Node[" << ii << "] : " << nodeNames[ii] << "\n"; G4Region* reg = regStore->GetRegion((G4String)nodeNames[ii]); - if (!reg) { - fout << "### NO G4Region found - EXIT" - << "\n"; - if (gdml) - delete gdml; - return; - } std::vector::iterator rootLVItr = reg->GetRootLogicalVolumeIterator(); unsigned int numRootLV = reg->GetNumberOfRootVolumes(); fout << " " << numRootLV << " Root Logical Volumes in this region"