source: trunk/source/processes/hadronic/models/incl/src/G4Incl.cc@ 900

Last change on this file since 900 was 819, checked in by garnier, 17 years ago

import all except CVS

File size: 232.2 KB
Line 
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// $Id: G4Incl.cc,v 1.14 2007/12/04 09:49:49 gcosmo Exp $
27// Translation of INCL4.2/ABLA V3
28// Pekka Kaitaniemi, HIP (translation)
29// Christelle Schmidt, IPNL (fission code)
30// Alain Boudard, CEA (contact person INCL/ABLA)
31// Aatos Heikkinen, HIP (project coordination)
32
33#include "G4Incl.hh"
34#include <iostream>
35#include <assert.h>
36#include "Randomize.hh"
37
38G4Incl::G4Incl()
39{
40 verboseLevel = 0;
41
42 // Set functions to be used for integration routine.
43 wsaxFunction = 0;
44 derivWsaxFunction = 1;
45 dmhoFunction = 2;
46 derivMhoFunction = 3;
47 derivGausFunction = 4;
48 densFunction = 5;
49}
50
51G4Incl::G4Incl(G4Hazard *aHazard, G4Dton *aDton, G4Saxw *aSaxw, G4Ws *aWs)
52{
53 verboseLevel = 0;
54
55 // Set functions to be used for integration routine.
56 wsaxFunction = 0;
57 derivWsaxFunction = 1;
58 dmhoFunction = 2;
59 derivMhoFunction = 3;
60 derivGausFunction = 4;
61 densFunction = 5;
62
63 // Set input data for testing.
64 hazard = aHazard;
65 dton = aDton;
66 saxw = aSaxw;
67 ws = aWs;
68}
69
70G4Incl::G4Incl(G4Hazard *aHazard, G4Calincl *aCalincl, G4Ws *aWs, G4Mat *aMat, G4VarNtp *aVarntp)
71{
72 verboseLevel = 0;
73
74 // Set functions to be used for integration routine.
75 wsaxFunction = 0;
76 derivWsaxFunction = 1;
77 dmhoFunction = 2;
78 derivMhoFunction = 3;
79 derivGausFunction = 4;
80 densFunction = 5;
81
82 // Set input data for INCL run.
83 hazard = aHazard;
84 calincl = aCalincl;
85 ws = aWs;
86 mat = aMat;
87 varntp = aVarntp;
88
89 light_gaus_nuc = new G4LightGausNuc();
90 light_nuc = new G4LightNuc();
91 spl2 = new G4Spl2();
92 saxw = new G4Saxw();
93 dton = new G4Dton();
94 bl1 = new G4Bl1();
95 bl2 = new G4Bl2();
96 bl3 = new G4Bl3();
97 bl4 = new G4Bl4();
98 bl5 = new G4Bl5();
99 bl6 = new G4Bl6();
100 bl8 = new G4Bl8();
101 bl9 = new G4Bl9();
102 bl10 = new G4Bl10();
103 kindstruct = new G4Kind();
104 paul = new G4Paul();
105 varavat = new G4VarAvat();
106 varavat->kveux = 0;
107
108 volant = new G4Volant();
109 volant->iv = 0;
110 evaporationResult = new G4VarNtp();
111 evaporationResult->ntrack = -1;
112
113 // Initialize evaporation.
114 abla = new G4Abla(hazard, volant, evaporationResult);
115 abla->initEvapora();
116}
117
118G4Incl::~G4Incl()
119{
120 delete light_gaus_nuc;
121 delete light_nuc;
122 delete spl2;
123 delete saxw;
124 delete dton;
125 delete bl1;
126 delete bl2;
127 delete bl3;
128 delete bl4;
129 delete bl5;
130 delete bl6;
131 delete bl8;
132 delete bl9;
133 delete bl10;
134 delete kindstruct;
135 delete paul;
136 delete varavat;
137
138 delete abla;
139 delete evaporationResult;
140 delete volant;
141}
142
143/**
144 *Methods for debugging.
145 */
146G4double G4Incl::energyTest(G4int i)
147{
148 return am(bl1->p1[i]+bl1->p1[i],bl1->p2[i]+bl1->p2[i],bl1->p3[i]+bl1->p3[i],bl1->eps[i]+bl1->eps[i]);
149}
150
151void G4Incl::dumpBl5(std::ofstream& dumpOut)
152{
153 dumpOut <<"Dumping G4Bl5:" << G4endl;
154 for(G4int i = 0; i < 300; i++) {
155 dumpOut <<"i = " << i << " nesc[i] = " << bl5->nesc[i] << G4endl;
156 }
157}
158
159void G4Incl::dumpSaxw(std::ofstream& dumpOut)
160{
161 dumpOut << "Dumping G4Saxw" << G4endl;
162 dumpOut << "saxw->k = " << saxw->k << G4endl;
163 dumpOut << "saxw->n = " << saxw->n << G4endl;
164 dumpOut << "saxw->imat = " << saxw->imat << G4endl;
165 for(G4int i = 0; i < 30; i++) {
166 dumpOut <<"i = " << i << " x = " << saxw->x[i][0] << " y = " << saxw->y[i][0] << " s = " << saxw->s[i][0] << G4endl;
167 }
168}
169
170void G4Incl::dumpBl1(std::ofstream& dumpOut)
171{
172 dumpOut <<"Dumping Bl1: " << G4endl;
173 dumpOut <<"bl1->ta = " << bl1->ta << G4endl;
174 for(G4int i = 0; i <= bl2->k; i++) {
175 dumpOut <<"i = " << i;
176 dumpOut <<" bl1->p1 = " << bl1->p1[i] << " bl1->p2 = " << bl1->p2[i] <<" bl1->p3 = " << bl1->p3[i];
177 dumpOut <<" bl1->eps = " << bl1->eps[i];
178 dumpOut <<" bl1->ind1 = " << bl1->ind1[i] <<" bl1->ind2 = " << bl1->ind2[i] << G4endl;
179 }
180 dumpOut <<"End of Bl1 dump." << G4endl << G4endl;
181}
182
183void G4Incl::dumpBl2(std::ofstream& dumpOut)
184{
185 dumpOut <<"Dumping Bl2: bl2->k = " << bl2->k << G4endl;
186 for(G4int i = 0; i <= bl2->k; i++) {
187 dumpOut <<"i = " << i;
188 dumpOut <<" bl2->ind " << bl2->ind[i] << " bl2->jnd = " << bl2->jnd[i] <<" bl2->crois = " << bl2->crois[i] << G4endl;
189 }
190 dumpOut <<"End of Bl2 dump." << G4endl << G4endl;}
191
192
193void G4Incl::dumpBl3(std::ofstream& dumpOut)
194{
195 dumpOut <<"Dumping Bl3:" << G4endl;
196 dumpOut <<"r1 = " << bl3->r1 << " r2 = " << bl3->r2 << G4endl;
197 dumpOut <<"ia1 = " << bl3->ia1 << " ia2 = " << bl3->ia2 << G4endl;
198 dumpOut <<"rab2 = " << bl3->rab2 << G4endl;
199
200 for(G4int i = 0; i <= bl2->k; i++) {
201 dumpOut <<"i = " << i;
202 dumpOut <<" bl3->x1 = " << bl3->x1[i] << " bl3->x2 = " << bl3->x2[i] <<" bl3->x3 = " << bl3->x3[i] << G4endl;
203 }
204 dumpOut <<"End of Bl2 dump." << G4endl << G4endl;
205}
206
207// End debug functions
208
209void G4Incl::setVerboseLevel(G4int level)
210{
211 verboseLevel = level;
212}
213
214G4int G4Incl::getVerboseLevel()
215{
216 return verboseLevel;
217}
218
219void G4Incl::setDtonData(G4Dton *newDton)
220{
221 dton = newDton;
222}
223
224void G4Incl::setWsData(G4Ws *newWs)
225{
226 ws = newWs;
227}
228
229void G4Incl::setHazardData(G4Hazard *newHazard)
230{
231 hazard = newHazard;
232}
233
234void G4Incl::setSaxwData(G4Saxw *newSaxw)
235{
236 saxw = newSaxw;
237}
238
239void G4Incl::setSpl2Data(G4Spl2 *newSpl2)
240{
241 spl2 = newSpl2;
242}
243
244void G4Incl::setCalinclData(G4Calincl *newCalincl)
245{
246 calincl = newCalincl;
247}
248
249void G4Incl::setMatData(G4Mat *newMat)
250{
251 mat = newMat;
252}
253
254void G4Incl::setLightNucData(G4LightNuc *newLightNuc)
255{
256 light_nuc = newLightNuc;
257}
258
259void G4Incl::setLightGausNucData(G4LightGausNuc *newLightGausNuc)
260{
261 light_gaus_nuc = newLightGausNuc;
262}
263
264void G4Incl::setBl1Data(G4Bl1 *newBl1)
265{
266 bl1 = newBl1;
267}
268
269void G4Incl::setBl2Data(G4Bl2 *newBl2)
270{
271 bl2 = newBl2;
272}
273
274void G4Incl::setBl3Data(G4Bl3 *newBl3)
275{
276 bl3 = newBl3;
277}
278
279void G4Incl::setBl4Data(G4Bl4 *newBl4)
280{
281 bl4 = newBl4;
282}
283
284void G4Incl::setBl5Data(G4Bl5 *newBl5)
285{
286 bl5 = newBl5;
287}
288
289void G4Incl::setBl6Data(G4Bl6 *newBl6)
290{
291 bl6 = newBl6;
292}
293
294void G4Incl::setBl8Data(G4Bl8 *newBl8)
295{
296 bl8 = newBl8;
297}
298
299void G4Incl::setBl9Data(G4Bl9 *newBl9)
300{
301 bl9 = newBl9;
302}
303
304void G4Incl::setBl10Data(G4Bl10 *newBl10)
305{
306 bl10 = newBl10;
307}
308
309void G4Incl::setKindData(G4Kind *newKind)
310{
311 kindstruct = newKind;
312}
313
314/**
315 * INCL main routines for event processing.
316 */
317
318void G4Incl::processEventIncl()
319{
320 const G4double uma = 931.4942;
321 const G4double melec = 0.511;
322
323 G4double pcorem;
324 G4double pxrem;
325 G4double pyrem;
326 G4double pzrem;
327
328 G4double ap = 0.0, zp = 0.0, mprojo = 0.0, pbeam = 0.0;
329
330 if(calincl->f[6] == 3.0) { // pi+
331 mprojo = 139.56995;
332 ap = 0.0;
333 zp = 1.0;
334 }
335
336 if(calincl->f[6] == 4.0) { // pi0
337 mprojo = 134.9764;
338 ap = 0.0;
339 zp = 0.0;
340 }
341
342 if(calincl->f[6] == 5.0) { // pi-
343 mprojo = 139.56995;
344 ap = 0.0;
345 zp = -1.0;
346 }
347
348 // Coulomb en entree seulement pour les particules ci-dessous.
349 if(calincl->f[6] == 1.0) { // proton
350 mprojo = 938.27231;
351 ap = 1.0;
352 zp = 1.0;
353 }
354
355 if(calincl->f[6] == 2.0) { // neutron
356 mprojo = 939.56563;
357 ap = 1.0;
358 zp = 0.0;
359 }
360
361 if(calincl->f[6] == 6.0) { // deuteron
362 mprojo = 1875.61276;
363 ap = 2.0;
364 zp = 1.0;
365 }
366
367 if(calincl->f[6] == 7.0) { // triton
368 mprojo = 2808.95;
369 ap = 3.0;
370 zp = 1.0;
371 }
372
373 if(calincl->f[6] == 8.0) { // He3
374 mprojo = 2808.42;
375 ap = 3.0;
376 zp = 2.0;
377 }
378
379 if(calincl->f[6] == 9.0) { // Alpha
380 mprojo = 3727.42;
381 ap = 4.0;
382 zp = 2.0;
383 }
384
385 pbeam = std::sqrt(calincl->f[2]*(calincl->f[2] + 2.0*mprojo));
386
387 G4double at = calincl->f[0];
388
389 calincl->f[3] = 0.0; // seuil sortie proton
390 calincl->f[7] = 0.0; // seuil sortie neutron
391
392 G4int ibert = 1;
393
394 G4int nopart;
395 G4int izrem;
396 G4int iarem;
397 G4double esrem;
398 G4double erecrem;
399 G4double berem;
400 G4double garem;
401 G4double bimpac;
402 G4int jrem;
403 G4double alrem;
404
405 /**
406 * Coulomb barrier treatment.
407 */
408 G4double probaTrans;
409 G4double rndm;
410 if((calincl->f[6] == 1.0) || (calincl->f[6] >= 6.0)) {
411 probaTrans = coulombTransm(calincl->f[2],ap,zp,calincl->f[0],calincl->f[1]);
412 standardRandom(&rndm, &(hazard->ial));
413 if(rndm <= (1.0 - probaTrans)) {
414 varntp->ntrack = -1;
415 return;
416 }
417 }
418
419 /**
420 * Call the actual INCL routine.
421 */
422 pnu(&ibert, &nopart,&izrem,&iarem,&esrem,&erecrem,&alrem,&berem,&garem,&bimpac,&jrem);
423 forceAbsor(&nopart, &iarem, &izrem, &esrem, &erecrem, &alrem, &berem, &garem, &jrem);
424 G4double aprf = double(iarem); // mass number of the prefragment
425 G4double jprf = 0.0; // angular momentum of the prefragment
426
427 // Mean angular momentum of prefragment.
428 jprf = 0.165 * std::pow(at,(2.0/3.0)) * aprf * (at - aprf) / (at - 1.0);
429 if (jprf < 0) {
430 jprf = 0.0;
431 }
432
433 // Reference M. de Jong, Ignatyuk, Schmidt Nuc. Phys A 613, p442, 7th line
434 jprf = std::sqrt(2*jprf);
435 jprf = jrem;
436 varntp->jremn = jrem; // Copy jrem to output tuple.
437
438 G4double numpi = 0; // Number of pions.
439 G4double multn = 0; // Number (multiplicity) of neutrons.
440 G4double multp = 0; // Number (multiplicity) of protons.
441
442 // Ecriture dans le ntuple des particules de cascade (sauf remnant).
443 varntp->ntrack = nopart; // Nombre de particules pour ce tir.
444 varntp->massini = iarem;
445 varntp->mzini = izrem;
446 varntp->exini = esrem;
447 varntp->bimpact = bimpac;
448
449 /**
450 * Three ways to compute the mass of the remnant:
451 * -from the output of the cascade and the canonic mass
452 * -from energy balance (input - all emitted energies)
453 * -following the approximations of the cugnon code (esrem...)
454 */
455 G4double f0 = calincl->f[0];
456 G4double f1 = calincl->f[1];
457 G4double f2 = calincl->f[2];
458 G4double mcorem = mprojo + f2 + abla->pace2(f0, f1) + f0 * uma - f1 * melec;
459
460 G4double pxbil = 0.0;
461 G4double pybil = 0.0;
462 G4double pzbil = 0.0;
463
464 if(nopart > -1) {
465 for(G4int j = 0; j < nopart; j++) {
466 varntp->itypcasc[j] = 1;
467 // kind(): 1=proton, 2=neutron, 3=pi+, 4=pi0, 5=pi -
468 if(kind[j] == 1) {
469 varntp->avv[j] = 1;
470 varntp->zvv[j] = 1;
471 varntp->plab[j] = std::sqrt(ep[j] * (ep[j] + 1876.5592)); // cugnon
472 multp = multp + 1;
473 mcorem = mcorem - ep[j] - 938.27231;
474 if(verboseLevel > 3) {
475 G4cout <<"G4Incl: Proton produced! " << G4endl;
476 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
477 }
478 }
479
480 if(kind[j] == 2) {
481 varntp->avv[j] = 1;
482 varntp->zvv[j] = 0;
483 varntp->plab[j] = std::sqrt(ep[j]*(ep[j]+1876.5592)); // cugnon
484 //varntp->plab[j] = std::sqrt(ep[j] * (ep[j] + 1879.13126)); // PK mass check
485 multn = multn + 1;
486 mcorem = mcorem - ep[j] - 939.56563;
487 if(verboseLevel > 3) {
488 G4cout <<"G4Incl: Neutron produced! " << G4endl;
489 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
490 }
491 }
492
493 if(kind[j] == 3) {
494 varntp->avv[j] = -1;
495 varntp->zvv[j] = 1;
496 varntp->plab[j] = std::sqrt(ep[j]*(ep[j]+276.0)); // cugnon
497 numpi = numpi + 1;
498 mcorem = mcorem - ep[j] - 139.56995;
499 if(verboseLevel > 3) {
500 G4cout <<"G4Incl: Pi+ produced! " << G4endl;
501 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
502 }
503 }
504
505 if(kind[j] == 4) {
506 varntp->avv[j] = -1;
507 varntp->zvv[j] = 0;
508 varntp->plab[j] = std::sqrt(ep[j]*(ep[j]+276.0)); // cugnon
509 numpi = numpi + 1;
510 mcorem = mcorem - ep[j] - 134.9764;
511 if(verboseLevel > 3) {
512 G4cout <<"G4Incl: Pi0 produced! " << G4endl;
513 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
514 }
515 }
516
517 if(kind[j] == 5) {
518 varntp->avv[j] = -1;
519 varntp->zvv[j] = -1;
520 varntp->plab[j] = std::sqrt(ep[j]*(ep[j]+276.0)); // cugnon
521 numpi = numpi + 1;
522 mcorem = mcorem - ep[j] - 139.56995;
523 if(verboseLevel > 3) {
524 G4cout <<"G4Incl: Pi+ produced! " << G4endl;
525 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
526 }
527 }
528
529 if(kind[j] == 6) {
530 varntp->avv[j] = 2;
531 varntp->zvv[j] = 1;
532 varntp->plab[j] = std::sqrt(ep[j]*(ep[j] + 2.0*1874.34)); // cugnon
533 numpi = numpi + 1;
534 mcorem = mcorem - ep[j] - 2806.359;
535 if(verboseLevel > 3) {
536 G4cout <<"G4Incl: Deuteron produced! " << G4endl;
537 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
538 }
539 }
540
541 if(kind[j] == 7) {
542 varntp->avv[j] = 3;
543 varntp->zvv[j] = 1;
544 varntp->plab[j] = std::sqrt(ep[j]*(ep[j] + 2.0*2806.359)); // cugnon
545 numpi = numpi + 1;
546 mcorem = mcorem - ep[j] - 2806.359;
547 if(verboseLevel > 3) {
548 G4cout <<"G4Incl: Triton produced! " << G4endl;
549 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
550 }
551 }
552
553 if(kind[j] == 8) {
554 varntp->avv[j] = 3;
555 varntp->zvv[j] = 2;
556 varntp->plab[j] = std::sqrt(ep[j]*(ep[j] + 2.0*2807.119)); // cugnon
557 numpi = numpi + 1;
558 mcorem = mcorem - ep[j] - 2807.119;
559 if(verboseLevel > 3) {
560 G4cout <<"G4Incl: He3 produced! " << G4endl;
561 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
562 }
563 }
564
565 if(kind[j] == 9) {
566 varntp->avv[j] = 4;
567 varntp->zvv[j] = 2;
568 varntp->plab[j] = std::sqrt(ep[j]*(ep[j] + 2.0*3724.818)); // cugnon
569 numpi = numpi + 1;
570 mcorem = mcorem - ep[j] - 3724.818;
571 if(verboseLevel > 3) {
572 G4cout <<"G4Incl: He4 produced! " << G4endl;
573 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
574 }
575 }
576
577 varntp->enerj[j] = ep[j];
578 varntp->tetlab[j] = 180.0*std::acos(gam[j])/3.141592654;
579 varntp->philab[j] = 180.0*std::atan2(beta[j],alpha[j])/3.141592654;
580 pxbil = pxbil + varntp->plab[j]*alpha[j];
581 pybil = pybil + varntp->plab[j]*beta[j];
582 pzbil = pzbil + varntp->plab[j]*gam[j];
583
584 if(verboseLevel > 3) {
585 G4cout <<"Momentum: " << varntp->plab[j] << G4endl;
586 G4cout <<"Theta: " << varntp->tetlab[j] << G4endl;
587 G4cout <<"Phi: " << varntp->philab[j] << G4endl;
588 }
589 }
590
591 // calcul de la masse (impulsion) du remnant coherente avec la conservation d'energie:
592 pcorem=std::sqrt(erecrem*(erecrem +2.*938.2796*iarem)); // cugnon
593 mcorem = 938.2796*iarem; // cugnon
594
595 // Note: Il faut negliger l'energie d'excitation (ESREM) pour que le bilan
596 // d'impulsion soit correct a la sortie de la cascade.....et prendre la
597 // masse MCOREM comme ci-dessus (fausse de ~1GeV par rapport aux tables...)
598 pxrem=pcorem*alrem;
599 pyrem=pcorem*berem;
600 pzrem=pcorem*garem;
601
602 pxbil=pxbil+pxrem;
603 pybil=pybil+pyrem;
604 pzbil=pzbil+pzrem;
605
606 if((std::fabs(pzbil-pbeam) > 5.0) || (std::sqrt(std::pow(pxbil,2)+std::pow(pybil,2)) >= 3.0)) {
607 if(verboseLevel > 3) {
608 G4cout <<"bad momentum conservation after incl:" << G4endl;
609 }
610 }
611
612 volant->iv = 0; // init du compteur des part evaporees
613 varntp->kfis = 0; //drapeau de fission copie dans le ntuple
614 varntp->estfis = 0.0;
615 varntp->izfis = 0;
616 varntp->iafis = 0;
617
618 // varntp->ntrack = varntp->ntrack + 1; // on recopie le remnant dans le ntuple
619 varntp->massini = iarem;
620 varntp->mzini = izrem;
621 varntp->exini = esrem;
622 varntp->itypcasc[varntp->ntrack] = 1;
623 varntp->avv[varntp->ntrack] = iarem;
624 varntp->zvv[varntp->ntrack]= izrem;
625 varntp->plab[varntp->ntrack] = pcorem;
626 varntp->enerj[varntp->ntrack] = std::sqrt(std::pow(pcorem,2) + std::pow(mcorem,2)) - mcorem;
627 varntp->tetlab[varntp->ntrack] = 180.0*std::acos(garem)/3.141592654;
628 varntp->philab[varntp->ntrack] = 180.0*std::atan2(berem,alrem)/3.141592654;
629 varntp->ntrack++;
630 varntp->mulncasc = varntp->ntrack;
631 varntp->mulnevap = 0;
632 varntp->mulntot = varntp->mulncasc + varntp->mulnevap;
633 if(verboseLevel > 3) {
634 G4cout <<"G4Incl: Returning nucleus fragment. " << G4endl;
635 G4cout <<"G4Incl: Fragment A = " << varntp->avv[varntp->ntrack] << " Z = " << varntp->zvv[varntp->ntrack] << G4endl;
636 G4cout <<"Energy: " << varntp->enerj[varntp->ntrack] << G4endl;
637 G4cout <<"Momentum: " << varntp->plab[varntp->ntrack] << G4endl;
638 G4cout <<"Theta: " << varntp->tetlab[varntp->ntrack] << G4endl;
639 G4cout <<"Phi: " << varntp->philab[varntp->ntrack] << G4endl;
640 }
641 }
642 else {
643 if(nopart == -2) {
644 varntp->ntrack = -2; //FIX: Error flag to remove events containing unphysical events (Ekin > Ebullet).
645 }
646 else {
647 varntp->ntrack = -1;
648 }
649 }
650}
651
652
653void G4Incl::processEventInclAbla(G4int eventnumber)
654{
655 const G4double uma = 931.4942;
656 const G4double melec = 0.511;
657
658 G4double pcorem;
659 G4double pxrem;
660 G4double pyrem;
661 G4double pzrem;
662
663 G4double ap = 0.0, zp = 0.0, mprojo = 0.0, pbeam = 0.0;
664
665 // pi+
666 if(calincl->f[6] == 3.0) {
667 mprojo = 139.56995;
668 ap = 0.0;
669 zp = 1.0;
670 }
671
672 // pi0
673 if(calincl->f[6] == 4.0) {
674 mprojo = 134.9764;
675 ap = 0.0;
676 zp = 0.0;
677 }
678
679 // pi-
680 if(calincl->f[6] == 5.0) {
681 mprojo = 139.56995;
682 ap = 0.0;
683 zp = -1.0;
684 }
685
686 // coulomb en entree seulement pour les particules ci-dessous
687
688 // proton
689 if(calincl->f[6] == 1.0) {
690 mprojo = 938.27231;
691 ap = 1.0;
692 zp = 1.0;
693 }
694
695 // neutron
696 if(calincl->f[6] == 2.0) {
697 mprojo = 939.56563;
698 ap = 1.0;
699 zp = 0.0;
700 }
701
702 // deuteron
703 if(calincl->f[6] == 6.0) {
704 mprojo = 1875.61276;
705 ap = 2.0;
706 zp = 1.0;
707 }
708
709 // triton
710 if(calincl->f[6] == 7.0) {
711 mprojo = 2808.95;
712 ap = 3.0;
713 zp = 1.0;
714 }
715
716 // He3
717 if(calincl->f[6] == 8.0) {
718 mprojo = 2808.42;
719 ap = 3.0;
720 zp = 2.0;
721 }
722
723 // Alpha
724 if(calincl->f[6] == 9.0) {
725 mprojo = 3727.42;
726 ap = 4.0;
727 zp = 2.0;
728 }
729
730 pbeam = std::sqrt(calincl->f[2]*(calincl->f[2] + 2.0*mprojo));
731
732 G4double at = calincl->f[0];
733
734 calincl->f[3] = 0.0; // !seuil sortie proton
735 calincl->f[7] = 0.0; // !seuil sortie neutron
736
737 G4int ibert = 1;
738
739 G4int nopart;
740 G4int izrem;
741 G4int iarem;
742 G4double esrem;
743 G4double erecrem;
744 G4double berem;
745 G4double garem;
746 G4double bimpac;
747 G4int jrem;
748 G4double alrem;
749
750 // Coulomb barrier
751
752 G4double probaTrans;
753 G4double rndm;
754
755 if((calincl->f[6] == 1.0) || (calincl->f[6] >= 6.0)) {
756 // probaTrans = coulombTransm(calincl->f[2],apro,zpro,calincl->f[0],calincl->f[1]);
757 probaTrans = coulombTransm(calincl->f[2],ap,zp,calincl->f[0],calincl->f[1]);
758 standardRandom(&rndm, &(hazard->ial));
759 if(rndm <= (1.0 - probaTrans)) {
760 varntp->ntrack = -1;
761 return;
762 }
763 }
764
765 // Call the actual INCL routine:
766 pnu(&ibert, &nopart,&izrem,&iarem,&esrem,&erecrem,&alrem,&berem,&garem,&bimpac,&jrem);
767
768 forceAbsor(&nopart, &iarem, &izrem, &esrem, &erecrem, &alrem, &berem, &garem, &jrem);
769 G4double aprf = double(iarem); // mass number of the prefragment
770 G4double jprf = 0.0; // angular momentum of the prefragment
771
772 // Mean angular momentum of prefragment
773 jprf = 0.165 * std::pow(at,(2.0/3.0)) * aprf*(at - aprf)/(at - 1.0);
774 if (jprf < 0) {
775 jprf = 0.0;
776 }
777
778 // check m.de jong, ignatyuk, schmidt nuc.phys a 613, pg442, 7th line
779 jprf = std::sqrt(2*jprf);
780
781 jprf = jrem;
782 varntp->jremn = jrem; // jrem copie dans le ntuple
783
784 G4double numpi = 0; // compteurs de pions, neutrons protons
785 G4double multn = 0;
786 G4double multp = 0;
787
788 // ecriture dans le ntuple des particules de cascade (sauf remnant)
789 varntp->ntrack = nopart; // nombre de particules pour ce tir
790 if(varntp->ntrack >= VARNTPSIZE) {
791 if(verboseLevel > 2) {
792 G4cout <<"G4Incl error: Output data structure not big enough." << G4endl;
793 }
794 }
795 varntp->massini = iarem;
796 varntp->mzini = izrem;
797 varntp->exini = esrem;
798 varntp->bimpact = bimpac;
799
800 // three ways to compute the mass of the remnant:
801 // -from the output of the cascade and the canonic mass
802 // -from energy balance (input - all emitted energies)
803 // -following the approximations of the cugnon code (esrem...)
804 G4double mcorem = mprojo + calincl->f[2] + abla->pace2(double(calincl->f[0]),double(calincl->f[1]))
805 + calincl->f[0]*uma - calincl->f[1]*melec;
806
807 G4double pxbil = 0.0;
808 G4double pybil = 0.0;
809 G4double pzbil = 0.0;
810
811 if(nopart > -1) {
812 for(G4int j = 0; j < nopart; j++) {
813 varntp->itypcasc[j] = 1;
814 // kind(): 1=proton, 2=neutron, 3=pi+, 4=pi0, 5=pi -
815 if(kind[j] == 1) {
816 varntp->avv[j] = 1;
817 varntp->zvv[j] = 1;
818 varntp->plab[j] = std::sqrt(ep[j]*(ep[j]+1876.5592)); // cugnon
819 multp = multp + 1;
820 mcorem = mcorem - ep[j] - 938.27231;
821 if(verboseLevel > 3) {
822 G4cout <<"G4Incl: Proton produced! " << G4endl;
823 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
824 }
825 }
826
827 if(kind[j] == 2) {
828 varntp->avv[j] = 1;
829 varntp->zvv[j] = 0;
830 varntp->plab[j] = std::sqrt(ep[j]*(ep[j]+1876.5592)); // cugnon
831 multn = multn + 1;
832 mcorem = mcorem - ep[j] - 939.56563;
833 if(verboseLevel > 3) {
834 G4cout <<"G4Incl: Neutron produced! " << G4endl;
835 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
836 }
837 }
838
839 if(kind[j] == 3) {
840 varntp->avv[j] = -1;
841 varntp->zvv[j] = 1;
842 varntp->plab[j] = std::sqrt(ep[j]*(ep[j]+276.0)); // cugnon
843 numpi = numpi + 1;
844 mcorem = mcorem - ep[j] - 139.56995;
845 if(verboseLevel > 3) {
846 G4cout <<"G4Incl: Pi+ produced! " << G4endl;
847 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
848 }
849 }
850
851 if(kind[j] == 4) {
852 varntp->avv[j] = -1;
853 varntp->zvv[j] = 0;
854 varntp->plab[j] = std::sqrt(ep[j]*(ep[j]+276.0)); // cugnon
855 numpi = numpi + 1;
856 mcorem = mcorem - ep[j] - 134.9764;
857 if(verboseLevel > 3) {
858 G4cout <<"G4Incl: Pi0 produced! " << G4endl;
859 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
860 }
861 }
862
863 if(kind[j] == 5) {
864 varntp->avv[j] = -1;
865 varntp->zvv[j] = -1;
866 varntp->plab[j] = std::sqrt(ep[j]*(ep[j]+276.0)); // cugnon
867 numpi = numpi + 1;
868 mcorem = mcorem - ep[j] - 139.56995;
869 if(verboseLevel > 3) {
870 G4cout <<"G4Incl: Pi+ produced! " << G4endl;
871 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
872 }
873 }
874
875 if(kind[j] == 6) {
876 varntp->avv[j] = 2;
877 varntp->zvv[j] = 1;
878 varntp->plab[j] = std::sqrt(ep[j]*(ep[j] + 2.0*1874.34)); // cugnon
879 numpi = numpi + 1;
880 mcorem = mcorem - ep[j] - 2806.359;
881 if(verboseLevel > 3) {
882 G4cout <<"G4Incl: Deuteron produced! " << G4endl;
883 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
884 }
885 }
886
887 if(kind[j] == 7) {
888 varntp->avv[j] = 3;
889 varntp->zvv[j] = 1;
890 varntp->plab[j] = std::sqrt(ep[j]*(ep[j] + 2.0*2806.359)); // cugnon
891 numpi = numpi + 1;
892 mcorem = mcorem - ep[j] - 2806.359;
893 if(verboseLevel > 3) {
894 G4cout <<"G4Incl: Triton produced! " << G4endl;
895 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
896 }
897 }
898
899 if(kind[j] == 8) {
900 varntp->avv[j] = 3;
901 varntp->zvv[j] = 2;
902 varntp->plab[j] = std::sqrt(ep[j]*(ep[j] + 2.0*2807.119)); // cugnon
903 numpi = numpi + 1;
904 mcorem = mcorem - ep[j] - 2807.119;
905 if(verboseLevel > 3) {
906 G4cout <<"G4Incl: He3 produced! " << G4endl;
907 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
908 }
909 }
910
911 if(kind[j] == 9) {
912 varntp->avv[j] = 4;
913 varntp->zvv[j] = 2;
914 varntp->plab[j] = std::sqrt(ep[j]*(ep[j] + 2.0*3724.818)); // cugnon
915 numpi = numpi + 1;
916 mcorem = mcorem - ep[j] - 3724.818;
917 if(verboseLevel > 3) {
918 G4cout <<"G4Incl: He3 produced! " << G4endl;
919 G4cout <<"G4Incl: Momentum: "<< varntp->plab[j] << G4endl;
920 }
921 }
922
923 varntp->enerj[j] = ep[j];
924 varntp->tetlab[j] = 180.0*std::acos(gam[j])/3.141592654;
925 varntp->philab[j] = 180.0*std::atan2(beta[j],alpha[j])/3.141592654;
926 pxbil = pxbil + varntp->plab[j]*alpha[j];
927 pybil = pybil + varntp->plab[j]*beta[j];
928 pzbil = pzbil + varntp->plab[j]*gam[j];
929
930 if(verboseLevel > 3) {
931 G4cout <<"Momentum: " << varntp->plab[j] << G4endl;
932 G4cout <<"Theta: " << varntp->tetlab[j] << G4endl;
933 G4cout <<"Phi: " << varntp->philab[j] << G4endl;
934 }
935 }
936
937 // calcul de la masse (impulsion) du remnant coherente avec la conservation d'energie:
938 pcorem = std::sqrt(erecrem*(erecrem + 2.0 * 938.2796 * iarem)); // cugnon
939 mcorem = 938.2796 * iarem; // cugnon
940
941 // Note: Il faut negliger l'energie d'excitation (ESREM) pour que le bilan
942 // d'impulsion soit correct a la sortie de la cascade.....et prendre la
943 // masse MCOREM comme ci-dessus (fausse de ~1GeV par rapport aux tables...)
944 pxrem = pcorem * alrem;
945 pyrem = pcorem * berem;
946 pzrem = pcorem * garem;
947
948 pxbil = pxbil + pxrem;
949 pybil = pybil + pyrem;
950 pzbil = pzbil + pzrem;
951
952 if((std::fabs(pzbil - pbeam) > 5.0) || (std::sqrt(std::pow(pxbil,2) + std::pow(pybil,2)) >= 3.0)) {
953 if(verboseLevel > 3) {
954 G4cout <<"bad momentum conservation after incl:" << G4endl;
955 }
956 }
957
958 volant->iv = 0; // init du compteur des part evaporees
959 varntp->kfis = 0; //drapeau de fission copie dans le ntuple
960 varntp->estfis = 0.0;
961 varntp->izfis = 0;
962 varntp->iafis = 0;
963
964 // on recopie le remnant dans le ntuple
965 // varntp->ntrack = varntp->ntrack + 1;
966 varntp->massini = iarem;
967 varntp->mzini = izrem;
968 varntp->exini = esrem;
969
970 // Evaporation/fission:
971 evaporationResult->ntrack = 0;
972 abla->breakItUp(varntp->massini, varntp->mzini, mcorem, varntp->exini, varntp->jremn,
973 erecrem, pxrem, pyrem, pzrem, eventnumber);
974
975 // assert(evaporationResult->ntrack > 0);
976 for(G4int evaporatedParticle = 1; evaporatedParticle < evaporationResult->ntrack; evaporatedParticle++) {
977 if(evaporationResult->avv[evaporatedParticle] == 0 && evaporationResult->zvv[evaporatedParticle] == 0) { //Fix: Skip "empty" particles with A = 0 and Z = 0
978 continue;
979 }
980 varntp->kfis = evaporationResult->kfis;
981 varntp->itypcasc[varntp->ntrack] = evaporationResult->itypcasc[evaporatedParticle];
982 varntp->avv[varntp->ntrack] = evaporationResult->avv[evaporatedParticle];
983 varntp->zvv[varntp->ntrack]= evaporationResult->zvv[evaporatedParticle];
984 varntp->plab[varntp->ntrack] = evaporationResult->plab[evaporatedParticle];
985 varntp->enerj[varntp->ntrack] = evaporationResult->enerj[evaporatedParticle];
986 varntp->tetlab[varntp->ntrack] = evaporationResult->tetlab[evaporatedParticle];
987 varntp->philab[varntp->ntrack] = evaporationResult->philab[evaporatedParticle];
988 varntp->ntrack++;
989 if(verboseLevel > 3) {
990 G4cout <<"G4Incl: Returning evaporation result" << G4endl;
991 G4cout <<"G4Incl: A = " << varntp->avv[varntp->ntrack] << " Z = " << varntp->zvv[varntp->ntrack] << G4endl;
992 G4cout <<"Energy: " << varntp->enerj[varntp->ntrack] << G4endl;
993 G4cout <<"Momentum: " << varntp->plab[varntp->ntrack] << G4endl;
994 G4cout <<"Theta: " << varntp->tetlab[varntp->ntrack] << G4endl;
995 G4cout <<"Phi: " << varntp->philab[varntp->ntrack] << G4endl;
996 }
997 }
998 if(verboseLevel > 2) {
999 G4cout <<"G4Incl: ntrack = " << varntp->ntrack << G4endl;
1000 G4cout <<"G4Incl: Done extracting..." << G4endl;
1001 }
1002 }
1003 if(nopart == -2) {
1004 varntp->ntrack = -2; //FIX: Error flag to remove events containing unphysical events (Ekin > Ebullet).
1005 evaporationResult->ntrack = -2; //FIX: Error flag to remove events containing unphysical events (Ekin > Ebullet).
1006 }
1007 else if(nopart == -1) {
1008 varntp->ntrack = -1;
1009 evaporationResult->ntrack = -1;
1010 }
1011}
1012
1013// Initialization routines
1014void G4Incl::initIncl(G4bool initRandomSeed)
1015{
1016 // Subroutine for initialisation of intranuclear cascade incl
1017 //
1018 // this will read some specific parameters for incl,
1019 // prepare the saxon-wood density for each nucleus
1020 // compute the deuteron momentum space density from paris pot.
1021 // print some global informations
1022 //
1023 // input: should contain z and a for nbmat nucleus considered in this problem
1024 //
1025 // input: should contain a seed (ial, odd and of 5 digits) to start the work.
1026
1027 G4double xrand;
1028 G4double ialdep;
1029 G4int imat;
1030 G4int iamat, izmat;
1031
1032 // for the 19 secondary seeds of hazard:
1033 G4int nbtirhaz[IGRAINESIZE] = {38,82,76,18,39,31,41,59,26,54,
1034 14,84,13,15,91,89,10,6,52};
1035
1036 // specific parameters for incl:
1037 // espace de phases test (r et p) pour pauli:
1038 // valeur recommandee par j.c. v-test=0.592 h**3:
1039 G4double rbl = 2.;
1040
1041 // valeur pour avoir v-test=2 h**3 (avec pbl=200)
1042 rbl = 3.1848;
1043
1044 // preparation of 19 other seeds (can also be initialized from outside):
1045 if(initRandomSeed) {
1046 ialdep=hazard->ial;
1047 for(int i = 0; i < IGRAINESIZE; i++) {
1048 for(int j = 0; j < nbtirhaz[i]; j++) {
1049 standardRandom(&xrand,&(hazard->ial));
1050 }
1051
1052 // Zero is not accepted as random seed!
1053 do {
1054 standardRandom(&xrand,&(hazard->ial));
1055 } while(xrand == 0);
1056
1057 xrand = xrand * 100000;
1058
1059 while(xrand < 10000) {
1060 xrand = xrand * 10;
1061 }
1062 hazard->igraine[i] = (int) xrand;
1063 if(hazard->igraine[i] == ((hazard->igraine[i] / 2) * 2)) {
1064 hazard->igraine[i] = hazard->igraine[i] + 1;
1065 }
1066 }
1067
1068 hazard->ial = int(ialdep);
1069 }
1070
1071 // calculation with realistic nuclear density (saxon-wood)
1072 if (ws->nosurf <= 0) {
1073 // prepare nucleus density for nbmat nucleus defined in struct mat
1074 if(mat->nbmat >= 500) {
1075 if(verboseLevel > 2) {
1076 G4cout <<"You need " << mat->nbmat << " nuclei in your problem. The maximum number of nuclei is 500 " << G4endl;
1077 }
1078 return;
1079 }
1080
1081 for(G4int i = 0; i < mat->nbmat; i++) {
1082 imat = i;
1083 izmat = int(mat->zmat[i]);
1084 iamat = int(mat->amat[i]);
1085
1086 initMaterial(izmat, iamat, imat);
1087 }
1088 }
1089
1090 // deuteron density in momentum space:
1091 densDeut();
1092}
1093
1094
1095void G4Incl::initMaterial(G4int izmat, G4int iamat, G4int imat)
1096{
1097 G4double res_dws;
1098 G4double fnor;
1099
1100 G4double rcour, geom;
1101 G4int nbr;
1102
1103 G4double step, f_r;
1104
1105 // rms espace r, espace p, fermi momentum and energy for light gauss nuc.
1106 const G4double datarms1t[LGNSIZE] = {0.0, 0.0, 0.0, 0.0, 0.0, 2.10, 1.80, 1.80, 1.63};
1107 const G4double datapf1t[LGNSIZE] = {0.0, 0.0, 0.0, 0.0, 0.0, 77.0, 110.0, 110.0, 153.0};
1108
1109 for(G4int i = 0; i < LGNSIZE; i++) {
1110 light_gaus_nuc->rms1t[i] = datarms1t[i];
1111 light_gaus_nuc->pf1t[i] = datapf1t[i];
1112 }
1113
1114 // fermi 2 param from a=19 to 28, modified harm oscil a=6 to 18
1115 // (h. de vries et al. at. data and nuc. data tab. 36 (1987) 495)
1116 const G4double datarln[LNSIZE] = {0.0,0.0,0.0,0.0,0.0,0.334,0.327,0.479,0.631,0.838,
1117 0.811,1.07,1.403,1.335,1.25,1.544,1.498,1.513,
1118 2.58,2.77, 2.775,2.78,2.88,2.98,3.22,3.03,2.84,
1119 3.14,0.0,0.0};
1120
1121 const G4double dataaln[LNSIZE] = {0.0,0.0,0.0,0.0,0.0,1.78,1.77,1.77,1.77,1.71,
1122 1.69,1.69,1.635,1.730,1.81,1.833,1.798,
1123 1.841,0.567,0.571, 0.560,0.549,0.550,0.551,
1124 0.580,0.575,0.569,0.537,0.0,0.0};
1125
1126 for(G4int i = 0; i < LNSIZE; i++) {
1127 light_nuc->r[i] = datarln[i];
1128 light_nuc->a[i] = dataaln[i];
1129 }
1130
1131 if(verboseLevel > 3) {
1132 G4cout <<"Nuclear density for nucleus (z, a): " << izmat << " " << iamat << " " << imat << G4endl;
1133 }
1134
1135 const G4double fmp = 938.2796;
1136
1137 // parametres moyens de densite de la cible (fermi 2 parametres)
1138 if (iamat >= 28) {
1139 ws->r0 = (2.745e-4*iamat+1.063)*std::pow(G4double(iamat), 0.33333333);
1140 ws->adif = 1.63e-4*iamat+0.510;
1141 ws->rmaxws = ws->r0 + (ws->xfoisa)*(ws->adif);
1142 }
1143 else if(iamat >= 19) {
1144 ws->r0 = light_nuc->r[iamat];
1145 ws->adif = light_nuc->a[iamat];
1146 ws->rmaxws = ws->r0 + (ws->xfoisa)*(ws->adif);
1147 }
1148 else if(iamat >= 6) {
1149 ws->r0 = light_nuc->r[iamat];
1150 ws->adif = light_nuc->a[iamat];
1151 ws->rmaxws = 5.5 + 0.3*(iamat-6.)/12.;
1152 }
1153 else if(iamat >= 2) {
1154 if(iamat == 2) {
1155 ws->r0=light_gaus_nuc->rms1t[5]; // Orig: rms1t(6)
1156 light_gaus_nuc->pfln[5] = light_gaus_nuc->pf1t[5]*1.291; // Orig [6], std::sqrt(5/3)=1.291
1157 light_gaus_nuc->tfln[5] = std::sqrt(std::pow(light_gaus_nuc->pfln[5],2) + fmp*fmp) - fmp;
1158 light_gaus_nuc->vnuc[5] = light_gaus_nuc->tfln[5] + 2.22;
1159 if(verboseLevel > 2) {
1160 G4cout <<"Nuclear potential: " << light_gaus_nuc->vnuc[5] << "MeV, Fermi momentum and energy: " << light_gaus_nuc->pfln[5] << " " << light_gaus_nuc->tfln[5] << G4endl;
1161 }
1162 }
1163 if(iamat == 3 && izmat == 1) {
1164 ws->r0=light_gaus_nuc->rms1t[6]; // Orig: rms1t(7)
1165 light_gaus_nuc->pfln[6] = light_gaus_nuc->pf1t[6]*1.291; // Orig [7], std::sqrt(5/3)=1.291
1166 light_gaus_nuc->tfln[6] = std::sqrt(std::pow(light_gaus_nuc->pfln[6],2) + fmp*fmp) - fmp;
1167 light_gaus_nuc->vnuc[6] = light_gaus_nuc->tfln[6] + 4.24;
1168 if(verboseLevel > 2) {
1169 G4cout <<"Nuclear potential: " << light_gaus_nuc->vnuc[6] << "MeV, Fermi momentum and energy: " << light_gaus_nuc->pfln[6] << " " << light_gaus_nuc->tfln[6] << G4endl;
1170 }
1171 }
1172 if(iamat == 3 && izmat == 2) {
1173 ws->r0 = light_gaus_nuc->rms1t[7]; // Orig: rms1t(8)
1174 light_gaus_nuc->pfln[7] = light_gaus_nuc->pf1t[7]*1.291; //!sqrt(5/3)=1.291
1175 light_gaus_nuc->tfln[7] = std::sqrt(std::pow(light_gaus_nuc->pfln[7],2) + fmp*fmp) - fmp;
1176 light_gaus_nuc->vnuc[7] = light_gaus_nuc->tfln[7] + 3.86;
1177 if(verboseLevel > 2) {
1178 G4cout <<"Nuclear potential: " << light_gaus_nuc->vnuc[7] << "MeV, Fermi momentum and energy: " << light_gaus_nuc->pfln[7] << " " << light_gaus_nuc->tfln[7] << G4endl;
1179 }
1180 }
1181 if(iamat == 4) {
1182 ws->r0 = light_gaus_nuc->rms1t[8]; // Orig: rms1t(9)
1183 light_gaus_nuc->pfln[8] = light_gaus_nuc->pf1t[8]*1.291; // !sqrt(5/3)=1.291
1184 light_gaus_nuc->tfln[8] = std::sqrt(std::pow(light_gaus_nuc->pfln[8],2) + fmp*fmp) - fmp;
1185 light_gaus_nuc->vnuc[8] = light_gaus_nuc->tfln[8] + 9.43;
1186 if(verboseLevel > 2) {
1187 G4cout <<"Nuclear potential: " << light_gaus_nuc->vnuc[8] << "MeV, Fermi momentum and energy: " << light_gaus_nuc->pfln[8] << " " << light_gaus_nuc->tfln[8] << G4endl;
1188 }
1189 }
1190 ws->adif = 0.57735*ws->r0;
1191 ws->rmaxws = ws->r0 + 2.5;
1192 }
1193 ws->drws = (ws->rmaxws)/29.0;
1194
1195 // bmax for sigma geom and various projectiles (p,n,pion/d/t/he3/he4/)
1196 G4int j;
1197 for(G4int i = 0; i < MATGEOSIZE; i++) { // Orig: do i=1,6
1198 j = i;
1199 if(i >= 2) {
1200 j = i + 3;
1201 }
1202 mat->bmax_geo[i][imat] = (ws->rmaxws) + (light_gaus_nuc->rms1t[j]);
1203 }
1204
1205 // preparation de la distribution w.s.:
1206 if (iamat >= 19) {
1207 G4double step = 0.2;
1208 res_dws = integrate(0.0, 13.5, step, derivWsaxFunction);
1209 }
1210 else {
1211 // preparation de la distribution m.h.o.:
1212 if(iamat >= 6) {
1213 step=0.1;
1214 res_dws = integrate(0.0, 10.0, step, derivMhoFunction);
1215 }
1216 else {
1217 // preparation de la distribution gaussienne:
1218 // G4double cte = std::pow(ws->adif,3)*std::sqrt(2.*3.141592654);
1219 res_dws = 3.0*(std::pow(ws->adif, 3)*std::sqrt(2.0*3.141592654))/2.0;
1220 }
1221 }
1222 fnor = res_dws;
1223
1224 // calcul de q/pf=f(r)
1225 nbr = int(std::floor((ws->rmaxws)/(ws->drws) + 1.5));
1226 rcour = -1*(ws->drws);
1227
1228 j = 0;
1229 for(G4int i = 0; i < nbr; i++) { // do i=1,nbr
1230 rcour = rcour + (ws->drws);
1231 if(i == 0) { // 1->0
1232 f_r = 0.0;
1233 saxw->x[j][imat] = f_r;
1234 saxw->y[j][imat] = 0.0; //!on impose x(1)=0., y(1)=0.
1235 res_dws = 0.0;
1236 }
1237 else {
1238 step = rcour/20.;
1239 if(step >= 0.05) {
1240 step = 0.05;
1241 }
1242 if (iamat >= 19) {
1243 //integ(ws, dton, 0.,rcour,step,&derivwsax,&res_dws);
1244 res_dws = integrate(0.0, rcour, step, derivWsaxFunction);
1245 f_r = res_dws/fnor;
1246 }
1247 else {
1248 if(iamat >= 6) {
1249 //integ(ws, dton, 0.,rcour,step,&derivmho,&res_dws);
1250 res_dws = integrate(0.0, rcour, step, derivMhoFunction);
1251 f_r = res_dws/fnor;
1252 }
1253 else {
1254 //integ(ws, dton, 0.,rcour,step,&derivgaus,&res_dws);
1255 res_dws = integrate(0.0, rcour, step, derivGausFunction);
1256 f_r = res_dws/fnor;
1257 }
1258 }
1259 // modif le 20/10/2003; éviter les valeurs négatives avant **1/3 !
1260 // }
1261 if(f_r >= 0.0) {
1262 f_r = std::pow(f_r,(1./3.));
1263 saxw->x[j][imat] = f_r;
1264 saxw->y[j][imat] = rcour;
1265 }
1266 }
1267 j = j + 1;
1268 }
1269 saxw->n = j;
1270 saxw->x[j-1][imat] = 1.; // !on impose saxw->x[nbpinter-1]=1. (y=rmax)
1271
1272 // interpolation de f_inv(r) (fonction inverse de f(r))
1273 // flin2(imat, saxw, ws);
1274 firstDerivative(imat);
1275
1276 if(verboseLevel > 3) {
1277 if(iamat >= 19) {
1278 G4cout <<"Wood-Saxon density, r0 = " << ws->r0 << " a = " << ws->adif << G4endl;
1279 }
1280 if(iamat >= 6 && iamat <= 19) {
1281 G4cout <<"Modif. harm. oscil. density, alpha = " << ws->r0 << " a = " << ws->adif << G4endl;
1282 }
1283 if(iamat >= 2 && iamat <= 6) {
1284 G4cout <<"Gaussian density, r.m.s = " << ws->r0 << " sigma = " << ws->adif << G4endl;
1285 }
1286 }
1287
1288 geom = 31.41592653*std::pow(ws->rmaxws,2);
1289
1290 if(verboseLevel > 3) {
1291 G4cout <<"For incident nucleons or pions rmax = " << ws->rmaxws << " and geometrical (pi*rmaxws*rmaxws) reaction cross section (mb) is " << geom << G4endl;
1292 for(G4int k = 2; k < MATGEOSIZE; k++) {
1293 G4cout << "Rmaxws for d/t/3he/4he = " << mat->bmax_geo[k][imat] << G4endl;
1294 }
1295
1296 G4cout <<"Exact calculation of the r(q) function for the target nucleus density q/pf r(q/pf)" << G4endl;
1297 }
1298}
1299
1300G4double G4Incl::deutv(G4int l, G4double q)
1301{
1302 G4double res = 0.0;
1303
1304 if (l == 0) {
1305 for(G4int i = 0; i < DTONSIZE; i++) {
1306 res = res + dton->c[i]/(std::pow(q,2) + fm2(i+1));
1307 }
1308 }
1309 if(l != 0) {
1310 for(G4int i = 0; i < DTONSIZE; i++) {
1311 res = res + dton->d[i]/(std::pow(q,2) + fm2(i+1));
1312 }
1313 }
1314
1315 return res*std::sqrt(2./CLHEP::pi)*dton->fn; // See G4InclDataDefs.hh
1316}
1317
1318G4double G4Incl::fm2(G4int j)
1319{
1320 /**
1321 * In implementation Returns the values of the function:
1322 * \f[
1323 * (0.23162461 + (j - 1))^2
1324 * \f]
1325 * @param j an integer parameter
1326 * @return a double value
1327 */
1328
1329 return std::pow((0.23162461 + (j - 1)),2);
1330}
1331
1332G4double G4Incl::interpolateFunction(G4double xv)
1333{
1334 // fonction d'interpolation au point xv ( meme hors bornes )
1335 // de la fn x->y dont les derivees premieres (s) ont ete
1336 // evaluees par l'appel prealable de flin2
1337 // les indices vont de 1 a n
1338
1339 saxw->k = saxw->imat;
1340 G4double tz = xv - saxw->x[0][saxw->imat];
1341 G4int j = 0;
1342
1343 if(tz < 0) {
1344 return (saxw->y[0][saxw->imat] + saxw->s[0][saxw->imat]*tz);
1345 }
1346 else if(tz == 0) {
1347 return (saxw->y[0][saxw->imat]);
1348 }
1349 else {
1350 for(G4int i = 1; i < saxw->n; i++) {
1351 j = i - 1;
1352 tz = xv - saxw->x[j][saxw->imat];
1353 if(tz < 0) {
1354 break;
1355 }
1356 else if(tz == 0) {
1357 return saxw->y[j][saxw->imat];
1358 }
1359 }
1360 }
1361
1362 G4double dgx = xv - saxw->x[j][saxw->imat];
1363 return(saxw->y[j][saxw->imat] + saxw->s[j][saxw->imat]*dgx);
1364}
1365
1366void G4Incl::firstDerivative(G4int k)
1367{
1368 for(G4int i=0; i < saxw->n-1; i++) {
1369 saxw->s[i][k] = (saxw->y[i+1][k] - saxw->y[i][k]) / (saxw->x[i+1][k] - saxw->x[i][k]);
1370 }
1371 saxw->s[saxw->n-1][k] = saxw->s[saxw->n-2][k];
1372}
1373
1374G4double G4Incl::wsax(G4double r) {
1375 return std::pow(r,2) / (1.0+std::exp(r-(ws->r0)/(ws->adif)));
1376}
1377
1378G4double G4Incl::derivWsax(G4double r)
1379{
1380 G4double derivwsax = std::pow(r,3)*std::exp((r-(ws->r0))/(ws->adif))/std::pow((1.0+std::exp((r-(ws->r0))/(ws->adif))),2);
1381 return derivwsax/(ws->adif);
1382}
1383
1384G4double G4Incl::dmho(G4double r)
1385{
1386 G4double arg=std::pow((r/(ws->adif)),2);
1387 return r*r*(1.+(ws->r0)*arg)*std::exp(-arg);
1388}
1389
1390G4double G4Incl::derivMho(G4double r)
1391{
1392 G4double arg=std::pow((r/(ws->adif)),2);
1393 return -2.*r*r*arg*((ws->r0) -1.-(ws->r0)*arg)*std::exp(-arg);
1394}
1395
1396G4double G4Incl::derivGaus(G4double r)
1397{
1398 G4double arg=std::pow((r/(ws->adif)),2);
1399 return r*r*arg*std::exp(-arg/2.);
1400}
1401
1402void G4Incl::densDeut()
1403{
1404 // ce subroutine appele sur le premier tir va calculer la densite du deuton
1405 // dans l'espace des impulsions et preparer l'interpolation permettant ensuite
1406 // le tir au hasard d'un module de l'impulsion (q).
1407 // ce subroutine remplit le common /spl2/:
1408 // xsp(0:1), ysp integrale normalisee de la densite de 0 a q.
1409 // a(),b(),c() coefs des nsp points pour une interpolation du second degre.
1410 // q est en fm-1.
1411
1412 // 495 dimension q(100),f(100)
1413 // 496 common/spl2/ xsp(100),ysp(100),a(100),b(100),cc(100),nbp
1414 G4double cData[DTONSIZE] = {0.88688076e+00,-0.34717093e+00,-.30502380e+01,
1415 .56207766e+02,-.74957334e+03,.53365279e+04,-.22706863e+05,
1416 .60434469e+05,-.10292058e+06,.11223357e+06,-.75925226e+05,
1417 .29059715e+05,-.48157368e+04};
1418
1419 G4double dData[DTONSIZE] = {.23135193e-01,-.85604572e+00,.56068193e+01,
1420 -.69462922e+02,.41631118e+03,-.12546621e+04,.12387830e+04,
1421 .33739172e+04,-.13041151e+05,.19512524e+05,-.15634324e+05,
1422 .66231089e+04,-.11698185e+04};
1423
1424 G4double fnData = 0.28212e+00;
1425
1426 for(G4int i = 0; i < DTONSIZE; i++) {
1427 dton->c[i] = cData[i];
1428 dton->d[i] = dData[i];
1429 }
1430 dton->fn = fnData;
1431
1432 // 509 c avec fn=.28212 les fo radiales suivantes sont normalisees a: deu00470
1433 // 510 c somme(0,infini)(deut0(q)**2 + deut2(q)**2))*q*q*dq = 1./4*pi deu00480
1434 // 511 c et ceci dans l'espace r et dans l'espace q. pd=5.74% deu00490
1435 // 512 cjcd
1436 // 513 common /inout/ in, io, itty, iscrt
1437 // 514 cjcd
1438
1439 const G4int qsize = 100;
1440 G4double q[qsize];
1441 G4double f[qsize];
1442 G4double dq=0.01;
1443 q[0]=0.0;
1444 for(G4int i = 1; i < 50; i++) {
1445 q[i] = q[i-1] + dq;
1446 f[i] = 0.0;
1447 }
1448
1449 spl2->n = 77; // nombre de points de calcul
1450
1451 dq=0.1;
1452 for(G4int i = 50; i < spl2->n; i++) {
1453 q[i] = q[i-1] + dq;
1454 }
1455
1456 f[0]=0.0;
1457
1458 G4double sumint=0.0;
1459
1460 // the id if the function we wish to integrate (in this case: G4Incl::dens
1461 for(G4int i = 1; i < spl2->n; i++) {
1462 dq = (q[i]-q[i-1])/10.0;
1463 sumint = sumint + integrate(q[i-1], q[i], dq, densFunction);
1464 f[i] = sumint;
1465 }
1466
1467 for(G4int i = 0; i < spl2->n; i++) {
1468 spl2->x[i] = f[i]/f[spl2->n-1];
1469 spl2->y[i] = q[i];
1470 }
1471
1472 spl2ab();
1473
1474 if(verboseLevel > 3) {
1475 G4cout << "deuteron density in q space from Paris potential: " << spl2->n << " Exact values from 0 to "
1476 << q[spl2->n-1] << " fm-1 " << G4endl;
1477 }
1478}
1479
1480G4double G4Incl::integrate(G4double ami, G4double ama, G4double step, G4int functionChoice)
1481{
1482 G4double res;
1483 G4double x1[5];
1484 G4double ri = ami;
1485 G4double ra = ama;
1486 G4int nb;
1487 G4double acont = 1.0;
1488 G4double dr = step;
1489
1490 if(ama <= ami) {
1491 acont = -1.0;
1492 ri = ama;
1493 ra = ami;
1494 }
1495
1496 x1[0] = 95.0/288.0;
1497 x1[1] = 317.0/240.0;
1498 x1[2] = 23.0/30.0;
1499 x1[3] = 793.0/720.0;
1500 x1[4] = 157.0/160.0;
1501 nb = int(std::floor(((ra - ri)/step + 1.0000000001))); // 1.0000000001 -> 0.0
1502 dr = (ra - ri)/(double(nb - 1));
1503 res = 0.0;
1504
1505 if(nb < 10) {
1506 if(verboseLevel > 2) {
1507 G4cout <<"pas assez de points d'integration" << G4endl;
1508 }
1509 return 0.0;
1510 }
1511
1512 for(G4int i = 0; i < 5; i++) {
1513 res = res + (callFunction(functionChoice, ri) + callFunction(functionChoice, ra))*x1[i];
1514 ri = ri + dr;
1515 ra = ra - dr;
1516 }
1517
1518 nb = nb - 10;
1519
1520 if(nb == 0) {
1521 return (res*dr*acont);
1522 }
1523
1524 for(G4int i = 0; i < nb; i++) {
1525 res = res + callFunction(functionChoice, ri);
1526 ri = ri + dr;
1527 }
1528
1529 return(res*dr*acont);
1530}
1531
1532
1533G4double G4Incl::dens(G4double q)
1534{
1535 return q*q*(std::pow(deutv(0,q),2)+std::pow(deutv(2,q),2));
1536}
1537
1538void G4Incl::spl2ab()
1539{
1540 G4int i, j, k;
1541
1542 for(i=0; i <= spl2->n-3; i++) {
1543 j = i + 1;
1544 k = i + 2;
1545
1546 spl2->c[i] = ((spl2->y[k]-spl2->y[i])*(spl2->x[j]-spl2->x[i])-(spl2->x[k]-spl2->x[i])*(spl2->y[j]-spl2->y[i]))
1547 /((spl2->x[j]-spl2->x[i])*(spl2->x[k]-spl2->x[i])*(spl2->x[k]-spl2->x[j]));
1548
1549 spl2->b[i] = (spl2->y[j]-spl2->y[i])/(spl2->x[j]-spl2->x[i]);
1550
1551 spl2->a[i] = spl2->y[i];
1552 }
1553
1554 for(i = spl2->n-2; i < spl2->n; i++) {
1555 spl2->c[i] = spl2->c[spl2->n-3];
1556 spl2->b[i] = spl2->b[spl2->n-3];
1557 spl2->a[i] = spl2->a[spl2->n-3];
1558 }
1559}
1560
1561G4double G4Incl::splineab(G4double xv)
1562{
1563 G4double tz;
1564 G4int j;
1565
1566 tz = xv-spl2->x[0];
1567
1568 if(tz < 0) {
1569 return spl2->a[0] + spl2->b[0] * tz + spl2->c[0] * tz * (xv - spl2->x[1]);
1570 }
1571 if(tz == 0) {
1572 return spl2->y[0];
1573 }
1574 if(tz > 0) {
1575 for(G4int i = 1; i <= spl2->n-1; i++) {
1576 j = i;
1577 tz = xv - spl2->x[i];
1578
1579 if(tz < 0) {
1580 j = j - 1;
1581 tz = xv - spl2->x[j];
1582 return spl2->a[j] + spl2->b[j] * tz + spl2->c[j] * tz * (xv - spl2->x[j+1]);
1583 }
1584 if(tz == 0) {
1585 return spl2->y[j];
1586 }
1587 }
1588 }
1589
1590 // Returns 0.0 if the point xv is outside the defined region (xv > spl2->x[spl2->n-1])
1591 if(verboseLevel > 2) {
1592 G4cout <<"G4Incl::splineab : requested point outside defined region! Returning 0.0." << G4endl;
1593 }
1594 return 0.0;
1595}
1596
1597// Actual calculation
1598
1599void G4Incl::pnu(G4int *ibert_p, G4int *nopart_p, G4int *izrem_p, G4int *iarem_p, G4double *esrem_p,
1600 G4double *erecrem_p, G4double *alrem_p, G4double *berem_p, G4double *garem_p,
1601 G4double *bimpact_p, G4int *l_p)
1602{
1603 G4int ibert = (*ibert_p);
1604 // float f[15]; // = (*f_p);
1605 G4int nopart = (*nopart_p);
1606// G4int kind[300]; //= (*kind_p);
1607// G4double ep[300]; // = (*ep_p);
1608// G4double alpha[300]; // = (*alpha_p);
1609// G4double beta[300]; // = (*beta_p);
1610// G4double gam[300]; // = (*gam_p);
1611 G4int izrem = (*izrem_p);
1612 G4int iarem = (*iarem_p);
1613 G4double esrem = (*esrem_p);
1614 G4double erecrem = (*erecrem_p);
1615 G4double alrem = (*alrem_p);
1616 G4double berem = (*berem_p);
1617 G4double garem = (*garem_p);
1618 G4double bimpact = (*bimpact_p);
1619 G4int l = (*l_p);
1620
1621 G4double minus_b1, minus_b2, minus_b3;
1622 //alog
1623 G4double aml1;
1624 G4double aml2;
1625 G4double amlnew;
1626 G4double arg;
1627 G4double b1;
1628 G4double b2;
1629 G4double b3;
1630 G4double bb2;
1631 G4double be;
1632 G4double bmass[2000];
1633 G4double bmax2;
1634 G4double c1;
1635 G4double c2;
1636 G4double cb0;
1637 G4double cchi;
1638 G4double ccr;
1639 G4double cg;
1640 G4double cif;
1641 G4double cmultn;
1642 G4double cobe;
1643 G4double coeffb0;
1644 G4double comom;
1645 G4double cstet;
1646 G4double dis1;
1647 G4double dis2;
1648 G4double dis3;
1649 G4double dist;
1650 G4double eb0;
1651 G4double ecoreh5;
1652 G4double efer;
1653 G4double egs;
1654 G4double eh5;
1655 G4double eh6;
1656 G4double eij;
1657 G4double ekout;
1658 G4double elead;
1659 G4double energie_in;
1660 G4double ener_max;
1661 G4double eout;
1662 G4double eps_c[BL1SIZE];
1663 G4double epsv;
1664 G4double erecg;
1665 G4double erem;
1666 G4double exi;
1667 G4double expob0;
1668 G4double factemp;
1669 G4double fffc;
1670 G4double fm;
1671 G4double g1;
1672 G4double g2;
1673 G4double ge;
1674 G4double geff;
1675 G4double gg;
1676 G4double gl1;
1677 G4double gl2;
1678 G4double gpsg;
1679 G4int i1;
1680 G4int i20;
1681 G4int ic33;
1682 G4int ich1;
1683 G4int ich2;
1684 G4int ich3;
1685 G4int ich4;
1686 G4int ichd;
1687 G4int ichpion;
1688 G4int idecf;
1689 G4int idep;
1690 G4int iej;
1691 G4int iejn;
1692 G4int iejp;
1693 G4int i_emax;
1694 G4int iflag;
1695 G4int iflag20 = 0;
1696 G4int iflag40 = 0;
1697 G4int iflag60 = 0;
1698 G4int ilm = 0;
1699 G4int imin;
1700 G4int indic[3000];
1701 G4int inrem;
1702 G4int ip;
1703 G4int ipi[2000];
1704 G4int iqe;
1705 G4int irem;
1706 G4int irst_avatar;
1707 G4int isos = 0;
1708 G4int itch;
1709 G4int iteste;
1710 G4int itt;
1711 G4int ixr1;
1712 G4int ixr2;
1713 G4int ixr3;
1714 // G4int k;
1715 G4int kcol;
1716 G4int kd;
1717 // G4int klm = 0;
1718// G4int l1;
1719// G4int l2;
1720 G4int ldel;
1721 G4int lead;
1722 G4int led;
1723 G4int lnew;
1724 G4int lp = 0;
1725 G4int lp1;
1726 G4double mcdd;
1727 //G4double mg;
1728 G4int mg;
1729 G4double mpaul1;
1730 G4double mpaul2;
1731 G4double mrdd;
1732 G4double mrdn;
1733 G4double mrdp;
1734 G4double mrnd;
1735 G4double mrnn;
1736 G4double mrpd;
1737 G4int n20;
1738 G4int nbalttf;
1739 G4int nbquit;
1740 G4int nbtest;
1741 G4int nc[300];
1742 G4int ncol;
1743 G4int ncol_2c;
1744 G4int next;
1745 G4int nmiss;
1746 G4int np;
1747 G4int npidir;
1748 G4int npion = 0;
1749 G4int npproj[300];
1750 G4int npx;
1751 G4int nsum_col;
1752 G4double p1v;
1753 G4double p2v;
1754 G4double p3_c[BL1SIZE];
1755 G4double p3v;
1756 G4double pfrem1;
1757 G4double pfrem2;
1758 G4double pfrem3;
1759 G4double pfreml;
1760 G4double pfreml2;
1761 G4double phi;
1762 G4double p_mod;
1763 G4double pot;
1764 G4double pout1;
1765 G4double pout2;
1766 G4double pout3;
1767 G4double pppp;
1768 G4double prem1;
1769 G4double prem2;
1770 G4double prem3;
1771 G4double psf;
1772 G4double pspr;
1773 G4double ptotl;
1774 G4double qdeut;
1775 G4double qqq;
1776 G4double r22;
1777 G4double rcm1;
1778 G4double rcm2;
1779 G4double rcm3;
1780 G4double rcorr;
1781 G4double rhopi;
1782 G4double rndm;
1783 G4double rr;
1784 G4double rrrr;
1785 G4double s;
1786 G4double s1t1;
1787 G4double s2t1;
1788 G4double s3t1;
1789 G4double schi;
1790 G4double sepa;
1791 G4double sif;
1792 G4double sitet;
1793 G4double sp1t1;
1794 G4double sp2t1;
1795 G4double sp3t1;
1796 G4double sq = 0.0;
1797 G4double sueps;
1798 G4double t[50];
1799 G4double t0;
1800 G4double t1;
1801 G4double t2;
1802 G4double t3;
1803 G4double t33;
1804 G4double t4;
1805 G4double t5;
1806 G4double t6;
1807 G4double t7;
1808 G4double t8;
1809 G4double tau;
1810 G4double tbid;
1811 G4double tdel;
1812 G4double temfin;
1813 G4double tim;
1814 G4double timi;
1815 G4double tlabu;
1816 G4double tp;
1817 G4double tref;
1818 G4double tri;
1819 G4double tt31;
1820 G4double tt32;
1821 G4double tt33;
1822 G4double tt34;
1823 G4double tt35;
1824 G4double tt36;
1825 G4double tte;
1826 G4double u;
1827 G4double v;
1828 G4double var_ab;
1829 G4double x;
1830 G4double x1l1;
1831 G4double x1l2;
1832 G4double x1_target = 0.0;
1833 G4double x2_target = 0.0;
1834 G4double x3_target = 0.0;
1835 G4double x2cour;
1836 G4double x2l1;
1837 G4double x2l2;
1838 G4double x3l1;
1839 G4double x3l2;
1840 G4double xapres;
1841 G4double xavant;
1842 G4double xbl1;
1843 G4double xbl2;
1844 G4double xc;
1845 G4double xe;
1846 G4double xga;
1847 G4double xl1;
1848 G4double xl2;
1849 G4double xl3;
1850 G4double xlab;
1851 G4double xleng;
1852 G4double xlengm;
1853 G4double xmodp;
1854 G4double xpb;
1855 G4double xq;
1856 G4double xr1;
1857 G4double xr2;
1858 G4double xr3;
1859 G4double xr4;
1860 G4double xr5;
1861 G4double xr6;
1862 G4double xr7;
1863 G4double xr8;
1864 G4double xv;
1865 G4double xxx;
1866 G4double xy1;
1867 G4double xy2;
1868 G4double xy3;
1869 G4double xye;
1870 G4double y;
1871 G4double q1[BL1SIZE];
1872 G4double q2[BL1SIZE];
1873 G4double q3[BL1SIZE];
1874 G4double q4[BL1SIZE];
1875 G4double y1[BL3SIZE];
1876 G4double y2[BL3SIZE];
1877 G4double y3[BL3SIZE];
1878 // G4double ym[2000];
1879 G4double ym[BL1SIZE];
1880 G4double z;
1881 G4double za_i;
1882 G4double zai2;
1883 G4double zshif;
1884 G4double ztouch = 0.0;
1885 G4double ztu;
1886
1887 // LIEGE INC-model as a subroutine
1888
1889 // The Liege INC model has been applied to several systems and in
1890 // several conditions. Refinements are still in progress.
1891
1892 // PLEASE refer to this version as INCL4.1 in order to avoid
1893 // confusion when comparing to the results of your colleagues.
1894
1895 // DIFFERENT from INCL2.0 in the sense that the cascade is stopped
1896 // when the excitation energy vanishes if this occurs before the
1897 // predetermined stopping time (herein denoted as temfin) Special
1898 // are taken to avoid emission of slow particles due to the
1899 // imperfect Pauli blocking
1900
1901 // PLEASE notice: There are basically only two parameters in the
1902 // model: the average potential depth, denoted as V0, and the time
1903 // at which the cascade is stopped denoted as temfin. In this
1904 // program, the "standard" values (those G4introduced in the ref
1905 // NPA620(1997)475) are V0=40MeV and temfin=1.25*some function of
1906 // incident energy and impact parameter. You may, of course, change
1907 // these parameters V0 and the numerical coefficient in temfin,
1908 // within reasonable limits (i.e. V0 cannot be lower than 38MeV;
1909 // V0=45MeV is recommended for heavy nuclei). If you do, PLEASE
1910 // indicate your choice, once again, for the same reason as above.
1911
1912 // The description of the cascade model(incl2.0) can be found in:
1913 // J.C., C.VOLANT & S.VUILLIER, NPA620(1997)475 It is basically the
1914 // same model as described in J.C. NPA462(1987)751 (version 7 (in
1915 // our jargon), sketched below) + a refinement of the
1916 // parametrization of the cross-sections, based on J.C., D. L'HOTE,
1917 // J.VANDERMEULEN, NIM B111(1996)215 and J.C., S.LERAY, E.MARTINEZ,
1918 // Y.PATIN & S.VUILLIER PRC56(1998)2431
1919
1920 // technical notes:
1921 // 1.for the parametrizations of cross sections, see
1922 // notes of 4/10/96, 9/10/96, 31/12/97 and 13/10/98
1923 // 2.temfin=1.25*... 18/6/98
1924 // 3.sepa in concordance with v0-tf 2/7/98
1925 // 4.special care for stopping the cascade before t=temfin 27/04/99
1926
1927 // 84 c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1928 // 85 C P-N00030
1929 // 86 C VERSION 7: 2/2/93 P-N00040
1930 // 87 C
1931 // 88 C++++++++++++ DESCRIPTION OF INPUT AND OUTPUT+++++++++++++++++++++++++++++
1932 // 89 C
1933 // 90 C **INPUT DATA**
1934 // 91 C
1935 // 92 C IBERT=O IN THE FIRST CALL
1936 // 93 C 1 IN THE SUBSEQUENT CALLS
1937 // 94 C
1938 // 95 C F= (REAL) ARRAY OF DIMENSION 8
1939 // 96 C
1940 // 97 C F(1)= A (TARGET)
1941 // 98 C F(2)= Z (TARGET)
1942 // 99 C F(3)= KINETIC ENERGY (IN MEV) OF THE INCIDENT PARTICLE
1943 // 100 C F(4)= SUPPOSED TO BE THE MINIMUM PROTON ENERGY REQUIRED TO LEAVE
1944 // 101 C THE TARGET. IN THIS CASCADE MODEL, IT IS ZERO
1945 // 102 C F(5)= Nuclear potential V0 (standard value=45 MeV for heavy nuclei)
1946 // 103 C F(6)= Rescale the cascade duration (the standard value t0 is MULTIPLIED
1947 // 104 c by this value. F(6)=1. is the standard)
1948 // 105 C F(7)= TYPE OF INCIDENT PARTICLE
1949 // 106 C 1.00 FOR PROTON
1950 // 107 C 2.00 FOR NEUTRON
1951 // 108 C 3.00 FOR PI+
1952 // 109 C 4.00 FOR PI0
1953 // 110 C 5.00 FOR PI-
1954 // 111 C 6.00 FOR DEUTERON
1955 // 112 C 7.00 FOR TRITON
1956 // 113 C 8.00 FOR HE3
1957 // 114 C 9.00 FOR HE4
1958 // 115 C F(8)= SUPPOSED TO BE THE MINIMUM NEUTRON ENERGY REQUIRED TO LEAVE
1959 // 116 C THE TARGET. IN THIS CASCADE MODEL, IT IS ZERO
1960 // 117 C
1961 // 118 C NOSURF=1 Sharp density (hard sphere),
1962 // 119 C NOSURF=0 Wood-Saxon density, stopping time "70"
1963 // 120 C without B (impact) dependence.
1964 // 121 C NOSURF=-1 Wood-Saxon density, stopping time "70"
1965 // 122 C with B (impact) dependence
1966 // 123 C (on peut toujours nenormaliser ces fonctions
1967 // 124 C de temps avec le facteur F(6): t=t0*F(6) )
1968 // 125 C XFOISA Rmaxws = R0 + XFOISA*A
1969 // 126 C Bmax = Rmaxws for pions and nucleons
1970 // 127 C Bmax = Rmaxws + rms1t (data) for composits
1971 // 128 C Pauli strict (1) or statistic (0) or without pauli (2): NPAULSTR
1972 // 129 C
1973 // 130 C F(9)= imat, target material identifier for the right choose of Sax.-Wood density
1974 // 131 c
1975 // 132 c common/hazard/ial,IY1,IY2,IY3,IY4,IY5,IY6,IY7,IY8,IY9,IY10,
1976 // 133 c s IY11,IY12,IY13,IY14,IY15,IY16,IY17,IY18,IY19
1977 // 134 c ......20 numbers in the main routine to initialize the random numbers
1978 // 135 c
1979 // 136 C **OUTPUT DATA**
1980 // 137 C
1981 // 138 C NOPART=-1 PSEUDO REACTION (VOID EVENT)
1982 // 139 C 0 ABSORPTION
1983 // 140 C >0 TRUE EVENT, = NUMBER OF PARTICLES EMITTED (EXCLUDING THE REMNANT)
1984 // 141 C
1985 // 142 C FOR N=1,NOPART:
1986 // 143 C KIND(N)= TYPE OF PARTICLES (SAME CONVENTION AS FOR F(7), BUT IN G4INTEGERS)
1987 // 144 C
1988 // 145 C EP(N)= KINETIC ENERGY
1989 // 146 C
1990 // 147 C ALPHA(N),BETA(N),GAM(N)= DIRECTION COSINES
1991 // 148 C
1992 // 149 C IZREM= Z (REMNANT)
1993 // 150 C
1994 // 151 C IAREM= A (REMNANT)
1995 // 152 C
1996 // 153 C ESREM= EXCITATION ENERGY OF THE REMNANT
1997 // 154 C
1998 // 155 C ERECREM= RECOIL ENERGY OF THE REMNANT
1999 // 156 C
2000 // 157 C ALREM,BEREM,GAREM=DIRECTION COSINES OF THE REMNANT
2001 // 158 C
2002 // 159 C BIMPACT impact parameter
2003 // 160 C
2004 // 161 C L G4intrinsic momentum of the remnant in units of h/2pi=hbar=197.328
2005 // 162 C+++++++++ DESCRIPTION OF THE INC MODEL ++++++++++++++++++++++++++++++++++++
2006 // 163 C
2007 // 164 C MODEL DESCRIBED IN J.CUGNON (NP A462(1987)751) P-N00050
2008 // 165 C =MODEL (DR) OF J.CUGNON,D.KINET,J.VANDERMEULEN(NP A379(1982)567) P-N00060
2009 // 166 C P-N00110
2010 // 167 C +REFLECTION OR TRANSMISSION ON THE POTENTIAL WALL P-N00120
2011 // 168 C (THE POTENTIAL DEPTH IS THE SAME FOR NUCLEONS & DELTA'S) P-N00130
2012 // 169 C (CONTAINS A COULOMB BARRIER) P-N00140
2013 // 170 C P-N00150
2014 // 171 C +ABSORPTION OF THE PION ABOVE THE (3,3) RESONANCE (NOT IN P-N00160
2015 // 172 C VERSION 2) P-N00170
2016 // 173 C P-N00180
2017 // 174 C +POSSIBLE PAULI BLOCKING OF TWO BODY COLLISIONS P-N00190
2018 // 175 C +POSSIBLE PAULI BLOCKING OF DELTA DECAY P-N00200
2019 // 176 C THE PAULI BLOCKING IS APPLIED TO THE NUCLEONS P-N00210
2020 // 177 C ONLY.THE PAULI BLOCKING FACTORS ARE EVALUATED P-N00220
2021 // 178 C BY COUNTING THE NUCLEONS INSIDE A VOLUME IN P-N00230
2022 // 179 C PHASE SPACE.THE EXTENSION OF THIS VOLUME IS P-N00240
2023 // 180 C OF THE ORDER OF H**3 P-N00250
2024 // 181 C P-N00260
2025 // 182 C ADDITIONAL FEATURES: P-N00270
2026 // 183 C P-N00280
2027 // 184 C +ISOSPIN (WITH NEW PN BACKWARD-FORWARD ASYMMETRY) P-N00290
2028 // 185 C P-N00300
2029 // 186 C +"LONGITUDINAL GROWTH" OF THE BARYONS (NOT ACTIVATED HERE)
2030 // 187 C
2031 // 188 C + PARTICLE #1 IS ALWAYS THE FASTEST PARTICLE IN THE Z-DIRECTIONP-N00100
2032 // 189 C (NOT ACTIVATED HERE)
2033 // 190 C +SIMPLIFIED NEUTRON EVAPORATION AT THE END OF THE CASCADE P-N00310
2034 // 191 C (NOT PRESENT HERE)
2035 // 192 C
2036 // 193 C +POSSIBLE CONSERVATION OF ANGULAR MOMENTUM (NOT ACTIVATED
2037 // 194 C HERE, COPIED FROM P_NUCJ)
2038 // 195 C P-NU7=SAME AS P-NU6 + EVAPORATION P-N00330
2039 // 196 C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++P-N00340
2040 // 197
2041 // 198 DIMENSION f(15),kind(300),ep(300),alpha(300),beta(300),gam(300)
2042 // 199 DIMENSION bmass(300)
2043 // 200 COMMON/hazard/ial,IY1,IY2,IY3,IY4,IY5,IY6,IY7,IY8,IY9,IY10,
2044 // 201 s IY11,IY12,IY13,IY14,IY15,IY16,IY17,IY18,IY19
2045 // 202 COMMON/kind/kindf7
2046 // 203 DIMENSION IND(20000),JND(20000) P-N00350
2047 // 204 DIMENSION INDIC(3000) P-N00360
2048 // 205 DIMENSION NPAR(625,15),NIMP(600,15),NNCO(15),NIMPP(600) P-N00370
2049 // 206 DIMENSION NENTR(10,8,20,10),NOUT1(15),NOUT2(15) P-N00380
2050 // 207
2051 // 208 c DIMENSION TEM(15),NSR(40),NSP(40),NSR1(40),NSP1(40) P-N00400
2052 // 209 DIMENSION TEM(15),NSR1(40),NSP1(40) P-N00400
2053 // 210 DIMENSION T(200),LINE(132),Q1(200),Q2(200),Q3(200),Q4(200),NC(300)P-N00410
2054 // 211 DIMENSION Y1(200),Y2(200),Y3(200),YM(200),IPI(200) P-N00420
2055 // 212 DIMENSION NRNN(15),NRND(15),NRDD(15),NRDN(15),NRDP(15),NRPD(15),NCP-N00430
2056 // 213 -DD(15),NPAUL1(15),NPAUL2(15) P-N00440
2057 // 214 DIMENSION NPDIR(600) P-N00450
2058 // 215 DIMENSION NEJ(6,15),NRES(6,15),NPIA(6,15),NCHPRO(15),NDEL(15) P-N00460
2059 // 216 DIMENSION EDEP1(15),EDEP2(15),EDEP3(15),EDEP4(15),NG4INT(15) P-N00470
2060 // 217 -,EPAR1(15),EPAR2(15),EPAR3(15),EPAR4(15),ENPI(15),E1(15),EZ3(15) P-N00480
2061 // 218 DIMENSION IHF1(50),IHF2(50),IHF3(50),IHF4(50),IHP(2,100),IHC(50), P-N00490
2062 // 219 -IHE(2,100),IHF5(100),IHREM(100,100)
2063 // 220
2064 // 221 DIMENSION JPARTICIP(300),eps_c(4),p3_c(4)
2065 // 222
2066 // 223 C Dialogue with INCL: function R(q/pf) for each nucleus
2067 // 224 COMMON/SAXW/ XX(30,500),YY(30,500),SS(30,500),NBPG4INTER,IMAT
2068 // 225 COMMON/WS/R0,ADIF,RMAXWS,DRWS,NOSURF,XFOISA,NPAULSTR,BMAX
2069 // 226
2070 // 227 C RMS espace R, espace P, Fermi momentum and energy for light gauss nuc.
2071 // 228 COMMON/light_gaus_nuc/rms1t(9),pf1t(9),pfln(9),tfln(9),vnuc(9)
2072 // 229
2073 // 230 C Fermi 2 param from A=19 to 28, modified harm oscil A=6 to 18
2074 // 231 C (H. De Vries et al. At. Data and Nuc. Data Tab. 36 (1987) 495)
2075 // 232 COMMON/light_nuc/R_light_nuc(30),a_light_nuc(30)
2076 // 233
2077 // 234 c common for study of avatars through an ntuple optionally produced
2078 // 235 real*4 bavat,timeavat,energyavat
2079 // 236 G4integer bloc_paul,bloc_cdpp,go_out,avm,del1avat,del2avat
2080 // 237 parameter (avm=1000)
2081 // 238 common/var_avat/kveux,bavat,nopartavat,ncolavat,
2082 // 239 s r1_in(3),r1_first_avat(3),
2083 // 240 s epsd(250),eps2(250),eps4(250),eps6(250),epsf(250),
2084 // 241 s nb_avat,
2085 // 242 s timeavat(avm),l1avat(avm),l2avat(avm),jpartl1(avm),jpartl2(avm),
2086 // 243 s del1avat(avm),del2avat(avm),energyavat(avm),
2087 // 244 s bloc_paul(avm),bloc_cdpp(avm),go_out(avm)
2088 // 245
2089 // 246 dimension npproj(300)
2090 // 247 common/spl2/ xsp(100),ysp(100),ad(100),bd(100),cd(100),ndeut
2091 // 248 c deutons
2092 // 249 c dimension ltt(15) p-n00520
2093 // 250 common/bl1/p1(300),p2(300),p3(300),eps(300),ind1(300),ind2(300),tap-n00530
2094 // 251 common/bl2/crois(19900),k,ind,jnd p-n00540
2095 // 252 common/bl3/r1,r2,x1(300),x2(300),x3(300),ia1,ia2,rab2 p-n00550
2096 // 253 common/bl4/tmax5 p-n00560
2097 // 254 common/bl5/tlg(300),nesc(300) p-n00570
2098 // 255 common/bl6/xx10,isa p-n00580
2099 // 256 common/bl8/rathr,ramass
2100 // 257 common/bl9/hel(300),l1,l2
2101 // 258 common/bl10/ri4,rs4,r2i,r2s,pf
2102 // 259 common/paul/ct0,ct1,ct2,ct3,ct4,ct5,ct6,pr,pr2,xrr,xrr2,
2103 // 260 s cp0,cp1,cp2,cp3,cp4,cp5,cp6
2104 // 261
2105 // 262 dimension ia1t(9),iz1t(9),fmpinct(9)
2106 // 264 data line/132*1h*/,hc,fmp,fmd,fmpi/197.328,938.2796,1232.,138.00/ p-n00590
2107 G4double hc = 197.328;
2108 G4double fmp = 938.2796;
2109 G4double fmpi = 138.00;
2110 // 265 data /ia1t,iz1t,fmpinct/1,1,0,0,0,2,3,3,4,1,0,1,0,-1,1,1,2,2,
2111 // 266 -938.2796,938.2796,138.0,138.0,138.0,1874.35,2806.8,2806.8,3727.
2112 G4int ia1t[9] = {1,1,0,0,0,2,3,3,4};
2113 G4int iz1t[9] = {1,0,1,0,-1,1,1,2,2};
2114 G4double fmpinct[9] = {938.2796,938.2796,138.0,138.0,138.0,1874.35,2806.8,2806.8,3727.};
2115
2116 // Initialize array:
2117 for(G4int i = 0; i < 300; i++) {
2118 npproj[i] = 0;
2119 nc[i] = 0;
2120 }
2121
2122 // 266
2123 // 267 c data rms1t,pf1t/0.,0.,0.,0.,0.,2.10,1.80,1.80,1.63,
2124 // 268 c -0.,0.,0.,0.,0.,77.,110.,110.,153./
2125 // 269
2126 // 270
2127 // 271 c deutons
2128 // 272 data nentr/16000*0/ p-n00620
2129 // 389 c p-n01700
2130 // 390 ccc reading of the data p-n01710
2131 // 391 c p-n01720
2132 // 392 c-------explanation of some physical quantities------------------------ p-n01730
2133 // 393 c (basically input data, when run as a program)
2134 // 394 c p-n01740
2135 // 395 c ia1=mass number of the incident ion p-n01750
2136 // 396 c p-n01760
2137 // 397 c ia2=mass number of the target p-n01770
2138 // 398 c iz1=atomic number of the projectile p-n01780
2139 // 399 c p-n01790
2140 // 400 c iz2=atomic number of the target p-n01800
2141 // 401 c r01=radius parameter of the projectile p-n01810
2142 // 402 c r01 should be put to 1.000 p-n01820
2143 // 403 c r02=radius parameter of the target p-n01830
2144 // 404 c adif1=diffuseness of the projectile p-n01840
2145 // 405 c adif1 should be put to 1.0000 p-n01850
2146 // 406 c adif2=diffuseness of the target p-n01860
2147 // 407 c p-n01870
2148 // 408 c tlab = incident energy (in mev) p-n01880
2149 // 409 c p-n01890
2150 // 410 c k1=1 reference frame=c.m. of the covering matter p-n01900
2151 // 411 c k1=2 reference frame=c.m. frame of the incident ion and its p-n01910
2152 // 412 c G4intercept p-n01920
2153 // 413 c k1=3 reference frame=c.m. frame of a n-n system with the same p-n01930
2154 // 414 c kinematics as the two ions p-n01940
2155 // 415 c k1=4 reference frame=c.m. frame for the total system p-n01950
2156 // 416 c k1=5 reference frame=lab system p-n01960
2157 // 417 c k1 should be put to 5 in this version p-n01970
2158 // 418 c k2=0 relativistic kinematics p-n01980
2159 // 419 c k2=1 non-relativistic kinematics(abandonned in this version) p-n01990
2160 // 420 c k3=0 deltas are produced p-n02000
2161 // 421 c k3=1 no delta production p-n02010
2162 // 422 c k4=0 the delta is given a vanishing lifetime p-n02020
2163 // 423 c k4=1 the delta has a very large lifetime p-n02030
2164 // 424 c k4=2 the delta has a exponentially random lifetime p-n02040
2165 // 425 c k5=0 no delta-nucleon,delta-delta G4interactions p-n02050
2166 // 426 c k5=1 delta-nucleon=delta-delta=nucleon-nucleon elastic x-section p-n02060
2167 // 427 c k6=0 no angular momentum conservation p-n02070
2168 // 428 c k6=1 angular momentum conservation p-n02080
2169 // 429 c p-n02090
2170 // 430 c b=impact parameter p-n02100
2171 // 431 c p-n02110
2172 // 432 c rbl(pbl) is the radius in real(momentum) space of the volume p-n02120
2173 // 433 c on which the nucleons are counted to evaluate the pauli p-n02130
2174 // 434 c blocking factors p-n02140
2175 // 435 c recommended values are 2 fm and 200 mev/c respectively p-n02150
2176 // 436 c p-n02160
2177 // 437 c nrun= number of runs (irrelevant here) p-n02170
2178 // 438 c p-n02180
2179 // 439 c ntm=number of G4intermediate times at which the spatial and momentump-n02190
2180 // 440 c distributions are stored (not relevant here) p-n02200
2181 // 441 c p-n02210
2182 // 442 c tem(it)=values of the G4intermediate times p-n02220
2183 // 443 c p-n02230
2184 // 444 c v0=depth of the nucleon potential p-n02240
2185 // 445 c v1=depth of the delta potential p-n02250
2186 // 446 c in this version v1 should be equal to v0 p-n02260
2187 // 447 c (attention! a v0 > 0 corresponds to an attractive potential) p-n02270
2188 // 448 c p-n02280
2189 // 449 c ncase=number of cells necessary to depict the spatial distributionp-n02290
2190 // 450 c in the x and z directions p-n02300
2191 // 451 c p-n02310
2192 // 452 c xp,xg,zp,zg=limits of the box in the x and z directions p-n02320
2193 // 453 c in order to have the same scale in the two directions ,put xg-xp= p-n02330
2194 // 454 c 0.9*(zg-zp) p-n02340
2195 // 455 c dy=dimension of the box in the y direction p-n02350
2196 // 456 c p-n02360
2197 // 457 c rap1,rap2,pp1,pp2=limits of the box in the rapidity-p(perpendicu- p-n02370
2198 // 458 c -lar) space p-n02380
2199 // 459 c the box is divided G4into 15 cells along p(perp) and 40 cells along p-n02390
2200 // 460 c the rapidity p-n02400
2201 // 461 c p-n02410
2202 // 462 c en,sn=average energy carried away by a nucleon,separation energy p-n02420
2203 // 463 c p-n02430
2204 // 464 c (ntm,ncase,xp,...,sn are not used here)
2205 // 465 c-----------------------------------------------------------------------p-n02440
2206
2207 // for logging
2208 // std::ofstream dumpOut("inclDump.txt");
2209 // end for logging
2210
2211 // G4int jparticip[300];
2212 G4int jparticip[BL1SIZE];
2213 G4double beproj = 0.;
2214 bl3->ia2 = G4int(calincl->f[0]); // f(1)->f[0] and so on..., calincl added
2215 G4int iz2 = G4int(calincl->f[1]);
2216 G4double r02 = 1.12;
2217 kindstruct->kindf7 = int(std::floor(calincl->f[6] + 0.1));
2218
2219 bl3->ia1 = ia1t[G4int(kindstruct->kindf7)-1];
2220 G4int iz1 = iz1t[G4int(kindstruct->kindf7)-1];
2221 G4double fmpinc = fmpinct[G4int(kindstruct->kindf7)-1];
2222 G4double rms1 = light_gaus_nuc->rms1t[G4int(kindstruct->kindf7)-1];
2223 G4double pf1 = light_gaus_nuc->pf1t[G4int(kindstruct->kindf7)-1];
2224 G4double tlab = calincl->f[2];
2225
2226 G4int k2 = 0;
2227 G4int k3 = 0;
2228 // G4int k3 = 1; // No deltas!
2229 G4int k4 = 2;
2230 G4int k5 = 1;
2231 G4int k6 = 0;
2232
2233 // material number:
2234 saxw->imat = G4int(std::floor(calincl->f[8] + 0.5)); // f(9) -> f[8]
2235 // espace de phases test (r et p) pour pauli:
2236 // valeur recommandee par j.c. v-test=0.589 h**3:
2237 G4double rbl = 2.0;
2238 G4double pbl=200.0;
2239
2240 paul->xrr = rbl;
2241 paul->xrr2 = (paul->xrr) * (paul->xrr);
2242 paul->pr=pbl;
2243 paul->pr2 = paul->pr*(paul->pr);
2244
2245 G4double tem[10];
2246 tem[0] = 100000.0; // tem(1) -> tem[0]
2247 // temfin (time at which the inc is stopped), tmax5 defined after chosing b
2248
2249 G4double v0 = calincl->f[4]; // f(5)->f[4]
2250 G4double v1 = v0;
2251 bl8->rathr = 0.;
2252 bl8->ramass = 0.;
2253
2254 // constants and derived data
2255 bl10->pf = 1.37*hc;
2256 G4double tf = std::sqrt(bl10->pf*(bl10->pf)+fmp*fmp)-fmp;
2257 G4double g0 = 115.0;
2258 G4double th = 0.;
2259 G4double pm2 = fmp*fmp;
2260 G4int ia = bl3->ia1 + bl3->ia2;
2261 G4int a2 = bl3->ia2;
2262 bl3->r2 = r02*std::pow(G4double(a2),0.33333333);
2263
2264 // parametres moyens de densite de la cible (fermi 2 parametres)
2265 if (bl3->ia2 > 28) { //then
2266 ws->r0 = (2.745e-4*bl3->ia2+1.063)*std::pow(G4double(bl3->ia2),0.33333333);
2267 ws->adif = 1.63e-4*bl3->ia2 + 0.510;
2268 ws->rmaxws = ws->r0 + ws->xfoisa*(ws->adif);
2269 }
2270 else if(bl3->ia2 >= 0.19) { //then
2271 ws->r0 = light_nuc->r[bl3->ia2];
2272 ws->adif = light_nuc->a[bl3->ia2];
2273 ws->rmaxws = ws->r0 + ws->xfoisa*(ws->adif);
2274 }
2275 else if(bl3->ia2>=6) { //then
2276 ws->r0 = 1.581*(light_nuc->a[bl3->ia2]) * (2.0 + 5.0 * (light_nuc->r[bl3->ia2])/(2.0 + 3.0*(light_nuc->r[bl3->ia2])));
2277 ws->adif = light_nuc->a[bl3->ia2];
2278 ws->rmaxws = 5.5 + 0.3*(bl3->ia2 - 6.0)/12.0;
2279 }
2280 else if(bl3->ia2 >= 2) { // then
2281 if(bl3->ia2 == 2) { //then
2282 ws->r0 = light_gaus_nuc->rms1t[5]; // rms1t(6) -> rms1t[5]
2283 bl10->pf = light_gaus_nuc->pfln[5]; //pfln(6)->pfln[5]
2284 tf = light_gaus_nuc->tfln[5]; // tfln(6) -> tfln[5]
2285 v0 = light_gaus_nuc->vnuc[5]; // vnuc(6) -> vnuc(5)
2286 } //endif
2287 if(bl3->ia2 == 3 && iz2 == 1) { //then
2288 ws->r0 = light_gaus_nuc->rms1t[6]; //rms1t(7)->rms1t[6] and so on...
2289 bl10->pf = light_gaus_nuc->pfln[6];
2290 tf = light_gaus_nuc->tfln[6];
2291 v0 = light_gaus_nuc->vnuc[6];
2292 } //endif
2293 if(bl3->ia2 == 3 && iz2 == 2) { //then
2294 ws->r0 = light_gaus_nuc->rms1t[7]; //rms1t(8)->rms1t[7] and so on...
2295 bl10->pf = light_gaus_nuc->pf1t[7];
2296 tf = light_gaus_nuc->tfln[7];
2297 v0 = light_gaus_nuc->vnuc[7];
2298 } //endif
2299 if(bl3->ia2 == 4) { //then
2300 ws->r0 = light_gaus_nuc->rms1t[8]; // rms1t(9) -> rms1t[8] and so on...
2301 bl10->pf = light_gaus_nuc->pf1t[8];
2302 tf = light_gaus_nuc->tfln[8];
2303 v0 = light_gaus_nuc->vnuc[8];
2304 } //endif
2305 v1 = v0;
2306 ws->adif = 0.57735*(ws->r0);
2307 ws->rmaxws = ws->r0+2.5;
2308 } // end if
2309 if(ws->nosurf > 0) { //then
2310 ws->adif=0.0;
2311 ws->rmaxws=ws->r0;
2312 } //end if
2313 ws->drws = ws->rmaxws/29.0;
2314
2315 // on impose le rayon du noyau:
2316 // ....voir coherence function wsax(r) et derivwsax(r)
2317 bl3->r2 = ws->r0;
2318 if(verboseLevel > 3) {
2319 G4cout <<"Radius bl3->r2 = " << bl3->r2 << G4endl;
2320 }
2321
2322 G4double tnr = tlab;
2323 assert((tnr*tnr + 2.0*tlab*fmpinc) >= 0);
2324 assert((tnr+fmpinc) != 0);
2325 G4double binc = std::sqrt(tnr*tnr + 2.0*tlab*fmpinc)/(tnr+fmpinc);
2326 assert((1.0 - binc*binc) > 0);
2327 G4double ginc=1.0/std::sqrt(1.0 - binc*binc);
2328 G4double pinc = fmpinc*binc*ginc;
2329
2330// for(G4int i = 0; i < ia; i++) {
2331// jparticip[i]=0;
2332// }
2333 for(G4int i = 0; i < 300; i++) {
2334 jparticip[i] = 0;
2335 }
2336
2337 for(G4int bli = 0; bli < BL1SIZE; bli++) {
2338 bl1->eps[bli] = 0.0;
2339 bl1->p1[bli] = 0.0;
2340 bl1->p2[bli] = 0.0;
2341 bl1->p3[bli] = 0.0;
2342 q1[bli] = 0.0;
2343 q2[bli] = 0.0;
2344 q3[bli] = 0.0;
2345 q4[bli] = 0.0;
2346 }
2347
2348 // skip initialisations
2349 G4double efrun = 0.0;
2350 G4int iavat = 0;
2351
2352 // generation of the initial distribution in the rest frame of the iop-n03870
2353 // surface
2354 // 700 c bmax=r2+2.2*adif
2355 // 701 c r2i=(r2-2.2*adif)
2356 // 702 c r2s=(r2+2.2*adif)
2357 // 703 c **********
2358 // 704
2359
2360 ws->bmax = ws->rmaxws; // maximum extension of the nucleus ( w.s.)
2361
2362 // fin surface (que faire aux pions ?)
2363 // 709 c if (kindf7.gt.2) bmax=r2+2.2
2364 // 710 c if (kindf7.gt.2) bmax=bmax ! a.b. (avec w.s., idem les nucleons)
2365 // deutons cv 22/01/2001
2366 if (kindstruct->kindf7 <= 2) { //then
2367 ws->bmax = ws->bmax; // comme alain
2368 }
2369 else {
2370 if (kindstruct->kindf7 < 6) { // then
2371 ws->bmax = ws->bmax; // comme alain
2372 }
2373 else {
2374 beproj = fmpinc - bl3->ia1*fmp;
2375 ws->bmax = ws->rmaxws + rms1; // maximum extension of the nucleus ( w.s.)
2376 }
2377 }
2378
2379 // deutons
2380 G4double al;
2381 standardRandom(&al, &(hazard->ial));
2382 G4double b = std::sqrt(al)*(ws->bmax);
2383 G4double bred = b/bl3->r2;
2384 //G4double bimpact=b;
2385 bimpact = b;
2386 G4double tnor;
2387
2388 if(ws->nosurf != -2) { // la suite, c'est la version temps avant 2001
2389 if(ws->nosurf <= 0) {
2390 tnor = 70.0/30.6349;
2391 }
2392 // PK endif removed
2393 else {
2394 tnor=1.;
2395 } //endif
2396 if(ws->nosurf == 0) {
2397 bred = 0.;
2398 }
2399 if (kindstruct->kindf7 <= 2) {
2400 if (tlab < 400.0) {
2401 cb0 = 6.86 - 0.0035 * tlab;
2402 eb0 = 0.32 - 0.00005 * tlab;
2403 }
2404 else {
2405 if (tlab < 1000.0) { //then
2406 cb0 = 5.23 + 0.000575 * tlab;
2407 eb0 = 0.32 - 0.00005 * tlab;
2408 }
2409 else {
2410 cb0 = 5.73 + 0.00007 * tlab;
2411 eb0 = 0.283 - 0.000013 * tlab;
2412 }
2413 }
2414 temfin = 1.25*cb0/amax1(1.0,0.854 + 0.438*bred)*std::pow(G4double(bl3->ia2),(eb0/amax1(1.0,0.941+0.177*bred)));
2415 temfin = temfin*tnor;
2416 }
2417 else {
2418 if (kindstruct->kindf7 < 6) {
2419 // here for pions:
2420 temfin = 30.0*std::pow((float(bl3->ia2)/208.0),0.25)*(1.0 - 0.2*bred)*(1.0 - tlab/1250.0);
2421 // correction for pions in the case nosurf=0 or -1 (a.b., c.v. 2/2002)
2422 temfin = temfin*tnor;
2423 }
2424 else {
2425 // deutons
2426 tlabu = tlab/bl3->ia1;
2427 if (tlabu <= 400) {
2428 coeffb0 = -0.0035*tlabu + 6.86;
2429 expob0 = -0.00005*tlabu + 0.32;
2430 }
2431 else {
2432 if (tlabu <= 1000) { //then
2433 coeffb0 = 0.000575*tlabu + 5.23;
2434 expob0 = -0.00005*tlabu + 0.32;
2435 }
2436 else {
2437 coeffb0 = 0.00007*tlabu + 5.73;
2438 expob0 = -0.000013*tlabu + 0.283;
2439 }
2440 }
2441 if (bred <= 0.33333) {
2442 xc = 1.0;
2443 xe = 1.0;
2444 }
2445 else {
2446 xc = 0.438*bred + 0.854;
2447 xe = 0.177*bred + 0.941;
2448 }
2449 temfin = 1.25*(coeffb0/xc)*std::pow(G4double(bl3->ia2),(expob0/xe));
2450 // same renormalisation of time for p,n and composit particles.
2451 temfin = temfin*tnor;
2452 }
2453 }
2454 }
2455 else { //ici,nosurf=-2 c'est la fonction temps 2001 (avec surface).
2456 if(kindstruct->kindf7 >= 3 && kindstruct->kindf7 <= 5) {
2457 // here for pions (arbitrary multiplied by 2 for surface) (a.b., c.v.) 2/2002:
2458 // temfin=60.*(float(ia2)/208.)**0.25*(1.-0.2*bred)*(1.-tlab/1250.)
2459 // modified in april 2003 (more reasonable but not yet checked!)
2460 temfin = 25.5*std::pow(G4double(bl3->ia2),0.16); // pb208->60fm/c
2461 }
2462 else {
2463 // here for other hadrons
2464 temfin = 29.8*std::pow(G4double(bl3->ia2),0.16); // pb208->70fm/c
2465 }
2466 }
2467
2468 // deutons
2469 // a way to change stopping time f[5] not used here
2470 factemp = calincl->f[5]; // f(6)->f[5]
2471 // attention !!! 30/04/2001 scaling time is now a multiplication factor
2472 temfin = temfin*factemp;
2473
2474 exi = 0.0;
2475 nbquit = 0;
2476 iqe = 0;
2477 idecf = 0;
2478 bl4->tmax5 = temfin+0.1;
2479 npion = 0;
2480 efer = 0.0;
2481
2482 // deutons
2483 if (bl3->ia1 > 1) {
2484 goto pnu7;
2485 }
2486
2487 // deutons
2488 if (bl3->ia1 == 1) { //then
2489 // bl5->nesc[0] = 0; // nesc(1)->nesc[0] and so on...
2490 bl5->nesc[1] = 0;
2491 // bl1->ind2[0] = 2*iz1 - 1;
2492 bl1->ind2[1] = 2*iz1 - 1;
2493 bl1->ind1[1] = 0;
2494 bl3->x1[1] = 0.0;
2495 bl3->x2[1] = 0.0;
2496 bl3->x3[1] = 0.0;
2497 bl1->p1[1] = 0.0;
2498 bl1->p2[1] = 0.0;
2499 bl1->p3[1] = 0.0;
2500 bl9->hel[0] = 0.0;
2501 bl9->hel[1] = 0.0;
2502 jparticip[0] = 0;
2503 jparticip[1] = 1;
2504 }
2505 else {
2506 npion = 1;
2507 ipi[1] = 8 - 2*(kindstruct->kindf7);
2508 y1[1] = 0.0;
2509 y2[1] = 0.0;
2510 y3[1] = 0.0;
2511 q1[1] = 0.0;
2512 q2[1] = 0.0;
2513 q3[1] = 0.0;
2514 q4[1] = fmpi;
2515 }
2516
2517 // deutons
2518 goto pnu9;
2519 // 850
2520 pnu7:
2521 s1t1 = 0.0;
2522 s2t1 = 0.0;
2523 s3t1 = 0.0;
2524 sp1t1 = 0.0;
2525 sp2t1 = 0.0;
2526 sp3t1 = 0.0;
2527 for(G4int i = 1; i <= bl3->ia1; i++) {
2528 //for(G4int i = 1; i <= (bl3->ia1-1); i++) {
2529 // for(G4int i = 1; i < (bl3->ia1-1); i++) {
2530 bl9->hel[i] = 0;
2531 bl5->nesc[i] = 0;
2532 bl1->ind2[i] = 1;
2533 if (i > iz1) {
2534 bl1->ind2[i] = -1;
2535 }
2536 bl1->ind1[i] = 0;
2537 // deutons
2538 jparticip[i] = 1;
2539
2540 // deutons
2541 gaussianRandom(&xga);
2542 bl3->x1[i] = xga*rms1*0.57735;
2543 s1t1 = s1t1 + bl3->x1[i];
2544 gaussianRandom(&xga);
2545 bl3->x2[i] = xga*rms1*0.57735;
2546 s2t1 = s2t1 + bl3->x2[i];
2547 gaussianRandom(&xga);
2548 bl3->x3[i] = xga*rms1*0.57735;
2549 s3t1 = s3t1 + bl3->x3[i];
2550
2551 if(kindstruct->kindf7 == 6) { //then
2552 // deuteron density from paris potential in q space:
2553 standardRandom(&xq, &(hazard->igraine[9]));
2554 qdeut = splineab(xq) * 197.3289;
2555 standardRandom(&u, &(hazard->igraine[10]));
2556 cstet = u*2 - 1;
2557 assert((1.0 - std::pow(cstet,2)) >= 0);
2558 sitet = std::sqrt(1.0 - std::pow(cstet,2));
2559 standardRandom(&v, &(hazard->igraine[11]));
2560 phi = 2.0*3.141592654*v;
2561
2562 bl1->p1[i] = qdeut*sitet*std::cos(phi);
2563 bl1->p2[i] = qdeut*sitet*std::sin(phi);
2564 bl1->p3[i] = qdeut*cstet;
2565 }
2566 else {
2567 // density of composite as a gaussien in q space:
2568 gaussianRandom(&xga);
2569 bl1->p1[i] = xga*pf1*0.57735;
2570 gaussianRandom(&xga);
2571 bl1->p2[i] = xga*pf1*0.57735;
2572 gaussianRandom(&xga);
2573 bl1->p3[i] = xga*pf1*0.57735;
2574 }
2575
2576 bl1->eps[i] = w(bl1->p1[i],bl1->p2[i],bl1->p3[i],fmp);
2577 // assert(isnan(bl1->eps[i]) == false);
2578 // assert(isnan(energyTest(i)) == false);
2579
2580 sp1t1 = sp1t1 + bl1->p1[i];
2581 sp2t1 = sp2t1 + bl1->p2[i];
2582 sp3t1 = sp3t1 + bl1->p3[i];
2583 }
2584
2585 bl9->hel[bl3->ia1] = 0;
2586 bl5->nesc[bl3->ia1] = 0;
2587 bl1->ind2[bl3->ia1] = -1;
2588 bl1->ind1[bl3->ia1] = 0;
2589 bl3->x1[bl3->ia1] = -s1t1;
2590 bl3->x2[bl3->ia1] = -s2t1;
2591 bl3->x3[bl3->ia1] = -s3t1;
2592 bl1->p1[bl3->ia1] = -sp1t1;
2593 bl1->p2[bl3->ia1] = -sp2t1;
2594 bl1->p3[bl3->ia1] = -sp3t1;
2595 bl1->eps[bl3->ia1] = w(bl1->p1[bl3->ia1],bl1->p2[bl3->ia1],bl1->p3[bl3->ia1],fmp);
2596 // assert(isnan(bl1->eps[bl3->ia1]) == false);
2597 // assert(isnan(energyTest(bl3->ia1)) == false);
2598
2599 // deutons
2600 jparticip[bl3->ia1] = 1;
2601 if(verboseLevel > 3) {
2602 G4cout <<"Particle " << bl3->ia1-1 << " is now participant." << G4endl;
2603 }
2604 pnu9: // continue
2605 // deutons
2606 // target preparation for 1 < a < 5 (with sum of momentum =0)
2607 if(bl3->ia2 >= 2 && bl3->ia2 <= 4) {
2608 pnu1633:
2609 s1t1 = 0.0;
2610 s2t1 = 0.0;
2611 s3t1 = 0.0;
2612 sp1t1 = 0.0;
2613 sp2t1 = 0.0;
2614 sp3t1 = 0.0;
2615 efer = 0.0;
2616 for(G4int i = bl3->ia1+1; i <= ia; i++) {
2617 // for(G4int i = bl3->ia1; i < ia-1; i++) {
2618 // for(G4int i = bl3->ia1; i < ia; i++) {
2619 bl1->ind2[i] = 1;
2620 bl5->nesc[i] = 0;
2621 if (i > (iz2+bl3->ia1)) {
2622 bl1->ind2[i] = -1;
2623 }
2624 for(G4int j = 0; j < 7; j++) {
2625 standardRandom(&t[j], &(hazard->ial));
2626 }
2627
2628 t[1] = -1.0 + 2.0*t[1]; // t(2)->t[1]
2629 t[2] = 6.283185*t[2]; // t(3)->t[2]
2630 t[4] = -1.0 + 2.0*t[4]; // t(5)->t[4]
2631 t[5] = 6.283185*t[5]; // t(6) -> t[5]
2632 t1 = t[1]; // t(2)->t[1]
2633 assert((1.0 - t1*t1) >= 0);
2634 t2 = std::sqrt(1.0 - t1*t1);
2635 t3 = std::cos(t[2]); //t(3)->t[2]
2636 t4 = std::sin(t[2]); //t(3)->t[2]
2637 t5 = t[4]; // t(5)->t[4]
2638 assert((1.0 - t5*t5) >= 0);
2639 t6 = std::sqrt(1.0 - t5*t5);
2640 t7 = std::cos(t[5]); //t(6) -> t[5]
2641 t8 = std::sin(t[5]); // t(6)->t[5]
2642 if (ws->nosurf == 1) {
2643 x = bl3->r2*std::pow(t[0],0.33333333); // t(1)->t[0]
2644 y = (bl10->pf)*std::pow(t[3],0.33333333); // t(4)->t[3]
2645 }
2646 else {
2647 // surface..w.s.: impulsion (sphere dure), puis r(q)
2648 t33 = std::pow(t[6],0.33333333); // t(7)->t[6]
2649 y = (bl10->pf)*t33;
2650
2651 rr = interpolateFunction(t33);
2652 x = rr*std::pow(t[3],0.33333333); // t(4)->t[3]
2653 // fin surface on a redefini x et y
2654 }
2655 bl3->x1[i] = x*t2*t3;
2656 bl3->x2[i] = x*t2*t4;
2657 bl3->x3[i] = x*t1;
2658 s1t1 = s1t1 + bl3->x1[i];
2659 s2t1 = s2t1 + bl3->x2[i];
2660 s3t1 = s3t1+bl3->x3[i];
2661 bl1->p1[i] = y*t6*t7;
2662 bl1->p2[i] = y*t6*t8;
2663 bl1->p3[i] = y*t5;
2664 sp1t1 = sp1t1+bl1->p1[i];
2665 sp2t1 = sp2t1+bl1->p2[i];
2666 sp3t1 = sp3t1+bl1->p3[i];
2667 bl1->ind1[i] = 0;
2668 bl1->eps[i] = w(bl1->p1[i],bl1->p2[i],bl1->p3[i],fmp);
2669 // assert(isnan(bl1->eps[i]) == false);
2670 // assert(isnan(energyTest(i)) == false);
2671 bl9->hel[i] = 0.0;
2672 efer = efer + bl1->eps[i] - fmp;
2673 }
2674
2675 bl9->hel[ia] = 0;
2676 bl5->nesc[ia] = 0;
2677 bl1->ind2[ia] = -1;
2678 bl1->ind1[ia] = 0;
2679 bl3->x1[ia] = -s1t1;
2680 bl3->x2[ia] = -s2t1;
2681 bl3->x3[ia] = -s3t1;
2682 // assert(isnan(bl3->x3[ia]) == false);
2683 bl1->p1[ia] = -sp1t1;
2684 bl1->p2[ia] = -sp2t1;
2685 bl1->p3[ia] = -sp3t1;
2686
2687 assert((std::pow(bl1->p1[ia],2) + std::pow(bl1->p2[ia],2) + std::pow(bl1->p3[ia],2)) >= 0);
2688 p_mod = std::sqrt(std::pow(bl1->p1[ia],2) + std::pow(bl1->p2[ia],2) + std::pow(bl1->p3[ia],2));
2689 if(p_mod > ((bl10->pf)+0.05)) {
2690 goto pnu1633;
2691 }
2692
2693 bl1->eps[ia] = w(bl1->p1[ia],bl1->p2[ia],bl1->p3[ia],fmp);
2694 // assert(isnan(energyTest(ia)) == false);
2695
2696 efer = efer + bl1->eps[ia]-fmp;
2697
2698 } //end if !(bl3->ia2 >= 2 && bl3->ia2 <= 4)
2699
2700 // target preparation for a > 4
2701 if(bl3->ia2 > 4) {
2702 x1_target = 0.0;
2703 x2_target = 0.0;
2704 x3_target = 0.0;
2705 for(G4int i = bl3->ia1+1; i <= ia; i++) { //do 1 i=bl3->ia1+1,ia
2706 bl5->nesc[i] = 0;
2707 bl1->ind2[i] = 1;
2708 if (i > (iz2+bl3->ia1)) {
2709 bl1->ind2[i] = -1;
2710 }
2711 // surface ajout de t(7) surface.f avait do 6 j=2,7 ici 1,6 ?
2712 for(G4int j = 0; j < 7; j++) {
2713 standardRandom(&t[j], &(hazard->ial));
2714 }
2715
2716 // pnu6: // continue
2717 t[1] = -1.0 + 2.0*t[1]; //t(2)->t[1]
2718 t[2] = 6.283185*t[2];
2719 t[4] = -1.0 + 2.0*t[4]; // t(5)->t[4]
2720 t[5] = 6.283185*t[5]; //t(6)->t[5]
2721 t1 = t[1]; // t(2)->t[1]
2722 assert((1.0 - t1*t1) >= 0);
2723 t2 = std::sqrt(1.0 - t1*t1);
2724 t3 = std::cos(t[2]); //t(3)->t[2]
2725 t4 = std::sin(t[2]); //t(3)->t[2]
2726 t5 = t[4]; //t(5)->t[4]
2727 assert((1.0 - t5*t5) >= 0);
2728 t6 = std::sqrt(1.0 - t5*t5);
2729 t7 = std::cos(t[5]); //t(6)->t[5]
2730 t8 = std::sin(t[5]); // t(6)->t[5]
2731
2732 if (ws->nosurf == 1) {
2733 x = bl3->r2*std::pow(t[0],0.33333333); // t(1)->t[0]
2734 y = bl10->pf*std::pow(t[3],0.33333333); // t(4)->t3
2735 }
2736 else {
2737 // surface..w.s.: impulsion (sphere dure), puis r(q)
2738 t33 = std::pow(t[6],0.33333333); // t(7)->t[6]
2739 y=bl10->pf*t33;
2740 rr=interpolateFunction(t33);
2741 x=rr*std::pow(t[3],0.33333333); // t(4)->t[3]
2742 // fin surface on a redefini x et y
2743 }
2744 bl3->x1[i] = x*t2*t3;
2745 bl3->x2[i] = x*t2*t4;
2746 bl3->x3[i] = x*t1;
2747 bl1->p1[i] = y*t6*t7;
2748 bl1->p2[i] = y*t6*t8;
2749 bl1->p3[i] = y*t5;
2750 x1_target = x1_target + bl3->x1[i];
2751 x2_target = x2_target + bl3->x2[i];
2752 x3_target = x3_target + bl3->x3[i];
2753 bl1->ind1[i] = 0;
2754 bl1->eps[i] = w(bl1->p1[i],bl1->p2[i],bl1->p3[i],fmp);
2755 // assert(isnan(energyTest(i)) == false);
2756
2757 bl9->hel[i] = 0.0;
2758 efer = efer + bl1->eps[i] - fmp;
2759 }
2760 x1_target = x1_target/bl3->ia2;
2761 x2_target = x2_target/bl3->ia2;
2762 x3_target = x3_target/bl3->ia2;
2763 }
2764
2765 efrun = efrun + efer;
2766
2767 // location of incident particle at point (b,z)
2768 r22 = bl3->r2*(bl3->r2);
2769 z = ws->bmax * (ws->bmax) - b*b; // for the wood-saxon density...
2770
2771 if (z < 0.0) {
2772 z=0.0;
2773 }
2774
2775 assert(z >= 0);
2776 z = std::sqrt(z);
2777 // random azimuthal direction of the impact parameter (sept 99)
2778
2779 if (kindstruct->kindf7 <= 2) {
2780 G4long testseed = hazard->igraine[13];
2781 // standardRandom(&tbid, &(hazard->igraine[13]));
2782 standardRandom(&tbid, &testseed);
2783 hazard->igraine[13] = testseed;
2784 tbid = tbid*6.283185;
2785 bl3->x1[1] = bl3->x1[1] + b*std::cos(tbid); //x1(1)->x1[1]
2786 bl3->x2[1] = bl3->x2[1] + b*std::sin(tbid); //x2(1)->x2[1]
2787 bl3->x3[1] = bl3->x3[1] - z;
2788 // pour le ntuple des avatars:
2789 if(varavat->kveux == 1) {
2790 varavat->r1_in[0] = bl3->x1[1]; //r1_in(1)->r1_in[0] and x1(1)->x1[0]
2791 varavat->r1_in[1] = bl3->x2[1]; //r1_in(2)->r1_in[1] and x1(2)->x1[1]
2792 varavat->r1_in[2] = bl3->x3[1]; //r1_in(3)->r1_in[2] and x1(3)->x1[2]
2793 } //endif
2794 }
2795 else {
2796 if (kindstruct->kindf7 < 6) { //then ! pour les pions on laisse
2797 //call standardRandom(tbid,iy14)
2798 standardRandom(&tbid, &(hazard->igraine[13]));
2799 tbid = tbid*6.283185;
2800 y1[1] = y1[1] + b*std::cos(tbid); //y1(1)->y1[0]
2801 y2[1] = y2[1] + b*std::sin(tbid); //y2(1)->y2[0]
2802 y3[1] = y3[1] - z;
2803 }
2804 else {
2805 // deutons
2806 //nmiss=0.;
2807 nmiss = 0;
2808 xlengm=1000.0;
2809
2810 for(G4int i = 1; i <= bl3->ia1; i++) {
2811 // for(G4int i = 1; i < bl3->ia1; i++) {
2812 // assert(isnan(ginc) == false);
2813 assert(ginc != 0);
2814 bl3->x3[i] = bl3->x3[i]/ginc;
2815 // assert(isnan(bl3->x3[i]) == false);
2816 zai2 = ws->rmaxws*(ws->rmaxws) - std::pow((b+bl3->x1[i]),2) - std::pow(bl3->x2[i],2);
2817 if (zai2 < 0.0) {
2818 goto pnu22;
2819 }
2820 ztu = -std::sqrt(zai2);
2821 // r22 remplace par rmaxws*rmaxws et r2 par rmaxws cv correct ?
2822 za_i = 2.0*(ws->rmaxws) + ztu;
2823 xleng = za_i - bl3->x3[i];
2824 if (xleng > xlengm) {
2825 // goto pnu21;
2826 continue;
2827 }
2828 ilm = i;
2829 xlengm = xleng;
2830 // assert(isnan(ztu) == false);
2831 ztouch = ztu;
2832 // goto pnu21;
2833 continue;
2834 pnu22:
2835 nmiss = nmiss + 1;
2836 }
2837 // pnu21:
2838 if (nmiss == bl3->ia1) { //then
2839 nopart = -1;
2840 // return;
2841 if(verboseLevel > 3) {
2842 G4cout <<"nmiss == bl3->ia1" << G4endl;
2843 G4cout <<"End of algorithm after pnu21." << G4endl;
2844 }
2845 goto pnureturn;
2846 }
2847 else {
2848 zshif = bl3->x3[ilm] - ztouch;
2849 standardRandom(&tbid, &(hazard->igraine[13]));
2850 tbid = tbid*6.283185;
2851 for(G4int i = 1; i <= bl3->ia1; i++) {
2852 xxx = bl3->x1[i] + b;
2853 bl3->x1[i] = xxx*std::cos(tbid) - bl3->x2[i]*std::sin(tbid);
2854 bl3->x2[i] = xxx*std::sin(tbid) + bl3->x2[i]*std::cos(tbid);
2855 bl3->x3[i] = bl3->x3[i] - zshif;
2856 }
2857 if (std::fabs(std::pow(bl3->x1[ilm],2)+std::pow(bl3->x2[ilm],2)+std::pow(bl3->x3[ilm],2)-ws->rmaxws*(ws->rmaxws)) > 0.01) {
2858 if(verboseLevel > 2) {
2859 G4cout <<"wrong position" << G4endl;
2860 }
2861 }
2862 }
2863 }
2864 }
2865
2866 // initial momentum for all type of incident particles:
2867 xl1 = b*pinc*std::sin(tbid);
2868 xl2 = -b*pinc*std::cos(tbid);
2869 xl3 = 0.0;
2870
2871 // transcription in the general frame of reference
2872 // (here,=lab frame)
2873
2874 be = 0.0;
2875 ge = 1.0;
2876 b1 = (binc - be)/(1.0 - be*binc);
2877 b2 = -be;
2878 assert((1.0 - b1*b1) > 0);
2879 g1 = 1.0/std::sqrt(1.0 - b1*b1);
2880 g2 = 1.0;
2881 // deutons
2882 // here for nucleons
2883 if (kindstruct->kindf7 <= 2) {
2884 bl1->eps[1] = g1*fmp + v0;
2885 assert((std::pow(bl1->eps[1],2) - std::pow(fmp,2)) >= 0);
2886 bl1->p3[1] = std::sqrt(std::pow(bl1->eps[1],2) - std::pow(fmp,2));
2887 // assert(isnan(energyTest(1)) == false);
2888 }
2889 else {
2890 // here for pions
2891 if (kindstruct->kindf7 < 6) { //then
2892 q4[1] = g1*fmpi; // q4(1)->q4[0]
2893 q3[1] = b1*q4[1];
2894 }
2895 else {
2896 // here for composite projectiles:
2897 // the kinetic energy is below the threshold. put all
2898 // fermi momentum to 0... projectile nucleons not on shell!
2899 energie_in = tlab + fmpinc;
2900 if((energie_in) <= (bl3->ia1*fmp)) {
2901 for(G4int i = 1; i <= bl3->ia1; i++) {
2902 bl1->eps[i] = energie_in/bl3->ia1;
2903 bl1->p1[i] = 0.0;
2904 bl1->p2[i] = 0.0;
2905 bl1->p3[i] = pinc/bl3->ia1;
2906 // assert(isnan(energyTest(i)) == false);
2907 }
2908 goto pnu1871;
2909 }
2910 // here the composit is above threshold
2911 for(G4int i = 1; i <= bl3->ia1; i++) { //do i=1,bl3->ia1 !save e,p in the composit rest frame
2912 eps_c[i] = bl1->eps[i];
2913 p3_c[i] = bl1->p3[i];
2914 } //enddo
2915
2916 nbtest = bl3->ia1 - 1;
2917 if(kindstruct->kindf7 == 6) {
2918 nbtest = 2;
2919 }
2920 iflag = 0;
2921 pnu1870:
2922 sueps = 0.0;
2923
2924 iflag = iflag + 1;
2925
2926 for(G4int i = 1; i <= bl3->ia1; i++) { //do i=1,bl3->ia1
2927 tte = eps_c[i];
2928 bl1->eps[i] = g1*(eps_c[i] + b1*p3_c[i]);
2929 bl1->p3[i] = g1*(b1*tte + p3_c[i]);
2930 // assert(isnan(energyTest(i)) == false);
2931 sueps = sueps + bl1->eps[i];
2932 } //enddo
2933
2934 assert(sueps != 0);
2935 cobe = (tlab + fmpinc)/sueps;
2936
2937 // off shell problem for incident clusters (a.b. 2/2002)
2938
2939 if(iflag == nbtest) { // too much..all momentum to 0
2940 for(G4int klm = 1; klm <= bl3->ia1; klm++) { //do klm=1,bl3->ia1
2941 eps_c[klm] = fmp;
2942 bl1->p1[klm] = 0.0;
2943 bl1->p2[klm] = 0.0;
2944 p3_c[klm] = 0;
2945 }
2946 goto pnu1870;
2947 }
2948 for(G4int i = 1; i <= bl3->ia1; i++) { //do i=1,bl3->ia1
2949 // assert(isnan(energyTest(i)) == false);
2950 arg = std::pow((cobe*(bl1->eps[i])),2)-pm2;
2951 if (arg <= 0.) { //then ! put maximum momentum to 0.
2952 i_emax = 1; // !find maximum
2953 ener_max = bl1->eps[1];
2954 for(G4int klm = 2; klm <= bl3->ia1; klm++) { //do klm=2,bl3->ia1
2955 if(bl1->eps[klm] > ener_max) {
2956 ener_max = bl1->eps[klm];
2957 i_emax = klm;
2958 }
2959 }
2960 eps_c[i_emax] = fmp;
2961 bl1->p1[i_emax] = 0.0;
2962 bl1->p2[i_emax] = 0.0;
2963 p3_c[i_emax] = 0.0;
2964
2965 if(i_emax == bl3->ia1) { // circular permut if the last one
2966 epsv = eps_c[bl3->ia1]; // permutation circulaire
2967 p1v = bl1->p1[bl3->ia1];
2968 p2v = bl1->p2[bl3->ia1];
2969 p3v = p3_c[bl3->ia1];
2970 for(bl2->k = bl3->ia1-1; bl2->k >= 1; bl2->k = bl2->k - 1) { //do k=bl3->ia1-1,1,-1
2971 eps_c[bl2->k+1] = eps_c[bl2->k];
2972 bl1->p1[bl2->k+1] = bl1->p1[bl2->k];
2973 bl1->p2[bl2->k+1] = bl1->p2[bl2->k];
2974 p3_c[bl2->k+1] = p3_c[bl2->k];
2975 }
2976 eps_c[1] = epsv;
2977 bl1->p1[1] = p1v;
2978 bl1->p2[1] = p2v;
2979 p3_c[1] = p3v; // fin permut.
2980 }
2981 sp1t1 = 0.0; // re-compute the last one
2982 sp2t1 = 0.0;
2983 sp3t1 = 0.0;
2984 for(G4int j = 1; j <= bl3->ia1-1; j++) { //do j=1,bl3->ia1-1
2985 sp1t1 = sp1t1 + bl1->p1[j];
2986 sp2t1 = sp2t1 + bl1->p2[j];
2987 sp3t1 = sp3t1 + p3_c[j];
2988 }
2989 bl1->p1[bl3->ia1] = -sp1t1;
2990 bl1->p2[bl3->ia1] = -sp2t1;
2991 p3_c[bl3->ia1] = -sp3t1;
2992 eps_c[bl3->ia1] = w(bl1->p1[bl3->ia1],bl1->p2[bl3->ia1],p3_c[bl3->ia1],fmp);
2993
2994 goto pnu1870; // ..and boost all of them.
2995 }
2996 }
2997
2998 for(G4int i = 1; i <= bl3->ia1; i++) { //do i=1,bl3->ia1
2999 // for(G4int i = 1; i < bl3->ia1; i++) { //do i=1,bl3->ia1
3000 // assert(isnan(energyTest(i)) == false);
3001 arg = std::pow((cobe*(bl1->eps[i])),2) - pm2;
3002 comom = std::sqrt(arg/(std::pow(bl1->eps[i],2) - pm2));
3003 // assert(isnan(comom) == false);
3004 bl1->p1[i] = comom*(bl1->p1[i]);
3005 bl1->p2[i] = comom*(bl1->p2[i]);
3006 bl1->p3[i] = comom*(bl1->p3[i]);
3007 bl1->eps[i] = bl1->eps[i]*cobe;
3008 // assert(isnan(energyTest(i)) == false);
3009 if (std::fabs(am(bl1->p1[i],bl1->p2[i],bl1->p3[i],bl1->eps[i])-fmp) > 0.01) {
3010 if(verboseLevel > 2) {
3011 G4cout <<"wrong correction " << i << G4endl;
3012 }
3013 }
3014 }
3015 bl1->eps[ilm] = bl1->eps[ilm] + v0;
3016 }
3017 }
3018
3019 pnu1871:
3020 // evaluation of the times t(a,b)
3021 bl2->k = 0;
3022 kcol = 0;
3023 if (kindstruct->kindf7 <= 2) {
3024 // modif s.vuillier tient compte propagation projectile,1e collision
3025 // imposee pour lui (c'est une maniere de faire!!)
3026 G4int ioldk = 0;
3027 for(G4int i = 1; i <= ia; i++) { //do 40 i=1,ia
3028 ioldk = bl2->k;
3029 // bl2->k = bl2->k + 1;
3030 // tref=ref(x1(i),x2(i),x3(i),p1(i),p2(i),p3(i),eps(i),r22) p-n04740
3031 // assert(isnan(energyTest(i)) == false);
3032 tref = ref(bl3->x1[i], bl3->x2[i], bl3->x3[i], bl1->p1[i], bl1->p2[i], bl1->p3[i], bl1->eps[i], r22);
3033 // assert(isnan(tref) == false);
3034 if (tref > bl4->tmax5) {
3035 goto pnu45;
3036 }
3037
3038 bl2->k = bl2->k + 1;
3039 assert((bl2->k >= 0) && (bl2->k < BL2INDSIZE));
3040 bl2->crois[bl2->k]=tref;
3041 bl2->ind[bl2->k]=i;
3042 bl2->jnd[bl2->k]=-1;
3043 pnu45:
3044 i1=i-1;
3045 if (i == 1) {
3046 //goto pnu40;
3047 continue;
3048 }
3049 // 1326 c ici on ne calcule que les G4interactions nn impliquant le projectile !!! (2/02)
3050 if (i1 > bl3->ia1) {
3051 i1=bl3->ia1;
3052 }
3053 for(G4int j = 1; j <= i1; j++) { //do 41 j=1,i1
3054 // no collisions before the first collision of the incident particle
3055 time (i, j);
3056 if (bl1->ta < 0.0) {
3057 continue;
3058 }
3059 if(bl1->ta > bl4->tmax5) {
3060 continue;
3061 }
3062 eij=am(bl1->p1[i]+bl1->p1[j],bl1->p2[i]+bl1->p2[j],bl1->p3[i]+bl1->p3[j],bl1->eps[i]+bl1->eps[j]);
3063 // assert(isnan(eij) == false);
3064 if (eij < 1925.0) {
3065 continue;
3066 }
3067 isos=bl1->ind2[i]+bl1->ind2[j];
3068
3069 // assert(isnan(eij) == false);
3070 // assert(isnan(isos) == false);
3071 if (31.0*(bl3->rab2) > totalCrossSection(eij,0,isos)) {
3072 continue;
3073 }
3074
3075 bl2->k = bl2->k + 1;
3076 assert((bl2->k >= 0) && (bl2->k < BL2INDSIZE));
3077 if (j == 1) {
3078 kcol = kcol + 1;
3079 }
3080 bl2->crois[bl2->k]=bl1->ta;
3081 bl2->ind[bl2->k]=i;
3082 bl2->jnd[bl2->k]=j;
3083 }
3084 if(verboseLevel > 3) {
3085 if(bl2->k == (ioldk + 2)) {
3086 if(verboseLevel > 2) {
3087 G4cout <<"bl2->k incremented twice!" << G4endl;
3088 }
3089 }
3090 }
3091 }
3092 }
3093 else {
3094 // deutons
3095 if (kindstruct->kindf7 < 6) { //then
3096 // here for incoming pions:
3097 for(G4int i = bl3->ia1+1; i <= ia; i++) { //do i=ia1+1,ia
3098 // assert(isnan(energyTest(i)) == false);
3099 tref = ref(bl3->x1[i], bl3->x2[i], bl3->x3[i], bl1->p1[i], bl1->p2[i], bl1->p3[i], bl1->eps[i], r22);
3100 // assert(isnan(tref) == false);
3101 // assert(isnan(tref) == false);
3102 if (tref < bl4->tmax5) {
3103 bl2->k = bl2->k + 1;
3104 assert((bl2->k >= 0) && (bl2->k < BL2INDSIZE));
3105 bl2->crois[bl2->k] = tref;
3106 bl2->ind[bl2->k] = i;
3107 bl2->jnd[bl2->k] = -1;
3108 }
3109 }
3110 new2(y1[1], y2[1], y3[1], q1[1], q2[1], q3[1], q4[1], 1, 0);
3111
3112 // modif a.b. 21/06/2002: should check at least one valid collision
3113 // 1361 c with incoming pion.
3114 // 1362 c kcol=1
3115 if(bl2->k != 0) {
3116 kcol = 1;
3117 }
3118 }
3119 else {
3120 for(G4int i = 1; i <= bl3->ia1; i++) { //do 38 i=1,ia1
3121 bl5->nesc[i] = 1;
3122 if (i != ilm) {
3123 goto pnu36;
3124 }
3125 // assert(isnan(energyTest(i)) == false);
3126 tref = ref(bl3->x1[i], bl3->x2[i], bl3->x3[i], bl1->p1[i], bl1->p2[i], bl1->p3[i], bl1->eps[i], r22);
3127 // assert(isnan(tref) == false);
3128 if(verboseLevel > 3) {
3129 if(tref < 0.0) {
3130 if(verboseLevel > 2) {
3131 G4cout <<"G4Incl: Reflection time < 0! (line 2579)" << G4endl;
3132 }
3133 }
3134 }
3135 bl5->nesc[i] = 0;
3136 npproj[i] = 0;
3137 goto pnu37;
3138 pnu36:
3139 t1 = bl3->x1[i]*(bl1->p1[i])+bl3->x2[i]*(bl1->p2[i])+bl3->x3[i]*(bl1->p3[i]);
3140 t2 = bl1->p1[i]*(bl1->p1[i])+bl1->p2[i]*(bl1->p2[i])+bl1->p3[i]*(bl1->p3[i]);
3141 assert(t2 != 0);
3142 t3 = t1/t2;
3143 t4 = bl3->x1[i]*(bl3->x1[i])+bl3->x2[i]*(bl3->x2[i])+bl3->x3[i]*(bl3->x3[i]);
3144 // 1379 c incoming nucleons enter potential at maximum radius (modif. 13/06/01)
3145 t5 = t3*t3 + ((ws->rmaxws)*(ws->rmaxws) - t4)/t2;
3146 if(verboseLevel > 3) {
3147 G4cout <<"x1 = " << bl3->x1[i] <<" x2 = " << bl3->x2[i] <<" x3 = " << bl3->x3[i] << G4endl;
3148 G4cout <<"t1 = " << t1 << G4endl;
3149 G4cout <<"t2 = " << t2 << G4endl;
3150 G4cout <<"t3 = " << t3 << G4endl;
3151 G4cout <<"t4 = " << t4 << G4endl;
3152 G4cout <<"rmaxws = " << ws->rmaxws << G4endl;
3153 G4cout <<"t5 = " << t5 << G4endl;
3154 }
3155 if (t5 < 0.) {
3156 continue;
3157 }
3158 tref = (-1.0*t3 - std::sqrt(t5))*(bl1->eps[i]);
3159 // assert(isnan(tref) == false);
3160 if (tref > bl4->tmax5) {
3161 continue;
3162 }
3163 npproj[i] = 1;
3164 pnu37:
3165 bl2->k = bl2->k + 1;
3166 assert((bl2->k >= 0) && (bl2->k < BL2INDSIZE));
3167 bl2->crois[bl2->k] = tref;
3168 bl2->ind[bl2->k] = i;
3169 bl2->jnd[bl2->k] = -1;
3170 }
3171 kcol = 1;
3172
3173 // for(G4int i = bl3->ia1+1; i < ia; i++) { //do 39 i=ia1+1,ia
3174 for(G4int i = bl3->ia1+1; i <= ia; i++) { //do 39 i=ia1+1,ia
3175 npproj[i] = 0;
3176 // assert(isnan(energyTest(i)) == false);
3177 tref = ref(bl3->x1[i], bl3->x2[i], bl3->x3[i], bl1->p1[i], bl1->p2[i], bl1->p3[i], bl1->eps[i], r22); // line 2609
3178 // assert(isnan(tref) == false);
3179 if(verboseLevel > 3) {
3180 if(tref < 0.0) {
3181 G4cout <<"G4Incl: Reflection time < 0! (line 2609)" << G4endl;
3182 }
3183 }
3184
3185 if (tref < bl4->tmax5) { //then
3186 bl2->k = bl2->k + 1;
3187 bl2->crois[bl2->k]=tref;
3188 bl2->ind[bl2->k]=i;
3189 bl2->jnd[bl2->k]=-1;
3190 } //endif
3191
3192 time (i, ilm);
3193 if (bl1->ta < 0.) {
3194 continue;
3195 }
3196 if (bl1->ta > bl4->tmax5) {
3197 continue;
3198 }
3199 eij=am(bl1->p1[i]+bl1->p1[ilm],bl1->p2[i]+bl1->p2[ilm],bl1->p3[i]+bl1->p3[ilm],bl1->eps[i]+bl1->eps[ilm]);
3200 // assert(isnan(eij) == false);
3201 if (eij < 1925.0) {
3202 continue;
3203 }
3204 isos=bl1->ind2[i]+bl1->ind2[ilm];
3205 // assert(isnan(eij) == false);
3206 // assert(isnan(isos) == false);
3207 if (31.*(bl3->rab2) > totalCrossSection(eij,0,isos)) {
3208 continue;
3209 }
3210 bl2->k = bl2->k + 1;
3211 kcol=kcol+1;
3212 bl2->crois[bl2->k]=bl1->ta;
3213 bl2->ind[bl2->k]=i;
3214 bl2->jnd[bl2->k]=ilm;
3215 }
3216 }
3217 }
3218
3219 // dumpBl3(dumpOut);
3220
3221 if(verboseLevel > 3) {
3222 G4cout <<"Variables after time evaluation:" << G4endl;
3223
3224 G4cout <<"bl3->ia1 + bl3->ia2 = ia " << G4endl;
3225 G4cout << bl3->ia1 << " " << bl3->ia2 << " " << ia << G4endl;
3226 G4cout <<"B11" << G4endl;
3227
3228 for(G4int idebugtest = 0; idebugtest <= bl2->k; idebugtest++) {
3229 G4cout <<"index = " << idebugtest << " ind1 = " << bl1->ind1[idebugtest] << " ind2 = " << bl1->ind2[idebugtest] << " p1 = " << bl1->p1[idebugtest] << " p2 = " << bl1->p2[idebugtest] << " p3 = " << bl1->p3[idebugtest] << " bl1->eps = " << bl1->eps[idebugtest] << G4endl;
3230 }
3231
3232 G4cout <<"Bl2" << G4endl;
3233 for(G4int idebugtest = 0; idebugtest <= bl2->k; idebugtest++) {
3234 G4cout <<"index = " << idebugtest << " ind = " << bl2->ind[idebugtest] << " jnd = " << bl2->jnd[idebugtest] << " crois = " << bl2->crois[idebugtest] << G4endl;
3235 }
3236
3237 G4cout <<"jparticip[i]" << G4endl;
3238 for(G4int idebugtest = 0; idebugtest < 300; idebugtest++) {
3239 G4cout <<" " << jparticip[idebugtest];
3240 }
3241 G4cout << G4endl;
3242 }
3243
3244
3245 // deutons
3246 if (kcol != 0) {
3247 if(verboseLevel > 3) {
3248 G4cout <<"After time evaluation: kcol != 0!" << G4endl;
3249 }
3250 goto pnu48;
3251 }
3252 nopart = -1;
3253 // Pour eviter renvoi des resultats du run precedent cv 7/7/98
3254 iarem = bl3->ia2;
3255 izrem = iz2;
3256 esrem = 0.0;
3257 erecrem = 0.0;
3258
3259 if(verboseLevel > 3) {
3260 G4cout <<"kcol == 0. No collisions..." << G4endl;
3261 G4cout <<"End of algorithm because kcol == 0." << G4endl;
3262 G4cout <<"kcol = " << kcol << G4endl;
3263 G4cout <<"Return after pnu39." << G4endl;
3264 }
3265 // fin ajout cv
3266 goto pnureturn;
3267
3268 // Initialization at the beginning of the run
3269 pnu48:
3270 if(verboseLevel > 3) {
3271 G4cout <<"Beginning a run..." << G4endl;
3272 }
3273 timi = 0.0;
3274 tim = 0.0;
3275 ncol = 0;
3276
3277 // compteur des collisions a deux corps (call collis acceptes par pauli)
3278 ncol_2c = 0;
3279
3280 //C npion=0;
3281 mrnn = 0;
3282 mrnd = 0;
3283 mrdd = 0;
3284 mrdn = 0;
3285 mrdp = 0;
3286 mrpd = 0;
3287 mcdd = 0;
3288 mpaul2 = 0;
3289 mpaul1 = 0;
3290
3291 // approx. (not considering escaping protons of incident clusters) 11/03 a.b.
3292 itch = iz1 + iz2 - 1;
3293 for(G4int i = 1; i <= ia; i++) { //do 47 i=1,ia
3294 bl5->tlg[i] = 0.0;
3295 nc[i] = 0;
3296 }
3297 itt = 1;
3298
3299 // tableau des energies a l'initialisation
3300 if(varavat->kveux == 1) {
3301 for(G4int i = bl3->ia1+1; i <= ia; i++) {
3302 varavat->epsd[i] = bl1->eps[i];
3303 }
3304 iflag20 = 0;
3305 iflag40 = 0;
3306 iflag60 = 0;
3307 }
3308
3309 // search for the smallest positive t(a,b)
3310 // pour tests, =0 G4interdit les reflexions avant un avatar du projectile,
3311 // =1 comme avant (reflexions autorisees). (a.b. 3/2002)
3312 irst_avatar = 1;
3313
3314 if(verboseLevel > 3) {
3315 G4cout <<"Now arriving to label pnu449." << G4endl;
3316 }
3317 pnu449:
3318 if(verboseLevel > 3) {
3319 G4cout <<"Now at 449" << G4endl;
3320 G4cout <<"G4Incl: Now at label pnu449." << G4endl;
3321 }
3322 next = 1;
3323 indic[next] = 1;
3324
3325 pnu44:
3326 if(verboseLevel > 3) {
3327 G4cout <<"Now at 44" << G4endl;
3328 G4cout <<"Starting a new loop at pnu44..." << G4endl;
3329 }
3330 if(next == 0) {
3331 if(verboseLevel > 3) {
3332 G4cout <<"next == 0. Returning to label pnu449." << G4endl;
3333 G4cout <<"next == 0" << G4endl;
3334 }
3335 goto pnu449;
3336 }
3337
3338 idep = indic[next] + 1;
3339 tau = bl2->crois[idep-1];
3340
3341 if(idep > bl2->k) {
3342 if(verboseLevel > 3) {
3343 G4cout <<"G4Incl: idep > bl2->k. Going to pnu448." << G4endl;
3344 }
3345 goto pnu448;
3346 }
3347 for(G4int i = idep; i <= bl2->k; i++) { //do 42 i=idep,k
3348 if (bl2->crois[i] > tau) {
3349 continue;
3350 }
3351 tau = bl2->crois[i];
3352 next = next + 1;
3353 indic[next] = i;
3354 }
3355
3356 // assert(isnan(tau) == false);
3357 if(verboseLevel > 3) {
3358 G4cout <<"next = " << next << G4endl;
3359 }
3360 pnu448:
3361 imin = indic[next];
3362 bl9->l1 = bl2->ind[imin]; //NOTE: l1 changed to bl9->l1.
3363 bl9->l2 = bl2->jnd[imin]; //NOTE: l2 changed to bl9->l2.
3364
3365 // test le 20/3/2003: tue sinon le dernier avatar?
3366 if (bl2->k == 0) {
3367 if(verboseLevel > 2) {
3368 G4cout <<"k == 0. Going to the end of the avatar." << G4endl;
3369 }
3370 goto pnu230;
3371 }
3372 bl2->k = bl2->k - 1; // bugfix k belongs to struct bl2!
3373 next = next - 1;
3374
3375 // correction s.vuillier 25/1/96 decalage temps correct
3376 if (imin > bl2->k) {
3377 goto pnu46;
3378 }
3379
3380 for(G4int i = imin; i <= bl2->k; i++) { //do 43 i=imin,k
3381 bl2->crois[i] = bl2->crois[i+1];
3382 bl2->ind[i] = bl2->ind[i+1];
3383 bl2->jnd[i] = bl2->jnd[i+1];
3384 }
3385 pnu46:
3386 if(verboseLevel > 3) {
3387 G4cout <<"G4Incl: Now at pnu46." << G4endl;
3388 }
3389 tim = timi + tau;
3390
3391 // tableau des energies a t=20,40,60 fm/c
3392 if(varavat->kveux == 1) {
3393 if(iflag20 == 0 && tim >= 20.0) {
3394 iflag20 = 1;
3395 for(G4int i = 1; i <= ia; i++) {
3396 if(bl5->nesc[i] == 0) {
3397 if(jparticip[i] == 1) {
3398 varavat->eps2[i] = bl1->eps[i];
3399 }
3400 else {
3401 varavat->eps2[i] = 0.0;
3402 }
3403 }
3404 else {
3405 varavat->eps2[i] = 0.;
3406 }
3407 }
3408 }
3409
3410 if(iflag40 == 0 && tim >= 40.0) {
3411 iflag40 = 1;
3412 for(G4int i = 1; i <= ia; i++) {
3413 if(bl5->nesc[i] == 0) {
3414 if(jparticip[i] == 1) {
3415 varavat->eps4[i] = bl1->eps[i];
3416 }
3417 else {
3418 varavat->eps4[i] = 0.0;
3419 }
3420 }
3421 else {
3422 varavat->eps4[i] = 0.0;
3423 }
3424 }
3425 }
3426
3427 if(iflag60 == 0 && tim >= 60.) {
3428 iflag60=1;
3429 for(G4int i = 1; i <= ia; i++) {
3430 if(bl5->nesc[i] == 0) {
3431 if(jparticip[i] == 1) {
3432 varavat->eps6[i] = bl1->eps[i];
3433 }
3434 else {
3435 varavat->eps6[i] = 0.0;
3436 }
3437 }
3438 else {
3439 varavat->eps6[i] = 0.0;
3440 }
3441 }
3442 }
3443 }
3444
3445 // modif: pas de reflexions avant au moins un avatar du (des) nucleon incident
3446 // celui-ci ne peut etre qu'une collision nn (ou pin)
3447
3448 if((irst_avatar == 0) && (bl9->l2 == -1)) {
3449 if(verboseLevel > 3) {
3450 G4cout <<"Interaction type: reflection (l2 = " << bl9->l2 << "). No first interaction with a participant yet." << G4endl;
3451 }
3452 goto pnu44;
3453 }
3454
3455 irst_avatar = irst_avatar+1;
3456
3457 if (tim < temfin) {
3458 if(verboseLevel > 3) {
3459 G4cout <<"G4Incl: tim < temfin. Going to pnu49 (line 2886)" << G4endl;
3460 }
3461 goto pnu49; // line 2886
3462 }
3463
3464 goto pnu255;
3465 pnu49:
3466 if(verboseLevel > 3) {
3467 G4cout <<"G4Incl: Now at pnu49. " << G4endl;
3468 }
3469
3470 if (bl2->k == 0) {
3471 if(verboseLevel > 3) {
3472 G4cout <<"G4Incl: bl2->k == 0. Going to pnu255." << G4endl;
3473 }
3474 goto pnu255;
3475 }
3476 // l1 va a la surface du noyau:
3477 if (bl9->l2 == -1) {
3478 if(verboseLevel > 3) {
3479 G4cout <<"G4Incl: l2 == -1. Going to pnu220." << G4endl;
3480 }
3481 goto pnu220;
3482 }
3483
3484 if((k4-1) <= 0) {
3485 if(verboseLevel > 3) {
3486 G4cout <<"G4Incl: (k4 - 1) <= 0. Going to pnu803." << G4endl;
3487 }
3488 goto pnu803;
3489 }
3490 if((k4-1) > 0) {
3491 if(verboseLevel > 3) {
3492 G4cout <<"G4Incl: (k4 - 1) > 0. Going to pnu830." << G4endl;
3493 }
3494 goto pnu830;
3495 }
3496
3497 // l1 est un delta:
3498 pnu830:
3499 if(verboseLevel > 3) {
3500 G4cout <<"G4Incl: Now at pnu830." << G4endl;
3501 }
3502
3503 if(bl9->l2 == 0) {
3504 goto pnu220;
3505 }
3506 // interaction pi(l1-ia)-nucleon(l2)
3507 if(bl9->l1 > ia) { // line 2916
3508 if(verboseLevel > 3) {
3509 G4cout <<"G4Incl: l1 > ia (line 2916)" << G4endl;
3510 }
3511 goto pnu801;
3512 }
3513 pnu803:
3514 // pas de collision entre 2 non participants:
3515 if(jparticip[bl9->l1] == 0 && jparticip[bl9->l2] == 0) {
3516 if(verboseLevel > 3) {
3517 G4cout <<"G4Incl: both particles are spectators. No collision. " << G4endl;
3518 }
3519 goto pnu44;
3520 }
3521
3522 // parameters for the next colliding pair
3523 // assert(isnan(energyTest(l1)) == false);
3524 // assert(isnan(energyTest(l2)) == false);
3525 t[9] = bl1->eps[bl9->l1] + bl1->eps[bl9->l2]; //t(10)->t[9]
3526 t0 = 1.0/t[9]; // t(10)->t[9]
3527 b1 = (bl1->p1[bl9->l1] + bl1->p1[bl9->l2])*t0;
3528 b2 = (bl1->p2[bl9->l1] + bl1->p2[bl9->l2])*t0;
3529 b3 = (bl1->p3[bl9->l1] + bl1->p3[bl9->l2])*t0;
3530 s = (1.0 - b1*b1 - b2*b2 - b3*b3)*t[9]*t[9]; //t(10)->t[9]
3531 sq = std::sqrt(s);
3532
3533 if(sq < 1925.5) {
3534 if(verboseLevel > 3) {
3535 G4cout <<"sq < 1925.5" << G4endl;
3536 G4cout <<"Particles: l1 = " << bl9->l1 << " l2 = " << bl9->l2 << G4endl;
3537 G4cout <<"eps[bl9->l1] = " << bl1->eps[bl9->l1] << " eps[bl9->l2] = " << bl1->eps[bl9->l2] << G4endl;
3538 G4cout <<"p1[bl9->l1] = " << bl1->p1[bl9->l1] << " p1[bl9->l2] = " << bl1->p1[bl9->l2] << G4endl;
3539 G4cout <<"p2[bl9->l1] = " << bl1->p2[bl9->l1] << " p2[bl9->l2] = " << bl1->p2[bl9->l2] << G4endl;
3540 G4cout <<"p3[bl9->l1] = " << bl1->p3[bl9->l1] << " p3[bl9->l2] = " << bl1->p3[bl9->l2] << G4endl;
3541 G4cout <<"sq = " << sq << G4endl;
3542 }
3543 goto pnu44;
3544 }
3545
3546 assert(bl1->eps[bl9->l1] != 0);
3547 bl1->ta = tau/bl1->eps[bl9->l1];
3548 x1l1 = bl3->x1[bl9->l1] + bl1->p1[bl9->l1]*(bl1->ta);
3549 x2l1 = bl3->x2[bl9->l1] + bl1->p2[bl9->l1]*(bl1->ta);
3550 x3l1 = bl3->x3[bl9->l1] + bl1->p3[bl9->l1]*(bl1->ta);
3551
3552 assert(bl1->eps[bl9->l2] != 0);
3553 bl1->ta = tau/bl1->eps[bl9->l2];
3554 x1l2 = bl3->x1[bl9->l2] + bl1->p1[bl9->l2]*(bl1->ta);
3555 x2l2 = bl3->x2[bl9->l2] + bl1->p2[bl9->l2]*(bl1->ta);
3556 x3l2 = bl3->x3[bl9->l2] + bl1->p3[bl9->l2]*(bl1->ta);
3557
3558 // test on the minimum distance of approach
3559 t[10] = x1l1 - x1l2; //t(11)->t[10]
3560 t[11] = x2l1 - x2l2; //t(12)->t[11]
3561 t[12] = x3l1 - x3l2; //t(13)->t[12]
3562 t[13] = t[10]*t[10] + t[11]*t[11] + t[12]*t[12]; //t(N)->t[N-1]
3563 t[14] = b1*t[10] + b2*t[11] + b3*t[12]; //t(N)->t[N-1]
3564 t[15] = b1*b1 + b2*b2 + b3*b3; //t(16)->t[15]
3565 bb2 = t[13] + t[14]*t[14]/(1.0 - t[15]); //t(N)->t[N-1]
3566
3567 if(verboseLevel > 3) {
3568 G4cout <<"Minimum dist. of approach tested..." << G4endl;
3569 }
3570
3571 // Replaced goto structure:
3572 // if (k3 == 1) go to 260
3573 // if (k4 == 0) go to 260
3574 mg=bl1->ind1[bl9->l1]+bl1->ind1[bl9->l2];
3575 if((k3 != 1) && (k4 != 0) && (mg == 1)) {
3576 isos=bl1->ind2[bl9->l1]+bl1->ind2[bl9->l2];
3577 // if (mg != 1) go to 260
3578 ldel = bl9->l2;
3579 if(mg-bl1->ind1[bl9->l1] == 0) {
3580 ldel = bl9->l1;
3581 }
3582 // assert(isnan(energyTest(ldel)) == false);
3583 bl6->xx10 = std::sqrt(std::pow(bl1->eps[ldel],2) - std::pow(bl1->p1[ldel],2) - std::pow(bl1->p2[ldel],2) - std::pow(bl1->p3[ldel],2));
3584 bl6->isa = bl1->ind2[ldel];
3585 // assert(isnan(sq) == false);
3586 // assert(isnan(mg) == false);
3587 // assert(isnan(isos) == false);
3588 bmax2 = totalCrossSection(sq,mg,isos)/31.415926;
3589 if (k5 == 0 && mg != 0) {
3590 bmax2 = bmax2 - lowEnergy(sq,mg,isos)/31.415926;
3591 }
3592 // go to 261
3593 }
3594 else {
3595 // assert(isnan(sq) == false);
3596 // assert(isnan(mg) == false);
3597 // assert(isnan(isos) == false);
3598 bmax2 = totalCrossSection(sq,mg,isos)/31.41592;
3599 }
3600
3601 if (bb2 < bmax2) {
3602 goto pnu220;
3603 }
3604 if (bl2->k == 0) {
3605 goto pnu230;
3606 }
3607
3608 if(verboseLevel > 3) {
3609 G4cout <<"bb2 >= bmax2 or bl2->k == 0" << G4endl;
3610 }
3611 goto pnu44;
3612 // loop while((bb2 >= bmax2) && (k != 0)) (PK)
3613 // evaluation of the positions at time = tim
3614 pnu220:
3615 timi = tim;
3616 if(verboseLevel > 3) {
3617 G4cout <<"Evaluating positions at time = tim" << G4endl;
3618 G4cout <<"tim = " << tim << G4endl;
3619 }
3620
3621// dumpSaxw(dumpOut);
3622// dumpBl1(dumpOut);
3623// dumpBl2(dumpOut);
3624// dumpBl3(dumpOut);
3625
3626 if(varavat->kveux == 1) { //then
3627 iavat = iavat + 1;
3628 varavat->timeavat[iavat] = tim;
3629 varavat->l1avat[iavat] = bl9->l1;
3630 varavat->l2avat[iavat] = bl9->l2;
3631 varavat->energyavat[iavat] = sq;
3632
3633 if(bl9->l1 <= ia) {
3634 varavat->jpartl1[iavat] = jparticip[bl9->l1];
3635 }
3636 else {
3637 varavat->jpartl1[iavat] = 0;
3638 }
3639
3640 if(bl9->l2 > 0) {
3641 varavat->jpartl2[iavat] = jparticip[bl9->l2];
3642 }
3643 else {
3644 varavat->jpartl2[iavat] = 0;
3645 }
3646 }
3647
3648 // gel des nucleons non participants sur le premier avatar (nn)=(l1,1)
3649 if (irst_avatar == 1) {
3650 for(G4int i = 1; i <= bl9->l1; i = i + bl9->l1 - 1) { // bugfix!
3651 assert(bl1->eps[i] != 0);
3652 // assert(isnan(energyTest(i)) == false);
3653 bl1->ta = tau/bl1->eps[i];
3654 bl3->x1[i] = bl3->x1[i] + bl1->p1[i]*(bl1->ta);
3655 bl3->x2[i] = bl3->x2[i] + bl1->p2[i]*(bl1->ta);
3656 bl3->x3[i] = bl3->x3[i] + bl1->p3[i]*(bl1->ta);
3657 if(verboseLevel > 3) {
3658 G4cout <<"G4Incl: i = " << G4endl;
3659 }
3660 }
3661 for(G4int i = 1; i <= bl2->k; i++) {
3662 bl2->crois[i] = bl2->crois[i] + tau;
3663 }
3664 }
3665 else {
3666 for(G4int i = 1; i <= ia; i++) {
3667 // assert(isnan(energyTest(i)) == false);
3668 assert(bl1->eps[i] != 0);
3669 bl1->ta = tau/bl1->eps[i];
3670 bl3->x1[i] = bl3->x1[i] + bl1->p1[i]*(bl1->ta);
3671 bl3->x2[i] = bl3->x2[i] + bl1->p2[i]*(bl1->ta);
3672 bl3->x3[i] = bl3->x3[i] + bl1->p3[i]*(bl1->ta);
3673 }
3674 }
3675
3676 // if(npion != 0) {
3677 if(npion > 0) {
3678 for(G4int i = 1; i <= npion; i++) {
3679 bl1->ta = tau/q4[i];
3680 y1[i] = y1[i] + q1[i]*(bl1->ta);
3681 y2[i] = y2[i] + q2[i]*(bl1->ta);
3682 y3[i] = y3[i] + q3[i]*(bl1->ta);
3683 }
3684 }
3685
3686 if(bl9->l2 == 0) {
3687 if(verboseLevel > 3) {
3688 G4cout <<"G4Incl: l2 == 0. Going to pnu805." << G4endl;
3689 }
3690 goto pnu805;
3691 }
3692 // Candidate: if(l2!=0)...
3693
3694 // reflexions sur le potentiel, sortie eventuelle de la particule:
3695 if (bl9->l2 == -1) {
3696 if(verboseLevel > 3) {
3697 G4cout <<"G4Incl: l2 == -1. Going to pnu600." << G4endl;
3698 }
3699 goto pnu600;
3700 }
3701
3702 if(bl9->l1 > ia) {
3703 if(verboseLevel > 3) {
3704 G4cout <<"G4Incl: l1 > ia. Going to pnu831." << G4endl;
3705 }
3706 goto pnu831;
3707 }
3708
3709 // collision of particles l1 and l2
3710 if(verboseLevel > 3) {
3711 G4cout <<"Particles l1 and l2 collide!" << G4endl;
3712 }
3713
3714 ich1 = bl1->ind1[bl9->l1];
3715 ich2 = bl1->ind1[bl9->l2];
3716 ich3 = bl1->ind2[bl9->l1];
3717 ich4 = bl1->ind2[bl9->l2];
3718 // assert(isnan(energyTest(l1)) == false);
3719 // assert(isnan(energyTest(l2)) == false);
3720 aml1 = std::sqrt(std::pow(bl1->eps[bl9->l1],2) - std::pow(bl1->p1[bl9->l1],2) - std::pow(bl1->p2[bl9->l1],2) - std::pow(bl1->p3[bl9->l1],2));
3721 aml2 = std::sqrt(std::pow(bl1->eps[bl9->l2],2) - std::pow(bl1->p1[bl9->l2],2) - std::pow(bl1->p2[bl9->l2],2) - std::pow(bl1->p3[bl9->l2],2));
3722 gl1 = bl1->eps[bl9->l1]/aml1;
3723 gl2 = bl1->eps[bl9->l2]/aml2;
3724 // l-conservation
3725 if (k6 == 1) {
3726 t[30] = (aml1*(bl3->x1[bl9->l1]) + aml2*(bl3->x1[bl9->l2]))/(aml1 + aml2); //t(31)->t[30]
3727 t[31] = (aml1*(bl3->x2[bl9->l1]) + aml2*(bl3->x2[bl9->l2]))/(aml1 + aml2); //t(32)->t[31]
3728 t[32] = (aml1*(bl3->x3[bl9->l1]) + aml2*(bl3->x3[bl9->l2]))/(aml1 + aml2); //t(33)->t[32]
3729 tt31 = bl3->x1[bl9->l1] - bl3->x1[bl9->l2];
3730 tt32 = bl3->x2[bl9->l1] - bl3->x2[bl9->l2];
3731 tt33 = bl3->x3[bl9->l1] - bl3->x3[bl9->l2];
3732 t[33] = (aml2*(bl1->p1[bl9->l1]) - aml1*(bl1->p1[bl9->l2]))/(aml1 + aml2); //t(34)->t[33]
3733 t[34] = (aml2*(bl1->p2[bl9->l1]) - aml1*(bl1->p2[bl9->l2]))/(aml1 + aml2); //t(35)->t[34]
3734 t[35] = (aml2*(bl1->p3[bl9->l1]) - aml1*(bl1->p3[bl9->l2]))/(aml1 + aml2); //t(36)->t[35]
3735 tt34 = bl1->p1[bl9->l1] + bl1->p1[bl9->l2];
3736 tt35 = bl1->p2[bl9->l1] + bl1->p2[bl9->l2];
3737 tt36 = bl1->p3[bl9->l1] + bl1->p3[bl9->l2];
3738 }
3739
3740 // l-conservation
3741 t[20] = bl1->p1[bl9->l1]; //t(21)->t[20]
3742 t[21] = bl1->p2[bl9->l1]; //t(22)->t[21]
3743 t[22] = bl1->p3[bl9->l1]; //t(23)->t[22]
3744 t[23] = bl1->eps[bl9->l1]; //t(24)->t[23]
3745 t[24] = bl1->p1[bl9->l2]; //t(25)->t[24]
3746 t[25] = bl1->p2[bl9->l2]; //t(26)->t[25]
3747 t[26] = bl1->p3[bl9->l2]; //t(27)->t[26]
3748 t[27] = bl1->eps[bl9->l2]; //t(28)->t[27]
3749
3750 // info delta ou nucleon:
3751 if(varavat->kveux == 1) {
3752 varavat->del1avat[iavat] = bl1->ind1[bl9->l1];
3753 varavat->del2avat[iavat] = bl1->ind1[bl9->l2];
3754 }
3755
3756 minus_b1 = -1.0*b1;
3757 minus_b2 = -1.0*b2;
3758 minus_b3 = -1.0*b3;
3759 loren(&(bl1->p1[bl9->l1]), &(bl1->p2[bl9->l1]), &(bl1->p3[bl9->l1]), &minus_b1, &minus_b2, &minus_b3, &(bl1->eps[bl9->l1]));
3760 loren(&(bl1->p1[bl9->l2]), &(bl1->p2[bl9->l2]), &(bl1->p3[bl9->l2]), &minus_b1, &minus_b2, &minus_b3, &(bl1->eps[bl9->l2]));
3761
3762 if(verboseLevel > 3) {
3763 G4cout <<"Calling collis..." << G4endl;
3764 G4cout <<"Energy eps[bl9->l1] = " << bl1->eps[bl9->l1] << G4endl;
3765 G4cout <<"Momentum: p1 = " << bl1->p1[bl9->l1] << " p2 = " << bl1->p2[bl9->l1] << " p3 = " << bl1->p3[bl9->l1] << G4endl;
3766 G4cout <<"Energy eps[bl9->l2] = " << bl1->eps[bl9->l2] << G4endl;
3767 G4cout <<"Momentum: p1 = " << bl1->p1[bl9->l2] << " p2 = " << bl1->p2[bl9->l2] << " p3 = " << bl1->p3[bl9->l2] << G4endl;
3768 }
3769 // assert(isnan(energyTest(l1)) == false);
3770 // assert(isnan(energyTest(l2)) == false);
3771// bl9->l1 = l1;
3772// bl9->l2 = l2;
3773 collis(&(bl1->p1[bl9->l1]), &(bl1->p2[bl9->l1]), &(bl1->p3[bl9->l1]),
3774 &(bl1->eps[bl9->l1]), &(bl1->p1[bl9->l2]), &(bl1->p2[bl9->l2]), &(bl1->p3[bl9->l2]), &(bl1->eps[bl9->l2]),
3775 &(t[11]), &(t[12]), &(t[13]), &(t[14]), &np, &ip, &k2, &k3, &k4, &k5,
3776 &(bl1->ind1[bl9->l1]), &(bl1->ind1[bl9->l2]), &(bl1->ind2[bl9->l1]), &(bl1->ind2[bl9->l2]));
3777// l1 = bl9->l1;
3778// l2 = bl9->l2;
3779 // assert(isnan(energyTest(l1)) == false);
3780 // assert(isnan(energyTest(l2)) == false);
3781 if(verboseLevel > 3) {
3782 G4cout <<"End of collis call" << G4endl;
3783 G4cout <<"Energy eps[bl9->l1] = " << bl1->eps[bl9->l1] << G4endl;
3784 G4cout <<"Energy eps[bl9->l2] = " << bl1->eps[bl9->l2] << G4endl;
3785 }
3786
3787 if(verboseLevel > 3) {
3788 G4cout <<"Variables after collis call: "<< G4endl;
3789 G4cout <<"bl1->p1[" << bl9->l1 <<"] = " << bl1->p1[bl9->l1] <<" bl1->p2[" << bl9->l1 <<"] = " << bl1->p2[bl9->l1] <<" bl1->p3[" << bl9->l1 <<"] = " << bl1->p3[bl9->l1] <<" bl1->eps[" << bl9->l1 <<"] = " << bl1->eps[bl9->l1] << G4endl;
3790 G4cout <<"bl1->p1[" << bl9->l2 <<"] = " << bl1->p1[bl9->l2] <<" bl2->p2[" << bl9->l2 <<"] = " << bl1->p2[bl9->l2] <<" bl2->p3[" << bl9->l2 <<"] = " << bl1->p3[bl9->l2] <<" bl1->eps[" << bl9->l2 <<"] = " << bl1->eps[bl9->l2] << G4endl;
3791 }
3792
3793 loren(&(bl1->p1[bl9->l1]), &(bl1->p2[bl9->l1]), &(bl1->p3[bl9->l1]), &b1, &b2, &b3, &(bl1->eps[bl9->l1]));
3794 loren(&(bl1->p1[bl9->l2]), &(bl1->p2[bl9->l2]), &(bl1->p3[bl9->l2]), &b1, &b2, &b3, &(bl1->eps[bl9->l2]));
3795
3796 if (bl1->ind1[bl9->l1] == 1) { // bugfix 1 -> 0
3797 goto pnu243;
3798 }
3799 xbl1 = pauliBlocking(bl9->l1, rbl, pbl);
3800 standardRandom(&rndm,&(hazard->igraine[10]));
3801 if (rndm > (1.0 - xbl1)) {
3802 goto pnu248;
3803 }
3804 pnu243:
3805 if (bl1->ind1[bl9->l2] == 1) { // bugfix 1 -> 0
3806 goto pnu241;
3807 }
3808 xbl2 = pauliBlocking(bl9->l2, rbl, pbl);
3809 standardRandom(&rndm,&(hazard->igraine[10]));
3810 if (rndm > (1.0 - xbl2)) {
3811 goto pnu248;
3812 }
3813 goto pnu241;
3814 pnu248:
3815 if(verboseLevel > 3) {
3816 G4cout <<"Pauli blocked transition!" << G4endl;
3817 }
3818
3819 mpaul1 = mpaul1 + 1;
3820 if(varavat->kveux == 1) {
3821 varavat->bloc_paul[iavat] = 1;
3822 }
3823 // restitution de l1 et l2 si rejet de la col. par pauli:
3824 // assert(isnan(energyTest(l1)) == false);
3825 // assert(isnan(energyTest(l2)) == false);
3826 bl1->p1[bl9->l1] = t[20]; //t(21)->t[20]
3827 bl1->p2[bl9->l1] = t[21]; //t(22)->t[21]
3828 bl1->p3[bl9->l1] = t[22]; //t(23)->t[22]
3829 bl1->eps[bl9->l1] = t[23]; //t(24)->t[23]
3830 bl1->p1[bl9->l2] = t[24]; //t(25)->t[24]
3831 bl1->p2[bl9->l2] = t[25]; //t(26)->t[25]
3832 bl1->p3[bl9->l2] = t[26]; //t(27)->t[26]
3833 bl1->eps[bl9->l2] = t[27]; //t(28)->t[27]
3834 bl1->ind1[bl9->l1] = ich1;
3835 bl1->ind1[bl9->l2] = ich2;
3836 bl1->ind2[bl9->l1] = ich3;
3837 bl1->ind2[bl9->l2] = ich4;
3838 // assert(isnan(energyTest(l1)) == false);
3839 // assert(isnan(energyTest(l2)) == false);
3840
3841 if (bl2->k == 0) {
3842 goto pnu230;
3843 }
3844 for(G4int i = 1; i <= bl2->k; i++) {
3845 bl2->crois[i] = bl2->crois[i] - tau;
3846 }
3847
3848 // pour le temps de calcul (a.b. 02/2002)
3849 if(verboseLevel > 3) {
3850 G4cout <<"G4Incl: bl2->k != 0" << G4endl;
3851 }
3852 goto pnu44;
3853
3854 pnu241:
3855
3856 // la premiere collision a deux corps ne peut pas baisser l'energie
3857 // du nucleon de recul (bloque par pauli dans un noyau cible froid).
3858 // (ici, toujours l2 < l1)
3859 ncol_2c = ncol_2c + 1;
3860 if(ncol_2c == 1) {
3861 for (G4int icomp = 1; icomp <= bl3->ia1; icomp++) {
3862 // test on the first collision modified 4/07/2001 for direct and exchange.
3863 if(icomp == bl9->l1 || icomp == bl9->l2) {
3864 xavant = min(t[23],t[27]); //t(24)->t[23], t(28)->t[27]
3865 xapres = min(bl1->eps[bl9->l1],bl1->eps[bl9->l2]);
3866 if(xapres <= xavant) {
3867 if(varavat->kveux == 1) {
3868 varavat->bloc_cdpp[iavat] = 1;
3869 }
3870 goto pnu248;
3871 }
3872 }
3873 }
3874
3875 // pour le ntuple des avatars:
3876 if(varavat->kveux == 1) { //then
3877 varavat->r1_first_avat[0] = bl3->x1[1]; //(N)->[N-1]
3878 varavat->r1_first_avat[1] = bl3->x2[1]; //(N)->[N-1]
3879 varavat->r1_first_avat[2] = bl3->x3[1]; //(N)->[N-1]
3880 } //endif
3881 }
3882 else {
3883 // les collisions suivantes ne penvent conduire a un noyau de a nucleons
3884 // sous l'energie de fermi et dans une config. d'energie inferieure a
3885 // efer-(ia2-nbalttf)*tf).
3886 egs = 0.0;
3887 nbalttf = 0;
3888 // for(G4int i = 1; i <= ia-1; i++) {
3889 for(G4int i = 1; i <= ia; i++) {
3890 if(bl5->nesc[i] == 0) {
3891 if(std::sqrt(std::pow(bl1->p1[i],2)+std::pow(bl1->p2[i],2)+std::pow(bl1->p3[i],2)) < bl10->pf) {
3892 nbalttf = nbalttf + 1;
3893 egs = egs + bl1->eps[i] - fmp;
3894 }
3895 }
3896 }
3897
3898 if(egs < (efer-(bl3->ia2-nbalttf)*tf)) {
3899 if(varavat->kveux == 1) {
3900 varavat->bloc_cdpp[iavat] = 1;
3901 }
3902 goto pnu248;
3903 }
3904 }
3905
3906 if(varavat->kveux == 1) {
3907 varavat->bloc_cdpp[iavat] = 0;
3908 varavat->bloc_paul[iavat] = 0;
3909 }
3910
3911 jparticip[bl9->l1] = 1;
3912 jparticip[bl9->l2] = 1;
3913 if(verboseLevel > 3) {
3914 G4cout <<"Particle " << bl9->l1 << " is now participant." << G4endl;
3915 G4cout <<"Particle " << bl9->l2 << " is now participant." << G4endl;
3916 }
3917
3918 if (ws->nosurf <= 0) {
3919 // surface
3920 pppp = std::sqrt(std::pow(bl1->p1[bl9->l1],2) + std::pow(bl1->p2[bl9->l1],2) + std::pow(bl1->p3[bl9->l1],2));
3921 rrrr = std::sqrt(std::pow(bl3->x1[bl9->l1],2) + std::pow(bl3->x2[bl9->l1],2) + std::pow(bl3->x3[bl9->l1],2));
3922 if (pppp <= bl10->pf) {
3923 xv = pppp/bl10->pf;
3924 rcorr = interpolateFunction(xv);
3925 if (rrrr > rcorr) {
3926 bl3->x1[bl9->l1] = bl3->x1[bl9->l1]*rcorr/rrrr;
3927 bl3->x2[bl9->l1] = bl3->x2[bl9->l1]*rcorr/rrrr;
3928 bl3->x3[bl9->l1] = bl3->x3[bl9->l1]*rcorr/rrrr;
3929 }
3930 }
3931 pppp = std::sqrt(std::pow(bl1->p1[bl9->l2],2) + std::pow(bl1->p2[bl9->l2],2) + std::pow(bl1->p3[bl9->l2],2));
3932 rrrr = std::sqrt(std::pow(bl3->x1[bl9->l2],2) + std::pow(bl3->x2[bl9->l2],2) + std::pow(bl3->x3[bl9->l2],2));
3933 if (pppp <= bl10->pf) {
3934 xv = pppp/bl10->pf;
3935 rcorr = interpolateFunction(xv);
3936 if (rrrr > rcorr) {
3937 bl3->x1[bl9->l2] = bl3->x1[bl9->l2]*rcorr/rrrr;
3938 bl3->x2[bl9->l2] = bl3->x2[bl9->l2]*rcorr/rrrr;
3939 bl3->x3[bl9->l2] = bl3->x3[bl9->l2]*rcorr/rrrr;
3940 }
3941 }
3942 }
3943
3944 if (np == 0) {
3945 goto pnu240;
3946 }
3947
3948 npion = npion + 1;
3949 loren(&(t[11]), &(t[12]), &(t[13]), &b1, &b2, &b3, &(t[14])); //t(N)->t[N-1]
3950 q1[npion] = t[11]; //t(12)->t[11]
3951 q2[npion] = t[12]; //t(13)->t[12]
3952 q3[npion] = t[13]; //t(14)->t[13]
3953 q4[npion] = t[14]; //t(15)->t[14]
3954 pnu240:
3955 ncol = ncol + 1;
3956 if (bl9->l2 != 1) {
3957 goto pnu870;
3958 }
3959
3960 // critere pour la leading particle: avant impulsion longitudinale max l=1
3961 // change en fevrier 2002: leading part. = energie totale max (l=1)
3962 if (bl1->p3[bl9->l2] > bl1->p3[bl9->l1]) {
3963 goto pnu870;
3964 }
3965
3966 // attention, il faut mieux faire et selectionner la plus grande energie
3967 // des particules participantes (jparticip()=1) et dans le noyau (nesc()=0)!
3968
3969 xr1 = bl1->p1[bl9->l1];
3970 xr2 = bl1->p2[bl9->l1];
3971 xr3 = bl1->p3[bl9->l1];
3972 xr4 = bl1->eps[bl9->l1];
3973 xr5 = bl3->x1[bl9->l1];
3974 xr6 = bl3->x2[bl9->l1];
3975 xr7 = bl3->x3[bl9->l1];
3976 xr8 = gl1;
3977 ixr1 = bl1->ind1[bl9->l1];
3978 ixr2 = bl1->ind2[bl9->l1];
3979 ixr3 = ich1;
3980 bl1->p1[bl9->l1] = bl1->p1[bl9->l2];
3981 bl1->p2[bl9->l1] = bl1->p2[bl9->l2];
3982 bl1->p3[bl9->l1] = bl1->p3[bl9->l2];
3983 bl1->eps[bl9->l1] = bl1->eps[bl9->l2];
3984 // assert(isnan(energyTest(l1)) == false);
3985
3986 bl3->x1[bl9->l1] = bl3->x1[bl9->l2];
3987 bl3->x2[bl9->l1] = bl3->x2[bl9->l2];
3988 bl3->x3[bl9->l1] = bl3->x3[bl9->l2];
3989 gl1 = gl2;
3990 bl1->ind1[bl9->l1] = bl1->ind1[bl9->l2];
3991 bl1->ind2[bl9->l1] = bl1->ind2[bl9->l2];
3992 ich1 = ich2;
3993 bl1->p1[bl9->l2] = xr1;
3994 bl1->p2[bl9->l2] = xr2;
3995 bl1->p3[bl9->l2] = xr3;
3996 bl1->eps[bl9->l2] = xr4;
3997 // assert(isnan(energyTest(l2)) == false);
3998
3999 bl3->x1[bl9->l2] = xr5;
4000 bl3->x2[bl9->l2] = xr6;
4001 bl3->x3[bl9->l2] = xr7;
4002 gl2 = xr8;
4003 bl1->ind1[bl9->l2] = ixr1;
4004 bl1->ind2[bl9->l2] = ixr2;
4005 ich2 = ixr3;
4006
4007 if(ich1 + ich2 - bl1->ind1[bl9->l1] - bl1->ind1[bl9->l2] != 0 || (ich1 + ich2) != 1) {
4008 goto pnu870;
4009 }
4010 if (bl2->k == 0) {
4011 goto pnu870;
4012 }
4013
4014 for(G4int i = 1; i <= bl2->k; i++) {
4015 if((bl2->ind[i] != 1) || (bl2->jnd[i] != 0)) {
4016 if((bl2->ind[i] != bl9->l1) || (bl2->jnd[i] != 0)) {
4017 continue;
4018 }
4019 bl2->ind[i] = 1;
4020 break;
4021 }
4022
4023 bl2->ind[i] = bl9->l1;
4024 break;
4025 }
4026
4027 pnu870:
4028 bl5->tlg[bl9->l1] = th*(bl1->eps[bl9->l1])/std::sqrt(std::pow(bl1->eps[bl9->l1],2)-std::pow(bl1->p1[bl9->l1],2)-std::pow(bl1->p2[bl9->l1],2)-std::pow(bl1->p3[bl9->l1],2));
4029 bl5->tlg[bl9->l2] = th*(bl1->eps[bl9->l2])/std::sqrt(std::pow(bl1->eps[bl9->l2],2)-std::pow(bl1->p1[bl9->l2],2)-std::pow(bl1->p2[bl9->l2],2)-std::pow(bl1->p3[bl9->l2],2));
4030 nc[bl9->l1] = nc[bl9->l1] + 1;
4031 nc[bl9->l2] = nc[bl9->l2] + 1;
4032 led = 0;
4033
4034 if((ich1+ich2-bl1->ind1[bl9->l1]-bl1->ind1[bl9->l2]) < 0) {
4035 mrnd = mrnd + 1;
4036 }
4037 if((ich1+ich2-bl1->ind1[bl9->l1]-bl1->ind1[bl9->l2]) == 0) {
4038 if((ich1+ich2-1) < 0) {
4039 mrnn = mrnn + 1;
4040 }
4041 if((ich1+ich2-1) == 0) {
4042 mrdd = mrdd + 1;
4043 led = 1;
4044 }
4045 if((ich1+ich2-1) == 0) {
4046 mcdd = mcdd + 1;
4047 led = 1;
4048 }
4049 }
4050 if((ich1+ich2-bl1->ind1[bl9->l1]-bl1->ind1[bl9->l2]) > 0) {
4051 mrdn = mrdn + 1;
4052 }
4053
4054
4055 // reevaluation of the times t(a,b) for (a or b)=(l1 or l2)
4056
4057 // l-conservation
4058 if (k6 == 1) {
4059 aml1 = am(bl1->p1[bl9->l1],bl1->p2[bl9->l1],bl1->p3[bl9->l1],bl1->eps[bl9->l1]);
4060 aml2 = am(bl1->p1[bl9->l2],bl1->p2[bl9->l2],bl1->p3[bl9->l2],bl1->eps[bl9->l2]);
4061 // assert(isnan(aml1) == false);
4062 // assert(isnan(aml2) == false);
4063
4064 t[36] = (aml2*(bl1->p1[bl9->l1]) - aml1*(bl1->p1[bl9->l2]))/(aml1+aml2); //t(37)->t[36]
4065 t[37] = (aml2*(bl1->p2[bl9->l1]) - aml1*(bl1->p2[bl9->l2]))/(aml1+aml2); //t(38)->t[37]
4066 t[38] = (aml2*(bl1->p3[bl9->l1]) - aml1*(bl1->p3[bl9->l2]))/(aml1+aml2); //t(39)->t[38]
4067 t[39] = std::sqrt(t[33]*t[33] + t[34]*t[34] + t[35]*t[35]); //t(N)->t[N-1]
4068 t[40] = std::sqrt(t[36]*t[36] + t[37]*t[37] + t[38]*t[38]); //t(N)->t[N-1]
4069 rhopi = tt31*t[33] + tt32*t[34] + tt33*t[35]; //t(N)->t[N-1]
4070 t[42] = tt31 - rhopi*t[33]/std::pow(t[39],2); //t(N)->t[N-1]
4071 t[43] = tt32 - rhopi*t[34]/std::pow(t[39],2); //t(N)->t[N-1]
4072 t[44] = tt33 - rhopi*t[35]/std::pow(t[39],2); //t(N)->t[N-1]
4073 t[45] = std::sqrt(t[42]*t[42] + t[43]*t[43] + t[44]*t[44]); //t(N)->t[N-1]
4074 t[42] = t[42]/t[45]; //t(N)->t[N-1]
4075 t[43] = t[43]/t[45]; //t(N)->t[N-1]
4076 t[45] = t[45]/t[46];
4077 cif = (t[33]*t[36] + t[34]*t[37] + t[35]*t[38])/t[39]/t[40]; //t(N)->t[N-1]
4078
4079 // trouble with forward scattering 22/3/95
4080 if(std::fabs(cif) > 1.) {
4081 cif = sign(1.0,cif);
4082 }
4083 sif = std::sqrt(1.0 - cif*cif);
4084 t[36] = (t[33]*cif/t[39] + t[42]*sif)*t[40]; //t(N)->t[N-1]
4085 t[37] = (t[34]*cif/t[39] + t[43]*sif)*t[40]; //t(N)->t[N-1]
4086 t[38] = (t[35]*cif/t[39] + t[44]*sif)*t[40]; //t(N)->t[N-1]
4087 tri = std::sqrt(tt31*tt31 + tt32*tt32 + tt33*tt33);
4088 cchi = rhopi/tri/t[39]; //t(40)->t[39]
4089 schi = std::sqrt(1.0 - cchi*cchi);
4090 c1 = cif*cchi - sif*schi;
4091 c2 = sif*cchi + cif*schi;
4092 tt31 = (c1*t[33]/t[39] + c2*t[42])*tri*t[39]/t[40]; //t(N)->t[N-1]
4093 tt32 = (c1*t[34]/t[39] + c2*t[43])*tri*t[39]/t[40]; //t(N)->t[N-1]
4094 tt33 = (c1*t[35]/t[39] + c2*t[44])*tri*t[39]/t[40]; //t(N)->t[N-1]
4095 bl3->x1[bl9->l1] = t[30] + aml2*tt31/(aml1 + aml2); //t(31)->t[30]
4096 bl3->x2[bl9->l1] = t[31] + aml2*tt32/(aml1 + aml2); //t(32)->t[30]
4097 bl3->x3[bl9->l1] = t[32] + aml2*tt33/(aml1 + aml2); //t(33)->t[32]
4098 bl3->x1[bl9->l2] = t[30] - aml1*tt31/(aml1 + aml2); //t(31)->t[30]
4099 bl3->x2[bl9->l2] = t[31] - aml1*tt32/(aml1 + aml2); //t(32)->t[31]
4100 bl3->x3[bl9->l2] = t[32] - aml1*tt33/(aml1 + aml2); //t(33)->t[32]
4101 bl1->p1[bl9->l1] = aml1*tt34/(aml1 + aml2) + t[36]; //t(37)->t[36]
4102 bl1->p2[bl9->l1] = aml1*tt35/(aml1 + aml2) + t[37]; //t(38)->t[37]
4103 bl1->p3[bl9->l1] = aml1*tt36/(aml1 + aml2) + t[38]; //t(39)->t[38]
4104 bl1->eps[bl9->l1] = w(bl1->p1[bl9->l1],bl1->p2[bl9->l1],bl1->p3[bl9->l1],aml1);
4105 // assert(isnan(energyTest(l1)) == false);
4106 bl1->p1[bl9->l2] = aml2*tt34/(aml1 + aml2) - t[36]; //t(37)->t[36]
4107 bl1->p2[bl9->l2] = aml2*tt35/(aml1 + aml2) - t[37]; //t(38)->t[37]
4108 bl1->p3[bl9->l2] = aml2*tt36/(aml1 + aml2) - t[38]; //t(39)->t[38]
4109 bl1->eps[bl9->l2] = w(bl1->p1[bl9->l2],bl1->p2[bl9->l2],bl1->p3[bl9->l2],aml2);
4110 // assert(isnan(energyTest(l2)) == false);
4111 }
4112 // l-conservation
4113
4114 if(bl2->k != 0) {
4115 kd = 0;
4116 ccr = tau;
4117// for(G4int i = 1; i <= bl2->k; i++) {
4118// i20 = i - kd;
4119// if (k4 != 2 || led != 1) {
4120// if((bl2->ind[i] == l1) || (bl2->ind[i] == l2) || (bl2->jnd[i] == l1) || (bl2->jnd[i] == l2)) {
4121// kd = kd + 1;
4122// continue;
4123// }
4124// }
4125// else {
4126// if(bl2->jnd[i] == 0) {
4127// if (bl2->ind[i] == l1 && bl1->ind1[l1] == 1) {
4128// bl2->crois[i]=(bl2->crois[i]-ccr)*(bl1->eps[l1])/std::sqrt(std::pow(bl1->eps[l1],2)-std::pow(bl1->p1[l1],2)-std::pow(bl1->p2[l1],2)-std::pow(bl1->p3[l1],2))/gl1+ccr;
4129// }
4130// if (bl2->ind[i] == l2 && bl1->ind1[l2] == 1) {
4131// bl2->crois[i]=(bl2->crois[i]-ccr)*(bl1->eps[l2])/std::sqrt(std::pow(bl1->eps[l2],2)-std::pow(bl1->p1[l2],2)-std::pow(bl1->p2[l2],2)-std::pow(bl1->p3[l2],2))/gl2+ccr;
4132// }
4133// }
4134// }
4135
4136// bl2->crois[i20]=bl2->crois[i]-ccr;
4137// bl2->ind[i20]=bl2->ind[i];
4138// bl2->jnd[i20]=bl2->jnd[i];
4139// }
4140
4141 for(G4int i = 1; i <= bl2->k; i++) { //do 50 i=1,k p-n09070
4142 i20 = i - kd;
4143 if(k4 != 2 || led != 1) { //if (k4.ne.2.or.led.ne.1) go to 512 p-n09090
4144 goto pnu512;
4145 }
4146 if(bl2->jnd[i] == 0) {//if (jnd(i).eq.0) go to 511 p-n09100
4147 goto pnu511;
4148 }
4149 pnu512:
4150 if(bl2->ind[i] == bl9->l1) {//if (ind(i).eq.l1) go to 52 p-n09120
4151 goto pnu52;
4152
4153 }
4154 if(bl2->ind[i] == bl9->l2) {//if (ind(i).eq.l2) go to 52 p-n09130
4155 goto pnu52;
4156 }
4157 if(bl2->jnd[i] == bl9->l2) {//if (jnd(i).eq.l2) go to 52 p-n09140
4158 goto pnu52;
4159 }
4160 if(bl2->jnd[i] == bl9->l1) {//if (jnd(i).eq.l1) go to 52 p-n09150
4161 goto pnu52;
4162 }
4163 goto pnu513;
4164 pnu511:
4165 //if (ind(i).eq.l1.and.ind1(l1).eq.1) crois(i)=(crois(i)-ccr)*eps(l1p-n09170
4166 //-)/std::sqrt(eps(l1)**2-p1(l1)**2-p2(l1)**2-p3(l1)**2)/gl1+ccr p-n09180
4167 if(bl2->ind[i] == bl9->l1 && bl1->ind1[bl9->l1] == 1) {
4168 bl2->crois[i]=(bl2->crois[i]-ccr)*bl1->eps[bl9->l1]/std::sqrt(std::pow(bl1->eps[bl9->l1],2)-std::pow(bl1->p1[bl9->l1],2)-std::pow(bl1->p2[bl9->l1],2)-std::pow(bl1->p3[bl9->l1],2))/gl1+ccr;
4169 }
4170 //if (ind(i).eq.l2.and.ind1(l2).eq.1) crois(i)=(crois(i)-ccr)*eps(l2p-n09190
4171 //-)/std::sqrt(eps(l2)**2-p1(l2)**2-p2(l2)**2-p3(l2)**2)/gl2+ccr p-n09200
4172 if(bl2->ind[i] == bl9->l2 && bl1->ind1[bl9->l2] == 1) {
4173 bl2->crois[i]=(bl2->crois[i]-ccr)*bl1->eps[bl9->l2]/std::sqrt(std::pow(bl1->eps[bl9->l2],2)-std::pow(bl1->p1[bl9->l2],2)-std::pow(bl1->p2[bl9->l2],2)-std::pow(bl1->p3[bl9->l2],2))/gl1+ccr;
4174 }
4175 pnu513:
4176 bl2->crois[i20]=bl2->crois[i]-ccr;
4177 bl2->ind[i20]=bl2->ind[i];
4178 bl2->jnd[i20]=bl2->jnd[i];
4179 continue; // goto pnu50
4180 pnu52:
4181 kd=kd+1;
4182 }
4183
4184 bl2->k = bl2->k - kd;
4185 }
4186
4187 newt(bl9->l1,bl9->l2);
4188
4189 tref=ref(bl3->x1[bl9->l1], bl3->x2[bl9->l1], bl3->x3[bl9->l1], bl1->p1[bl9->l1], bl1->p2[bl9->l1], bl1->p3[bl9->l1], bl1->eps[bl9->l1],r22); // line 3502
4190 // assert(isnan(tref) == false);
4191
4192 if(verboseLevel > 3) {
4193 if(tref < 0.0) {
4194 G4cout <<"G4Incl: Reflection time < 0! (line 3502)" << G4endl;
4195 }
4196 }
4197
4198 if(tref <= bl4->tmax5) {
4199 bl2->k = bl2->k + 1;
4200 bl2->crois[bl2->k] = tref;
4201 bl2->ind[bl2->k] = bl9->l1;
4202 bl2->jnd[bl2->k] = -1;
4203 }
4204
4205 tref=ref(bl3->x1[bl9->l2], bl3->x2[bl9->l2], bl3->x3[bl9->l2], bl1->p1[bl9->l2], bl1->p2[bl9->l2], bl1->p3[bl9->l2], bl1->eps[bl9->l2],r22); // line 3516
4206 // assert(isnan(tref) == false);
4207
4208 if(verboseLevel > 3) {
4209 if(tref < 0.0) {
4210 G4cout <<"G4Incl: Reflection time < 0! (line 3516)" << G4endl;
4211 }
4212 }
4213
4214 if(tref <= bl4->tmax5) {
4215 bl2->k = bl2->k + 1;
4216 bl2->crois[bl2->k] = tref;
4217 bl2->ind[bl2->k] = bl9->l2;
4218 bl2->jnd[bl2->k] = -1;
4219 }
4220
4221 if (k4 == 2) {
4222 goto pnu848;
4223 }
4224
4225 if(bl2->k < 0) {
4226 goto pnu230;
4227 }
4228 if(bl2->k == 0) {
4229 goto pnu230;
4230 }
4231 if(bl2->k > 0) {
4232 if(verboseLevel > 3) {
4233 G4cout <<"G4Incl: bl2->k > 0 at line 3488. Going back to label pnu449." << G4endl;
4234 }
4235 goto pnu449;
4236 }
4237
4238 pnu848:
4239 if (npion == 0) {
4240 goto pnu844;
4241 }
4242 if (bl1->ind1[bl9->l1] == 1) {
4243 goto pnu843;
4244 }
4245 for(G4int k20 = 1; k20 <= npion; k20++) {
4246 if(verboseLevel > 3) {
4247 G4cout <<"G4Incl: calling G4Incl::new3" << G4endl;
4248 }
4249 new3((y1[k20]), (y2[k20]), (y3[k20]), (q1[k20]), (q2[k20]), (q3[k20]), (q4[k20]), k20, bl9->l1);
4250 if(verboseLevel > 3) {
4251 G4cout <<"G4Incl: After new3:" << G4endl;
4252 G4cout <<"y1[" << k20 << "] = " << y1[k20] <<" y2[" << k20 << "] = " << y2[k20] <<" y3[" << k20 << "] = " << y3[k20] << G4endl;
4253 G4cout <<"q1[" << k20 << "] = " << q1[k20] <<" q2[" << k20 << "] = " << q2[k20] <<" q3[" << k20 << "] = " << q3[k20] << G4endl;
4254 }
4255 }
4256
4257 pnu843:
4258 if(bl1->ind1[bl9->l2] != 1) {
4259 for(G4int k20 = 1; k20 <= npion; k20++) {
4260 //new3(y1[k20], y2[k20], y3[k20], q1[k20], q2[k20], q3[k20], q4[k20], -k20, l2);
4261 new3(y1[k20], y2[k20], y3[k20], q1[k20], q2[k20], q3[k20], q4[k20], k20, bl9->l2);
4262 }
4263 }
4264 pnu844:
4265
4266 if(bl1->ind1[bl9->l1]+bl1->ind1[bl9->l2] <= ich1+ich2) {
4267 goto pnu849;
4268 }
4269 if(bl1->ind1[bl9->l1]-ich1 != 1) {
4270 goto pnu820;
4271 }
4272 lnew = bl9->l1;
4273 goto pnu821;
4274 pnu820:
4275 if(bl1->ind1[bl9->l2]-ich2 != 1) {
4276 goto pnu849;
4277 }
4278 lnew = bl9->l2;
4279
4280 pnu821:
4281 standardRandom(&rndm,&(hazard->igraine[16]));
4282 // largeur variable du delta (phase space factor G4introduced 4/2001)
4283 amlnew = std::sqrt(std::pow(bl1->eps[lnew],2)-std::pow(bl1->p1[lnew],2)-std::pow(bl1->p2[lnew],2)-std::pow(bl1->p3[lnew],2));
4284 // assert(isnan(amlnew) == false);
4285
4286 geff = bl1->eps[lnew]/amlnew;
4287 qqq = std::sqrt((std::pow(amlnew,2) - std::pow((fmp+fmpi),2))*(std::pow(amlnew,2) - std::pow((fmp-fmpi),2)))/(2.0*amlnew);
4288 // assert(isnan(qqq) == false);
4289
4290 psf = std::pow(qqq,3)/(std::pow(qqq,3) + 5832000.0);
4291 tdel = -hc/(g0*psf)*std::log(rndm)*geff;
4292 // assert(isnan(tdel) == false);
4293
4294 if(tdel <= bl4->tmax5) {
4295 bl2->k = bl2->k + 1;
4296 bl2->crois[bl2->k] = tdel;
4297 bl2->ind[bl2->k] = lnew;
4298 bl2->jnd[bl2->k] = 0;
4299 }
4300
4301 pnu849:
4302 if (bl2->k == 0) {
4303 goto pnu230;
4304 }
4305 if(verboseLevel > 3) {
4306 G4cout <<"G4Incl: bl2->k != 0. Going back to label pnu449." << G4endl;
4307 }
4308 goto pnu449;
4309
4310 // decay of the delta particle p-n09780
4311 pnu805:
4312 npion = npion + 1;
4313 ichd = bl1->ind2[bl9->l1];
4314 t[30] = bl1->p1[bl9->l1]; //t(31)->t[30]
4315 t[31] = bl1->p2[bl9->l1]; //t(32)->t[31]
4316 t[32] = bl1->p3[bl9->l1]; //t(33)->t[32]
4317 t[33] = bl1->eps[bl9->l1]; //t(34)->t[33]
4318 var_ab = std::pow(bl1->eps[bl9->l1],2) - std::pow(bl1->p1[bl9->l1],2) - std::pow(bl1->p2[bl9->l1],2) - std::pow(bl1->p3[bl9->l1],2);
4319 assert(var_ab > 0);
4320 ym[npion] = 0.0;
4321
4322 if(var_ab > 0.0) {
4323 ym[npion] = std::sqrt(var_ab);
4324 }
4325
4326 //PK: This workaround avoids a NaN problem encountered with
4327 //geant4. The problem does not seem to exist if we run in standalone
4328 //mode.
4329 // if(((std::pow(ym[npion],2)-std::pow(fmp+fmpi,2))*(std::pow(ym[npion],2)-std::pow(fmp-fmpi,2))) < 0) {
4330 // ym[npion] = ym[npion]+fmpi+100.0;
4331 // }
4332 // PK
4333 // assert(isnan(ym[npion]) == false);
4334 assert(ym[npion] != 0);
4335 // assert(isnan(pcm(ym[npion], fmp, fmpi)) == false);
4336 if(varavat->kveux == 1) {
4337 varavat->del1avat[iavat] = bl1->ind1[bl9->l1];
4338 varavat->energyavat[iavat] = ym[npion];
4339 }
4340
4341 if(verboseLevel > 3) {
4342 G4cout <<"Calling decay2 from pnu" << G4endl;
4343 G4cout <<"npion = " << npion << G4endl;
4344 G4cout <<"q1 = " << q1[npion] << " q2 = " << q2[npion] << " q3 = " << q3[npion] << " q4 = " << q4[npion] << G4endl;
4345 }
4346 assert(ym[npion] != 0);
4347 decay2(&(bl1->p1[bl9->l1]), &(bl1->p2[bl9->l1]), &(bl1->p3[bl9->l1]), &(bl1->eps[bl9->l1]), &(q1[npion]), &(q2[npion]), &(q3[npion]),
4348 &(q4[npion]), &(ym[npion]), &fmp, &fmpi, &(bl9->hel[bl9->l1]));
4349
4350 if(verboseLevel > 3) {
4351 G4cout <<"Quantities after decay2: " << G4endl;
4352 G4cout <<"l1 = " << bl9->l1 << " bl1->p1[l1] = " << bl1->p1[bl9->l1] << " bl1->p2[l1] = " << bl1->p2[bl9->l1] << " bl1->p3[l1] = " << bl1->p3[bl9->l1] << " bl1->eps[l1] = " << bl1->eps[bl9->l1] << G4endl;
4353 }
4354
4355 // decay
4356 if (bl1->ind2[bl9->l1]*(bl1->ind2[bl9->l1]) == 9) {
4357 goto pnu806;
4358 }
4359
4360 standardRandom(&rndm, &(hazard->ial));
4361 if (rndm < 0.333333333) {
4362 goto pnu837;
4363 }
4364
4365 ipi[npion]=0;
4366 goto pnu809;
4367
4368 pnu837:
4369 ipi[npion]=bl1->ind2[bl9->l1]*2;
4370 bl1->ind2[bl9->l1]=-1*(bl1->ind2[bl9->l1]);
4371 goto pnu809;
4372 pnu806:
4373 bl1->ind2[bl9->l1]=bl1->ind2[bl9->l1]/3;
4374 ipi[npion]=2*(bl1->ind2[bl9->l1]);
4375 pnu809: // continue
4376 bl1->ind1[bl9->l1]=0;
4377 bl5->tlg[bl9->l1]=0.;
4378
4379 // escape ?
4380 if (bl5->nesc[bl9->l1] > 0) {
4381 goto pnu850;
4382 }
4383
4384 iteste = 0;
4385 xpb = pauliBlocking(bl9->l1, rbl, pbl);
4386 standardRandom(&rndm,&(hazard->igraine[10]));
4387
4388 // pauli blocking?
4389 if (rndm <= xpb) {
4390 goto pnu1848;
4391 }
4392 // le decay ne peut conduire a un noyau de a nucleons
4393 // sous l'energie de fermi et dans une config. d'energie inferieure a
4394 // c efer-(ia2-nbalttf)*tf).
4395 egs = 0.0;
4396 nbalttf = 0;
4397 iteste = 1;
4398 for(G4int i = 1; i <= ia; i++) {
4399 if(bl5->nesc[i] == 0) {
4400 if(std::sqrt(std::pow(bl1->p1[i],2)+std::pow(bl1->p2[i],2)+std::pow(bl1->p3[i],2)) < bl10->pf) {
4401 nbalttf = nbalttf + 1;
4402 egs = egs + bl1->eps[i] - fmp;
4403 }
4404 }
4405 }
4406 if(egs >= (efer-(bl3->ia2-nbalttf)*tf)) {
4407 goto pnu850;
4408 }
4409
4410 // attention, logique negative!!! liberer le goto si on veut supprimer la
4411 // sequence precedente (cdpp sur delta-> pi n)
4412
4413 if(varavat->kveux == 1) {
4414 varavat->bloc_cdpp[iavat] = 1;
4415 }
4416
4417 // it is blocked!
4418 pnu1848:
4419 mpaul2 = mpaul2 + 1;
4420 if(varavat->kveux == 1) {
4421 varavat->bloc_paul[iavat] = 1;
4422 }
4423
4424 // largeur variable du delta (phase space factor G4introduced 4/2001)
4425 // (180.**3 = 5832000.)
4426 qqq = std::sqrt((std::pow(ym[npion],2) - std::pow((fmp+fmpi),2))*(std::pow(ym[npion],2) - std::pow((fmp-fmpi),2)))/(2.*ym[npion]);
4427 psf = std::pow(qqq,3)/(std::pow(qqq,3)+5832000.0);
4428 tdel = hc*t[33]/(g0*psf*ym[npion]); //t(34)->t[33]
4429
4430 if (iteste == 0) {
4431 tdel = tdel*xpb/(1.000001-xpb);
4432 }
4433
4434 if(tdel <= bl4->tmax5) {
4435 bl2->k = bl2->k + 1;
4436 bl2->crois[bl2->k] = tdel;
4437 bl2->ind[bl2->k] = bl9->l1;
4438 bl2->jnd[bl2->k] = 0;
4439 }
4440
4441 bl1->p1[bl9->l1] = t[30]; //t(31)->t[30]
4442 bl1->p2[bl9->l1] = t[31]; //t(32)->t[31]
4443 bl1->p3[bl9->l1] = t[32]; //t(33)->t[32]
4444 bl1->eps[bl9->l1] = t[33]; //t(34)->t[33]
4445 bl1->ind1[bl9->l1] = 1;
4446 bl1->ind2[bl9->l1] = ichd;
4447 npion = npion - 1;
4448
4449 if (bl2->k == 0) {
4450 goto pnu230;
4451 }
4452
4453 for(G4int i = 1; i <= bl2->k; i++) {
4454 bl2->crois[i] = bl2->crois[i] - tau;
4455 }
4456
4457 if(verboseLevel > 3) {
4458 G4cout <<"G4Incl: Going back to label pnu449 after a loop from 1 to bl2->k" << G4endl;
4459 }
4460 goto pnu449;
4461
4462 // valid decay of the delta
4463 pnu850:
4464 if(varavat->kveux == 1) {
4465 varavat->bloc_paul[iavat] = 0;
4466 varavat->bloc_cdpp[iavat] = 0;
4467 }
4468
4469 if (ws->nosurf <= 0) {
4470 // surface
4471 pppp = std::sqrt(std::pow(bl1->p1[bl9->l1],2) + std::pow(bl1->p2[bl9->l1],2) + std::pow(bl1->p3[bl9->l1],2));
4472 rrrr = std::sqrt(std::pow(bl3->x1[bl9->l1],2) + std::pow(bl3->x2[bl9->l1],2) + std::pow(bl3->x3[bl9->l1],2));
4473 if (pppp <= bl10->pf) {
4474 xv = pppp/bl10->pf;
4475 rcorr = interpolateFunction(xv);
4476 if (rrrr > rcorr) {
4477 bl3->x1[bl9->l1] = bl3->x1[bl9->l1]*rcorr/rrrr;
4478 bl3->x2[bl9->l1] = bl3->x2[bl9->l1]*rcorr/rrrr;
4479 bl3->x3[bl9->l1] = bl3->x3[bl9->l1]*rcorr/rrrr;
4480 }
4481 }
4482 }
4483
4484 ncol = ncol + 1;
4485 mrdp = mrdp + 1;
4486 y1[npion] = bl3->x1[bl9->l1];
4487 y2[npion] = bl3->x2[bl9->l1];
4488 y3[npion] = bl3->x3[bl9->l1];
4489
4490 if (bl2->k == 0) {
4491 goto pnu4047;
4492 }
4493
4494 kd = 0;
4495 ccr = tau;
4496 for(G4int i = 1; i <= bl2->k; i++) {
4497 i20 = i - kd;
4498
4499 if((bl2->ind[i] == bl9->l1) || (bl2->jnd[i] == bl9->l1)) {
4500 kd = kd + 1;
4501 }
4502 else {
4503 bl2->crois[i20] = bl2->crois[i] - ccr;
4504 bl2->ind[i20] = bl2->ind[i];
4505 bl2->jnd[i20] = bl2->jnd[i];
4506 }
4507 }
4508 bl2->k = bl2->k - kd;
4509
4510 pnu4047:
4511 if (bl5->nesc[bl9->l1] != 0) {
4512 goto pnu845;
4513 }
4514
4515 new1(bl9->l1);
4516 bl2->k = bl2->k + 1;
4517 bl2->crois[bl2->k] = ref(bl3->x1[bl9->l1], bl3->x2[bl9->l1], bl3->x3[bl9->l1], bl1->p1[bl9->l1], bl1->p2[bl9->l1], bl1->p3[bl9->l1], bl1->eps[bl9->l1],r22);
4518 bl2->ind[bl2->k] = bl9->l1;
4519 bl2->jnd[bl2->k] = -1;
4520 if(verboseLevel > 3) {
4521 if(bl2->crois[bl2->k] < 0.0) {
4522 G4cout <<"G4Incl: Reflection time < 0! (line 3797)" << G4endl;
4523 }
4524 }
4525
4526
4527 if(npion > 1) {
4528 n20 = npion - 1;
4529 for(G4int k20 = 1; k20 <= n20; k20++) {
4530 new3(y1[k20], y2[k20], y3[k20], q1[k20], q2[k20], q3[k20], q4[k20], k20, bl9->l1);
4531 }
4532 }
4533
4534 pnu845:
4535 new2(y1[npion], y2[npion], y3[npion], q1[npion], q2[npion], q3[npion], q4[npion], npion, bl9->l1);
4536 if(bl2->k == 0) {
4537 goto pnu230;
4538 }
4539
4540 if(verboseLevel > 3) {
4541 G4cout <<"G4Incl: bl2->k == 0 after a call to new2. Going back to label pnu449." << G4endl;
4542 }
4543 goto pnu449;
4544
4545 // pion-nucleon collision
4546 pnu801:
4547 if(verboseLevel > 3) {
4548 G4cout <<"Pion-nucleon collision!" << G4endl;
4549 }
4550 lp = bl9->l1 - ia;
4551 dis1 = bl3->x1[bl9->l2]-y1[lp] + (bl1->p1[bl9->l2]/bl1->eps[bl9->l2] - q1[lp]/q4[lp])*tau;
4552 dis2 = bl3->x2[bl9->l2]-y2[lp] + (bl1->p2[bl9->l2]/bl1->eps[bl9->l2] - q2[lp]/q4[lp])*tau;
4553 dis3 = bl3->x3[bl9->l2]-y3[lp] + (bl1->p3[bl9->l2]/bl1->eps[bl9->l2] - q3[lp]/q4[lp])*tau;
4554 dist = dis1*dis1 + dis2*dis2 + dis3*dis3;
4555 t[9] = bl1->eps[bl9->l2] + q4[lp]; //t(10)->t[9]
4556 t0 = 1.0/t[9]; //t(10)->t[9]
4557 b1 = (bl1->p1[bl9->l2] + q1[lp])*t0;
4558 b2 = (bl1->p2[bl9->l2] + q2[lp])*t0;
4559 b3 = (bl1->p3[bl9->l2] + q3[lp])*t0;
4560 s = (1.0 - b1*b1 - b2*b2 - b3*b3)*t[9]*t[9]; //t(10)->t[9]
4561 sq = std::sqrt(s);
4562 cg = 4+bl1->ind2[bl9->l2]*ipi[lp];
4563
4564 if(verboseLevel > 3) {
4565 G4cout <<"Pion-Nucleon collision done! " << G4endl;
4566 }
4567
4568 if(sq > 3000.0) {
4569 if(verboseLevel > 3) {
4570 G4cout <<"sq = " << sq << G4endl;
4571 }
4572 goto pnu832;
4573 }
4574 if(31.41592*dist > pionNucleonCrossSection(sq)*cg/6.0) {
4575 goto pnu832;
4576 }
4577
4578 if(verboseLevel > 3) {
4579 G4cout <<"Going to pnu220!" << G4endl;
4580 }
4581
4582 goto pnu220;
4583
4584 pnu832:
4585 if (bl2->k == 0) {
4586 goto pnu230;
4587 }
4588
4589 if(verboseLevel > 3) {
4590 G4cout <<"G4Incl: bl2->k != 0. Going back to pnu44." << G4endl;
4591 }
4592 goto pnu44;
4593 pnu831:
4594 standardRandom(&rndm, &(hazard->igraine[18]));
4595 geff = t[9]/sq; //t(10)->t[9]
4596 gg = g0;
4597 if (sq > 1500.0) {
4598 gg=200.0;
4599 }
4600
4601 // largeur variable du delta (phase space factor G4introduced 4/2001)
4602 // (180.**3 = 5832000.)
4603 qqq = std::sqrt((std::pow(sq,2) - std::pow((fmp+fmpi),2))*(std::pow(sq,2) - std::pow((fmp-fmpi),2)))/(2.0*sq);
4604 psf = std::pow(qqq,3)/(std::pow(qqq,3)+5832000.);
4605 tdel = -hc/(gg*psf)*std::log(rndm)*geff;
4606
4607 bl1->ind1[bl9->l2] = 1;
4608 bl1->ind2[bl9->l2] = bl1->ind2[bl9->l2] + ipi[lp];
4609 nc[bl9->l2] = nc[bl9->l2] + 1;
4610 bl1->eps[bl9->l2] = t[9]; //t(10)->t[9]
4611 bl1->p1[bl9->l2] = bl1->p1[bl9->l2] + q1[lp];
4612 bl1->p2[bl9->l2] = bl1->p2[bl9->l2] + q2[lp];
4613 bl1->p3[bl9->l2] = bl1->p3[bl9->l2] + q3[lp];
4614
4615 // ce nucleon (ici delta) devient un participant:
4616 jparticip[bl9->l2] = 1;
4617 if(verboseLevel > 3) {
4618 G4cout <<"Particle " << bl9->l2 << " is now participant." << G4endl;
4619 }
4620
4621 if (ws->nosurf <= 0) {
4622 // surface
4623 pppp = std::sqrt(std::pow(bl1->p1[bl9->l2],2) + std::pow(bl1->p2[bl9->l2],2) + std::pow(bl1->p3[bl9->l2],2));
4624 rrrr = std::sqrt(std::pow(bl3->x1[bl9->l2],2) + std::pow(bl3->x2[bl9->l2],2) + std::pow(bl3->x3[bl9->l2],2));
4625 if (pppp <= bl10->pf) {
4626 xv = pppp/bl10->pf;
4627 rcorr = interpolateFunction(xv);
4628 if (rrrr > rcorr) {
4629 bl3->x1[bl9->l2] = bl3->x1[bl9->l2]*rcorr/rrrr;
4630 bl3->x2[bl9->l2] = bl3->x2[bl9->l2]*rcorr/rrrr;
4631 bl3->x3[bl9->l2] = bl3->x3[bl9->l2]*rcorr/rrrr;
4632 }
4633 }
4634 // fin surface
4635 }
4636
4637 // difference with standard cascade :
4638 // the delta is located at the nucleon site to avoid problems
4639 // with the reflexion on the wall
4640 if(lp != npion) {
4641 lp1 = lp + 1;
4642 // for(G4int i10 = lp1; i10 <= npion; lp1++) {
4643 for(G4int i10 = lp1; i10 <= npion; i10++) {
4644 ipi[i10-1] = ipi[i10];
4645 ym[i10-1] = ym[i10];
4646 q1[i10-1] = q1[i10];
4647 q2[i10-1] = q2[i10];
4648 q3[i10-1] = q3[i10];
4649 q4[i10-1] = q4[i10];
4650 y1[i10-1] = y1[i10];
4651 y2[i10-1] = y2[i10];
4652 y3[i10-1] = y3[i10];
4653 }
4654 }
4655 npion = npion-1;
4656 ncol = ncol+1;
4657 mrpd = mrpd+1;
4658
4659 if(bl2->k != 0) {
4660 kd = 0;
4661 ccr = tau;
4662 for(G4int i = 1; i <= bl2->k; i++) {
4663 i20 = i - kd;
4664 if((bl2->ind[i] == bl9->l1) || (bl2->ind[i] == bl9->l2) || (bl2->jnd[i] == bl9->l1) || (bl2->jnd[i] == bl9->l2)) {
4665 kd = kd + 1;
4666 }
4667 else {
4668 bl2->crois[i20] = bl2->crois[i] - ccr;
4669 bl2->ind[i20] = bl2->ind[i];
4670 bl2->jnd[i20] = bl2->jnd[i];
4671 }
4672 }
4673
4674 bl2->k = bl2->k - kd;
4675 for(G4int i10 = 1; i10 <= bl2->k; i10++) {
4676 if(bl2->ind[i10] <= bl9->l1) {
4677 continue;
4678 }
4679 else {
4680 bl2->ind[i10] = bl2->ind[i10] - 1;
4681 }
4682 }
4683 }
4684
4685 new1(bl9->l2);
4686
4687 if(tdel <= bl4->tmax5) {
4688 bl2->k = bl2->k + 1;
4689 bl2->crois[bl2->k] = tdel;
4690 bl2->ind[bl2->k] = bl9->l2;
4691 bl2->jnd[bl2->k] = 0;
4692 }
4693
4694 bl2->k = bl2->k + 1;
4695 bl2->crois[bl2->k] = ref(bl3->x1[bl9->l2], bl3->x2[bl9->l2], bl3->x3[bl9->l2], bl1->p1[bl9->l2], bl1->p2[bl9->l2], bl1->p3[bl9->l2], bl1->eps[bl9->l2],r22);
4696 if(verboseLevel > 3) {
4697 if(bl2->crois[bl2->k] < 0.0) {
4698 G4cout <<"G4Incl: Reflection time < 0! (line 3955)" << G4endl;
4699 }
4700 }
4701 bl2->ind[bl2->k] = bl9->l2;
4702 bl2->jnd[bl2->k] = -1;
4703
4704 if(verboseLevel > 3) {
4705 G4cout <<"G4Incl: Going back to pnu449 at line 3917." << G4endl;
4706 }
4707 goto pnu449; // Line 3917
4708
4709 // reflection on or transmission through the potential wall
4710 pnu600:
4711 // deutons pas bien compris ici cv ?
4712 if (npproj[bl9->l1] == 0) {
4713 if(verboseLevel > 3) {
4714 G4cout <<"G4Incl: npproj[l1] == 0. Going to pnu608." << G4endl;
4715 }
4716 goto pnu608;
4717 }
4718
4719 if (bl1->ind1[bl9->l1] != 0) {
4720 if(verboseLevel > 3) {
4721 G4cout <<"wrong reentering particle (ind1[l1] != 0)" << G4endl;
4722 G4cout <<"ind1[" << bl9->l1 << "] = " << bl1->ind1[bl9->l1] << G4endl;
4723 }
4724 }
4725
4726 if (bl3->x1[bl9->l1]*(bl1->p1[bl9->l1])+bl3->x2[bl9->l1]*(bl1->p2[bl9->l1])+bl3->x3[bl9->l1]*(bl1->p3[bl9->l1]) > 0.0) {
4727 if(verboseLevel > 3) {
4728 G4cout <<"wrong reentering particle" << G4endl;
4729 G4cout <<"particle: l1 = " << bl9->l1 << G4endl;
4730 }
4731 }
4732
4733 var_ab = std::pow(bl1->p1[bl9->l1],2) + std::pow(bl1->p2[bl9->l1],2) + std::pow(bl1->p3[bl9->l1],2);
4734 assert(var_ab > 0);
4735 gpsg = 0.0;
4736 if (var_ab > 0.0) {
4737 gpsg = std::sqrt((std::pow(bl1->eps[bl9->l1]+v0,2)-pm2)/var_ab);
4738 }
4739
4740 bl1->p1[bl9->l1] = gpsg*(bl1->p1[bl9->l1]);
4741 bl1->p2[bl9->l1] = gpsg*(bl1->p2[bl9->l1]);
4742 bl1->p3[bl9->l1] = gpsg*(bl1->p3[bl9->l1]);
4743 bl1->eps[bl9->l1] = bl1->eps[bl9->l1] + v0;
4744 npproj[bl9->l1] = 0;
4745 bl5->nesc[bl9->l1] = 0;
4746
4747 // reevaluation of the times tab after entrance of 2nd,..nucleon
4748 // of the projectile (goto 602 instead of 607 modif. 13/06/01)
4749 goto pnu602;
4750
4751 // deutons
4752 // pour un non participant la transmission est impossible:
4753 pnu608:
4754 if(varavat->kveux == 1) {
4755 varavat->del1avat[iavat] = bl1->ind1[bl9->l1];
4756 varavat->energyavat[iavat] = bl1->eps[bl9->l1] - fmp;
4757 }
4758 if(jparticip[bl9->l1] == 0) {
4759 if(verboseLevel > 3) {
4760 G4cout <<"G4Incl: jparticip[l1] == 0. Going to pnu601." << G4endl;
4761 }
4762 goto pnu601;
4763 }
4764 if(varavat->kveux == 1) {
4765 varavat->go_out[iavat]=1;
4766 }
4767 if (bl1->ind1[bl9->l1] == 0) {
4768 goto pnu605;
4769 }
4770 fm = am(bl1->p1[bl9->l1],bl1->p2[bl9->l1],bl1->p3[bl9->l1],bl1->eps[bl9->l1]);
4771 pot = v1;
4772 goto pnu606;
4773
4774 pnu605:
4775 fm = fmp;
4776 pot = v0;
4777
4778 pnu606:
4779 if(verboseLevel > 3) {
4780 G4cout <<"G4Incl: Now at pnu606. Calculating transmission probability." << G4endl;
4781 }
4782 tp = transmissionProb(bl1->eps[bl9->l1]-fm,bl1->ind2[bl9->l1],itch,bl3->r2,v0);
4783 if(varavat->kveux == 1) {
4784 varavat->energyavat[iavat] = bl1->eps[bl9->l1] - fm;
4785 }
4786 standardRandom(&rndm,&(hazard->igraine[10]));
4787
4788 if (rndm > tp) {
4789 if(verboseLevel > 3) {
4790 G4cout <<"G4Incl:" << G4endl;
4791 }
4792 goto pnu601;
4793 }
4794
4795 // ici la particule l1 s'échappe du noyau:
4796 bl5->nesc[bl9->l1] = 1;
4797 nbquit = nbquit + 1;
4798 itch = itch - (1 + bl1->ind2[bl9->l1])/2;
4799 var_ab = std::pow(bl1->p1[bl9->l1],2) + std::pow(bl1->p2[bl9->l1],2) + std::pow(bl1->p3[bl9->l1],2);
4800 assert(var_ab > 0);
4801 gpsg = 0.0;
4802 if(var_ab > 0.0) {
4803 gpsg = std::sqrt((std::pow(bl1->eps[bl9->l1]-pot,2) - fm*fm)/(var_ab));
4804 }
4805 bl1->p1[bl9->l1] = gpsg*(bl1->p1[bl9->l1]);
4806 bl1->p2[bl9->l1] = gpsg*(bl1->p2[bl9->l1]);
4807 bl1->p3[bl9->l1] = gpsg*(bl1->p3[bl9->l1]);
4808 bl1->eps[bl9->l1] = bl1->eps[bl9->l1] - pot;
4809
4810 // comptage des particules hors du noyau (7/6/2002):
4811 // (remnant minimum=1 nucleon)
4812 if(nbquit >= (ia-1)) {
4813 if(verboseLevel > 3) {
4814 G4cout <<"G4Incl: nbquit >= (ia - 1). Going to pnu255." << G4endl;
4815 }
4816 goto pnu255;
4817 }
4818
4819 if(verboseLevel > 3) {
4820 G4cout <<"G4Incl: Going to pnu 602." << G4endl;
4821 }
4822 goto pnu602;
4823
4824 // here no transmission possible
4825 pnu601:
4826 pspr=bl3->x1[bl9->l1]*(bl1->p1[bl9->l1])+bl3->x2[bl9->l1]*(bl1->p2[bl9->l1])+bl3->x3[bl9->l1]*(bl1->p3[bl9->l1]);
4827 if(varavat->kveux == 1) {
4828 varavat->go_out[iavat]=0;
4829 }
4830
4831 // surface: modif a.b. pour tenir compte du rayon variable du noyau.
4832 // (x2cour remplace r22 le rayon**2 fixe du noyau)
4833 x2cour = std::pow(bl3->x1[bl9->l1],2) + std::pow(bl3->x2[bl9->l1],2) + std::pow(bl3->x3[bl9->l1],2);
4834 bl1->p1[bl9->l1] = bl1->p1[bl9->l1] - 2.0*(bl3->x1[bl9->l1])*pspr/x2cour;
4835 bl1->p2[bl9->l1] = bl1->p2[bl9->l1] - 2.0*(bl3->x2[bl9->l1])*pspr/x2cour;
4836 bl1->p3[bl9->l1] = bl1->p3[bl9->l1] - 2.0*(bl3->x3[bl9->l1])*pspr/x2cour;
4837 // fin modif surface a.b.
4838
4839 pnu602:
4840 if(verboseLevel > 3) {
4841 G4cout <<"G4Incl: Now at pnu602." << G4endl;
4842 }
4843
4844 if(bl2->k != 0) {
4845 kd = 0;
4846 ccr = tau;
4847 for(G4int i = 1; i <= bl2->k; i++) {
4848 i20 = i - kd;
4849
4850 if((bl2->jnd[i] == bl9->l1) || ((bl2->ind[i] == bl9->l1) && (bl2->jnd[i] != 0))) {
4851 kd = kd + 1;
4852 continue;
4853 }
4854
4855 bl2->crois[i20] = bl2->crois[i] - ccr;
4856 bl2->ind[i20] = bl2->ind[i];
4857 bl2->jnd[i20] = bl2->jnd[i];
4858 }
4859 bl2->k = bl2->k - kd;
4860
4861 if (bl5->nesc[bl9->l1] == 1) {
4862 goto pnu613;
4863 }
4864 }
4865
4866 if(verboseLevel > 3) {
4867 G4cout <<"G4Incl: Now calling new1(l1) (new1(" << bl9->l1 << "))" << G4endl;
4868 }
4869 new1(bl9->l1);
4870
4871 if(verboseLevel > 3) {
4872 G4cout <<"G4Incl: Now calling ref." << G4endl;
4873 G4cout <<"x1 = " << bl3->x1[bl9->l1] <<" x2 = " << bl3->x2[bl9->l1] <<" x3 = " << bl3->x3[bl9->l1] << G4endl;
4874 G4cout <<"p1 = " << bl1->p1[bl9->l1] <<" p2 = " << bl1->p2[bl9->l1] <<" p3 = " << bl1->p3[bl9->l1] <<" eps = " << bl1->eps[bl9->l1] << G4endl;
4875 }
4876 tref = ref(bl3->x1[bl9->l1],bl3->x2[bl9->l1],bl3->x3[bl9->l1],bl1->p1[bl9->l1],bl1->p2[bl9->l1],bl1->p3[bl9->l1],bl1->eps[bl9->l1],r22); // line 4101
4877 if(verboseLevel > 3) {
4878 G4cout <<"Returned from function ref. tref = " << tref << G4endl;
4879 }
4880
4881 if(verboseLevel > 3) {
4882 if(tref < 0.0) {
4883 G4cout <<"G4Incl: Reflection time < 0 (line 4101)!" << G4endl;
4884 G4cout <<"G4Incl: bl1->eps[" << bl9->l1 << "] = " << bl1->eps[bl9->l1] << G4endl;
4885 }
4886 }
4887
4888 if (tref > bl4->tmax5) {
4889 goto pnu615;
4890 }
4891 bl2->k = bl2->k + 1;
4892 bl2->crois[bl2->k] = tref;
4893 bl2->ind[bl2->k] = bl9->l1;
4894 bl2->jnd[bl2->k] = -1;
4895
4896 pnu615:
4897 if(verboseLevel > 3) {
4898 G4cout <<"G4Incl: Now at pnu615." << G4endl;
4899 }
4900
4901 if (npion == 0) {
4902 goto pnu613;
4903 }
4904 if (bl1->ind1[bl9->l1] == 1) {
4905 goto pnu613;
4906 }
4907 for(G4int k20 = 1; k20 <= npion; k20++) { //do 614 k20=1,npion
4908 new3(y1[k20], y2[k20], y3[k20], q1[k20], q2[k20], q3[k20], q4[k20], k20, bl9->l1);
4909 }
4910 pnu613:
4911 if(verboseLevel > 3) {
4912 G4cout <<"G4Incl: Now at pnu613." << G4endl;
4913 }
4914
4915 if (bl2->k == 0) {
4916 goto pnu230;
4917 }
4918
4919 if(verboseLevel > 3) {
4920 G4cout <<"G4Incl. bl2->k != 0. Going back to pnu449 from line 4077." << G4endl;
4921 G4cout <<"G4Incl: bl2->k = " << bl2->k << G4endl;
4922 for(G4int myindex = 0; myindex <= bl2->k; myindex++) {
4923 G4cout <<"index = " << myindex << " ind = " << bl2->ind[myindex] << " jnd = " << bl2->jnd[myindex] << " crois = " << bl2->crois[myindex] << G4endl;
4924 if(bl2->crois[myindex] < 0.0) {
4925 G4cout <<"Negative time!!! Dumping information on collision: " << G4endl;
4926 G4int part1 = bl2->ind[myindex];
4927 G4int part2 = bl2->jnd[myindex];
4928 G4cout <<"particle 1 index = " << bl2->ind[myindex] << " \t particle 2 index = " << bl2->jnd[myindex] << G4endl;
4929 if(part1 >= 0) {
4930 G4cout <<"Particle 1: " << G4endl;
4931 G4cout <<"p1 = " << bl1->p1[part1] <<"p2 = " << bl1->p2[part1] <<"p3 = " << bl1->p3[part1] <<" eps = " << bl1->eps[part1] << G4endl;
4932 G4cout <<"x1 = " << bl3->x1[part1] <<"x2 = " << bl3->x2[part1] <<"x3 = " << bl3->x3[part1] << G4endl;
4933 }
4934 if(part2 >= 0) {
4935 G4cout <<"Particle 2: " << G4endl;
4936 G4cout <<"p1 = " << bl1->p1[part2] <<"p2 = " << bl1->p2[part2] <<"p3 = " << bl1->p3[part2] <<" eps = " << bl1->eps[part2] << G4endl;
4937 G4cout <<"x1 = " << bl3->x1[part2] <<"x2 = " << bl3->x2[part2] <<"x3 = " << bl3->x3[part2] << G4endl;
4938 }
4939 }
4940 }
4941 }
4942
4943 goto pnu449; // Line 4077
4944
4945 // decay of the surviving deltas
4946 pnu230:
4947 if(verboseLevel > 3) {
4948 G4cout <<"G4Incl: Now at pnu230." << G4endl;
4949 }
4950 // decay of the surviving deltas
4951pnu255:
4952 if(verboseLevel > 3) {
4953 G4cout <<"G4Incl: Now at pnu6255." << G4endl;
4954 }
4955
4956 if (k3 == 1) {
4957 goto pnu256;
4958 }
4959 if (k4 == 0) {
4960 goto pnu256;
4961 }
4962
4963 npidir = npion;
4964 for(G4int i = 1; i <= ia; i++) {
4965 if (bl1->ind1[i] == 0) {
4966 continue;
4967 }
4968 npion = npion + 1;
4969 var_ab = std::pow(bl1->eps[i],2) - std::pow(bl1->p1[i],2) - std::pow(bl1->p2[i],2) - std::pow(bl1->p3[i],2);
4970 assert(var_ab > 0);
4971 ym[npion] = 0.0;
4972
4973 if(var_ab > 0.0) {
4974 ym[npion] = std::sqrt(var_ab);
4975 }
4976 xy1 = bl1->p1[i];
4977 xy2 = bl1->p2[i];
4978 xy3 = bl1->p3[i];
4979 xye = bl1->eps[i];
4980 if(varavat->kveux == 1) {
4981 iavat = iavat + 1;
4982 varavat->timeavat[iavat] = tim;
4983 varavat->l1avat[iavat] = i;
4984 varavat->l2avat[iavat] = -2;
4985 varavat->energyavat[iavat] = ym[npion];
4986 varavat->bloc_paul[iavat] = 0;
4987 varavat->bloc_cdpp[iavat] = 0;
4988 varavat->del1avat[iavat] = bl1->ind1[bl9->l1];
4989 varavat->jpartl1[iavat] = 1;
4990 varavat->jpartl2[iavat] = 0;
4991 }
4992
4993 decay2(&(bl1->p1[i]), &(bl1->p2[i]), &(bl1->p3[i]), &(bl1->eps[i]), &(q1[npion]), &(q2[npion]), &(q3[npion]),
4994 &(q4[npion]), &(ym[npion]), &fmp, &fmpi, &(bl9->hel[i]));
4995
4996 if(verboseLevel > 3) {
4997 G4cout <<"Quantities after decay2: " << G4endl;
4998 G4cout <<"i = " << i << " bl1->p1[i] = " << bl1->p1[i] << " bl1->p2[i] = " << bl1->p2[i] << " bl1->p3[i] = " << bl1->p3[i] << " bl1->eps[i] = " << bl1->eps[i] << G4endl;
4999 }
5000
5001 if(bl5->nesc[i] == 0) {
5002 idecf = 1;
5003 }
5004
5005 if (ws->nosurf <= 0) {
5006 // surface
5007 if (bl5->nesc[i] == 0.0) {
5008 pppp = std::sqrt(std::pow(bl1->p1[i],2) + std::pow(bl1->p2[i],2) + std::pow(bl1->p3[i],2));
5009 rrrr = std::sqrt(std::pow(bl3->x1[i],2) + std::pow(bl3->x2[i],2) + std::pow(bl3->x3[i],2));
5010 if (pppp <= bl10->pf) {
5011 xv = pppp/bl10->pf;
5012 rcorr = interpolateFunction(xv);
5013 if (rrrr > rcorr) { //then
5014 bl3->x1[i] = bl3->x1[i]*rcorr/rrrr;
5015 bl3->x2[i] = bl3->x2[i]*rcorr/rrrr;
5016 bl3->x3[i] = bl3->x3[i]*rcorr/rrrr;
5017 }
5018 }
5019 }
5020 // fin surface
5021 }
5022
5023 if (bl1->ind2[i]*(bl1->ind2[i]) == 9) {
5024 goto pnu280;
5025 }
5026
5027 standardRandom(&rndm, &(hazard->ial));
5028
5029 if (rndm*3. < 1.0) {
5030 goto pnu283;
5031 }
5032 ipi[npion] = 0;
5033 goto pnu285;
5034
5035 pnu283:
5036 if(verboseLevel > 3) {
5037 G4cout <<"G4Incl: Now at pnu283." << G4endl;
5038 }
5039
5040 ipi[npion] = bl1->ind2[i]*2;
5041 bl1->ind2[i] = -1*(bl1->ind2[i]);
5042 goto pnu285;
5043
5044 pnu280:
5045 if(verboseLevel > 3) {
5046 G4cout <<"G4Incl: Now at pnu280." << G4endl;
5047 }
5048
5049 bl1->ind2[i] = bl1->ind2[i]/3;
5050 ipi[npion] = 2*(bl1->ind2[i]);
5051
5052 pnu285:
5053 if(verboseLevel > 3) {
5054 G4cout <<"G4Incl: Now at pnu285." << G4endl;
5055 }
5056
5057 y1[npion] = bl3->x1[i];
5058 y2[npion] = bl3->x2[i];
5059 y3[npion] = bl3->x3[i];
5060 }
5061
5062 if(verboseLevel > 3) {
5063 G4cout <<"out of the loop..." << G4endl;
5064 }
5065
5066 if(varavat->kveux == 1) {
5067 varavat->bavat = b;
5068 varavat->nopartavat = nopart;
5069 varavat->ncolavat = ncol;
5070 varavat->nb_avat = iavat;
5071 }
5072
5073 // final properties of the incoming nucleon and of the remnant
5074 // before evaporation
5075
5076 // tableau des energies a la fin (avatar.hbk)
5077 if(varavat->kveux == 1) {
5078 for(G4int i = 1; i <= ia; i++) {
5079 if(bl5->nesc[i] == 0) {
5080 if(jparticip[i] == 1) {
5081 varavat->epsf[i] = bl1->eps[i];
5082 }
5083 else {
5084 varavat->epsf[i] = 0.0;
5085 }
5086 }
5087 else {
5088 varavat->epsf[i] = 0.0;
5089 }
5090 }
5091 }
5092
5093 pnu256:
5094 if(verboseLevel > 3) {
5095 G4cout <<"G4Incl: Now at pnu256." << G4endl;
5096 }
5097
5098 elead = 0.0;
5099 lead = 0;
5100 npx = 0;
5101 erem = 0.;
5102 izrem = 0;
5103 inrem = 0;
5104 iarem = 0;
5105 rcm1 = 0.0;
5106 rcm2 = 0.0;
5107 rcm3 = 0.0;
5108 prem1 = 0.0;
5109 prem2 = 0.0;
5110 prem3 = 0.0;
5111 pout1 = 0.0;
5112 pout2 = 0.0;
5113 pout3 = 0.0;
5114 eout = 0.0;
5115 cmultn = 0.0;
5116
5117 if (kindstruct->kindf7 <= 2) {
5118 if (ncol == 0 || nc[1] == 0) { // then nc(1)->nc[0]
5119 if(verboseLevel > 3) {
5120 G4cout <<"no collisioms" << G4endl;
5121 }
5122 goto pnu9100;
5123 }
5124 }
5125 else {
5126 if (kindstruct->kindf7 <= 5) {
5127 if (ncol == 0) {
5128 if(verboseLevel > 3) {
5129 G4cout <<"no collisioms" << G4endl;
5130 }
5131 goto pnu9100;
5132 }
5133 }
5134 else {
5135 // ici faisceau composite: modif a.b. 2/2002 pour tous les composites:
5136 nsum_col = 0;
5137 for(G4int i = 1; i <= bl3->ia1; i++) {
5138 nsum_col = nsum_col + nc[i];
5139 }
5140 if (ncol == 0 || nsum_col == 0) { //then
5141 goto pnu9100;
5142 }
5143 }
5144 }
5145
5146 goto pnu9101;
5147 // pour eviter renvoi des resultats du run precedent cv 20/11/98
5148 pnu9100:
5149 iarem = bl3->ia2;
5150 izrem = iz2;
5151 esrem = 0.0;
5152 erecrem = 0.0;
5153 nopart = -1;
5154 // fin ajout cv
5155 if(verboseLevel > 3) {
5156 G4cout <<"End of algorithm after pnu9100." << G4endl;
5157 }
5158 goto pnureturn;
5159
5160 pnu9101:
5161 if(verboseLevel > 3) {
5162 G4cout <<"G4Incl: Now at pnu9101." << G4endl;
5163 }
5164
5165 nopart = 0;
5166 ekout = 0.0;
5167
5168 for(G4int i = 1; i <= ia; i++) {
5169 if(bl5->nesc[i] != 0) {
5170 xl1 = xl1-bl3->x2[i]*(bl1->p3[i]) + (bl3->x3[i])*(bl1->p2[i]);
5171 xl2 = xl2-bl3->x3[i]*(bl1->p1[i]) + bl3->x1[i]*(bl1->p3[i]);
5172 xl3 = xl3-bl3->x1[i]*(bl1->p2[i]) + bl3->x2[i]*(bl1->p1[i]);
5173
5174 // ici ajout de pout cv le 5/7/95
5175 pout1 = pout1 + bl1->p1[i];
5176 pout2 = pout2 + bl1->p2[i];
5177 pout3 = pout3 + bl1->p3[i];
5178 eout = eout+bl1->eps[i] - fmp;
5179 // ic33 = int((std::floor(double(bl1->ind2[i]+3))/double(2)));
5180 ic33 = (bl1->ind2[i]+3)/2;
5181 //nopart = nopart + 1;
5182 kind[nopart] = 3 - ic33;
5183 if(verboseLevel > 3) {
5184 G4cout <<"kind[" << nopart << "] = " << kind[nopart] << G4endl;
5185 }
5186 ep[nopart] = bl1->eps[i] - fmp;
5187 if(verboseLevel > 2) {
5188 if(ep[nopart] > calincl->f[2]) {
5189 G4cout <<"ep[" << nopart << "] = " << ep[nopart] << " > " << calincl->f[2] << G4endl;
5190 G4cout <<"E = " << bl1->eps[nopart] << G4endl;
5191 G4cout <<"px = " << bl1->p1[nopart] << " py = " << bl1->p2[nopart] << " pz = " << bl1->p3[nopart] << G4endl;
5192 G4cout <<"Particle mass = " << fmp << G4endl;
5193 }
5194 }
5195 bmass[nopart] = fmp;
5196 ekout = ekout + ep[nopart];
5197 ptotl = std::sqrt(std::pow(bl1->p1[i],2) + std::pow(bl1->p2[i],2) + std::pow(bl1->p3[i],2));
5198 alpha[nopart] = bl1->p1[i]/ptotl;
5199 beta[nopart] = bl1->p2[i]/ptotl;
5200 gam[nopart] = bl1->p3[i]/ptotl;
5201 nopart = nopart + 1;
5202 continue;
5203 }
5204
5205 t[3] = bl3->x1[i]*(bl3->x1[i]) + bl3->x2[i]*(bl3->x2[i]) + bl3->x3[i]*(bl3->x3[i]); //t(4)->t[3]
5206 erem = erem + bl1->eps[i] - fmp;
5207 rcm1 = rcm1 + bl3->x1[i];
5208 rcm2 = rcm2 + bl3->x2[i];
5209 rcm3 = rcm3 + bl3->x3[i];
5210 prem1 = prem1 + bl1->p1[i];
5211 prem2 = prem2 + bl1->p2[i];
5212 prem3 = prem3 + bl1->p3[i];
5213 izrem = izrem + (1 + bl1->ind2[i])/2;
5214 iarem = iarem + 1;
5215 }
5216
5217 // correction pions 21/3/95 jc
5218 ichpion = 0;
5219 if(npion != 0) {
5220 for(G4int ipion = 1; ipion <= npion; ipion++) {
5221 pout1 = pout1 + q1[ipion];
5222 pout2 = pout2 + q2[ipion];
5223 pout3 = pout3 + q3[ipion];
5224 eout = eout + q4[ipion];
5225 xl1 = xl1 - y2[ipion]*q3[ipion] + y3[ipion]*q2[ipion];
5226 xl2 = xl2 - y3[ipion]*q1[ipion] + y1[ipion]*q3[ipion];
5227 xl3 = xl3 - y1[ipion]*q2[ipion] + y2[ipion]*q1[ipion];
5228 ichpion = ichpion + ipi[ipion]/2;
5229 // nopart = nopart + 1;
5230 kind[nopart] = 4 - ipi[ipion]/2;
5231 ptotl = std::sqrt(std::pow(q1[ipion],2) + std::pow(q2[ipion],2) + std::pow(q3[ipion],2));
5232 ep[nopart] = q4[ipion] - fmpi;
5233 bmass[nopart] = fmpi;
5234 ekout = ekout + ep[nopart];
5235 alpha[nopart] = q1[ipion]/ptotl;
5236 beta[nopart] = q2[ipion]/ptotl;
5237 gam[nopart] = q3[ipion]/ptotl;
5238 nopart++;
5239 }
5240 }
5241
5242 // fin correction pions sur impulsion et moment angulaire et charge
5243 // ici ajout de pfrem cv le 5/7/95
5244 pfrem1 = -pout1;
5245 pfrem2 = -pout2;
5246 pfrem3 = pinc - pout3;
5247
5248 inrem = iarem - izrem;
5249 iejp = iz2 - izrem;
5250 iejn = bl3->ia2 - inrem - iz2;
5251 irem = inrem + izrem;
5252
5253 // intrinsic momentum of the remnant (a.b. 05/2001):
5254 // momentum of projectile minus momentum of all outgoing particles
5255 // minus angular momentum of the remnant computed
5256 // from the sum of all inside nucleons.
5257 // 2675 c xl1=xl1-rcm2/irem*prem3+rcm3/irem*prem2
5258 // 2676 c xl2=xl2-rcm3/irem*prem1+rcm1/irem*prem3
5259 // 2677 c xl3=xl3-rcm1/irem*prem2+rcm2/irem*prem1
5260 // 2678 c here the remnant momentum is pin - sig(pout),
5261 // 2679 c and the distance with respect to the barycenter of the actual target
5262 xl1 = xl1 - (rcm2/irem - x2_target)*pfrem3+(rcm3/irem - x3_target)*pfrem2;
5263 xl2 = xl2 - (rcm3/irem - x3_target)*pfrem1+(rcm1/irem - x1_target)*pfrem3;
5264 xl3 = xl3 - (rcm1/irem - x1_target)*pfrem2+(rcm2/irem - x2_target)*pfrem1;
5265 l = int(std::sqrt(xl1*xl1 + xl2*xl2 + xl3*xl3)/hc + 0.5);
5266
5267 iej = bl3->ia2 - irem;
5268
5269 eh5 = erem - std::pow(double(irem)/double(a2),1.666667)*efer;
5270 if(verboseLevel > 3) {
5271 G4cout <<"erem used for excitation energy calculation = " << erem << G4endl;
5272 G4cout <<"irem used for excitation energy calculation = " << irem << G4endl;
5273 G4cout <<"a2 used for excitation energy calculation = " << a2 << G4endl;
5274 G4cout <<"eh5 used for excitation energy calculation = " << eh5 << G4endl;
5275 }
5276 sepa = (bl3->ia2 - irem)*(v0 - tf);
5277 eh6 = eh5;
5278
5279 // deutons ajout beproj ?????? on retire beproj (18/06/2002 ab cv)
5280 // eh5=erem-efer-beproj+(ia2-irem)*tf
5281 eh5 = erem - efer + (bl3->ia2 - irem)*tf;
5282 if (eh5 < 0.0) {
5283 eh5 = 0.00000001;
5284 }
5285
5286 xlab = tlab - eout - eh5 - sepa;
5287 ecoreh5 = 0.0;
5288
5289 if (iqe == 1) {
5290 eh5=0.00000001;
5291 }
5292 else {
5293 if (eh5 < 0.0) {
5294 if (npion == 0) {
5295 nopart = -1;
5296 if(verboseLevel > 3) {
5297 G4cout <<"npion == 0" << G4endl;
5298 G4cout <<"End of algorithm because npion == 0" << G4endl;
5299 }
5300 goto pnureturn;
5301 }
5302 else {
5303 ecoreh5 = -eh5;
5304 eh5 = 0.000000001;
5305 }
5306 }
5307 }
5308 if (idecf != 0 && eh5 < 0.0) {
5309 ecoreh5 = -eh5;
5310 eh5 = 0.000001;
5311 }
5312
5313 iarem = irem;
5314 pfreml2 = std::pow(pfrem1,2) + std::pow(pfrem2,2) + std::pow(pfrem3,2);
5315 if (pfreml2 > 1.0e-12) {
5316 pfreml = std::sqrt(pfreml2);
5317 alrem = pfrem1/pfreml;
5318 berem = pfrem2/pfreml;
5319 garem = pfrem3/pfreml;
5320 }
5321 else {
5322 alrem = 0.0;
5323 berem = 0.0;
5324 garem = 1.0;
5325 }
5326
5327 erecrem = pfreml2/(std::sqrt(pfreml2 + std::pow((fmp*iarem),2)) + fmp*iarem);
5328
5329 if(iarem == 1) {
5330 erecrem = erecrem + eh5;
5331 }
5332
5333 // correction recul
5334 erecg = erecrem + ecoreh5;
5335 // correction energie d'excitation pour une absorption (a.b., c.v. 2/2002)
5336 esrem = eh5;
5337
5338 if (ekout < 0.001) {
5339 if(verboseLevel > 3) {
5340 G4cout <<"ekout < 0.001" << G4endl;
5341 G4cout <<"End of algorithm because kout < 0.001" << G4endl;
5342 }
5343 goto pnureturn;
5344 }
5345
5346 // on ote l'instruction precedente car esrem toujours nulle 14/9/99
5347
5348 if (erecg > 0.25) {
5349 fffc = (ekout - erecg)/ekout;
5350 if (fffc < 0.0) {
5351 fffc = 0.0;
5352 }
5353
5354 for(G4int ipart = 0; ipart < nopart; ipart++) {
5355 ep[ipart] = ep[ipart]*fffc;
5356 }
5357 }
5358
5359 // modif boudard juillet 99 (il faut tenir compte de la renormalisation
5360 // des energies pour les impulsions.)
5361 pfrem1 = 0.0;
5362 pfrem2 = 0.0;
5363 pfrem3 = pinc;
5364 for(G4int ipart = 0; ipart < nopart; ipart++) {
5365 xmodp = std::sqrt(ep[ipart]*(2.0*bmass[ipart] + ep[ipart]));
5366 pfrem1 = pfrem1 - alpha[ipart]*xmodp;
5367 pfrem2 = pfrem2 - beta[ipart]*xmodp;
5368 pfrem3 = pfrem3 - gam[ipart]*xmodp;
5369 }
5370 // fin modif a.b.
5371
5372 pfreml2 = std::pow(pfrem1,2) + std::pow(pfrem2,2) + std::pow(pfrem3,2);
5373 erecrem = pfreml2/(std::sqrt(pfreml2 + std::pow((fmp*iarem),2)) + fmp*iarem);
5374
5375 if (pfreml2 > 1.0e-12) {
5376 pfreml = std::sqrt(pfreml2);
5377 alrem = pfrem1/pfreml;
5378 berem = pfrem2/pfreml;
5379 garem = pfrem3/pfreml;
5380 }
5381 else {
5382 alrem = 0.0;
5383 berem = 0.0;
5384 garem = 1.0;
5385 }
5386 // fin modif a.b. pour incl3
5387
5388 esrem = eh5;
5389
5390 // if the remnant is a nucleon, no excitation energy
5391 if(iarem == 1) {
5392 esrem = 0.0;
5393 }
5394
5395 if(verboseLevel > 3) {
5396 G4cout <<"Reached end of routine..." << G4endl;
5397 }
5398 goto pnureturn;
5399
5400 if(verboseLevel > 3) {
5401 G4cout <<"ia1 > 1 ! " << G4endl;
5402 }
5403 pnureturn:
5404 (*ibert_p) = ibert;
5405 (*nopart_p) = nopart;
5406 (*izrem_p) = izrem;
5407 (*iarem_p) = iarem;
5408 (*esrem_p) = esrem;
5409 (*erecrem_p) = erecrem;
5410 (*alrem_p) = alrem;
5411 (*berem_p) = berem;
5412 (*garem_p) = garem;
5413 (*bimpact_p) = bimpact;
5414 (*l_p) = l;
5415}
5416
5417
5418void G4Incl::collis(G4double *p1_p, G4double *p2_p, G4double *p3_p, G4double *e1_p, G4double *pout11_p, G4double *pout12_p,
5419 G4double *pout13_p, G4double *eout1_p, G4double *q1_p, G4double *q2_p, G4double *q3_p,
5420 G4double *q4_p, G4int *np_p, G4int *ip_p, G4int *k2_p, G4int *k3_p, G4int *k4_p,
5421 G4int *k5_p, G4int *m1_p, G4int *m2_p, G4int *is1_p, G4int *is2_p)
5422{
5423 G4double p1 = (*p1_p);
5424 G4double p2 = (*p2_p);
5425 G4double p3 = (*p3_p);
5426
5427 G4double e1 = (*e1_p);
5428
5429 G4double debugOutput;
5430 debugOutput = am(p1,p2,p3,e1);
5431 // assert(isnan(debugOutput) == false);
5432
5433 G4double pout11 = (*pout11_p);
5434 G4double pout12 = (*pout12_p);
5435 G4double pout13 = (*pout13_p);
5436 G4double eout1 = (*eout1_p);
5437
5438 G4double q1 = (*q1_p);
5439 G4double q2 = (*q2_p);
5440 G4double q3 = (*q3_p);
5441 // G4double q4 = -1*(*q4_p);
5442 G4double q4 = (*q4_p);
5443
5444 G4int np = (*np_p);
5445 G4int ip = (*ip_p);
5446
5447 G4int k2 = (*k2_p);
5448 G4int k3 = (*k3_p);
5449 G4int k4 = (*k4_p);
5450 G4int k5 = (*k5_p);
5451
5452 G4int m1 = (*m1_p);
5453 G4int m2 = (*m2_p);
5454
5455 G4int is1 = (*is1_p);
5456 G4int is2 = (*is2_p);
5457
5458 // Variables:
5459 G4double a;
5460 G4double aaa;
5461 G4double aac;
5462 // G4double alog;
5463 G4double alphac;
5464 // G4double amax1;
5465 G4double apt;
5466 G4double argu;
5467 G4double b;
5468 G4double btmax;
5469 G4double cfi;
5470 G4double cpt;
5471 G4double ctet;
5472 G4double e3;
5473 G4double ecm;
5474 G4double ex[3];
5475 G4double ey[3];
5476 G4double ez[3];
5477 G4double f3;
5478 G4double f3max;
5479 G4double fi;
5480 G4double fracpn;
5481 G4double heli;
5482 G4int iexpi;
5483 G4int ii;
5484 G4int index;
5485 G4int index2;
5486 G4int isi;
5487 G4double pin;
5488 G4double pl;
5489 G4double pnorm;
5490 // G4double pq = 0.0;
5491 G4double psq;
5492 G4double qq[3];
5493 G4double qq4;
5494 G4double ranres;
5495 G4double rndm;
5496 G4double s;
5497 G4double s1;
5498 // G4double sel;
5499 G4double sfi;
5500 G4double stet;
5501 G4double t;
5502 G4double x;
5503 G4double xkh;
5504 G4double xp1;
5505 G4double xp2;
5506 G4double xp3;
5507 G4double xx;
5508 G4double y;
5509 G4double yn;
5510 G4double z;
5511 G4double zn;
5512 G4double zz;
5513
5514 // !!! q4 = -1*q4;
5515 // 2837 c
5516 // 2838 c collis p-n17770
5517 // 2839 subroutine collis(p1,p2,p3,e1,pout11,pout12,pout13,eout1,q1,q2,q3,p-n17780
5518 // 2840 -q4,np,ip,k2,k3,k4,k5,m1,m2,is1,is2) p-n17790
5519
5520 // 2841 common/bl6/xx10,isa p-n17800
5521 // 2842 common/bl8/rathr,ramass p-n17810
5522 // 2843 common/hazard/ial,iy1,iy2,iy3,iy4,iy5,iy6,iy7,iy8,iy9,iy10,
5523 // 2844 s iy11,iy12,iy13,iy14,iy15,iy16,iy17,iy18,iy19
5524 // 2845 common/bl9/hel(300),l1,l2
5525 // 2846 dimension ex(3),ey(3),ez(3),qq(3) p-n17820
5526 // 2847 data xm,xm2,xmdel,ezero,xpi/938.2796,8.8037e5,1232.,1876.6,138./ p-n17830
5527 G4double xm = 938.2796;
5528 G4double xm2 = 8.8037e5;
5529 G4double xmdel = 1232.0;
5530 G4double xpi = 138.0;
5531
5532 // 2848 c data iy1,iy2,iy3,iy4,iy5,iy6,iy7,iy8,iy10,iy11,iy12,iy13/ p-n17840
5533 // 2849 c 1 12345,22345,32345,42345,52345,62345,72345,82345,34567,47059,21033p-n17850
5534 // 2850 c 1 12345,22345,32345,42345,52345,62345,72345,82341,34567,47059,21033p-n17850
5535 // 2851 c 2,32835/ p-n17860
5536 // 2852 c data iy9/15637/
5537 // 2853 pcm(e,a,c)=0.5*std::sqrt((e**2-(a+c)**2)*(e**2-(a-c)**2))/e p-n17870
5538 G4int iso = is1 + is2;
5539 np = 0;
5540 psq = p1*p1 + p2*p2 + p3*p3;
5541 assert(psq >= 0);
5542 pnorm = std::sqrt(psq);
5543 ecm = e1 + eout1;
5544 // assert(isnan(ecm) == false);
5545
5546 if(ecm < 1925.0) {
5547 goto collis160;
5548 }
5549
5550 if (k3 == 1) {
5551 goto collis17;
5552 }
5553
5554 // assert(isnan(bl8->rathr) == false);
5555 if(ecm < (2065.0 + bl8->rathr)) {
5556 goto collis17;
5557 }
5558
5559 if((k4-1) < 0) {
5560 goto collis18;
5561 }
5562 if((k4-1) == 0) {
5563 goto collis10;
5564 }
5565 if((k4-1) > 0) {
5566 goto collis20;
5567 }
5568
5569 collis10:
5570 if((m1+m2-1) < 0) {
5571 goto collis19;
5572 }
5573 if((m1+m2-1) == 0) {
5574 goto collis14;
5575 }
5576 if((m1+m2-1) > 0) {
5577 goto collis13;
5578 }
5579
5580 collis19:
5581 // assert(isnan(bl8->ramass) == false);
5582 if((ecm-2170.4-bl8->ramass) <= 0) {
5583 goto collis17;
5584 }
5585 if((ecm-2170.4-bl8->ramass) > 0) {
5586 goto collis18;
5587 }
5588
5589 collis20:
5590 if((m1+m2-1) < 0) {
5591 goto collis18;
5592 }
5593 if((m1+m2-1) == 0) {
5594 goto collis14;
5595 }
5596 if((m1+m2-1) > 0) {
5597 goto collis13;
5598 }
5599
5600 // test on the recombination possibility for the n-delta system
5601 collis14:
5602 if (k5 == 0) {
5603 goto collis170;
5604 }
5605
5606 standardRandom(&rndm, &(hazard->igraine[10]));
5607
5608 // assert(isnan(ecm) == false);
5609 // assert(isnan(iso) == false);
5610 s1 = lowEnergy(ecm, 1, iso);
5611 // assert(isnan(s1) == false);
5612
5613 if(m1 != 0) {
5614 assert((e1*e1 - psq) >= 0);
5615 bl6->xx10=std::sqrt(e1*e1-psq);
5616 bl6->isa=is1;
5617 // assert(isnan(bl6->isa) == false);
5618 }
5619 else {
5620 assert((std::pow(eout1,2)-psq) >= 0);
5621 bl6->xx10 = std::sqrt(std::pow(eout1,2)-psq);
5622 bl6->isa = is2;
5623 // assert(isnan(bl6->isa) == false);
5624 }
5625
5626 s = s1 + srec(ecm,bl6->xx10, iso,int(bl6->isa));
5627 // assert(isnan(s) == false);
5628 assert(s != 0);
5629 a = (s - s1)/s;
5630 // assert(isnan(a) == false);
5631
5632 if((rndm-a) <= 0) {
5633 goto collis170;
5634 }
5635 if((rndm-a) > 0) {
5636 goto collis17;
5637 }
5638
5639 // test for the behaviour of the delta-delta system
5640 collis13:
5641 if (k5 == 0) {
5642 goto collis160;
5643 }
5644 goto collis17;
5645
5646 // test on the inelasticity
5647 collis18:
5648 standardRandom(&rndm, &(hazard->igraine[0]));
5649 s = lowEnergy(ecm,0,iso);
5650 // assert(isnan(ecm) == false);
5651 // assert(isnan(iso) == false);
5652 a = deltaProductionCrossSection(ecm,iso);
5653 a = s/(s+a);
5654 if(rndm > a) {
5655 goto collis100;
5656 }
5657
5658 // elastic scattering
5659 // fit of the b parameter in the differential x-section:
5660 // taken from :j.c.,d.l'hote, j.vandermeulen,nimb111(1996)215
5661 // for pn :improvement of the backward scattering according
5662 // j.c et al, prc56(1997)2431
5663 collis17:
5664 assert((std::pow(ecm,2) - 4.0*xm2) >= 0);
5665 pl = 0.5*ecm*std::sqrt(std::pow(ecm,2) - 4.0*xm2)/xm;
5666 x = 0.001*pl;
5667 // assert(isnan(x) == false);
5668
5669 if (iso == 0) {
5670 goto collis80;
5671 }
5672 if (pl > 2000.0) {
5673 goto collis81;
5674 }
5675 x = x*x;
5676 x = std::pow(x,4);
5677 b = 5.5e-6*x/(7.7+x);
5678 goto collis82;
5679
5680 collis81:
5681 b = (5.34 + 0.67*(x-2.0))*1.e-6;
5682 goto collis82;
5683
5684 collis80:
5685 if (pl < 800.) {
5686 b = (7.16 - 1.63*x)*1.e-6;
5687 b = b/(1.0 + std::exp(-(x - 0.45)/0.05));
5688 }
5689 else {
5690 if (pl < 1100.) {
5691 b = (9.87 - 4.88*x)*1.e-6;
5692 }
5693 else {
5694 b = (3.68 + 0.76*x)*1.e-6;
5695 }
5696 }
5697
5698 collis82:
5699 debugOutput = am(p1,p2,p3,e1);
5700 // assert(isnan(debugOutput) == false);
5701
5702 btmax = 4.0*psq*b;
5703 z = std::exp(-btmax);
5704 standardRandom(&rndm, &(hazard->igraine[1]));
5705 ranres = rndm;
5706 y = 1.0 - rndm*(1.0 - z);
5707 assert(y >= 0);
5708 t = std::log(y)/b;
5709 iexpi = 0;
5710
5711 if (((m1+m2) == 0) && (iso == 0)) {
5712 apt = 1.0;
5713 if (pl > 800.) {
5714 apt = std::pow((800.0/pl),2);
5715 cpt = amax1(6.23*std::exp(-1.79*x),0.3);
5716 alphac = 100.0*1.e-6;
5717 aaa = (1 + apt)*(1 - std::exp(-btmax))/b;
5718 argu = psq*alphac;
5719
5720 if (argu >= 8) {
5721 argu = 0.0;
5722 }
5723 else {
5724 argu = std::exp(-4.0*argu);
5725 }
5726
5727 aac = cpt*(1.0 - argu)/alphac;
5728 fracpn = aaa/(aac + aaa);
5729 standardRandom(&rndm, &(hazard->igraine[7]));
5730 if (rndm > fracpn) {
5731 z = std::exp(-4.0*psq*alphac);
5732 iexpi = 1;
5733 // y = 1.0 - ranres*(10.0 - z);
5734 y = 1.0 - ranres*(1.0 - z);
5735 assert(y >= 0);
5736 t = std::log(y)/alphac;
5737 }
5738 }
5739 }
5740
5741 ctet = 1.0 + 0.5*t/psq;
5742 if(std::fabs(ctet) > 1.0) {
5743 ctet = sign(1.0,ctet);
5744 }
5745
5746 assert((1.0 - std::pow(ctet,2)) >= 0);
5747 stet = std::sqrt(1.0 - std::pow(ctet,2));
5748 standardRandom(&rndm, &(hazard->igraine[2]));
5749 fi = 6.2832*rndm;
5750 cfi = std::cos(fi);
5751 sfi = std::sin(fi);
5752 xx = p1*p1 + p2*p2;
5753 zz = p3*p3;
5754
5755 debugOutput = am(p1,p2,p3,e1);
5756 // assert(isnan(debugOutput) == false);
5757
5758 if(xx >= (zz*1.0e-8)) {
5759 assert(xx >= 0);
5760 yn=std::sqrt(xx);
5761 zn=yn*pnorm;
5762 assert(pnorm != 0);
5763 ez[0] = p1/pnorm; // ez(1) -> ez[0] and so on...
5764 ez[1] = p2/pnorm;
5765 ez[2] = p3/pnorm;
5766 assert(yn != 0);
5767 ex[0] = p2/yn;
5768 ex[1] = -p1/yn;
5769 ex[2] = 0.0;
5770 assert(zn != 0);
5771 ey[0] = p1*p3/zn;
5772 ey[1] = p2*p3/zn;
5773 ey[2] = -xx/zn;
5774 p1 = (ex[0]*cfi*stet + ey[0]*sfi*stet + ez[0]*ctet)*pnorm;
5775 p2 = (ex[1]*cfi*stet + ey[1]*sfi*stet + ez[1]*ctet)*pnorm;
5776 p3 = (ex[2]*cfi*stet + ey[2]*sfi*stet + ez[2]*ctet)*pnorm;
5777 }
5778 else {
5779 p1 = p3*cfi*stet;
5780 p2 = p3*sfi*stet;
5781 p3 = p3*ctet;
5782 }
5783 pout11 = -p1;
5784 pout12 = -p2;
5785 pout13 = -p3;
5786 debugOutput = am(p1,p2,p3,e1);
5787 // assert(isnan(debugOutput) == false);
5788
5789 // backward scattering according the parametrization of ref
5790 // prc56(1997)1
5791
5792 if(((m1+m2) != 1) || (iso == 0)) {
5793 standardRandom(&rndm, &(hazard->igraine[7]));
5794 apt = 1.0;
5795 if (pl > 800.0) {
5796 apt = std::pow((800.0/pl),2);
5797 }
5798 if ((iexpi == 1) || (rndm > (1./(1.+apt)))) {
5799 ii = is1;
5800 is1 = is2;
5801 is2 = ii;
5802 }
5803 }
5804
5805 debugOutput = am(p1,p2,p3,e1);
5806 // assert(isnan(debugOutput) == false);
5807 goto exitRoutine;
5808
5809 // delta production
5810 // the production is not isotropic in this version
5811 // it has the same std::exp(b*t) structure as the nn elastic scatteringp-n19170
5812 // (formula 2.3 of j.cugnon et al, nucl phys a352(1981)505)
5813 // parametrization of b taken from ref. prc56(1997)2431
5814 collis100:
5815 if (k4 != 1) {
5816 goto collis101;
5817 }
5818 xmdel = 1232.0 + bl8->ramass;
5819 goto collis103;
5820 collis101:
5821 //call ribm(rndm,iy10)
5822 standardRandom(&rndm, &(hazard->igraine[9]));
5823
5824 y = std::tan(3.1415926*(rndm - 0.5));
5825 x = 1232.0 + 0.5*130.0*y + bl8->ramass;
5826 if (x < (xm+xpi+2.0)) {
5827 goto collis101;
5828 }
5829 if (ecm < (x+xm+1.)) {
5830 goto collis101;
5831 }
5832
5833 // generation of the delta mass with the penetration factor
5834 // (see prc56(1997)2431)
5835 y = std::pow(ecm,2);
5836 q2 = (y - std::pow(1076.0,2))*(y - std::pow(800.0,2))/y/4.0;
5837 assert(q2 >= 0);
5838 q3 = std::pow((std::sqrt(q2)),3);
5839 f3max = q3/(q3 + std::pow(180.0,3));
5840 y = std::pow(x,2);
5841 q2 = (y - std::pow(1076.0,2))*(y - std::pow(800.0,2))/y/4.0;
5842 assert(q2 >= 0);
5843 q3 = std::pow((std::sqrt(q2)),3);
5844 f3 = q3/(q3 + std::pow(180.0,3));
5845
5846 standardRandom(&rndm, &(hazard->igraine[10]));
5847 if (rndm > (f3/f3max)) {
5848 goto collis101;
5849 }
5850 xmdel = x;
5851
5852 collis103:
5853 pin = pnorm;
5854 pnorm = pcm(ecm,xm,xmdel);
5855 // assert(isnan(pnorm) == false);
5856 if (pnorm <= 0) {
5857 pnorm = 0.000001;
5858 }
5859 index = 0;
5860 index2 = 0;
5861
5862 standardRandom(&rndm, &(hazard->igraine[3]));
5863 if (rndm < 0.5) {
5864 index = 1;
5865 }
5866
5867 if (iso == 0) {
5868 standardRandom(&rndm, &(hazard->igraine[4]));
5869 if (rndm < 0.5) {
5870 index2 = 1;
5871 }
5872 }
5873
5874 standardRandom(&rndm, &(hazard->igraine[5]));
5875 assert((std::pow(ecm,2) - 4.0*xm2) >= 0);
5876 x = 0.001*0.5*ecm*std::sqrt(std::pow(ecm,2) - 4.0*xm2)/xm;
5877 if(x < 1.4) {
5878 b = (5.287/(1.0 + std::exp((1.3 - x)/0.05)))*1.e-6;
5879 }
5880 else {
5881 b = (4.65 + 0.706*(x - 1.4))*1.e-6;
5882 }
5883
5884 xkh = 2.0*b*pin*pnorm;
5885 ctet=1.0 + std::log(1.0 - rndm*(1.0 - std::exp(-2.0*xkh)))/xkh;
5886 if(std::fabs(ctet) > 1.0) {
5887 ctet = sign(1.0,ctet);
5888 }
5889
5890 assert((1.0 - std::pow(ctet,2)) >= 0);
5891 stet = std::sqrt(1.0 - std::pow(ctet,2));
5892 standardRandom(&rndm, &(hazard->igraine[6]));
5893 fi = 6.2832*rndm;
5894 cfi = std::cos(fi);
5895 sfi = std::sin(fi);
5896
5897 // delta production: correction of the angular distribution 02/09/02
5898 xx = p1*p1 + p2*p2;
5899 zz = p3*p3;
5900 if(xx >= (zz*1.0e-8)) {
5901 assert(xx >= 0);
5902 yn = std::sqrt(xx);
5903 zn = yn*pin;
5904 ez[0] = p1/pin; // ez(1) -> ez[0] and so on...
5905 ez[1] = p2/pin;
5906 ez[2] = p3/pin;
5907 ex[0] = p2/yn;
5908 ex[1] = -p1/yn;
5909 ex[2] = 0.0;
5910 ey[0] = p1*p3/zn;
5911 ey[1] = p2*p3/zn;
5912 ey[2] = -xx/zn;
5913 xp1 = (ex[0]*cfi*stet + ey[0]*sfi*stet + ez[0]*ctet)*pnorm;
5914 xp2 = (ex[1]*cfi*stet + ey[1]*sfi*stet + ez[1]*ctet)*pnorm;
5915 xp3 = (ex[2]*cfi*stet + ey[2]*sfi*stet + ez[2]*ctet)*pnorm;
5916 }
5917 else {
5918 xp1 = pnorm*stet*cfi;
5919 xp2 = pnorm*stet*sfi;
5920 xp3 = pnorm*ctet;
5921 }
5922 // end of correction angular distribution of delta production
5923
5924 assert((xp1*xp1 + xp2*xp2 + xp3*xp3 + xm*xm) >= 0);
5925 e3 = std::sqrt(xp1*xp1 + xp2*xp2 + xp3*xp3 + xm*xm);
5926 if(k4 != 0) {
5927 goto collis161;
5928 }
5929
5930 // decay of the delta particle (k4=0)
5931 np = 1;
5932 ip = 0;
5933 qq[0] = xp1; //qq(1) -> qq[0]
5934 qq[1] = xp2;
5935 qq[2] = xp3;
5936 assert((xp1*xp1 + xp2*xp2 + xp3*xp3 + xmdel*xmdel) >= 0);
5937 qq4 = std::sqrt(xp1*xp1 + xp2*xp2 + xp3*xp3 + xmdel*xmdel);
5938 heli = std::pow(ctet,2);
5939
5940 if(verboseLevel > 3) {
5941 G4cout <<"Caling decay2 from collis" << G4endl;
5942 }
5943 decay2(&qq[0],&qq[1],&qq[2],&qq4,&q1,&q2,&q3,&q4,&xmdel,&xm,&xpi,&heli);
5944
5945 if(index != 0) {
5946 p1 = qq[0]; //qq(1) -> qq[0] and so on...
5947 p2 = qq[1];
5948 p3 = qq[2];
5949 pout11 = -xp1;
5950 pout12 = -xp2;
5951 pout13 = -xp3;
5952 eout1 = e3;
5953 }
5954 else {
5955 pout11 = qq[0]; //qq(1) -> qq[0] and so on...
5956 pout12 = qq[1];
5957 pout13 = qq[2];
5958 eout1 = e1;
5959 p1 = -xp1;
5960 p2 = -xp2;
5961 p3 = -xp3;
5962 e1 = e3;
5963 }
5964 debugOutput = am(p1,p2,p3,e1);
5965 // assert(isnan(debugOutput) == false);
5966
5967 if (iso == 0) {
5968 goto collis150;
5969 }
5970 if (rndm > 0.333333) {
5971 debugOutput = am(p1,p2,p3,e1);
5972 // assert(isnan(debugOutput) == false);
5973 goto exitRoutine;
5974 }
5975
5976 is1 = -is1;
5977 ip = -2*is1;
5978
5979 collis150:
5980 if (index == 1) {
5981 debugOutput = am(p1,p2,p3,e1);
5982 // assert(isnan(debugOutput) == false);
5983 goto exitRoutine;
5984 }
5985 if (rndm < 0.5) {
5986 goto collis152;
5987 }
5988 is1 = 1;
5989 is2 = 1;
5990 ip = -2;
5991 debugOutput = am(p1,p2,p3,e1);
5992 // assert(isnan(debugOutput) == false);
5993 goto exitRoutine;
5994
5995 collis152:
5996 is1 = -1;
5997 is2 = -1;
5998 ip = 2;
5999 debugOutput = am(p1,p2,p3,e1);
6000 // assert(isnan(debugOutput) == false);
6001 goto exitRoutine;
6002
6003 collis160:
6004 pout11 = -p1;
6005 pout12 = -p2;
6006 pout13 = -p3;
6007 debugOutput = am(p1,p2,p3,e1);
6008 // assert(isnan(debugOutput) == false);
6009 goto exitRoutine;
6010
6011 // long-lived delta
6012 collis161:
6013 if(index != 1) {
6014 p1=xp1;
6015 p2=xp2;
6016 p3=xp3;
6017 eout1=e3;
6018 e1=ecm-eout1;
6019 m1=1;
6020 }
6021 else {
6022 p1=-xp1;
6023 p2=-xp2;
6024 p3=-xp3;
6025 eout1=e3;
6026 e1=ecm-eout1;
6027 m1=1;
6028 }
6029 debugOutput = am(p1,p2,p3,e1);
6030 // assert(isnan(debugOutput) == false);
6031
6032 // symmetrization of charges in pn -> n delta
6033 // the test on "index" above symetrizes the excitation of one
6034 // of the nucleons with respect to the delta excitation
6035 // (see note 16/10/97)
6036 if (iso == 0) {
6037 if (index2 == 1) {
6038 isi = is1;
6039 is1 = is2;
6040 is2 = isi;
6041 }
6042 goto collis160;
6043 }
6044
6045 bl9->hel[bl9->l1] = std::pow(ctet,2);
6046 standardRandom(&rndm, &(hazard->igraine[7]));
6047 if (rndm < 0.25) {
6048 goto collis160;
6049 }
6050
6051 is1=3*is1*m1-(1-m1)*is1;
6052 is2=3*is2*m2-(1-m2)*is2;
6053 goto collis160;
6054
6055 // recombination process
6056 collis170:
6057 pnorm = pcm(ecm,xm,xm);
6058 // assert(isnan(pnorm) == false);
6059 standardRandom(&rndm, &(hazard->igraine[11]));
6060 ctet = -1.0 + 2.0*rndm;
6061 if(std::fabs(ctet) > 1.0) {
6062 ctet = sign(1.0,ctet);
6063 }
6064 assert((1.0 - ctet*ctet) >= 0);
6065 stet = std::sqrt(1.0 - ctet*ctet);
6066 standardRandom(&rndm, &(hazard->igraine[12]));
6067 fi = 6.2832*rndm;
6068 cfi = std::cos(fi);
6069 sfi = std::sin(fi);
6070 p1 = pnorm*stet*cfi;
6071 p2 = pnorm*stet*sfi;
6072 p3 = pnorm*ctet;
6073 m1 = 0;
6074 m2 = 0;
6075 assert((p1*p1 + p2*p2 + p3*p3 + xm*xm) >= 0);
6076 e1 = std::sqrt(p1*p1 + p2*p2 + p3*p3 + xm*xm);
6077 eout1 = ecm - e1;
6078 debugOutput = am(p1,p2,p3,e1);
6079 // assert(isnan(debugOutput) == false);
6080
6081 if (iso == 0) {
6082 goto collis160;
6083 }
6084 is1=iso/2;
6085 is2=iso/2;
6086 goto collis160;
6087
6088 exitRoutine:
6089 debugOutput = am(p1,p2,p3,e1);
6090 // assert(isnan(debugOutput) == false);
6091 (*p1_p) = p1;// Was pq
6092 (*p2_p) = p2;
6093 (*p3_p) = p3;
6094
6095 (*e1_p) = e1;
6096
6097 debugOutput = am(pout11,pout12,pout13,eout1);
6098 // assert(isnan(debugOutput) == false);
6099 (*pout11_p) = pout11;
6100 (*pout12_p) = pout12;
6101 (*pout13_p) = pout13;
6102 (*eout1_p) = eout1;
6103
6104 (*q1_p) = q1;
6105 (*q2_p) = q2;
6106 (*q3_p) = q3;
6107 (*q4_p) = q4;
6108
6109 (*np_p) = np;
6110 (*ip_p) = np;
6111
6112 (*k2_p) = k2;
6113 (*k3_p) = k2;
6114 (*k4_p) = k4;
6115 (*k5_p) = k5;
6116
6117 (*m1_p) = m1;
6118 (*m2_p) = m2;
6119
6120 (*is1_p) = is1;
6121 (*is2_p) = is2;
6122}
6123
6124void G4Incl::decay2(G4double *p1_p, G4double *p2_p, G4double *p3_p, G4double *wp_p, G4double *q1_p,
6125 G4double *q2_p, G4double *q3_p, G4double *wq_p, G4double *xi_p, G4double *x1_p, G4double *x2_p,
6126 G4double *hel_p)
6127{
6128 // This routine describes the anisotropic decay of a particle of mass
6129 // xi into 2 particles of masses x1,x2
6130 // the anisotropy is supposed to follow a 1+3*hel*(std::cos(theta))**2
6131 // law with respect to the direction of the incoming particle
6132 // in the input, p1,p2,p3 is the momentum of particle xi
6133 // in the output, p1,p2,p3 is the momentum of particle x1 , while
6134 // q1,q2,q3 is the momentum of particle x2
6135
6136 // Temporary variables for input/output data:
6137
6138 G4double p1 = (*p1_p);
6139 G4double p2 = (*p2_p);
6140 G4double p3 = (*p3_p);
6141
6142 G4double q1 = (*q1_p);
6143 G4double q2 = (*q2_p);
6144 G4double q3 = (*q3_p);
6145
6146 G4double wp = (*wp_p);
6147 G4double wq = (*wq_p);
6148
6149 G4double xi = (*xi_p);
6150 G4double x1 = (*x1_p);
6151 G4double x2 = (*x2_p);
6152 G4double hel = (*hel_p);
6153
6154 G4double rndm;
6155
6156 G4double xe = wp;
6157 G4double b1 = p1/xe;
6158 G4double b2 = p2/xe;
6159 G4double b3 = p3/xe;
6160 // PK: NaN workaround
6161 // if(((std::pow(xi,2)-std::pow(x1+x2,2))*(std::pow(xi,2)-std::pow(x1-x2,2))) < 0) {
6162 // xi = xi+x2+100.0;
6163 // }
6164 // PK
6165 G4double xq = pcm(xi,x1,x2);
6166 // assert(isnan(xq) == false);
6167 G4double ctet, stet;
6168
6169 G4double fi, cfi, sfi;
6170 G4double sal, cal;
6171 G4double t1, t2;
6172 G4double w1;
6173 G4double beta;
6174
6175 if(verboseLevel > 3) {
6176 G4cout <<"Delta decay in progress: " << G4endl;
6177 G4cout <<"Starting values: " << G4endl;
6178 G4cout <<"p1 = " << p1 << " p2 = " << p2 << " p3 = " << p3 << " wp = " << wp << G4endl;
6179 G4cout <<"q1 = " << q1 << " q2 = " << q2 << " q3 = " << q3 << " wq = " << wq << G4endl;
6180 }
6181
6182 do {
6183 standardRandom(&rndm, &(hazard->igraine[7]));
6184 ctet = -1.0 + 2.0*rndm;
6185 if(std::fabs(ctet) > 1.0) {
6186 ctet = sign(1.0,ctet);
6187 }
6188 assert((1.0 - std::pow(ctet,2)) >= 0);
6189 stet = std::sqrt(1.0 - std::pow(ctet,2));
6190 standardRandom(&rndm, &(hazard->igraine[9]));
6191 } while(rndm > ((1.0 + 3.0*hel*std::pow(ctet,2))/(1.0 + 3.0*hel)));
6192
6193 standardRandom(&rndm, &(hazard->igraine[8]));
6194 fi = 6.2832*rndm;
6195 cfi = std::cos(fi);
6196 sfi = std::sin(fi);
6197 assert((b1*b1+b2*b2+b3*b3) >= 0);
6198 beta = std::sqrt(b1*b1+b2*b2+b3*b3);
6199 // assert(isnan(beta) == false);
6200 assert(beta != 0);
6201
6202 assert((std::pow(b1,2) + std::pow(b2,2)) >= 0);
6203 sal = std::sqrt(std::pow(b1,2) + std::pow(b2,2))/beta;
6204 cal = b3/beta;
6205
6206 if((beta >= 1.0e-10) || (sal >= 1.0e-6)) {
6207 t1 = ctet + cal*stet*sfi/sal;
6208 assert(sal != 0);
6209 t2 = stet/sal;
6210 q1 = xq*(b1*t1 + b2*t2*cfi)/beta;
6211 q2 = xq*(b2*t1 - b1*t2*cfi)/beta;
6212 q3 = xq*(b3*t1/beta - t2*sfi);
6213 }
6214 else {
6215 q1 = xq*stet*cfi;
6216 q2 = xq*stet*sfi;
6217 q3 = xq*ctet;
6218 }
6219
6220 hel = 0.0;
6221 w1 = q1*q1 + q2*q2 + q3*q3;
6222 assert((w1 + x2*x2) >= 0);
6223 wq = std::sqrt(w1 + x2*x2);
6224 p1 = -q1;
6225 p2 = -q2;
6226 p3 = -q3;
6227 assert((w1+x1*x1) >= 0);
6228 wp = std::sqrt(w1+x1*x1);
6229 loren(&q1, &q2, &q3, &b1, &b2, &b3, &wq);
6230 loren(&p1, &p2, &p3, &b1, &b2, &b3, &wp);
6231
6232 // Return calculated values:
6233 (*p1_p) = p1;
6234 (*p2_p) = p2;
6235 (*p3_p) = p3;
6236
6237 (*q1_p) = q1;
6238 (*q2_p) = q2;
6239 (*q3_p) = q3;
6240
6241 (*wp_p) = wp;
6242 (*wq_p) = wq;
6243
6244 (*xi_p) = xi;
6245 (*x1_p) = x1;
6246 (*x2_p) = x2;
6247 (*hel_p) = hel;
6248}
6249
6250void G4Incl::time(G4int i, G4int j)
6251{
6252 // time
6253 G4double t[10];
6254
6255 t[0] = bl1->p1[i]/bl1->eps[i] - bl1->p1[j]/bl1->eps[j]; // t(1)->t[0]
6256 t[1] = bl1->p2[i]/bl1->eps[i] - bl1->p2[j]/bl1->eps[j]; // t(2)->t[1] and so on ...
6257 t[2] = bl1->p3[i]/bl1->eps[i] - bl1->p3[j]/bl1->eps[j];
6258 t[3] = bl3->x1[i] - bl3->x1[j];
6259 t[4] = bl3->x2[i] - bl3->x2[j];
6260 t[5] = bl3->x3[i] - bl3->x3[j];
6261
6262 t[6] = t[0]*t[3] + t[1]*t[4] + t[2]*t[5];
6263 t[9] = t[0]*t[0] + t[1]*t[1] + t[2]*t[2];
6264
6265 if(t[9] <= 1.0e-10) {
6266 bl1->ta = 100000;
6267 }
6268 else {
6269 bl1->ta = -1.0*t[6]/t[9];
6270 }
6271
6272 bl3->rab2 = t[3]*t[3] + t[4]*t[4] + t[5]*t[5] + bl1->ta*t[6];
6273}
6274
6275void G4Incl::newt(G4int l1, G4int l2)
6276{
6277 G4int ig, id, kg, kd;
6278 G4int iy, ix;
6279 G4double E;
6280
6281 G4int ia = bl3->ia1 + bl3->ia2;
6282 for(G4int i = 1; i <= ia; i++) { // do 52 i=1,ia
6283 if (bl5->nesc[i] != 0) {
6284 continue;
6285 }
6286 // if (i-l2) 53,52,54
6287 if((i-l2) < 0) {
6288 goto newt53;
6289 }
6290 if((i-l2) == 0) {
6291 continue;
6292 }
6293 if((i-l2) > 0) {
6294 goto newt54;
6295 }
6296 newt53:
6297 ig=l2;
6298 id=i;
6299 kg=l1;
6300 kd=i;
6301 goto newt55;
6302 newt54:
6303 // if (i-l1) 56,52,57
6304 if((i-l1) == 0) {
6305 continue;
6306 }
6307 if((i-l1) < 0) {
6308 goto newt56;
6309 }
6310 if((i-l1) > 0) {
6311 goto newt57;
6312 }
6313 newt56:
6314 kg=l1;
6315 kd=i;
6316 goto newt58;
6317 newt57:
6318 kg=i;
6319 kd=l1;
6320 newt58:
6321 ig=i;
6322 id=l2;
6323 newt55:
6324 // call time(ig,id)
6325 time(ig, id);
6326 if (bl1->ta < 0.0) {
6327 goto newt50;
6328 }
6329 if(bl1->ta > bl4->tmax5) {
6330 goto newt50;
6331 }
6332 if (bl1->ta < bl5->tlg[l1]) { // tlg(12)->tlg[11]
6333 goto newt50;
6334 }
6335 if ((bl1->ind1[ig]+bl1->ind1[id]) > 0) {
6336 goto newt60;
6337 }
6338
6339 E=am(bl1->p1[ig]+bl1->p1[id],bl1->p2[ig]+bl1->p2[id],bl1->p3[ig]+bl1->p3[id],bl1->eps[ig]+bl1->eps[id]);
6340 if (E < 1925.0) {
6341 goto newt50;
6342 }
6343 iy=bl1->ind1[ig]+bl1->ind1[id];
6344 if (iy != 1) {
6345 goto newt61;
6346 }
6347 ix=ig*(bl1->ind1[ig])+id*(bl1->ind1[id]);
6348 bl6->xx10=am(bl1->p1[ix],bl1->p2[ix],bl1->p3[ix],bl1->eps[ix]);
6349 bl6->isa=bl1->ind2[ix];
6350 newt61:
6351 // assert(isnan(E) == false);
6352 // assert(isnan(iy) == false);
6353 // assert(isnan(bl1->ind2[ig]) == false);
6354 // assert(isnan(bl1->ind2[id]) == false);
6355 if ((31.*(bl3->rab2)) > totalCrossSection(E,iy,bl1->ind2[ig]+bl1->ind2[id])) {
6356 goto newt50;
6357 }
6358 newt60: // continue
6359 bl2->k=bl2->k+1;
6360 bl2->crois[bl2->k]=bl1->ta;
6361 bl2->ind[bl2->k]=ig;
6362 bl2->jnd[bl2->k]=id;
6363 newt50:
6364 time(kg,kd);
6365 if (bl1->ta < 0.) {
6366 continue;
6367 }
6368 if(bl1->ta > bl4->tmax5) {
6369 continue;
6370 }
6371 if (bl1->ta < bl5->tlg[10]) { //tlg(11)->tlg[10]
6372 continue;
6373 }
6374 if ((bl1->ind1[kg]+bl1->ind1[kd]) > 0) {
6375 goto newt62;
6376 }
6377 E=am(bl1->p1[kg]+bl1->p1[kd],bl1->p2[kg]+bl1->p2[kd],bl1->p3[kg]+bl1->p3[kd],bl1->eps[kg]+bl1->eps[kd]);
6378 if (E < 1925.) {
6379 continue;
6380 }
6381 iy=bl1->ind1[kg]+bl1->ind1[kd];
6382 if (iy != 1) {
6383 goto newt63;
6384 }
6385 ix=kg*(bl1->ind1[kg])+kd*(bl1->ind1[kd]);
6386 bl6->xx10=am(bl1->p1[ix],bl1->p2[ix],bl1->p3[ix],bl1->eps[ix]);
6387 bl6->isa=bl1->ind2[ix];
6388 newt63:
6389 // assert(isnan(E) == false);
6390 // assert(isnan(iy) == false);
6391 // assert(isnan(bl1->ind2[kg]) == false);
6392 // assert(isnan(bl1->ind2[kd]) == false);
6393 if ((31.*(bl3->rab2)) > totalCrossSection(E,iy,bl1->ind2[kg]+bl1->ind2[kd])) {
6394 continue;
6395 }
6396 newt62:
6397 bl2->k=bl2->k+1;
6398 bl2->crois[bl2->k]=bl1->ta;
6399 bl2->ind[bl2->k]=kg;
6400 bl2->jnd[bl2->k]=kd;
6401 }
6402}
6403
6404void G4Incl::new1(G4int l1)
6405{
6406 G4int ia, iy, ix;
6407 G4double E;
6408
6409 ia=bl3->ia1+bl3->ia2;
6410 for(G4int i = 1; i <= ia; i++) {
6411 if (bl5->nesc[i] != 0) {
6412 continue;
6413 }
6414 //if(i-l1) 53,52,54
6415 if((i-l1) < 0) {
6416 goto new153;
6417 }
6418 if((i-l1) == 0) {
6419 continue;
6420 }
6421 if((i-l1) > 0) {
6422 goto new154;
6423 }
6424 new153:
6425 time(i, l1);
6426 if(bl1->ta < 0.0) {
6427 continue;
6428 }
6429 if(bl1->ta > bl4->tmax5) {
6430 continue;
6431 }
6432 if (bl1->ind1[i]+bl1->ind1[l1] > 0) {
6433 goto new160;
6434 }
6435 E=am(bl1->p1[i]+bl1->p1[l1],bl1->p2[i]+bl1->p2[l1],bl1->p3[i]+bl1->p3[l1],bl1->eps[i]+bl1->eps[l1]);
6436 if (E < 1925.0) {
6437 continue;
6438 }
6439 iy=bl1->ind1[i]+bl1->ind1[l1];
6440 if (iy != 1) {
6441 goto new161;
6442 }
6443 ix=i*(bl1->ind1[i])+l1*(bl1->ind1[l1]);
6444 bl6->xx10=am(bl1->p1[ix],bl1->p2[ix],bl1->p3[ix],bl1->eps[ix]);
6445 bl6->isa=bl1->ind2[ix];
6446 new161:
6447 // assert(isnan(E) == false);
6448 // assert(isnan(iy) == false);
6449 // assert(isnan(bl1->ind2[i]) == false);
6450 // assert(isnan(bl1->ind2[l1]) == false);
6451 if ((31.*(bl3->rab2)) > totalCrossSection(E ,iy,bl1->ind2[i]+bl1->ind2[l1])) {
6452 continue;
6453 }
6454 new160: //continue
6455 bl2->k=bl2->k+1;
6456 bl2->crois[bl2->k]=bl1->ta;
6457 bl2->ind[bl2->k]=l1;
6458 bl2->jnd[bl2->k]=i;
6459 continue;
6460 new154:
6461 time(i, l1);
6462 if(bl1->ta < 0.) {
6463 continue;
6464 }
6465 if(bl1->ta > bl4->tmax5) {
6466 continue;
6467 }
6468 if ((bl1->ind1[i]+bl1->ind1[l1]) > 0) {
6469 goto new170;
6470 }
6471 E=am(bl1->p1[i]+bl1->p1[l1],bl1->p2[i]+bl1->p2[l1],bl1->p3[i]+bl1->p3[l1],bl1->eps[i]+bl1->eps[l1]);
6472 if (E < 1925.0) {
6473 continue;
6474 }
6475 iy=bl1->ind1[i]+bl1->ind1[l1];
6476 if (iy != 1) {
6477 goto new171;
6478 }
6479 ix=i*(bl1->ind1[i])+l1*(bl1->ind1[l1]);
6480 bl6->xx10=am(bl1->p1[ix],bl1->p2[ix],bl1->p3[ix],bl1->eps[ix]);
6481 bl6->isa=bl1->ind2[ix];
6482 new171:
6483 // assert(isnan(E) == false);
6484 // assert(isnan(iy) == false);
6485 // assert(isnan(bl1->ind2[i]) == false);
6486 // assert(isnan(bl1->ind2[l1]) == false);
6487 if ((31.0*(bl3->rab2)) > totalCrossSection(E,iy,bl1->ind2[i]+bl1->ind2[l1])) {
6488 continue;
6489 }
6490 new170:
6491 bl2->k=bl2->k+1;
6492 bl2->crois[bl2->k]=bl1->ta;
6493 bl2->ind[bl2->k]=i;
6494 bl2->jnd[bl2->k]=l1;
6495 }
6496 // std::ofstream newout("new1Dump.out");
6497 // dumpBl2(newout);
6498 // dumpBl5(newout);
6499 // newout.close();
6500 // exit(0);
6501}
6502
6503void G4Incl::new2(G4double y1, G4double y2, G4double y3, G4double q1, G4double q2, G4double q3,
6504 G4double q4, G4int npion, G4int l1)
6505{
6506 G4double t[10];
6507
6508 G4int ia = bl3->ia1 + bl3->ia2;
6509 for(G4int i = 1; i <= ia; i++) {
6510 if (bl5->nesc[i] != 0) {
6511 continue;
6512 }
6513 if(i == l1) {
6514 continue;
6515 }
6516 if(bl1->ind1[i] == 1) {
6517 continue;
6518 }
6519
6520 assert(q4 != 0);
6521 assert(bl1->eps[i] != 0);
6522 t[0] = bl1->p1[i]/bl1->eps[i] - q1/q4;
6523 t[1] = bl1->p2[i]/bl1->eps[i] - q2/q4;
6524 t[2] = bl1->p3[i]/bl1->eps[i] - q3/q4;
6525 t[3] = bl3->x1[i] - y1;
6526 t[4] = bl3->x2[i] - y2;
6527 t[5] = bl3->x3[i] - y3;
6528 t[6] = t[0]*t[3] + t[1]*t[4] + t[2]*t[5];
6529
6530 if(t[6] > 0.0) {
6531 continue;
6532 }
6533
6534 t[9] = t[0]*t[0] + t[1]*t[1] + t[2]*t[2];
6535 bl1->ta = -1 * t[6]/t[9];
6536 if(bl1->ta > bl4->tmax5) {
6537 continue;
6538 }
6539 G4double xx2 = t[3]*t[3] + t[4]*t[4] + t[5]*t[5] + (bl1->ta)*t[6];
6540 G4double E = std::sqrt(std::pow((bl1->eps[i]+q4),2) - std::pow((bl1->p1[i]+q1),2) - std::pow((bl1->p2[i]+q2),2) - std::pow((bl1->p3[i]+q3),2));
6541 // assert(isnan(E) == false);
6542 if ((31.0*xx2) > pionNucleonCrossSection(E)) {
6543 continue;
6544 }
6545 bl2->k=bl2->k+1;
6546 bl2->crois[bl2->k]=bl1->ta;
6547 bl2->ind[bl2->k]=ia+npion;
6548 bl2->jnd[bl2->k]=i;
6549 }
6550}
6551
6552void G4Incl::new3(G4double y1, G4double y2, G4double y3, G4double q1, G4double q2, G4double q3,
6553 G4double q4, G4int npion, G4int l1)
6554{
6555 G4double t[10];
6556 G4double E, xx2;
6557 G4int ia;
6558
6559 if(bl5->nesc[l1] > 0) {
6560 return;
6561 }
6562
6563 assert(q4 != 0);
6564 assert(bl1->eps[l1] != 0);
6565 t[0] = bl1->p1[l1]/bl1->eps[l1] - q1/q4;
6566 t[1] = bl1->p2[l1]/bl1->eps[l1] - q2/q4;
6567 t[2] = bl1->p3[l1]/bl1->eps[l1] - q3/q4;
6568 t[3] = bl3->x1[l1] - y1;
6569 t[4] = bl3->x2[l1] - y2;
6570 t[5] = bl3->x3[l1] - y3;
6571 t[6] = t[0]*t[3] + t[1]*t[4] + t[2]*t[5];
6572
6573 if(t[6] > 0.0) {
6574 return;
6575 }
6576
6577 t[9] = t[0]*t[0] + t[1]*t[1] + t[2]*t[2];
6578 bl1->ta = -1 * t[6]/t[9];
6579 if(bl1->ta > bl4->tmax5) {
6580 return;
6581 }
6582 if (bl1->ta < bl5->tlg[l1]) {
6583 return;
6584 }
6585 xx2 = t[3]*t[3] + t[4]*t[4] + t[5]*t[5] + (bl1->ta)*t[6];
6586 E = std::sqrt(std::pow((bl1->eps[l1]+q4),2) - std::pow((bl1->p1[l1]+q1),2) - std::pow((bl1->p2[l1]+q2),2) - std::pow((bl1->p3[l1]+q3),2));
6587 // assert(isnan(E) == false);
6588 if ((31.0*xx2) > pionNucleonCrossSection(E)) {
6589 return;
6590 }
6591
6592 bl2->k = bl2->k + 1;
6593 bl2->crois[bl2->k] = bl1->ta;
6594 ia = bl3->ia1+bl3->ia2;
6595 bl2->ind[bl2->k] = ia + npion;
6596 bl2->jnd[bl2->k] = l1;
6597}
6598
6599void G4Incl::loren(G4double *q1, G4double *q2, G4double *q3, G4double *b1, G4double *b2, G4double *b3, G4double *E)
6600{
6601 // Transforms momentum q and energy E from a frame moving with
6602 // velocity beta
6603
6604 G4double bb2 = (*b1) * (*b1) + (*b2) * (*b2) + (*b3) * (*b3);
6605 G4double bq = (*b1) * (*q1) + (*b2) * (*q2) + (*b3) * (*q3);
6606 G4double gam2 = 1.0/(1.0 - bb2);
6607 G4double gam = std::sqrt(gam2);
6608 G4double c = gam2/(gam + 1.0);
6609 G4double g = c * bq + gam*(*E);
6610 (*E) = gam * ((*E) + bq);
6611 (*q1) = (*q1) + (*b1) * g;
6612 (*q2) = (*q2) + (*b2) * g;
6613 (*q3) = (*q3) + (*b3) * g;
6614}
6615
6616G4double G4Incl::pauliBlocking(G4int l, G4double xr, G4double pr)
6617{
6618 // G4int l = (*l_p);
6619 // G4double xr = (*xr_p);
6620 // G4double pr = (*pr_p);
6621 // G4double f = (*f_p);
6622
6623 // This subroutine calculates the occupation in phase space around
6624 // nucleon l , by counting the particles in a volume around l the
6625 // volume is the product of a sphere of radius xr in r-space by a
6626 // sphere of radius pr in momentum space average is taken on the spin
6627 // only
6628
6629 // 3756 common/bl1/p1(300),p2(300),p3(300),eps(300),ind1(300),ind2(300),tap-n24950
6630 // 3757 common/bl3/r1,r2,x1(300),x2(300),x3(300),ia1,ia2,rab2 p-n24960
6631 // 3758 common/bl5/tlg(300),nesc(300) p-n24970
6632 // 3759 common/saxw/ xx(30,500),yy(30,500),ss(30,500),nbpG4inter,imat
6633 // 3760 common/ws/r0,adif,rmaxws,drws,nosurf,xfoisa,npaulstr,bmax
6634
6635 G4double pmod, pr2;
6636 G4double xr2, rdeq, dx2, dp2;
6637 G4double rs, vol;
6638 G4int nl;
6639 G4int ia;
6640
6641 if (ws->npaulstr == 2) {
6642 return 0.0;
6643 }
6644
6645 if (ws->npaulstr == 1) {
6646 // pauli strict
6647 pmod = std::sqrt(std::pow(bl1->p1[l],2) + std::pow(bl1->p2[l],2) + std::pow(bl1->p3[l],2));
6648 if (pmod < 270.0) {
6649 return 1.0;
6650 }
6651 else {
6652 return 0.0;
6653 }
6654 }
6655 else {
6656 // Statistic Pauli blocking
6657 xr2 = xr*xr;
6658 pr2 = pr*pr;
6659 vol = std::pow((40.0*3.1415926/3.0),2) * (std::pow((xr*pr)/(2.0*3.1415926*197.13),3));
6660 rs = std::sqrt(bl3->x1[l]*bl3->x1[l] + bl3->x2[l]*bl3->x2[l] + bl3->x3[l]*bl3->x3[l]);
6661 // assert(isnan(rs) == false);
6662 if (ws->nosurf <= 0) {
6663 // modifs a.b.: r2 -> rmaxws pour la densite en w.s.
6664 rdeq = ws->rmaxws;
6665 }
6666 else {
6667 rdeq = ws->r0;
6668 }
6669
6670 if ((rs - xr) <= rdeq) {
6671 if ((rs + xr) > rdeq) {
6672 vol = vol*0.5*(rdeq-rs+xr)/xr;
6673 }
6674
6675 ia = bl3->ia1 + bl3->ia2;
6676 nl = 0;
6677
6678 for(G4int i = 1; i <= ia; i++) {
6679 dx2 = std::pow((bl3->x1[l]-bl3->x1[i]),2) + std::pow((bl3->x2[l]-bl3->x2[i]),2) + std::pow((bl3->x3[l]-bl3->x3[i]),2);
6680 dp2 = std::pow((bl1->p1[l]-bl1->p1[i]),2) + std::pow((bl1->p2[l]-bl1->p2[i]),2) + std::pow((bl1->p3[l]-bl1->p3[i]),2);
6681
6682 if((bl5->nesc[i] > 0) || (bl1->ind1[i] > 0) || (bl1->ind2[i] != bl1->ind2[l]) || (dx2 > xr2) || (dp2 > pr2)) {
6683 if(((nl - 1)/vol/2.0) > 1.0) {
6684 return 1.0;
6685 }
6686 else {
6687 return ((nl - 1)/vol/2.0);
6688 }
6689 }
6690 nl = nl + 1;
6691 }
6692 }
6693 else {
6694 return 0.0;
6695 }
6696 }
6697
6698 return 0.0; // The algorithm is not supposed to reach this point.
6699}
6700
6701G4double G4Incl::lowEnergy(G4double E, G4double m, G4double i)
6702{
6703 // fit by j.vandermeulen
6704 // low enrgy fit of j.c., d. l'hote, j. vdm, nim b111(1996)215
6705 // i = 2,0,-2 for pp,pn,nn
6706 // m = 0,1,2 for nucleon-nucleon,nucleon-delta,delta,delta
6707
6708 G4double scale = 1.0;
6709 G4double plab = E*std::sqrt(E*E-3.52e6)/1876.6;
6710 G4double p1 = 0.001*plab;
6711 G4double alp;
6712
6713 if(plab > 2000.0) {
6714 // goto sel13;
6715 // sel13:
6716 return ((77.0/(p1 + 1.5))*scale);
6717 }
6718
6719 if((m-1) < 0) {
6720 if (i == 0) {
6721 if (plab < 800.0) {
6722 if (plab < 450.0) {
6723 alp = std::log(p1);
6724 return(6.3555*std::exp(-3.2481*alp - 0.377*alp*alp));
6725 }
6726 else {
6727 return((33.0 + 196.0*std::sqrt(std::fabs(std::pow((p1 - 0.95),5))))*scale);
6728 }
6729 }
6730 else {
6731 return(31.0/std::sqrt(p1)*scale);
6732 }
6733 }
6734 }
6735
6736 if (plab < 800.0) {
6737 if (plab < 440.0) {
6738 return(34.0*std::pow((p1/0.4),(-2.104)));
6739 }
6740 else {
6741 return((23.5 + 1000.*std::pow((p1 - 0.7),4))*scale);
6742 }
6743 }
6744 else if(plab > 2000.0) {
6745 return ((77.0/(p1 + 1.5))*scale);
6746 }
6747 else {
6748 return((1250.0/(50.0 + p1) - 4.0*std::pow((p1 - 1.3),2))*scale);
6749 }
6750}
6751
6752G4double G4Incl::totalCrossSection(G4double E, G4int m, G4int i)
6753{
6754 // total cross-sections
6755 // i=2,0,-2 for pp,pn,nn
6756 // m=0,1,2 for nucleon-nucleon,nucleon-delta,delta,delta
6757
6758 G4double stotResult;
6759 G4double sine = 0.0;
6760
6761 if((m-1) < 0) {
6762 // assert(isnan(E) == false);
6763 // assert(isnan(i) == false);
6764 sine = deltaProductionCrossSection(E,int(i));
6765 }
6766
6767 if((m-1) == 0) {
6768 sine = srec(E,(bl6->xx10),i,int(bl6->isa));
6769 }
6770
6771 if((m-1) > 0) {
6772 sine = 0.0;
6773 }
6774
6775 stotResult = sine + lowEnergy(E,m,i);
6776 // assert(isnan(stotResult) == false);
6777 return stotResult;
6778}
6779
6780G4double G4Incl::srec(G4double Ein, G4double d, G4int i, G4int isa)
6781{
6782 G4double E = Ein;
6783 G4double s;
6784 G4double x, y;
6785 G4double srecResult;
6786
6787 if (i*i == 16) {
6788 return 0.0;
6789 }
6790
6791 if(E <= (938.3 + d)) {
6792 return 0.0;
6793 }
6794 else {
6795 if(E < (938.3 + d + 2.0)) {
6796 E = 938.3 + d + 2.0;
6797 }
6798 s = E*E;
6799 x = (s - 3.523e6)/(s - std::pow((938.3 + d),2));
6800 y = s/(s - std::pow((d - 938.3),2));
6801 // assert(isnan(E) == false);
6802 // assert(isnan(i) == false);
6803 srecResult = 0.5*x*y*deltaProductionCrossSection(E, i);
6804 srecResult = srecResult*(32.0 + i*i*(isa*isa - 5))/64.0;
6805 srecResult = srecResult/(1.0 + 0.25*i*i);
6806 srecResult = 3.0*srecResult; //pi absorption increased also for internal pions (7/3/01)
6807
6808 return srecResult;
6809 }
6810}
6811
6812G4double G4Incl::deltaProductionCrossSection(G4double E, G4int i)
6813{
6814 // delta production cross-sections
6815 // fit by j.vandermeulen
6816 // i = 2,0,-2 for pp,pn,nn
6817
6818// G4double scali = 1.0;
6819// G4double plab;
6820// G4double p1;
6821// G4double sproResult;
6822
6823// G4double EE = E - bl8->rathr;
6824
6825// if(EE*EE-3.53e6 < 0) {
6826// return 0.0;
6827// }
6828// else {
6829// plab = EE*std::sqrt(EE*EE-3.52e6)/1876.6;
6830// p1 = 0.001*plab;
6831// if (plab > 800.0) {
6832// //goto spro1;
6833// // spro1:
6834// if (i*i == 4) {
6835// // goto spro10;
6836// //spro10:
6837// if (plab < 2000.0) {
6838// // goto spro11;
6839// // spro11:
6840// if (plab < 1500.0) {
6841// // goto spro12;
6842// // spro12:
6843// sproResult = 23.5 + 24.6/(1.0 + std::exp(-10.0*p1 + 12.0)) - 1250.0/(p1+50.0)+4.0*std::pow((p1-1.3),2);
6844// return (sproResult*scali);
6845// }
6846// else {
6847// sproResult = 41.0 + 60.0*(p1 - 0.9)*std::exp(-1.2*p1) - 1250.0/(p1+50.0) + 4.*std::pow((p1 - 1.3),2);
6848// return (sproResult*scali);
6849// }
6850// }
6851// else {
6852// return ((41.0 + (60.0*p1 - 54.0)*std::exp(-1.2*p1) - 77.0/(p1 + 1.5))*scali);
6853// }
6854// }
6855// else {
6856// if (plab < 2000.0) {
6857// //goto spro2;
6858// // spro2:
6859// if (plab < 1000.0) {
6860// //goto spro3;
6861// // spro3:
6862// return ((33.0 + 196.0*std::sqrt(std::pow(std::fabs(p1 - 0.95),5)) - 31.1/std::sqrt(p1))*scali);
6863// }
6864// else {
6865// return ((24.2 + 8.9*p1 - 31.1/std::sqrt(p1))*scali);
6866// }
6867// }
6868// else {
6869// return ((42.-77./(p1+1.5))*scali);
6870// }
6871// }
6872// }
6873// // plab <= 800.0
6874// else {
6875// return 0.0;
6876// }
6877// }
6878 double scali=1.0;
6879 double plab;
6880 double p1;
6881 double sproResult;
6882
6883 double EE=E-(bl8->rathr);
6884
6885 // assert(isnan(EE) == false);
6886 if(EE*EE-3.53e6 < 0) {
6887 goto spro22;
6888 }
6889 plab=EE*std::sqrt(EE*EE-3.52e6)/1876.6;
6890 // assert(isnan(plab) == false);
6891 p1=0.001*plab;
6892 if (plab > 800.) {
6893 goto spro1;
6894 }
6895 spro22:
6896 sproResult=0.0;
6897 return sproResult;
6898
6899 spro1:
6900 if (i*i == 4) {
6901 goto spro10;
6902 }
6903 if (plab < 2000.) {
6904 goto spro2;
6905 }
6906 sproResult=(42.-77./(p1+1.5))*scali;
6907 return sproResult;
6908 spro2: if (plab < 1000.) {
6909 goto spro3;
6910 }
6911 sproResult=(24.2+8.9*p1-31.1/std::sqrt(p1))*scali;
6912 return sproResult;
6913 spro3: sproResult=(33.0 + 196.0*std::sqrt(std::pow(std::fabs(p1-0.95),5))-31.1/std::sqrt(p1))*scali;
6914 return sproResult;
6915 spro10: if (plab < 2000.) {
6916 goto spro11;
6917 }
6918 sproResult=(41.+(60.*p1-54.)*std::exp(-1.2*p1)-77./(p1+1.5))*scali;
6919 return sproResult;
6920 spro11: if (plab < 1500.) {
6921 goto spro12;
6922 }
6923 sproResult=41.+60.*(p1-0.9)*std::exp(-1.2*p1)-1250./(p1+50.)+4.*std::pow((p1-1.3),2);
6924 sproResult=sproResult*scali;
6925 return sproResult;
6926 spro12: sproResult=23.5+24.6/(1.+std::exp(-10.*p1+12.))-1250./(p1+50.)+4.*std::pow((p1-1.3),2);
6927 sproResult=sproResult*scali;
6928 return sproResult;
6929
6930}
6931
6932G4double G4Incl::pionNucleonCrossSection(G4double x)
6933{
6934 // sigma(pi+ + p) in the (3,3) region
6935 // new fit by j.vandermeulen + constant value above the (3,3)
6936 // resonance
6937
6938 G4double y = x*x;
6939 G4double q2 = (y-std::pow(1076.0,2))*(y-std::pow(800.0,2))/y/4.0;
6940 assert(q2 >= 0);
6941 G4double q3, f3;
6942 G4double spn;
6943
6944 if(q2 <= 0) {
6945 return 0.0;
6946 }
6947 else {
6948 q3 = std::pow((std::sqrt(q2)),3);
6949 f3 = q3/(q3+std::pow(180.0,3));
6950 spn = 326.5/(std::pow(((x - 1215.0 - bl8->ramass)*2.0/110.0),2)+1.0);
6951 spn = spn*(1.0 - 5.0 * (bl8->ramass/1215.0));
6952 return (spn*f3);
6953 }
6954}
6955
6956G4double G4Incl::transmissionProb(G4double E, G4double iz, G4double izn, G4double r, G4double v0)
6957{
6958 // transmission probability for a nucleon of kinetic energy
6959 // E on the edge of the well of depth v0 (nr approximation)
6960 // iz is the isospin of the nucleon,izn the instanteneous charge
6961 // of the nucleus and r is the target radius
6962
6963 G4double x;
6964 G4double barr = 0.0;
6965
6966 // We need enough energy to escape from the potential well.
6967 if (E > v0) {
6968 x = std::sqrt(E*(E-v0));
6969 // assert(isnan(x) == false);
6970 barr = 4.*x/(E+E-v0+x+x);
6971 // assert(isnan(barr) == false);
6972 if (iz > 0) {
6973 G4double b = izn*1.44/r;
6974 G4double px = std::sqrt((E-v0)/b);
6975 // assert(isnan(px) == false);
6976
6977 if (px < 1.0) {
6978 G4double g = izn/137.03*std::sqrt(2.*938.3/(E-v0))*(std::acos(px)-px*std::sqrt(1.-px*px));
6979 // assert(isnan(g) == false);
6980 if (g > 35.){
6981 barr=0.0;
6982 }
6983 else {
6984 barr = barr*std::exp(-2.0*g);
6985 }
6986 return barr;
6987 }
6988 else {
6989 return barr;
6990 }
6991 }
6992 else {
6993 return barr;
6994 }
6995 }
6996 else {
6997 return barr;
6998 }
6999}
7000
7001G4double G4Incl::ref(G4double x1, G4double x2, G4double x3, G4double p1, G4double p2, G4double p3, G4double E, G4double r2)
7002{
7003 const G4double pf = 270.339 , pf2 = 73083.4;
7004
7005 G4double ref;
7006 G4double t1, t3, t4, t5;
7007
7008 G4double t2 = p1*p1+p2*p2+p3*p3;
7009 assert(t2 >= 0);
7010 G4double p = std::sqrt(t2);
7011 G4double r = r2;
7012 G4double xv;
7013 G4double s;
7014
7015 if (ws->nosurf <= 0) {
7016 xv = p/pf;
7017 // assert(isnan(xv) == false);
7018 r = interpolateFunction(xv);
7019 // assert(isnan(r) == false);
7020 r = r*r;
7021 if (t2 > pf2) {
7022 r = std::pow(ws->rmaxws,2);
7023 }
7024 }
7025
7026 t4 = x1*x1 + x2*x2 + x3*x3;
7027 while(t4 > r) {
7028 s = std::sqrt(r*0.99/t4);
7029 x1 = x1*s;
7030 x2 = x2*s;
7031 x3 = x3*s;
7032 t4 = x1*x1 + x2*x2 + x3*x3;
7033 }
7034
7035 t1 = x1*p1 + x2*p2 + x3*p3;
7036 t3 = t1/t2;
7037
7038 t5 = t3*t3 + (r - t4)/t2;
7039 if (t5 > 0) {
7040 ref = (-t3 + std::sqrt(t5))*E;
7041 // assert(isnan(ref) == false);
7042 return ref;
7043 }
7044 else {
7045 ref = 10000.0;
7046 return ref;
7047 }
7048}
7049
7050// void G4Incl::forceAbsor(G4int nopart, G4double iarem, G4double izrem, G4double esrem, G4double erecrem,
7051// G4double alrem, G4double berem, G4double garem, G4double jrem)
7052void G4Incl::forceAbsor(G4int *nopart, G4int *iarem, G4int *izrem, G4double *esrem, G4double *erecrem,
7053 G4double *alrem, G4double *berem, G4double *garem, G4int *jrem)
7054{
7055 // 4341 C------------------------------------------------------------------------------
7056 // 4342 SUBROUTINE FORCE_ABSOR(nopart,F,IAREM,IZREM,ESREM,ERECREM,
7057 // 4343 s ALREM,BEREM,GAREM,JREM)
7058
7059 // 4346 DIMENSION F(15)
7060 // 4347 REAL*4 ia1,iz1
7061 // 4348
7062 // 4349 COMMON/hazard/ial,IY(19)
7063 // 4350 C Dialogue with INCL for nucleus density and parameters.
7064 // 4351 COMMON/WS/R0,ADIF,RMAXWS,DRWS,NOSURF,XFOISA,NPAULSTR,BMAX
7065 // 4352 C RMS espace R, espace P, Fermi momentum and energy for light gauss nuc.
7066 // 4353 COMMON/light_gaus_nuc/rms1t(9),pf1t(9),pfln(9),tfln(9),vnuc(9)
7067
7068 G4int itg = 0;
7069 G4double sep = 0.0;
7070 G4double iz1 = 0.0;
7071 G4double del = 0.0;
7072 G4double bmaxt = 0.0;
7073 G4double proba, proba_trans;
7074 G4double alea;
7075
7076 if((*nopart) != -1) {
7077 return;
7078 }
7079
7080 bl3->ia2 = int(calincl->f[0]); // f(1) -> f[0]
7081 sep = 6.8309;
7082
7083 if(bl3->ia2 <= 4) {
7084 if(bl3->ia2 == 2) {
7085 itg = 6 - 1;
7086 }
7087 if(bl3->ia2 == 3 && calincl->f[1] == 1) {
7088 itg = 7 - 1;
7089 }
7090 if(bl3->ia2 == 3 && calincl->f[1] == 2) {
7091 itg = 8 - 1;
7092 }
7093 if(bl3->ia2 == 4) {
7094 itg = 9 - 1;
7095 }
7096 sep = light_gaus_nuc->vnuc[itg] - light_gaus_nuc->tfln[itg]; // :::BUG::: Off-by-one!!!
7097 }
7098
7099 if((calincl->f[2] >= 10.0) && (calincl->f[2] <= 100.0)) {
7100 if(calincl->f[6] == 1.0) {
7101 bl3->ia1 = int(1.0);
7102 iz1 = 1.0;
7103 G4double fmpinc = 938.2796;
7104 G4double pbeam2 = calincl->f[2]*(calincl->f[2] + 2.0*fmpinc);
7105 bmaxt = ws->bmax;
7106 proba_trans = coulombTransm(calincl->f[2],bl3->ia1,iz1,calincl->f[0],calincl->f[1]);
7107 // assert(isnan(proba_trans) == false);
7108
7109 proba = forceAbs(1,calincl->f[0],calincl->f[1],calincl->f[2],bmaxt,proba_trans);
7110 // assert(isnan(proba) == false);
7111
7112 standardRandom(&alea,&(hazard->igraine[4]));
7113 if(alea > proba) {
7114 return;
7115 }
7116
7117 (*iarem) = int(calincl->f[0]) + bl3->ia1;
7118 (*izrem) = int(calincl->f[1]) + int(iz1);
7119
7120 del = std::sqrt(std::pow(((calincl->f[0] + 1.0)*fmpinc + calincl->f[2]),2) - pbeam2);
7121 // assert(isnan(del) == false);
7122
7123 (*erecrem) = pbeam2/((calincl->f[0] + 1.0)*fmpinc+calincl->f[2] + del);
7124
7125 (*esrem) = calincl->f[2] + sep - (*erecrem);
7126
7127 (*alrem) = 0.00001;
7128 (*berem) = 0.0;
7129 (*garem) = 0.99999;
7130 (*jrem) = 0;
7131 (*nopart) = 0;
7132 return;
7133 }
7134 else if((calincl->f[6] == 2) && (calincl->f[2] >= 20.0)) {
7135 bl3->ia1 = int(1.0);
7136 iz1 = 0.0;
7137 G4double fmpinc = 938.2796;
7138 G4double pbeam2 = calincl->f[2]*(calincl->f[2] + 2.0*fmpinc);
7139 bmaxt = ws->bmax;
7140 proba_trans = coulombTransm(calincl->f[2],bl3->ia1,iz1,calincl->f[0],calincl->f[1]);
7141 // assert(isnan(proba_trans) == false);
7142
7143 proba = forceAbs(1,calincl->f[0],calincl->f[1],calincl->f[2],bmaxt,proba_trans);
7144 // assert(isnan(proba) == false);
7145
7146 standardRandom(&alea,&(hazard->igraine[4]));
7147 if(alea > proba) {
7148 return;
7149 }
7150
7151 (*iarem) = int(calincl->f[0]) + bl3->ia1;
7152 (*izrem) = int(calincl->f[1]) + int(iz1);
7153
7154 del = std::sqrt(std::pow(((calincl->f[0]+1.)*fmpinc+calincl->f[2]),2)-pbeam2);
7155 // assert(isnan(del) == false);
7156
7157 (*erecrem) = pbeam2/((calincl->f[0] + 1.0)*fmpinc + calincl->f[2] + del);
7158
7159 (*esrem) = calincl->f[2] + sep - (*erecrem);
7160
7161 (*alrem) = 0.00001;
7162 (*berem) = 0.0;
7163 (*garem) = 0.99999;
7164 (*jrem) = 0;
7165 (*nopart) = 0;
7166 return;
7167 }
7168 } // end if
7169}
7170
7171G4double G4Incl::forceAbs(G4double iprojo, G4double at, G4double zt, G4double ep, G4double bmax, G4double pt)
7172{
7173 // Results of xabs2 and sig_reac
7174 G4double sig_exp, sig_incl;
7175 G4double proba;
7176
7177 G4double ap,zp,A,Z,E;
7178 A=at;
7179 Z=zt;
7180 E=ep;
7181 double sig_g = 31.41592654*bmax*bmax;
7182 if(iprojo == 1) {
7183 ap = 1.0;
7184 zp = 1.0;
7185 }
7186 else {
7187 ap=1.0;
7188 zp=0.0;
7189 }
7190
7191 sig_exp = xabs2(zp, ap, zt, at, ep);
7192 // assert(isnan(sig_exp) == false);
7193
7194 sig_incl = crossSection(int(iprojo), ep, at);
7195 // assert(isnan(sig_incl) == false);
7196
7197 proba = (sig_exp-pt*sig_incl)/(pt*(sig_g - sig_incl));
7198 if(proba <= 0.0) {
7199 proba = 0.0;
7200 }
7201 if(proba > 1.0) {
7202 proba = 1.0;
7203 }
7204
7205 return proba;
7206}
7207
7208G4double G4Incl::xabs2(G4double zp, G4double ap, G4double zt, G4double at, G4double ep)
7209{
7210 G4double sig = 0.0;
7211
7212 G4double Const, xzt, xat, Const1 = 0.0, t1, gcm, bcm, plab, ecmp, ecmt, rela, ecm, rm, bigr, bigb;
7213 G4double xm, x1, sl, phst, ce, term1, delta, beta, twxsec;
7214 G4double xsec;
7215
7216 const G4double dp0 = 0.e0, dp1 = 1.e0, dp2 = 2.e0, dp3 = 3.e0, dph = 0.5e0;
7217 const G4double dp10 = 1.e1, dpth = dp1/dp3, dppi = 3.1415926535898;
7218
7219 // absoprption xsec revised version rkt-97/5 neutron data from
7220 // barashenkov this gives absorption xsec for given zp,ap,zt,at,e
7221 // (mev/nucleon) arguement changed to mev; then e=ep/ap mev/nucleon
7222 // can be used for neutrons also. this has coulomb as ours
7223
7224 G4double E = ep/ap;
7225
7226 // nucleon-nucleon inelastc xsec not included here
7227 if ((nint(ap*at) == 1) || (nint(zp+zt) == 1)) {
7228 return dp0;
7229 }
7230 G4double rp = radius(ap);
7231 G4double rt = radius(at);
7232 G4double vp = (dp1 + dpth)*dppi*std::pow(rp,3);
7233 G4double vt = (dp1 + dpth)*dppi*std::pow(rt,3);
7234 G4double density = dph*((ap/vp) + (at/vt));
7235 Const=1.75e0*density/8.824728e-02;
7236
7237 if ((zt < zp) || ((zt == zp) && (at < ap))) {
7238 xzt = zp;
7239 xat = ap;
7240 zp = zt;
7241 ap = at;
7242 zt = xzt;
7243 at = xat;
7244 }
7245
7246 if (nint(ap) == 1) {
7247 Const=2.05;
7248 }
7249 if ((nint(zp) == 2) && (nint(ap) == 4)) {
7250 Const1 = 2.77 - at*8.0e-03 + (at*at)*1.8e-05;
7251 }
7252 if (nint(zp) == 3) {
7253 Const=Const/3.0;
7254 }
7255 t1=40.0;
7256 if (nint(zp) == 0) {
7257 if ((nint(at) >= 11) && (nint(at) < 40)) {
7258 t1=30.0;
7259 }
7260 if (nint(zt) == 14) {
7261 t1=35.0;
7262 }
7263 if (nint(zt) == 26) {
7264 t1=30.0;
7265 }
7266 }
7267
7268 gcm = (ap*(dp1 + E/938.0) + at)/(std::pow((std::pow(ap,2) + std::pow(at,2) + dp2*ap*(E + 938.0)*at/938.e0),dph));
7269 bcm = std::sqrt(dp1-dp1/(std::pow(gcm,2)));
7270 // assert(isnan(bcm) == false);
7271
7272 plab = ap*std::sqrt(dp2*938.0*E + E*E);
7273 // assert(isnan(plab) == false);
7274 ecmp = gcm*(E+938.0)*ap - bcm*gcm*plab - ap*938.0;
7275 ecmt = gcm*938.0*at - at*938.0;
7276 rela = ecmp + ecmt;
7277 ecm = rela;
7278 if (ecm < (0.1*rela)) {
7279 ecm = 0.1*rela;
7280 }
7281 rm = (197.32/137.01)*zp*zt/ecm;
7282 bigr = rp + rt + 1.2*(std::pow(ap,dpth) + std::pow(at,dpth))/(std::pow(ecm,dpth));
7283 // assert(isnan(bigr) == false);
7284
7285 bigb = 1.44*zp*zt/bigr;
7286 // assert(isnan(bigb) == false);
7287
7288 if ((nint(zp) == 1) && (nint(at) > 56)) {
7289 bigb = 0.90*bigb;
7290 }
7291 if ((nint(ap) > 56) && (nint(zt) == 1)) {
7292 bigb = 0.90*bigb;
7293 }
7294 if ((nint(ap) == 1) && (nint(at) == 12)) {
7295 bigb = 3.5*bigb;
7296 }
7297 if (nint(ap) == 1) {
7298 if ((nint(at) <= 16) && (nint(at) >= 13)) {
7299 bigb = (at/7.)*bigb;
7300 }
7301 if (nint(zt) == 12) {
7302 bigb = 1.8*bigb;
7303 }
7304 if (nint(zt) == 14) {
7305 bigb = 1.4*bigb;
7306 }
7307 if (nint(zt) == 20) {
7308 bigb = 1.3*bigb;
7309 }
7310 }
7311 if ((nint(ap) == 1) && (nint(at) < 4)) {
7312 bigb = 21.0*bigb;
7313 }
7314 if ((nint(ap) < 4) && (nint(at) == 1)) {
7315 bigb = 21.0*bigb;
7316 }
7317 if ((nint(ap) == 1) && (nint(at) == 4)) {
7318 bigb = 27.0*bigb;
7319 }
7320 if ((nint(ap) == 4) && (nint(at) == 1)) {
7321 bigb = 27.0*bigb;
7322 }
7323 if ((nint(zp) == 0) || (nint(zt) == 0)) {
7324 bigb = dp0;
7325 }
7326 xsec = dp10*dppi*bigr*bigr*(dp1-bigb/ecm);
7327 xm=1.0;
7328 if (nint(zp) == 0) {
7329 if (nint(at) < 200) {
7330 x1 = 2.83 - 3.1e-02*at + 1.7e-04*at*at;
7331 if (x1 <= 1) {
7332 x1=1.0;
7333 }
7334 sl=dp1;
7335 if (nint(at) == 12) {
7336 sl=1.6;
7337 }
7338 if (nint(at) < 12) {
7339 sl=0.6;
7340 }
7341 xm = (1 - x1*std::exp(-E/(sl*x1)));
7342 if (E < 20) {
7343 // cout <<"e,xm= " << e << " " << xm << endl;
7344 }
7345 }
7346 else {
7347 xm = (1-0.3*std::exp(-(E-1)/15))*(1 - std::exp(-(E-0.9)));
7348 }
7349 }
7350 if ((nint(zp) == 2) && (nint(ap) == 4)) {
7351 Const = Const1 - 0.8/(1 + std::exp((250.0-E)/75.0));
7352 }
7353 if ((nint(zp) == 1) && (nint(ap) == 1)) {
7354 if (nint(at) > 45) {
7355 t1 = 40.0 + at/dp3;
7356 }
7357 if (nint(at) < 4) {
7358 t1 = 55;
7359 }
7360 Const = 2.05 - 0.05/(1 + std::exp((250.0-E)/75.0));
7361 if (nint(at) < 4) {
7362 Const = 1.7;
7363 }
7364 if (nint(zt) == 12) {
7365 t1=40.0;
7366 Const=2.05 - dp3/(1.0 + safeExp((E - 20.0)/dp10));
7367 }
7368 if (nint(zt) == 14) {
7369 t1 = 40.0;
7370 Const = 2.05 - 1.75/(1.0 + safeExp((E - 20.0)/dp10));
7371 }
7372 if (nint(zt) == 18) {
7373 t1 = 40.0;
7374 Const = 2.05 - dp2/(1.0 + safeExp((E - 20.0)/dp10));
7375 }
7376 if (nint(zt) == 20) {
7377 t1 = 40.0;
7378 Const = 2.05 - dp1/(1.0 + safeExp((E - 40.0)/dp10));
7379 Const = Const - 0.25/(1 + std::exp((250.0 - E)/75.0));
7380 }
7381 if (nint(zt) >= 35) {
7382 phst = (nint(zt)-35.e0)/260.e0;
7383 Const = Const - phst/(1 + std::exp((250.0 - E)/75.0));
7384 }
7385 }
7386
7387 if ((nint(zp) == 0) && (nint(ap) == 1)) {
7388 Const = 2*(0.134457/density);
7389 if ((nint(at) > 140) && (nint(at) <200)) {
7390 Const = Const - 1.5*(at - dp2*zt)/at;
7391 }
7392 if (nint(at) < 60) {
7393 Const = Const - 1.5*(at - dp2*zt)/at;
7394 }
7395 if (nint(at) <= 40) {
7396 Const = Const + 0.25/(dp1 + safeExp(-(170.0 - E)/100.0));
7397 }
7398 if (nint(zt) > 82) {
7399 Const = Const - zt/(at - zt);
7400 }
7401 if (nint(zt) >= 82) {
7402 Const = Const - dp2/(1.0 + safeExp((E - 20.0)/20.0));
7403 }
7404 if ((nint(zt) <= 20) && (nint(zt) >= 10)) {
7405 Const = Const - dp1/(dp1 + safeExp((E - 20.0)/dp10));
7406 }
7407 }
7408
7409 ce = Const * (1.0 - std::exp(-E/t1)) - 0.292*std::exp(-E / 792) * std::cos(0.229*std::pow(E,0.453));
7410 term1 = std::pow((at*ap),dpth)/(std::pow(at,dpth) + std::pow(ap,dpth));
7411 delta = 1.615*term1 - 0.873*ce;
7412 delta = delta + 0.140*term1/(std::pow(ecm,dpth));
7413 delta = delta + 0.794*(at - dp2*zt)*zp/(at*ap);
7414 delta = -delta;
7415 beta = 1.0;
7416 twxsec = dp10*dppi*1.26e0*1.26e0*beta*std::pow((0.873e0*std::pow(ap,dpth) + 0.873e0*std::pow(at,dpth)-delta),2);
7417 sig = twxsec*(dp1-bigb/ecm)*xm;
7418 if (sig < dp0) {
7419 sig = dp0;
7420 }
7421
7422// if(isnan(sig)) {
7423// sig = 0.0;
7424// }
7425
7426 return sig;
7427}
7428
7429void G4Incl::standardRandom(G4double *rndm, G4long *seed)
7430{
7431 (*seed) = (*seed); // Avoid warning during compilation.
7432 // Use Geant4 G4UniformRand
7433 (*rndm) = G4UniformRand();
7434}
7435
7436void G4Incl::gaussianRandom(G4double *rndm)
7437{
7438 // Gaussian random number generator
7439
7440 G4double tempRandom = 0.0, random = 0.0, randomShuffle = 0.0;
7441
7442 do {
7443 random = 0.0;
7444
7445 for(G4int i = 0; i < 12; i++) {
7446 standardRandom(&tempRandom, &(hazard->ial));
7447 random = random + tempRandom;
7448 }
7449
7450 random = random - 6.0;
7451 } while(random*random > 9);
7452
7453 // Shuffle the random seeds
7454 standardRandom(&randomShuffle, &(hazard->igraine[10]));
7455
7456 if(randomShuffle > 0.5) {
7457 standardRandom(&tempRandom, &(hazard->ial));
7458 }
7459
7460 (*rndm) = random;
7461}
7462
7463G4double G4Incl::safeExp(G4double x)
7464{
7465 if (x < -80.0) {
7466 x = -80.0;
7467 }
7468 if (x > 80.0) {
7469 x = 80.0;
7470 }
7471
7472 return std::exp(x);
7473}
7474
7475G4double G4Incl::radius(G4double A)
7476{
7477 const G4double dp1 = 1.0, dp3 = 3.0;
7478 const G4double dp5 = 5.0, dpth = dp1/dp3;
7479 const G4int naSize = 23;
7480 const G4int rmsSize = naSize;
7481
7482 const G4int na[naSize] = {1,2,3,4,6,7,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26};
7483
7484 const G4double rms[rmsSize] = {0.85,2.095,1.976,1.671,2.57,2.41,2.519,2.45,
7485 2.42,2.471,2.440,2.58,2.611,2.730,2.662,2.727,
7486 2.900,3.040,2.969,2.94,3.075,3.11,3.06};
7487
7488 G4double fact = std::sqrt(dp5/dp3);
7489 G4int ia = int(std::floor(A+0.4));
7490 G4double result = fact * (0.84 * std::pow(A,dpth) + 0.55);
7491 for(G4int i = 0; i < naSize; i++) {
7492 if (ia == na[i]) {
7493 result = fact*rms[i];
7494 }
7495 }
7496
7497 return result;
7498}
7499
7500G4double G4Incl::crossSection(G4int projectile, G4double E, G4double A)
7501{
7502 const G4double coefp[4][3] = {{ -5.9260e-9, 6.89450e-6, -6.0980e-6},
7503 { 2.1544e-6,-1.84800e-3, -5.9820e-4},
7504 { -2.5900e-4, 0.17595e+0, 1.1741e+0},
7505 { 1.1504e-3, 2.82810e+0,-28.7300e+0}};
7506
7507 const G4double coefn[4][3] = {{1.6105e-9,3.3985e-7,1.4678e-5},
7508 {-5.35e-7,-3.465e-4,-0.01633e+0},
7509 {-4.755e-6,0.07608e+0,2.8135e+0},
7510 {-3.622e-3,3.5924e+0,-38.294e+0}};
7511
7512 const G4double coef2p[5][3] = {{6.8108e-9,-2.163e-7,2.1898e-6},
7513 {-2.187e-6,7.8331e-5,-7.164e-4},
7514 {2.3651e-4,-9.690e-3,0.076424e+0},
7515 {-9.195e-3,0.5030e+0,-2.4979e+0},
7516 {-0.01087e+0,2.6494e+0,-2.5173e+0}};
7517
7518 G4double apow[3], epow[5];
7519 G4int ii, jj;
7520
7521 if(A >= 27.0) {
7522 ii = 3;
7523 jj = 4;
7524 }
7525 else {
7526 ii = 3;
7527 jj = 5;
7528 }
7529
7530 for(int i = 1; i <= ii; i++) {
7531 apow[i-1] = std::pow(A,(ii-i));
7532 }
7533
7534 for(int j = 1; j <= jj; j++) {
7535 epow[j-1] = std::pow(E,(jj-j));
7536 }
7537
7538 double result = 0.0;
7539
7540 if(A >= 27.0) {
7541 if(projectile == 1) {
7542 for(G4int i = 0; i < ii; i++) {
7543 for(G4int j = 0; j < jj; j++) {
7544 result = result + coefp[j][i]*apow[i]*epow[j];
7545 }
7546 }
7547 }
7548 else {
7549 for(G4int i = 0; i < ii; i++ ) {
7550 for(G4int j = 0; j < jj; j++) {
7551 result = result + coefn[j][i]*apow[i]*epow[j];
7552 }
7553 }
7554 }
7555 }
7556 else {
7557 for(G4int i = 0; i < ii; i++) {
7558 for(G4int j = 0; j < jj; j++) {
7559 result = result + coef2p[j][i]*apow[i]*epow[j];
7560 }
7561 }
7562 }
7563
7564 return result;
7565}
7566
7567G4double G4Incl::coulombTransm(G4double E, G4double fm1, G4double z1, G4double fm2, G4double z2)
7568{
7569 G4double eta,rho;
7570 const G4double c2 = 0.00516;
7571 const G4double c3 = 0.007165;
7572 const G4double uma = 938.0;
7573 G4double ml;
7574
7575 G4double ecm = E*fm2/(fm1+fm2);
7576 G4double fm = fm1*fm2*uma/(fm1+fm2);
7577 G4double r1 = 0.0;
7578 G4double r2 = 0.0;
7579 if(fm1 >= 2.0) {
7580 r1 = 1.2*std::pow(fm1,0.33333333);
7581 }
7582 r2 = 1.2*std::pow(fm2,0.33333333);
7583 eta = c2*z1*z2*std::sqrt(fm/ecm);
7584 rho = c3*(r1+r2)*std::sqrt(fm*ecm);
7585
7586 return clmb1(rho,eta,&ml);
7587}
7588
7589G4double G4Incl::clmb1(G4double rho, G4double eta, G4double *ml)
7590{
7591 const G4double dp1 = 1.0, dp2 = 2.e0, dp4 = 4.e0, dph = 0.5, dp5 = 5.0;
7592
7593 const G4double prm1 = 69.06;
7594 const G4int ln0 = 81, lt0 = 21;
7595 const G4int ln1 = 61, lt1 = 61;
7596 static G4double psi0[ln0], trans0[lt0][ln0], x0[lt0], f0[ln0], psi1[ln1];
7597 static G4double trans1[lt1][ln1], x1[lt1], f1[ln1];
7598
7599 const G4double pi = 3.14159;
7600 const G4double c0 = 0.11225, c1 = dph, gamma = 0.5772157e0, s3 = 0.2020569;
7601 const G4double s4 = 0.08232323;
7602 static G4double y = dp2*eta;
7603 static G4double psi = rho*y;
7604
7605 static G4int i0, j0;
7606
7607 static G4double prob;
7608 static G4double dumm, x, cx;
7609 static G4double t, t1, t2, t3;
7610 static G4double f, g;
7611 static G4double temp, temp1, temp2;
7612 static G4double xk, delp0, delp1, delx0, delx1;
7613
7614 if (rho > y) {
7615 if (psi > dp4 && psi < 50.0) {
7616 prob = clmb2(rho,eta,&dumm);
7617 }
7618 else {
7619 x = std::exp(std::log(eta)/6.0);
7620 prob = std::sqrt(dp1 - y*x/(c0 + c1 * std::pow(x,3) + rho * x));
7621 }
7622 (*ml) = 0;
7623 }
7624 else {
7625 x = rho/y;
7626 if (psi <= psi0[0]) {
7627 t = min(pi*y,prm1);
7628 cx = t/(std::exp(t) - dp1);
7629 t1 = std::cos(rho) * (dp1-0.75*std::pow(psi,2) + dp5 * x * std::pow(psi,2)) - dph * psi * rho * std::sin(rho);
7630 t2 = dp1 + dph * psi * (dp1 - x/6.0);
7631 if (eta > dp1) {
7632 t3 = std::log(psi)+dp2*gamma - dp1 + dp1/(12.e0*std::pow(eta,2))+dp1/(12.e1*std::pow(eta,4));
7633 }
7634 else {
7635 t3 = std::log(dp2*rho) + gamma - dp1/(dp1 + std::pow(eta,2)) + s3*std::pow(eta,2) + s4*std::pow(eta,4);
7636 }
7637 g = t1 + psi*t2*t3;
7638 f = cx*rho*t2;
7639 prob = cx/(std::pow(g,2)+std::pow(f,2));
7640 (*ml) = 3;
7641 }
7642 else if (psi <= psi0[ln0-1]) {
7643 if (x <= x0[0]) {
7644 temp = std::log(psi/psi0[0]);
7645 j0 = 1 + int(temp/delp0);
7646 j0 = min(max(j0,1),(ln0-1));
7647 temp = temp - (j0-1)*delp0;
7648 t = f0[j0] + (f0[j0+1] - f0[j0])*temp/delp0;
7649 xk = x*std::sqrt(psi);
7650 prob = (dp1+3.33e-1*x+3.e-1*xk+1.e-1*std::pow(xk,2))*std::exp(t);
7651 t = min(pi*y,prm1);
7652 cx = t/(std::exp(t)-dp1);
7653 prob = cx/std::pow(prob,2);
7654 (*ml) = 1;
7655 }
7656 else {
7657 temp1 = std::log(x/x0[0]);
7658 i0 = min(max(1 + int(temp1/delx0),1),lt0-1);
7659 temp1 = temp1 - (i0 - 1)*delx0;
7660 temp2 = std::log(psi/psi0[0]);
7661 j0 = min(max(1+int(temp2/delp0),1),ln0-1);
7662 temp2 = temp2-(j0-1)*delp0;
7663 t1 = trans0[i0][j0] + (trans0[i0+1][j0] - trans0[i0][j0]) * temp1/delx0;
7664 t2 = trans0[i0][j0+1] + (trans0[i0+1][j0+1] - trans0[i0][j0+1]) * temp1/delx0;
7665 prob = std::exp(t1 + (t2 - t1)*temp2/delp0);
7666 (*ml)=2;
7667 }
7668 }
7669 else if (psi <= psi1[ln1-1]) {
7670 if (x <= x1[0]) {
7671 temp = std::log(psi/psi1[0]);
7672 j0 = min(max(1+int(temp/delp1), 1), ln1-1);
7673 t = f1[j0]+(f1[j0+1]-f1[j0])*(temp - (j0 - 1)*delp1)/delp1;
7674 xk = x*std::sqrt(psi);
7675 prob = (dp1+3.33e-1*x+3.0e-1*xk+1.e-1*std::pow(xk,2))*std::exp(t);
7676 t = min(pi*y,prm1);
7677 cx = t/(std::exp(t)-dp1);
7678 prob = cx/std::pow(prob,2);
7679 (*ml) = 1;
7680 }
7681 else {
7682 temp1 = std::log(x/x1[0]);
7683 i0 = min(max(1+int(temp1/delx1),1),lt1-1);
7684 temp1 = temp1-(i0-1)*delx1;
7685 temp2 = std::log(psi/psi1[0]);
7686 j0 = min(max(1+int(temp2/delp1),1),ln1-1);
7687 temp2 = temp2 - (j0-1)*delp1;
7688 t1 = trans1[i0][j0] + (trans1[i0+1][j0] - trans1[i0][j0])*temp1/delx1;
7689 t2 = trans1[i0][j0+1] + (trans1[i0+1][j0+1] - trans1[i0][j0+1])*temp1/delx1;
7690 prob = std::exp(t1 + (t2-t1)*temp2/delp1);
7691 (*ml)=2;
7692 }
7693 }
7694 else {
7695 prob = clmb2(rho,eta,&dumm);
7696 (*ml) = 4;
7697 }
7698 }
7699
7700 return prob;
7701}
7702
7703G4double G4Incl::clmb2(G4double rho, G4double eta, G4double *t1)
7704{
7705 const G4double dp0 = 0.0, dp1 = 1.0, dp2 = 2.0, dp3 = 3.0;
7706 const G4double dph = 0.5, dpth = dp1/dp3;
7707 const G4int ln = 102;
7708
7709 const G4double t0[ln] = {0.0, dp0,.1083,.1369,.1572,.1736,.1876,.2,.2113,
7710 0.2216,.2312,.2403,.2489,.2571,.265,.2725,.2798,
7711 .2869,.2938,.3006,.3071,.3136,.3199,.3261,.3322,
7712 .3382,.3442,.3499,.3557,.3615,.3672,.3729,.3785,
7713 .3841,.3897,.3952,.4008,.4063,.4118,.4173,.4228,
7714 .4283,.4338,.4393,.4448,.4504,.4559,.4615,.4671,
7715 .4728,.4784,.4841,.4899,.4957,.5015,.5074,.5133,
7716 .5193,.5253,.5315,.5376,.5439,.5503,.5567,.5632,
7717 .5698,.5765,.5833,.5903,.5973,.6045,.6118,.6193,
7718 .6269,.6346,.6426,.6507,.659,.6675,.6763,.6853,
7719 .6945,.704,.7139,.724,.7345,.7453,.7566,.7683,
7720 .7805,.7932,.8065,.8205,.8352,.8508,.8673,.8849,
7721 .9038,.9243,.9467,.9715,dp1};
7722 const G4double x1 = 0.01;
7723 const G4double xi = 100;
7724 static G4double x,temp,prob;
7725 static G4int i;
7726
7727 x = dp1/(dp1 + std::sqrt(dph*rho*eta));
7728 if (x < x1) {
7729 temp = t0[2] * std::pow((x/x1),dpth);
7730 }
7731 else {
7732 i = int(std::floor(xi*x));
7733 i = i + 1;
7734 if(i == 101) {
7735 i = 100;
7736 }
7737 i = max(min(i,ln-1),2); // 2->1
7738 temp = t0[i] + (t0[i+1] - t0[i]) * (x - i * x1)/x1;
7739 }
7740 (*t1) = dp1 - temp;
7741 prob = dp1 - dp2 * (*t1) * eta/rho;
7742
7743 return (max(prob,dp0));
7744}
7745
7746// Utilities
7747
7748G4double G4Incl::min(G4double a, G4double b)
7749{
7750 if(a < b) {
7751 return a;
7752 }
7753 else {
7754 return b;
7755 }
7756}
7757
7758G4int G4Incl::min(G4int a, G4int b)
7759{
7760 if(a < b) {
7761 return a;
7762 }
7763 else {
7764 return b;
7765 }
7766}
7767
7768G4double G4Incl::max(G4double a, G4double b)
7769{
7770 if(a > b) {
7771 return a;
7772 }
7773 else {
7774 return b;
7775 }
7776}
7777
7778G4int G4Incl::max(G4int a, G4int b)
7779{
7780 if(a > b) {
7781 return a;
7782 }
7783 else {
7784 return b;
7785 }
7786}
7787
7788G4int G4Incl::nint(G4double number)
7789{
7790 G4double intpart;
7791 G4double fractpart;
7792 fractpart = std::modf(number, &intpart);
7793 if(number == 0) {
7794 return 0;
7795 }
7796 if(number > 0) {
7797 if(fractpart < 0.5) {
7798 return int(std::floor(number));
7799 }
7800 else {
7801 return int(std::ceil(number));
7802 }
7803 }
7804 if(number < 0) {
7805 if(fractpart < -0.5) {
7806 return int(std::floor(number));
7807 }
7808 else {
7809 return int(std::ceil(number));
7810 }
7811 }
7812
7813 return 0;
7814}
7815
7816G4double G4Incl::callFunction(G4int functionChoice, G4double r)
7817{
7818 if(functionChoice == wsaxFunction) {
7819 return wsax(r);
7820 }
7821 else if(functionChoice == derivWsaxFunction) {
7822 return derivWsax(r);
7823 }
7824 else if(functionChoice == dmhoFunction) {
7825 return dmho(r);
7826 }
7827 else if(functionChoice == derivMhoFunction) {
7828 return derivMho(r);
7829 }
7830 else if(functionChoice == derivGausFunction) {
7831 return derivGaus(r);
7832 }
7833 else if(functionChoice == densFunction) {
7834 return dens(r);
7835 }
7836
7837 return 0.0;
7838}
7839
7840G4double G4Incl::am(G4double a, G4double b, G4double c, G4double d)
7841{
7842 return std::sqrt(d*d-a*a-b*b-c*c);
7843}
7844
7845G4double G4Incl::pcm(G4double E, G4double A, G4double C)
7846{
7847// assert(((std::pow(E,2)-std::pow((A+C),2))*(std::pow(E,2)-std::pow((A-C),2))) >= 0);
7848// assert(E != 0);
7849 return (0.5*std::sqrt((std::pow(E,2)-std::pow((A+C),2))*(std::pow(E,2)-std::pow((A-C),2)))/E);
7850}
7851
7852G4double G4Incl::sign(G4double a, G4double b)
7853{
7854 if(b >= 0) {
7855 return utilabs(a);
7856 }
7857 if(b < 0) {
7858 return (-1.0*utilabs(a));
7859 }
7860
7861 if(verboseLevel > 2) {
7862 G4cout <<"Error: sign function failed. " << G4endl;
7863 }
7864 return a; // The algorithm is never supposed to reach this point.
7865}
7866
7867G4double G4Incl::utilabs(G4double a)
7868{
7869 if(a > 0) {
7870 return a;
7871 }
7872 if(a < 0) {
7873 return (-1.0*a);
7874 }
7875 if(a == 0) {
7876 return a;
7877 }
7878
7879 if(verboseLevel > 2) {
7880 G4cout <<"Error: utilabs function failed. " << G4endl;
7881 }
7882 return a;
7883}
7884
7885G4double G4Incl::amax1(G4double a, G4double b)
7886{
7887 if(a > b) {
7888 return a;
7889 }
7890 else if(b > a) {
7891 return b;
7892 }
7893 else if(a == b) {
7894 return a;
7895 }
7896
7897 return a; // The algorithm is never supposed to reach this point.
7898}
7899
7900G4double G4Incl::w(G4double a, G4double b, G4double c, G4double d)
7901{
7902 return (std::sqrt(a*a+b*b+c*c+d*d));
7903}
7904
7905G4int G4Incl::idnint(G4double a)
7906{
7907 G4int value = 0;
7908
7909 G4int valueCeil = int(std::ceil(a));
7910 G4int valueFloor = int(std::floor(a));
7911
7912 if(std::abs(value - valueCeil) < std::abs(value - valueFloor)) {
7913 return valueCeil;
7914 }
7915 else {
7916 return valueFloor;
7917 }
7918}
Note: See TracBrowser for help on using the repository browser.