CMS 3D CMS Logo

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

#include <CustomPhysicsList.h>

Inheritance diagram for CustomPhysicsList:

Public Member Functions

void ConstructParticle () override
 
void ConstructProcess () override
 
 CustomPhysicsList (const std::string &name, const edm::ParameterSet &p, bool useuni=false)
 
 ~CustomPhysicsList () 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 12 of file CustomPhysicsList.h.

Constructor & Destructor Documentation

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

Definition at line 23 of file CustomPhysicsList.cc.

References dfactor, fHadronicInteraction, fParticleFactory, edm::ParameterSet::getParameter(), myConfig, myHelper, AlCaHLTBitMon_ParallelJobs::p, and particleDefFilePath.

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

Definition at line 44 of file CustomPhysicsList.cc.

44 {}

Member Function Documentation

void CustomPhysicsList::ConstructParticle ( )
override

Definition at line 46 of file CustomPhysicsList.cc.

References fParticleFactory, and particleDefFilePath.

46  {
47  edm::LogVerbatim("SimG4CoreCustomPhysics") << "===== CustomPhysicsList::ConstructParticle ";
48  fParticleFactory.get()->loadCustomParticles(particleDefFilePath);
49 }
std::string particleDefFilePath
std::unique_ptr< CustomParticleFactory > fParticleFactory
void CustomPhysicsList::ConstructProcess ( )
override

Definition at line 51 of file CustomPhysicsList.cc.

References SimDataFormats::CaloAnalysis::cp, dfactor, fHadronicInteraction, fParticleFactory, CustomParticle::GetCloud(), CustomParticle::GetSpectator(), GeV, myConfig, myHelper, CustomPDGParser::s_isgluinoHadron(), CustomPDGParser::s_issbottomHadron(), and CustomPDGParser::s_isstopHadron().

51  {
52  edm::LogVerbatim("SimG4CoreCustomPhysics") << "CustomPhysicsList: adding CustomPhysics processes "
53  << "for the list of particles";
54 
55  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
56 
57  for (auto particle : fParticleFactory.get()->GetCustomParticles()) {
58  CustomParticle* cp = dynamic_cast<CustomParticle*>(particle);
59  if (cp) {
60  G4ProcessManager* pmanager = particle->GetProcessManager();
61  edm::LogVerbatim("SimG4CoreCustomPhysics")
62  << "CustomPhysicsList: " << particle->GetParticleName() << " PDGcode= " << particle->GetPDGEncoding()
63  << " Mass= " << particle->GetPDGMass() / GeV << " GeV.";
64  if (pmanager) {
65  if (particle->GetPDGCharge() != 0.0) {
66  ph->RegisterProcess(new G4hMultipleScattering, particle);
67  ph->RegisterProcess(new G4hIonisation, particle);
68  }
69  if (cp->GetCloud() && fHadronicInteraction &&
70  (CustomPDGParser::s_isgluinoHadron(particle->GetPDGEncoding()) ||
71  (CustomPDGParser::s_isstopHadron(particle->GetPDGEncoding())) ||
72  (CustomPDGParser::s_issbottomHadron(particle->GetPDGEncoding())))) {
73  edm::LogVerbatim("SimG4CoreCustomPhysics")
74  << "CustomPhysicsList: " << particle->GetParticleName()
75  << " CloudMass= " << cp->GetCloud()->GetPDGMass() / GeV
76  << " GeV; SpectatorMass= " << cp->GetSpectator()->GetPDGMass() / GeV << " GeV.";
77 
78  if (!myHelper.get()) {
80  }
81  pmanager->AddDiscreteProcess(new FullModelHadronicProcess(myHelper.get()));
82  }
83  if (particle->GetParticleType() == "darkpho") {
85  pmanager->AddDiscreteProcess(darkGamma);
86  }
87  }
88  }
89  }
90 }
const double GeV
Definition: MathUtil.h:16
static bool s_isgluinoHadron(int pdg)
edm::ParameterSet myConfig
G4ParticleDefinition * GetCloud()
static G4ThreadLocal std::unique_ptr< G4ProcessHelper > myHelper
G4ParticleDefinition * GetSpectator()
std::unique_ptr< CustomParticleFactory > fParticleFactory
static bool s_issbottomHadron(int pdg)
static bool s_isstopHadron(int pdg)

Member Data Documentation

double CustomPhysicsList::dfactor
private

Definition at line 30 of file CustomPhysicsList.h.

Referenced by ConstructProcess(), and CustomPhysicsList().

bool CustomPhysicsList::fHadronicInteraction
private

Definition at line 24 of file CustomPhysicsList.h.

Referenced by ConstructProcess(), and CustomPhysicsList().

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

Definition at line 22 of file CustomPhysicsList.h.

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

edm::ParameterSet CustomPhysicsList::myConfig
private

Definition at line 26 of file CustomPhysicsList.h.

Referenced by ConstructProcess(), and CustomPhysicsList().

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

Definition at line 21 of file CustomPhysicsList.h.

Referenced by ConstructProcess(), and CustomPhysicsList().

std::string CustomPhysicsList::particleDefFilePath
private

Definition at line 28 of file CustomPhysicsList.h.

Referenced by ConstructParticle(), and CustomPhysicsList().

std::string CustomPhysicsList::processDefFilePath
private

Definition at line 29 of file CustomPhysicsList.h.