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

Last change on this file since 1331 was 1315, checked in by garnier, 15 years ago

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

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