Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCLParticle.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// INCL++ intra-nuclear cascade model
27// Alain Boudard, CEA-Saclay, France
28// Joseph Cugnon, University of Liege, Belgium
29// Jean-Christophe David, CEA-Saclay, France
30// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
31// Sylvie Leray, CEA-Saclay, France
32// Davide Mancusi, CEA-Saclay, France
33//
34#define INCLXX_IN_GEANT4_MODE 1
35
36#include "globals.hh"
37
38/*
39 * G4INCLParticle.hh
40 *
41 * \date Jun 5, 2009
42 * \author Pekka Kaitaniemi
43 */
44
45#ifndef PARTICLE_HH_
46#define PARTICLE_HH_
47
48#include "G4INCLThreeVector.hh"
50#include "G4INCLParticleType.hh"
52#include "G4INCLLogger.hh"
55#include <sstream>
56#include <string>
57
58namespace G4INCL {
59
60 class Particle;
61
62 class ParticleList : public UnorderedVector<Particle*> {
63 public:
64 void rotatePositionAndMomentum(const G4double angle, const ThreeVector &axis) const;
65 void rotatePosition(const G4double angle, const ThreeVector &axis) const;
66 void rotateMomentum(const G4double angle, const ThreeVector &axis) const;
67 void boost(const ThreeVector &b) const;
69 std::vector<G4int> getParticleListBiasVector() const;
70 };
71
72 typedef ParticleList::const_iterator ParticleIter;
73 typedef ParticleList::iterator ParticleMutableIter;
74
75 class Particle {
76 public:
77 Particle();
78 Particle(ParticleType t, G4double energy, ThreeVector const &momentum, ThreeVector const &position);
79 Particle(ParticleType t, ThreeVector const &momentum, ThreeVector const &position);
80 virtual ~Particle() {}
81
82 /** \brief Copy constructor
83 *
84 * Does not copy the particle ID.
85 */
86 Particle(const Particle &rhs) :
87 theZ(rhs.theZ),
88 theA(rhs.theA),
89 theS(rhs.theS),
91 theType(rhs.theType),
98 nDecays(rhs.nDecays),
103 theNKaon(rhs.theNKaon),
104 theHelicity(rhs.theHelicity),
105 emissionTime(rhs.emissionTime),
106 outOfWell(rhs.outOfWell),
107 theMass(rhs.theMass)
108 {
109 if(rhs.thePropagationEnergy == &(rhs.theFrozenEnergy))
111 else
115 else
117 // ID intentionally not copied
118 ID = nextID++;
119
120 theBiasCollisionVector = rhs.theBiasCollisionVector;
121 }
122
123 protected:
124 /// \brief Helper method for the assignment operator
125 void swap(Particle &rhs) {
126 std::swap(theZ, rhs.theZ);
127 std::swap(theA, rhs.theA);
128 std::swap(theS, rhs.theS);
130 std::swap(theType, rhs.theType);
131 if(rhs.thePropagationEnergy == &(rhs.theFrozenEnergy))
133 else
135 std::swap(theEnergy, rhs.theEnergy);
136 std::swap(theFrozenEnergy, rhs.theFrozenEnergy);
139 else
141 std::swap(theMomentum, rhs.theMomentum);
142 std::swap(theFrozenMomentum, rhs.theFrozenMomentum);
143 std::swap(thePosition, rhs.thePosition);
144 std::swap(nCollisions, rhs.nCollisions);
145 std::swap(nDecays, rhs.nDecays);
147 // ID intentionally not swapped
148
149 std::swap(theHelicity, rhs.theHelicity);
150 std::swap(emissionTime, rhs.emissionTime);
151 std::swap(outOfWell, rhs.outOfWell);
152
153 std::swap(theMass, rhs.theMass);
154 std::swap(rpCorrelated, rhs.rpCorrelated);
156
157 std::swap(theParticleBias, rhs.theParticleBias);
158 std::swap(theBiasCollisionVector, rhs.theBiasCollisionVector);
159
160 }
161
162 public:
163
164 /** \brief Assignment operator
165 *
166 * Does not copy the particle ID.
167 */
169 Particle temporaryParticle(rhs);
170 swap(temporaryParticle);
171 return *this;
172 }
173
174 /**
175 * Get the particle type.
176 * @see G4INCL::ParticleType
177 */
179 return theType;
180 };
181
182 /// \brief Get the particle species
184 return ParticleSpecies(theType);
185 };
186
188 theType = t;
189 switch(theType)
190 {
191 case DeltaPlusPlus:
192 theA = 1;
193 theZ = 2;
194 theS = 0;
195 break;
196 case Proton:
197 case DeltaPlus:
198 theA = 1;
199 theZ = 1;
200 theS = 0;
201 break;
202 case Neutron:
203 case DeltaZero:
204 theA = 1;
205 theZ = 0;
206 theS = 0;
207 break;
208 case DeltaMinus:
209 theA = 1;
210 theZ = -1;
211 theS = 0;
212 break;
213 case PiPlus:
214 theA = 0;
215 theZ = 1;
216 theS = 0;
217 break;
218 case PiZero:
219 case Eta:
220 case Omega:
221 case EtaPrime:
222 case Photon:
223 theA = 0;
224 theZ = 0;
225 theS = 0;
226 break;
227 case PiMinus:
228 theA = 0;
229 theZ = -1;
230 theS = 0;
231 break;
232 case Lambda:
233 theA = 1;
234 theZ = 0;
235 theS = -1;
236 break;
237 case SigmaPlus:
238 theA = 1;
239 theZ = 1;
240 theS = -1;
241 break;
242 case SigmaZero:
243 theA = 1;
244 theZ = 0;
245 theS = -1;
246 break;
247 case SigmaMinus:
248 theA = 1;
249 theZ = -1;
250 theS = -1;
251 break;
252 case KPlus:
253 theA = 0;
254 theZ = 1;
255 theS = 1;
256 break;
257 case KZero:
258 theA = 0;
259 theZ = 0;
260 theS = 1;
261 break;
262 case KZeroBar:
263 theA = 0;
264 theZ = 0;
265 theS = -1;
266 break;
267 case KShort:
268 theA = 0;
269 theZ = 0;
270// theS should not be defined
271 break;
272 case KLong:
273 theA = 0;
274 theZ = 0;
275// theS should not be defined
276 break;
277 case KMinus:
278 theA = 0;
279 theZ = -1;
280 theS = -1;
281 break;
282 case Composite:
283 // INCL_ERROR("Trying to set particle type to Composite! Construct a Cluster object instead" << '\n');
284 theA = 0;
285 theZ = 0;
286 theS = 0;
287 break;
288 case UnknownParticle:
289 theA = 0;
290 theZ = 0;
291 theS = 0;
292 INCL_ERROR("Trying to set particle type to Unknown!" << '\n');
293 break;
294 }
295
296 if( !isResonance() && t!=Composite )
297 setINCLMass();
298 }
299
300 /**
301 * Is this a nucleon?
302 */
305 return true;
306 else
307 return false;
308 };
309
311 return theParticipantType;
312 }
313
316 }
317
320 }
321
324 }
325
328 }
329
330 virtual void makeParticipant() {
332 }
333
334 virtual void makeTargetSpectator() {
336 }
337
338 virtual void makeProjectileSpectator() {
340 }
341
342 /** \brief Is this a pion? */
343 G4bool isPion() const { return (theType == PiPlus || theType == PiZero || theType == PiMinus); }
344
345 /** \brief Is this an eta? */
346 G4bool isEta() const { return (theType == Eta); }
347
348 /** \brief Is this an omega? */
349 G4bool isOmega() const { return (theType == Omega); }
350
351 /** \brief Is this an etaprime? */
352 G4bool isEtaPrime() const { return (theType == EtaPrime); }
353
354 /** \brief Is this a photon? */
355 G4bool isPhoton() const { return (theType == Photon); }
356
357 /** \brief Is it a resonance? */
358 inline G4bool isResonance() const { return isDelta(); }
359
360 /** \brief Is it a Delta? */
361 inline G4bool isDelta() const {
362 return (theType==DeltaPlusPlus || theType==DeltaPlus ||
364
365 /** \brief Is this a Sigma? */
366 G4bool isSigma() const { return (theType == SigmaPlus || theType == SigmaZero || theType == SigmaMinus); }
367
368 /** \brief Is this a Kaon? */
369 G4bool isKaon() const { return (theType == KPlus || theType == KZero); }
370
371 /** \brief Is this an antiKaon? */
372 G4bool isAntiKaon() const { return (theType == KZeroBar || theType == KMinus); }
373
374 /** \brief Is this a Lambda? */
375 G4bool isLambda() const { return (theType == Lambda); }
376
377 /** \brief Is this a Nucleon or a Lambda? */
378 G4bool isNucleonorLambda() const { return (isNucleon() || isLambda()); }
379
380 /** \brief Is this an Hyperon? */
381 G4bool isHyperon() const { return (isLambda() || isSigma()); }
382
383 /** \brief Is this a Meson? */
384 G4bool isMeson() const { return (isPion() || isKaon() || isAntiKaon() || isEta() || isEtaPrime() || isOmega()); }
385
386 /** \brief Is this a Baryon? */
387 G4bool isBaryon() const { return (isNucleon() || isResonance() || isHyperon()); }
388
389 /** \brief Is this an Strange? */
390 G4bool isStrange() const { return (isKaon() || isAntiKaon() || isHyperon()); }
391
392 /** \brief Returns the baryon number. */
393 G4int getA() const { return theA; }
394
395 /** \brief Returns the charge number. */
396 G4int getZ() const { return theZ; }
397
398 /** \brief Returns the strangeness number. */
399 G4int getS() const { return theS; }
400
402 const G4double P = theMomentum.mag();
403 return P/theEnergy;
404 }
405
406 /**
407 * Returns a three vector we can give to the boost() -method.
408 *
409 * In order to go to the particle rest frame you need to multiply
410 * the boost vector by -1.0.
411 */
413 return theMomentum / theEnergy;
414 }
415
416 /**
417 * Boost the particle using a boost vector.
418 *
419 * Example (go to the particle rest frame):
420 * particle->boost(particle->boostVector());
421 */
422 void boost(const ThreeVector &aBoostVector) {
423 const G4double beta2 = aBoostVector.mag2();
424 const G4double gamma = 1.0 / std::sqrt(1.0 - beta2);
425 const G4double bp = theMomentum.dot(aBoostVector);
426 const G4double alpha = (gamma*gamma)/(1.0 + gamma);
427
428 theMomentum = theMomentum + aBoostVector * (alpha * bp - gamma * theEnergy);
429 theEnergy = gamma * (theEnergy - bp);
430 }
431
432 /** \brief Lorentz-contract the particle position around some center
433 *
434 * Apply Lorentz contraction to the position component along the
435 * direction of the boost vector.
436 *
437 * \param aBoostVector the boost vector (velocity) [c]
438 * \param refPos the reference position
439 */
440 void lorentzContract(const ThreeVector &aBoostVector, const ThreeVector &refPos) {
441 const G4double beta2 = aBoostVector.mag2();
442 const G4double gamma = 1.0 / std::sqrt(1.0 - beta2);
443 const ThreeVector theRelativePosition = thePosition - refPos;
444 const ThreeVector transversePosition = theRelativePosition - aBoostVector * (theRelativePosition.dot(aBoostVector) / aBoostVector.mag2());
445 const ThreeVector longitudinalPosition = theRelativePosition - transversePosition;
446
447 thePosition = refPos + transversePosition + longitudinalPosition / gamma;
448 }
449
450 /** \brief Get the cached particle mass. */
451 inline G4double getMass() const { return theMass; }
452
453 /** \brief Get the INCL particle mass. */
454 inline G4double getINCLMass() const {
455 switch(theType) {
456 case Proton:
457 case Neutron:
458 case PiPlus:
459 case PiMinus:
460 case PiZero:
461 case Lambda:
462 case SigmaPlus:
463 case SigmaZero:
464 case SigmaMinus:
465 case KPlus:
466 case KZero:
467 case KZeroBar:
468 case KShort:
469 case KLong:
470 case KMinus:
471 case Eta:
472 case Omega:
473 case EtaPrime:
474 case Photon:
476 break;
477
478 case DeltaPlusPlus:
479 case DeltaPlus:
480 case DeltaZero:
481 case DeltaMinus:
482 return theMass;
483 break;
484
485 case Composite:
487 break;
488
489 default:
490 INCL_ERROR("Particle::getINCLMass: Unknown particle type." << '\n');
491 return 0.0;
492 break;
493 }
494 }
495
496 /** \brief Get the tabulated particle mass. */
497 inline virtual G4double getTableMass() const {
498 switch(theType) {
499 case Proton:
500 case Neutron:
501 case PiPlus:
502 case PiMinus:
503 case PiZero:
504 case Lambda:
505 case SigmaPlus:
506 case SigmaZero:
507 case SigmaMinus:
508 case KPlus:
509 case KZero:
510 case KZeroBar:
511 case KShort:
512 case KLong:
513 case KMinus:
514 case Eta:
515 case Omega:
516 case EtaPrime:
517 case Photon:
519 break;
520
521 case DeltaPlusPlus:
522 case DeltaPlus:
523 case DeltaZero:
524 case DeltaMinus:
525 return theMass;
526 break;
527
528 case Composite:
530 break;
531
532 default:
533 INCL_ERROR("Particle::getTableMass: Unknown particle type." << '\n');
534 return 0.0;
535 break;
536 }
537 }
538
539 /** \brief Get the real particle mass. */
540 inline G4double getRealMass() const {
541 switch(theType) {
542 case Proton:
543 case Neutron:
544 case PiPlus:
545 case PiMinus:
546 case PiZero:
547 case Lambda:
548 case SigmaPlus:
549 case SigmaZero:
550 case SigmaMinus:
551 case KPlus:
552 case KZero:
553 case KZeroBar:
554 case KShort:
555 case KLong:
556 case KMinus:
557 case Eta:
558 case Omega:
559 case EtaPrime:
560 case Photon:
562 break;
563
564 case DeltaPlusPlus:
565 case DeltaPlus:
566 case DeltaZero:
567 case DeltaMinus:
568 return theMass;
569 break;
570
571 case Composite:
573 break;
574
575 default:
576 INCL_ERROR("Particle::getRealMass: Unknown particle type." << '\n');
577 return 0.0;
578 break;
579 }
580 }
581
582 /// \brief Set the mass of the Particle to its real mass
584
585 /// \brief Set the mass of the Particle to its table mass
587
588 /// \brief Set the mass of the Particle to its table mass
590
591 /**\brief Computes correction on the emission Q-value
592 *
593 * Computes the correction that must be applied to INCL particles in
594 * order to obtain the correct Q-value for particle emission from a given
595 * nucleus. For absorption, the correction is obviously equal to minus
596 * the value returned by this function.
597 *
598 * \param AParent the mass number of the emitting nucleus
599 * \param ZParent the charge number of the emitting nucleus
600 * \return the correction
601 */
602 G4double getEmissionQValueCorrection(const G4int AParent, const G4int ZParent) const {
603 const G4int SParent = 0;
604 const G4int ADaughter = AParent - theA;
605 const G4int ZDaughter = ZParent - theZ;
606 const G4int SDaughter = 0;
607
608 // Note the minus sign here
609 G4double theQValue;
610 if(isCluster())
611 theQValue = -ParticleTable::getTableQValue(theA, theZ, theS, ADaughter, ZDaughter, SDaughter);
612 else {
613 const G4double massTableParent = ParticleTable::getTableMass(AParent,ZParent,SParent);
614 const G4double massTableDaughter = ParticleTable::getTableMass(ADaughter,ZDaughter,SDaughter);
615 const G4double massTableParticle = getTableMass();
616 theQValue = massTableParent - massTableDaughter - massTableParticle;
617 }
618
619 const G4double massINCLParent = ParticleTable::getINCLMass(AParent,ZParent,SParent);
620 const G4double massINCLDaughter = ParticleTable::getINCLMass(ADaughter,ZDaughter,SDaughter);
621 const G4double massINCLParticle = getINCLMass();
622
623 // The rhs corresponds to the INCL Q-value
624 return theQValue - (massINCLParent-massINCLDaughter-massINCLParticle);
625 }
626
627 /**\brief Computes correction on the transfer Q-value
628 *
629 * Computes the correction that must be applied to INCL particles in
630 * order to obtain the correct Q-value for particle transfer from a given
631 * nucleus to another.
632 *
633 * Assumes that the receving nucleus is INCL's target nucleus, with the
634 * INCL separation energy.
635 *
636 * \param AFrom the mass number of the donating nucleus
637 * \param ZFrom the charge number of the donating nucleus
638 * \param ATo the mass number of the receiving nucleus
639 * \param ZTo the charge number of the receiving nucleus
640 * \return the correction
641 */
642 G4double getTransferQValueCorrection(const G4int AFrom, const G4int ZFrom, const G4int ATo, const G4int ZTo) const {
643 const G4int SFrom = 0;
644 const G4int STo = 0;
645 const G4int AFromDaughter = AFrom - theA;
646 const G4int ZFromDaughter = ZFrom - theZ;
647 const G4int SFromDaughter = 0;
648 const G4int AToDaughter = ATo + theA;
649 const G4int ZToDaughter = ZTo + theZ;
650 const G4int SToDaughter = 0;
651 const G4double theQValue = ParticleTable::getTableQValue(AToDaughter,ZToDaughter,SToDaughter,AFromDaughter,ZFromDaughter,SFromDaughter,AFrom,ZFrom,SFrom);
652
653 const G4double massINCLTo = ParticleTable::getINCLMass(ATo,ZTo,STo);
654 const G4double massINCLToDaughter = ParticleTable::getINCLMass(AToDaughter,ZToDaughter,SToDaughter);
655 /* Note that here we have to use the table mass in the INCL Q-value. We
656 * cannot use theMass, because at this stage the particle is probably
657 * still off-shell; and we cannot use getINCLMass(), because it leads to
658 * violations of global energy conservation.
659 */
660 const G4double massINCLParticle = getTableMass();
661
662 // The rhs corresponds to the INCL Q-value for particle absorption
663 return theQValue - (massINCLToDaughter-massINCLTo-massINCLParticle);
664 }
665
666 /**\brief Computes correction on the emission Q-value for hypernuclei
667 *
668 * Computes the correction that must be applied to INCL particles in
669 * order to obtain the correct Q-value for particle emission from a given
670 * nucleus. For absorption, the correction is obviously equal to minus
671 * the value returned by this function.
672 *
673 * \param AParent the mass number of the emitting nucleus
674 * \param ZParent the charge number of the emitting nucleus
675 * \param SParent the strangess number of the emitting nucleus
676 * \return the correction
677 */
678 G4double getEmissionQValueCorrection(const G4int AParent, const G4int ZParent, const G4int SParent) const {
679 const G4int ADaughter = AParent - theA;
680 const G4int ZDaughter = ZParent - theZ;
681 const G4int SDaughter = SParent - theS;
682
683 // Note the minus sign here
684 G4double theQValue;
685 if(isCluster())
686 theQValue = -ParticleTable::getTableQValue(theA, theZ, theS, ADaughter, ZDaughter, SDaughter);
687 else {
688 const G4double massTableParent = ParticleTable::getTableMass(AParent,ZParent,SParent);
689 const G4double massTableDaughter = ParticleTable::getTableMass(ADaughter,ZDaughter,SDaughter);
690 const G4double massTableParticle = getTableMass();
691 theQValue = massTableParent - massTableDaughter - massTableParticle;
692 }
693
694 const G4double massINCLParent = ParticleTable::getINCLMass(AParent,ZParent,SParent);
695 const G4double massINCLDaughter = ParticleTable::getINCLMass(ADaughter,ZDaughter,SDaughter);
696 const G4double massINCLParticle = getINCLMass();
697
698 // The rhs corresponds to the INCL Q-value
699 return theQValue - (massINCLParent-massINCLDaughter-massINCLParticle);
700 }
701
702 /**\brief Computes correction on the transfer Q-value for hypernuclei
703 *
704 * Computes the correction that must be applied to INCL particles in
705 * order to obtain the correct Q-value for particle transfer from a given
706 * nucleus to another.
707 *
708 * Assumes that the receving nucleus is INCL's target nucleus, with the
709 * INCL separation energy.
710 *
711 * \param AFrom the mass number of the donating nucleus
712 * \param ZFrom the charge number of the donating nucleus
713 * \param SFrom the strangess number of the donating nucleus
714 * \param ATo the mass number of the receiving nucleus
715 * \param ZTo the charge number of the receiving nucleus
716 * \param STo the strangess number of the receiving nucleus
717 * \return the correction
718 */
719 G4double getTransferQValueCorrection(const G4int AFrom, const G4int ZFrom, const G4int SFrom, const G4int ATo, const G4int ZTo , const G4int STo) const {
720 const G4int AFromDaughter = AFrom - theA;
721 const G4int ZFromDaughter = ZFrom - theZ;
722 const G4int SFromDaughter = SFrom - theS;
723 const G4int AToDaughter = ATo + theA;
724 const G4int ZToDaughter = ZTo + theZ;
725 const G4int SToDaughter = STo + theS;
726 const G4double theQValue = ParticleTable::getTableQValue(AToDaughter,ZToDaughter,SFromDaughter,AFromDaughter,ZFromDaughter,SToDaughter,AFrom,ZFrom,SFrom);
727
728 const G4double massINCLTo = ParticleTable::getINCLMass(ATo,ZTo,STo);
729 const G4double massINCLToDaughter = ParticleTable::getINCLMass(AToDaughter,ZToDaughter,SToDaughter);
730 /* Note that here we have to use the table mass in the INCL Q-value. We
731 * cannot use theMass, because at this stage the particle is probably
732 * still off-shell; and we cannot use getINCLMass(), because it leads to
733 * violations of global energy conservation.
734 */
735 const G4double massINCLParticle = getTableMass();
736
737 // The rhs corresponds to the INCL Q-value for particle absorption
738 return theQValue - (massINCLToDaughter-massINCLTo-massINCLParticle);
739 }
740
741
742
743 /** \brief Get the the particle invariant mass.
744 *
745 * Uses the relativistic invariant
746 * \f[ m = \sqrt{E^2 - {\vec p}^2}\f]
747 **/
749 const G4double mass = std::pow(theEnergy, 2) - theMomentum.dot(theMomentum);
750 if(mass < 0.0) {
751 INCL_ERROR("E*E - p*p is negative." << '\n');
752 return 0.0;
753 } else {
754 return std::sqrt(mass);
755 }
756 };
757
758 /// \brief Get the particle kinetic energy.
759 inline G4double getKineticEnergy() const { return theEnergy - theMass; }
760
761 /// \brief Get the particle potential energy.
763
764 /// \brief Set the particle potential energy.
766
767 /**
768 * Get the energy of the particle in MeV.
769 */
771 {
772 return theEnergy;
773 };
774
775 /**
776 * Set the mass of the particle in MeV/c^2.
777 */
778 void setMass(G4double mass)
779 {
780 this->theMass = mass;
781 }
782
783 /**
784 * Set the energy of the particle in MeV.
785 */
786 void setEnergy(G4double energy)
787 {
788 this->theEnergy = energy;
789 };
790
791 /**
792 * Get the momentum vector.
793 */
795 {
796 return theMomentum;
797 };
798
799 /** Get the angular momentum w.r.t. the origin */
801 {
803 };
804
805 /**
806 * Set the momentum vector.
807 */
808 virtual void setMomentum(const G4INCL::ThreeVector &momentum)
809 {
810 this->theMomentum = momentum;
811 };
812
813 /**
814 * Set the position vector.
815 */
817 {
818 return thePosition;
819 };
820
822 {
823 this->thePosition = position;
824 };
825
826 G4double getHelicity() { return theHelicity; };
827 void setHelicity(G4double h) { theHelicity = h; };
828
829 void propagate(G4double step) {
830 thePosition += ((*thePropagationMomentum)*(step/(*thePropagationEnergy)));
831 };
832
833 /** \brief Return the number of collisions undergone by the particle. **/
835
836 /** \brief Set the number of collisions undergone by the particle. **/
838
839 /** \brief Increment the number of collisions undergone by the particle. **/
841
842 /** \brief Return the number of decays undergone by the particle. **/
843 G4int getNumberOfDecays() const { return nDecays; }
844
845 /** \brief Set the number of decays undergone by the particle. **/
847
848 /** \brief Increment the number of decays undergone by the particle. **/
850
851 /** \brief Mark the particle as out of its potential well
852 *
853 * This flag is used to control pions created outside their potential well
854 * in delta decay. The pion potential checks it and returns zero if it is
855 * true (necessary in order to correctly enforce energy conservation). The
856 * Nucleus::applyFinalState() method uses it to determine whether new
857 * avatars should be generated for the particle.
858 */
859 void setOutOfWell() { outOfWell = true; }
860
861 /// \brief Check if the particle is out of its potential well
862 G4bool isOutOfWell() const { return outOfWell; }
863
864 void setEmissionTime(G4double t) { emissionTime = t; }
865 G4double getEmissionTime() { return emissionTime; };
866
867 /** \brief Transverse component of the position w.r.t. the momentum. */
870 }
871
872 /** \brief Longitudinal component of the position w.r.t. the momentum. */
875 }
876
877 /** \brief Rescale the momentum to match the total energy. */
879
880 /** \brief Recompute the energy to match the momentum. */
882
884 return (theType == Composite);
885 }
886
887 /// \brief Set the frozen particle momentum
888 void setFrozenMomentum(const ThreeVector &momentum) { theFrozenMomentum = momentum; }
889
890 /// \brief Set the frozen particle momentum
891 void setFrozenEnergy(const G4double energy) { theFrozenEnergy = energy; }
892
893 /// \brief Get the frozen particle momentum
895
896 /// \brief Get the frozen particle momentum
898
899 /// \brief Get the propagation velocity of the particle
900 ThreeVector getPropagationVelocity() const { return (*thePropagationMomentum)/(*thePropagationEnergy); }
901
902 /** \brief Freeze particle propagation
903 *
904 * Make the particle use theFrozenMomentum and theFrozenEnergy for
905 * propagation. The normal state can be restored by calling the
906 * thawPropagation() method.
907 */
911 }
912
913 /** \brief Unfreeze particle propagation
914 *
915 * Make the particle use theMomentum and theEnergy for propagation. Call
916 * this method to restore the normal propagation if the
917 * freezePropagation() method has been called.
918 */
922 }
923
924 /** \brief Rotate the particle position and momentum
925 *
926 * \param angle the rotation angle
927 * \param axis a unit vector representing the rotation axis
928 */
929 virtual void rotatePositionAndMomentum(const G4double angle, const ThreeVector &axis) {
930 rotatePosition(angle, axis);
931 rotateMomentum(angle, axis);
932 }
933
934 /** \brief Rotate the particle position
935 *
936 * \param angle the rotation angle
937 * \param axis a unit vector representing the rotation axis
938 */
939 virtual void rotatePosition(const G4double angle, const ThreeVector &axis) {
940 thePosition.rotate(angle, axis);
941 }
942
943 /** \brief Rotate the particle momentum
944 *
945 * \param angle the rotation angle
946 * \param axis a unit vector representing the rotation axis
947 */
948 virtual void rotateMomentum(const G4double angle, const ThreeVector &axis) {
949 theMomentum.rotate(angle, axis);
950 theFrozenMomentum.rotate(angle, axis);
951 }
952
953 std::string print() const {
954 std::stringstream ss;
955 ss << "Particle (ID = " << ID << ") type = ";
957 ss << '\n'
958 << " energy = " << theEnergy << '\n'
959 << " momentum = "
960 << theMomentum.print()
961 << '\n'
962 << " position = "
963 << thePosition.print()
964 << '\n';
965 return ss.str();
966 };
967
968 std::string dump() const {
969 std::stringstream ss;
970 ss << "(particle " << ID << " ";
972 ss << '\n'
973 << thePosition.dump()
974 << '\n'
975 << theMomentum.dump()
976 << '\n'
977 << theEnergy << ")" << '\n';
978 return ss.str();
979 };
980
981 long getID() const { return ID; };
982
983 /**
984 * Return a NULL pointer
985 */
986 ParticleList const *getParticles() const {
987 INCL_WARN("Particle::getParticles() method was called on a Particle object" << '\n');
988 return 0;
989 }
990
991 /** \brief Return the reflection momentum
992 *
993 * The reflection momentum is used by calls to getSurfaceRadius to compute
994 * the radius of the sphere where the nucleon moves. It is necessary to
995 * introduce fuzzy r-p correlations.
996 */
998 if(rpCorrelated)
999 return theMomentum.mag();
1000 else
1001 return uncorrelatedMomentum;
1002 }
1003
1004 /// \brief Set the uncorrelated momentum
1006
1007 /// \brief Make the particle follow a strict r-p correlation
1008 void rpCorrelate() { rpCorrelated = true; }
1009
1010 /// \brief Make the particle not follow a strict r-p correlation
1011 void rpDecorrelate() { rpCorrelated = false; }
1012
1013 /// \brief Get the cosine of the angle between position and momentum
1016 if(norm>0.)
1017 return thePosition.dot(*thePropagationMomentum) / std::sqrt(norm);
1018 else
1019 return 1.;
1020 }
1021
1022 /// \brief General bias vector function
1023 static G4double getTotalBias();
1024 static void setINCLBiasVector(std::vector<G4double> NewVector);
1025 static void FillINCLBiasVector(G4double newBias);
1026 static G4double getBiasFromVector(std::vector<G4int> VectorBias);
1027
1028 static std::vector<G4int> MergeVectorBias(Particle const * const p1, Particle const * const p2);
1029 static std::vector<G4int> MergeVectorBias(std::vector<G4int> p1, Particle const * const p2);
1030
1031 /// \brief Get the particle bias.
1033
1034 /// \brief Set the particle bias.
1035 void setParticleBias(G4double ParticleBias) { this->theParticleBias = ParticleBias; }
1036
1037 /// \brief Get the vector list of biased vertices on the particle path.
1038 std::vector<G4int> getBiasCollisionVector() const { return theBiasCollisionVector; }
1039
1040 /// \brief Set the vector list of biased vertices on the particle path.
1041 void setBiasCollisionVector(std::vector<G4int> BiasCollisionVector) {
1042 this->theBiasCollisionVector = BiasCollisionVector;
1043 this->setParticleBias(Particle::getBiasFromVector(BiasCollisionVector));
1044 }
1045
1046 /** \brief Number of Kaon inside de nucleus
1047 *
1048 * Put in the Particle class in order to calculate the
1049 * "correct" mass of composit particle.
1050 *
1051 */
1052
1053 G4int getNumberOfKaon() const { return theNKaon; };
1054 void setNumberOfKaon(const G4int NK) { theNKaon = NK; }
1055
1056 public:
1057 /** \brief Time ordered vector of all bias applied
1058 *
1059 * /!\ Caution /!\
1060 * methods Assotiated to G4VectorCache<T> are:
1061 * Push_back(…),
1062 * operator[],
1063 * Begin(),
1064 * End(),
1065 * Clear(),
1066 * Size() and
1067 * Pop_back()
1068 *
1069 */
1070#ifdef INCLXX_IN_GEANT4_MODE
1071 static std::vector<G4double> INCLBiasVector;
1072 //static G4VectorCache<G4double> INCLBiasVector;
1073#else
1074 static G4ThreadLocal std::vector<G4double> INCLBiasVector;
1075 //static G4VectorCache<G4double> INCLBiasVector;
1076#endif
1078
1079 protected:
1093 long ID;
1094
1097
1099 /// \brief The number of Kaons inside the nucleus (update during the cascade)
1101
1102 private:
1103 G4double theHelicity;
1104 G4double emissionTime;
1105 G4bool outOfWell;
1106
1107 /// \brief Time ordered vector of all biased vertices on the particle path
1108 std::vector<G4int> theBiasCollisionVector;
1109
1110 G4double theMass;
1111 static G4ThreadLocal long nextID;
1112
1114 };
1115}
1116
1117#endif /* PARTICLE_HH_ */
Singleton for recycling allocation of instances of a given class.
#define INCL_DECLARE_ALLOCATION_POOL(T)
#define INCL_ERROR(x)
#define INCL_WARN(x)
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4double getParticleListBias() const
std::vector< G4int > getParticleListBiasVector() const
void rotateMomentum(const G4double angle, const ThreeVector &axis) const
void boost(const ThreeVector &b) const
void rotatePosition(const G4double angle, const ThreeVector &axis) const
void rotatePositionAndMomentum(const G4double angle, const ThreeVector &axis) const
G4bool isCluster() const
ThreeVector boostVector() const
G4double getINCLMass() const
Get the INCL particle mass.
G4bool isBaryon() const
Is this a Baryon?
virtual G4INCL::ParticleSpecies getSpecies() const
Get the particle species.
void setPotentialEnergy(G4double v)
Set the particle potential energy.
ParticleList const * getParticles() const
G4bool isPhoton() const
Is this a photon?
G4INCL::ThreeVector * thePropagationMomentum
G4bool isLambda() const
Is this a Lambda?
G4int getS() const
Returns the strangeness number.
G4bool isOutOfWell() const
Check if the particle is out of its potential well.
G4double getEmissionQValueCorrection(const G4int AParent, const G4int ZParent) const
Computes correction on the emission Q-value.
G4INCL::ThreeVector theMomentum
void setBiasCollisionVector(std::vector< G4int > BiasCollisionVector)
Set the vector list of biased vertices on the particle path.
void setNumberOfKaon(const G4int NK)
G4bool isMeson() const
Is this a Meson?
virtual G4INCL::ThreeVector getAngularMomentum() const
void setFrozenMomentum(const ThreeVector &momentum)
Set the frozen particle momentum.
G4double getFrozenEnergy() const
Get the frozen particle momentum.
void setUncorrelatedMomentum(const G4double p)
Set the uncorrelated momentum.
G4double getEnergy() const
G4double getPotentialEnergy() const
Get the particle potential energy.
G4bool isStrange() const
Is this an Strange?
void incrementNumberOfDecays()
Increment the number of decays undergone by the particle.
G4bool isEtaPrime() const
Is this an etaprime?
G4double getHelicity()
static std::vector< G4double > INCLBiasVector
Time ordered vector of all bias applied.
void rpCorrelate()
Make the particle follow a strict r-p correlation.
void setMass(G4double mass)
G4bool isNucleonorLambda() const
Is this a Nucleon or a Lambda?
G4bool isOmega() const
Is this an omega?
void lorentzContract(const ThreeVector &aBoostVector, const ThreeVector &refPos)
Lorentz-contract the particle position around some center.
virtual void makeTargetSpectator()
ParticipantType getParticipantType() const
void setHelicity(G4double h)
void setFrozenEnergy(const G4double energy)
Set the frozen particle momentum.
ThreeVector getPropagationVelocity() const
Get the propagation velocity of the particle.
G4double thePotentialEnergy
virtual void rotatePositionAndMomentum(const G4double angle, const ThreeVector &axis)
Rotate the particle position and momentum.
void setParticipantType(ParticipantType const p)
ParticipantType theParticipantType
std::string dump() const
void propagate(G4double step)
G4int getZ() const
Returns the charge number.
static void FillINCLBiasVector(G4double newBias)
G4bool isSigma() const
Is this a Sigma?
const G4INCL::ThreeVector & getPosition() const
void setParticleBias(G4double ParticleBias)
Set the particle bias.
G4double getBeta() const
G4bool isParticipant() const
G4double getKineticEnergy() const
Get the particle kinetic energy.
G4INCL::ParticleType theType
Particle(const Particle &rhs)
Copy constructor.
G4double getReflectionMomentum() const
Return the reflection momentum.
G4bool isTargetSpectator() const
static std::vector< G4int > MergeVectorBias(Particle const *const p1, Particle const *const p2)
virtual void rotateMomentum(const G4double angle, const ThreeVector &axis)
Rotate the particle momentum.
G4int theNKaon
The number of Kaons inside the nucleus (update during the cascade)
G4double getCosRPAngle() const
Get the cosine of the angle between position and momentum.
std::vector< G4int > getBiasCollisionVector() const
Get the vector list of biased vertices on the particle path.
void setEmissionTime(G4double t)
ThreeVector getLongitudinalPosition() const
Longitudinal component of the position w.r.t. the momentum.
G4int getNumberOfCollisions() const
Return the number of collisions undergone by the particle.
G4bool isEta() const
Is this an eta?
virtual void makeProjectileSpectator()
G4double adjustEnergyFromMomentum()
Recompute the energy to match the momentum.
static void setINCLBiasVector(std::vector< G4double > NewVector)
static G4double getTotalBias()
General bias vector function.
virtual void rotatePosition(const G4double angle, const ThreeVector &axis)
Rotate the particle position.
G4double getParticleBias() const
Get the particle bias.
void setNumberOfDecays(G4int n)
Set the number of decays undergone by the particle.
G4int getNumberOfDecays() const
Return the number of decays undergone by the particle.
const ThreeVector & adjustMomentumFromEnergy()
Rescale the momentum to match the total energy.
G4bool isPion() const
Is this a pion?
void setINCLMass()
Set the mass of the Particle to its table mass.
void incrementNumberOfCollisions()
Increment the number of collisions undergone by the particle.
G4double getTransferQValueCorrection(const G4int AFrom, const G4int ZFrom, const G4int ATo, const G4int ZTo) const
Computes correction on the transfer Q-value.
ThreeVector getFrozenMomentum() const
Get the frozen particle momentum.
G4double getRealMass() const
Get the real particle mass.
G4double uncorrelatedMomentum
G4bool isProjectileSpectator() const
G4bool isAntiKaon() const
Is this an antiKaon?
const G4INCL::ThreeVector & getMomentum() const
void rpDecorrelate()
Make the particle not follow a strict r-p correlation.
Particle & operator=(const Particle &rhs)
Assignment operator.
virtual void setMomentum(const G4INCL::ThreeVector &momentum)
G4INCL::ParticleType getType() const
G4bool isKaon() const
Is this a Kaon?
G4int getNumberOfKaon() const
Number of Kaon inside de nucleus.
void thawPropagation()
Unfreeze particle propagation.
virtual G4double getTableMass() const
Get the tabulated particle mass.
G4double getEmissionQValueCorrection(const G4int AParent, const G4int ZParent, const G4int SParent) const
Computes correction on the emission Q-value for hypernuclei.
G4double getInvariantMass() const
Get the the particle invariant mass.
G4double getEmissionTime()
virtual void makeParticipant()
G4bool isResonance() const
Is it a resonance?
void setEnergy(G4double energy)
void setType(ParticleType t)
std::string print() const
ThreeVector getTransversePosition() const
Transverse component of the position w.r.t. the momentum.
G4double getMass() const
Get the cached particle mass.
void boost(const ThreeVector &aBoostVector)
static G4ThreadLocal G4int nextBiasedCollisionID
virtual void setPosition(const G4INCL::ThreeVector &position)
void setTableMass()
Set the mass of the Particle to its table mass.
void setOutOfWell()
Mark the particle as out of its potential well.
void swap(Particle &rhs)
Helper method for the assignment operator.
long getID() const
G4double * thePropagationEnergy
G4bool isDelta() const
Is it a Delta?
void freezePropagation()
Freeze particle propagation.
void setRealMass()
Set the mass of the Particle to its real mass.
static G4double getBiasFromVector(std::vector< G4int > VectorBias)
G4int getA() const
Returns the baryon number.
G4bool isHyperon() const
Is this an Hyperon?
G4INCL::ThreeVector thePosition
G4INCL::ThreeVector theFrozenMomentum
void setNumberOfCollisions(G4int n)
Set the number of collisions undergone by the particle.
G4bool isNucleon() const
G4double getTransferQValueCorrection(const G4int AFrom, const G4int ZFrom, const G4int SFrom, const G4int ATo, const G4int ZTo, const G4int STo) const
Computes correction on the transfer Q-value for hypernuclei.
std::string dump() const
G4double mag() const
std::string print() const
void rotate(const G4double angle, const ThreeVector &axis)
Rotate the vector by a given angle around a given axis.
G4double dot(const ThreeVector &v) const
G4double mag2() const
ThreeVector vector(const ThreeVector &v) const
G4ThreadLocal NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.
G4double getTableQValue(const G4int A1, const G4int Z1, const G4int S1, const G4int A2, const G4int Z2, const G4int S2)
Get Q-value (in MeV/c^2)
G4ThreadLocal ParticleMassFn getTableParticleMass
Static pointer to the mass function for particles.
G4double getRealMass(const G4INCL::ParticleType t)
Get particle mass (in MeV/c^2)
G4double getINCLMass(const G4int A, const G4int Z, const G4int S)
Get INCL nuclear mass (in MeV/c^2)
std::string getName(const ParticleType t)
Get the native INCL name of the particle.
ParticleList::iterator ParticleMutableIter
ParticleList::const_iterator ParticleIter
#define G4ThreadLocal
Definition: tls.hh:77
#define position
Definition: xmlparse.cc:622