473{
476
477
478
480
481 size_t it = 0;
482
483 while(it < theZ.size() && Z > theZ[it]) it++;
484
485
486
487
488 if(Z > theZ[it])
489 {
491 "Called G4PiNuclearCrossSection outside parametrization");
492 }
495 if( charge < 0 )
496 {
497 if( theZ[it] == Z )
498 {
499 result = thePimData[it]->ReactionXSection(kineticEnergy);
500 fTotalXsc = thePimData[it]->TotalXSection(kineticEnergy);
501
502
503
504
505 }
506 else
507 {
508 x1 = thePimData[it-1]->ReactionXSection(kineticEnergy);
509 xt1 = thePimData[it-1]->TotalXSection(kineticEnergy);
510 Z1 = theZ[it-1];
511 x2 = thePimData[it]->ReactionXSection(kineticEnergy);
512 xt2 = thePimData[it]->TotalXSection(kineticEnergy);
513 Z2 = theZ[it];
514
515 result = Interpolate(Z1, Z2, Z, x1, x2);
516 fTotalXsc = Interpolate(Z1, Z2, Z, xt1, xt2);
517
518
519
520
521
522
523
524
525
526
527 }
528 }
529 else
530 {
531 if(theZ[it]==Z)
532 {
533
534 std::vector<G4PiData *> * theData = &thePimData;
535 if(thePipData[it]->AppliesTo(kineticEnergy))
536 {
537 theData = &thePipData;
538 }
539 result = theData->operator[](it)->ReactionXSection(kineticEnergy);
540 fTotalXsc = theData->operator[](it)->TotalXSection(kineticEnergy);
541
542
543
544
545 }
546 else
547 {
548 std::vector<G4PiData *> * theLData = &thePimData;
549 if(thePipData[it-1]->AppliesTo(kineticEnergy))
550 {
551 theLData = &thePipData;
552 }
553 std::vector<G4PiData *> * theHData = &thePimData;
554 if(thePipData[it]->AppliesTo(kineticEnergy))
555 {
556 theHData = &thePipData;
557 }
558 x1 = theLData->operator[](it-1)->ReactionXSection(kineticEnergy);
559 xt1 = theLData->operator[](it-1)->TotalXSection(kineticEnergy);
560 Z1 = theZ[it-1];
561 x2 = theHData->operator[](it)->ReactionXSection(kineticEnergy);
562 xt2 = theHData->operator[](it)->TotalXSection(kineticEnergy);
563 Z2 = theZ[it];
564
565 result = Interpolate(Z1, Z2, Z, x1, x2);
566 fTotalXsc = Interpolate(Z1, Z2, Z, xt1, xt2);
567
568
569
570
571
572
573
574
575
576
577 }
578 }
579
580
581 fElasticXsc = fTotalXsc - result;
582 if( fElasticXsc < 0.) fElasticXsc = 0.;
583
584 return result;
585}
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4double GetPDGCharge() const