Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4BiasingOperation.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2019 Ivana Hrivnacova
4// All rights reserved.
5//
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
9
14
15// Model ranges:
16// New (Geant4 11.1.px)
17// Bertini: Low: 0 MeV High: 41 MeV
18// INCLXX: Low: 40 MeV High: 12 GeV
19// FTF: Low: 3 GeV High: via Hadr. param
20//
21// Previous version (Geant4 11.0.px)
22// Preco: Low: 0 High: 2 MeV
23// INCLXX: Low: 1 MeV High: 12 GeV
24// FTF: Low: 3 GeV High: via Hadr. param
25
26#include "TG4BiasingOperation.h"
27
28#include "G4BGGNucleonInelasticXS.hh"
29#include "G4BGGPionInelasticXS.hh"
30#include "G4BiasingProcessInterface.hh"
31#include "G4CascadeInterface.hh"
32#include "G4ExcitedStringDecay.hh"
33#include "G4FTFModel.hh"
34#include "G4GeneratorPrecompoundInterface.hh"
35#include "G4HadronInelasticProcess.hh"
36#include "G4HadronicParameters.hh"
37#include "G4INCLXXInterface.hh"
38#include "G4LundStringFragmentation.hh"
39#include "G4NeutronInelasticXS.hh"
40#include "G4TheoFSGenerator.hh"
41#include "G4VParticleChange.hh"
42#include "G4CrossSectionDataStore.hh"
43
46{
47
48 // Create the inelastic processes for p , n , pi+ , pi-
50 new G4HadronInelasticProcess("protonInelastic", G4Proton::Definition());
52 new G4HadronInelasticProcess("neutronInelastic", G4Neutron::Definition());
54 new G4HadronInelasticProcess("pi+Inelastic", G4PionPlus::Definition());
56 new G4HadronInelasticProcess("pi-Inelastic", G4PionMinus::Definition());
57
58 // Set the energy ranges
59 const G4double maxBERT = 41.0 * CLHEP::MeV;
60 const G4double minINCLXX = 40.0 * CLHEP::MeV;
61 const G4double maxINCLXX = 12.0 * CLHEP::GeV;
62 const G4double minFTFP = 3.0 * CLHEP::GeV;
63 const G4double maxFTFP = G4HadronicParameters::Instance()->GetMaxEnergy();
64
65 // Create the hadronic models (to replace FTFP_BERT with "FTFP_INCLXX",
66 // keeping the same energy ranges for the transition between models).
67 // Notice that it is better to create the models here from scratch,
68 // instead of reusing the existing ones, because we might pick up the
69 // existing ones associated to the wrong particles...
70 // --- FTFP model ---
71 G4FTFModel* theStringModel = new G4FTFModel;
72 G4LundStringFragmentation* theLund = new G4LundStringFragmentation;
73 G4ExcitedStringDecay* theStringDecay = new G4ExcitedStringDecay(theLund);
74 theStringModel->SetFragmentationModel(theStringDecay);
75 G4GeneratorPrecompoundInterface* thePrecoInterface =
76 new G4GeneratorPrecompoundInterface;
77 G4TheoFSGenerator* theHighEnergyModel = new G4TheoFSGenerator("FTFP");
78 theHighEnergyModel->SetHighEnergyGenerator(theStringModel);
79 theHighEnergyModel->SetTransport(thePrecoInterface);
80 theHighEnergyModel->SetMinEnergy(minFTFP);
81 theHighEnergyModel->SetMaxEnergy(maxFTFP);
82 // Bertini : create a new model to be used below INCLXX limit
83 G4CascadeInterface* theBertiniModel = new G4CascadeInterface();
84 theBertiniModel->SetMinEnergy(0.0);
85 theBertiniModel->SetMaxEnergy(maxBERT);
86 // --- INCLXX model ---
87 G4INCLXXInterface* theInclxxModel = new G4INCLXXInterface();
88 theInclxxModel->SetMinEnergy(minINCLXX);
89 theInclxxModel->SetMaxEnergy(maxINCLXX);
90
91 // Register the models
92 fProtonInelasticProcess->RegisterMe(theHighEnergyModel);
93 fProtonInelasticProcess->RegisterMe(theInclxxModel);
94 fProtonInelasticProcess->RegisterMe(theBertiniModel);
95 fNeutronInelasticProcess->RegisterMe(theHighEnergyModel);
96 fNeutronInelasticProcess->RegisterMe(theInclxxModel);
97 fNeutronInelasticProcess->RegisterMe(theBertiniModel);
98 fPionPlusInelasticProcess->RegisterMe(theHighEnergyModel);
99 fPionPlusInelasticProcess->RegisterMe(theInclxxModel);
100 fPionPlusInelasticProcess->RegisterMe(theBertiniModel);
101 fPionMinusInelasticProcess->RegisterMe(theHighEnergyModel);
102 fPionMinusInelasticProcess->RegisterMe(theInclxxModel);
103 fPionMinusInelasticProcess->RegisterMe(theBertiniModel);
104
105 // Register the cross sections: this is mandatory starting from G4 10.6
106 // because the default Gheisha inelastic cross sections have been removed.
107 // It is convenient to use the Gheisha inelastic cross sections here
108 // because they do not require any special initialization.
109 G4VCrossSectionDataSet* theProtonXSdata =
110 new G4BGGNucleonInelasticXS(G4Proton::Definition());
111 theProtonXSdata->BuildPhysicsTable(*(G4Proton::Definition()));
112 fProtonInelasticProcess->AddDataSet(theProtonXSdata);
113 G4VCrossSectionDataSet* theNeutronXSdata = new G4NeutronInelasticXS;
114 theNeutronXSdata->BuildPhysicsTable(*(G4Neutron::Definition()));
115 fNeutronInelasticProcess->AddDataSet(theNeutronXSdata);
116 G4VCrossSectionDataSet* thePionPlusXSdata =
117 new G4BGGPionInelasticXS(G4PionPlus::Definition());
118 thePionPlusXSdata->BuildPhysicsTable(*(G4PionPlus::Definition()));
119 fPionPlusInelasticProcess->AddDataSet(thePionPlusXSdata);
120 G4VCrossSectionDataSet* thePionMinusXSdata =
121 new G4BGGPionInelasticXS(G4PionMinus::Definition());
122 thePionMinusXSdata->BuildPhysicsTable(*(G4PionMinus::Definition()));
123 fPionMinusInelasticProcess->AddDataSet(thePionMinusXSdata);
124}
125
127
129 const G4BiasingProcessInterface*, const G4Track* track, const G4Step* step,
130 G4bool&)
131{
132 if (track->GetParticleDefinition() == G4Proton::Definition()) {
133 auto particle = track->GetDynamicParticle();
134 auto material = track->GetMaterial();
135 fProtonInelasticProcess->GetCrossSectionDataStore( )
136 ->ComputeCrossSection(particle, material);
137 return fProtonInelasticProcess->PostStepDoIt(*track, *step);
138 }
139 else if (track->GetParticleDefinition() == G4Neutron::Definition()) {
140 auto particle = track->GetDynamicParticle();
141 auto material = track->GetMaterial();
142 fNeutronInelasticProcess->GetCrossSectionDataStore( )
143 ->ComputeCrossSection(particle, material);
144 return fNeutronInelasticProcess->PostStepDoIt(*track, *step);
145 }
146 else if (track->GetParticleDefinition() == G4PionPlus::Definition()) {
147 auto particle = track->GetDynamicParticle();
148 auto material = track->GetMaterial();
149 fPionPlusInelasticProcess->GetCrossSectionDataStore( )
150 ->ComputeCrossSection(particle, material);
151 return fPionPlusInelasticProcess->PostStepDoIt(*track, *step);
152 }
153 else if (track->GetParticleDefinition() == G4PionMinus::Definition()) {
154 auto particle = track->GetDynamicParticle();
155 auto material = track->GetMaterial();
156 fPionMinusInelasticProcess->GetCrossSectionDataStore( )
157 ->ComputeCrossSection(particle, material);
158 return fPionMinusInelasticProcess->PostStepDoIt(*track, *step);
159 }
160 else {
161 G4cerr << "ERROR in TG4BiasingOperation::ApplyFinalStateBiasing : "
162 "unexpected particle = "
163 << track->GetParticleDefinition()->GetParticleName() << G4endl;
164 return 0;
165 }
166}
Definition of the TG4BiasingOperation class.
G4HadronInelasticProcess * fPionMinusInelasticProcess
TG4BiasingOperation(G4String name)
virtual G4VParticleChange * ApplyFinalStateBiasing(const G4BiasingProcessInterface *, const G4Track *, const G4Step *, G4bool &)
G4HadronInelasticProcess * fProtonInelasticProcess
G4HadronInelasticProcess * fPionPlusInelasticProcess
G4HadronInelasticProcess * fNeutronInelasticProcess