CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
CustomPhysicsListSS Class Reference

#include <CustomPhysicsListSS.h>

Inheritance diagram for CustomPhysicsListSS:

Public Member Functions

void ConstructParticle () override
 
void ConstructProcess () override
 
 CustomPhysicsListSS (const std::string &name, const edm::ParameterSet &p, bool useuni=false)
 
 ~CustomPhysicsListSS () override
 

Private Attributes

double dfactor
 
bool fHadronicInteraction
 
std::unique_ptr< CustomParticleFactoryfParticleFactory
 
edm::ParameterSet myConfig
 
std::string particleDefFilePath
 
std::string processDefFilePath
 

Static Private Attributes

static G4ThreadLocal std::unique_ptr< G4ProcessHelpermyHelper
 

Detailed Description

Definition at line 11 of file CustomPhysicsListSS.h.

Constructor & Destructor Documentation

◆ CustomPhysicsListSS()

CustomPhysicsListSS::CustomPhysicsListSS ( const std::string &  name,
const edm::ParameterSet p,
bool  useuni = false 
)

Definition at line 26 of file CustomPhysicsListSS.cc.

References dfactor, fHadronicInteraction, personalPlayback::fp, fParticleFactory, myConfig, myHelper, AlCaHLTBitMon_ParallelJobs::p, and particleDefFilePath.

27  : G4VPhysicsConstructor(name) {
28  myConfig = p;
29  if (apinew) {
30  dfactor = p.getParameter<double>("DarkMPFactor");
31  fHadronicInteraction = p.getParameter<bool>("RhadronPhysics");
32  } else {
33  // this is left for backward compatibility
34  dfactor = p.getParameter<double>("dark_factor");
35  fHadronicInteraction = p.getParameter<bool>("rhadronPhysics");
36  }
37  edm::FileInPath fp = p.getParameter<edm::FileInPath>("particlesDef");
38  particleDefFilePath = fp.fullPath();
39  fParticleFactory = std::make_unique<CustomParticleFactory>();
40  myHelper.reset(nullptr);
41 
42  edm::LogVerbatim("SimG4CoreCustomPhysics") << "CustomPhysicsListSS: Path for custom particle definition file: \n"
44 }
std::string particleDefFilePath
Log< level::Info, true > LogVerbatim
std::unique_ptr< CustomParticleFactory > fParticleFactory
static G4ThreadLocal std::unique_ptr< G4ProcessHelper > myHelper
edm::ParameterSet myConfig

◆ ~CustomPhysicsListSS()

CustomPhysicsListSS::~CustomPhysicsListSS ( )
override

Definition at line 46 of file CustomPhysicsListSS.cc.

46 {}

Member Function Documentation

◆ ConstructParticle()

void CustomPhysicsListSS::ConstructParticle ( )
override

Definition at line 48 of file CustomPhysicsListSS.cc.

References fParticleFactory, and particleDefFilePath.

48  {
49  edm::LogVerbatim("SimG4CoreCustomPhysicsSS") << "===== CustomPhysicsList::ConstructParticle ";
50  fParticleFactory.get()->loadCustomParticles(particleDefFilePath);
51 }
std::string particleDefFilePath
Log< level::Info, true > LogVerbatim
std::unique_ptr< CustomParticleFactory > fParticleFactory

◆ ConstructProcess()

void CustomPhysicsListSS::ConstructProcess ( )
override

Definition at line 53 of file CustomPhysicsListSS.cc.

References dfactor, fHadronicInteraction, fParticleFactory, myConfig, myHelper, CustomPDGParser::s_isgluinoHadron(), CustomPDGParser::s_issbottomHadron(), and CustomPDGParser::s_isstopHadron().

53  {
54  edm::LogVerbatim("SimG4CoreCustomPhysicsSS") << "CustomPhysicsListSS: adding CustomPhysics processes";
55 
56  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
57 
58  for (auto particle : fParticleFactory.get()->getCustomParticles()) {
59  CustomParticle* cp = dynamic_cast<CustomParticle*>(particle);
60  if (cp) {
61  G4ProcessManager* pmanager = particle->GetProcessManager();
62  edm::LogVerbatim("SimG4CoreCustomPhysics")
63  << "CustomPhysicsListSS: " << particle->GetParticleName() << " PDGcode= " << particle->GetPDGEncoding()
64  << " Mass= " << particle->GetPDGMass() / GeV << " GeV.";
65  if (pmanager) {
66  if (particle->GetPDGCharge() != 0.0) {
67  ph->RegisterProcess(new G4CoulombScattering, particle);
68  ph->RegisterProcess(new G4hIonisation, particle);
69  }
70  if (cp->GetCloud() && fHadronicInteraction &&
71  (CustomPDGParser::s_isgluinoHadron(particle->GetPDGEncoding()) ||
72  (CustomPDGParser::s_isstopHadron(particle->GetPDGEncoding())) ||
73  (CustomPDGParser::s_issbottomHadron(particle->GetPDGEncoding())))) {
74  edm::LogVerbatim("SimG4CoreCustomPhysics")
75  << "CustomPhysicsListSS: " << particle->GetParticleName()
76  << " CloudMass= " << cp->GetCloud()->GetPDGMass() / GeV
77  << " GeV; SpectatorMass= " << cp->GetSpectator()->GetPDGMass() / GeV << " GeV.";
78 
79  if (!myHelper.get()) {
80  myHelper = std::make_unique<G4ProcessHelper>(myConfig, fParticleFactory.get());
81  }
82  pmanager->AddDiscreteProcess(new FullModelHadronicProcess(myHelper.get()));
83  }
84  if (particle->GetParticleType() == "darkpho") {
86  pmanager->AddDiscreteProcess(darkGamma);
87  }
88  }
89  }
90  }
91 }
Log< level::Info, true > LogVerbatim
std::unique_ptr< CustomParticleFactory > fParticleFactory
static bool s_isgluinoHadron(int pdg)
static G4ThreadLocal std::unique_ptr< G4ProcessHelper > myHelper
edm::ParameterSet myConfig
static bool s_issbottomHadron(int pdg)
static bool s_isstopHadron(int pdg)

Member Data Documentation

◆ dfactor

double CustomPhysicsListSS::dfactor
private

Definition at line 30 of file CustomPhysicsListSS.h.

Referenced by ConstructProcess(), and CustomPhysicsListSS().

◆ fHadronicInteraction

bool CustomPhysicsListSS::fHadronicInteraction
private

Definition at line 24 of file CustomPhysicsListSS.h.

Referenced by ConstructProcess(), and CustomPhysicsListSS().

◆ fParticleFactory

std::unique_ptr<CustomParticleFactory> CustomPhysicsListSS::fParticleFactory
private

Definition at line 22 of file CustomPhysicsListSS.h.

Referenced by ConstructParticle(), ConstructProcess(), and CustomPhysicsListSS().

◆ myConfig

edm::ParameterSet CustomPhysicsListSS::myConfig
private

Definition at line 26 of file CustomPhysicsListSS.h.

Referenced by ConstructProcess(), and CustomPhysicsListSS().

◆ myHelper

G4ThreadLocal std::unique_ptr< G4ProcessHelper > CustomPhysicsListSS::myHelper
staticprivate

Definition at line 20 of file CustomPhysicsListSS.h.

Referenced by ConstructProcess(), and CustomPhysicsListSS().

◆ particleDefFilePath

std::string CustomPhysicsListSS::particleDefFilePath
private

Definition at line 28 of file CustomPhysicsListSS.h.

Referenced by ConstructParticle(), and CustomPhysicsListSS().

◆ processDefFilePath

std::string CustomPhysicsListSS::processDefFilePath
private

Definition at line 29 of file CustomPhysicsListSS.h.