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

#include <G4InuclCollider.hh>

+ Inheritance diagram for G4InuclCollider:

Public Member Functions

 G4InuclCollider ()
 
virtual ~G4InuclCollider ()
 
void collide (G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &globalOutput)
 
void rescatter (G4InuclParticle *bullet, G4KineticTrackVector *theSecondaries, G4V3DNucleus *theNucleus, G4CollisionOutput &globalOutput)
 
void setVerboseLevel (G4int verbose=0)
 
void useCascadeDeexcitation ()
 
void usePreCompoundDeexcitation ()
 
void useAblaDeexcitation ()
 
- Public Member Functions inherited from G4CascadeColliderBase
 G4CascadeColliderBase (const G4String &name, G4int verbose=0)
 
virtual ~G4CascadeColliderBase ()
 
- Public Member Functions inherited from G4VCascadeCollider
 G4VCascadeCollider (const G4String &name, G4int verbose=0)
 
virtual ~G4VCascadeCollider ()
 

Protected Member Functions

void deexcite (const G4Fragment &fragment, G4CollisionOutput &globalOutput)
 
G4bool photonuclearOkay (G4CollisionOutput &checkOutput) const
 
- Protected Member Functions inherited from G4CascadeColliderBase
virtual G4bool useEPCollider (G4InuclParticle *bullet, G4InuclParticle *target) const
 
virtual G4bool inelasticInteractionPossible (G4InuclParticle *bullet, G4InuclParticle *target, G4double ekin) const
 
virtual G4bool validateOutput (G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
 
virtual G4bool validateOutput (const G4Fragment &fragment, G4CollisionOutput &output)
 
virtual G4bool validateOutput (G4InuclParticle *bullet, G4InuclParticle *target, const std::vector< G4InuclElementaryParticle > &particles)
 
- Protected Member Functions inherited from G4VCascadeCollider
virtual void setName (const G4String &name)
 

Additional Inherited Members

- Protected Attributes inherited from G4CascadeColliderBase
G4InteractionCase interCase
 
G4CascadeCheckBalancebalance
 
- Protected Attributes inherited from G4VCascadeCollider
G4String theName
 
G4int verboseLevel
 

Detailed Description

Definition at line 60 of file G4InuclCollider.hh.

Constructor & Destructor Documentation

◆ G4InuclCollider()

G4InuclCollider::G4InuclCollider ( )

Definition at line 88 of file G4InuclCollider.cc.

89 : G4CascadeColliderBase("G4InuclCollider"),
90 theElementaryParticleCollider(new G4ElementaryParticleCollider),
91 theIntraNucleiCascader(new G4IntraNucleiCascader),
92 theDeexcitation(new G4PreCompoundDeexcitation) {}
G4CascadeColliderBase(const G4String &name, G4int verbose=0)

◆ ~G4InuclCollider()

G4InuclCollider::~G4InuclCollider ( )
virtual

Definition at line 94 of file G4InuclCollider.cc.

94 {
95 delete theElementaryParticleCollider;
96 delete theIntraNucleiCascader;
97 delete theDeexcitation;
98}

Member Function Documentation

◆ collide()

void G4InuclCollider::collide ( G4InuclParticle * bullet,
G4InuclParticle * target,
G4CollisionOutput & globalOutput )
virtual

Implements G4VCascadeCollider.

Definition at line 137 of file G4InuclCollider.cc.

138 {
139 if (verboseLevel) G4cout << " >>> G4InuclCollider::collide" << G4endl;
140
141 const G4int itry_max = 100;
142
143 // Particle-on-particle collision; no nucleus involved
144 if (useEPCollider(bullet,target)) {
145 if (verboseLevel > 2)
146 G4cout << " InuclCollider -> particle on particle collision" << G4endl;
147
148 theElementaryParticleCollider->collide(bullet, target, globalOutput);
149 return;
150 }
151
152 interCase.set(bullet,target); // Classify collision type
153 if (verboseLevel > 2) {
154 G4cout << " InuclCollider -> inter case " << interCase.code() << G4endl;
155 }
156
157 if (!interCase.valid()) {
158 if (verboseLevel > 1)
159 G4cerr << " InuclCollider -> no collision possible " << G4endl;
160
161 globalOutput.trivialise(bullet, target);
162 return;
163 }
164
165 // Target must be a nucleus
166 G4InuclNuclei* ntarget = dynamic_cast<G4InuclNuclei*>(interCase.getTarget());
167 if (!ntarget) {
168 G4cerr << " InuclCollider -> ERROR target is not a nucleus " << G4endl;
169
170 globalOutput.trivialise(bullet, target);
171 return;
172 }
173
174 G4int btype = 0;
175 G4int ab = 0;
176 G4int zb = 0;
177
178 if (interCase.hadNucleus()) { // particle with nuclei
179 G4InuclElementaryParticle* pbullet =
181
182 if (!pbullet) {
183 G4cerr << " InuclCollider -> ERROR bullet is not a hadron " << G4endl;
184 globalOutput.trivialise(bullet, target);
185 return;
186 }
187
188 if (!G4CascadeChannelTables::GetTable(pbullet->type())) {
189 G4cerr << " InuclCollider -> ERROR can not collide with "
190 << pbullet->getDefinition()->GetParticleName() << G4endl;
191 globalOutput.trivialise(bullet, target);
192 return;
193 }
194
195 btype = pbullet->type();
196 } else { // nuclei with nuclei
197 G4InuclNuclei* nbullet =
198 dynamic_cast<G4InuclNuclei*>(interCase.getBullet());
199 if (!nbullet) {
200 G4cerr << " InuclCollider -> ERROR bullet is not a nucleus " << G4endl;
201 globalOutput.trivialise(bullet, target);
202 return;
203 }
204
205 ab = nbullet->getA();
206 zb = nbullet->getZ();
207 }
208
209 G4LorentzConvertor convertToTargetRestFrame(bullet, ntarget);
210 G4double ekin = convertToTargetRestFrame.getKinEnergyInTheTRS();
211
212 if (verboseLevel > 3) G4cout << " ekin in trs " << ekin << G4endl;
213
214 if (!inelasticInteractionPossible(bullet, target, ekin)) {
215 if (verboseLevel > 3)
216 G4cout << " InuclCollider -> inelastic interaction is impossible\n"
217 << " due to the coulomb barirer " << G4endl;
218
219 globalOutput.trivialise(bullet, target);
220 return;
221 }
222
223 // Generate interaction secondaries in rest frame of target nucleus
224 convertToTargetRestFrame.toTheTargetRestFrame();
225 if (verboseLevel > 3) {
226 G4cout << " degenerated? " << convertToTargetRestFrame.trivial()
227 << G4endl;
228 }
229
230 G4LorentzVector bmom; // Bullet is along local Z
231 bmom.setZ(convertToTargetRestFrame.getTRSMomentum());
232
233 // Need to make copy of bullet with momentum realigned
234 G4InuclParticle* zbullet = 0;
235 if (interCase.hadNucleus())
236 zbullet = new G4InuclElementaryParticle(bmom, btype);
237 else
238 zbullet = new G4InuclNuclei(bmom, ab, zb);
239
240 G4int itry = 0;
241 while (itry < itry_max) { /* Loop checking 08.06.2015 MHK */
242 itry++;
243 if (verboseLevel > 2) G4cout << " InuclCollider itry " << itry << G4endl;
244
245 globalOutput.reset(); // Clear buffers for this attempt
246 output.reset();
247
248 theIntraNucleiCascader->collide(zbullet, target, output);
249
250 if (verboseLevel > 1) G4cout << " After Cascade " << G4endl;
251
252 deexcite(output.getRecoilFragment(), output);
253 output.removeRecoilFragment();
254
255 //*** TEMPORARY, USE ENVVAR TO ENABLE/DISABLE THIS TEST ***
256 if (std::getenv("G4CASCADE_CHECK_PHOTONUCLEAR"))
257 if (!photonuclearOkay(output)) continue;
258
259 if (verboseLevel > 2)
260 G4cout << " itry " << itry << " finished, moving to lab frame" << G4endl;
261
262 // convert to the LAB frame and add to final result
263 output.boostToLabFrame(convertToTargetRestFrame);
264
265 globalOutput.add(output);
266
267 // Adjust final state particles to balance momentum and energy
268 // FIXME: This should no longer be necessary!
269 globalOutput.setOnShell(bullet, target);
270 if (globalOutput.acceptable()) {
271 if (verboseLevel)
272 G4cout << " InuclCollider output after trials " << itry << G4endl;
273 delete zbullet;
274 return;
275 } else {
276 if (verboseLevel>2)
277 G4cerr << " InuclCollider setOnShell failed." << G4endl;
278 }
279 } // while (itry < itry_max)
280
281 if (verboseLevel) {
282 G4cout << " InuclCollider -> can not generate acceptable inter. after "
283 << itry_max << " attempts " << G4endl;
284 }
285
286 globalOutput.trivialise(bullet, target);
287
288 delete zbullet;
289 return;
290}
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static const G4CascadeChannel * GetTable(G4int initialState)
virtual G4bool useEPCollider(G4InuclParticle *bullet, G4InuclParticle *target) const
virtual G4bool inelasticInteractionPossible(G4InuclParticle *bullet, G4InuclParticle *target, G4double ekin) const
void removeRecoilFragment(G4int index=-1)
void boostToLabFrame(const G4LorentzConvertor &convertor)
const G4Fragment & getRecoilFragment(G4int index=0) const
void setOnShell(G4InuclParticle *bullet, G4InuclParticle *target)
G4bool acceptable() const
void add(const G4CollisionOutput &right)
void trivialise(G4InuclParticle *bullet, G4InuclParticle *target)
void collide(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
G4InuclParticle * getBullet() const
void set(G4InuclParticle *part1, G4InuclParticle *part2)
G4bool hadNucleus() const
G4InuclParticle * getTarget() const
void collide(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &globalOutput)
void deexcite(const G4Fragment &fragment, G4CollisionOutput &globalOutput)
G4bool photonuclearOkay(G4CollisionOutput &checkOutput) const
G4int getZ() const
G4int getA() const
const G4ParticleDefinition * getDefinition() const
const G4String & GetParticleName() const

Referenced by G4CascadeInterface::ApplyYourself().

◆ deexcite()

void G4InuclCollider::deexcite ( const G4Fragment & fragment,
G4CollisionOutput & globalOutput )
protected

Definition at line 323 of file G4InuclCollider.cc.

324 {
325 if (fragment.GetA_asInt() <= 1) return; // Nothing real to be de-excited
326
327 if (verboseLevel) G4cout << " >>> G4InuclCollider::deexcite" << G4endl;
328
329 const G4int itry_max = 10; // Maximum number of attempts
330 G4int itry = 0;
331 do { /* Loop checking 08.06.2015 MHK */
332 if (verboseLevel > 2) G4cout << " deexcite itry " << itry << G4endl;
333
334 DEXoutput.reset();
335 theDeexcitation->deExcite(fragment, DEXoutput);
336
337 } while (!validateOutput(fragment, DEXoutput) && (++itry < itry_max));
338 // Add de-excitation products to output buffer
339 globalOutput.add(DEXoutput);
340}
virtual G4bool validateOutput(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
G4int GetA_asInt() const
virtual void deExcite(const G4Fragment &fragment, G4CollisionOutput &output)=0

Referenced by collide(), and rescatter().

◆ photonuclearOkay()

G4bool G4InuclCollider::photonuclearOkay ( G4CollisionOutput & checkOutput) const
protected

Definition at line 345 of file G4InuclCollider.cc.

345 {
346 if (interCase.twoNuclei()) return true; // A-A is not photonuclear
347
350 if (!bullet || !(bullet->isPhoton() || bullet->isElectron())) return true;
351
352 if (verboseLevel>1)
353 G4cout << " >>> G4InuclCollider::photonuclearOkay" << G4endl;
354
355 if (bullet->getKineticEnergy() > 0.050) return true;
356
357 if (verboseLevel>2) {
358 if (checkOutput.numberOfOutgoingNuclei() > 0) {
359 G4cout << " comparing final nucleus with initial target:\n"
360 << checkOutput.getOutgoingNuclei()[0] << G4endl
361 << *(interCase.getTarget()) << G4endl;
362 } else {
363 G4cout << " no final nucleus remains when target was "
364 << *(interCase.getTarget()) << G4endl;
365 }
366 }
367
368 // Hadron production changes target nucleus
369 G4double mfinalNuc = 0.0;
370 if (checkOutput.numberOfOutgoingNuclei() > 0)
371 mfinalNuc = checkOutput.getOutgoingNuclei()[0].getMass();
372 G4double mtargetNuc = interCase.getTarget()->getMass();
373 if (mfinalNuc != mtargetNuc) return true; // Mass from G4Ions is fixed
374
375 if (verboseLevel>2)
376 G4cout << " photonuclear produced only gammas. Try again." << G4endl;
377
378 return false; // Final state is entirely de-excitation photons
379}
const std::vector< G4InuclNuclei > & getOutgoingNuclei() const
G4int numberOfOutgoingNuclei() const
G4bool twoNuclei() const
G4double getKineticEnergy() const
G4double getMass() const

Referenced by collide().

◆ rescatter()

void G4InuclCollider::rescatter ( G4InuclParticle * bullet,
G4KineticTrackVector * theSecondaries,
G4V3DNucleus * theNucleus,
G4CollisionOutput & globalOutput )
virtual

Reimplemented from G4CascadeColliderBase.

Definition at line 295 of file G4InuclCollider.cc.

298 {
299 if (verboseLevel) G4cout << " >>> G4InuclCollider::rescatter" << G4endl;
300
301 G4int itry=1; // For diagnostic post-processing only
302 if (verboseLevel > 2) G4cout << " InuclCollider itry " << itry << G4endl;
303
304 globalOutput.reset(); // Clear buffers for this attempt
305 output.reset();
306
307 theIntraNucleiCascader->rescatter(bullet, theSecondaries, theNucleus,
308 output);
309
310 if (verboseLevel > 1) G4cout << " After Rescatter" << G4endl;
311
312 deexcite(output.getRecoilFragment(), output);
313 output.removeRecoilFragment();
314
315 globalOutput.add(output); // Add local results to global output
316
317 if (verboseLevel)
318 G4cout << " InuclCollider output after trials " << itry << G4endl;
319}
void rescatter(G4InuclParticle *bullet, G4KineticTrackVector *theSecondaries, G4V3DNucleus *theNucleus, G4CollisionOutput &globalOutput)

Referenced by G4CascadeInterface::Propagate().

◆ setVerboseLevel()

void G4InuclCollider::setVerboseLevel ( G4int verbose = 0)
virtual

Reimplemented from G4CascadeColliderBase.

Definition at line 102 of file G4InuclCollider.cc.

102 {
104
105 theElementaryParticleCollider->setVerboseLevel(verboseLevel);
106 theIntraNucleiCascader->setVerboseLevel(verboseLevel);
107 theDeexcitation->setVerboseLevel(verboseLevel);
108
110 DEXoutput.setVerboseLevel(verboseLevel);
111}
virtual void setVerboseLevel(G4int verbose=0)
void setVerboseLevel(G4int verbose)
void setVerboseLevel(G4int verbose=0)
virtual void setVerboseLevel(G4int verbose=0)

Referenced by G4CascadeInterface::SetVerboseLevel().

◆ useAblaDeexcitation()

void G4InuclCollider::useAblaDeexcitation ( )

Definition at line 128 of file G4InuclCollider.cc.

128 {
129 delete theDeexcitation;
130 theDeexcitation = new G4AblaDeexcitation;
131 theDeexcitation->setVerboseLevel(verboseLevel);
132}

Referenced by G4CascadeInterface::useAblaDeexcitation().

◆ useCascadeDeexcitation()

void G4InuclCollider::useCascadeDeexcitation ( )

Definition at line 116 of file G4InuclCollider.cc.

116 {
117 delete theDeexcitation;
118 theDeexcitation = new G4CascadeDeexcitation;
119 theDeexcitation->setVerboseLevel(verboseLevel);
120}

Referenced by G4CascadeInterface::useCascadeDeexcitation().

◆ usePreCompoundDeexcitation()

void G4InuclCollider::usePreCompoundDeexcitation ( )

Definition at line 122 of file G4InuclCollider.cc.

122 {
123 delete theDeexcitation;
124 theDeexcitation = new G4PreCompoundDeexcitation;
125 theDeexcitation->setVerboseLevel(verboseLevel);
126}

Referenced by G4CascadeInterface::usePreCompoundDeexcitation().


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