Geant4_10
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 71042 2013-06-10 09:28:44Z 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"
64 
65 // factory
67 //
69 
70 G4ThreadLocal G4bool G4IonBinaryCascadePhysics::wasActivated = false;
71 G4ThreadLocal std::vector<G4HadronInelasticProcess*>* G4IonBinaryCascadePhysics::G4MT_p_list = 0;
72 G4ThreadLocal std::vector<G4HadronicInteraction*>* G4IonBinaryCascadePhysics::G4MT_model_list = 0;
73 
74 G4ThreadLocal G4VCrossSectionDataSet* G4IonBinaryCascadePhysics::theNuclNuclData = 0;
75 G4ThreadLocal G4VComponentCrossSection* G4IonBinaryCascadePhysics::theGGNuclNuclXS = 0;
76 G4ThreadLocal G4BinaryLightIonReaction* G4IonBinaryCascadePhysics::theIonBC = 0;
77 G4ThreadLocal G4HadronicInteraction* G4IonBinaryCascadePhysics::theFTFP = 0;
78 G4ThreadLocal G4FTFBuilder* G4IonBinaryCascadePhysics::theBuilder = 0;
79 
81  : G4VPhysicsConstructor("IonBinaryCascade"), verbose(ver)
82 {
83  theNuclNuclData = 0;
84  theGGNuclNuclXS = 0;
85  theIonBC = 0;
86  theFTFP = 0;
87  theBuilder = 0;
89  if(verbose > 1) G4cout << "### G4IonBinaryCascadePhysics" << G4endl;
90 }
91 
92 
94  G4int ver)
95  : G4VPhysicsConstructor(name), verbose(ver)
96 {
97  theNuclNuclData = 0;
98  theGGNuclNuclXS = 0;
99  theIonBC = 0;
100  theFTFP = 0;
101  theBuilder = 0;
103  if(verbose > 1) G4cout << "### G4IonBinaryCascadePhysics" << G4endl;
104 }
105 
106 
108 {
109  //Explicitly setting pointers TLS to 0 is
110  //needed, in case I create a new thread
111  //this variable is static!
112  if(wasActivated) {
113  delete theBuilder; theBuilder = 0;
114  delete theGGNuclNuclXS; theGGNuclNuclXS = 0;
115  delete theNuclNuclData; theNuclNuclData = 0;
116  G4int i;
117  if ( G4MT_p_list ) {
118  G4int n = G4MT_p_list->size();
119  for(i=0; i<n; i++) {delete (*G4MT_p_list)[i];}
120  delete G4MT_p_list;
121  G4MT_p_list = 0;
122  }
123  if ( G4MT_model_list ) {
124  G4int n = G4MT_model_list->size();
125  for(i=0; i<n; i++) {delete (*G4MT_model_list)[i];}
126  delete G4MT_model_list;
127  G4MT_model_list = 0;
128  }
129  }
130 }
131 
132 
134 {
135  if(wasActivated) { return; }
136  wasActivated = true;
137 
138  G4ExcitationHandler* handler = new G4ExcitationHandler();
139  G4PreCompoundModel* thePreCompound = new G4PreCompoundModel(handler);
140 
141  theIonBC = new G4BinaryLightIonReaction(thePreCompound);
142  theIonBC->SetMinEnergy(0.0);
143  theIonBC->SetMaxEnergy(4.0*GeV);
144  if ( G4MT_model_list == 0 ) G4MT_model_list = new std::vector<G4HadronicInteraction*>;
145  G4MT_model_list->push_back(theIonBC);
146 
147  theBuilder = new G4FTFBuilder("FTFP",thePreCompound);
148  theFTFP = theBuilder->GetModel();
149  theFTFP->SetMinEnergy(2.0*GeV);
150  theFTFP->SetMaxEnergy(100.0*TeV);
151  G4MT_model_list->push_back(theFTFP);
152 
153  theNuclNuclData = new G4CrossSectionInelastic( theGGNuclNuclXS = new G4ComponentGGNuclNuclXsc() );
154 
155  AddProcess("dInelastic", G4Deuteron::Deuteron());
156  AddProcess("tInelastic", G4Triton::Triton());
157  AddProcess("He3Inelastic", G4He3::He3());
158  AddProcess("alphaInelastic", G4Alpha::Alpha());
159  AddProcess("ionInelastic", G4GenericIon::GenericIon());
160 }
161 
162 
163 void G4IonBinaryCascadePhysics::AddProcess(const G4String& name,
165 {
166  if ( G4MT_p_list == 0 ) G4MT_p_list = new std::vector<G4HadronInelasticProcess*>;
167  G4HadronInelasticProcess* hadi = new G4HadronInelasticProcess(name, part);
168  G4MT_p_list->push_back(hadi);
169  G4ProcessManager* pManager = part->GetProcessManager();
170  pManager->AddDiscreteProcess(hadi);
171 
172  hadi->AddDataSet(theNuclNuclData);
173 
174  hadi->RegisterMe(theIonBC);
175  hadi->RegisterMe(theFTFP);
176 }
177 
178 
180 {
181  // Construct light ions
182  G4IonConstructor pConstructor;
183  pConstructor.ConstructParticle();
184 }
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
const XML_Char * name
Definition: expat.h:151
#define G4ThreadLocal
Definition: tls.hh:52
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
G4HadronicInteraction * GetModel()
static void ConstructParticle()
void RegisterMe(G4HadronicInteraction *a)
void SetMinEnergy(G4double anEnergy)
Char_t n[5]
void AddDataSet(G4VCrossSectionDataSet *aDataSet)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
TString part[npart]
Definition: Style.C:32
static G4Triton * Triton()
Definition: G4Triton.cc:95
static G4Deuteron * Deuteron()
Definition: G4Deuteron.cc:94
static G4GenericIon * GenericIon()
Definition: G4GenericIon.cc:93
void SetMaxEnergy(const G4double anEnergy)
#define G4endl
Definition: G4ios.hh:61
static G4Alpha * Alpha()
Definition: G4Alpha.cc:89
static G4He3 * He3()
Definition: G4He3.cc:94
#define G4_DECLARE_PHYSCONSTR_FACTORY(physics_constructor)