Main method to apply the INCL physics model.
177{
185
186
187 if((isIonTrack && ((trackZ<=0 && trackL==0) || trackA<=trackZ)) ||
188 (nucleusA>1 && (nucleusZ<=0 || nucleusA<=nucleusZ))) {
193 return &theResult;
194 }
195
196
197 if(trackA<=1 && nucleusA<=1) {
198 return theBackupModelNucleon->
ApplyYourself(aTrack, theNucleus);
199 }
200
201
202
204 if(trackA > theMaxProjMassINCL && nucleusA > theMaxProjMassINCL) {
205 if(!complainedAboutBackupModel) {
206 complainedAboutBackupModel = true;
207 std::stringstream ss;
208 ss << "INCL++ refuses to handle reactions between nuclei with A>"
209 << theMaxProjMassINCL
210 << ". A backup model ("
212 << ") will be used instead.";
214 }
216 }
217
218
222 && trackKinE < cascadeMinEnergyPerNucleon) {
223 if(!complainedAboutPreCompound) {
224 complainedAboutPreCompound = true;
225 std::stringstream ss;
226 ss << "INCL++ refuses to handle nucleon-induced reactions below "
227 << cascadeMinEnergyPerNucleon / MeV
228 << " MeV. A PreCoumpound model ("
230 << ") will be used instead.";
232 }
233 return thePreCompoundModel->
ApplyYourself(aTrack, theNucleus);
234 }
235
236
239 const G4double theTrackEnergy = trackKinE + theTrackMass;
240 const G4double theTrackMomentumAbs2 = theTrackEnergy*theTrackEnergy - theTrackMass*theTrackMass;
241 const G4double theTrackMomentumAbs = ((theTrackMomentumAbs2>0.0) ? std::sqrt(theTrackMomentumAbs2) : 0.0);
243
246 fourMomentumIn.
setE(theTrackEnergy + theNucleusMass);
247 fourMomentumIn.
setVect(theTrackMomentum);
248
249
250 const G4bool inverseKinematics = AccurateProjectile(aTrack, theNucleus);
251
252
256 G4Nucleus *theTargetNucleus = &theNucleus;
257 if(inverseKinematics) {
260
261 if(oldProjectileDef != 0 && oldTargetDef != 0) {
265 if(newTargetA > 0 && newTargetZ > 0) {
266
267 theTargetNucleus =
new G4Nucleus(newTargetA, newTargetZ, newTargetL);
270 G4DynamicParticle swappedProjectileParticle(oldTargetDef, (*toInverseKinematics) * theProjectile4Momentum);
272 } else {
273 G4String message =
"badly defined target after swapping. Falling back to normal (non-swapped) mode.";
276 }
277 } else {
278 G4String message =
"oldProjectileDef or oldTargetDef was null";
281 }
282 }
283
284
285
286
287
289
290
291
292
293
294
295
296
297
303
304
305
306
307
308
309
310
313
314 std::list<G4Fragment> remnants;
315
316 const G4int maxTries = 200;
318
319
320
322 do {
324 const G4double kineticEnergy = toINCLKineticEnergy(*aProjectileTrack);
325
326
328
332 -theTargetNucleus->
GetL());
333
335 if(eventIsOK) {
336
337
338
339 if(inverseKinematics) {
341 }
342
344
350
356 if(p != 0) {
358
359
360 momentum *= toLabFrame;
361
362 if(inverseKinematics) {
363 momentum *= *toDirectKinematics;
365 }
366
367
369 fourMomentumOut += momentum;
370
371
376 }
377 secondary.SetParentResonanceDef(parentResonanceDef);
379
381
382 } else {
383 G4String message =
"the model produced a particle that couldn't be converted to Geant4 particle.";
385 }
386 }
387
392
393
394 if((
Z == 0 &&
S == 0 &&
A > 1 ) ||
395 (
Z == 0 &&
S != 0 &&
A < 4 ) ||
396 (
Z != 0 &&
S != 0 &&
A ==
Z + std::abs(
S) )) {
397 std::stringstream ss;
398 ss <<
"unphysical residual fragment : Z=" <<
Z <<
" S=" <<
S <<
" A=" <<
A
399 << " skipping it and resampling the collision";
401 eventIsOK = false;
402 continue;
403 }
409 eventInfo.
jxRem[i]*hbar_Planck,
410 eventInfo.
jyRem[i]*hbar_Planck,
411 eventInfo.
jzRem[i]*hbar_Planck
412 );
417 } else {
418
420 }
421 const G4double scaling = remnant4MomentumScaling(nuclearMass, kinE, px, py, pz);
423 nuclearMass + kinE);
424 if(std::abs(scaling - 1.0) > 0.01) {
425 std::stringstream ss;
426 ss << "momentum scaling = " << scaling
427 << "\n Lorentz vector = " << fourMomentum
428 <<
")\n A = " <<
A <<
", Z = " <<
Z <<
", S = " <<
S
429 << "\n E* = " << excitationE << ", nuclearMass = " << nuclearMass
430 <<
"\n remnant i=" << i <<
", nRemnants=" << eventInfo.
nRemnants
434 << ", in " << (inverseKinematics ? "inverse" : "direct") << " kinematics.";
436 }
437
438
439 fourMomentum *= toLabFrame;
440 spin *= toLabFrame3;
441
442 if(inverseKinematics) {
443 fourMomentum *= *toDirectKinematics;
444 fourMomentum.setVect(-fourMomentum.vect());
445 }
446
447 fourMomentumOut += fourMomentum;
449 remnant.SetAngularMomentum(spin);
450 remnant.SetCreatorModelID(secID);
451 if(dumpRemnantInfo) {
452 G4cerr <<
"G4INCLXX_DUMP_REMNANT: " << remnant <<
" spin: " << spin <<
G4endl;
453 }
454 remnants.push_back(remnant);
455 }
456
457
458 if(!eventIsOK) {
463 remnants.clear();
464 } else {
465
466 const G4LorentzVector violation4Momentum = fourMomentumOut - fourMomentumIn;
467 const G4double energyViolation = std::abs(violation4Momentum.
e());
468 const G4double momentumViolation = violation4Momentum.
rho();
470 std::stringstream ss;
471 ss << "energy conservation violated by " << energyViolation/MeV << " MeV in "
474 << " inelastic reaction, in " << (inverseKinematics ? "inverse" : "direct") << " kinematics. Will resample.";
476 eventIsOK = false;
481 remnants.clear();
483 std::stringstream ss;
484 ss << "momentum conservation violated by " << momentumViolation/MeV << " MeV in "
487 << " inelastic reaction, in " << (inverseKinematics ? "inverse" : "direct") << " kinematics. Will resample.";
489 eventIsOK = false;
494 remnants.clear();
495 }
496 }
497 }
498 nTries++;
499 } while(!eventIsOK && nTries < maxTries);
500
501
502 if(inverseKinematics) {
503 delete aProjectileTrack;
504 delete theTargetNucleus;
505 delete toInverseKinematics;
506 delete toDirectKinematics;
507 }
508
509 if(!eventIsOK) {
510 std::stringstream ss;
511 ss << "maximum number of tries exceeded for the proposed "
513 <<
" + " << theIonTable->
GetIonName(nucleusZ, nucleusA, 0)
514 << " inelastic reaction, in " << (inverseKinematics ? "inverse" : "direct") << " kinematics.";
519 return &theResult;
520 }
521
522
523
525 for(std::list<G4Fragment>::iterator i = remnants.begin();
526 i != remnants.end(); ++i) {
528
529 for(G4ReactionProductVector::iterator fragment = deExcitationResult->begin();
530 fragment != deExcitationResult->end(); ++fragment) {
532 if(def != 0) {
534 theResult.
AddSecondary(theFragment, (*fragment)->GetCreatorModelID());
535 }
536 }
537
538 for(G4ReactionProductVector::iterator fragment = deExcitationResult->begin();
539 fragment != deExcitationResult->end(); ++fragment) {
540 delete (*fragment);
541 }
542 deExcitationResult->clear();
543 delete deExcitationResult;
544 }
545 }
546
547 remnants.clear();
548
549 if((theTally = theInterfaceStore->
GetTally()))
550 theTally->
Tally(aTrack, theNucleus, theResult);
551
552 return &theResult;
553}
G4double S(G4double temp)
CLHEP::HepLorentzRotation G4LorentzRotation
std::vector< G4ReactionProduct * > G4ReactionProductVector
G4GLOB_DLL std::ostream G4cerr
HepLorentzRotation inverse() const
void setVect(const Hep3Vector &)
HepRotation inverse() const
HepRotation & rotateZ(double delta)
HepRotation & rotateY(double delta)
G4LorentzVector Get4Momentum() const
void Set4Momentum(const G4LorentzVector &momentum)
static G4GenericIon * GenericIon()
void SetStatusChange(G4HadFinalStateStatus aS)
void AddSecondary(G4DynamicParticle *aP, G4int mod=-1)
std::size_t GetNumberOfSecondaries() const
void SetEnergyChange(G4double anEnergy)
G4HadSecondary * GetSecondary(size_t i)
void SetMomentumChange(const G4ThreeVector &aV)
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4LorentzVector & Get4Momentum() const
G4DynamicParticle * GetParticle()
virtual G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)
const G4String & GetModelName() const
static G4double GetNuclearMass(G4int A, G4int Z, G4int L)
G4int GetMaxProjMassINCL() const
Getter for theMaxProjMassINCL.
G4INCL::INCL * GetINCLModel()
Get the cached INCL model engine.
G4double GetConservationTolerance() const
Getter for conservationTolerance.
G4double GetCascadeMinEnergyPerNucleon() const
Getter for cascadeMinEnergyPerNucleon.
G4INCLXXVInterfaceTally * GetTally() const
Getter for the interface tally.
virtual void Tally(G4HadProjectile const &aTrack, G4Nucleus const &theNucleus, G4HadFinalState const &result)=0
const EventInfo & processEvent()
const G4String & GetIonName(G4int Z, G4int A, G4int lvl=0) const
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
G4double GetIonMass(G4int Z, G4int A, G4int nL=0, G4int lvl=0) const
static G4Neutron * NeutronDefinition()
static G4double GetNuclearMass(const G4double A, const G4double Z)
G4int GetAtomicNumber() const
const G4String & GetParticleType() const
G4double GetPDGMass() const
G4int GetAtomicMass() const
G4double GetPDGCharge() const
G4int GetNumberOfLambdasInHypernucleus() const
const G4String & GetParticleName() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
static G4Proton * ProtonDefinition()
virtual G4ReactionProductVector * DeExcite(G4Fragment &aFragment)=0
Short_t S[maxSizeParticles]
Particle strangeness number.
Int_t parentResonancePDGCode[maxSizeParticles]
Particle's parent resonance PDG code.
Short_t nRemnants
Number of remnants.
Bool_t transparent
True if the event is transparent.
Short_t A[maxSizeParticles]
Particle mass number.
Float_t EKinRem[maxSizeRemnants]
Remnant kinetic energy [MeV].
Int_t parentResonanceID[maxSizeParticles]
Particle's parent resonance unique ID identifier.
Float_t jzRem[maxSizeRemnants]
Remnant angular momentum, z component [ ].
Float_t EStarRem[maxSizeRemnants]
Remnant excitation energy [MeV].
Short_t Z[maxSizeParticles]
Particle charge number.
Float_t EKin[maxSizeParticles]
Particle kinetic energy [MeV].
Short_t nParticles
Number of particles in the final state.
Float_t jxRem[maxSizeRemnants]
Remnant angular momentum, x component [ ].
Float_t px[maxSizeParticles]
Particle momentum, x component [MeV/c].
Short_t SRem[maxSizeRemnants]
Remnant strangeness number.
Float_t pxRem[maxSizeRemnants]
Remnant momentum, x component [MeV/c].
Float_t pyRem[maxSizeRemnants]
Remnant momentum, y component [MeV/c].
Float_t pzRem[maxSizeRemnants]
Remnant momentum, z component [MeV/c].
Float_t pz[maxSizeParticles]
Particle momentum, z component [MeV/c].
Int_t PDGCode[maxSizeParticles]
PDG numbering of the particles.
Float_t jyRem[maxSizeRemnants]
Remnant angular momentum, y component [ ].
Float_t py[maxSizeParticles]
Particle momentum, y component [MeV/c].
Short_t ARem[maxSizeRemnants]
Remnant mass number.
Short_t ZRem[maxSizeRemnants]
Remnant charge number.