CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  aParticleIterator->reset();
54  G4ParticleDefinition* particle;
55 
56  while((*aParticleIterator)()) {
57  particle = aParticleIterator->value();
59  CustomParticle* cp = dynamic_cast<CustomParticle*>(particle);
60  G4ProcessManager* pmanager = particle->GetProcessManager();
61  edm::LogInfo("SimG4CoreCustomPhysics")
62  <<"CustomPhysicsListSS: " << particle->GetParticleName()
63  <<" PDGcode= " << particle->GetPDGEncoding()
64  << " Mass= " << particle->GetPDGMass()/GeV <<" GeV.";
65  if(cp && pmanager) {
66  if(particle->GetPDGCharge() != 0.0) {
67  ph->RegisterProcess(new G4hMultipleScattering, particle);
68  ph->RegisterProcess(new G4hIonisation, particle);
69  }
70  if(fDecayProcess->IsApplicable(*particle)) {
71  ph->RegisterProcess(fDecayProcess, particle);
72  }
73  if(cp->GetCloud() && fHadronicInteraction &&
74  CustomPDGParser::s_isRHadron(particle->GetPDGEncoding())) {
75  edm::LogInfo("SimG4CoreCustomPhysics")
76  <<"CustomPhysicsListSS: " << particle->GetParticleName()
77  <<" CloudMass= " <<cp->GetCloud()->GetPDGMass()/GeV
78  <<" GeV; SpectatorMass= " << cp->GetSpectator()->GetPDGMass()/GeV <<" GeV.";
79 
80  if(!myHelper) { myHelper = new G4ProcessHelper(myConfig); }
81  pmanager->AddDiscreteProcess(new FullModelHadronicProcess(myHelper));
82  }
83  }
84  }
85  }
86 }
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 bool isCustomParticle(G4ParticleDefinition *particle)
std::string fullPath() const
Definition: FileInPath.cc:184
virtual void ConstructProcess()