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::CustomPhysicsList ( const std::string &  name,
const edm::ParameterSet p,
bool  useuni = false 
)

Definition at line 27 of file CustomPhysicsList.cc.

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

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

◆ ~CustomPhysicsList()

CustomPhysicsList::~CustomPhysicsList ( )
override

Definition at line 48 of file CustomPhysicsList.cc.

48 {}

Member Function Documentation

◆ ConstructParticle()

void CustomPhysicsList::ConstructParticle ( )
override

Definition at line 50 of file CustomPhysicsList.cc.

50  {
51  edm::LogVerbatim("SimG4CoreCustomPhysics") << "===== CustomPhysicsList::ConstructParticle ";
52  fParticleFactory.get()->loadCustomParticles(particleDefFilePath);
53 }

References fParticleFactory, and particleDefFilePath.

◆ ConstructProcess()

void CustomPhysicsList::ConstructProcess ( )
override

Definition at line 55 of file CustomPhysicsList.cc.

55  {
56  edm::LogVerbatim("SimG4CoreCustomPhysics") << "CustomPhysicsList: adding CustomPhysics processes "
57  << "for the list of particles";
58 
59  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
60 
61  for (auto particle : fParticleFactory.get()->GetCustomParticles()) {
62  if (particle->GetParticleType() == "simp") {
63  G4ProcessManager* pmanager = particle->GetProcessManager();
64  if (pmanager) {
66  CMSQGSPSIMPBuilder* theQGSPSIMPB = new CMSQGSPSIMPBuilder();
67  theQGSPSIMPB->Build(simpInelPr);
68  pmanager->AddDiscreteProcess(simpInelPr);
69  } else
70  edm::LogInfo("CustomPhysics") << " No pmanager";
71  }
72 
73  CustomParticle* cp = dynamic_cast<CustomParticle*>(particle);
74  if (cp) {
75  G4ProcessManager* pmanager = particle->GetProcessManager();
76  edm::LogVerbatim("SimG4CoreCustomPhysics")
77  << "CustomPhysicsList: " << particle->GetParticleName() << " PDGcode= " << particle->GetPDGEncoding()
78  << " Mass= " << particle->GetPDGMass() / GeV << " GeV.";
79  if (pmanager) {
80  if (particle->GetPDGCharge() != 0.0) {
81  ph->RegisterProcess(new G4hMultipleScattering, particle);
82  ph->RegisterProcess(new G4hIonisation, particle);
83  }
84  if (cp->GetCloud() && fHadronicInteraction && CustomPDGParser::s_isRHadron(particle->GetPDGEncoding())) {
85  edm::LogVerbatim("SimG4CoreCustomPhysics")
86  << "CustomPhysicsList: " << particle->GetParticleName()
87  << " CloudMass= " << cp->GetCloud()->GetPDGMass() / GeV
88  << " GeV; SpectatorMass= " << cp->GetSpectator()->GetPDGMass() / GeV << " GeV.";
89 
90  if (!myHelper.get()) {
91  myHelper = std::make_unique<G4ProcessHelper>(myConfig, fParticleFactory.get());
92  }
93  pmanager->AddDiscreteProcess(new FullModelHadronicProcess(myHelper.get()));
94  }
95  if (particle->GetParticleType() == "darkpho") {
97  pmanager->AddDiscreteProcess(darkGamma);
98  }
99  }
100  }
101  }
102 }

References CMSQGSPSIMPBuilder::Build(), CommonMethods::cp(), dfactor, fHadronicInteraction, fParticleFactory, GeV, myConfig, myHelper, and CustomPDGParser::s_isRHadron().

Member Data Documentation

◆ dfactor

double CustomPhysicsList::dfactor
private

Definition at line 30 of file CustomPhysicsList.h.

Referenced by ConstructProcess(), and CustomPhysicsList().

◆ fHadronicInteraction

bool CustomPhysicsList::fHadronicInteraction
private

Definition at line 24 of file CustomPhysicsList.h.

Referenced by ConstructProcess(), and CustomPhysicsList().

◆ fParticleFactory

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

Definition at line 22 of file CustomPhysicsList.h.

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

◆ myConfig

edm::ParameterSet CustomPhysicsList::myConfig
private

Definition at line 26 of file CustomPhysicsList.h.

Referenced by ConstructProcess(), and CustomPhysicsList().

◆ myHelper

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

Definition at line 21 of file CustomPhysicsList.h.

Referenced by ConstructProcess(), and CustomPhysicsList().

◆ particleDefFilePath

std::string CustomPhysicsList::particleDefFilePath
private

Definition at line 28 of file CustomPhysicsList.h.

Referenced by ConstructParticle(), and CustomPhysicsList().

◆ processDefFilePath

std::string CustomPhysicsList::processDefFilePath
private

Definition at line 29 of file CustomPhysicsList.h.

AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CustomPhysicsList::myHelper
static G4ThreadLocal std::unique_ptr< G4ProcessHelper > myHelper
Definition: CustomPhysicsList.h:21
CMSQGSPSIMPBuilder
Definition: CMSQGSPSIMPBuilder.h:16
CMSSIMPInelasticProcess
Definition: CMSSIMPInelasticProcess.h:8
personalPlayback.fp
fp
Definition: personalPlayback.py:523
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
CustomPhysicsList::myConfig
edm::ParameterSet myConfig
Definition: CustomPhysicsList.h:26
CustomPhysicsList::particleDefFilePath
std::string particleDefFilePath
Definition: CustomPhysicsList.h:28
edm::FileInPath
Definition: FileInPath.h:64
CustomPhysicsList::fHadronicInteraction
bool fHadronicInteraction
Definition: CustomPhysicsList.h:24
CustomPhysicsList::dfactor
double dfactor
Definition: CustomPhysicsList.h:30
GeV
const double GeV
Definition: MathUtil.h:16
FullModelHadronicProcess
Definition: FullModelHadronicProcess.h:16
CustomParticle
Definition: CustomParticle.h:11
CustomPDGParser::s_isRHadron
static bool s_isRHadron(int pdg)
Definition: CustomPDGParser.cc:10
CMSDarkPairProductionProcess
Definition: CMSDarkPairProductionProcess.h:20
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CommonMethods.cp
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
Definition: CommonMethods.py:192
CustomPhysicsList::fParticleFactory
std::unique_ptr< CustomParticleFactory > fParticleFactory
Definition: CustomPhysicsList.h:22
CMSQGSPSIMPBuilder::Build
void Build(CMSSIMPInelasticProcess *aP)
Definition: CMSQGSPSIMPBuilder.cc:26