CMS 3D CMS Logo

CustomPhysicsListSS.cc
Go to the documentation of this file.
4 #include "SimG4Core/CustomPhysics/interface/G4ProcessHelper.hh"
6 
10 
11 #include "G4Decay.hh"
12 #include "G4hMultipleScattering.hh"
13 #include "G4hIonisation.hh"
14 #include "G4CoulombScattering.hh"
15 #include "G4ProcessManager.hh"
16 
17 #include "SimG4Core/CustomPhysics/interface/FullModelHadronicProcess.hh"
18 #include "SimG4Core/CustomPhysics/interface/ToyModelHadronicProcess.hh"
19 
20 using namespace CLHEP;
21 
22 G4ThreadLocal G4Decay* CustomPhysicsListSS::fDecayProcess = nullptr;
23 G4ThreadLocal G4ProcessHelper* CustomPhysicsListSS::myHelper = nullptr;
24 
26  : G4VPhysicsConstructor(name)
27 {
28  myConfig = p;
29  edm::FileInPath fp = p.getParameter<edm::FileInPath>("particlesDef");
30  fHadronicInteraction = p.getParameter<bool>("rhadronPhysics");
32  edm::LogInfo("SimG4CoreCustomPhysics")
33  <<"CustomPhysicsListSS: Path for custom particle definition file: \n"
35  myHelper = 0;
36 }
37 
39 }
40 
43 }
44 
46 
47  edm::LogInfo("SimG4CoreCustomPhysics")
48  <<"CustomPhysicsListSS: adding CustomPhysics processes";
49 
50  fDecayProcess = new G4Decay();
51  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
52 
53  for(auto particle : CustomParticleFactory::GetCustomParticles()) {
54 
55  CustomParticle* cp = dynamic_cast<CustomParticle*>(particle);
56  if(cp) {
57  G4ProcessManager* pmanager = particle->GetProcessManager();
58  edm::LogInfo("SimG4CoreCustomPhysics")
59  <<"CustomPhysicsListSS: " << particle->GetParticleName()
60  <<" PDGcode= " << particle->GetPDGEncoding()
61  << " Mass= " << particle->GetPDGMass()/GeV <<" GeV.";
62  if(pmanager) {
63  if(particle->GetPDGCharge() != 0.0) {
64  ph->RegisterProcess(new G4hMultipleScattering, particle);
65  ph->RegisterProcess(new G4hIonisation, particle);
66  }
67  if(fDecayProcess->IsApplicable(*particle)) {
68  ph->RegisterProcess(fDecayProcess, particle);
69  }
70  if(cp->GetCloud() && fHadronicInteraction &&
71  CustomPDGParser::s_isRHadron(particle->GetPDGEncoding())) {
72  edm::LogInfo("SimG4CoreCustomPhysics")
73  <<"CustomPhysicsListSS: " << particle->GetParticleName()
74  <<" CloudMass= " <<cp->GetCloud()->GetPDGMass()/GeV
75  <<" GeV; SpectatorMass= " << cp->GetSpectator()->GetPDGMass()/GeV <<" GeV.";
76 
77  if(!myHelper) { myHelper = new G4ProcessHelper(myConfig); }
78  pmanager->AddDiscreteProcess(new FullModelHadronicProcess(myHelper));
79  }
80  }
81  }
82  }
83 }
std::string particleDefFilePath
T getParameter(std::string const &) const
const double GeV
Definition: MathUtil.h:16
G4ParticleDefinition * GetCloud()
virtual void ConstructParticle()
CustomPhysicsListSS(std::string name, const edm::ParameterSet &p)
static G4ThreadLocal G4ProcessHelper * myHelper
static void loadCustomParticles(const std::string &filePath)
static G4ThreadLocal G4Decay * fDecayProcess
G4ParticleDefinition * GetSpectator()
edm::ParameterSet myConfig
static bool s_isRHadron(int pdg)
static const std::vector< G4ParticleDefinition * > & GetCustomParticles()
std::string fullPath() const
Definition: FileInPath.cc:184
virtual void ConstructProcess()