Geant4 10.7.0
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 ()
 
- Public Member Functions inherited from G4CascadeColliderBase
 G4CascadeColliderBase (const G4String &name, G4int verbose=0)
 
virtual ~G4CascadeColliderBase ()
 
virtual void rescatter (G4InuclParticle *, G4KineticTrackVector *, G4V3DNucleus *, G4CollisionOutput &)
 
virtual void setVerboseLevel (G4int verbose=0)
 
- Public Member Functions inherited from G4VCascadeCollider
 G4VCascadeCollider (const G4String &name, G4int verbose=0)
 
virtual ~G4VCascadeCollider ()
 
virtual void collide (G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)=0
 
virtual void setVerboseLevel (G4int verbose=0)
 

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 ( )

◆ ~G4InuclCollider()

G4InuclCollider::~G4InuclCollider ( )
virtual

Definition at line 93 of file G4InuclCollider.cc.

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

Member Function Documentation

◆ collide()

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

Implements G4VCascadeCollider.

Definition at line 130 of file G4InuclCollider.cc.

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

317 {
318 if (fragment.GetA_asInt() <= 1) return; // Nothing real to be de-excited
319
320 if (verboseLevel) G4cout << " >>> G4InuclCollider::deexcite" << G4endl;
321
322 const G4int itry_max = 10; // Maximum number of attempts
323 G4int itry = 0;
324 do { /* Loop checking 08.06.2015 MHK */
325 if (verboseLevel > 2) G4cout << " deexcite itry " << itry << G4endl;
326
327 DEXoutput.reset();
328 theDeexcitation->deExcite(fragment, DEXoutput);
329
330 } while (!validateOutput(fragment, DEXoutput) && (++itry < itry_max));
331 // Add de-excitation products to output buffer
332 globalOutput.add(DEXoutput);
333}
virtual G4bool validateOutput(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
G4int GetA_asInt() const
Definition: G4Fragment.hh:258
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 338 of file G4InuclCollider.cc.

338 {
339 if (interCase.twoNuclei()) return true; // A-A is not photonuclear
340
343 if (!bullet || !(bullet->isPhoton() || bullet->isElectron())) return true;
344
345 if (verboseLevel>1)
346 G4cout << " >>> G4InuclCollider::photonuclearOkay" << G4endl;
347
348 if (bullet->getKineticEnergy() > 0.050) return true;
349
350 if (verboseLevel>2) {
351 if (checkOutput.numberOfOutgoingNuclei() > 0) {
352 G4cout << " comparing final nucleus with initial target:\n"
353 << checkOutput.getOutgoingNuclei()[0] << G4endl
354 << *(interCase.getTarget()) << G4endl;
355 } else {
356 G4cout << " no final nucleus remains when target was "
357 << *(interCase.getTarget()) << G4endl;
358 }
359 }
360
361 // Hadron production changes target nucleus
362 G4double mfinalNuc = 0.0;
363 if (checkOutput.numberOfOutgoingNuclei() > 0)
364 mfinalNuc = checkOutput.getOutgoingNuclei()[0].getMass();
365 G4double mtargetNuc = interCase.getTarget()->getMass();
366 if (mfinalNuc != mtargetNuc) return true; // Mass from G4Ions is fixed
367
368 if (verboseLevel>2)
369 G4cout << " photonuclear produced only gammas. Try again." << G4endl;
370
371 return false; // Final state is entirely de-excitation photons
372}
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 288 of file G4InuclCollider.cc.

291 {
292 if (verboseLevel) G4cout << " >>> G4InuclCollider::rescatter" << G4endl;
293
294 G4int itry=1; // For diagnostic post-processing only
295 if (verboseLevel > 2) G4cout << " InuclCollider itry " << itry << G4endl;
296
297 globalOutput.reset(); // Clear buffers for this attempt
298 output.reset();
299
300 theIntraNucleiCascader->rescatter(bullet, theSecondaries, theNucleus,
301 output);
302
303 if (verboseLevel > 1) G4cout << " After Rescatter" << G4endl;
304
305 deexcite(output.getRecoilFragment(), output);
306 output.removeRecoilFragment();
307
308 globalOutput.add(output); // Add local results to global output
309
310 if (verboseLevel)
311 G4cout << " InuclCollider output after trials " << itry << G4endl;
312}
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 101 of file G4InuclCollider.cc.

101 {
103
104 theElementaryParticleCollider->setVerboseLevel(verboseLevel);
105 theIntraNucleiCascader->setVerboseLevel(verboseLevel);
106 theDeexcitation->setVerboseLevel(verboseLevel);
107
109 DEXoutput.setVerboseLevel(verboseLevel);
110}
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().

◆ useCascadeDeexcitation()

void G4InuclCollider::useCascadeDeexcitation ( )

Definition at line 115 of file G4InuclCollider.cc.

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

Referenced by G4CascadeInterface::useCascadeDeexcitation().

◆ usePreCompoundDeexcitation()

void G4InuclCollider::usePreCompoundDeexcitation ( )

Definition at line 121 of file G4InuclCollider.cc.

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

Referenced by G4CascadeInterface::usePreCompoundDeexcitation().


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