Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCL::NbarAtrestEntryChannel Class Reference

#include <G4INCLNbarAtrestEntryChannel.hh>

Inheritance diagram for G4INCL::NbarAtrestEntryChannel:

Public Member Functions

 NbarAtrestEntryChannel (Nucleus *n, Particle *p)
virtual ~NbarAtrestEntryChannel ()
void fillFinalState (FinalState *fs)
ParticleList makeMesonStar ()
IAvatarList bringMesonStar (ParticleList const &pL, Nucleus *const n)
G4bool ProtonIsTheVictim ()
ThreeVector getAnnihilationPosition ()
G4double Pabs (G4double x, G4double value)
G4double densityP ()
G4double densityN ()
G4double overlapP (G4double &x)
G4double overlapN (G4double &x)
G4double read_file (std::string filename, std::vector< G4double > &probabilities, std::vector< std::vector< std::string > > &particle_types)
G4int findStringNumber (G4double rdm, std::vector< G4double > yields)
Public Member Functions inherited from G4INCL::IChannel
 IChannel ()
virtual ~IChannel ()
FinalStategetFinalState ()

Detailed Description

Definition at line 64 of file G4INCLNbarAtrestEntryChannel.hh.

Constructor & Destructor Documentation

◆ NbarAtrestEntryChannel()

G4INCL::NbarAtrestEntryChannel::NbarAtrestEntryChannel ( Nucleus * n,
Particle * p )

Definition at line 79 of file G4INCLNbarAtrestEntryChannel.cc.

80 :theNucleus(n), theParticle(p)
81 {}

◆ ~NbarAtrestEntryChannel()

G4INCL::NbarAtrestEntryChannel::~NbarAtrestEntryChannel ( )
virtual

Definition at line 82 of file G4INCLNbarAtrestEntryChannel.cc.

82{}

Member Function Documentation

◆ bringMesonStar()

IAvatarList G4INCL::NbarAtrestEntryChannel::bringMesonStar ( ParticleList const & pL,
Nucleus *const n )

Definition at line 661 of file G4INCLNbarAtrestEntryChannel.cc.

661 {
662 ThreeVector ann_position = getAnnihilationPosition();
663 IAvatarList theAvatarList;
664 for(ParticleIter p = pL.begin(), e = pL.end(); p!=e; ++p){
665 (*p)->setPosition(ann_position);
666 theAvatarList.push_back(new ParticleEntryAvatar(0.0, n, *p, ANAR));
667 }
668 return theAvatarList;
669 }
ParticleList::const_iterator ParticleIter
UnorderedVector< IAvatar * > IAvatarList

Referenced by G4INCL::StandardPropagationModel::shootAtrest(), and G4INCL::StandardPropagationModel::shootCompositeAtrest().

◆ densityN()

G4double G4INCL::NbarAtrestEntryChannel::densityN ( )

Definition at line 205 of file G4INCLNbarAtrestEntryChannel.cc.

205 {
206 const G4bool isProton = ProtonIsTheVictim();
207 G4int Z = theNucleus->getZ(); //was modified in Cascade.cc
208 G4int A = theNucleus->getA(); //was modified in Cascade.cc
209 G4double threshold_density = 0.10; //the maximum of the interaction probability is taken at 10% of maximum density
210 //https://doi.org/10.1016/0375-9474(82)90352-9 , Nuclear absorption of stopped antiprotons: Multipion-nucleus interactions, Iljinov, Nazaruk, Chigrinov
211 A++; //restoration of original A value before annihilation
212 if(isProton == true){Z++;} //restoration of original Z value before annihilation
213 if(theNucleus->getAnnihilationType()==DNbarPPbarNType || theNucleus->getAnnihilationType()==DNbarNPbarPType ||
214 theNucleus->getAnnihilationType()==DNbarNPbarNType || theNucleus->getAnnihilationType()==DNbarNPbarPType){A++;}
215 if(theNucleus->getAnnihilationType()==DNbarPPbarPType || theNucleus->getAnnihilationType()==DNbarNPbarPType){Z++;}
216
217 if(A > 19) {
220 G4double r_10 = diffuseness*std::log((1/threshold_density)-1) + radius; //Radius for a Wood-Saxon
221 return r_10;
222 } else if(A <= 19 && A > 6) {
226 NuclearDensityFunctions::ModifiedHarmonicOscillator rDensityFunction(radius, maximumRadius, diffuseness);
227 G4double r_10 = 0.01;
228 while (rDensityFunction(r_10)/(r_10*r_10) > threshold_density*rDensityFunction(0.01)/(0.01*0.01)) {
229 r_10 = r_10 + maximumRadius/100. ;
230 }
231 return r_10;
232 } else if(A <= 6 && A > 2) { // Gaussian distribution for light nuclei
235 NuclearDensityFunctions::Gaussian rDensityFunction(maximumRadius, Math::oneOverSqrtThree * radius);
236 G4double r_10=std::sqrt(std::pow(Math::oneOverSqrtThree * radius,2)*std::log(2)); //start when the density is half the maximum
237 while (rDensityFunction(r_10)/(r_10*r_10) > threshold_density*rDensityFunction(0.01)/(0.01*0.01)) {
238 r_10 = r_10 + maximumRadius/500. ;
239 }
240 return r_10;
241 } else {
242 INCL_ERROR("No nuclear density function for target A = "
243 << A << " Z = " << Z << '\n');
244 return 0.0;
245 }
246
247
248 }
#define INCL_ERROR(x)
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
const G4double A[17]
const G4double oneOverSqrtThree
G4double getRadiusParameter(const ParticleType t, const G4int A, const G4int Z)
G4double getMaximumNuclearRadius(const ParticleType t, const G4int A, const G4int Z)
G4double getSurfaceDiffuseness(const ParticleType t, const G4int A, const G4int Z)
@ DNbarNPbarNType
@ DNbarNPbarPType
@ DNbarPPbarPType
@ DNbarPPbarNType

Referenced by overlapN().

◆ densityP()

G4double G4INCL::NbarAtrestEntryChannel::densityP ( )

Definition at line 135 of file G4INCLNbarAtrestEntryChannel.cc.

135 { // return the r at which the gaussian of the interaction Probability(Pabs) is centered
136 const G4bool isProton = ProtonIsTheVictim();
137 G4int Z = theNucleus->getZ(); //was modified in Cascade.cc
138 G4int A = theNucleus->getA(); //was modified in Cascade.cc
139 G4double threshold_density = 0.10; //the maximum of the interaction probability is taken at 10% of maximum density
140 //https://doi.org/10.1016/0375-9474(82)90352-9 , Nuclear absorption of stopped antiprotons: Multipion-nucleus interactions, Iljinov, Nazaruk, Chigrinov
141 A++; //restoration of original A value before annihilation
142 if(isProton == true){Z++;} //restoration of original Z value before annihilation
143 if(theNucleus->getAnnihilationType()==DNbarPPbarNType || theNucleus->getAnnihilationType()==DNbarNPbarPType ||
144 theNucleus->getAnnihilationType()==DNbarNPbarNType || theNucleus->getAnnihilationType()==DNbarNPbarPType){A++;}
145 if(theNucleus->getAnnihilationType()==DNbarPPbarPType || theNucleus->getAnnihilationType()==DNbarNPbarPType){Z++;}
146
147 if(A > 19) {
150 G4double r_10 = diffuseness*std::log((1/threshold_density)-1) + radius; //Radius for a Wood-Saxon
151 return r_10;
152 }else if(A <= 19 && A > 6) {
156 NuclearDensityFunctions::ModifiedHarmonicOscillator rDensityFunction(radius, maximumRadius, diffuseness);
157 //double r_10 = 0.01;
158 //while (rDensityFunction(r_10)/(r_10*r_10) > threshold_density*rDensityFunction(0.01)/(0.01*0.01)) {
159 // r_10 = r_10 + maximumRadius/100. ;
160 //}
161 G4double r_min = 0.01;
162 G4double r_max = maximumRadius;
163 G4double r_10 = (r_min + r_max)/2.;
164 while ((rDensityFunction(r_10)/(r_10*r_10) > 0.11*rDensityFunction(0.01)/(0.01*0.01)) ||
165 (rDensityFunction(r_10)/(r_10*r_10) < 0.09*rDensityFunction(0.01)/(0.01*0.01))) {
166 if (rDensityFunction(r_10)/(r_10*r_10) > 0.11*rDensityFunction(0.01)/(0.01*0.01)) {
167 r_min = r_10;
168 }
169 else {
170 r_max = r_10;
171 }
172 r_10 = (r_min + r_max)/2.;
173 }
174 return r_10;
175 }else if(A <= 6 && A > 2) { // Gaussian distribution for light nuclei
178 NuclearDensityFunctions::Gaussian rDensityFunction(maximumRadius, Math::oneOverSqrtThree * radius);
179 //double r_10=std::sqrt(std::pow(Math::oneOverSqrtThree * radius,2)*std::log(2)); //start when the density is half the maximum
180 //while (rDensityFunction(r_10)/(r_10*r_10) > threshold_density*rDensityFunction(0.01)/(0.01*0.01)) {
181 // r_10 = r_10 + maximumRadius/500. ;
182 //}
183 G4double r_min = 0.01;
184 G4double r_max = maximumRadius;
185 G4double r_10 = (r_min + r_max)/2.;
186 while ((rDensityFunction(r_10)/(r_10*r_10) > 0.11*rDensityFunction(0.01)/(0.01*0.01)) ||
187 (rDensityFunction(r_10)/(r_10*r_10) < 0.09*rDensityFunction(0.01)/(0.01*0.01))) {
188 if (rDensityFunction(r_10)/(r_10*r_10) > 0.11*rDensityFunction(0.01)/(0.01*0.01)) {
189 r_min = r_10;
190 }
191 else {
192 r_max = r_10;
193 }
194 r_10 = (r_min + r_max)/2.;
195 }
196 return r_10;
197 }else {
198 INCL_ERROR("No nuclear density function for target A = "
199 << A << " Z = " << Z << '\n');
200 return 0.0;
201 }
202
203 }

Referenced by overlapP().

◆ fillFinalState()

void G4INCL::NbarAtrestEntryChannel::fillFinalState ( FinalState * fs)
virtual

Implements G4INCL::IChannel.

Definition at line 670 of file G4INCLNbarAtrestEntryChannel.cc.

670 {
671 //const bool isProton = ProtonIsTheVictim();
672 //int z = theNucleus->getZ(); //was modified in Cascade.cc
673 //int a = theNucleus->getA(); //was modified in Cascade.cc
674 //a++; //restoration of original A value before annihilation
675 //if(isProton == true){z++;} //restoration of original Z value before annihilation
676 const G4double energyBefore = theParticle->getEnergy();
677 fs->addEnteringParticle(theParticle);
678 INCL_DEBUG("Entering particle added " << '\n');
679 fs->setTotalEnergyBeforeInteraction(energyBefore);
680 }
#define INCL_DEBUG(x)

◆ findStringNumber()

G4int G4INCL::NbarAtrestEntryChannel::findStringNumber ( G4double rdm,
std::vector< G4double > yields )

Definition at line 109 of file G4INCLNbarAtrestEntryChannel.cc.

109 {
110 G4int stringNumber =-1;
111 G4double smallestsum =0.0;
112 G4double biggestsum = yields[0];
113 for (G4int i=0; i < static_cast<G4int>(yields.size() -1);i++){
114 if (rdm >= smallestsum && rdm <= biggestsum){
115 stringNumber = i+1;
116
117 }
118 smallestsum += yields[i];
119 biggestsum += yields[i+1];
120 }
121 if (stringNumber==-1) stringNumber = static_cast<G4int>(yields.size());
122 if (stringNumber==-1){
123 INCL_ERROR("ERROR in findStringNumber (stringNumber=-1)");
124 std::cout << "ERROR in findStringNumber" << std::endl;
125 }
126 return stringNumber;
127 }

Referenced by makeMesonStar().

◆ getAnnihilationPosition()

ThreeVector G4INCL::NbarAtrestEntryChannel::getAnnihilationPosition ( )

Definition at line 591 of file G4INCLNbarAtrestEntryChannel.cc.

591 {
592 const G4bool isProton = ProtonIsTheVictim();
593 G4int z = theNucleus->getZ(); //was modified in Cascade.cc
594 G4int a = theNucleus->getA(); //was modified in Cascade.cc
595 a++;
596
597 if(isProton == true){z++;}
598 if(theNucleus->getAnnihilationType()==DNbarPPbarNType || theNucleus->getAnnihilationType()==DNbarNPbarPType ||
599 theNucleus->getAnnihilationType()==DNbarNPbarNType || theNucleus->getAnnihilationType()==DNbarNPbarPType){a++;}
600 if(theNucleus->getAnnihilationType()==DNbarPPbarPType || theNucleus->getAnnihilationType()==DNbarNPbarPType){z++;}
603 G4double probabilitymax = 0.; //the max value of the probability distribution
604 G4double probability = 0.0;
605 G4double radius;
606
607 //now we compute the max value of the probability distribution...
608 if(isProton == true){
609
610 for(radius = 0.0; radius < Rpmax; radius = radius + 0.001){
611 probability = overlapP(radius);
612 //INCL_WARN("radius, densityP, overlapP: " << radius << " " << densityP(radius) << " " << probability << '\n');
613 if(probability > probabilitymax)
614 probabilitymax = probability; //now it should be the max value of overlapP function
615 }
616 }
617 else{ //neutron
618
619 for(radius = 0.0; radius < Rnmax; radius = radius + 0.001){
620 probability = overlapN(radius);
621 //INCL_WARN("radius, densityN, overlapN: " << radius << " " << densityN(radius) << " " << probability << '\n');
622 if(probability > probabilitymax)
623 probabilitymax = probability; //now it should be the max value of overlapP function
624 }
625 }
626
627 //we know the limits! start rejection algorithm!
628 G4double x = 0., y = 0.0001, p_for_x = 0.;
629 G4double distance = 0.;
630 if(isProton == true){
631 while(y >= p_for_x){
632 x = Random::shoot() * Rpmax; // create uniformly random r
633 y = Random::shoot() * probabilitymax; // create uniformly random prob
634 p_for_x = overlapP(x); //probability call for comparison
635 if(y <= p_for_x){ //first cut-off is introduced for computational volume reduction
636 distance = x;
637 }
638 }
639 }
640 else{
641 while(y >= p_for_x){
642 x = Random::shoot() * Rnmax; // create uniformly random r
643 y = Random::shoot() * probabilitymax; // create uniformly random prob
644 p_for_x = overlapN(x); //probability call for comparison
645 if(y <= p_for_x){ //first cut-off is introduced for computational volume reduction
646 distance = x;
647 }
648 }
649 }
650
651 //FINAL POSITION VECTOR
652 //ThreeVector annihilationPosition(0., 0., -distance); //3D sphere of distance radius
653 G4double ctheta = (1.-2.*Random::shoot());
654 G4double stheta = std::sqrt(1.-ctheta*ctheta);
656 ThreeVector annihilationPosition(distance*stheta * std::cos(phi), distance*stheta * std::sin(phi), distance*ctheta); //3D sphere of distance radius
657
658 return annihilationPosition;
659 }
const G4double twoPi
G4double shoot()

Referenced by bringMesonStar(), and G4INCL::AntinucleiAtrestEntryChannel::makeMesonStar().

◆ makeMesonStar()

ParticleList G4INCL::NbarAtrestEntryChannel::makeMesonStar ( )

Definition at line 257 of file G4INCLNbarAtrestEntryChannel.cc.

257 {//This function creates a set of mesons with momenta
258 // File names
259 #ifdef INCLXX_IN_GEANT4_MODE
260 if(!G4FindDataDir("G4INCLDATA")) {
262 ed << " Data missing: set environment variable G4INCLDATA\n"
263 << " to point to the directory containing data files needed\n"
264 << " by the INCL++ model" << G4endl;
265 G4Exception("G4INCLDataFile::readData()","rawppbarFS.dat, ...",
266 FatalException, ed);
267 }
268 G4String dataPath0{G4FindDataDir("G4INCLDATA")};
269 G4String dataPathnbarp(dataPath0 + "/rawnbarpFS.dat");
270 G4String dataPathnbarn(dataPath0 + "/rawnbarnFS.dat");
271 G4String dataPathnbarnk(dataPath0 + "/rawppbarFSkaonic.dat");
272 G4String dataPathnbarpk(dataPath0 + "/rawnbarpFSkaonic.dat");
273 #else
274 Config const *theConfig=theNucleus->getStore()->getConfig();
275 std::string path;
276 if(theConfig)
277 path = theConfig->getINCLXXDataFilePath();
278 std::string dataPathnbarn(path + "/rawnbarnFS.dat");
279 INCL_DEBUG("Reading nbarn final states" << dataPathnbarn << '\n');
280 std::string dataPathnbarp(path + "/rawnbarpFS.dat");
281 INCL_DEBUG("Reading nbarp final states" << dataPathnbarp << '\n');
282 std::string dataPathnbarnk(path + "/rawppbarFSkaonic.dat");
283 INCL_DEBUG("Reading nbarn kaonic final states" << dataPathnbarnk << '\n');
284 std::string dataPathnbarpk(path + "/rawnbarpFSkaonic.dat");
285 INCL_DEBUG("Reading nbarp kaonic final states" << dataPathnbarpk << '\n');
286 #endif
287 //read probabilities and particle types from file
288 std::vector<G4double> probabilities; //will store each FS yield
289 std::vector<std::vector<std::string>> particle_types; //will store particle names
290
291 G4double sum; //will contain a sum of probabilities of all FS in the file
292 G4double kaonicFSprob=0.05; //probability to kave kaonic FS
293
294 const G4bool isProton = ProtonIsTheVictim();
295 G4int z = theNucleus->getZ(); //was modified in Cascade.cc
296 G4int a = theNucleus->getA(); //was modified in Cascade.cc
297 a++; //restoration of original A value before annihilation
298 if(isProton == true){z++;} //restoration of original Z value before annihilation
299 ThreeVector annihilationPosition;
300 ParticleList starlist;
301 ThreeVector mommy; //momentum to be assigned later
302
303 //LETS GOOOOOOO!!!
304 G4double rdm = Random::shoot();
305 if(isProton == true){ //protonic annihilation
306 INCL_DEBUG("Proton is the victim" << '\n');
307 if(rdm < (1.-kaonicFSprob)){ // pionic FS was chosen
308 INCL_DEBUG("pionic pp final state chosen" << '\n');
309 sum = read_file(dataPathnbarp, probabilities, particle_types);
310 rdm = (rdm/(1.-kaonicFSprob))*sum; //99.88 normalize by the sum of probabilities in the file
311 //now get the line number in the file where the FS particles are stored:
312 G4int n = findStringNumber(rdm, probabilities)-1;
313 if ( n < 0 ) return starlist;
314 for(G4int j = 0; j < static_cast<G4int>(particle_types[n].size()); j++){
315 if(particle_types[n][j] == "pi0"){
316 Particle *p = new Particle(PiZero, mommy, annihilationPosition);
317 starlist.push_back(p);
318 }
319 else if(particle_types[n][j] == "pi-"){
320 Particle *p = new Particle(PiMinus, mommy, annihilationPosition);
321 starlist.push_back(p);
322 }
323 else if(particle_types[n][j] == "pi+"){
324 Particle *p = new Particle(PiPlus, mommy, annihilationPosition);
325 starlist.push_back(p);
326 }
327 else if(particle_types[n][j] == "omega"){
328 Particle *p = new Particle(Omega, mommy, annihilationPosition);
329 starlist.push_back(p);
330 }
331 else if(particle_types[n][j] == "eta"){
332 Particle *p = new Particle(Eta, mommy, annihilationPosition);
333 starlist.push_back(p);
334 }
335 else if(particle_types[n][j] == "rho-"){
336 Particle *p = new Particle(PiMinus, mommy, annihilationPosition);
337 starlist.push_back(p);
338 Particle *pp = new Particle(PiZero, mommy, annihilationPosition);
339 starlist.push_back(pp);
340 }
341 else if(particle_types[n][j] == "rho+"){
342 Particle *p = new Particle(PiPlus, mommy, annihilationPosition);
343 starlist.push_back(p);
344 Particle *pp = new Particle(PiZero, mommy, annihilationPosition);
345 starlist.push_back(pp);
346 }
347 else if(particle_types[n][j] == "rho0"){
348 Particle *p = new Particle(PiMinus, mommy, annihilationPosition);
349 starlist.push_back(p);
350 Particle *pp = new Particle(PiPlus, mommy, annihilationPosition);
351 starlist.push_back(pp);
352 }
353 else{
354 INCL_ERROR("Some non-existing FS particle detected when reading pbar FS files");
355 for(G4int jj = 0; jj < static_cast<G4int>(particle_types[n].size()); jj++){
356 std::cout << "gotcha! " << particle_types[n][jj] << std::endl;
357 }
358 std::cout << "Some non-existing FS particle detected when reading pbar FS files" << std::endl;
359 }
360 }
361 }
362 else{
363 INCL_DEBUG("kaonic pp final state chosen" << '\n');
364 sum = read_file(dataPathnbarpk, probabilities, particle_types);
365 rdm = ((1-rdm)/kaonicFSprob)*sum;//2670 normalize by the sum of probabilities in the file
366 //now get the line number in the file where the FS particles are stored:
367 G4int n = findStringNumber(rdm, probabilities)-1;
368 if ( n < 0 ) return starlist;
369 for(G4int j = 0; j < static_cast<G4int>(particle_types[n].size()); j++){
370 if(particle_types[n][j] == "pi0"){
371 Particle *p = new Particle(PiZero, mommy, annihilationPosition);
372 starlist.push_back(p);
373 }
374 else if(particle_types[n][j] == "pi-"){
375 Particle *p = new Particle(PiMinus, mommy, annihilationPosition);
376 starlist.push_back(p);
377 }
378 else if(particle_types[n][j] == "pi+"){
379 Particle *p = new Particle(PiPlus, mommy, annihilationPosition);
380 starlist.push_back(p);
381 }
382 else if(particle_types[n][j] == "omega"){
383 Particle *p = new Particle(Omega, mommy, annihilationPosition);
384 starlist.push_back(p);
385 }
386 else if(particle_types[n][j] == "eta"){
387 Particle *p = new Particle(Eta, mommy, annihilationPosition);
388 starlist.push_back(p);
389 }
390 else if(particle_types[n][j] == "K-"){
391 Particle *p = new Particle(KMinus, mommy, annihilationPosition);
392 starlist.push_back(p);
393 }
394 else if(particle_types[n][j] == "K+"){
395 Particle *p = new Particle(KPlus, mommy, annihilationPosition);
396 starlist.push_back(p);
397 }
398 else if(particle_types[n][j] == "K0"){
399 Particle *p = new Particle(KZero, mommy, annihilationPosition);
400 starlist.push_back(p);
401 }
402 else if(particle_types[n][j] == "K0b"){
403 Particle *p = new Particle(KZeroBar, mommy, annihilationPosition);
404 starlist.push_back(p);
405 }
406 else{
407 INCL_ERROR("Some non-existing FS particle detected when reading pbar FS files");
408 for(G4int jj = 0; jj < static_cast<G4int>(particle_types[n].size()); jj++){
409 std::cout << "gotcha! " << particle_types[n][jj] << std::endl;
410 }
411 std::cout << "Some non-existing FS particle detected when reading pbar FS files" << std::endl;
412 }
413 }
414 }
415 }
416 else{ //neutronic annihilation
417 INCL_DEBUG("Neutron is the victim" << '\n');
418 if(rdm < (1.-kaonicFSprob)){ // pionic/kaonic choice
419 INCL_DEBUG("pionic np final state chosen" << '\n');
420 sum = read_file(dataPathnbarn, probabilities, particle_types);
421 rdm = (rdm/(1.-kaonicFSprob))*sum; //99.95 normalize by the sum of probabilities in the file
422 //now get the line number in the file where the FS particles are stored:
423 G4int n = findStringNumber(rdm, probabilities)-1;
424 if ( n < 0 ) return starlist;
425 for(G4int j = 0; j < static_cast<G4int>(particle_types[n].size()); j++){
426 if(particle_types[n][j] == "pi0"){
427 Particle *p = new Particle(PiZero, mommy, annihilationPosition);
428 starlist.push_back(p);
429 }
430 else if(particle_types[n][j] == "pi-"){
431 Particle *p = new Particle(PiMinus, mommy, annihilationPosition);
432 starlist.push_back(p);
433 }
434 else if(particle_types[n][j] == "pi+"){
435 Particle *p = new Particle(PiPlus, mommy, annihilationPosition);
436 starlist.push_back(p);
437 }
438 else if(particle_types[n][j] == "omega"){
439 Particle *p = new Particle(Omega, mommy, annihilationPosition);
440 starlist.push_back(p);
441 }
442 else if(particle_types[n][j] == "eta"){
443 Particle *p = new Particle(Eta, mommy, annihilationPosition);
444 starlist.push_back(p);
445 }
446 else if(particle_types[n][j] == "rho-"){
447 Particle *p = new Particle(PiMinus, mommy, annihilationPosition);
448 starlist.push_back(p);
449 Particle *pp = new Particle(PiZero, mommy, annihilationPosition);
450 starlist.push_back(pp);
451 }
452 else if(particle_types[n][j] == "rho+"){
453 Particle *p = new Particle(PiPlus, mommy, annihilationPosition);
454 starlist.push_back(p);
455 Particle *pp = new Particle(PiZero, mommy, annihilationPosition);
456 starlist.push_back(pp);
457 }
458 else if(particle_types[n][j] == "rho0"){
459 Particle *p = new Particle(PiMinus, mommy, annihilationPosition);
460 starlist.push_back(p);
461 Particle *pp = new Particle(PiPlus, mommy, annihilationPosition);
462 starlist.push_back(pp);
463 }
464 else{
465 INCL_ERROR("Some non-existing FS particle detected when reading pbar FS files");
466 for(G4int jj = 0; jj < static_cast<G4int>(particle_types[n].size()); jj++){
467 std::cout << "gotcha! " << particle_types[n][jj] << std::endl;
468 }
469 std::cout << "Some non-existing FS particle detected when reading pbar FS files" << std::endl;
470 }
471 }
472 }
473 else{
474 INCL_DEBUG("kaonic np final state chosen" << '\n');
475 sum = read_file(dataPathnbarnk, probabilities, particle_types);
476 rdm = ((1-rdm)/kaonicFSprob)*sum;//3837 normalize by the sum of probabilities in the file
477 //now get the line number in the file where the FS particles are stored:
478 G4int n = findStringNumber(rdm, probabilities)-1;
479 if ( n < 0 ) return starlist;
480 for(G4int j = 0; j < static_cast<G4int>(particle_types[n].size()); j++){
481 if(particle_types[n][j] == "pi0"){
482 Particle *p = new Particle(PiZero, mommy, annihilationPosition);
483 starlist.push_back(p);
484 }
485 else if(particle_types[n][j] == "pi-"){
486 Particle *p = new Particle(PiMinus, mommy, annihilationPosition);
487 starlist.push_back(p);
488 }
489 else if(particle_types[n][j] == "pi+"){
490 Particle *p = new Particle(PiPlus, mommy, annihilationPosition);
491 starlist.push_back(p);
492 }
493 else if(particle_types[n][j] == "omega"){
494 Particle *p = new Particle(Omega, mommy, annihilationPosition);
495 starlist.push_back(p);
496 }
497 else if(particle_types[n][j] == "eta"){
498 Particle *p = new Particle(Eta, mommy, annihilationPosition);
499 starlist.push_back(p);
500 }
501 else if(particle_types[n][j] == "K-"){
502 Particle *p = new Particle(KMinus, mommy, annihilationPosition);
503 starlist.push_back(p);
504 }
505 else if(particle_types[n][j] == "K+"){
506 Particle *p = new Particle(KPlus, mommy, annihilationPosition);
507 starlist.push_back(p);
508 }
509 else if(particle_types[n][j] == "K0"){
510 Particle *p = new Particle(KZero, mommy, annihilationPosition);
511 starlist.push_back(p);
512 }
513 else if(particle_types[n][j] == "K0b"){
514 Particle *p = new Particle(KZeroBar, mommy, annihilationPosition);
515 starlist.push_back(p);
516 }
517 else{
518 INCL_ERROR("Some non-existing FS particle detected when reading pbar FS files");
519 for(G4int jj = 0; jj < static_cast<G4int>(particle_types[n].size()); jj++){
520 std::cout << "gotcha! " << particle_types[n][jj] << std::endl;
521 }
522 std::cout << "Some non-existing FS particle detected when reading pbar FS files" << std::endl;
523 }
524 }
525 }
526 }
527
528 // Correction to the Q-value of the entering particle
529 G4int stra = theNucleus->getS();
530 G4double energyOfMesonStar;
531 if(theNucleus->isNucleusNucleusCollision()==false){//antiNeutron
532 if(isProton == true){
533 energyOfMesonStar = theParticle->getEnergy() + ParticleTable::getTableMass(a,z,stra)
534 -ParticleTable::getTableMass(a-1,z,stra);
535 }
536 else{
537 energyOfMesonStar = theParticle->getEnergy() + ParticleTable::getTableMass(a,z,stra)
538 -ParticleTable::getTableMass(a-1,z,stra);
539 }
540 } else if(theNucleus->isNucleusNucleusCollision()==true){//antiComposite : job is done in the Antinuclei file
541 return starlist;
542 }
543
544 //compute energies of mesons with a phase-space model
545 if(starlist.size() < 2){
546 INCL_ERROR("should never happen, at least 2 final state particles!" << '\n');
547 }
548 else if(starlist.size() == 2){
549 ParticleIter first = starlist.begin();
550 ParticleIter last = std::next(first, 1); //starlist.end() gives an error of segfault, idk why
551 G4double m1 = (*first)->getMass();
552 G4double m2 = (*last)->getMass();
553 G4double s = energyOfMesonStar*energyOfMesonStar;
554 G4double mom1 = std::sqrt(s/4 - (std::pow(m1,2) + std::pow(m2,2))/2 - std::pow(m1,2)*std::pow(m2,2)/s + (std::pow(m1,4) + 2*std::pow(m1*m2,2) + std::pow(m2,4))/(4*s));
555 ThreeVector momentello = Random::normVector(mom1); //like raffaello :)
556 (*first)->setMomentum(momentello);
557 (*first)->adjustEnergyFromMomentum();
558 (*last)->setMomentum(-momentello);
559 (*last)->adjustEnergyFromMomentum();
560 //std::cout << (*first)->getEnergy() << std::endl;
561 }
562 else{
563 PhaseSpaceGenerator::generate(energyOfMesonStar, starlist);
564 //ParticleIter first = starlist.begin();
565 //std::cout << (*first)->getEnergy() << std::endl;
566 //ParticleIter last = std::next(first, 1);
567 //std::cout << (*last)->getEnergy() << std::endl;
568 }
569
570 return starlist;
571 }
const char * G4FindDataDir(const char *)
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define G4endl
Definition G4ios.hh:67
G4double read_file(std::string filename, std::vector< G4double > &probabilities, std::vector< std::vector< std::string > > &particle_types)
G4int findStringNumber(G4double rdm, std::vector< G4double > yields)
G4ThreadLocal NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.
void generate(const G4double sqrtS, ParticleList &particles)
Generate an event in the CM system.
ThreeVector normVector(G4double norm=1.)
std::vector< Base * > ParticleList
Definition PoPI.hpp:186

Referenced by G4INCL::AntinucleiAtrestEntryChannel::makeMesonStar(), G4INCL::StandardPropagationModel::shootAtrest(), and G4INCL::StandardPropagationModel::shootCompositeAtrest().

◆ overlapN()

G4double G4INCL::NbarAtrestEntryChannel::overlapN ( G4double & x)

Definition at line 250 of file G4INCLNbarAtrestEntryChannel.cc.

250 {
251 return Pabs(x,densityN());
252 }
G4double Pabs(G4double x, G4double value)

Referenced by getAnnihilationPosition().

◆ overlapP()

G4double G4INCL::NbarAtrestEntryChannel::overlapP ( G4double & x)

Definition at line 253 of file G4INCLNbarAtrestEntryChannel.cc.

253 {
254 return Pabs(x,densityP());
255
256 }

Referenced by getAnnihilationPosition().

◆ Pabs()

G4double G4INCL::NbarAtrestEntryChannel::Pabs ( G4double x,
G4double value )

Definition at line 129 of file G4INCLNbarAtrestEntryChannel.cc.

129 {
130 const G4double r = value; // center of the gaussian
131 const G4double sigma = 1;
132 return std::exp(-std::pow(x-r,2)/(2*sigma*sigma));
133 }

Referenced by overlapN(), and overlapP().

◆ ProtonIsTheVictim()

G4bool G4INCL::NbarAtrestEntryChannel::ProtonIsTheVictim ( )

Definition at line 573 of file G4INCLNbarAtrestEntryChannel.cc.

573 {
574 if(theNucleus->getAnnihilationType() == PType || theNucleus->getAnnihilationType() == DNbarPPbarPType || theNucleus->getAnnihilationType() == DNbarPPbarNType ){
575 return true; //a proton is annihilated
576 }
577 else if(theNucleus->getAnnihilationType() == NType || theNucleus->getAnnihilationType() == DNbarNPbarPType || theNucleus->getAnnihilationType() == DNbarNPbarNType){
578 return false; // a neutron is annihilated
579 }
580 else{
581 INCL_ERROR("should never happen, n or p is your only choise" << '\n');
582 G4double rdm3 = Random::shoot();
583 if(rdm3 >= 0.){
584 return false;
585 }
586 else{
587 return true;
588 }
589 }
590 }

Referenced by densityN(), densityP(), getAnnihilationPosition(), makeMesonStar(), G4INCL::StandardPropagationModel::shootAtrest(), and G4INCL::StandardPropagationModel::shootCompositeAtrest().

◆ read_file()

G4double G4INCL::NbarAtrestEntryChannel::read_file ( std::string filename,
std::vector< G4double > & probabilities,
std::vector< std::vector< std::string > > & particle_types )

Definition at line 84 of file G4INCLNbarAtrestEntryChannel.cc.

84 {
85 std::ifstream file(filename);
86 G4double sum_probs =0.0;
87 if (file.is_open()){
88 std::string line;
89 while(getline(file,line)){
90 std::istringstream iss(line);
91 G4double prob;
92 iss >> prob;
93 sum_probs += prob;
94 probabilities.push_back(prob);
95 std::vector<std::string> types;
96 std::string type;
97 while (iss >>type){
98 types.push_back(type);
99 }
100 particle_types.push_back(types);
101 }
102 }
103 else std::cout << "ERROR no fread_file " << filename << std::endl;
104
105 return sum_probs;
106 }

Referenced by makeMesonStar().


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