CMS 3D CMS Logo

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