16 #include "art/Framework/Services/Registry/ServiceHandle.h"
18 #include "Geant4/G4ParallelWorldScoringProcess.hh"
19 #include "Geant4/G4ParticleDefinition.hh"
20 #include "Geant4/G4ParticleTable.hh"
21 #include "Geant4/G4VModularPhysicsList.hh"
23 #include "Geant4/G4ChargeExchange.hh"
24 #include "Geant4/G4ChargeExchangeProcess.hh"
25 #include "Geant4/G4ProcessManager.hh"
29 #include "Geant4/G4PhysListStamper.hh"
32 #define G4MT_physicsVector ((G4VMPLsubInstanceManager.offset[g4vmplInstanceID]).physicsVector)
42 G4VModularPhysicsList::AddTransportation();
49 art::ServiceHandle<sim::LArG4Parameters const> lgp;
50 bool DisableWireplanes = lgp->DisableWireplanes();
52 G4ParallelWorldScoringProcess* LArVoxelParallelWorldScoringProcess =
53 new G4ParallelWorldScoringProcess(
"LArVoxelReadoutScoringProcess");
55 G4ParallelWorldScoringProcess* OpDetParallelWorldScoringProcess =
56 new G4ParallelWorldScoringProcess(
"OpDetReadoutScoringProcess");
60 LArVoxelParallelWorldScoringProcess->SetParallelWorld(
"LArVoxelReadoutGeometry");
61 OpDetParallelWorldScoringProcess->SetParallelWorld(
"OpDetReadoutGeometry");
67 static G4ParticleTable* fParticleTable = G4ParticleTable::GetParticleTable();
68 G4ParticleTable::G4PTblDicIterator* theParticleIterator;
69 theParticleIterator = fParticleTable->GetIterator();
70 theParticleIterator->reset();
71 while ((*theParticleIterator)()) {
72 G4ParticleDefinition* particle = theParticleIterator->value();
74 if (particle->GetParticleType() ==
"opticalphoton") {
75 G4ProcessManager* pmanager = particle->GetProcessManager();
76 pmanager->AddProcess(OpDetParallelWorldScoringProcess);
77 pmanager->SetProcessOrderingToLast(OpDetParallelWorldScoringProcess, idxAtRest);
78 pmanager->SetProcessOrdering(OpDetParallelWorldScoringProcess, idxAlongStep, 1);
79 pmanager->SetProcessOrderingToLast(OpDetParallelWorldScoringProcess, idxPostStep);
84 else if (particle->GetPDGCharge() != 0 && !particle->IsShortLived()) {
85 G4ProcessManager* pmanager = particle->GetProcessManager();
86 if (!DisableWireplanes) {
87 pmanager->AddProcess(LArVoxelParallelWorldScoringProcess);
88 pmanager->SetProcessOrderingToLast(LArVoxelParallelWorldScoringProcess, idxAtRest);
89 pmanager->SetProcessOrdering(LArVoxelParallelWorldScoringProcess, idxAlongStep, 1);
90 pmanager->SetProcessOrderingToLast(LArVoxelParallelWorldScoringProcess, idxPostStep);
94 G4bool genSecondaries(
false);
96 if (((particle->GetParticleName() == G4MuonPlus::MuonPlus()->GetParticleName() ||
97 particle->GetParticleName() == G4MuonMinus::MuonMinus()->GetParticleName()) &&
98 lgp->UseCustomPhysics()) ||
99 ((particle->GetParticleName() == G4Proton::Proton()->GetParticleName() ||
100 particle->GetParticleName() == G4Neutron::Neutron()->GetParticleName() ||
101 particle->GetParticleName() == G4KaonZeroShort::KaonZeroShort()->GetParticleName() ||
102 particle->GetParticleName() == G4KaonZeroLong::KaonZeroLong()->GetParticleName() ||
103 particle->GetParticleName() == G4Lambda::Lambda()->GetParticleName()) &&
104 lgp->UseCustomPhysics())) {
106 for (std::vector<std::string>::const_iterator it = EnabledPhysics.begin();
107 it != EnabledPhysics.end();
109 std::string PhysicsName = (*it);
110 if (!PhysicsName.compare(
"SynchrotronAndGN") && lgp->K0Bias()) {
111 genSecondaries =
true;
113 if (!PhysicsName.compare(
"ChargeExchange")) { cE =
true; }
117 if (genSecondaries) {
118 G4int nSecondaries(lgp->K0Bias());
119 G4int fXSBias(lgp->MNXSBias());
120 G4int xSBias(lgp->MNXBias());
121 mf::LogInfo(
"PhysicsList: ")
122 <<
"Turning on WrappedMuNuclear for " << particle->GetParticleName() <<
"s with "
123 << nSecondaries <<
" appropriately weighted secondaries."
124 <<
" XSBias is set to " << xSBias
125 <<
" and the cross-section is increased by a factor of " << fXSBias <<
".";
126 G4MuonNuclearProcess* g4MNI =
new G4MuonNuclearProcess();
131 munuclSplitting->
SetNSplit(nSecondaries, xSBias, fXSBias);
133 munuclSplitting->RegisterProcess(g4MNI);
136 if (xSBias && (fXSBias > 1))
137 pmanager->AddProcess(munuclSplitting, -1, 1, 1);
139 pmanager->AddProcess(munuclSplitting, -1, -1, 1);
143 mf::LogInfo(
"PhysicsList: ")
144 <<
"Turning on ChargeExchange for " << particle->GetParticleName() <<
"s.";
145 G4ChargeExchange* model =
new G4ChargeExchange();
146 G4ChargeExchangeProcess*
p =
new G4ChargeExchangeProcess();
148 p->RegisterMe(model);
149 pmanager->AddDiscreteProcess(p);
165 G4PhysConstVector::iterator itr;
167 (*itr)->ConstructProcess();
Create the physics lists to be used by Geant4.
void SetIsActive(G4bool doIt)
void SetNSplit(G4int nTrx, G4int xB=0, G4double xFac=1)
#define G4MT_physicsVector
TConfigurablePhysicsList< ModularPhysicsList > PhysicsList
G4_DECLARE_PHYSLIST_FACTORY_NS(larg4::PhysicsList, larg4, PhysicsList)
virtual void ConstructProcess()
process_name largeant stream1 can override from command line with o or output physics producers generator physics producers generator services LArG4Parameters EnabledPhysics