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* pythiaDecayProcess =
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();
97 G4ProcessVector *fullProcessList = processMgr->GetProcessList();
98 std::vector< G4VProcess * > existingDecayProcesses; existingDecayProcesses.reserve(2);
99 for (
unsigned int i=0;
i<fullProcessList->size(); ++
i) {
100 G4VProcess*
process = (*fullProcessList)[
i];
101 if (
process->GetProcessType() == fDecay) {
102 ATH_MSG_VERBOSE (
"Found a pre-existing decay process for " <<
particle->GetParticleName() <<
" (" <<
pid <<
"). Will remove in favour of using RHadronPythiaDecayer." );
103 existingDecayProcesses.push_back(
process);
107 for (G4VProcess*
process : existingDecayProcesses) {
108 processMgr->RemoveProcess(
process);
111 for (
unsigned int i=0;
i<fullProcessList->size(); ++
i) {
112 G4VProcess*
process = (*fullProcessList)[
i];
113 if (
process->GetProcessType() == fDecay) {
114 ATH_MSG_WARNING (
"There is another decay process for " <<
particle->GetParticleName() <<
" (" <<
pid <<
") already defined!" );
115 processMgr->DumpInfo();
118 ATH_MSG_VERBOSE (
"Adding decay process for " <<
particle->GetParticleName() <<
" (" <<
pid <<
") using RHadronPythiaDecayer." );
119 processMgr->AddProcess(pythiaDecayProcess);
120 processMgr->SetProcessOrdering(pythiaDecayProcess, idxPostStep); processMgr->SetProcessOrdering(pythiaDecayProcess, idxAtRest);
128 std::vector<int> handled;
130 while ((*particleIterator)()) {
131 G4ParticleDefinition *
particle = particleIterator->value();
134 if (
find(handled.begin(), handled.end(),
pid) == handled.end()) {
135 handled.push_back(
pid);
136 ATH_MSG_VERBOSE (
particle->GetParticleName() <<
" (" <<
particle->GetPDGEncoding() <<
") " <<
" is a Custom Particle. Attempting to add a decay process." );
137 G4ProcessManager *processMgr =
particle->GetProcessManager();
139 G4ProcessVector *fullProcessList = processMgr->GetProcessList();
140 std::vector< G4VProcess * > existingDecayProcesses; existingDecayProcesses.reserve(2);
141 for (
unsigned int i=0;
i<fullProcessList->size(); ++
i) {
142 G4VProcess*
process = (*fullProcessList)[
i];
143 if (
process->GetProcessType() == fDecay) {
144 ATH_MSG_VERBOSE (
"Found a pre-existing decay process for " <<
particle->GetParticleName() <<
" (" <<
pid <<
"). Will remove in favour of using RHadronPythiaDecayer." );
145 existingDecayProcesses.push_back(
process);
149 for (G4VProcess*
process : existingDecayProcesses) {
150 processMgr->RemoveProcess(
process);
153 for (
unsigned int i=0;
i<fullProcessList->size(); ++
i) {
154 G4VProcess*
process = (*fullProcessList)[
i];
155 if (
process->GetProcessType() == fDecay) {
156 ATH_MSG_WARNING (
"There is another decay process for " <<
particle->GetParticleName() <<
" (" <<
pid <<
") already defined!" );
157 processMgr->DumpInfo();
160 if (
particle->GetParticleType()==
"rhadron" ) {
161 processMgr->AddDiscreteProcess(
new FullModelHadronicProcess());
162 if (pythiaDecayProcess->IsApplicable(*
particle)) {
164 processMgr->AddProcess(pythiaDecayProcess);
166 processMgr->SetProcessOrdering(pythiaDecayProcess, idxPostStep);
167 processMgr->SetProcessOrdering(pythiaDecayProcess, idxAtRest);
172 processMgr->AddProcess(pythiaDecayProcess);
174 processMgr->SetProcessOrdering(pythiaDecayProcess, idxPostStep);
175 processMgr->SetProcessOrdering(pythiaDecayProcess, idxAtRest);
180 processMgr->AddProcess(
new G4hMultipleScattering, -1, 1, 1);
181 processMgr->AddProcess(
new G4hIonisation, -1, 2, 2);
186 processMgr->DumpInfo();
192 ATH_MSG_DEBUG(
"RHadronsPhysicsTool::ConstructProcess() - list of handled RHadrons = " << handled);
193 ATH_MSG_DEBUG(
"RHadronsPhysicsTool::ConstructProcess() - end");