79 static const char* G4Hadronic_Random_File = getenv(
"G4HADRONIC_RANDOM_FILE");
 
   96   G4HadronicProcess_debug_flag = 
false;
 
   98   GetEnergyMomentumCheckEnvvars();
 
  116   G4HadronicProcess_debug_flag = 
false;
 
  118   GetEnergyMomentumCheckEnvvars();
 
  126   delete theCrossSectionDataStore;
 
  129 void G4HadronicProcess::GetEnergyMomentumCheckEnvvars() {
 
  130   levelsSetByProcess = 
false;
 
  133     strtol(getenv(
"G4Hadronic_epReportLevel"),0,10) : 0;
 
  135   epCheckLevels.first = getenv(
"G4Hadronic_epCheckRelativeLevel") ?
 
  136     strtod(getenv(
"G4Hadronic_epCheckRelativeLevel"),0) : 
DBL_MAX;
 
  138   epCheckLevels.second = getenv(
"G4Hadronic_epCheckAbsoluteLevel") ?
 
  139     strtod(getenv(
"G4Hadronic_epCheckAbsoluteLevel"),0) : 
DBL_MAX;
 
  160   if(getenv(
"G4HadronicProcess_debug")) {
 
  161     G4HadronicProcess_debug_flag = 
true;
 
  176     ed << 
" hadronic initialisation fails" << 
G4endl;
 
  177     G4Exception(
"G4HadronicProcess::BuildPhysicsTable", 
"had000", 
 
  188     theLastCrossSection = aScaleFactor*
 
  197     ed << 
" Cross section is not available" << 
G4endl;
 
  202   if( theLastCrossSection > 0.0 ) { res = 1.0/theLastCrossSection; }
 
  223      anElement = theCrossSectionDataStore->
SampleZandA(aParticle,
 
  232     ed << 
" PostStepDoIt failed on element selection" << 
G4endl;
 
  252       ed << 
"G4HadronicProcess: track in unusable state - " 
  254       ed << 
"G4HadronicProcess: returning unchanged track " << 
G4endl;
 
  265   G4double kineticEnergy = originalEnergy;
 
  280     ed << 
"Target element "<<anElement->
GetName()<<
"  Z= " 
  283     DumpState(aTrack,
"ChooseHadronicInteraction",ed);
 
  284     ed << 
" No HadronicInteraction found out" << 
G4endl;
 
  292   G4int reentryCount = 0;
 
  299       if (G4Hadronic_Random_File) {
 
  311       ed << 
"Target element "<<anElement->
GetName()<<
"  Z= " 
  315       ed << 
" ApplyYourself failed" << 
G4endl;
 
  323     if(reentryCount>100) {
 
  326       ed << 
"Target element "<<anElement->
GetName()<<
"  Z= " 
  330       ed << 
" ApplyYourself does not completed after 100 attempts" << 
G4endl;
 
  352   outFile << 
"The description for this process has not been written yet.\n";
 
  356 G4double G4HadronicProcess::XBiasSurvivalProbability()
 
  360   G4double biasedProbability = 1.-std::exp(-nLTraversed);
 
  361   G4double realProbability = 1-std::exp(-nLTraversed/aScaleFactor);
 
  362   result = (biasedProbability-realProbability)/biasedProbability;
 
  366 G4double G4HadronicProcess::XBiasSecondaryWeight()
 
  371      1./aScaleFactor*std::exp(-nLTraversed/aScaleFactor*(1-1./aScaleFactor));
 
  384   if(efinal < 0.0) { efinal = 0.0; }
 
  392   } 
else if(0.0 == efinal) {
 
  404     G4double newP = std::sqrt(efinal*(efinal + 2*mass));
 
  407     newP4.
rotate(rotation, it);
 
  410     newE = newP4.
e() - mass;
 
  411     if(G4HadronicProcess_debug_flag && newE <= 0.0) {
 
  413       DumpState(aT,
"Primary has zero energy after interaction",ed);
 
  416     if(newE < 0.0) { newE = 0.0; }
 
  427     for (
G4int i = 0; i < nSec; ++i) {
 
  429       theM.
rotate(rotation, it);
 
  435       if (time < 0.0) { time = 0.0; }
 
  456       if (G4HadronicProcess_debug_flag) {
 
  460           DumpState(aT,
"Secondary has zero energy",ed);
 
  608   aScaleFactor = aScale;
 
  610   if( (it != 
"PhotonInelastic") &&
 
  611       (it != 
"ElectroNuclear") &&
 
  612       (it != 
"PositronNuclear") )
 
  616           "Cross-section biasing available only for gamma and electro nuclear reactions.");
 
  622           "Cross-section bias readjusted to be above safe limit. New value is 100");
 
  652       for (
G4int i = 0; i < nSec; i++) {
 
  658       if (std::abs(deltaE) > checkLevels.second && std::abs(deltaE) > checkLevels.first*aPro.
GetKineticEnergy()){
 
  662          desc << 
"Warning: Bad energy non-conservation detected, will " 
  669               << 
" E(initial - final) = " << deltaE << 
" MeV." << 
G4endl;
 
  689   G4int initial_A = target_A + track_A;
 
  690   G4int initial_Z = target_Z + track_Z;
 
  696   G4int final_A(0), final_Z(0);
 
  726     for (
G4int i = 0; i < nSec; i++) {
 
  739   std::pair<G4double, G4double> checkLevels = epCheckLevels;
 
  740   if (!levelsSetByProcess) {
 
  742     checkLevels.first= std::min(checkLevels.first,  epCheckLevels.first);
 
  743     checkLevels.second=std::min(checkLevels.second, epCheckLevels.second);
 
  759   if (  std::abs(relative) > checkLevels.first
 
  760      || std::abs(relative_mom) > checkLevels.first) {
 
  762     relResult = checkRelative ? 
"fail" : 
"N/A";
 
  767   if (   std::abs(absolute) > checkLevels.second
 
  768       || std::abs(absolute_mom) > checkLevels.second ) {
 
  775   if (   (initial_A-final_A)!=0
 
  776       || (initial_Z-final_Z)!=0 ) {
 
  777     chargePass = checkLevels.second < 
DBL_MAX ? 
false : 
true;
 
  778     chargeResult = 
"fail";
 
  781   G4bool conservationPass = (relPass || absPass) && chargePass;
 
  783   std::stringstream Myout;
 
  784   G4bool Myout_notempty(
false);
 
  795       Myout << 
" Process: " << processName << 
" , Model: " <<  modelName << 
G4endl;
 
  799         << 
", target nucleus (" << aNucleus.
GetZ_asInt() << 
"," 
  805      || ! conservationPass ){
 
  807       Myout << 
"   "<< relResult  <<
" relative, limit " << checkLevels.
first << 
", values E/T(0) = " 
  808              << relative << 
" p/p(0)= " << relative_mom  << 
G4endl;
 
  809       Myout << 
"   "<< absResult << 
" absolute, limit (MeV) " << checkLevels.second/
MeV << 
", values E / p (MeV) = " 
  811       Myout << 
"   "<< chargeResult << 
" charge/baryon number balance " << (initial_Z-final_Z) << 
" / " << (initial_A-final_A) << 
" "<<  
G4endl;
 
  816   if ( Myout_notempty ) {
 
  827   ed << 
"Unrecoverable error in the method " << method << 
" of " 
  829   ed << 
"TrackID= "<< aTrack.
GetTrackID() << 
"  ParentID= " 
  835   ed << 
"Position(mm)= " << aTrack.
GetPosition()/CLHEP::mm << 
";";