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

Last change on this file since 1201 was 1196, checked in by garnier, 16 years ago

update CVS release candidate geant4.9.3.01

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