Skip to content

Commit

Permalink
Merge pull request #27204 from civanch/removed_double_counting
Browse files Browse the repository at this point in the history
Bug fix in the alternative Geant4 physics list for exotic particles
  • Loading branch information
cmsbuild committed Jun 17, 2019
2 parents b03bd66 + be8993b commit 6705704
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
2 changes: 0 additions & 2 deletions SimG4Core/CustomPhysics/interface/CustomPhysicsListSS.h
Expand Up @@ -6,7 +6,6 @@
#include <string>

class G4ProcessHelper;
class G4Decay;
class CustomParticleFactory;

class CustomPhysicsListSS : public G4VPhysicsConstructor {
Expand All @@ -18,7 +17,6 @@ class CustomPhysicsListSS : public G4VPhysicsConstructor {
void ConstructProcess() override;

private:
static G4ThreadLocal std::unique_ptr<G4Decay> fDecayProcess;
static G4ThreadLocal std::unique_ptr<G4ProcessHelper> myHelper;

std::unique_ptr<CustomParticleFactory> fParticleFactory;
Expand Down
9 changes: 1 addition & 8 deletions SimG4Core/CustomPhysics/src/CustomPhysicsListSS.cc
Expand Up @@ -9,7 +9,6 @@
#include "FWCore/ParameterSet/interface/FileInPath.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "G4Decay.hh"
#include "G4hMultipleScattering.hh"
#include "G4hIonisation.hh"
#include "G4CoulombScattering.hh"
Expand All @@ -20,7 +19,6 @@

using namespace CLHEP;

G4ThreadLocal std::unique_ptr<G4Decay> CustomPhysicsListSS::fDecayProcess;
G4ThreadLocal std::unique_ptr<G4ProcessHelper> CustomPhysicsListSS::myHelper;

CustomPhysicsListSS::CustomPhysicsListSS(const std::string& name, const edm::ParameterSet& p, bool apinew)
Expand All @@ -37,7 +35,6 @@ CustomPhysicsListSS::CustomPhysicsListSS(const std::string& name, const edm::Par
edm::FileInPath fp = p.getParameter<edm::FileInPath>("particlesDef");
particleDefFilePath = fp.fullPath();
fParticleFactory.reset(new CustomParticleFactory());
fDecayProcess.reset(nullptr);
myHelper.reset(nullptr);

edm::LogVerbatim("SimG4CoreCustomPhysics") << "CustomPhysicsListSS: Path for custom particle definition file: \n"
Expand All @@ -54,7 +51,6 @@ void CustomPhysicsListSS::ConstructParticle() {
void CustomPhysicsListSS::ConstructProcess() {
edm::LogVerbatim("SimG4CoreCustomPhysicsSS") << "CustomPhysicsListSS: adding CustomPhysics processes";

fDecayProcess.reset(new G4Decay());
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();

for (auto particle : fParticleFactory.get()->GetCustomParticles()) {
Expand All @@ -66,12 +62,9 @@ void CustomPhysicsListSS::ConstructProcess() {
<< " Mass= " << particle->GetPDGMass() / GeV << " GeV.";
if (pmanager) {
if (particle->GetPDGCharge() != 0.0) {
ph->RegisterProcess(new G4hMultipleScattering, particle);
ph->RegisterProcess(new G4CoulombScattering, particle);
ph->RegisterProcess(new G4hIonisation, particle);
}
if (fDecayProcess.get()->IsApplicable(*particle)) {
ph->RegisterProcess(fDecayProcess.get(), particle);
}
if (cp->GetCloud() && fHadronicInteraction && CustomPDGParser::s_isRHadron(particle->GetPDGEncoding())) {
edm::LogVerbatim("SimG4CoreCustomPhysics")
<< "CustomPhysicsListSS: " << particle->GetParticleName()
Expand Down

0 comments on commit 6705704

Please sign in to comment.