CMS 3D CMS Logo

CustomPhysicsListSS.cc
Go to the documentation of this file.
7 
11 
12 #include "G4hMultipleScattering.hh"
13 #include "G4hIonisation.hh"
14 #include "G4CoulombScattering.hh"
15 #include "G4ProcessManager.hh"
16 
19 
20 using namespace CLHEP;
21 
22 G4ThreadLocal std::unique_ptr<G4ProcessHelper> CustomPhysicsListSS::myHelper;
23 
25  : G4VPhysicsConstructor(name) {
26  myConfig = p;
27  if (apinew) {
28  dfactor = p.getParameter<double>("DarkMPFactor");
29  fHadronicInteraction = p.getParameter<bool>("RhadronPhysics");
30  } else {
31  // this is left for backward compatibility
32  dfactor = p.getParameter<double>("dark_factor");
33  fHadronicInteraction = p.getParameter<bool>("rhadronPhysics");
34  }
35  edm::FileInPath fp = p.getParameter<edm::FileInPath>("particlesDef");
36  particleDefFilePath = fp.fullPath();
38  myHelper.reset(nullptr);
39 
40  edm::LogVerbatim("SimG4CoreCustomPhysics") << "CustomPhysicsListSS: Path for custom particle definition file: \n"
42 }
43 
45 
47  edm::LogVerbatim("SimG4CoreCustomPhysicsSS") << "===== CustomPhysicsList::ConstructParticle ";
48  fParticleFactory.get()->loadCustomParticles(particleDefFilePath);
49 }
50 
52  edm::LogVerbatim("SimG4CoreCustomPhysicsSS") << "CustomPhysicsListSS: adding CustomPhysics processes";
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::LogVerbatim("SimG4CoreCustomPhysics")
61  << "CustomPhysicsListSS: " << particle->GetParticleName() << " PDGcode= " << particle->GetPDGEncoding()
62  << " Mass= " << particle->GetPDGMass() / GeV << " GeV.";
63  if (pmanager) {
64  if (particle->GetPDGCharge() != 0.0) {
65  ph->RegisterProcess(new G4CoulombScattering, particle);
66  ph->RegisterProcess(new G4hIonisation, particle);
67  }
68  if (cp->GetCloud() && fHadronicInteraction && CustomPDGParser::s_isRHadron(particle->GetPDGEncoding())) {
69  edm::LogVerbatim("SimG4CoreCustomPhysics")
70  << "CustomPhysicsListSS: " << particle->GetParticleName()
71  << " CloudMass= " << cp->GetCloud()->GetPDGMass() / GeV
72  << " GeV; SpectatorMass= " << cp->GetSpectator()->GetPDGMass() / GeV << " GeV.";
73 
74  if (!myHelper.get()) {
76  }
77  pmanager->AddDiscreteProcess(new FullModelHadronicProcess(myHelper.get()));
78  }
79  if (particle->GetParticleType() == "darkpho") {
81  pmanager->AddDiscreteProcess(darkGamma);
82  }
83  }
84  }
85  }
86 }
G4ProcessHelper.h
MessageLogger.h
G4ProcessHelper
Definition: G4ProcessHelper.h:26
DummyChargeFlipProcess.h
FullModelHadronicProcess.h
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
personalPlayback.fp
fp
Definition: personalPlayback.py:523
CustomPhysicsListSS::ConstructProcess
void ConstructProcess() override
Definition: CustomPhysicsListSS.cc:51
CustomPhysicsListSS.h
FileInPath.h
edm::FileInPath
Definition: FileInPath.h:64
CustomPhysicsListSS::myHelper
static G4ThreadLocal std::unique_ptr< G4ProcessHelper > myHelper
Definition: CustomPhysicsListSS.h:20
CustomPhysicsListSS::myConfig
edm::ParameterSet myConfig
Definition: CustomPhysicsListSS.h:26
CustomPDGParser.h
CMSDarkPairProductionProcess.h
CustomPhysicsListSS::particleDefFilePath
std::string particleDefFilePath
Definition: CustomPhysicsListSS.h:28
CLHEP
Definition: CocoaGlobals.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CustomParticleFactory.h
edm::ParameterSet
Definition: ParameterSet.h:36
GeV
const double GeV
Definition: MathUtil.h:16
FullModelHadronicProcess
Definition: FullModelHadronicProcess.h:16
CustomParticle
Definition: CustomParticle.h:11
edm::LogVerbatim
Definition: MessageLogger.h:297
CustomPDGParser::s_isRHadron
static bool s_isRHadron(int pdg)
Definition: CustomPDGParser.cc:10
CMSDarkPairProductionProcess
Definition: CMSDarkPairProductionProcess.h:20
CustomPhysicsListSS::ConstructParticle
void ConstructParticle() override
Definition: CustomPhysicsListSS.cc:46
CustomParticleFactory
Definition: CustomParticleFactory.h:12
CustomParticle.h
CustomPhysicsListSS::dfactor
double dfactor
Definition: CustomPhysicsListSS.h:30
CustomPhysicsListSS::fParticleFactory
std::unique_ptr< CustomParticleFactory > fParticleFactory
Definition: CustomPhysicsListSS.h:22
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CustomPhysicsListSS::fHadronicInteraction
bool fHadronicInteraction
Definition: CustomPhysicsListSS.h:24
ParameterSet.h
CustomPhysicsListSS::~CustomPhysicsListSS
~CustomPhysicsListSS() override
Definition: CustomPhysicsListSS.cc:44
CommonMethods.cp
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
Definition: CommonMethods.py:192
CustomPhysicsListSS::CustomPhysicsListSS
CustomPhysicsListSS(const std::string &name, const edm::ParameterSet &p, bool useuni=false)
Definition: CustomPhysicsListSS.cc:24