Geant4  10.02.p02
G4IonBinaryCascadePhysics.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4IonBinaryCascadePhysics.cc 80671 2014-05-06 13:59:16Z gcosmo $
27 //
28 //---------------------------------------------------------------------------
29 //
30 // ClassName: G4IonBinaryCascadePhysics
31 //
32 // Author: V.Ivanchenko 09.11.2005
33 //
34 // Modified:
35 // 21.03.13 A.Ribon : replace LHEP with FTFP.
36 // 23.06.06 V.Ivanchenko set emaxLHEP=1 TeV
37 // 24.06.06 V.Ivanchenko fix typo
38 //
39 //----------------------------------------------------------------------------
40 //
41 
43 
44 #include "G4SystemOfUnits.hh"
45 #include "G4ParticleDefinition.hh"
46 #include "G4ProcessManager.hh"
47 #include "G4Deuteron.hh"
48 #include "G4Triton.hh"
49 #include "G4He3.hh"
50 #include "G4Alpha.hh"
51 #include "G4GenericIon.hh"
52 #include "G4IonConstructor.hh"
53 
58 
59 #include "G4PreCompoundModel.hh"
60 #include "G4ExcitationHandler.hh"
61 #include "G4FTFBuilder.hh"
62 #include "G4HadronicInteraction.hh"
63 #include "G4BuilderType.hh"
65 
66 // factory
68 //
70 
72 G4ThreadLocal std::vector<G4HadronInelasticProcess*>* G4IonBinaryCascadePhysics::G4MT_p_list = 0;
73 G4ThreadLocal std::vector<G4HadronicInteraction*>* G4IonBinaryCascadePhysics::G4MT_model_list = 0;
74 
80 
82  : G4VPhysicsConstructor("IonBinaryCascade"), verbose(ver)
83 {
84  theNuclNuclData = 0;
85  theGGNuclNuclXS = 0;
86  theIonBC = 0;
87  theFTFP = 0;
88  theBuilder = 0;
90  if(verbose > 1) G4cout << "### G4IonBinaryCascadePhysics" << G4endl;
91 }
92 
93 
95  G4int ver)
96  : G4VPhysicsConstructor(name), verbose(ver)
97 {
98  theNuclNuclData = 0;
99  theGGNuclNuclXS = 0;
100  theIonBC = 0;
101  theFTFP = 0;
102  theBuilder = 0;
104  if(verbose > 1) G4cout << "### G4IonBinaryCascadePhysics" << G4endl;
105 }
106 
107 
109 {
110  //Explicitly setting pointers TLS to 0 is
111  //needed, in case I create a new thread
112  //this variable is static!
113  if(wasActivated) {
114  delete theBuilder; theBuilder = 0;
115  delete theGGNuclNuclXS; theGGNuclNuclXS = 0;
116  delete theNuclNuclData; theNuclNuclData = 0;
117  G4int i;
118  if ( G4MT_p_list ) {
119  G4int n = G4MT_p_list->size();
120  for(i=0; i<n; i++) {delete (*G4MT_p_list)[i];}
121  delete G4MT_p_list;
122  G4MT_p_list = 0;
123  }
124  if ( G4MT_model_list ) {
125  G4int n = G4MT_model_list->size();
126  for(i=0; i<n; i++) {delete (*G4MT_model_list)[i];}
127  delete G4MT_model_list;
128  G4MT_model_list = 0;
129  }
130  }
131 }
132 
133 
135 {
136  if(wasActivated) { return; }
137  wasActivated = true;
138 
141  G4PreCompoundModel* thePreCompound = static_cast<G4PreCompoundModel*>(p);
142  if(!thePreCompound) { thePreCompound = new G4PreCompoundModel; }
143 
144  theIonBC = new G4BinaryLightIonReaction(thePreCompound);
145  theIonBC->SetMinEnergy(0.0);
146  theIonBC->SetMaxEnergy(4.0*GeV);
147  if ( G4MT_model_list == 0 ) G4MT_model_list = new std::vector<G4HadronicInteraction*>;
148  G4MT_model_list->push_back(theIonBC);
149 
150  theBuilder = new G4FTFBuilder("FTFP",thePreCompound);
152  theFTFP->SetMinEnergy(2.0*GeV);
153  theFTFP->SetMaxEnergy(100.0*TeV);
154  G4MT_model_list->push_back(theFTFP);
155 
157 
158  AddProcess("dInelastic", G4Deuteron::Deuteron());
159  AddProcess("tInelastic", G4Triton::Triton());
160  AddProcess("He3Inelastic", G4He3::He3());
161  AddProcess("alphaInelastic", G4Alpha::Alpha());
162  AddProcess("ionInelastic", G4GenericIon::GenericIon());
163 }
164 
165 
167  G4ParticleDefinition* part)
168 {
169  if ( G4MT_p_list == 0 ) G4MT_p_list = new std::vector<G4HadronInelasticProcess*>;
170  G4HadronInelasticProcess* hadi = new G4HadronInelasticProcess(name, part);
171  G4MT_p_list->push_back(hadi);
172  G4ProcessManager* pManager = part->GetProcessManager();
173  pManager->AddDiscreteProcess(hadi);
174 
176 
177  hadi->RegisterMe(theIonBC);
178  hadi->RegisterMe(theFTFP);
179 }
180 
181 
183 {
184  // Construct light ions
185  G4IonConstructor pConstructor;
186  pConstructor.ConstructParticle();
187 }
static G4ThreadLocal G4FTFBuilder * theBuilder
static G4ThreadLocal G4HadronicInteraction * theFTFP
G4String name
Definition: TRTMaterials.hh:40
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
static G4ThreadLocal G4BinaryLightIonReaction * theIonBC
void AddProcess(const G4String &, G4ParticleDefinition *)
static G4ThreadLocal std::vector< G4HadronicInteraction * > * G4MT_model_list
static G4ThreadLocal std::vector< G4HadronInelasticProcess * > * G4MT_p_list
#define G4ThreadLocal
Definition: tls.hh:89
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
G4HadronicInteraction * GetModel()
static void ConstructParticle()
void RegisterMe(G4HadronicInteraction *a)
static G4ThreadLocal G4bool wasActivated
void SetMinEnergy(G4double anEnergy)
void AddDataSet(G4VCrossSectionDataSet *aDataSet)
G4GLOB_DLL std::ostream G4cout
static G4ThreadLocal G4VComponentCrossSection * theGGNuclNuclXS
G4_DECLARE_PHYSCONSTR_FACTORY(G4IonBinaryCascadePhysics)
bool G4bool
Definition: G4Types.hh:79
static G4Triton * Triton()
Definition: G4Triton.cc:95
static const double GeV
Definition: G4SIunits.hh:214
const G4int n
static G4Deuteron * Deuteron()
Definition: G4Deuteron.cc:94
G4HadronicInteraction * FindModel(const G4String &name)
static G4GenericIon * GenericIon()
Definition: G4GenericIon.cc:93
static G4HadronicInteractionRegistry * Instance()
void SetMaxEnergy(const G4double anEnergy)
#define G4endl
Definition: G4ios.hh:61
static const double TeV
Definition: G4SIunits.hh:215
static G4Alpha * Alpha()
Definition: G4Alpha.cc:89
static G4ThreadLocal G4VCrossSectionDataSet * theNuclNuclData
static G4He3 * He3()
Definition: G4He3.cc:94