Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 #include <algorithm> 26 #include <algorithm> 27 #include <vector> 27 #include <vector> 28 #include <cmath> 28 #include <cmath> 29 #include <numeric> 29 #include <numeric> 30 30 31 #include "G4BinaryLightIonReaction.hh" 31 #include "G4BinaryLightIonReaction.hh" 32 #include "G4PhysicalConstants.hh" 32 #include "G4PhysicalConstants.hh" 33 #include "G4SystemOfUnits.hh" 33 #include "G4SystemOfUnits.hh" 34 #include "G4LorentzVector.hh" 34 #include "G4LorentzVector.hh" 35 #include "G4LorentzRotation.hh" 35 #include "G4LorentzRotation.hh" 36 #include "G4ReactionProductVector.hh" 36 #include "G4ReactionProductVector.hh" 37 #include "G4ping.hh" 37 #include "G4ping.hh" 38 #include "G4Delete.hh" 38 #include "G4Delete.hh" 39 #include "G4Neutron.hh" 39 #include "G4Neutron.hh" 40 #include "G4VNuclearDensity.hh" 40 #include "G4VNuclearDensity.hh" 41 #include "G4FermiMomentum.hh" 41 #include "G4FermiMomentum.hh" 42 #include "G4HadTmpUtil.hh" 42 #include "G4HadTmpUtil.hh" 43 #include "G4PreCompoundModel.hh" 43 #include "G4PreCompoundModel.hh" 44 #include "G4HadronicInteractionRegistry.hh" 44 #include "G4HadronicInteractionRegistry.hh" 45 #include "G4Log.hh" << 46 #include "G4PhysicsModelCatalog.hh" << 47 #include "G4HadronicParameters.hh" << 48 << 49 G4int G4BinaryLightIonReaction::theBLIR_ID = - << 50 45 51 //#define debug_G4BinaryLightIonReaction 46 //#define debug_G4BinaryLightIonReaction 52 //#define debug_BLIR_finalstate 47 //#define debug_BLIR_finalstate 53 //#define debug_BLIR_result << 54 48 55 G4BinaryLightIonReaction::G4BinaryLightIonReac 49 G4BinaryLightIonReaction::G4BinaryLightIonReaction(G4VPreCompoundModel* ptr) 56 : G4HadronicInteraction("Binary Light Ion Casc 50 : G4HadronicInteraction("Binary Light Ion Cascade"), 57 theProjectileFragmentation(ptr), 51 theProjectileFragmentation(ptr), 58 pA(0),pZ(0), tA(0),tZ(0),spectatorA(0),spect 52 pA(0),pZ(0), tA(0),tZ(0),spectatorA(0),spectatorZ(0), 59 projectile3dNucleus(0),target3dNucleus(0) 53 projectile3dNucleus(0),target3dNucleus(0) 60 { 54 { 61 if(!ptr) { 55 if(!ptr) { 62 G4HadronicInteraction* p = 56 G4HadronicInteraction* p = 63 G4HadronicInteractionRegistry::Instance( 57 G4HadronicInteractionRegistry::Instance()->FindModel("PRECO"); 64 G4VPreCompoundModel* pre = static_cast<G4V 58 G4VPreCompoundModel* pre = static_cast<G4VPreCompoundModel*>(p); 65 if(!pre) { pre = new G4PreCompoundModel(); 59 if(!pre) { pre = new G4PreCompoundModel(); } 66 theProjectileFragmentation = pre; 60 theProjectileFragmentation = pre; 67 } 61 } 68 theModel = new G4BinaryCascade(theProjectile 62 theModel = new G4BinaryCascade(theProjectileFragmentation); 69 theHandler = theProjectileFragmentation->Get 63 theHandler = theProjectileFragmentation->GetExcitationHandler(); 70 theBLIR_ID = G4PhysicsModelCatalog::GetM << 64 71 debug_G4BinaryLightIonReactionResults = G4Ha << 65 debug_G4BinaryLightIonReactionResults=getenv("debug_G4BinaryLightIonReactionResults")!=0; 72 } 66 } 73 67 74 G4BinaryLightIonReaction::~G4BinaryLightIonRea 68 G4BinaryLightIonReaction::~G4BinaryLightIonReaction() 75 {} 69 {} 76 70 77 void G4BinaryLightIonReaction::ModelDescriptio 71 void G4BinaryLightIonReaction::ModelDescription(std::ostream& outFile) const 78 { 72 { 79 outFile << "G4Binary Light Ion Cascade is an 73 outFile << "G4Binary Light Ion Cascade is an intra-nuclear cascade model\n" 80 << "using G4BinaryCasacde to model the i 74 << "using G4BinaryCasacde to model the interaction of a light\n" 81 << "nucleus with a nucleus.\n" 75 << "nucleus with a nucleus.\n" 82 << "The lighter of the two nuclei is tre 76 << "The lighter of the two nuclei is treated like a set of projectiles\n" 83 << "which are transported simultaneously << 77 << "which are transported simultanously through the heavier nucleus.\n"; 84 } 78 } 85 79 86 //-------------------------------------------- 80 //-------------------------------------------------------------------------------- 87 struct ReactionProduct4Mom 81 struct ReactionProduct4Mom 88 { 82 { 89 G4LorentzVector operator()(G4LorentzVector 83 G4LorentzVector operator()(G4LorentzVector a,G4ReactionProduct* b) {return a + G4LorentzVector(b->GetMomentum(), b->GetTotalEnergy() );} 90 }; 84 }; 91 85 92 G4HadFinalState *G4BinaryLightIonReaction:: 86 G4HadFinalState *G4BinaryLightIonReaction:: 93 ApplyYourself(const G4HadProjectile &aTrack, G 87 ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus & targetNucleus ) 94 { 88 { 95 if(debug_G4BinaryLightIonReactionResults) G4 << 89 static G4int eventcounter=0; >> 90 eventcounter++; >> 91 if(getenv("BLICDEBUG") ) G4cerr << " ######### Binary Light Ion Reaction number starts ######### "<<eventcounter<<G4endl; 96 G4ping debug("debug_G4BinaryLightIonReaction 92 G4ping debug("debug_G4BinaryLightIonReaction"); 97 pA=aTrack.GetDefinition()->GetBaryonNumber() 93 pA=aTrack.GetDefinition()->GetBaryonNumber(); 98 pZ=G4lrint(aTrack.GetDefinition()->GetPDGCha 94 pZ=G4lrint(aTrack.GetDefinition()->GetPDGCharge()/eplus); 99 tA=targetNucleus.GetA_asInt(); 95 tA=targetNucleus.GetA_asInt(); 100 tZ=targetNucleus.GetZ_asInt(); 96 tZ=targetNucleus.GetZ_asInt(); 101 G4double timePrimary = aTrack.GetGlobalTime( << 97 102 G4LorentzVector mom(aTrack.Get4Momentum()); 98 G4LorentzVector mom(aTrack.Get4Momentum()); 103 //G4cout << "proj mom : " << mom << G4endl; 99 //G4cout << "proj mom : " << mom << G4endl; 104 G4LorentzRotation toBreit(mom.boostVector()) 100 G4LorentzRotation toBreit(mom.boostVector()); 105 101 106 G4bool swapped=SetLighterAsProjectile(mom, t 102 G4bool swapped=SetLighterAsProjectile(mom, toBreit); 107 //G4cout << "after swap, swapped? / mom " < 103 //G4cout << "after swap, swapped? / mom " << swapped << " / " << mom <<G4endl; 108 G4ReactionProductVector * result = 0; 104 G4ReactionProductVector * result = 0; 109 G4ReactionProductVector * cascaders=0; //new 105 G4ReactionProductVector * cascaders=0; //new G4ReactionProductVector; 110 // G4double m_nucl(0); // to check energ 106 // G4double m_nucl(0); // to check energy balance 111 107 112 108 113 // G4double m1=G4ParticleTable::GetPartic 109 // G4double m1=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(pZ,pA); 114 // G4cout << "Entering the decision point 110 // G4cout << "Entering the decision point " 115 // << (mom.t()-mom.mag())/pA << " 111 // << (mom.t()-mom.mag())/pA << " " 116 // << pA<<" "<< pZ<<" " 112 // << pA<<" "<< pZ<<" " 117 // << tA<<" "<< tZ<<G4endl 113 // << tA<<" "<< tZ<<G4endl 118 // << " "<<mom.t()-mom.mag()<<" " 114 // << " "<<mom.t()-mom.mag()<<" " 119 // << mom.t()- m1<<G4endl; 115 // << mom.t()- m1<<G4endl; 120 if( (mom.t()-mom.mag())/pA < 50*MeV ) 116 if( (mom.t()-mom.mag())/pA < 50*MeV ) 121 { 117 { 122 // G4cout << "Using pre-compound only 118 // G4cout << "Using pre-compound only, E= "<<mom.t()-mom.mag()<<G4endl; 123 // m_nucl = mom.mag(); 119 // m_nucl = mom.mag(); 124 cascaders=FuseNucleiAndPrompound(mom); << 120 cascaders=FuseNucleiAndPrompound(mom); 125 if( !cascaders ) << 126 { << 127 << 128 // abort!! happens for too low e << 129 << 130 theResult.Clear(); << 131 theResult.SetStatusChange(isAliv << 132 theResult.SetEnergyChange(aTrack << 133 theResult.SetMomentumChange(aTra << 134 return &theResult; << 135 } << 136 } 121 } 137 else 122 else 138 { 123 { 139 result=Interact(mom,toBreit); 124 result=Interact(mom,toBreit); 140 125 141 if(! result ) << 126 if(! result ) 142 { << 127 { 143 // abort!! << 128 { 144 << 129 // abort!! 145 G4cerr << "G4BinaryLightIonReaction << 130 146 G4cerr << " Primary " << aTrack.Get << 131 G4cerr << "G4BinaryLightIonReaction no final state for: " << G4endl; 147 << ", (A,Z)=(" << aTrack.GetDefi << 132 G4cerr << " Primary " << aTrack.GetDefinition() 148 << "," << aTrack.GetDefinition() << 133 << ", (A,Z)=(" << aTrack.GetDefinition()->GetBaryonNumber() 149 << ", kinetic energy " << aTrack << 134 << "," << aTrack.GetDefinition()->GetPDGCharge()/eplus << ") " 150 << G4endl; << 135 << ", kinetic energy " << aTrack.GetKineticEnergy() 151 G4cerr << " Target nucleus (A,Z)=(" << 136 << G4endl; 152 << (swapped?pA:tA) << "," << 137 G4cerr << " Target nucleus (A,Z)=(" 153 << (swapped?pZ:tZ) << ")" << << 138 << (swapped?pA:tA) << "," 154 G4cerr << " if frequent, please sub << 139 << (swapped?pZ:tZ) << ")" << G4endl; 155 << G4endl << G4endl; << 140 G4cerr << " if frequent, please submit above information as bug report" 156 << 141 << G4endl << G4endl; 157 theResult.Clear(); << 142 158 theResult.SetStatusChange(isAlive); << 143 theResult.Clear(); 159 theResult.SetEnergyChange(aTrack.Ge << 144 theResult.SetStatusChange(isAlive); 160 theResult.SetMomentumChange(aTrack. << 145 theResult.SetEnergyChange(aTrack.GetKineticEnergy()); 161 return &theResult; << 146 theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit()); 162 } << 147 return &theResult; 163 << 148 164 // Calculate excitation energy, << 149 } 165 G4double theStatisticalExEnergy = GetProj << 150 } 166 << 151 167 << 152 // Calculate excitation energy, 168 pInitialState = mom; << 153 G4double theStatisticalExEnergy = GetProjectileExcitation(); 169 //G4cout << "BLIC: pInitialState from << 154 170 pInitialState.setT(pInitialState.getT() + << 155 171 G4ParticleTable::GetParticleTable()->GetIo << 156 pInitialState = mom; 172 //G4cout << "BLIC: target nucleus added << 157 //G4cout << "pInitialState from aTrack : " << pInitialState; 173 << 158 pInitialState.setT(pInitialState.getT() + 174 delete target3dNucleus;target3dNucleus=0; << 159 G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(tZ,tA)); 175 delete projectile3dNucleus;projectile3dNu << 160 //G4cout << "target nucleus added : " << pInitialState << G4endl; 176 << 161 177 G4ReactionProductVector * spectators= new << 162 delete target3dNucleus;target3dNucleus=0; 178 << 163 delete projectile3dNucleus;projectile3dNucleus=0; 179 cascaders = new G4ReactionProductVector; << 180 164 181 G4LorentzVector pspectators=SortResult(re << 165 G4ReactionProductVector * spectators= new G4ReactionProductVector; 182 // this also sets spectatorA and << 183 166 184 // pFinalState=std::accumulate(casca << 167 cascaders = new G4ReactionProductVector; 185 168 186 std::vector<G4ReactionProduct *>::iterato << 169 G4LorentzVector pspectators=SortResult(result,spectators,cascaders); 187 170 188 // G4cout << "pInitialState, pFin << 171 // pFinalState=std::accumulate(cascaders->begin(),cascaders->end(),pFinalState,ReactionProduct4Mom); >> 172 std::vector<G4ReactionProduct *>::iterator iter; >> 173 >> 174 //G4cout << "pInitialState, pFinalState / pspectators"<< pInitialState << " / " << pFinalState << " / " << pspectators << G4endl; 189 // if ( spectA-spectatorA !=0 || spec 175 // if ( spectA-spectatorA !=0 || spectZ-spectatorZ !=0) 190 // { 176 // { 191 // G4cout << "spect Nucl != spect 177 // G4cout << "spect Nucl != spectators: nucl a,z; spect a,z" << 192 // spectatorA <<" "<< spectatorZ << 178 // spectatorA <<" "<< spectatorZ <<" ; " << spectA <<" "<< spectZ << G4endl; 193 // } 179 // } 194 delete result; << 180 delete result; 195 result=0; << 181 result=0; 196 G4LorentzVector momentum(pInitialState-pF << 182 G4LorentzVector momentum(pInitialState-pFinalState); 197 G4int loopcount(0); << 183 G4int loopcount(0); 198 //G4cout << "BLIC: momentum, pspectato << 184 //G4cout << "momentum, pspectators : " << momentum << " / " << pspectators << G4endl; 199 while (std::abs(momentum.e()-pspectators. << 185 while (std::abs(momentum.e()-pspectators.e()) > 10*MeV) 200 << 186 { 201 { << 187 G4LorentzVector pCorrect(pInitialState-pspectators); 202 G4LorentzVector pCorrect(pInitialState- << 188 //G4cout << "BIC nonconservation? (pInitialState-pFinalState) / spectators :" << momentum << " / " << pspectators << "pCorrect "<< pCorrect<< G4endl; 203 //G4cout << "BLIC:: BIC nonconservatio << 189 // Correct outgoing casacde particles.... to have momentum of (initial state - spectators) 204 // Correct outgoing casacde particles.. << 190 G4bool EnergyIsCorrect=EnergyAndMomentumCorrector(cascaders, pCorrect); 205 G4bool EnergyIsCorrect=EnergyAndMomentu << 191 if ( ! EnergyIsCorrect && debug_G4BinaryLightIonReactionResults) 206 if ( ! EnergyIsCorrect && debug_G4Binar << 192 { 207 { << 193 G4cout << "Warning - G4BinaryLightIonReaction E/P correction for cascaders failed" << G4endl; 208 G4cout << "Warning - G4BinaryLightIon << 194 } 209 } << 195 pFinalState=G4LorentzVector(0,0,0,0); 210 pFinalState=G4LorentzVector(0,0,0,0); << 196 unsigned int i; 211 for(iter=cascaders->begin(); iter!=casc << 197 for(i=0; i<cascaders->size(); i++) 212 { << 198 { 213 pFinalState += G4LorentzVector( (*ite << 199 pFinalState += G4LorentzVector( (*cascaders)[i]->GetMomentum(), (*cascaders)[i]->GetTotalEnergy() ); 214 } << 200 } 215 momentum=pInitialState-pFinalState; << 201 momentum=pInitialState-pFinalState; 216 if (++loopcount > 10 ) << 202 if (++loopcount > 10 ) >> 203 { >> 204 if ( momentum.vect().mag() - momentum.e()> 10*keV ) >> 205 { >> 206 G4cerr << "G4BinaryLightIonReaction.cc: Cannot correct 4-momentum of cascade particles" << G4endl; >> 207 throw G4HadronicException(__FILE__, __LINE__, "G4BinaryCasacde::ApplyCollision()"); >> 208 } else { >> 209 break; >> 210 } >> 211 >> 212 } >> 213 } >> 214 >> 215 if (spectatorA > 0 ) >> 216 { >> 217 // check spectator momentum >> 218 if ( momentum.vect().mag() - momentum.e()> 10*keV ) 217 { 219 { 218 break; << 220 >> 221 G4ReactionProductVector::iterator ispectator; >> 222 for (ispectator=spectators->begin();ispectator!=spectators->end();ispectator++) >> 223 { >> 224 delete *ispectator; >> 225 } >> 226 delete spectators; >> 227 >> 228 G4cout << "G4BinaryLightIonReaction.cc: mom check: " << momentum >> 229 << " 3.mag "<< momentum.vect().mag() << G4endl >> 230 << " .. pInitialState/pFinalState/spectators " << pInitialState <<" " >> 231 << pFinalState << " " << pspectators << G4endl >> 232 << " .. A,Z " << spectatorA <<" "<< spectatorZ << G4endl; >> 233 G4cout << "G4BinaryLightIonReaction invalid final state for: " << G4endl; >> 234 G4cout << " Primary " << aTrack.GetDefinition() >> 235 << ", (A,Z)=(" << aTrack.GetDefinition()->GetBaryonNumber() >> 236 << "," << aTrack.GetDefinition()->GetPDGCharge()/eplus << ") " >> 237 << ", kinetic energy " << aTrack.GetKineticEnergy() >> 238 << G4endl; >> 239 G4cout << " Target nucleus (A,Z)=(" << targetNucleus.GetA_asInt() >> 240 << "," << targetNucleus.GetZ_asInt() << ")" << G4endl; >> 241 G4cout << " if frequent, please submit above information as bug report" >> 242 << G4endl << G4endl; >> 243 >> 244 theResult.Clear(); >> 245 theResult.SetStatusChange(isAlive); >> 246 theResult.SetEnergyChange(aTrack.GetKineticEnergy()); >> 247 theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit()); >> 248 return &theResult; 219 } 249 } 220 } << 221 250 222 // Check if Energy/Momemtum is now ok, if << 223 if ( std::abs(momentum.e()-pspectators.e( << 224 { << 225 for (iter=spectators->begin();iter!=specta << 226 { << 227 delete *iter; << 228 } << 229 delete spectators; << 230 for(iter=cascaders->begin(); iter!=cascad << 231 { << 232 delete *iter; << 233 } << 234 delete cascaders; << 235 << 236 G4cout << "G4BinaryLightIonReaction.cc: m << 237 << " initial - final " << momentum << 238 << " .. pInitialState/pFinalState/s << 239 << pInitialState << G4endl << 240 << pFinalState << G4endl << 241 << pspectators << G4endl << 242 << " .. A,Z " << spectatorA <<" "<< << 243 G4cout << "G4BinaryLightIonReaction inval << 244 G4cout << " Primary " << aTrack.GetDefini << 245 << ", (A,Z)=(" << aTrack.GetDefin << 246 << "," << aTrack.GetDefinition()- << 247 << ", kinetic energy " << aTrack. << 248 << G4endl; << 249 G4cout << " Target nucleus (A,Z)=(" << t << 250 << "," << targetNucleus.GetZ_ << 251 G4cout << " if frequent, please submit ab << 252 << G4endl << G4endl; << 253 #ifdef debug_G4BinaryLightIonReaction << 254 G4ExceptionDescription ed; << 255 ed << "G4BinaryLightIonreaction: Ter << 256 G4Exception("G4BinaryLightIonreactio << 257 ed); << 258 251 259 #endif << 252 DeExciteSpectatorNucleus(spectators, cascaders, theStatisticalExEnergy, momentum); 260 theResult.Clear(); << 253 } 261 theResult.SetStatusChange(isAlive); << 262 theResult.SetEnergyChange(aTrack.GetKinet << 263 theResult.SetMomentumChange(aTrack.Get4Mo << 264 return &theResult; << 265 << 266 } << 267 if (spectatorA > 0 ) << 268 { << 269 // DeExciteSpectatorNucleus() also << 270 DeExciteSpectatorNucleus(specta << 271 } else { // no spectators << 272 delete spectators; << 273 } << 274 } 254 } 275 // Rotate to lab 255 // Rotate to lab 276 G4LorentzRotation toZ; 256 G4LorentzRotation toZ; 277 toZ.rotateZ(-1*mom.phi()); 257 toZ.rotateZ(-1*mom.phi()); 278 toZ.rotateY(-1*mom.theta()); 258 toZ.rotateY(-1*mom.theta()); 279 G4LorentzRotation toLab(toZ.inverse()); 259 G4LorentzRotation toLab(toZ.inverse()); 280 260 281 // Fill the particle change, while rotating. 261 // Fill the particle change, while rotating. Boost from projectile breit-frame in case we swapped. 282 // theResult.Clear(); 262 // theResult.Clear(); 283 theResult.Clear(); 263 theResult.Clear(); 284 theResult.SetStatusChange(stopAndKill); 264 theResult.SetStatusChange(stopAndKill); 285 G4LorentzVector ptot(0); << 265 G4double Etot(0); 286 #ifdef debug_BLIR_result << 266 size_t i=0; 287 G4LorentzVector p_raw; << 267 for(i=0; i<cascaders->size(); i++) 288 #endif << 289 //G4int i=0; << 290 << 291 G4ReactionProductVector::iterator iter << 292 for(iter=cascaders->begin(); iter!=cascaders << 293 { 268 { 294 if((*iter)->GetNewlyAdded()) << 269 if((*cascaders)[i]->GetNewlyAdded()) 295 { 270 { 296 G4DynamicParticle * aNewDP = << 271 G4DynamicParticle * aNew = 297 new G4DynamicParticle((*iter)->GetDe << 272 new G4DynamicParticle((*cascaders)[i]->GetDefinition(), 298 (*iter)->GetTotalEnergy(), << 273 (*cascaders)[i]->GetTotalEnergy(), 299 (*iter)->GetMomentum() ); << 274 (*cascaders)[i]->GetMomentum() ); 300 G4LorentzVector tmp = aNewDP->Get4Moment << 275 G4LorentzVector tmp = aNew->Get4Momentum(); 301 #ifdef debug_BLIR_result << 302 p_raw+= tmp; << 303 #endif << 304 if(swapped) 276 if(swapped) 305 { 277 { 306 tmp*=toBreit.inverse(); 278 tmp*=toBreit.inverse(); 307 tmp.setVect(-tmp.vect()); 279 tmp.setVect(-tmp.vect()); 308 } 280 } 309 tmp *= toLab; 281 tmp *= toLab; 310 aNewDP->Set4Momentum(tmp); << 282 aNew->Set4Momentum(tmp); 311 G4HadSecondary aNew = G4HadSecondary(aNe << 283 //G4cout << "result[" << i << "], 4vect: " << tmp << G4endl; 312 G4double time = 0; << 313 //if(time < 0.0) { time = 0.0; } << 314 aNew.SetTime(timePrimary + time); << 315 //aNew.SetCreatorModelID((*iter)-> << 316 aNew.SetCreatorModelID(theBLIR_ID) << 317 << 318 theResult.AddSecondary(aNew); 284 theResult.AddSecondary(aNew); 319 ptot += tmp; << 285 Etot += tmp.e(); 320 //G4cout << "BLIC: Secondary " < << 286 // G4cout << "LIBIC: Secondary " << aNew->GetDefinition()->GetParticleName() 321 // <<" "<< aNew->GetMomen << 287 // <<" "<< aNew->GetMomentum() >> 288 // <<" "<< aNew->GetTotalEnergy() >> 289 // << G4endl; 322 } 290 } 323 delete *iter; << 291 delete (*cascaders)[i]; 324 } 292 } 325 delete cascaders; 293 delete cascaders; 326 294 327 #ifdef debug_BLIR_result 295 #ifdef debug_BLIR_result 328 //G4cout << "Result analysis, secondaries " << 296 G4cout << "Result analysis, secondaries" << theResult.GetNumberOfSecondaries() << G4endl; 329 //G4cout << "p_tot_raw " << p_raw << " sum p << 297 G4cout << " Energy conservation initial/primary/nucleus/final/delta(init-final) " 330 G4double m_nucl= G4ParticleTable::GetPartic << 298 << aTrack.GetTotalEnergy() + m_nucl << aTrack.GetTotalEnergy() << m_nucl <<Etot 331 GetIonMass(targetNucleus.GetZ_asInt( << 299 << aTrack.GetTotalEnergy() + m_nucl - Etot; 332 // delete? tZ=targetNucleus.GetZ_asInt(); << 333 << 334 //G4cout << "BLIC Energy conservation initia << 335 // << aTrack.GetTotalEnergy() + m_nuc << 336 // <<" "<< aTrack.GetTotalEnergy() + m_ << 337 G4cout << "BLIC momentum conservation " << a << 338 << " ptot " << ptot << " delta " << aTra << 339 << " 3mom.mag() " << (aTrack.Get4 << 340 #endif 300 #endif 341 301 342 if(debug_G4BinaryLightIonReactionResults) G4 << 302 if(getenv("BLICDEBUG") ) G4cerr << " ######### Binary Light Ion Reaction number ends ######### "<<eventcounter<<G4endl; 343 303 344 return &theResult; 304 return &theResult; 345 } 305 } 346 306 347 //-------------------------------------------- 307 //-------------------------------------------------------------------------------- 348 308 349 //******************************************** 309 //**************************************************************************** 350 G4bool G4BinaryLightIonReaction::EnergyAndMome 310 G4bool G4BinaryLightIonReaction::EnergyAndMomentumCorrector( 351 G4ReactionProductVector* Output, G4Lorentz 311 G4ReactionProductVector* Output, G4LorentzVector& TotalCollisionMom) 352 //******************************************** 312 //**************************************************************************** 353 { 313 { 354 const int nAttemptScale = 2500; 314 const int nAttemptScale = 2500; 355 const double ErrLimit = 1.E-6; 315 const double ErrLimit = 1.E-6; 356 if (Output->empty()) 316 if (Output->empty()) 357 return TRUE; 317 return TRUE; 358 G4LorentzVector SumMom(0,0,0,0); 318 G4LorentzVector SumMom(0,0,0,0); 359 G4double SumMass = 0; 319 G4double SumMass = 0; 360 G4double TotalCollisionMass = TotalCo 320 G4double TotalCollisionMass = TotalCollisionMom.m(); 361 size_t i = 0; 321 size_t i = 0; 362 // Calculate sum hadron 4-momenta and summin 322 // Calculate sum hadron 4-momenta and summing hadron mass 363 for(i = 0; i < Output->size(); i++) 323 for(i = 0; i < Output->size(); i++) 364 { 324 { 365 SumMom += G4LorentzVector((*Output)[i]->G 325 SumMom += G4LorentzVector((*Output)[i]->GetMomentum(),(*Output)[i]->GetTotalEnergy()); 366 SumMass += (*Output)[i]->GetDefinition()-> 326 SumMass += (*Output)[i]->GetDefinition()->GetPDGMass(); 367 } 327 } 368 // G4cout << " E/P corrector, SumMass, Sum 328 // G4cout << " E/P corrector, SumMass, SumMom.m2, TotalMass " 369 // << SumMass <<" "<< SumMom.m2() << 329 // << SumMass <<" "<< SumMom.m2() <<" "<<TotalCollisionMass<< G4endl; 370 if (SumMass > TotalCollisionMass) return FAL 330 if (SumMass > TotalCollisionMass) return FALSE; 371 SumMass = SumMom.m2(); 331 SumMass = SumMom.m2(); 372 if (SumMass < 0) return FALSE; 332 if (SumMass < 0) return FALSE; 373 SumMass = std::sqrt(SumMass); 333 SumMass = std::sqrt(SumMass); 374 334 375 // Compute c.m.s. hadron velocity and boost 335 // Compute c.m.s. hadron velocity and boost KTV to hadron c.m.s. 376 G4ThreeVector Beta = -SumMom.boostVector(); 336 G4ThreeVector Beta = -SumMom.boostVector(); 377 //G4cout << " == pre boost 2 "<< SumMo 337 //G4cout << " == pre boost 2 "<< SumMom.e()<< " "<< SumMom.mag()<<" "<< Beta <<G4endl; 378 //--old Output->Boost(Beta); 338 //--old Output->Boost(Beta); 379 for(i = 0; i < Output->size(); i++) 339 for(i = 0; i < Output->size(); i++) 380 { 340 { 381 G4LorentzVector mom = G4LorentzVector((*Ou 341 G4LorentzVector mom = G4LorentzVector((*Output)[i]->GetMomentum(),(*Output)[i]->GetTotalEnergy()); 382 mom *= Beta; 342 mom *= Beta; 383 (*Output)[i]->SetMomentum(mom.vect()); 343 (*Output)[i]->SetMomentum(mom.vect()); 384 (*Output)[i]->SetTotalEnergy(mom.e()); 344 (*Output)[i]->SetTotalEnergy(mom.e()); 385 } 345 } 386 346 387 // Scale total c.m.s. hadron energy (hadron 347 // Scale total c.m.s. hadron energy (hadron system mass). 388 // It should be equal interaction mass 348 // It should be equal interaction mass 389 G4double Scale = 0,OldScale=0; 349 G4double Scale = 0,OldScale=0; 390 G4double factor = 1.; 350 G4double factor = 1.; 391 G4int cAttempt = 0; 351 G4int cAttempt = 0; 392 G4double Sum = 0; 352 G4double Sum = 0; 393 G4bool success = false; 353 G4bool success = false; 394 for(cAttempt = 0; cAttempt < nAttemptScale; 354 for(cAttempt = 0; cAttempt < nAttemptScale; cAttempt++) 395 { 355 { 396 Sum = 0; 356 Sum = 0; 397 for(i = 0; i < Output->size(); i++) 357 for(i = 0; i < Output->size(); i++) 398 { 358 { 399 G4LorentzVector HadronMom = G4LorentzVec 359 G4LorentzVector HadronMom = G4LorentzVector((*Output)[i]->GetMomentum(),(*Output)[i]->GetTotalEnergy()); 400 HadronMom.setVect(HadronMom.vect()+ fact 360 HadronMom.setVect(HadronMom.vect()+ factor*Scale*HadronMom.vect()); 401 G4double E = std::sqrt(HadronMom.vect(). 361 G4double E = std::sqrt(HadronMom.vect().mag2() + sqr((*Output)[i]->GetDefinition()->GetPDGMass())); 402 HadronMom.setE(E); 362 HadronMom.setE(E); 403 (*Output)[i]->SetMomentum(HadronMom.vect 363 (*Output)[i]->SetMomentum(HadronMom.vect()); 404 (*Output)[i]->SetTotalEnergy(HadronMom.e 364 (*Output)[i]->SetTotalEnergy(HadronMom.e()); 405 Sum += E; 365 Sum += E; 406 } 366 } 407 OldScale=Scale; 367 OldScale=Scale; 408 Scale = TotalCollisionMass/Sum - 1; 368 Scale = TotalCollisionMass/Sum - 1; 409 // G4cout << "E/P corr - " << cAttempt << 369 // G4cout << "E/P corr - " << cAttempt << " " << Scale << G4endl; 410 if (std::abs(Scale) <= ErrLimit 370 if (std::abs(Scale) <= ErrLimit 411 || OldScale == Scale) // protect ' 371 || OldScale == Scale) // protect 'frozen' situation and divide by 0 in calculating new factor below 412 { 372 { 413 if (debug_G4BinaryLightIonReactionResult 373 if (debug_G4BinaryLightIonReactionResults) G4cout << "E/p corrector: " << cAttempt << G4endl; 414 success = true; 374 success = true; 415 break; 375 break; 416 } 376 } 417 if ( cAttempt > 10 ) 377 if ( cAttempt > 10 ) 418 { 378 { 419 // G4cout << " speed it up? " << 379 // G4cout << " speed it up? " << std::abs(OldScale/(OldScale-Scale)) << G4endl; 420 factor=std::max(1.,G4Log(std::abs(OldSca << 380 factor=std::max(1.,std::log(std::abs(OldScale/(OldScale-Scale)))); 421 // G4cout << " ? factor ? " << factor 381 // G4cout << " ? factor ? " << factor << G4endl; 422 } 382 } 423 } 383 } 424 384 425 if( (!success) && debug_G4BinaryLightIonRea 385 if( (!success) && debug_G4BinaryLightIonReactionResults) 426 { 386 { 427 G4cout << "G4G4BinaryLightIonReaction::Ene 387 G4cout << "G4G4BinaryLightIonReaction::EnergyAndMomentumCorrector - Warning"<<G4endl; 428 G4cout << " Scale not unity at end of it 388 G4cout << " Scale not unity at end of iteration loop: "<<TotalCollisionMass<<" "<<Sum<<" "<<Scale<<G4endl; 429 G4cout << " Increase number of attempts 389 G4cout << " Increase number of attempts or increase ERRLIMIT"<<G4endl; 430 } 390 } 431 391 432 // Compute c.m.s. interaction velocity and K 392 // Compute c.m.s. interaction velocity and KTV back boost 433 Beta = TotalCollisionMom.boostVector(); 393 Beta = TotalCollisionMom.boostVector(); 434 //--old Output->Boost(Beta); 394 //--old Output->Boost(Beta); 435 for(i = 0; i < Output->size(); i++) 395 for(i = 0; i < Output->size(); i++) 436 { 396 { 437 G4LorentzVector mom = G4LorentzVector((*Ou 397 G4LorentzVector mom = G4LorentzVector((*Output)[i]->GetMomentum(),(*Output)[i]->GetTotalEnergy()); 438 mom *= Beta; 398 mom *= Beta; 439 (*Output)[i]->SetMomentum(mom.vect()); 399 (*Output)[i]->SetMomentum(mom.vect()); 440 (*Output)[i]->SetTotalEnergy(mom.e()); 400 (*Output)[i]->SetTotalEnergy(mom.e()); 441 } 401 } 442 return TRUE; 402 return TRUE; 443 } 403 } 444 G4bool G4BinaryLightIonReaction::SetLighterAsP 404 G4bool G4BinaryLightIonReaction::SetLighterAsProjectile(G4LorentzVector & mom,const G4LorentzRotation & toBreit) 445 { 405 { 446 G4bool swapped = false; 406 G4bool swapped = false; 447 if(tA<pA) 407 if(tA<pA) 448 { 408 { 449 swapped = true; 409 swapped = true; 450 G4int tmp(0); 410 G4int tmp(0); 451 tmp = tA; tA=pA; pA=tmp; 411 tmp = tA; tA=pA; pA=tmp; 452 tmp = tZ; tZ=pZ; pZ=tmp; 412 tmp = tZ; tZ=pZ; pZ=tmp; 453 G4double m1=G4ParticleTable::GetParticle 413 G4double m1=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(pZ,pA); 454 G4LorentzVector it(m1, G4ThreeVector(0,0 414 G4LorentzVector it(m1, G4ThreeVector(0,0,0)); 455 mom = toBreit*it; 415 mom = toBreit*it; 456 } 416 } 457 return swapped; 417 return swapped; 458 } 418 } 459 G4ReactionProductVector * G4BinaryLightIonReac 419 G4ReactionProductVector * G4BinaryLightIonReaction::FuseNucleiAndPrompound(const G4LorentzVector & mom) 460 { 420 { 461 // Check if kinematically nuclei can fuse. << 462 G4double mFused=G4ParticleTable::GetParticl << 463 G4double mTarget=G4ParticleTable::GetPartic << 464 G4LorentzVector pCompound(mom.e()+mTarget,m << 465 G4double m2Compound=pCompound.m2(); << 466 if (m2Compound < sqr(mFused) ) { << 467 //G4cout << "G4BLIC: projectile p, mTarge << 468 // << " " << sqrt(m2Compound)<< " " << 469 return 0; << 470 } << 471 << 472 G4Fragment aPreFrag; 421 G4Fragment aPreFrag; 473 aPreFrag.SetZandA_asInt(pZ+tZ, pA+tA); << 422 aPreFrag.SetA(pA+tA); >> 423 aPreFrag.SetZ(pZ+tZ); 474 aPreFrag.SetNumberOfParticles(pA); 424 aPreFrag.SetNumberOfParticles(pA); 475 aPreFrag.SetNumberOfCharged(pZ); 425 aPreFrag.SetNumberOfCharged(pZ); 476 aPreFrag.SetNumberOfHoles(0); 426 aPreFrag.SetNumberOfHoles(0); 477 //GF FIXME: whyusing plop in z direction? t << 427 G4ThreeVector plop(0.,0., mom.vect().mag()); 478 //G4ThreeVector plop(0.,0., mom.vect().mag( << 428 G4double m_nucl=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(tZ,tA); 479 //G4LorentzVector aL(mom.t()+mTarget, plop) << 429 G4LorentzVector aL(mom.t()+m_nucl, plop); 480 G4LorentzVector aL(mom.t()+mTarget,mom.vect << 481 aPreFrag.SetMomentum(aL); 430 aPreFrag.SetMomentum(aL); >> 431 G4ParticleDefinition * preFragDef; >> 432 preFragDef = G4ParticleTable::GetParticleTable() >> 433 ->FindIon(pZ+tZ,pA+tA,0,pZ+tZ); >> 434 aPreFrag.SetParticleDefinition(preFragDef); 482 435 483 << 436 // G4cout << "Fragment INFO "<< pA+tA <<" "<<pZ+tZ<<" " 484 //G4cout << "Fragment INFO "<< pA+tA << 437 // << aL <<" "<<preFragDef->GetParticleName()<<G4endl; 485 // << aL <<" "<<G4endl << aPreF << 486 G4ReactionProductVector * cascaders = thePr 438 G4ReactionProductVector * cascaders = theProjectileFragmentation->DeExcite(aPreFrag); 487 //G4double tSum = 0; 439 //G4double tSum = 0; 488 for(size_t count = 0; count<cascaders->size 440 for(size_t count = 0; count<cascaders->size(); count++) 489 { 441 { 490 cascaders->operator[](count)->SetNewlyAd 442 cascaders->operator[](count)->SetNewlyAdded(true); 491 //tSum += cascaders->operator[](count)-> 443 //tSum += cascaders->operator[](count)->GetKineticEnergy(); 492 } 444 } 493 // G4cout << "Exiting pre-compound on 445 // G4cout << "Exiting pre-compound only, E= "<<tSum<<G4endl; 494 return cascaders; 446 return cascaders; 495 } 447 } 496 G4ReactionProductVector * G4BinaryLightIonReac 448 G4ReactionProductVector * G4BinaryLightIonReaction::Interact(G4LorentzVector & mom, const G4LorentzRotation & toBreit) 497 { 449 { 498 G4ReactionProductVector * result = 0; 450 G4ReactionProductVector * result = 0; 499 G4double projectileMass(0); 451 G4double projectileMass(0); 500 G4LorentzVector it; 452 G4LorentzVector it; 501 453 502 G4int tryCount(0); 454 G4int tryCount(0); 503 do 455 do 504 { 456 { 505 ++tryCount; 457 ++tryCount; 506 projectile3dNucleus = new G4Fancy3DNu 458 projectile3dNucleus = new G4Fancy3DNucleus; 507 projectile3dNucleus->Init(pA, pZ); 459 projectile3dNucleus->Init(pA, pZ); 508 projectile3dNucleus->CenterNucleons() 460 projectile3dNucleus->CenterNucleons(); 509 projectileMass=G4ParticleTable::GetPa 461 projectileMass=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass( 510 projectile3dNucleus->GetCharge( 462 projectile3dNucleus->GetCharge(),projectile3dNucleus->GetMassNumber()); 511 it=toBreit * G4LorentzVector(projecti 463 it=toBreit * G4LorentzVector(projectileMass,G4ThreeVector(0,0,0)); 512 464 513 target3dNucleus = new G4Fancy3DNucleu 465 target3dNucleus = new G4Fancy3DNucleus; 514 target3dNucleus->Init(tA, tZ); 466 target3dNucleus->Init(tA, tZ); 515 G4double impactMax = target3dNucleus- 467 G4double impactMax = target3dNucleus->GetOuterRadius()+projectile3dNucleus->GetOuterRadius(); 516 // G4cout << "out radius - nuc 468 // G4cout << "out radius - nucleus - projectile " << target3dNucleus->GetOuterRadius()/fermi << " - " << projectile3dNucleus->GetOuterRadius()/fermi << G4endl; 517 G4double aX=(2.*G4UniformRand()-1.)*i 469 G4double aX=(2.*G4UniformRand()-1.)*impactMax; 518 G4double aY=(2.*G4UniformRand()-1.)*i 470 G4double aY=(2.*G4UniformRand()-1.)*impactMax; 519 G4ThreeVector pos(aX, aY, -2.*impactM 471 G4ThreeVector pos(aX, aY, -2.*impactMax-5.*fermi); 520 472 521 G4KineticTrackVector * initalState = 473 G4KineticTrackVector * initalState = new G4KineticTrackVector; 522 projectile3dNucleus->StartLoop(); 474 projectile3dNucleus->StartLoop(); 523 G4Nucleon * aNuc; 475 G4Nucleon * aNuc; 524 G4LorentzVector tmpV(0,0,0,0); 476 G4LorentzVector tmpV(0,0,0,0); 525 #ifdef debug_BLIR_finalstate << 526 G4LorentzVector pinitial; << 527 #endif << 528 G4LorentzVector nucleonMom(1./pA*mom) 477 G4LorentzVector nucleonMom(1./pA*mom); 529 nucleonMom.setZ(nucleonMom.vect().mag 478 nucleonMom.setZ(nucleonMom.vect().mag()); 530 nucleonMom.setX(0); 479 nucleonMom.setX(0); 531 nucleonMom.setY(0); 480 nucleonMom.setY(0); 532 theFermi.Init(pA,pZ); 481 theFermi.Init(pA,pZ); 533 while( (aNuc=projectile3dNucleus->Get << 482 while( (aNuc=projectile3dNucleus->GetNextNucleon()) ) 534 { 483 { 535 G4LorentzVector p4 = aNuc->GetMome 484 G4LorentzVector p4 = aNuc->GetMomentum(); 536 tmpV+=p4; 485 tmpV+=p4; 537 G4ThreeVector nucleonPosition(aNuc 486 G4ThreeVector nucleonPosition(aNuc->GetPosition()); 538 G4double density=(projectile3dNucl 487 G4double density=(projectile3dNucleus->GetNuclearDensity())->GetDensity(nucleonPosition); 539 nucleonPosition += pos; 488 nucleonPosition += pos; 540 G4KineticTrack * it1 = new G4Kinet 489 G4KineticTrack * it1 = new G4KineticTrack(aNuc, nucleonPosition, nucleonMom ); 541 it1->SetState(G4KineticTrack::outs 490 it1->SetState(G4KineticTrack::outside); 542 G4double pfermi= theFermi.GetFermi 491 G4double pfermi= theFermi.GetFermiMomentum(density); 543 G4double mass = aNuc->GetDefinitio 492 G4double mass = aNuc->GetDefinition()->GetPDGMass(); 544 G4double Efermi= std::sqrt( sqr(ma 493 G4double Efermi= std::sqrt( sqr(mass) + sqr(pfermi)) - mass; 545 it1->SetProjectilePotential(-Eferm 494 it1->SetProjectilePotential(-Efermi); 546 initalState->push_back(it1); 495 initalState->push_back(it1); 547 #ifdef debug_BLIR_finalstate << 548 pinitial += it1->Get4Momentum() << 549 #endif << 550 } 496 } 551 497 552 result=theModel->Propagate(initalStat 498 result=theModel->Propagate(initalState, target3dNucleus); 553 #ifdef debug_BLIR_finalstate << 554 if( result && result->size()>0) << 555 { << 556 G4cout << " Cascade result " << G4endl; << 557 G4LorentzVector presult; << 558 G4ReactionProductVector::iterator << 559 G4ReactionProduct xp; << 560 for (iter=result->begin(); iter ! << 561 { << 562 presult += G4LorentzVector((*ite << 563 G4cout << (*iter)->GetDefinition()->Ge << 564 << "("<< (*iter)->GetMomentum().x()<<" << 565 << (*iter)->GetMomentum().y()<<"," << 566 << (*iter)->GetMomentum().z()<<";" << 567 << (*iter)->GetTotalEnergy() <<")"< << 568 } << 569 << 570 G4cout << "BLIC check result : in << 571 << " final " << presult << 572 << " IF - FF " << pinitial +G << 573 << 574 } << 575 #endif << 576 if( result && result->size()==0) 499 if( result && result->size()==0) 577 { 500 { 578 delete result; 501 delete result; 579 result=0; 502 result=0; 580 } 503 } 581 if ( ! result ) 504 if ( ! result ) 582 { 505 { 583 delete target3dNucleus; 506 delete target3dNucleus; 584 delete projectile3dNucleus; 507 delete projectile3dNucleus; 585 } 508 } 586 509 587 // std::for_each(initalState->begin() 510 // std::for_each(initalState->begin(), initalState->end(), Delete<G4KineticTrack>()); 588 // delete initalState; 511 // delete initalState; 589 512 590 } while (! result && tryCount< 150); / << 513 } while (! result && tryCount< 150); 591 return result; 514 return result; 592 } 515 } 593 G4double G4BinaryLightIonReaction::GetProjecti 516 G4double G4BinaryLightIonReaction::GetProjectileExcitation() 594 { 517 { >> 518 spectatorA=spectatorZ=0; 595 519 596 G4Nucleon * aNuc; 520 G4Nucleon * aNuc; >> 521 // targetNucleus->StartLoop(); >> 522 // while( (aNuc=targetNucleus->GetNextNucleon()) ) >> 523 // { >> 524 // G4cout << " tgt Nucleon : " << aNuc->GetDefinition()->GetParticleName() <<" "<< aNuc->AreYouHit() <<" "<<aNuc->GetMomentum()<<G4endl; >> 525 // } 597 // the projectileNucleus excitation ener 526 // the projectileNucleus excitation energy estimate... 598 G4double theStatisticalExEnergy = 0; 527 G4double theStatisticalExEnergy = 0; 599 projectile3dNucleus->StartLoop(); 528 projectile3dNucleus->StartLoop(); 600 while( (aNuc=projectile3dNucleus->GetNex << 529 while( (aNuc=projectile3dNucleus->GetNextNucleon()) ) 601 { 530 { 602 //G4cout << " Nucleon : " << a << 531 // G4cout << " Nucleon : " << aNuc->GetDefinition()->GetParticleName() <<" "<< aNuc->AreYouHit() <<" "<<aNuc->GetMomentum()<<G4endl; 603 if(aNuc->AreYouHit()) { << 532 if(!aNuc->AreYouHit()) >> 533 { >> 534 spectatorA++; >> 535 spectatorZ+=G4lrint(aNuc->GetDefinition()->GetPDGCharge()/eplus); >> 536 } >> 537 else >> 538 { 604 G4ThreeVector aPosition(aNuc->GetP 539 G4ThreeVector aPosition(aNuc->GetPosition()); 605 G4double localDensity = projectile 540 G4double localDensity = projectile3dNucleus->GetNuclearDensity()->GetDensity(aPosition); 606 G4double localPfermi = theFermi.Ge 541 G4double localPfermi = theFermi.GetFermiMomentum(localDensity); 607 G4double nucMass = aNuc->GetDefini 542 G4double nucMass = aNuc->GetDefinition()->GetPDGMass(); 608 G4double localFermiEnergy = std::s 543 G4double localFermiEnergy = std::sqrt(nucMass*nucMass + localPfermi*localPfermi) - nucMass; 609 G4double deltaE = localFermiEnergy 544 G4double deltaE = localFermiEnergy - (aNuc->GetMomentum().t()-aNuc->GetMomentum().mag()); 610 theStatisticalExEnergy += deltaE; 545 theStatisticalExEnergy += deltaE; 611 } 546 } 612 } 547 } 613 return theStatisticalExEnergy; 548 return theStatisticalExEnergy; 614 } 549 } 615 550 616 G4LorentzVector G4BinaryLightIonReaction::Sort 551 G4LorentzVector G4BinaryLightIonReaction::SortResult(G4ReactionProductVector * result, G4ReactionProductVector * spectators,G4ReactionProductVector * cascaders) 617 { 552 { 618 unsigned int i(0); 553 unsigned int i(0); 619 spectatorA=spectatorZ=0; << 554 // G4int spectA(0),spectZ(0); 620 G4LorentzVector pspectators(0,0,0,0); 555 G4LorentzVector pspectators(0,0,0,0); 621 pFinalState=G4LorentzVector(0,0,0,0); 556 pFinalState=G4LorentzVector(0,0,0,0); 622 for(i=0; i<result->size(); i++) 557 for(i=0; i<result->size(); i++) 623 { 558 { 624 if( (*result)[i]->GetNewlyAdded() ) 559 if( (*result)[i]->GetNewlyAdded() ) 625 { 560 { 626 pFinalState += G4LorentzVector( (*res 561 pFinalState += G4LorentzVector( (*result)[i]->GetMomentum(), (*result)[i]->GetTotalEnergy() ); 627 cascaders->push_back((*result)[i]); 562 cascaders->push_back((*result)[i]); 628 } 563 } 629 else { 564 else { 630 // G4cout <<" spectator ... 565 // G4cout <<" spectator ... "; 631 pspectators += G4LorentzVector( (*res 566 pspectators += G4LorentzVector( (*result)[i]->GetMomentum(), (*result)[i]->GetTotalEnergy() ); 632 spectators->push_back((*result)[i]); 567 spectators->push_back((*result)[i]); 633 spectatorA++; << 568 // spectA++; 634 spectatorZ+= G4lrint((*result)[i]->Ge << 569 // spectZ+= G4lrint((*result)[i]->GetDefinition()->GetPDGCharge()/eplus); 635 } 570 } 636 571 637 // G4cout << (*result)[i]<< " " 572 // G4cout << (*result)[i]<< " " 638 // << (*result)[i]->GetDefinition 573 // << (*result)[i]->GetDefinition()->GetParticleName() << " " 639 // << (*result)[i]->GetMomentum() 574 // << (*result)[i]->GetMomentum()<< " " 640 // << (*result)[i]->GetTotalEnerg 575 // << (*result)[i]->GetTotalEnergy() << G4endl; 641 } 576 } 642 //G4cout << "pFinalState / pspectators, << 577 //G4cout << "pFinalState / pspectators" << pFinalState << " / " << pspectators << G4endl; 643 // << " (" << spectatorA << ", "<< sp << 644 << 645 return pspectators; 578 return pspectators; 646 } 579 } 647 580 648 void G4BinaryLightIonReaction::DeExciteSpectat 581 void G4BinaryLightIonReaction::DeExciteSpectatorNucleus(G4ReactionProductVector * spectators, G4ReactionProductVector * cascaders, 649 582 G4double theStatisticalExEnergy, G4LorentzVector & pSpectators) 650 { 583 { 651 // call precompound model 584 // call precompound model 652 G4ReactionProductVector * proFrag = 0; 585 G4ReactionProductVector * proFrag = 0; 653 G4LorentzVector pFragment(0.,0.,0.,0.); 586 G4LorentzVector pFragment(0.,0.,0.,0.); 654 // G4cout << " == pre boost 1 "<< mome 587 // G4cout << " == pre boost 1 "<< momentum.e()<< " "<< momentum.mag()<<G4endl; 655 G4LorentzRotation boost_fragments; 588 G4LorentzRotation boost_fragments; 656 // G4cout << " == post boost 1 "<< mom 589 // G4cout << " == post boost 1 "<< momentum.e()<< " "<< momentum.mag()<<G4endl; 657 // G4LorentzRotation boost_spectator_mom 590 // G4LorentzRotation boost_spectator_mom(-momentum.boostVector()); 658 // G4cout << "- momentum " << boost_spe 591 // G4cout << "- momentum " << boost_spectator_mom * momentum << G4endl; 659 G4LorentzVector pFragments(0,0,0,0); 592 G4LorentzVector pFragments(0,0,0,0); 660 593 661 if(spectatorZ>0 && spectatorA>1) 594 if(spectatorZ>0 && spectatorA>1) 662 { 595 { 663 // Make the fragment 596 // Make the fragment 664 G4Fragment aProRes; 597 G4Fragment aProRes; 665 aProRes.SetZandA_asInt(spectatorZ, spect << 598 aProRes.SetA(spectatorA); >> 599 aProRes.SetZ(spectatorZ); 666 aProRes.SetNumberOfParticles(0); 600 aProRes.SetNumberOfParticles(0); 667 aProRes.SetNumberOfCharged(0); 601 aProRes.SetNumberOfCharged(0); 668 aProRes.SetNumberOfHoles(pA-spectatorA); 602 aProRes.SetNumberOfHoles(pA-spectatorA); 669 G4double mFragment=G4ParticleTable::GetP 603 G4double mFragment=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(spectatorZ,spectatorA); 670 pFragment=G4LorentzVector(0,0,0,mFragmen 604 pFragment=G4LorentzVector(0,0,0,mFragment+std::max(0.,theStatisticalExEnergy) ); 671 aProRes.SetMomentum(pFragment); 605 aProRes.SetMomentum(pFragment); >> 606 G4ParticleDefinition * resDef; >> 607 resDef = G4ParticleTable::GetParticleTable()->FindIon(spectatorZ,spectatorA,0,spectatorZ); >> 608 aProRes.SetParticleDefinition(resDef); 672 609 673 proFrag = theHandler->BreakItUp(aProRes) 610 proFrag = theHandler->BreakItUp(aProRes); 674 611 675 boost_fragments = G4LorentzRotation(pSpe 612 boost_fragments = G4LorentzRotation(pSpectators.boostVector()); 676 613 677 // G4cout << " Fragment a,z, Mass Fr 614 // G4cout << " Fragment a,z, Mass Fragment, mass spect-mom, exitationE " 678 // << spectatorA <<" "<< spectator 615 // << spectatorA <<" "<< spectatorZ <<" "<< mFragment <<" " 679 // << momentum.mag() <<" "<< momen 616 // << momentum.mag() <<" "<< momentum.mag() - mFragment 680 // << " "<<theStatisticalExEnergy 617 // << " "<<theStatisticalExEnergy 681 // << " "<< boost_fragments*pFragm 618 // << " "<< boost_fragments*pFragment<< G4endl; 682 G4ReactionProductVector::iterator ispect 619 G4ReactionProductVector::iterator ispectator; 683 for (ispectator=spectators->begin();ispe 620 for (ispectator=spectators->begin();ispectator!=spectators->end();ispectator++) 684 { 621 { 685 delete *ispectator; 622 delete *ispectator; 686 } 623 } 687 } 624 } 688 else if(spectatorA!=0) 625 else if(spectatorA!=0) 689 { 626 { 690 G4ReactionProductVector::iterator ispecta << 627 G4ReactionProductVector::iterator ispectator; 691 for (ispectator=spectators->begin();ispec << 628 for (ispectator=spectators->begin();ispectator!=spectators->end();ispectator++) 692 { 629 { 693 (*ispectator)->SetNewlyAdded(true); 630 (*ispectator)->SetNewlyAdded(true); 694 cascaders->push_back(*ispectator); 631 cascaders->push_back(*ispectator); 695 pFinalState+=G4LorentzVector((*ispect << 632 pFragments+=G4LorentzVector((*ispectator)->GetMomentum(),(*ispectator)->GetTotalEnergy()); 696 //G4cout << "BLIC: spectator << 633 // G4cout << "from spectator " 697 // << (*ispectator)->GetDefi << 634 // << (*ispectator)->GetDefinition()->GetParticleName() << " " 698 // << (*ispectator)->GetMome << 635 // << (*ispectator)->GetMomentum()<< " " 699 // << (*ispectator)->GetTota << 636 // << (*ispectator)->GetTotalEnergy() << G4endl; 700 } 637 } 701 << 702 } 638 } 703 // / if (spectators) 639 // / if (spectators) 704 delete spectators; 640 delete spectators; 705 641 706 // collect the evaporation part and boost t 642 // collect the evaporation part and boost to spectator frame 707 G4ReactionProductVector::iterator ii; 643 G4ReactionProductVector::iterator ii; 708 if(proFrag) 644 if(proFrag) 709 { 645 { 710 for(ii=proFrag->begin(); ii!=proFrag->en 646 for(ii=proFrag->begin(); ii!=proFrag->end(); ii++) 711 { 647 { 712 (*ii)->SetNewlyAdded(true); 648 (*ii)->SetNewlyAdded(true); 713 G4LorentzVector tmp((*ii)->GetMomentu 649 G4LorentzVector tmp((*ii)->GetMomentum(),(*ii)->GetTotalEnergy()); 714 tmp *= boost_fragments; 650 tmp *= boost_fragments; 715 (*ii)->SetMomentum(tmp.vect()); 651 (*ii)->SetMomentum(tmp.vect()); 716 (*ii)->SetTotalEnergy(tmp.e()); 652 (*ii)->SetTotalEnergy(tmp.e()); 717 // result->push_back(*ii); 653 // result->push_back(*ii); 718 pFragments += tmp; 654 pFragments += tmp; 719 } 655 } 720 } 656 } 721 657 722 // G4cout << "Fragmented p, momentum, de 658 // G4cout << "Fragmented p, momentum, delta " << pFragments <<" "<<momentum 723 // <<" "<< pFragments-momentum < 659 // <<" "<< pFragments-momentum << G4endl; 724 660 725 // correct p/E of Cascade secondaries 661 // correct p/E of Cascade secondaries 726 G4LorentzVector pCas=pInitialState - pFragm 662 G4LorentzVector pCas=pInitialState - pFragments; 727 663 728 //G4cout <<"BLIC: Going to correct from << 664 //G4cout <<" Going to correct from " << pFinalState << " to " << pCas << G4endl; 729 // the creation of excited fragment did vi << 730 G4bool EnergyIsCorrect=EnergyAndMomentumCor 665 G4bool EnergyIsCorrect=EnergyAndMomentumCorrector(cascaders, pCas); 731 if ( ! EnergyIsCorrect && debug_G4BinaryLig 666 if ( ! EnergyIsCorrect && debug_G4BinaryLightIonReactionResults) 732 { 667 { 733 G4cout << "G4BinaryLightIonReaction E/P 668 G4cout << "G4BinaryLightIonReaction E/P correction for nucleus failed, will try to correct overall" << G4endl; 734 } 669 } 735 670 736 // Add deexcitation secondaries 671 // Add deexcitation secondaries 737 if(proFrag) 672 if(proFrag) 738 { 673 { 739 for(ii=proFrag->begin(); ii!=proFrag->en 674 for(ii=proFrag->begin(); ii!=proFrag->end(); ii++) 740 { 675 { 741 cascaders->push_back(*ii); 676 cascaders->push_back(*ii); 742 } 677 } 743 delete proFrag; 678 delete proFrag; 744 } 679 } 745 //G4cout << "EnergyIsCorrect? " << Energ << 680 //G4cout << "EnergyIsCorrect? " << EnergyIsCorrect << G4endl; 746 if ( ! EnergyIsCorrect ) 681 if ( ! EnergyIsCorrect ) 747 { 682 { 748 // G4cout <<" ! EnergyIsCorrect " << << 683 //G4cout <<" ! EnergyIsCorrect " << pFinalState << " to " << pInitialState << G4endl; 749 if (! EnergyAndMomentumCorrector(cascade 684 if (! EnergyAndMomentumCorrector(cascaders,pInitialState)) 750 { 685 { 751 if(debug_G4BinaryLightIonReactionResu 686 if(debug_G4BinaryLightIonReactionResults) 752 G4cout << "G4BinaryLightIonReactio 687 G4cout << "G4BinaryLightIonReaction E/P corrections failed" << G4endl; 753 } 688 } 754 } 689 } 755 690 756 } 691 } 757 692 758 693