Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4InuclCollider Class Reference

#include <G4InuclCollider.hh>

Inheritance diagram for G4InuclCollider:
Collaboration 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 ()
 
- 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 61 of file G4InuclCollider.hh.

Constructor & Destructor Documentation

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

Definition at line 94 of file G4InuclCollider.cc.

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

Member Function Documentation

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

Implements G4VCascadeCollider.

Definition at line 131 of file G4InuclCollider.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 319 of file G4InuclCollider.cc.

320  {
321  if (fragment.GetA_asInt() <= 1) return; // Nothing real to be de-excited
322 
323  if (verboseLevel) G4cout << " >>> G4InuclCollider::deexcite" << G4endl;
324 
325  const G4int itry_max = 10; // Maximum number of attempts
326  G4int itry = 0;
327  do { /* Loop checking 08.06.2015 MHK */
328  if (verboseLevel > 2) G4cout << " deexcite itry " << itry << G4endl;
329 
330  DEXoutput.reset();
331  theDeexcitation->deExcite(fragment, DEXoutput);
332  } while (!validateOutput(fragment, DEXoutput) && (++itry < itry_max));
333 
334  // Add de-excitation products to output buffer
335  globalOutput.add(DEXoutput);
336 }
int G4int
Definition: G4Types.hh:78
virtual void deExcite(const G4Fragment &fragment, G4CollisionOutput &output)=0
void add(const G4CollisionOutput &right)
G4GLOB_DLL std::ostream G4cout
G4int GetA_asInt() const
Definition: G4Fragment.hh:266
virtual G4bool validateOutput(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4InuclCollider::photonuclearOkay ( G4CollisionOutput checkOutput) const
protected

Definition at line 341 of file G4InuclCollider.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from G4CascadeColliderBase.

Definition at line 290 of file G4InuclCollider.cc.

293  {
294  if (verboseLevel) G4cout << " >>> G4InuclCollider::rescatter" << G4endl;
295 
296  G4int itry=1; // For diagnostic post-processing only
297  if (verboseLevel > 2) G4cout << " InuclCollider itry " << itry << G4endl;
298 
299  globalOutput.reset(); // Clear buffers for this attempt
300  output.reset();
301 
302  theIntraNucleiCascader->rescatter(bullet, theSecondaries, theNucleus,
303  output);
304 
305  if (verboseLevel > 1) G4cout << " After Rescatter" << G4endl;
306 
307  deexcite(output.getRecoilFragment(), output);
308  output.removeRecoilFragment();
309 
310  globalOutput.add(output); // Add local results to global output
311 
312  if (verboseLevel)
313  G4cout << " InuclCollider output after trials " << itry << G4endl;
314 }
void removeRecoilFragment(G4int index=-1)
void deexcite(const G4Fragment &fragment, G4CollisionOutput &globalOutput)
int G4int
Definition: G4Types.hh:78
void add(const G4CollisionOutput &right)
G4GLOB_DLL std::ostream G4cout
void rescatter(G4InuclParticle *bullet, G4KineticTrackVector *theSecondaries, G4V3DNucleus *theNucleus, G4CollisionOutput &globalOutput)
#define G4endl
Definition: G4ios.hh:61
const G4Fragment & getRecoilFragment(G4int index=0) const

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
void setVerboseLevel(G4int verbose)
virtual void setVerboseLevel(G4int verbose=0)
virtual void setVerboseLevel(G4int verbose=0)
void setVerboseLevel(G4int verbose=0)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4InuclCollider::useCascadeDeexcitation ( )

Definition at line 116 of file G4InuclCollider.cc.

116  {
117  delete theDeexcitation;
118  theDeexcitation = new G4CascadeDeexcitation;
119  theDeexcitation->setVerboseLevel(verboseLevel);
120 }
virtual void setVerboseLevel(G4int verbose=0)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4InuclCollider::usePreCompoundDeexcitation ( )

Definition at line 122 of file G4InuclCollider.cc.

122  {
123  delete theDeexcitation;
124  theDeexcitation = new G4PreCompoundDeexcitation;
125  theDeexcitation->setVerboseLevel(verboseLevel);
126 }
virtual void setVerboseLevel(G4int verbose=0)

Here is the call graph for this function:

Here is the caller graph for this function:


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