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)
 
 ~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 
)

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 {
26  myConfig = p;
27  dfactor = p.getParameter<double>("dark_factor");
28  edm::FileInPath fp = p.getParameter<edm::FileInPath>("particlesDef");
29  fHadronicInteraction = p.getParameter<bool>("rhadronPhysics");
30  particleDefFilePath = fp.fullPath();
32  myHelper.reset(nullptr);
33 
34  edm::LogInfo("SimG4CoreCustomPhysics")
35  << "CustomPhysicsList: Path for custom particle definition file: \n"
36  <<particleDefFilePath << "\n" << " dark_factor= " << dfactor;
37 }
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 39 of file CustomPhysicsList.cc.

39  {
40 }

Member Function Documentation

void CustomPhysicsList::ConstructParticle ( )
override

Definition at line 42 of file CustomPhysicsList.cc.

References fParticleFactory, and particleDefFilePath.

42  {
43  edm::LogInfo("SimG4CoreCustomPhysics")
44  << "===== CustomPhysicsList::ConstructParticle ";
45  fParticleFactory.get()->loadCustomParticles(particleDefFilePath);
46 }
std::string particleDefFilePath
std::unique_ptr< CustomParticleFactory > fParticleFactory
void CustomPhysicsList::ConstructProcess ( )
override

Definition at line 48 of file CustomPhysicsList.cc.

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

48  {
49 
50  edm::LogInfo("SimG4CoreCustomPhysics")
51  <<"CustomPhysicsList: adding CustomPhysics processes "
52  << "for the list of particles";
53 
54  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
55 
56  for(auto particle : fParticleFactory.get()->GetCustomParticles()) {
57  CustomParticle* cp = dynamic_cast<CustomParticle*>(particle);
58  if(cp) {
59  G4ProcessManager* pmanager = particle->GetProcessManager();
60  edm::LogInfo("SimG4CoreCustomPhysics")
61  <<"CustomPhysicsList: " << particle->GetParticleName()
62  <<" 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_isRHadron(particle->GetPDGEncoding())) {
71  edm::LogInfo("SimG4CoreCustomPhysics")
72  <<"CustomPhysicsList: " << particle->GetParticleName()
73  <<" CloudMass= " <<cp->GetCloud()->GetPDGMass()/GeV
74  <<" GeV; SpectatorMass= " << cp->GetSpectator()->GetPDGMass()/GeV<<" GeV.";
75 
76  if(!myHelper.get()) { myHelper.reset(new G4ProcessHelper(myConfig, fParticleFactory.get())); }
77  pmanager->AddDiscreteProcess(new FullModelHadronicProcess(myHelper.get()));
78  }
79  if(particle->GetParticleType()=="darkpho"){
80  CMSDarkPairProductionProcess * darkGamma = new CMSDarkPairProductionProcess(dfactor);
81  pmanager->AddDiscreteProcess(darkGamma);
82  }
83  }
84  }
85  }
86 }
const double GeV
Definition: MathUtil.h:16
edm::ParameterSet myConfig
G4ParticleDefinition * GetCloud()
static G4ThreadLocal std::unique_ptr< G4ProcessHelper > myHelper
G4ParticleDefinition * GetSpectator()
static bool s_isRHadron(int pdg)
std::unique_ptr< CustomParticleFactory > fParticleFactory

Member Data Documentation

double CustomPhysicsList::dfactor
private

Definition at line 32 of file CustomPhysicsList.h.

Referenced by ConstructProcess(), and CustomPhysicsList().

bool CustomPhysicsList::fHadronicInteraction
private

Definition at line 26 of file CustomPhysicsList.h.

Referenced by ConstructProcess(), and CustomPhysicsList().

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

Definition at line 24 of file CustomPhysicsList.h.

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

edm::ParameterSet CustomPhysicsList::myConfig
private

Definition at line 28 of file CustomPhysicsList.h.

Referenced by ConstructProcess(), and CustomPhysicsList().

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

Definition at line 23 of file CustomPhysicsList.h.

Referenced by ConstructProcess(), and CustomPhysicsList().

std::string CustomPhysicsList::particleDefFilePath
private

Definition at line 30 of file CustomPhysicsList.h.

Referenced by ConstructParticle(), and CustomPhysicsList().

std::string CustomPhysicsList::processDefFilePath
private

Definition at line 31 of file CustomPhysicsList.h.