99   #define _CheckChargeAndBaryonNumber_(val) CheckChargeAndBaryonNumber(val) 
  102   #define _CheckChargeAndBaryonNumber_(val) 
  106   #define _DebugEpConservation(val)  DebugEpConservation(val) 
  109   #define _DebugEpConservation(val) 
  124     theImR.push_back(theDecay);
 
  127     theImR.push_back(aAb);
 
  130     theImR.push_back(aSc);
 
  136     theCutOnPAbsorb= 0*
MeV;   
 
  150     thePrimaryEscape = 
true;
 
  159     projectileA=projectileZ=0;
 
  160     currentInitialEnergy=initial_nuclear_mass=0.;
 
  174     ClearAndDestroy(&theTargetList);
 
  175     ClearAndDestroy(&theSecondaryList);
 
  176     ClearAndDestroy(&theCapturedList);
 
  177     delete thePropagator;
 
  178     delete theCollisionMgr;
 
  180     delete theLateParticle;
 
  182     delete theH1Scatterer;
 
  187     outFile << 
"G4BinaryCascade is an intra-nuclear cascade model in which\n" 
  188             << 
"an incident hadron collides with a nucleon, forming two\n" 
  189             << 
"final-state particles, one or both of which may be resonances.\n" 
  190             << 
"The resonances then decay hadronically and the decay products\n" 
  191             << 
"are then propagated through the nuclear potential along curved\n" 
  192             << 
"trajectories until they re-interact or leave the nucleus.\n" 
  193             << 
"This model is valid for incident pions up to 1.5 GeV and\n" 
  194             << 
"nucleons up to 10 GeV.\n" 
  195             << 
"The remaining excited nucleus is handed on to ";
 
  201             else if (theExcitationHandler)    
 
  203                outFile << 
"G4ExcitationHandler";    
 
  208                outFile << 
"void.\n";
 
  214     outFile << 
"G4BinaryCascade propagtes secondaries produced by a high\n" 
  215             << 
"energy model through the wounded nucleus.\n" 
  216             << 
"Secondaries are followed after the formation time and if\n" 
  217             << 
"within the nucleus are propagated through the nuclear\n" 
  218             << 
"potential along curved trajectories until they interact\n" 
  219             << 
"with a nucleon, decay, or leave the nucleus.\n" 
  220             << 
"An interaction of a secondary with a nucleon produces two\n" 
  221             << 
"final-state particles, one or both of which may be resonances.\n" 
  222             << 
"Resonances decay hadronically and the decay products\n" 
  223             << 
"are in turn propagated through the nuclear potential along curved\n" 
  224             << 
"trajectories until they re-interact or leave the nucleus.\n" 
  225             << 
"This model is valid for pions up to 1.5 GeV and\n" 
  226             << 
"nucleons up to about 3.5 GeV.\n" 
  227             << 
"The remaining excited nucleus is handed on to ";
 
  233     else if (theExcitationHandler)    
 
  235        outFile << 
"G4ExcitationHandler";    
 
  240        outFile << 
"void.\n";
 
  257     if(getenv(
"BCDEBUG") ) 
G4cerr << 
" ######### Binary Cascade Reaction starts ######### "<< 
G4endl;
 
  262     if(initial4Momentum.
e()-initial4Momentum.
m()<theBCminP &&
 
  276     if(!getenv(
"I_Am_G4BinaryCascade_Developer") )
 
  283             G4cerr << 
"You are trying to use G4BinaryCascade with " <<definition->GetParticleName()<<
" as projectile."<<
G4endl;
 
  284             G4cerr << 
"G4BinaryCascade should not be used for projectiles other than nucleons or pions."<<
G4endl;
 
  285             G4cerr << 
"If you want to continue, please switch on the developer environment: "<<
G4endl;
 
  286             G4cerr << 
"setenv I_Am_G4BinaryCascade_Developer 1 "<<G4endl<<
G4endl;
 
  287             throw G4HadronicException(__FILE__, __LINE__, 
"G4BinaryCascade - used for unvalid particle type - Fatal");
 
  292     thePrimaryType = definition;
 
  293     thePrimaryEscape = 
false;
 
  297     G4int interactionCounter = 0,collisionLoopMaxCount;
 
  305             ClearAndDestroy(products);
 
  314           collisionLoopMaxCount = 200;
 
  319             initialPosition=GetSpherePoint(1.1*radius, initial4Momentum);  
 
  320             kt = 
new G4KineticTrack(definition, 0., initialPosition, initial4Momentum);
 
  324             secondaries->push_back(kt);
 
  332         } 
while(! products && --collisionLoopMaxCount>0);   
 
  334         if(++interactionCounter>99) 
break;
 
  336     } 
while(products && products->size() == 0);   
 
  338     if(products && products->size()>0)
 
  344         G4ReactionProductVector::iterator iter;
 
  346         for(iter = products->begin(); iter != products->end(); ++iter)
 
  350                             (*iter)->GetTotalEnergy(),
 
  351                             (*iter)->GetMomentum());
 
  359         if(getenv(
"BCDEBUG") ) 
G4cerr << 
" ######### Binary Cascade Reaction void, return intial state ######### "<< 
G4endl;
 
  367         ClearAndDestroy(products);
 
  374     if(getenv(
"BCDEBUG") ) 
G4cerr << 
" ######### Binary Cascade Reaction ends ######### "<< 
G4endl;
 
  384 #ifdef debug_BIC_Propagate 
  385     G4cout << 
"G4BinaryCascade Propagate starting -------------------------------------------------------" <<
G4endl;
 
  395     ClearAndDestroy(&theCapturedList);
 
  396     ClearAndDestroy(&theSecondaryList);
 
  397     theSecondaryList.clear();
 
  398     ClearAndDestroy(&theFinalState);
 
  399     std::vector<G4KineticTrack *>::iterator iter;
 
  410 #ifdef debug_BIC_GetExcitationEnergy 
  411     G4cout << 
"ExcitationEnergy0 " << GetExcitationEnergy() << 
G4endl;
 
  416     G4bool success = BuildLateParticleCollisions(secondaries);
 
  419        products=HighEnergyModelFSProducts(products, secondaries);
 
  420        ClearAndDestroy(secondaries);
 
  423 #ifdef debug_G4BinaryCascade 
  424        G4cout << 
"G4BinaryCascade::Propagate: warning - high energy model failed energy conservation, returning unchanged high energy final state" << 
G4endl;
 
  435     FindCollisions(&theSecondaryList);
 
  438     if(theCollisionMgr->
Entries() == 0 )      
 
  442 #ifdef debug_BIC_return 
  452     G4bool haveProducts = 
false;
 
  453     G4int collisionCount=0;
 
  454      G4int collisionLoopMaxCount=1000000;
 
  455     while(theCollisionMgr->
Entries() > 0 && currentZ && --collisionLoopMaxCount>0)    
 
  466         if(theCollisionMgr->
Entries() > 0)
 
  470 #ifdef debug_BIC_Propagate_Collisions 
  471             G4cout << 
" NextCollision  * , Time, curtime = " << nextCollision << 
" " 
  487                 if (ApplyCollision(nextCollision))
 
  506     for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter)
 
  510     if ( ! theTargetList.size() || ! nProtons ){
 
  512        products = FillVoidNucleusProducts(products);
 
  513 #ifdef debug_BIC_return 
  514         G4cout << 
"return @ Z=0 after collision loop "<< 
G4endl;
 
  515         PrintKTVector(&theSecondaryList,std::string(
" theSecondaryList"));
 
  516         G4cout << 
"theTargetList size: " << theTargetList.size() << 
G4endl;
 
  517         PrintKTVector(&theTargetList,std::string(
" theTargetList"));
 
  518         PrintKTVector(&theCapturedList,std::string(
" theCapturedList"));
 
  520         G4cout << 
" ExcitE be4 Correct : " <<GetExcitationEnergy() << 
G4endl;
 
  521         G4cout << 
" Mom Transfered to nucleus : " << theMomentumTransfer << 
" " << theMomentumTransfer.
mag() << 
G4endl;
 
  522         PrintKTVector(&theFinalState,std::string(
" FinalState uncorrected"));
 
  523         G4cout << 
"returned products: " << products->size() << 
G4endl;
 
  544 #ifdef debug_BIC_return 
  551 #ifdef debug_BIC_Propagate 
  552     G4cout << 
" Momentum transfer to Nucleus " << theMomentumTransfer << 
" " << theMomentumTransfer.
mag() << 
G4endl;
 
  560     if ( theSecondaryList.size() > 0 )
 
  562 #ifdef debug_G4BinaryCascade 
  563         G4cerr << 
"G4BinaryCascade: Warning, have active particles at end" << 
G4endl;
 
  564         PrintKTVector(&theSecondaryList, 
"active particles @ end  added to theFinalState");
 
  567         for ( iter =theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
 
  569             theFinalState.push_back(*iter);
 
  571         theSecondaryList.clear();
 
  574     while ( theCollisionMgr->
Entries() > 0 )                
 
  576 #ifdef debug_G4BinaryCascade 
  577         G4cerr << 
" Warning: remove left over collision(s) " << 
G4endl;
 
  582 #ifdef debug_BIC_Propagate_Excitation 
  584     PrintKTVector(&theSecondaryList,std::string(
" theSecondaryList"));
 
  585     G4cout << 
"theTargetList size: " << theTargetList.size() << 
G4endl;
 
  587     PrintKTVector(&theCapturedList,std::string(
" theCapturedList"));
 
  589     G4cout << 
" ExcitE be4 Correct : " <<GetExcitationEnergy() << 
G4endl;
 
  590     G4cout << 
" Mom Transfered to nucleus : " << theMomentumTransfer << 
" " << theMomentumTransfer.
mag() << 
G4endl;
 
  591     PrintKTVector(&theFinalState,std::string(
" FinalState uncorrected"));
 
  597     G4double ExcitationEnergy=GetExcitationEnergy();
 
  599 #ifdef debug_BIC_Propagate_finals 
  600     PrintKTVector(&theFinalState,std::string(
" FinalState be4 corr"));
 
  601     G4cout << 
" Excitation Energy prefinal,  #collisions:, out, captured  " 
  602             << ExcitationEnergy << 
" " 
  603             << collisionCount << 
" " 
  604             << theFinalState.size() << 
" " 
  605             << theCapturedList.size()<<
G4endl;
 
  608     if (ExcitationEnergy < 0 )
 
  610         G4int maxtry=5, ntry=0;
 
  613             ExcitationEnergy=GetExcitationEnergy();
 
  614         } 
while ( ++ntry < maxtry && ExcitationEnergy < 0 );       
 
  618 #ifdef debug_BIC_Propagate_finals 
  619     PrintKTVector(&theFinalState,std::string(
" FinalState corrected"));
 
  620     G4cout << 
" Excitation Energy final,  #collisions:, out, captured  " 
  621             << ExcitationEnergy << 
" " 
  622             << collisionCount << 
" " 
  623             << theFinalState.size() << 
" " 
  624             << theCapturedList.size()<<
G4endl;
 
  628     if ( ExcitationEnergy < 0. )
 
  630             #ifdef debug_G4BinaryCascade 
  631                   G4cerr << 
"G4BinaryCascade-Warning: negative excitation energy ";
 
  633                    PrintKTVector(&theFinalState,std::string(
"FinalState"));
 
  634                    PrintKTVector(&theCapturedList,std::string(
"captured"));
 
  635                   G4cout << 
"negative ExE:Final 4Momentum .mag: " << GetFinal4Momentum()
 
  636                           << 
" "<< GetFinal4Momentum().
mag()<< G4endl
 
  637                           << 
"negative ExE:FinalNucleusMom  .mag: " << GetFinalNucleusMomentum()
 
  638                       << 
" "<< GetFinalNucleusMomentum().
mag()<< 
G4endl;
 
  640             #ifdef debug_BIC_return 
  641                     G4cout << 
"  negative Excitation E return empty products " << products << 
G4endl;
 
  645         ClearAndDestroy(products);
 
  655     products= ProductsAddFinalState(products, theFinalState);
 
  657     products= ProductsAddPrecompound(products, precompoundProducts);
 
  662     thePrimaryEscape = 
true;
 
  664     #ifdef debug_BIC_return 
  673 G4double G4BinaryCascade::GetExcitationEnergy()
 
  678 #if defined(debug_G4BinaryCascade) || defined(debug_BIC_GetExcitationEnergy) 
  679     G4int finalA = theTargetList.size()+theCapturedList.size();
 
  680     G4int finalZ = GetTotalCharge(theTargetList)+GetTotalCharge(theCapturedList);
 
  681     if ( (currentA - finalA) != 0 || (currentZ - finalZ) != 0 )
 
  683         G4cerr << 
"G4BIC:GetExcitationEnergy(): Nucleon counting error current/final{A,Z} " 
  684                 << 
"("<< currentA << 
"," << finalA << 
") ("<< currentZ << 
"," << finalZ << 
")" << 
G4endl;
 
  693         nucleusMass = GetIonMass(currentZ,currentA);
 
  695     else if (currentZ==0 )     
 
  698         else              {nucleusMass = GetFinalNucleusMomentum().
mag()     
 
  703 #ifdef debug_G4BinaryCascade 
  704         G4cout << 
"G4BinaryCascade::GetExcitationEnergy(): Warning - invalid nucleus (A,Z)=(" 
  705                 << currentA << 
"," << currentZ << 
")" << 
G4endl;
 
  710 #ifdef debug_BIC_GetExcitationEnergy 
  712     debug.push_back(
"====> current A, Z");
 
  713     debug.push_back(currentZ);
 
  714     debug.push_back(currentA);
 
  715     debug.push_back(
"====> final A, Z");
 
  716     debug.push_back(finalZ);
 
  717     debug.push_back(finalA);
 
  718     debug.push_back(nucleusMass);
 
  719     debug.push_back(GetFinalNucleusMomentum().mag());
 
  725     excitationE = GetFinalNucleusMomentum().
mag() - nucleusMass;
 
  731 #ifdef debug_BIC_GetExcitationEnergy 
  733     if ( excitationE < 0 )
 
  735         G4cout << 
"negative ExE final Ion mass " <<nucleusMass<< 
G4endl;
 
  737         if(finalZ>.5) 
G4cout << 
" Final nuclmom/mass " << Nucl_mom << 
" " << Nucl_mom.
mag()
 
  738                                << 
" (A,Z)=("<< finalA <<
","<<finalZ <<
")" 
  739                                << 
" mass " << nucleusMass << 
" " 
  740                                << 
" excitE " << excitationE << 
G4endl;
 
  748             initialExc = theInitial4Mom.
mag()- GetIonMass(Z, A);
 
  749             G4cout << 
"GetExcitationEnergy: Initial nucleus A Z " << A << 
" " << Z << 
" " << initialExc << 
G4endl;
 
  766 void G4BinaryCascade::BuildTargetList()
 
  777     ClearAndDestroy(&theTargetList);  
 
  786     initial_nuclear_mass=GetIonMass(initialZ,initialA);
 
  805             theTargetList.push_back(kt);
 
  810 #ifdef debug_BIC_BuildTargetList 
  811         else { 
G4cout << 
"nucleon is hit" << nucleon << 
G4endl;}
 
  817         massInNucleus = GetIonMass(currentZ,currentA);
 
  818     } 
else if (currentZ==0 && currentA>=1 )
 
  823         G4cerr << 
"G4BinaryCascade::BuildTargetList(): Fatal Error - invalid nucleus (A,Z)=(" 
  824                 << currentA << 
"," << currentZ << 
")" << 
G4endl;
 
  827     currentInitialEnergy=   theInitial4Mom.
e() + theProjectile4Momentum.
e();
 
  829 #ifdef debug_BIC_BuildTargetList 
  830     G4cout << 
"G4BinaryCascade::BuildTargetList():  nucleus (A,Z)=(" 
  831             << currentA << 
"," << currentZ << 
") mass: " << massInNucleus <<
 
  832             ", theInitial4Mom " << theInitial4Mom <<
 
  833             ", currentInitialEnergy " << currentInitialEnergy << 
G4endl;
 
  843    std::vector<G4KineticTrack *>::iterator iter;
 
  846    projectileA=projectileZ=0;
 
  849    for(iter = secondaries->begin(); iter != secondaries->end(); ++iter)
 
  851       if((*iter)->GetFormationTime() < StartingTime)
 
  852          StartingTime = (*iter)->GetFormationTime();
 
  857    for(iter = secondaries->begin(); iter != secondaries->end(); ++iter)
 
  861       G4double FormTime = (*iter)->GetFormationTime() - StartingTime;
 
  862       (*iter)->SetFormationTime(FormTime);
 
  865          FindLateParticleCollision(*iter);
 
  866          lateParticles4Momentum += (*iter)->GetTrackingMomentum();
 
  867          lateA += (*iter)->GetDefinition()->GetBaryonNumber();
 
  868          lateZ += 
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
 
  872          theSecondaryList.push_back(*iter);
 
  874          theProjectile4Momentum += (*iter)->GetTrackingMomentum();
 
  875          projectileA += (*iter)->GetDefinition()->GetBaryonNumber();
 
  876          projectileZ += 
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
 
  877 #ifdef debug_BIC_Propagate 
  878          G4cout << 
" Adding initial secondary " << *iter
 
  879                << 
" time" << (*iter)->GetFormationTime()
 
  880                << 
", state " << (*iter)->GetState() << 
G4endl;
 
  889       theProjectile4Momentum += mom;
 
  893       G4double excitation= theProjectile4Momentum.
e() + initial_nuclear_mass - lateParticles4Momentum.e() - massInNucleus;
 
  894 #ifdef debug_BIC_GetExcitationEnergy 
  895       G4cout << 
"BIC: Proj.e, nucl initial, nucl final, lateParticles" 
  896             << theProjectile4Momentum << 
",  " 
  897             << initial_nuclear_mass<< 
",  " << massInNucleus << 
",  " 
  898             << lateParticles4Momentum << 
G4endl;
 
  899       G4cout << 
"BIC: Proj.e / initial excitation: " << theProjectile4Momentum.
e() << 
" / " << excitation << 
G4endl;
 
  901       success = excitation > 0;
 
  902 #ifdef debug_G4BinaryCascade 
  904          G4cout << 
"G4BinaryCascade::BuildLateParticleCollisions(): Proj.e / initial excitation: " << theProjectile4Momentum.
e() << 
" / " << excitation << 
G4endl;
 
  914       secondaries->clear(); 
 
  933    fragment = FindFragments();
 
  946          else if (theExcitationHandler)    
 
  948             precompoundProducts=theExcitationHandler->
BreakItUp(*fragment);
 
  953          if (theTargetList.size() + theCapturedList.size() > 1 ) {
 
  957          std::vector<G4KineticTrack *>::iterator i;
 
  958          if ( theTargetList.size() == 1 )  {i=theTargetList.begin();}
 
  959          if ( theCapturedList.size() == 1 ) {i=theCapturedList.begin();}                             
 
  964          precompoundProducts->push_back(aNew);
 
  972       precompoundProducts = DecayVoidNucleus();
 
  974    #ifdef debug_BIC_DeexcitationProducts 
  978        if ( precompoundProducts )
 
  980           std::vector<G4ReactionProduct *>::iterator j;
 
  981           for(j = precompoundProducts->begin(); j != precompoundProducts->end(); ++j)
 
  984              Preco_momentum += pProduct;
 
  987        G4cout << 
"finalNuclMom / sum preco products" << fragment_momentum << 
"  / " << Preco_momentum
 
  988                << 
" delta E "<< fragment_momentum.
e() - Preco_momentum.
e() <<  
G4endl;
 
  992    return precompoundProducts;
 
 1000    if ( (theTargetList.size()+theCapturedList.size()) > 0 )
 
 1003       std::vector<G4KineticTrack *>::iterator aNuc;
 
 1005       std::vector<G4double> masses;
 
 1008       if ( theTargetList.size() != 0)                                      
 
 1010          for ( aNuc=theTargetList.begin(); aNuc != theTargetList.end(); aNuc++)
 
 1012             G4double mass=(*aNuc)->GetDefinition()->GetPDGMass();
 
 1013             masses.push_back(mass);
 
 1018       if ( theCapturedList.size() != 0)                                    
 
 1020          for(aNuc = theCapturedList.begin();                               
 
 1021                aNuc != theCapturedList.end(); aNuc++)                        
 
 1023             G4double mass=(*aNuc)->GetDefinition()->GetPDGMass();          
 
 1024             masses.push_back(mass);                                        
 
 1035       if ( eCMS < sumMass )                    
 
 1037          eCMS=sumMass + 2*
MeV*masses.size();
 
 1042       std::vector<G4LorentzVector*> * momenta=decay.
Decay(eCMS,masses);
 
 1043       std::vector<G4LorentzVector*>::iterator aMom=momenta->begin();
 
 1046       if ( theTargetList.size() != 0)
 
 1048          for ( aNuc=theTargetList.begin();
 
 1049                (aNuc != theTargetList.end()) && (aMom!=momenta->end());
 
 1055             result->push_back(aNew);
 
 1061       if ( theCapturedList.size() != 0)                                    
 
 1063          for ( aNuc=theCapturedList.begin();                                
 
 1064                (aNuc != theCapturedList.end()) && (aMom!=momenta->end());    
 
 1068                   (*aNuc)->GetDefinition());            
 
 1071             result->push_back(aNew);                           
 
 1087 #ifdef debug_BIC_Propagate_finals 
 1090     for(i = 0; i< fs.size(); i++)
 
 1097         products->push_back(aNew);
 
 1099 #ifdef debug_BIC_Propagate_finals 
 1109 #ifdef debug_BIC_Propagate_finals 
 1110     G4cout << 
" Final state momentum " << mom_fs << 
G4endl;
 
 1121    if ( precompoundProducts )
 
 1123       std::vector<G4ReactionProduct *>::iterator j;
 
 1124       for(j = precompoundProducts->begin(); j != precompoundProducts->end(); ++j)
 
 1129 #ifdef debug_BIC_Propagate_finals 
 1130          G4cout << 
"BIC: pProduct be4 boost " <<pProduct << 
G4endl;
 
 1132          pProduct *= precompoundLorentzboost;
 
 1133 #ifdef debug_BIC_Propagate_finals 
 1134          G4cout << 
"BIC: pProduct aft boost " <<pProduct << 
G4endl;
 
 1136          pSumPreco += pProduct;
 
 1137          (*j)->SetTotalEnergy(pProduct.e());
 
 1138          (*j)->SetMomentum(pProduct.vect());
 
 1139          (*j)->SetNewlyAdded(
true);
 
 1140          products->push_back(*j);
 
 1144       precompoundProducts->clear();
 
 1145       delete precompoundProducts;
 
 1153     for(std::vector<G4KineticTrack *>::iterator i = secondaries->begin();
 
 1154             i != secondaries->end(); ++i)
 
 1156         for(std::vector<G4BCAction *>::iterator j = theImR.begin();
 
 1157                 j!=theImR.end(); j++)
 
 1160             const std::vector<G4CollisionInitialState *> & aCandList
 
 1161             = (*j)->GetCollisions(*i, theTargetList, theCurrentTime);
 
 1162             for(
size_t count=0; count<aCandList.size(); count++)
 
 1174 void  G4BinaryCascade::FindDecayCollision(
G4KineticTrack * secondary)
 
 1177     const std::vector<G4CollisionInitialState *> & aCandList
 
 1178     = theDecay->
GetCollisions(secondary, theTargetList, theCurrentTime);
 
 1179     for(
size_t count=0; count<aCandList.size(); count++)
 
 1186 void  G4BinaryCascade::FindLateParticleCollision(
G4KineticTrack * secondary)
 
 1191     if (((
G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes(secondary,tin,tout))
 
 1196         } 
else if ( tout > 0 )
 
 1209 #ifdef debug_BIC_FindCollision 
 1210     G4cout << 
"FindLateP Particle, 4-mom, times newState " 
 1213             << 
" times " <<  tin << 
" " << tout << 
" " 
 1217     const std::vector<G4CollisionInitialState *> & aCandList
 
 1218     = theLateParticle->
GetCollisions(secondary, theTargetList, theCurrentTime);
 
 1219     for(
size_t count=0; count<aCandList.size(); count++)
 
 1221 #ifdef debug_BIC_FindCollision 
 1222         G4cout << 
" Adding a late Col : " << aCandList[count] << 
G4endl;
 
 1235 #ifdef debug_BIC_ApplyCollision 
 1236     G4cerr << 
"G4BinaryCascade::ApplyCollision start"<<
G4endl;
 
 1237     theCollisionMgr->
Print();
 
 1242     G4bool haveTarget=target_collection.size()>0;
 
 1245 #ifdef debug_G4BinaryCascade 
 1246         G4cout << 
"G4BinaryCasacde::ApplyCollision(): StateError " << primary << 
G4endl;
 
 1247         PrintKTVector(primary,std::string(
"primay- ..."));
 
 1248         PrintKTVector(&target_collection,std::string(
"... targets"));
 
 1251         theCollisionMgr->
Print();
 
 1268     G4int initialBaryon(0);
 
 1269     G4int initialCharge(0);
 
 1277     G4double initial_Efermi=CorrectShortlivedPrimaryForFermi(primary,target_collection);
 
 1283 #ifdef debug_BIC_ApplyCollision 
 1284     DebugApplyCollisionFail(collision, products);
 
 1290     G4bool lateParticleCollision= (!haveTarget) && products && products->size() == 1;
 
 1291     G4bool decayCollision= (!haveTarget) && products && products->size() > 1;
 
 1295 #ifdef debug_G4BinaryCascade 
 1296     G4int lateBaryon(0), lateCharge(0);
 
 1299     if ( lateParticleCollision )
 
 1303 #ifdef debug_G4BinaryCascade 
 1304         lateBaryon = initialBaryon;
 
 1305         lateCharge = initialCharge;
 
 1307         initialBaryon=initialCharge=0;
 
 1314     if (!lateParticleCollision)
 
 1316        if( !products || products->size()==0 || !CheckPauliPrinciple(products) )
 
 1318 #ifdef debug_BIC_ApplyCollision 
 1319           if (products) 
G4cout << 
" ======Failed Pauli =====" << 
G4endl;
 
 1320           G4cerr << 
"G4BinaryCascade::ApplyCollision blocked"<<
G4endl;
 
 1328           if (! CorrectShortlivedFinalsForFermi(products, initial_Efermi)){
 
 1334 #ifdef debug_BIC_ApplyCollision 
 1335     DebugApplyCollision(collision, products);
 
 1339         if (products) ClearAndDestroy(products);
 
 1340         if ( decayCollision ) FindDecayCollision(primary);  
 
 1346     G4int finalBaryon(0);
 
 1347     G4int finalCharge(0);
 
 1349     for(std::vector<G4KineticTrack *>::iterator i =products->begin(); i != products->end(); i++)
 
 1351         if ( ! lateParticleCollision )
 
 1353             (*i)->SetState(primary->
GetState());  
 
 1355                 finalBaryon+=(*i)->GetDefinition()->GetBaryonNumber();
 
 1356                 finalCharge+=
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
 
 1359                if (((
G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes((*i),tin,tout) &&
 
 1360                      tin < 0 && tout > 0 )
 
 1362                   PrintKTVector((*i),
"particle inside marked not-inside");
 
 1363                    G4cout << 
"tin tout: " << tin << 
" " << tout << 
G4endl;
 
 1368             if (((
G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes((*i),tin,tout))
 
 1375                 else if ( tout > 0 )
 
 1378                     finalBaryon+=(*i)->GetDefinition()->GetBaryonNumber();
 
 1379                     finalCharge+=
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
 
 1384                     toFinalState.push_back((*i));
 
 1390                 toFinalState.push_back((*i));
 
 1395     if(!toFinalState.empty())
 
 1397         theFinalState.insert(theFinalState.end(),
 
 1398                 toFinalState.begin(),toFinalState.end());
 
 1399         std::vector<G4KineticTrack *>::iterator iter1, iter2;
 
 1400         for(iter1 = toFinalState.begin(); iter1 != toFinalState.end();
 
 1403             iter2 = std::find(products->begin(), products->end(),
 
 1405             if ( iter2 != products->end() ) products->erase(iter2);
 
 1411     currentA += finalBaryon-initialBaryon;
 
 1412     currentZ += finalCharge-initialCharge;
 
 1416     oldSecondaries.push_back(primary);
 
 1419 #ifdef debug_G4BinaryCascade 
 1420     if ( (finalBaryon-initialBaryon-lateBaryon) != 0 || (finalCharge-initialCharge-lateCharge) != 0 )
 
 1422         G4cout << 
"G4BinaryCascade: Error in Balancing: " << 
G4endl;
 
 1423         G4cout << 
"initial/final baryon number, initial/final Charge " 
 1424                 << initialBaryon <<
" "<< finalBaryon <<
" " 
 1425                 << initialCharge <<
" "<< finalCharge <<
" " 
 1427                 << 
", with number of products: "<< products->size() <<
G4endl;
 
 1428         G4cout << G4endl<<
"Initial condition are these:"<<
G4endl;
 
 1441     for(
size_t ii=0; ii< oldTarget.size(); ii++)
 
 1443         oldTarget[ii]->Hit();
 
 1446     UpdateTracksAndCollisions(&oldSecondaries, &oldTarget, products);
 
 1456 G4bool G4BinaryCascade::Absorb()
 
 1464     std::vector<G4KineticTrack *>::iterator iter;
 
 1466     for(iter = theSecondaryList.begin();
 
 1467             iter != theSecondaryList.end(); ++iter)
 
 1472             if(absorber.WillBeAbsorbed(*kt))
 
 1474                 absorbList.push_back(kt);
 
 1479     if(absorbList.empty())
 
 1483     for(iter = absorbList.begin(); iter != absorbList.end(); ++iter)
 
 1486         if(!absorber.FindAbsorbers(*kt, theTargetList))
 
 1487             throw G4HadronicException(__FILE__, __LINE__, 
"G4BinaryCascade::Absorb(): Cannot absorb a particle.");
 
 1489         if(!absorber.FindProducts(*kt))
 
 1490             throw G4HadronicException(__FILE__, __LINE__, 
"G4BinaryCascade::Absorb(): Cannot absorb a particle.");
 
 1493         G4int maxLoopCount = 1000;
 
 1494         while(!CheckPauliPrinciple(products) && --maxLoopCount>0)   
 
 1496             ClearAndDestroy(products);
 
 1497             if(!absorber.FindProducts(*kt))
 
 1499                         "G4BinaryCascade::Absorb(): Cannot absorb a particle.");
 
 1501           if ( --maxLoopCount < 0 ) 
throw G4HadronicException(__FILE__, __LINE__, 
"G4BinaryCascade::Absorb(): Cannot absorb a particle."); 
 
 1506         toRemove.push_back(kt);
 
 1507         toDelete.push_back(kt);  
 
 1509         UpdateTracksAndCollisions(&toRemove, absorbers, products);
 
 1510         ClearAndDestroy(absorbers);
 
 1512     ClearAndDestroy(&toDelete);
 
 1525     std::vector<G4KineticTrack *>::iterator i;
 
 1530     G4int particlesAboveCut=0;
 
 1531     G4int particlesBelowCut=0;
 
 1532     if ( verbose ) 
G4cout << 
" Capture: secondaries " << theSecondaryList.size() << 
G4endl;
 
 1533     for(i = theSecondaryList.begin(); i != theSecondaryList.end(); ++i)
 
 1550                 ++particlesBelowCut;
 
 1558     if (verbose) 
G4cout << 
"Capture particlesAboveCut,particlesBelowCut, capturedEnergy,capturedEnergy/particlesBelowCut <? 0.2*theCutOnP " 
 1559             << particlesAboveCut << 
" " << particlesBelowCut << 
" " << capturedEnergy
 
 1563     if(particlesBelowCut>0 && capturedEnergy/particlesBelowCut<0.2*theCutOnP)
 
 1566         for(i = theSecondaryList.begin(); i != theSecondaryList.end(); ++i)
 
 1574                     captured.push_back(kt);
 
 1576                     theCapturedList.push_back(kt);
 
 1580         UpdateTracksAndCollisions(&captured, NULL, NULL);
 
 1595     fermiMom.
Init(A, Z);
 
 1599     G4KineticTrackVector::iterator i;
 
 1606     for(i = products->begin(); i != products->end(); ++i)
 
 1608         definition = (*i)->GetDefinition();
 
 1634             if(mom.
e() < eFermi )
 
 1643 #ifdef debug_BIC_CheckPauli 
 1646         for(i = products->begin(); i != products->end(); ++i)
 
 1648             definition = (*i)->GetDefinition();
 
 1657                 if ( mom.
e()-mom.
mag()+field > 160*
MeV )
 
 1659                     G4cout << 
"momentum problem pFermi=" <<  pFermi
 
 1660                             << 
" mom, mom.m " << mom << 
" " << mom.
mag()
 
 1661                             << 
" field " << field << 
G4endl;
 
 1672 void G4BinaryCascade::StepParticlesOut()
 
 1679     while( theSecondaryList.size() > 0 )               
 
 1685         std::vector<G4KineticTrack *>::iterator i;
 
 1686         for(i = theSecondaryList.begin(); i != theSecondaryList.end(); ++i)
 
 1694                         ((
G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes(kt,tdummy,tStep);
 
 1695 #ifdef debug_BIC_StepParticlesOut 
 1696                 G4cout << 
" minTimeStep, tStep Particle " <<minTimeStep << 
" " <<tStep
 
 1701                     PrintKTVector(&theSecondaryList, std::string(
" state ERROR....."));
 
 1702                     throw G4HadronicException(__FILE__, __LINE__, 
"G4BinaryCascade::StepParticlesOut() particle not in nucleus");
 
 1705                 if(intersect && tStep<minTimeStep && tStep> 0 )
 
 1707                     minTimeStep = tStep;
 
 1710                 PrintKTVector(&theSecondaryList, std::string(
" state ERROR....."));
 
 1711                 throw G4HadronicException(__FILE__, __LINE__, 
"G4BinaryCascade::StepParticlesOut() particle not in nucleus");
 
 1718         if(theCollisionMgr->
Entries() > 0)
 
 1724         if ( timeToCollision > minTimeStep )
 
 1726             DoTimeStep(minTimeStep);
 
 1730             if (!DoTimeStep(timeToCollision) )
 
 1742                 if  ( ApplyCollision(nextCollision))
 
 1754 #ifdef debug_G4BinaryCascade 
 1755             G4cerr << 
"G4BinaryCascade.cc: Warning - aborting looping particle(s)" << 
G4endl;
 
 1756             PrintKTVector(&theSecondaryList,
" looping particles added to theFinalState");
 
 1760             std::vector<G4KineticTrack *>::iterator iter;
 
 1761             for ( iter =theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
 
 1763                 theFinalState.push_back(*iter);
 
 1765             theSecondaryList.clear();
 
 1779 #ifdef debug_BIC_StepParticlesOut 
 1783         if ( counter > 100 && theCollisionMgr->
Entries() == 0)   
 
 1785 #ifdef debug_BIC_StepParticlesOut 
 1786             PrintKTVector(&theSecondaryList,std::string(
"stepping 100 steps"));
 
 1788             FindCollisions(&theSecondaryList);
 
 1796     #ifdef debug_BIC_return 
 1797             G4cout << 
"return @ Z=0 after collision loop "<< 
G4endl;
 
 1798             PrintKTVector(&theSecondaryList,std::string(
" theSecondaryList"));
 
 1799             G4cout << 
"theTargetList size: " << theTargetList.size() << 
G4endl;
 
 1800             PrintKTVector(&theTargetList,std::string(
" theTargetList"));
 
 1801             PrintKTVector(&theCapturedList,std::string(
" theCapturedList"));
 
 1803             G4cout << 
" ExcitE be4 Correct : " <<GetExcitationEnergy() << 
G4endl;
 
 1804             G4cout << 
" Mom Transfered to nucleus : " << theMomentumTransfer << 
" " << theMomentumTransfer.
mag() << 
G4endl;
 
 1805             PrintKTVector(&theFinalState,std::string(
" FinalState uncorrected"));
 
 1821 G4double G4BinaryCascade::CorrectShortlivedPrimaryForFermi(
 
 1830         if ( std::abs(PDGcode) > 1000 && PDGcode != 2112 && PDGcode != 2212 )
 
 1837         std::vector<G4KineticTrack *>::iterator titer;
 
 1838         for ( titer=target_collection.begin() ; titer!=target_collection.end(); ++titer)
 
 1856     for ( std::vector<G4KineticTrack *>::iterator i =products->begin(); i != products->end(); i++)
 
 1858         G4int PDGcode=(*i)->GetDefinition()->GetPDGEncoding();
 
 1860         final_Efermi+=((
G4RKPropagation *)thePropagator)->GetField(PDGcode,(*i)->GetPosition());
 
 1861         if ( std::abs(PDGcode) > 1000 && PDGcode != 2112 && PDGcode != 2212 )
 
 1863             resonances.push_back(*i);
 
 1866     if ( resonances.size() > 0 )
 
 1868         G4double delta_Fermi= (initial_Efermi-final_Efermi)/resonances.size();
 
 1869         for (std::vector<G4KineticTrack *>::iterator res=resonances.begin(); res != resonances.end(); res++)
 
 1873             G4double newEnergy=mom.
e() + delta_Fermi;
 
 1874             G4double newEnergy2= newEnergy*newEnergy;
 
 1876             if ( newEnergy2 < mass2 )
 
 1890 void G4BinaryCascade::CorrectFinalPandE()
 
 1898 #ifdef debug_BIC_CorrectFinalPandE 
 1902     if ( theFinalState.size() == 0 ) 
return;
 
 1904     G4KineticTrackVector::iterator i;
 
 1906     if ( pNucleus.
e() == 0 ) 
return;    
 
 1907 #ifdef debug_BIC_CorrectFinalPandE 
 1912     for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
 
 1914         pFinals += (*i)->Get4Momentum();
 
 1916 #ifdef debug_BIC_CorrectFinalPandE 
 1917         G4cout <<
"CorrectFinalPandE a final " << (*i)->GetDefinition()->GetParticleName()
 
 1918                            << 
" 4mom " << (*i)->Get4Momentum()<< 
G4endl;
 
 1921 #ifdef debug_BIC_CorrectFinalPandE 
 1922     G4cout << 
"CorrectFinalPandE pN pF: " <<pNucleus << 
" " <<pFinals << 
G4endl;
 
 1928 #ifdef debug_BIC_CorrectFinalPandE 
 1929     G4cout << 
"CorrectFinalPandE pCM, CMS pCM " << pCM << 
" " <<toCMS*pCM<< 
G4endl;
 
 1930     G4cout << 
"CorrectFinal CMS pN pF " <<toCMS*pNucleus << 
" " 
 1932             << 
" nucleus initial mass : " <<GetFinal4Momentum().
mag()
 
 1933             <<
" massInNucleus m(nucleus) m(finals) std::sqrt(s): " << massInNucleus << 
" " <<pNucleus.
mag()<< 
" " 
 1934             << pFinals.mag() << 
" " << pCM.
mag() << 
G4endl;
 
 1940     G4double m10 = GetIonMass(currentZ,currentA);
 
 1942     if( s0-(m10+m20)*(m10+m20) < 0 )
 
 1944 #ifdef debug_BIC_CorrectFinalPandE 
 1945         G4cout << 
"G4BinaryCascade::CorrectFinalPandE() : error! " << 
G4endl;
 
 1947         G4cout << 
"not enough mass to correct: mass^2, A,Z, mass(nucl), mass(finals) " 
 1948                 << (s0-(m10+m20)*(m10+m20)) << 
" " 
 1949                 << currentA << 
" " << currentZ << 
" " 
 1950                 << m10 << 
" " << m20
 
 1954         PrintKTVector(&theFinalState,
" mass problem");
 
 1960     G4double pInCM = std::sqrt((s0-(m10+m20)*(m10+m20))*(s0-(m10-m20)*(m10-m20))/(4.*s0));
 
 1961 #ifdef debug_BIC_CorrectFinalPandE 
 1962     G4cout <<
" CorrectFinalPandE pInCM  new, CURRENT, ratio : " << pInCM
 
 1963             << 
" " << (pFinals).vect().mag()<< 
" " <<  pInCM/(pFinals).vect().mag() << 
G4endl;
 
 1965     if ( pFinals.vect().mag() > pInCM )
 
 1972         for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
 
 1975             G4ThreeVector p3(factor*(toCMS*(*i)->Get4Momentum()).vect());
 
 1979 #ifdef debug_BIC_CorrectFinalPandE 
 1982             (*i)->Set4Momentum(
p);
 
 1984 #ifdef debug_BIC_CorrectFinalPandE 
 1985         G4cout << 
"CorrectFinalPandE nucleus corrected mass : " << GetFinal4Momentum() << 
" " 
 1986                 <<GetFinal4Momentum().
mag() << G4endl
 
 1987                 << 
" CMS pFinals , mag, 3.mag : " << qFinals << 
" " << qFinals.mag() << 
" " << qFinals.vect().mag()<< 
G4endl;
 
 1988         G4cerr << 
" -CorrectFinalPandE 5 " << factor <<  
G4endl;
 
 1991 #ifdef debug_BIC_CorrectFinalPandE 
 1992     else { 
G4cerr << 
" -CorrectFinalPandE 6 - no correction done" << 
G4endl; }
 
 1998 void G4BinaryCascade::UpdateTracksAndCollisions(
 
 2004     std::vector<G4KineticTrack *>::iterator iter1, iter2;
 
 2009         if(!oldSecondaries->empty())
 
 2011             for(iter1 = oldSecondaries->begin(); iter1 != oldSecondaries->end();
 
 2014                 iter2 = std::find(theSecondaryList.begin(), theSecondaryList.end(),
 
 2016                 if ( iter2 != theSecondaryList.end() ) theSecondaryList.erase(iter2);
 
 2026         if(oldTarget->size()!=0)
 
 2030             for(iter1 = oldTarget->begin(); iter1 != oldTarget->end(); ++iter1)
 
 2032                 iter2 = std::find(theTargetList.begin(), theTargetList.end(),
 
 2034                 theTargetList.erase(iter2);
 
 2042         if(!newSecondaries->empty())
 
 2045             for(iter1 = newSecondaries->begin(); iter1 != newSecondaries->end();
 
 2048                 theSecondaryList.push_back(*iter1);
 
 2051                    PrintKTVector(*iter1, 
"undefined in FindCollisions");
 
 2057             FindCollisions(newSecondaries);
 
 2072         ktv(out), wanted_state(astate)
 
 2076         if ( (kt)->GetState() == wanted_state ) ktv->push_back(kt);
 
 2087 #ifdef debug_BIC_DoTimeStep 
 2089     debug.push_back(
"======> DoTimeStep 1"); 
debug.dump();
 
 2090     G4cerr <<
"G4BinaryCascade::DoTimeStep: enter step="<< theTimeStep
 
 2091             << 
" , time="<<theCurrentTime << 
G4endl;
 
 2092     PrintKTVector(&theSecondaryList, std::string(
"DoTimeStep - theSecondaryList"));
 
 2097     std::vector<G4KineticTrack *>::iterator iter;
 
 2100     std::for_each( theSecondaryList.begin(),theSecondaryList.end(),
 
 2105     std::for_each( theSecondaryList.begin(),theSecondaryList.end(),
 
 2110 #ifdef debug_BIC_DoTimeStep 
 2116     thePropagator->
Transport(theSecondaryList, dummy, theTimeStep);
 
 2123 #ifdef debug_BIC_DoTimeStep 
 2124     G4cout << 
"DoTimeStep : theMomentumTransfer = " << theMomentumTransfer << 
G4endl;
 
 2125     PrintKTVector(&theSecondaryList, std::string(
"DoTimeStep - secondaries aft trsprt"));
 
 2133     std::for_each( kt_outside->begin(),kt_outside->end(),
 
 2140     std::for_each( kt_inside->begin(),kt_inside->end(),
 
 2150         kt_gone_in->clear();
 
 2151         std::for_each( kt_outside->begin(),kt_outside->end(),
 
 2154         kt_gone_out->clear();
 
 2155         std::for_each( kt_inside->begin(),kt_inside->end(),
 
 2158 #ifdef debug_BIC_DoTimeStep 
 2159         PrintKTVector(fail,std::string(
" Failed to go in/out -> miss_nucleus/captured"));
 
 2160         PrintKTVector(kt_gone_in, std::string(
"recreated kt_gone_in"));
 
 2161         PrintKTVector(kt_gone_out, std::string(
"recreated kt_gone_out"));
 
 2167     std::for_each( kt_outside->begin(),kt_outside->end(),
 
 2170     std::for_each( kt_outside->begin(),kt_outside->end(),
 
 2173 #ifdef debug_BIC_DoTimeStep 
 2174     PrintKTVector(kt_gone_out, std::string(
"append gone_outs to final state.. theFinalState"));
 
 2177     theFinalState.insert(theFinalState.end(),
 
 2178             kt_gone_out->begin(),kt_gone_out->end());
 
 2182     std::for_each( theSecondaryList.begin(),theSecondaryList.end(),
 
 2188     if ( theCollisionMgr->
Entries()> 0 )
 
 2190         if (kt_gone_out->size() )
 
 2193             iter = std::find(kt_gone_out->begin(),kt_gone_out->end(),nextPrimary);
 
 2194             if ( iter !=  kt_gone_out->end() )
 
 2197 #ifdef debug_BIC_DoTimeStep 
 2198                 G4cout << 
" DoTimeStep - WARNING: deleting current collision!" << 
G4endl;
 
 2202         if ( kt_captured->size() )
 
 2205             iter = std::find(kt_captured->begin(),kt_captured->end(),nextPrimary);
 
 2206             if ( iter !=  kt_captured->end() )
 
 2209 #ifdef debug_BIC_DoTimeStep 
 2210                 G4cout << 
" DoTimeStep - WARNING: deleting current collision!" << 
G4endl;
 
 2217     UpdateTracksAndCollisions(kt_gone_out,0 ,0);
 
 2220     if ( kt_captured->size() )
 
 2222         theCapturedList.insert(theCapturedList.end(),
 
 2223                 kt_captured->begin(),kt_captured->end());
 
 2227         std::vector<G4KineticTrack *>::iterator i_captured;
 
 2228         for(i_captured=kt_captured->begin();i_captured!=kt_captured->end();i_captured++)
 
 2230             (*i_captured)->Hit();
 
 2233         UpdateTracksAndCollisions(kt_captured, NULL, NULL);
 
 2236 #ifdef debug_G4BinaryCascade 
 2239     std::for_each( theSecondaryList.begin(),theSecondaryList.end(),
 
 2241     if ( currentZ != (GetTotalCharge(theTargetList)
 
 2242             + GetTotalCharge(theCapturedList)
 
 2243             + GetTotalCharge(*kt_inside)) )
 
 2245         G4cout << 
" error-DoTimeStep aft, A, Z: " << currentA << 
" " << currentZ
 
 2246                 << 
" sum(tgt,capt,active) " 
 2247                 << GetTotalCharge(theTargetList) + GetTotalCharge(theCapturedList) + GetTotalCharge(*kt_inside)
 
 2248                 << 
" targets: "  << GetTotalCharge(theTargetList)
 
 2249                 << 
" captured: " << GetTotalCharge(theCapturedList)
 
 2250                 << 
" active: "   << GetTotalCharge(*kt_inside)
 
 2262     theCurrentTime += theTimeStep;
 
 2276     std::vector<G4KineticTrack *>::iterator iter;
 
 2281         G4int secondaries_in(0);
 
 2282         G4int secondaryBarions_in(0);
 
 2283         G4int secondaryCharge_in(0);
 
 2286         for ( iter =in->begin(); iter != in->end(); ++iter)
 
 2289             secondaryCharge_in += 
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
 
 2290             if ((*iter)->GetDefinition()->GetBaryonNumber()!=0 )
 
 2292                 secondaryBarions_in += (*iter)->GetDefinition()->GetBaryonNumber();
 
 2296                     secondaryMass_in += (*iter)->GetDefinition()->GetPDGMass();
 
 2302         G4double mass_initial= GetIonMass(currentZ,currentA);
 
 2304         currentZ += secondaryCharge_in;
 
 2305         currentA += secondaryBarions_in;
 
 2310         G4double mass_final= GetIonMass(currentZ,currentA);
 
 2312         G4double correction= secondaryMass_in + mass_initial - mass_final;
 
 2313         if (secondaries_in>1)
 
 2314         {correction /= secondaries_in;}
 
 2316 #ifdef debug_BIC_CorrectBarionsOnBoundary 
 2317         G4cout << 
"CorrectBarionsOnBoundary,currentZ,currentA," 
 2318                 << 
"secondaryCharge_in,secondaryBarions_in," 
 2319                 << 
"energy correction,m_secondry,m_nucl_init,m_nucl_final " 
 2320                 << currentZ << 
" "<< currentA <<
" " 
 2321                 << secondaryCharge_in<<
" "<<secondaryBarions_in<<
" " 
 2322                 << correction << 
" " 
 2323                 << secondaryMass_in << 
" " 
 2324                 << mass_initial << 
" " 
 2325                 << mass_final << 
" " 
 2327         PrintKTVector(in,std::string(
"in be4 correction"));
 
 2329         for ( iter = in->begin(); iter != in->end(); ++iter)
 
 2331             if ((*iter)->GetTrackingMomentum().e()+correction > (*iter)->GetActualMass())
 
 2333                 (*iter)->UpdateTrackingMomentum((*iter)->GetTrackingMomentum().e() + correction);
 
 2340                 (*iter)->UpdateTrackingMomentum((*iter)->GetTrackingMomentum().e() + barrier);
 
 2342                 kt_fail->push_back(*iter);
 
 2343                 currentZ -= 
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
 
 2344                 currentA -= (*iter)->GetDefinition()->GetBaryonNumber();
 
 2349 #ifdef debug_BIC_CorrectBarionsOnBoundary 
 2350         G4cout << 
" CorrectBarionsOnBoundary, aft, Z, A, sec-Z,A,m,m_in_nucleus " 
 2351                 << currentZ << 
" " << currentA << 
" " 
 2352                 << secondaryCharge_in << 
" " << secondaryBarions_in << 
" " 
 2353                 << secondaryMass_in  << 
" " 
 2355         PrintKTVector(in,std::string(
"in AFT correction"));
 
 2362         G4int secondaries_out(0);
 
 2363         G4int secondaryBarions_out(0);
 
 2364         G4int secondaryCharge_out(0);
 
 2367         for ( iter =out->begin(); iter != out->end(); ++iter)
 
 2370             secondaryCharge_out += 
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
 
 2371             if ((*iter)->GetDefinition()->GetBaryonNumber() !=0 )
 
 2373                 secondaryBarions_out += (*iter)->GetDefinition()->GetBaryonNumber();
 
 2377                     secondaryMass_out += (*iter)->GetDefinition()->GetPDGMass();
 
 2384         G4double mass_initial=  GetIonMass(currentZ,currentA);
 
 2385         currentA -=secondaryBarions_out;
 
 2386         currentZ -=secondaryCharge_out;
 
 2395             G4cerr << 
"G4BinaryCascade - secondaryBarions_out,secondaryCharge_out " <<
 
 2396                     secondaryBarions_out << 
" " << secondaryCharge_out << 
G4endl;
 
 2397             PrintKTVector(&theTargetList,
"CorrectBarionsOnBoundary Target");
 
 2398             PrintKTVector(&theCapturedList,
"CorrectBarionsOnBoundary Captured");
 
 2399             PrintKTVector(&theSecondaryList,
"CorrectBarionsOnBoundary Secondaries");
 
 2400             G4cerr << 
"G4BinaryCascade - currentA, currentZ " << currentA << 
" " << currentZ << 
G4endl;
 
 2401             throw G4HadronicException(__FILE__, __LINE__, 
"G4BinaryCascade::CorrectBarionsOnBoundary() - fatal error");
 
 2403         G4double mass_final=GetIonMass(currentZ,currentA);
 
 2404         G4double correction= mass_initial - mass_final - secondaryMass_out;
 
 2407         if (secondaries_out>1) correction /= secondaries_out;
 
 2408 #ifdef debug_BIC_CorrectBarionsOnBoundary 
 2409         G4cout << 
"DoTimeStep,(current Z,A)," 
 2410                 << 
"(secondaries out,Charge,Barions)," 
 2411                 <<
"* energy correction,(m_secondry,m_nucl_init,m_nucl_final) " 
 2412                 << 
"("<< currentZ << 
","<< currentA <<
") (" 
 2413                 << secondaries_out << 
"," 
 2414                 << secondaryCharge_out<<
","<<secondaryBarions_out<<
") * " 
 2415                 << correction << 
" (" 
 2416                 << secondaryMass_out << 
", " 
 2417                 << mass_initial << 
", " 
 2418                 << mass_final << 
")" 
 2420         PrintKTVector(out,std::string(
"out be4 correction"));
 
 2423         for ( iter = out->begin(); iter != out->end(); ++iter)
 
 2425             if ((*iter)->GetTrackingMomentum().e()+correction > (*iter)->GetActualMass())
 
 2427                 (*iter)->UpdateTrackingMomentum((*iter)->GetTrackingMomentum().e() + correction);
 
 2438                     (*iter)->UpdateTrackingMomentum((*iter)->GetTrackingMomentum().e() - barrier);
 
 2440                     kt_fail->push_back(*iter);
 
 2441                     currentZ += 
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
 
 2442                     currentA += (*iter)->GetDefinition()->GetBaryonNumber();
 
 2444 #ifdef debug_BIC_CorrectBarionsOnBoundary 
 2447                     G4cout << 
"Not correcting outgoing " << *iter << 
" " 
 2448                             << (*iter)->GetDefinition()->GetPDGEncoding() << 
" " 
 2449                             << (*iter)->GetDefinition()->GetParticleName() << 
G4endl;
 
 2450                     PrintKTVector(out,std::string(
"outgoing, one not corrected"));
 
 2456 #ifdef debug_BIC_CorrectBarionsOnBoundary 
 2457         PrintKTVector(out,std::string(
"out AFTER correction"));
 
 2458         G4cout << 
" DoTimeStep, nucl-update, A, Z, sec-Z,A,m,m_in_nucleus, table-mass, delta " 
 2459                 << currentA << 
" "<< currentZ << 
" " 
 2460                 << secondaryCharge_out << 
" "<< secondaryBarions_out << 
" "<<
 
 2461                 secondaryMass_out << 
" " 
 2462                 << massInNucleus << 
" " 
 2463                 << GetIonMass(currentZ,currentA)
 
 2464                 << 
" " << massInNucleus - GetIonMass(currentZ,currentA)
 
 2475 G4Fragment * G4BinaryCascade::FindFragments()
 
 2479 #ifdef debug_BIC_FindFragments 
 2480     G4cout << 
"target, captured, secondary: " 
 2481             << theTargetList.size() << 
" " 
 2482             << theCapturedList.size()<< 
" " 
 2483             << theSecondaryList.size()
 
 2487     G4int a = theTargetList.size()+theCapturedList.size();
 
 2489     G4KineticTrackVector::iterator i;
 
 2490     for(i = theTargetList.begin(); i != theTargetList.end(); ++i)
 
 2492         if(
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus) == 1 )
 
 2498     G4int zCaptured = 0;
 
 2500     for(i = theCapturedList.begin(); i != theCapturedList.end(); ++i)
 
 2502         CapturedMomentum += (*i)->Get4Momentum();
 
 2503         if(
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus) == 1 )
 
 2509     G4int z = zTarget+zCaptured;
 
 2511 #ifdef debug_G4BinaryCascade 
 2512     if ( z != (GetTotalCharge(theTargetList) + GetTotalCharge(theCapturedList)) )
 
 2514         G4cout << 
" FindFragment Counting error z a " << z << 
" " <<a << 
" " 
 2515                 << GetTotalCharge(theTargetList) << 
" " <<  GetTotalCharge(theCapturedList)<<
 
 2517         PrintKTVector(&theTargetList, std::string(
"theTargetList"));
 
 2518         PrintKTVector(&theCapturedList, std::string(
"theCapturedList"));
 
 2532     if ( z < 1 ) 
return 0;
 
 2535     G4int excitons = theCapturedList.size();
 
 2536 #ifdef debug_BIC_FindFragments 
 2537     G4cout << 
"Fragment: a= " << a << 
" z= " << z << 
" particles= " <<  excitons
 
 2538             << 
" Charged= " << zCaptured << 
" holes= " << holes
 
 2539             << 
" excitE= " <<GetExcitationEnergy()
 
 2540             << 
" Final4Momentum= " << GetFinalNucleusMomentum() << 
" capturMomentum= " << CapturedMomentum
 
 2561     G4LorentzVector final4Momentum = theInitial4Mom + theProjectile4Momentum;
 
 2563     for(G4KineticTrackVector::iterator i = theFinalState.begin(); i != theFinalState.end(); ++i)
 
 2565         final4Momentum -= (*i)->Get4Momentum();
 
 2566         finals         += (*i)->Get4Momentum();
 
 2569     if(final4Momentum.
e()> 0 && (final4Momentum.
vect()/final4Momentum.
e()).mag()>1.0 && currentA > 0)
 
 2571 #ifdef debug_BIC_Final4Momentum 
 2573         G4cerr << 
"G4BinaryCascade::GetFinal4Momentum - Fatal"<<
G4endl;
 
 2574         G4KineticTrackVector::iterator i;
 
 2575         G4cerr <<
"Total initial 4-momentum " << theProjectile4Momentum << 
G4endl;
 
 2576         G4cerr <<
" GetFinal4Momentum: Initial nucleus "<<theInitial4Mom<<
G4endl;
 
 2577         for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
 
 2579             G4cerr <<
" Final state: "<<(*i)->Get4Momentum()<<(*i)->GetDefinition()->GetParticleName()<<
G4endl;
 
 2582         G4cerr<< 
" Final4Momentum = "<<final4Momentum <<
" "<<final4Momentum.
m()<<
G4endl;
 
 2583         G4cerr <<
" current A, Z = "<< currentA<<
", "<<currentZ<<
G4endl;
 
 2589     return final4Momentum;
 
 2600     G4KineticTrackVector::iterator i;
 
 2602     for(i = theCapturedList.begin(); i != theCapturedList.end(); ++i)
 
 2604         CapturedMomentum += (*i)->Get4Momentum();
 
 2610     if ( NucleusMomentum.
e() > 0 )
 
 2614         G4ThreeVector boost= (NucleusMomentum.
vect() -CapturedMomentum.vect())/NucleusMomentum.
e();
 
 2615         if(boost.
mag2()>1.0)
 
 2617 #     ifdef debug_BIC_FinalNucleusMomentum 
 2618             G4cerr << 
"G4BinaryCascade::GetFinalNucleusMomentum - Fatal"<<
G4endl;
 
 2620             G4cerr << 
"it 01"<<NucleusMomentum<<
" "<<CapturedMomentum<<
" "<<
G4endl;
 
 2627         precompoundLorentzboost.
set( boost );
 
 2628 #ifdef debug_debug_BIC_FinalNucleusMomentum 
 2629         G4cout << 
"GetFinalNucleusMomentum be4 boostNucleusMomentum, CapturedMomentum"<<NucleusMomentum<<
" "<<CapturedMomentum<<
" "<<
G4endl;
 
 2631         NucleusMomentum *= nucleusBoost;
 
 2632 #ifdef debug_BIC_FinalNucleusMomentum 
 2633         G4cout << 
"GetFinalNucleusMomentum aft boost GetFinal4Momentum= " <<NucleusMomentum <<
G4endl;
 
 2636     return NucleusMomentum;
 
 2653     std::vector<G4KineticTrack *>::iterator iter, jter;
 
 2658     while(!done && tryCount++ <200)                                 
 
 2665         secs = theH1Scatterer->
Scatter(*(*secondaries).front(), aTarget);
 
 2666 #ifdef debug_H1_BinaryCascade 
 2667         PrintKTVector(secs,
" From Scatter");
 
 2669         for(
size_t ss=0; secs && ss<secs->size(); ss++)
 
 2672             if((*secs)[ss]->GetDefinition()->IsShortLived()) done = 
true;
 
 2676     ClearAndDestroy(&theFinalState);
 
 2677     ClearAndDestroy(secondaries);
 
 2680     for(
size_t current=0; secs && current<secs->size(); current++)
 
 2682         if((*secs)[current]->GetDefinition()->IsShortLived())
 
 2686             for(jter=dec->begin(); jter != dec->end(); jter++)
 
 2689                 secs->push_back(*jter);
 
 2692             delete (*secs)[current];
 
 2699             theFinalState.push_back((*secs)[current]);
 
 2704 #ifdef debug_H1_BinaryCascade 
 2705     PrintKTVector(&theFinalState,
" FinalState");
 
 2707     for(iter = theFinalState.begin(); iter != theFinalState.end(); ++iter)
 
 2713         products->push_back(aNew);
 
 2714 #ifdef debug_H1_BinaryCascade 
 2719                 G4cout << 
"final shortlived : ";
 
 2722                 G4cout << 
"final un stable : ";
 
 2729     theFinalState.clear();
 
 2754     } 
while (
sqr(x1) +
sqr(x2) > 1.);                       
 
 2780     std::vector<G4KineticTrack *>::iterator i;
 
 2781     for(i = ktv->begin(); i != ktv->end(); ++i)
 
 2790     std::vector<G4ReactionProduct *>::iterator i;
 
 2791     for(i = rpv->begin(); i != rpv->end(); ++i)
 
 2800     if (comment.size() > 0 ) 
G4cout << 
"G4BinaryCascade::PrintKTVector() " << comment << G4endl;
 
 2802         G4cout << 
"  vector: " << ktv << 
", number of tracks: " << ktv->size()
 
 2804         std::vector<G4KineticTrack *>::iterator i;
 
 2807         for(count = 0, i = ktv->begin(); i != ktv->end(); ++i, ++count)
 
 2810             G4cout << 
"  track n. " << count;
 
 2814         G4cout << 
"G4BinaryCascade::PrintKTVector():No KineticTrackVector given " << 
G4endl;
 
 2818 void G4BinaryCascade::PrintKTVector(
G4KineticTrack * kt, std::string comment)
 
 2821     if (comment.size() > 0 ) 
G4cout << 
"G4BinaryCascade::PrintKTVector() "<< comment << G4endl;
 
 2834         G4cout << 
"G4BinaryCascade::PrintKTVector(): No Kinetictrack given" << 
G4endl;
 
 2844     if ( Z > 0 && A >= Z )
 
 2848     } 
else if ( A > 0 && Z>0 )
 
 2853     } 
else if ( A >= 0 && Z<=0 )
 
 2858     } 
else if ( A == 0  )
 
 2865         G4cerr << 
"G4BinaryCascade::GetIonMass() - invalid (A,Z) = (" 
 2866                 << A << 
"," << Z << 
")" <<
G4endl;
 
 2867         throw G4HadronicException(__FILE__, __LINE__, 
"G4BinaryCascade::GetIonMass() - giving up");
 
 2878     std::vector<G4KineticTrack *>::iterator iter;
 
 2879     std::vector<G4ReactionProduct *>::iterator rpiter;
 
 2880     decayKTV.
Decay(&theFinalState);
 
 2882     for(iter = theFinalState.begin(); iter != theFinalState.end(); ++iter)
 
 2885         aNew->
SetMomentum((*iter)->Get4Momentum().vect());
 
 2887         Esecondaries +=(*iter)->Get4Momentum().e();
 
 2888         psecondaries +=(*iter)->Get4Momentum();
 
 2891         products->push_back(aNew);
 
 2896     while(theCollisionMgr->
Entries() > 0)        
 
 2903             if ( lates->size() == 1 ) {
 
 2913                 products->push_back(aNew);
 
 2923     decayKTV.
Decay(&theSecondaryList);
 
 2927     if ( (theSecondaryList.size() + theCapturedList.size()) > 0)
 
 2929         transferCorrection= theMomentumTransfer /(theSecondaryList.size() + theCapturedList.size());
 
 2932     for(iter = theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
 
 2935         (*iter)->Update4Momentum((*iter)->Get4Momentum().vect()+transferCorrection);
 
 2936         aNew->
SetMomentum((*iter)->Get4Momentum().vect());
 
 2938         Esecondaries +=(*iter)->Get4Momentum().e();
 
 2939         psecondaries +=(*iter)->Get4Momentum();
 
 2941         products->push_back(aNew);
 
 2945     for(iter = theCapturedList.begin(); iter != theCapturedList.end(); ++iter)
 
 2948         (*iter)->Update4Momentum((*iter)->Get4Momentum().vect()+transferCorrection);
 
 2949         aNew->
SetMomentum((*iter)->Get4Momentum().vect());
 
 2951         Esecondaries +=(*iter)->Get4Momentum().e();
 
 2952         psecondaries +=(*iter)->Get4Momentum();
 
 2954         products->push_back(aNew);
 
 2959     for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter)
 
 2961         SumMassNucleons += (*iter)->GetDefinition()->GetPDGMass();
 
 2962         pNucleons += (*iter)->Get4Momentum();
 
 2965     G4double Ekinetic=theProjectile4Momentum.e() + initial_nuclear_mass - Esecondaries - SumMassNucleons;
 
 2966      #ifdef debug_BIC_FillVoidnucleus 
 2968                             psecondaries - pNucleons;
 
 2972     if (Ekinetic > 0. && theTargetList.size()){
 
 2973         Ekinetic /= theTargetList.size();
 
 2978         for (rpiter=products->begin(); rpiter!=products->end(); ++rpiter){
 
 2979             TotalEkin+=(*rpiter)->GetKineticEnergy();
 
 2982         if ( std::abs(Ekinetic) < 20*
perCent * TotalEkin ){
 
 2983             correction=1. + (Ekinetic-Ekineticrdm)/TotalEkin;   
 
 2985         #ifdef debug_G4BinaryCascade 
 2987                 G4cout << 
"BLIC::FillVoidNucleus() fail correction, Ekinetic, TotalEkin " << Ekinetic << 
""<< TotalEkin << 
G4endl;
 
 2991         for (rpiter=products->begin(); rpiter!=products->end(); ++rpiter){
 
 2992             (*rpiter)->SetKineticEnergy((*rpiter)->GetKineticEnergy()*correction);  
 
 2993             (*rpiter)->SetMomentum((*rpiter)->GetTotalMomentum() * (*rpiter)->GetMomentum().unit());
 
 2997         Ekinetic=Ekineticrdm*correction;
 
 2998         if (theTargetList.size())Ekinetic /= theTargetList.size();
 
 3002     for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter) {
 
 3009         products->push_back(aNew);
 
 3014     for (rpiter=products->begin(); rpiter!=products->end(); ++rpiter){
 
 3015         psecondaries += 
G4LorentzVector((*rpiter)->GetMomentum(),(*rpiter)->GetTotalEnergy() );
 
 3027     SumMom=initial4Mom.
vect()-SumMom;
 
 3030     std::vector<G4ReactionProduct *>::reverse_iterator 
reverse;  
 
 3031     while ( SumMom.
mag() > 0.1*
MeV && loopcount++ < 10)           
 
 3033         G4int index=products->size();
 
 3034         for (reverse=products->rbegin(); reverse!=products->rend(); ++
reverse, --index){
 
 3035             SumMom=initial4Mom.
vect();
 
 3036             for (rpiter=products->begin(); rpiter!=products->end(); ++rpiter){
 
 3037                 SumMom-=(*rpiter)->GetMomentum();
 
 3040             G4double p=((*reverse)->GetMomentum()).mag();
 
 3041             (*reverse)->SetMomentum(  p*(((*reverse)->GetMomentum()+SumMom).unit()));
 
 3052     std::vector<G4KineticTrack *>::iterator iter;
 
 3053     for(iter = secondaries->begin(); iter != secondaries->end(); ++iter)
 
 3056         aNew->
SetMomentum((*iter)->Get4Momentum().vect());
 
 3060         products->push_back(aNew);
 
 3063     if (currentA == 1 && currentZ == 0) {
 
 3065     } 
else if (currentA == 1 && currentZ == 1) {
 
 3067     } 
else if (currentA == 2 && currentZ == 1) {
 
 3069     } 
else if (currentA == 3 && currentZ == 1) {
 
 3071     } 
else if (currentA == 3 && currentZ == 2) {
 
 3073     } 
else if (currentA == 4 && currentZ == 2) {
 
 3079     if (fragment != 0) {
 
 3085         products->push_back(theNew);
 
 3090 void G4BinaryCascade::PrintWelcomeMessage()
 
 3092     G4cout <<
"Thank you for using G4BinaryCascade. "<<
G4endl;
 
 3102       for ( std::vector<G4KineticTrack *>::iterator i =products->begin(); i != products->end(); i++)
 
 3104          G4int PDGcode=std::abs((*i)->GetDefinition()->GetPDGEncoding());
 
 3105          if (std::abs(PDGcode)==211 || PDGcode==111 ) havePion=
true;
 
 3108    if ( !products  || havePion)
 
 3111       G4cout << 
" Collision " << collision << 
", type: "<< 
typeid(action).
name()
 
 3112                                                 << 
", with NO products! " <<
G4endl;
 
 3113       G4cout << G4endl<<
"Initial condition are these:"<<
G4endl;
 
 3129 G4bool G4BinaryCascade::CheckChargeAndBaryonNumber(
G4String where)
 
 3131    static G4int lastdA(0), lastdZ(0);
 
 3138    std::vector<G4KineticTrack *>::iterator i;
 
 3139    G4int CapturedA(0), CapturedZ(0);
 
 3140    G4int secsA(0), secsZ(0);
 
 3141    for ( i=theCapturedList.begin(); i!=theCapturedList.end(); ++i) {
 
 3142       CapturedA += (*i)->GetDefinition()->GetBaryonNumber();
 
 3143       CapturedZ += 
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
 
 3146    for ( i=theSecondaryList.begin(); i!=theSecondaryList.end(); ++i) {
 
 3148          secsA += (*i)->GetDefinition()->GetBaryonNumber();
 
 3149          secsZ += 
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
 
 3153    for ( i=theFinalState.begin(); i!=theFinalState.end(); ++i) {
 
 3154       fStateA += (*i)->GetDefinition()->GetBaryonNumber();
 
 3155       fStateZ += 
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
 
 3158    G4int deltaA= iStateA -  secsA - fStateA -currentA - lateA;
 
 3159    G4int deltaZ= iStateZ -  secsZ - fStateZ -currentZ - lateZ;
 
 3161 #ifdef debugCheckChargeAndBaryonNumberverbose    
 3162     G4cout << where <<
" A: iState= "<< iStateA<<
", secs= "<< secsA<< 
", fState= "<< fStateA<< 
", current= "<<currentA<< 
", late= " <<lateA << 
G4endl;   
 
 3163     G4cout << where <<
" Z: iState= "<< iStateZ<<
", secs= "<< secsZ<< 
", fState= "<< fStateZ<< 
", current= "<<currentZ<< 
", late= " <<lateZ << 
G4endl;   
 
 3166    if (deltaA != 0  || deltaZ!=0 ) {
 
 3167       if (deltaA != lastdA || deltaZ != lastdZ ) {
 
 3168          G4cout << 
"baryon/charge imbalance - " << where << G4endl
 
 3169                << 
"deltaA " <<deltaA<<
", iStateA "<<iStateA<< 
",  CapturedA "<<CapturedA <<
",  secsA "<<secsA
 
 3170                << 
", fStateA "<<fStateA << 
", currentA "<<currentA << 
", lateA "<<lateA << G4endl
 
 3171                << 
"deltaZ "<<deltaZ<<
", iStateZ "<<iStateZ<< 
",  CapturedZ "<<CapturedZ <<
",  secsZ "<<secsZ
 
 3172                << 
", fStateZ "<<fStateZ << 
", currentZ "<<currentZ << 
", lateZ "<<lateZ << G4endl<< 
G4endl;
 
 3176    } 
else { lastdA=lastdZ=0;}
 
 3185     PrintKTVector(collision->
GetPrimary(),std::string(
" Primary particle"));
 
 3187     PrintKTVector(products,std::string(
" Scatterer products"));
 
 3204                           << 
" " << initial << G4endl;;
 
 3207     for ( 
unsigned int it=0; it < ktv.size(); it++)
 
 3220                       << 
" " << initial <<
" Excit " << thisExcitation << G4endl;;
 
 3225     G4int product_barions(0);
 
 3228         for ( 
unsigned int it=0; it < products->size(); it++)
 
 3240                          << 
" " << 
final << G4endl;;
 
 3245     G4int finalA = currentA;
 
 3246     G4int finalZ = currentZ;
 
 3249         finalA -= product_barions;
 
 3250         finalZ -= GetTotalCharge(*products);
 
 3252     G4double delta = GetIonMass(currentZ,currentA) - (GetIonMass(finalZ,finalA) + mass_out);
 
 3253     G4cout << 
" current/final a,z " << currentA << 
" " << currentZ << 
" "<< finalA<< 
" "<< finalZ
 
 3254             <<  
" delta-mass " << delta<<
G4endl;
 
 3256     mass_out  = GetIonMass(finalZ,finalA);
 
 3257     G4cout << 
" initE/ E_out/ Mfinal/ Excit " << currentInitialEnergy
 
 3258             << 
" " <<   
final << 
" " 
 3260             <<  currentInitialEnergy - 
final - mass_out
 
 3262     currentInitialEnergy-=
final;
 
 3271     G4ReactionProductVector::iterator iter;
 
 3279     for(iter = products->begin(); iter != products->end(); ++iter)
 
 3282            G4cout << 
" Secondary E - Ekin / p " <<
 
 3283               (*iter)->GetDefinition()->GetParticleName() << 
" " <<
 
 3284               (*iter)->GetTotalEnergy() << 
" - " <<
 
 3285               (*iter)->GetKineticEnergy()<< 
" / " <<
 
 3286               (*iter)->GetMomentum().x() << 
" " <<
 
 3287               (*iter)->GetMomentum().y() << 
" " <<
 
 3288               (*iter)->GetMomentum().z() << 
G4endl;
 
 3289         Efinal += (*iter)->GetTotalEnergy();
 
 3290         pFinal += (*iter)->GetMomentum();
 
 3293       G4cout << 
"e outgoing/ total : " << Efinal << 
" " << Efinal+GetFinal4Momentum().
e()<< 
G4endl;
 
 3294       G4cout << 
"BIC E/p delta " <<
 
 3302 G4bool G4BinaryCascade::DebugEpConservation(
const G4String where)
 
 3312     std::vector<G4KineticTrack *>::iterator ktiter;
 
 3313     for(ktiter = theSecondaryList.begin(); ktiter != theSecondaryList.end(); ++ktiter)
 
 3316               G4cout << 
" Secondary E - Ekin / p " <<
 
 3317                  (*ktiter)->GetDefinition()->GetParticleName() << 
" " <<
 
 3318                  (*ktiter)->Get4Momentum().e() << 
" - " <<
 
 3319                  (*ktiter)->Get4Momentum().e() - (*ktiter)->Get4Momentum().mag() << 
" / " <<
 
 3320                  (*ktiter)->Get4Momentum().vect() << 
G4endl;
 
 3321            psecs += (*ktiter)->Get4Momentum();
 
 3324     for(ktiter = theTargetList.begin(); ktiter != theTargetList.end(); ++ktiter)
 
 3327               G4cout << 
" Target E - Ekin / p " <<
 
 3328                  (*ktiter)->GetDefinition()->GetParticleName() << 
" " <<
 
 3329                  (*ktiter)->Get4Momentum().e() << 
" - " <<
 
 3330                  (*ktiter)->Get4Momentum().e() - (*ktiter)->Get4Momentum().mag() << 
" / " <<
 
 3331                  (*ktiter)->Get4Momentum().vect() << 
G4endl;
 
 3332            ptgts += (*ktiter)->Get4Momentum();
 
 3335     for(ktiter = theCapturedList.begin(); ktiter != theCapturedList.end(); ++ktiter)
 
 3338                G4cout << 
" Captured E - Ekin / p " <<
 
 3339                   (*ktiter)->GetDefinition()->GetParticleName() << 
" " <<
 
 3340                   (*ktiter)->Get4Momentum().e() << 
" - " <<
 
 3341                   (*ktiter)->Get4Momentum().e() - (*ktiter)->Get4Momentum().mag() << 
" / " <<
 
 3342                   (*ktiter)->Get4Momentum().vect() << 
G4endl;
 
 3343             pcpts += (*ktiter)->Get4Momentum();
 
 3346     for(ktiter = theFinalState.begin(); ktiter != theFinalState.end(); ++ktiter)
 
 3349                G4cout << 
" Finals E - Ekin / p " <<
 
 3350                   (*ktiter)->GetDefinition()->GetParticleName() << 
" " <<
 
 3351                   (*ktiter)->Get4Momentum().e() << 
" - " <<
 
 3352                   (*ktiter)->Get4Momentum().e() - (*ktiter)->Get4Momentum().mag() << 
" / " <<
 
 3353                   (*ktiter)->Get4Momentum().vect() << 
G4endl;
 
 3354             pfins += (*ktiter)->Get4Momentum();
 
 3357       G4cout << 
" Secondaries " << psecs << 
", Targets " << ptgts << G4endl
 
 3358               <<
" Captured    " << pcpts << 
", Finals  " << pfins << G4endl
 
 3359               <<
" Sum " << psecs + ptgts + pcpts + pfins << 
" PTransfer " << theMomentumTransfer
 
 3360               <<
" Sum+PTransfer " << psecs + ptgts + pcpts + pfins + theMomentumTransfer
 
G4double G4ParticleHPJENDLHEData::G4double result
 
G4double GetWeightChange() const 
 
G4bool IsParticipant() const 
 
static G4Triton * TritonDefinition()
 
Hep3Vector boostVector() const 
 
void Update4Momentum(G4double aEnergy)
 
static G4He3 * He3Definition()
 
void ModelDescription(std::ostream &outFile) const 
 
CascadeState GetState() const 
 
G4double GetTotalMomentum() const 
 
const G4LorentzVector & GetMomentum() const 
 
virtual G4int GetCharge()=0
 
CLHEP::Hep3Vector G4ThreeVector
 
const G4HadProjectile * GetPrimaryProjectile() const 
 
virtual G4ReactionProductVector * DeExcite(G4Fragment &aFragment)=0
 
const G4ThreeVector & GetPosition() const 
 
virtual G4bool StartLoop()=0
 
G4VPreCompoundModel * GetDeExcitation() const 
 
std::vector< ExP01TrackerHit * > a
 
virtual void Transport(G4KineticTrackVector &theActive, const G4KineticTrackVector &theSpectators, G4double theTimeStep)=0
 
void SetKineticEnergy(const G4double en)
 
void RemoveCollision(G4CollisionInitialState *collision)
 
virtual const G4VNuclearDensity * GetNuclearDensity() const =0
 
G4KineticTrack * GetPrimary(void)
 
static constexpr double perCent
 
void SetMomentum(const G4double x, const G4double y, const G4double z)
 
G4bool GetPDGStable() const 
 
G4CollisionInitialState * GetNextCollision()
 
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
 
virtual G4int GetMassNumber()=0
 
static G4Proton * ProtonDefinition()
 
virtual G4ThreeVector GetMomentumTransfer() const =0
 
#define _DebugEpConservation(val)
 
virtual const std::vector< G4CollisionInitialState * > & GetCollisions(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &, G4double theCurrentTime)
 
void SetNumberOfHoles(G4int valueTot, G4int valueP=0)
 
G4int GetPDGEncoding() const 
 
G4double GetActualMass() const 
 
const G4String & GetModelName() const 
 
virtual const G4ThreeVector & GetPosition() const 
 
static void ConstructParticle()
 
#define _CheckChargeAndBaryonNumber_(val)
 
virtual void PropagateModelDescription(std::ostream &) const 
 
G4ReactionProductVector * BreakItUp(const G4Fragment &theInitialState)
 
virtual G4double CoulombBarrier()=0
 
const G4String & GetParticleName() const 
 
void RemoveTracksCollisions(G4KineticTrackVector *ktv)
 
virtual const G4ParticleDefinition * GetDefinition() const 
 
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &theNucleus)
 
void SetNewlyAdded(const G4bool f)
 
G4double GetBarrier(G4int encoding)
 
void SetStatusChange(G4HadFinalStateStatus aS)
 
std::vector< G4ReactionProduct * > G4ReactionProductVector
 
virtual G4double GetOuterRadius()=0
 
G4KineticTrackVector * GetFinalState()
 
void SetMinEnergy(G4double anEnergy)
 
virtual ~G4BinaryCascade()
 
G4ExcitationHandler * GetExcitationHandler() const 
 
G4IonTable * GetIonTable() const 
 
G4GLOB_DLL std::ostream G4cout
 
double A(double temperature)
 
CascadeState SetState(const CascadeState new_state)
 
ParticleList decay(Cluster *const c)
Carries out a cluster decay. 
 
const G4ParticleDefinition * GetDefinition() const 
 
virtual void Init(G4int theA, G4int theZ)=0
 
G4bool nucleon(G4int ityp)
 
static G4PionMinus * PionMinusDefinition()
 
G4double GetIonMass(G4int Z, G4int A, G4int L=0, G4int lvl=0) const 
 
const G4LorentzVector & GetMomentum() const 
 
void SetNucleon(G4Nucleon *aN)
 
G4double GetKineticEnergy() const 
 
void SetTotalEnergy(const G4double en)
 
static constexpr double eplus
 
G4double GetFermiMomentum(G4double density)
 
static G4PionPlus * PionPlusDefinition()
 
static G4Proton * Proton()
 
HepLorentzRotation & set(double bx, double by, double bz)
 
virtual void Init(G4V3DNucleus *theNucleus)=0
 
G4int GetTargetBaryonNumber()
 
static G4Neutron * Neutron()
 
void Set4Momentum(const G4LorentzVector &a4Momentum)
 
void SetNumberOfParticles(G4int value)
 
G4KineticTrackVector & GetTargetCollection(void)
 
virtual G4ReactionProductVector * Propagate(G4KineticTrackVector *, G4V3DNucleus *)
 
const G4LorentzVector & Get4Momentum() const 
 
virtual const std::vector< G4CollisionInitialState * > & GetCollisions(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &, G4double theCurrentTime)
 
G4BinaryCascade(G4VPreCompoundModel *ptr=0)
 
void AddCollision(G4double time, G4KineticTrack *proj, G4KineticTrack *target=NULL)
 
G4double GetKineticEnergy() const 
 
G4HadronicInteraction * FindModel(const G4String &name)
 
void operator()(G4KineticTrack *&kt) const 
 
G4bool IsShortLived() const 
 
void SetEnergyChange(G4double anEnergy)
 
virtual void ModelDescription(std::ostream &) const 
 
G4double GetTotalEnergy() const 
 
std::vector< G4LorentzVector * > * Decay(G4double parent_mass, const std::vector< G4double > &fragment_masses) const 
 
void Init(G4int anA, G4int aZ)
 
void Decay(G4KineticTrackVector *tracks) const 
 
G4double GetPDGMass() const 
 
G4double GetDensity(const G4ThreeVector &aPosition) const 
 
static G4ParticleTable * GetParticleTable()
 
T max(const T t1, const T t2)
brief Return the largest of the two arguments 
 
virtual G4KineticTrackVector * Scatter(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const 
 
G4double energy(const ThreeVector &p, const G4double m)
 
const G4LorentzVector & GetTrackingMomentum() const 
 
static G4HadronicInteractionRegistry * Instance()
 
Hep3Vector orthogonal() const 
 
G4VPreCompoundModel * theDeExcitation
 
static constexpr double GeV
 
G4double GetField(G4int encoding, G4ThreeVector pos)
 
void SetMaxEnergy(const G4double anEnergy)
 
G4ThreeVector GetMomentum() const 
 
void SetDeExcitation(G4VPreCompoundModel *ptr)
 
G4HadFinalState theParticleChange
 
virtual G4double GetMass()=0
 
static constexpr double MeV
 
Hep3Vector cross(const Hep3Vector &) const 
 
void AddSecondary(G4DynamicParticle *aP, G4int mod=-1)
 
G4V3DNucleus * the3DNucleus
 
virtual G4Nucleon * GetNextNucleon()=0
 
HepLorentzRotation inverse() const 
 
void SetNumberOfCharged(G4int value)
 
virtual void DeExciteModelDescription(std::ostream &outFile) const =0
 
G4double GetCollisionTime(void)
 
static constexpr double fermi
 
const G4LorentzVector & Get4Momentum() const 
 
G4double GetPDGCharge() const 
 
void SetEnergyMomentumCheckLevels(G4double relativeLevel, G4double absoluteLevel)
 
const G4ParticleDefinition * GetDefinition() const 
 
static G4Deuteron * DeuteronDefinition()
 
static G4Alpha * AlphaDefinition()
 
static G4Neutron * NeutronDefinition()
 
void SetMomentumChange(const G4ThreeVector &aV)
 
const G4BCAction * GetGenerator()
 
SelectFromKTV(G4KineticTrackVector *out, G4KineticTrack::CascadeState astate)
 
static const G4double pos
 
virtual G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)=0
 
G4GLOB_DLL std::ostream G4cerr
 
G4int GetBaryonNumber() const 
 
CLHEP::HepLorentzVector G4LorentzVector