CMS 3D CMS Logo

CustomPhysicsListSS.cc
Go to the documentation of this file.
1 #include <memory>
2 
9 
13 
14 #include "G4hMultipleScattering.hh"
15 #include "G4hIonisation.hh"
16 #include "G4CoulombScattering.hh"
17 #include "G4ProcessManager.hh"
18 
21 
22 using namespace CLHEP;
23 
24 G4ThreadLocal std::unique_ptr<G4ProcessHelper> CustomPhysicsListSS::myHelper;
25 
27  : G4VPhysicsConstructor(name) {
28  myConfig = p;
29  if (apinew) {
30  dfactor = p.getParameter<double>("DarkMPFactor");
31  fHadronicInteraction = p.getParameter<bool>("RhadronPhysics");
32  } else {
33  // this is left for backward compatibility
34  dfactor = p.getParameter<double>("dark_factor");
35  fHadronicInteraction = p.getParameter<bool>("rhadronPhysics");
36  }
37  edm::FileInPath fp = p.getParameter<edm::FileInPath>("particlesDef");
38  particleDefFilePath = fp.fullPath();
39  fParticleFactory = std::make_unique<CustomParticleFactory>();
40  myHelper.reset(nullptr);
41 
42  edm::LogVerbatim("SimG4CoreCustomPhysics") << "CustomPhysicsListSS: Path for custom particle definition file: \n"
44 }
45 
47 
49  edm::LogVerbatim("SimG4CoreCustomPhysicsSS") << "===== CustomPhysicsList::ConstructParticle ";
50  fParticleFactory.get()->loadCustomParticles(particleDefFilePath);
51 }
52 
54  edm::LogVerbatim("SimG4CoreCustomPhysicsSS") << "CustomPhysicsListSS: adding CustomPhysics processes";
55 
56  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
57 
58  for (auto particle : fParticleFactory.get()->GetCustomParticles()) {
59  CustomParticle* cp = dynamic_cast<CustomParticle*>(particle);
60  if (cp) {
61  G4ProcessManager* pmanager = particle->GetProcessManager();
62  edm::LogVerbatim("SimG4CoreCustomPhysics")
63  << "CustomPhysicsListSS: " << particle->GetParticleName() << " PDGcode= " << particle->GetPDGEncoding()
64  << " Mass= " << particle->GetPDGMass() / GeV << " GeV.";
65  if (pmanager) {
66  if (particle->GetPDGCharge() != 0.0) {
67  ph->RegisterProcess(new G4CoulombScattering, particle);
68  ph->RegisterProcess(new G4hIonisation, particle);
69  }
70  if (cp->GetCloud() && fHadronicInteraction && CustomPDGParser::s_isRHadron(particle->GetPDGEncoding())) {
71  edm::LogVerbatim("SimG4CoreCustomPhysics")
72  << "CustomPhysicsListSS: " << particle->GetParticleName()
73  << " CloudMass= " << cp->GetCloud()->GetPDGMass() / GeV
74  << " GeV; SpectatorMass= " << cp->GetSpectator()->GetPDGMass() / GeV << " GeV.";
75 
76  if (!myHelper.get()) {
77  myHelper = std::make_unique<G4ProcessHelper>(myConfig, fParticleFactory.get());
78  }
79  pmanager->AddDiscreteProcess(new FullModelHadronicProcess(myHelper.get()));
80  }
81  if (particle->GetParticleType() == "darkpho") {
83  pmanager->AddDiscreteProcess(darkGamma);
84  }
85  }
86  }
87  }
88 }
G4ProcessHelper.h
MessageLogger.h
DummyChargeFlipProcess.h
FullModelHadronicProcess.h
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
personalPlayback.fp
fp
Definition: personalPlayback.py:523
hgcal_conditions::parameters
Definition: HGCConditions.h:86
CustomPhysicsListSS::ConstructProcess
void ConstructProcess() override
Definition: CustomPhysicsListSS.cc:53
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:47
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:4
CMSDarkPairProductionProcess
Definition: CMSDarkPairProductionProcess.h:20
CustomPhysicsListSS::ConstructParticle
void ConstructParticle() override
Definition: CustomPhysicsListSS.cc:48
CustomParticle.h
CustomPhysicsListSS::dfactor
double dfactor
Definition: CustomPhysicsListSS.h:30
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
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:46
CustomPhysicsListSS::CustomPhysicsListSS
CustomPhysicsListSS(const std::string &name, const edm::ParameterSet &p, bool useuni=false)
Definition: CustomPhysicsListSS.cc:26