9 #include "FullModelHadronicProcess.hh"
13 #include "G4ParticleTable.hh"
14 #include "G4VProcess.hh"
15 #include "G4Transportation.hh"
16 #include "G4hMultipleScattering.hh"
17 #include "G4hIonisation.hh"
18 #include "G4ProcessManager.hh"
20 #include "G4BaryonConstructor.hh"
36 const std::string& nam,
const IInterface*
parent )
56 this->SetPhysicsName(
name());
57 return StatusCode::SUCCESS;
68 ATH_MSG_DEBUG(
"RHadronsPhysicsTool::ConstructParticle() - start");
70 ATH_MSG_DEBUG(
"RHadronsPhysicsTool::ConstructParticle() - end");
74 ATH_MSG_DEBUG(
"RHadronsPhysicsTool::ConstructProcess() - start");
75 G4Decay* theDecayProcess =
new G4Decay();
77 G4ParticleTable::G4PTblDicIterator* particleIterator = G4ParticleTable::GetParticleTable()->GetIterator();
78 particleIterator->reset();
82 G4BaryonConstructor::ConstructParticle();
84 G4ProcessManager *templateProcessMgr = G4ParticleTable::GetParticleTable()->FindParticle(4122)->GetProcessManager();
87 G4ParticleDefinition *
particle = G4ParticleTable::GetParticleTable()->FindParticle(
pid );
90 G4ProcessManager *processMgr =
particle->GetProcessManager();
92 ATH_MSG_VERBOSE (
"No process manager found for " <<
particle->GetParticleName() <<
" (" <<
pid <<
"). Copying process manager from 4122 (one we know works) to this particle" );
93 particle->SetProcessManager(
new G4ProcessManager(*templateProcessMgr));
94 processMgr =
particle->GetProcessManager();
96 G4ProcessVector *pros = processMgr->GetProcessList();
97 for (
unsigned int pi=0;
pi<pros->size(); ++
pi) {
98 if ((*pros)[
pi]->GetProcessType()==fDecay) {
99 ATH_MSG_VERBOSE (
"Found a pre-existing decay process for " <<
particle->GetParticleName() <<
" (" <<
pid <<
"). Will remove in favour of using RHadronPythiaDecayer." );
100 processMgr->RemoveProcess(
pi);
104 for (
unsigned int pi=0;
pi<pros->size(); ++
pi) {
105 if ((*pros)[
pi]->GetProcessType()==fDecay) {
106 ATH_MSG_WARNING (
"There is another decay process for " <<
particle->GetParticleName() <<
" (" <<
pid <<
") already defined!" );
107 processMgr ->DumpInfo();
110 ATH_MSG_VERBOSE (
"Adding decay process for " <<
particle->GetParticleName() <<
" (" <<
pid <<
") using RHadronPythiaDecayer." );
111 processMgr ->AddProcess(theDecayProcess);
112 processMgr ->SetProcessOrdering(theDecayProcess, idxPostStep); processMgr ->SetProcessOrdering(theDecayProcess, idxAtRest);
120 std::vector<int> handled;
122 while ((*particleIterator)()) {
123 G4ParticleDefinition *
particle = particleIterator->value();
125 if (
find(handled.begin(),handled.end(),
particle->GetPDGEncoding())==handled.end()) {
126 handled.push_back(
particle->GetPDGEncoding());
127 ATH_MSG_VERBOSE (
particle->GetParticleName() <<
" (" <<
particle->GetPDGEncoding() <<
") " <<
" is a Custom Particle. Attempting to add a decay process." );
128 G4ProcessManager *processMgr =
particle->GetProcessManager();
129 if (
particle->GetParticleType()==
"rhadron" ||
130 particle->GetParticleType()==
"mesonino" ||
131 particle->GetParticleType()==
"sbaryon" ) {
132 processMgr->AddDiscreteProcess(
new FullModelHadronicProcess());
133 if (theDecayProcess->IsApplicable(*
particle)) {
135 processMgr ->AddProcess(theDecayProcess);
137 processMgr->SetProcessOrdering(theDecayProcess, idxPostStep);
138 processMgr->SetProcessOrdering(theDecayProcess, idxAtRest);
143 processMgr->AddProcess(theDecayProcess);
145 processMgr->SetProcessOrdering(theDecayProcess, idxPostStep);
146 processMgr->SetProcessOrdering(theDecayProcess, idxAtRest);
151 processMgr->AddProcess(
new G4hMultipleScattering, -1, 1, 1);
152 processMgr->AddProcess(
new G4hIonisation, -1, 2, 2);
157 processMgr->DumpInfo();
163 ATH_MSG_DEBUG(
"RHadronsPhysicsTool::ConstructProcess() - list of handled RHadrons = " << handled);
164 ATH_MSG_DEBUG(
"RHadronsPhysicsTool::ConstructProcess() - end");