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

Last change on this file since 1306 was 1228, checked in by garnier, 16 years ago

update geant4.9.3 tag

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