Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4StatMF Class Reference

#include <G4StatMF.hh>

+ Inheritance diagram for G4StatMF:

Public Member Functions

 G4StatMF ()
 
 ~G4StatMF ()
 
G4FragmentVectorBreakItUp (const G4Fragment &theNucleus)
 
- Public Member Functions inherited from G4VMultiFragmentation
 G4VMultiFragmentation ()
 
virtual ~G4VMultiFragmentation ()
 
virtual G4FragmentVectorBreakItUp (const G4Fragment &theNucleus)=0
 

Detailed Description

Definition at line 46 of file G4StatMF.hh.

Constructor & Destructor Documentation

◆ G4StatMF()

G4StatMF::G4StatMF ( )

Definition at line 37 of file G4StatMF.cc.

37: _theEnsemble(0) {}

◆ ~G4StatMF()

G4StatMF::~G4StatMF ( )

Definition at line 41 of file G4StatMF.cc.

41{} //{if (_theEnsemble != 0) delete _theEnsemble;}

Member Function Documentation

◆ BreakItUp()

G4FragmentVector * G4StatMF::BreakItUp ( const G4Fragment theNucleus)
virtual

Implements G4VMultiFragmentation.

Definition at line 44 of file G4StatMF.cc.

45{
46 // G4FragmentVector * theResult = new G4FragmentVector;
47
48 if (theFragment.GetExcitationEnergy() <= 0.0) {
49 //G4FragmentVector * theResult = new G4FragmentVector;
50 //theResult->push_back(new G4Fragment(theFragment));
51 return 0;
52 }
53
54
55 // Maximun average multiplicity: M_0 = 2.6 for A ~ 200
56 // and M_0 = 3.3 for A <= 110
57 G4double MaxAverageMultiplicity =
58 G4StatMFParameters::GetMaxAverageMultiplicity(theFragment.GetA_asInt());
59
60
61 // We'll use two kinds of ensembles
62 G4StatMFMicroCanonical * theMicrocanonicalEnsemble = 0;
63 G4StatMFMacroCanonical * theMacrocanonicalEnsemble = 0;
64
65 //-------------------------------------------------------
66 // Direct simulation part (Microcanonical ensemble)
67 //-------------------------------------------------------
68
69 // Microcanonical ensemble initialization
70 theMicrocanonicalEnsemble = new G4StatMFMicroCanonical(theFragment);
71
72 G4int Iterations = 0;
73 G4int IterationsLimit = 100000;
74 G4double Temperature = 0.0;
75
76 G4bool FirstTime = true;
77 G4StatMFChannel * theChannel = 0;
78
79 G4bool ChannelOk;
80 do { // Try to de-excite as much as IterationLimit permits
81 do {
82
83 G4double theMeanMult = theMicrocanonicalEnsemble->GetMeanMultiplicity();
84 if (theMeanMult <= MaxAverageMultiplicity) {
85 // G4cout << "MICROCANONICAL" << G4endl;
86 // Choose fragments atomic numbers and charges from direct simulation
87 theChannel = theMicrocanonicalEnsemble->ChooseAandZ(theFragment);
88 _theEnsemble = theMicrocanonicalEnsemble;
89 } else {
90 //-----------------------------------------------------
91 // Non direct simulation part (Macrocanonical Ensemble)
92 //-----------------------------------------------------
93 if (FirstTime) {
94 // Macrocanonical ensemble initialization
95 theMacrocanonicalEnsemble = new G4StatMFMacroCanonical(theFragment);
96 _theEnsemble = theMacrocanonicalEnsemble;
97 FirstTime = false;
98 }
99 // G4cout << "MACROCANONICAL" << G4endl;
100 // Select calculated fragment total multiplicity,
101 // fragment atomic numbers and fragment charges.
102 theChannel = theMacrocanonicalEnsemble->ChooseAandZ(theFragment);
103 }
104
105 ChannelOk = theChannel->CheckFragments();
106 if (!ChannelOk) delete theChannel;
107
108 // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
109 } while (!ChannelOk);
110
111
112 if (theChannel->GetMultiplicity() <= 1) {
113 G4FragmentVector * theResult = new G4FragmentVector;
114 theResult->push_back(new G4Fragment(theFragment));
115 delete theMicrocanonicalEnsemble;
116 if (theMacrocanonicalEnsemble != 0) delete theMacrocanonicalEnsemble;
117 delete theChannel;
118 return theResult;
119 }
120
121 //--------------------------------------
122 // Second part of simulation procedure.
123 //--------------------------------------
124
125 // Find temperature of breaking channel.
126 Temperature = _theEnsemble->GetMeanTemperature(); // Initial guess for Temperature
127
128 if (FindTemperatureOfBreakingChannel(theFragment,theChannel,Temperature)) break;
129
130 // Do not forget to delete this unusable channel, for which we failed to find the temperature,
131 // otherwise for very proton-reach nuclei it would lead to memory leak due to large
132 // number of iterations. N.B. "theChannel" is created in G4StatMFMacroCanonical::ChooseZ()
133
134 // G4cout << " Iteration # " << Iterations << " Mean Temperature = " << Temperature << G4endl;
135
136 delete theChannel;
137
138 // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
139 } while (Iterations++ < IterationsLimit );
140
141
142
143 // If Iterations >= IterationsLimit means that we couldn't solve for temperature
144 if (Iterations >= IterationsLimit)
145 throw G4HadronicException(__FILE__, __LINE__, "G4StatMF::BreakItUp: Was not possible to solve for temperature of breaking channel");
146
147
148 G4FragmentVector * theResult = theChannel->
149 GetFragments(theFragment.GetA_asInt(),theFragment.GetZ_asInt(),Temperature);
150
151
152
153 // ~~~~~~ Energy conservation Patch !!!!!!!!!!!!!!!!!!!!!!
154 // Original nucleus 4-momentum in CM system
155 G4LorentzVector InitialMomentum(theFragment.GetMomentum());
156 InitialMomentum.boost(-InitialMomentum.boostVector());
157 G4double ScaleFactor = 0.0;
158 G4double SavedScaleFactor = 0.0;
159 do {
160 G4double FragmentsEnergy = 0.0;
161 G4FragmentVector::iterator j;
162 for (j = theResult->begin(); j != theResult->end(); j++)
163 FragmentsEnergy += (*j)->GetMomentum().e();
164 SavedScaleFactor = ScaleFactor;
165 ScaleFactor = InitialMomentum.e()/FragmentsEnergy;
166 G4ThreeVector ScaledMomentum(0.0,0.0,0.0);
167 for (j = theResult->begin(); j != theResult->end(); j++) {
168 ScaledMomentum = ScaleFactor * (*j)->GetMomentum().vect();
169 G4double Mass = (*j)->GetMomentum().m();
170 G4LorentzVector NewMomentum;
171 NewMomentum.setVect(ScaledMomentum);
172 NewMomentum.setE(std::sqrt(ScaledMomentum.mag2()+Mass*Mass));
173 (*j)->SetMomentum(NewMomentum);
174 }
175 // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
176 } while (ScaleFactor > 1.0+1.e-5 && std::abs(ScaleFactor-SavedScaleFactor)/ScaleFactor > 1.e-10);
177 // ~~~~~~ End of patch !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
178
179 // Perform Lorentz boost
180 G4FragmentVector::iterator i;
181 for (i = theResult->begin(); i != theResult->end(); i++) {
182 G4LorentzVector FourMom = (*i)->GetMomentum();
183 FourMom.boost(theFragment.GetMomentum().boostVector());
184 (*i)->SetMomentum(FourMom);
185 }
186
187 // garbage collection
188 delete theMicrocanonicalEnsemble;
189 if (theMacrocanonicalEnsemble != 0) delete theMacrocanonicalEnsemble;
190 delete theChannel;
191
192 return theResult;
193}
std::vector< G4Fragment * > G4FragmentVector
Definition: G4Fragment.hh:63
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
HepLorentzVector & boost(double, double, double)
void setVect(const Hep3Vector &)
G4bool CheckFragments(void)
size_t GetMultiplicity(void)
G4StatMFChannel * ChooseAandZ(const G4Fragment &theFragment)
G4StatMFChannel * ChooseAandZ(const G4Fragment &theFragment)
static G4double GetMaxAverageMultiplicity(G4int A)
G4double GetMeanTemperature(void) const
G4double GetMeanMultiplicity(void) const

The documentation for this class was generated from the following files: