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 // 080602 Fix memory leaks by T. Koi 26 // 080602 Fix memory leaks by T. Koi 27 // 081120 Add deltaT in signature of CalKinema 27 // 081120 Add deltaT in signature of CalKinematicsOfBinaryCollisions 28 // Add several required updating of Mea 28 // Add several required updating of Mean Filed 29 // Modified handling of absorption case 29 // Modified handling of absorption case by T. Koi 30 // 090126 Fix in absorption case by T. Koi 30 // 090126 Fix in absorption case by T. Koi 31 // 090331 Fix for gamma participant by T. Koi 31 // 090331 Fix for gamma participant by T. Koi 32 // 32 // 33 #include "G4QMDCollision.hh" 33 #include "G4QMDCollision.hh" 34 #include "G4Scatterer.hh" 34 #include "G4Scatterer.hh" 35 #include "G4Pow.hh" << 36 #include "G4Exp.hh" << 37 #include "G4Log.hh" << 38 #include "G4PhysicalConstants.hh" 35 #include "G4PhysicalConstants.hh" 39 #include "G4SystemOfUnits.hh" 36 #include "G4SystemOfUnits.hh" 40 #include "Randomize.hh" 37 #include "Randomize.hh" 41 38 42 G4QMDCollision::G4QMDCollision() 39 G4QMDCollision::G4QMDCollision() 43 : fdeltar ( 4.0 ) << 40 : deltar ( 4 ) 44 , fbcmax0 ( 1.323142 ) // NN maximum impact pa << 41 , bcmax0 ( 1.323142 ) // NN maximum impact parameter 45 , fbcmax1 ( 2.523 ) // others maximum impac << 42 , bcmax1 ( 2.523 ) // others maximum impact parameter 46 // , sig0 ( 55 ) // NN cross section << 43 , sig0 ( 55 ) // NN cross section 47 //110617 fix for gcc 4.6 compilation warnings 44 //110617 fix for gcc 4.6 compilation warnings 48 //, sig1 ( 200 ) // others cross section 45 //, sig1 ( 200 ) // others cross section 49 , fepse ( 0.0001 ) << 46 , epse ( 0.0001 ) 50 { 47 { 51 //These two pointers will be set through Se << 52 theSystem=NULL; << 53 theMeanField=NULL; << 54 theScatterer = new G4Scatterer(); 48 theScatterer = new G4Scatterer(); 55 } 49 } 56 50 57 /* << 58 G4QMDCollision::G4QMDCollision( const G4QMDCol << 59 : fdeltar ( obj.fdeltar ) << 60 , fbcmax0 ( obj.fbcmax0 ) // NN maximum impact << 61 , fbcmax1 ( obj.fbcmax1 ) // others maximum << 62 , fepse ( obj.fepse ) << 63 { << 64 << 65 if ( obj.theSystem != NULL ) { << 66 theSystem = new G4QMDSystem; << 67 *theSystem = *obj.theSystem; << 68 } else { << 69 theSystem = NULL; << 70 } << 71 if ( obj.theMeanField != NULL ) { << 72 theMeanField = new G4QMDMeanField; << 73 *theMeanField = *obj.theMeanField; << 74 } else { << 75 theMeanField = NULL; << 76 } << 77 theScatterer = new G4Scatterer(); << 78 *theScatterer = *obj.theScatterer; << 79 } << 80 << 81 G4QMDCollision & G4QMDCollision::operator= ( c << 82 { << 83 fdeltar = obj.fdeltar; << 84 fbcmax0 = obj.fbcmax1; << 85 fepse = obj.fepse; << 86 << 87 if ( obj.theSystem != NULL ) { << 88 delete theSystem; << 89 theSystem = new G4QMDSystem; << 90 *theSystem = *obj.theSystem; << 91 } else { << 92 theSystem = NULL; << 93 } << 94 if ( obj.theMeanField != NULL ) { << 95 delete theMeanField; << 96 theMeanField = new G4QMDMeanField; << 97 *theMeanField = *obj.theMeanField; << 98 } else { << 99 theMeanField = NULL; << 100 } << 101 delete theScatterer; << 102 theScatterer = new G4Scatterer(); << 103 *theScatterer = *obj.theScatterer; << 104 << 105 return *this; << 106 } << 107 */ << 108 51 109 52 110 G4QMDCollision::~G4QMDCollision() 53 G4QMDCollision::~G4QMDCollision() 111 { 54 { 112 //if ( theSystem != NULL ) delete theSystem << 113 //if ( theMeanField != NULL ) delete theMea << 114 delete theScatterer; 55 delete theScatterer; 115 } 56 } 116 57 117 58 118 void G4QMDCollision::CalKinematicsOfBinaryColl 59 void G4QMDCollision::CalKinematicsOfBinaryCollisions( G4double dt ) 119 { 60 { 120 G4double deltaT = dt; 61 G4double deltaT = dt; 121 62 122 G4int n = theSystem->GetTotalNumberOfPartic 63 G4int n = theSystem->GetTotalNumberOfParticipant(); 123 //081118 64 //081118 124 //G4int nb = 0; 65 //G4int nb = 0; 125 for ( G4int i = 0 ; i < n ; i++ ) 66 for ( G4int i = 0 ; i < n ; i++ ) 126 { 67 { 127 theSystem->GetParticipant( i )->UnsetHit 68 theSystem->GetParticipant( i )->UnsetHitMark(); 128 theSystem->GetParticipant( i )->UnsetHit 69 theSystem->GetParticipant( i )->UnsetHitMark(); 129 //nb += theSystem->GetParticipant( i )-> 70 //nb += theSystem->GetParticipant( i )->GetBaryonNumber(); 130 } 71 } 131 //G4cout << "nb = " << nb << " n = " << n < 72 //G4cout << "nb = " << nb << " n = " << n << G4endl; 132 73 133 74 134 //071101 75 //071101 135 for ( G4int i = 0 ; i < n ; i++ ) 76 for ( G4int i = 0 ; i < n ; i++ ) 136 { 77 { 137 78 138 //std::cout << i << " " << theSystem->Ge 79 //std::cout << i << " " << theSystem->GetParticipant( i )->GetDefinition()->GetParticleName() << " " << theSystem->GetParticipant( i )->GetPosition() << std::endl; 139 80 140 if ( theSystem->GetParticipant( i )->Get 81 if ( theSystem->GetParticipant( i )->GetDefinition()->IsShortLived() ) 141 { 82 { 142 83 143 G4bool decayed = false; 84 G4bool decayed = false; 144 85 145 const G4ParticleDefinition* pd0 = the << 86 G4ParticleDefinition* pd0 = theSystem->GetParticipant( i )->GetDefinition(); 146 G4ThreeVector p0 = theSystem->GetPart 87 G4ThreeVector p0 = theSystem->GetParticipant( i )->GetMomentum(); 147 G4ThreeVector r0 = theSystem->GetPart 88 G4ThreeVector r0 = theSystem->GetParticipant( i )->GetPosition(); 148 89 149 G4LorentzVector p40 = theSystem->GetP 90 G4LorentzVector p40 = theSystem->GetParticipant( i )->Get4Momentum(); 150 91 151 G4double eini = theMeanField->GetTota 92 G4double eini = theMeanField->GetTotalPotential() + p40.e(); 152 93 153 G4int n0 = theSystem->GetTotalNumberO 94 G4int n0 = theSystem->GetTotalNumberOfParticipant(); 154 G4int i0 = 0; 95 G4int i0 = 0; 155 96 156 G4bool isThisEnergyOK = false; 97 G4bool isThisEnergyOK = false; 157 98 158 G4int maximumNumberOfTrial=4; << 99 for ( G4int ii = 0 ; ii < 4 ; ii++ ) 159 for ( G4int ii = 0 ; ii < maximumNumb << 160 { 100 { 161 101 162 //G4LorentzVector p4 = theSystem-> 102 //G4LorentzVector p4 = theSystem->GetParticipant( i )->Get4Momentum(); 163 G4LorentzVector p400 = p40; 103 G4LorentzVector p400 = p40; 164 104 165 p400 *= GeV; 105 p400 *= GeV; 166 //G4KineticTrack kt( theSystem->Ge 106 //G4KineticTrack kt( theSystem->GetParticipant( i )->GetDefinition() , 0.0 , (theSystem->GetParticipant( i )->GetPosition())*fermi , p4 ); 167 G4KineticTrack kt( pd0 , 0.0 , r0* 107 G4KineticTrack kt( pd0 , 0.0 , r0*fermi , p400 ); 168 //std::cout << "G4KineticTrack " < 108 //std::cout << "G4KineticTrack " << i << " " << kt.GetDefinition()->GetParticleName() << kt.GetPosition() << std::endl; 169 G4KineticTrackVector* secs = NULL; 109 G4KineticTrackVector* secs = NULL; 170 secs = kt.Decay(); 110 secs = kt.Decay(); 171 G4int id = 0; 111 G4int id = 0; 172 G4double et = 0; 112 G4double et = 0; 173 if ( secs ) 113 if ( secs ) 174 { 114 { 175 for ( G4KineticTrackVector::ite 115 for ( G4KineticTrackVector::iterator it 176 = secs->begin() ; it != s 116 = secs->begin() ; it != secs->end() ; it++ ) 177 { 117 { 178 /* 118 /* 179 G4cout << "G4KineticTrack" 119 G4cout << "G4KineticTrack" 180 << " " << (*it)->GetDefiniti 120 << " " << (*it)->GetDefinition()->GetParticleName() 181 << " " << (*it)->Get4Momentu 121 << " " << (*it)->Get4Momentum() 182 << " " << (*it)->GetPosition 122 << " " << (*it)->GetPosition()/fermi 183 << G4endl; 123 << G4endl; 184 */ 124 */ 185 if ( id == 0 ) 125 if ( id == 0 ) 186 { 126 { 187 theSystem->GetParticipan 127 theSystem->GetParticipant( i )->SetDefinition( (*it)->GetDefinition() ); 188 theSystem->GetParticipan 128 theSystem->GetParticipant( i )->SetMomentum( (*it)->Get4Momentum().v()/GeV ); 189 theSystem->GetParticipan 129 theSystem->GetParticipant( i )->SetPosition( (*it)->GetPosition()/fermi ); 190 //theMeanField->Cal2Body 130 //theMeanField->Cal2BodyQuantities( i ); 191 et += (*it)->Get4Momentu 131 et += (*it)->Get4Momentum().e()/GeV; 192 } 132 } 193 if ( id > 0 ) 133 if ( id > 0 ) 194 { 134 { 195 // Append end; 135 // Append end; 196 theSystem->SetParticipan 136 theSystem->SetParticipant ( new G4QMDParticipant ( (*it)->GetDefinition() , (*it)->Get4Momentum().v()/GeV , (*it)->GetPosition()/fermi ) ); 197 et += (*it)->Get4Momentu 137 et += (*it)->Get4Momentum().e()/GeV; 198 if ( id > 1 ) 138 if ( id > 1 ) 199 { 139 { 200 //081118 140 //081118 201 //G4cout << "G4QMDCol 141 //G4cout << "G4QMDCollision id >2; id= " << id << G4endl; 202 } 142 } 203 } 143 } 204 id++; // number of daughter 144 id++; // number of daughter particles 205 145 206 delete *it; 146 delete *it; 207 } 147 } 208 148 209 theMeanField->Update(); 149 theMeanField->Update(); 210 i0 = id-1; // 0 enter to i 150 i0 = id-1; // 0 enter to i 211 151 212 delete secs; 152 delete secs; 213 } 153 } 214 154 215 // EnergyCheck 155 // EnergyCheck 216 156 217 G4double efin = theMeanField->GetT 157 G4double efin = theMeanField->GetTotalPotential() + et; 218 //std::cout << std::abs ( eini - << 158 //std::cout << std::abs ( eini - efin ) - epse << std::endl; 219 // std::cout << std::abs ( eini - << 159 // std::cout << std::abs ( eini - efin ) - epse*10 << std::endl; 220 // * 160 // *10 TK 221 if ( std::abs ( eini - efin ) < fe << 161 if ( std::abs ( eini - efin ) < epse*10 ) 222 { 162 { 223 // Energy OK 163 // Energy OK 224 isThisEnergyOK = true; 164 isThisEnergyOK = true; 225 break; 165 break; 226 } 166 } 227 else 167 else 228 { 168 { 229 169 230 theSystem->GetParticipant( i )- 170 theSystem->GetParticipant( i )->SetDefinition( pd0 ); 231 theSystem->GetParticipant( i )- 171 theSystem->GetParticipant( i )->SetPosition( r0 ); 232 theSystem->GetParticipant( i )- 172 theSystem->GetParticipant( i )->SetMomentum( p0 ); 233 173 234 //for ( G4int i0i = 0 ; i0i < i << 174 for ( G4int i0i = 0 ; i0i < id-1 ; i0i++ ) 235 //160210 deletion must be done << 175 { 236 for ( G4int i0i = id-2 ; 0 <= i << 237 //081118 176 //081118 238 //std::cout << "Decay Energi 177 //std::cout << "Decay Energitically Blocked deleteing " << i0i+n0 << std::endl; 239 theSystem->DeleteParticipant 178 theSystem->DeleteParticipant( i0i+n0 ); 240 } 179 } 241 //081103 180 //081103 242 theMeanField->Update(); 181 theMeanField->Update(); 243 } 182 } 244 183 245 } 184 } 246 185 247 186 248 // Pauli Check 187 // Pauli Check 249 if ( isThisEnergyOK == true ) 188 if ( isThisEnergyOK == true ) 250 { 189 { 251 if ( theMeanField->IsPauliBlocked 190 if ( theMeanField->IsPauliBlocked ( i ) != true ) 252 { 191 { 253 192 254 G4bool allOK = true; 193 G4bool allOK = true; 255 for ( G4int i0i = 0 ; i0i < i0 194 for ( G4int i0i = 0 ; i0i < i0 ; i0i++ ) 256 { 195 { 257 if ( theMeanField->IsPauliBl 196 if ( theMeanField->IsPauliBlocked ( i0i+n0 ) == true ) 258 { 197 { 259 allOK = false; 198 allOK = false; 260 break; 199 break; 261 } 200 } 262 } 201 } 263 202 264 if ( allOK ) 203 if ( allOK ) 265 { 204 { 266 decayed = true; //Decay Succ 205 decayed = true; //Decay Succeeded 267 } 206 } 268 } 207 } 269 208 270 } 209 } 271 // 210 // 272 211 273 if ( decayed ) 212 if ( decayed ) 274 { 213 { 275 //081119 214 //081119 276 //G4cout << "Decay Suceeded! " << 215 //G4cout << "Decay Suceeded! " << std::endl; 277 theSystem->GetParticipant( i )->Se 216 theSystem->GetParticipant( i )->SetHitMark(); 278 for ( G4int i0i = 0 ; i0i < i0 ; i 217 for ( G4int i0i = 0 ; i0i < i0 ; i0i++ ) 279 { 218 { 280 theSystem->GetParticipant( i0i 219 theSystem->GetParticipant( i0i+n0 )->SetHitMark(); 281 } 220 } 282 221 283 } 222 } 284 else 223 else 285 { 224 { 286 225 287 // Decay Blocked and re-enter orginal 226 // Decay Blocked and re-enter orginal participant; 288 227 289 if ( isThisEnergyOK == true ) // 228 if ( isThisEnergyOK == true ) // for false case already done 290 { 229 { 291 230 292 theSystem->GetParticipant( i )- 231 theSystem->GetParticipant( i )->SetDefinition( pd0 ); 293 theSystem->GetParticipant( i )- 232 theSystem->GetParticipant( i )->SetPosition( r0 ); 294 theSystem->GetParticipant( i )- 233 theSystem->GetParticipant( i )->SetMomentum( p0 ); 295 234 296 for ( G4int i0i = 0 ; i0i < i0 235 for ( G4int i0i = 0 ; i0i < i0 ; i0i++ ) 297 { 236 { 298 //081118 237 //081118 299 //std::cout << "Decay Blocke 238 //std::cout << "Decay Blocked deleteing " << i0i+n0 << std::endl; 300 //160210 adding commnet: del << 239 theSystem->DeleteParticipant( i0i+n0 ); 301 theSystem->DeleteParticipant << 302 } 240 } 303 //081103 241 //081103 304 theMeanField->Update(); 242 theMeanField->Update(); 305 } 243 } 306 244 307 } 245 } 308 246 309 } //shortlive 247 } //shortlive 310 } // go next participant 248 } // go next participant 311 //071101 249 //071101 312 250 313 251 314 n = theSystem->GetTotalNumberOfParticipant( 252 n = theSystem->GetTotalNumberOfParticipant(); 315 253 316 //081118 254 //081118 317 //for ( G4int i = 1 ; i < n ; i++ ) 255 //for ( G4int i = 1 ; i < n ; i++ ) 318 for ( G4int i = 1 ; i < theSystem->GetTotal 256 for ( G4int i = 1 ; i < theSystem->GetTotalNumberOfParticipant() ; i++ ) 319 { 257 { 320 258 321 //std::cout << "Collision i " << i << st 259 //std::cout << "Collision i " << i << std::endl; 322 if ( theSystem->GetParticipant( i )->IsT 260 if ( theSystem->GetParticipant( i )->IsThisHit() ) continue; 323 261 324 G4ThreeVector ri = theSystem->GetPartic 262 G4ThreeVector ri = theSystem->GetParticipant( i )->GetPosition(); 325 G4LorentzVector p4i = theSystem->GetPar 263 G4LorentzVector p4i = theSystem->GetParticipant( i )->Get4Momentum(); 326 G4double rmi = theSystem->GetParticipan 264 G4double rmi = theSystem->GetParticipant( i )->GetMass(); 327 const G4ParticleDefinition* pdi = theSy << 265 G4ParticleDefinition* pdi = theSystem->GetParticipant( i )->GetDefinition(); 328 //090331 gamma 266 //090331 gamma 329 if ( pdi->GetPDGMass() == 0.0 ) continue 267 if ( pdi->GetPDGMass() == 0.0 ) continue; 330 268 331 //std::cout << " p4i00 " << p4i << std:: 269 //std::cout << " p4i00 " << p4i << std::endl; 332 for ( G4int j = 0 ; j < i ; j++ ) 270 for ( G4int j = 0 ; j < i ; j++ ) 333 { 271 { 334 272 335 273 336 /* 274 /* 337 G4cout << "Collision " << i << " " << << 275 std::cout << "Collision " << i << " " << theSystem->GetParticipant( i )->IsThisProjectile() << std::endl; 338 G4cout << "Collision " << j << " " << << 276 std::cout << "Collision " << j << " " << theSystem->GetParticipant( j )->IsThisProjectile() << std::endl; 339 G4cout << "Collision " << i << " " << << 277 std::cout << "Collision " << i << " " << theSystem->GetParticipant( i )->IsThisTarget() << std::endl; 340 G4cout << "Collision " << j << " " << << 278 std::cout << "Collision " << j << " " << theSystem->GetParticipant( j )->IsThisTarget() << std::endl; 341 */ 279 */ 342 280 343 // Only 1 Collision allowed for each 281 // Only 1 Collision allowed for each particle in a time step. 344 //081119 282 //081119 345 if ( theSystem->GetParticipant( i )-> 283 if ( theSystem->GetParticipant( i )->IsThisHit() ) continue; 346 if ( theSystem->GetParticipant( j )-> 284 if ( theSystem->GetParticipant( j )->IsThisHit() ) continue; 347 285 348 //std::cout << "Collision " << i << " 286 //std::cout << "Collision " << i << " " << j << std::endl; 349 287 350 // Do not allow collision between nuc 288 // Do not allow collision between nucleons in target/projectile til its first collision. 351 if ( theSystem->GetParticipant( i )-> 289 if ( theSystem->GetParticipant( i )->IsThisProjectile() ) 352 { 290 { 353 if ( theSystem->GetParticipant( j 291 if ( theSystem->GetParticipant( j )->IsThisProjectile() ) continue; 354 } 292 } 355 else if ( theSystem->GetParticipant( 293 else if ( theSystem->GetParticipant( i )->IsThisTarget() ) 356 { 294 { 357 if ( theSystem->GetParticipant( j 295 if ( theSystem->GetParticipant( j )->IsThisTarget() ) continue; 358 } 296 } 359 297 360 298 361 G4ThreeVector rj = theSystem->GetPar 299 G4ThreeVector rj = theSystem->GetParticipant( j )->GetPosition(); 362 G4LorentzVector p4j = theSystem->Get 300 G4LorentzVector p4j = theSystem->GetParticipant( j )->Get4Momentum(); 363 G4double rmj = theSystem->GetPartici 301 G4double rmj = theSystem->GetParticipant( j )->GetMass(); 364 const G4ParticleDefinition* pdj = th << 302 G4ParticleDefinition* pdj = theSystem->GetParticipant( j )->GetDefinition(); 365 //090331 gamma 303 //090331 gamma 366 if ( pdj->GetPDGMass() == 0.0 ) conti 304 if ( pdj->GetPDGMass() == 0.0 ) continue; 367 305 368 G4double rr2 = theMeanField->GetRR2( 306 G4double rr2 = theMeanField->GetRR2( i , j ); 369 307 370 // Here we assume elab (beam momentum le 308 // Here we assume elab (beam momentum less than 5 GeV/n ) 371 if ( rr2 > fdeltar*fdeltar ) continue << 309 if ( rr2 > deltar*deltar ) continue; 372 310 373 //G4double s = (p4i+p4j)*(p4i+p4j); 311 //G4double s = (p4i+p4j)*(p4i+p4j); 374 //G4double srt = std::sqrt ( s ); 312 //G4double srt = std::sqrt ( s ); 375 313 376 G4double srt = std::sqrt( (p4i+p4j)*( 314 G4double srt = std::sqrt( (p4i+p4j)*(p4i+p4j) ); 377 315 378 G4double cutoff = 0.0; 316 G4double cutoff = 0.0; 379 G4double fbcmax = 0.0; << 317 G4double bcmax = 0.0; 380 //110617 fix for gcc 4.6 compilation 318 //110617 fix for gcc 4.6 compilation warnings 381 //G4double sig = 0.0; 319 //G4double sig = 0.0; 382 320 383 if ( rmi < 0.94 && rmj < 0.94 ) 321 if ( rmi < 0.94 && rmj < 0.94 ) 384 { 322 { 385 // nucleon or pion case 323 // nucleon or pion case 386 cutoff = rmi + rmj + 0.02; 324 cutoff = rmi + rmj + 0.02; 387 fbcmax = fbcmax0; << 325 bcmax = bcmax0; 388 //110617 fix for gcc 4.6 compilati 326 //110617 fix for gcc 4.6 compilation warnings 389 //sig = sig0; 327 //sig = sig0; 390 } 328 } 391 else 329 else 392 { 330 { 393 cutoff = rmi + rmj; 331 cutoff = rmi + rmj; 394 fbcmax = fbcmax1; << 332 bcmax = bcmax1; 395 //110617 fix for gcc compilation w 333 //110617 fix for gcc compilation warnings 396 //sig = sig1; 334 //sig = sig1; 397 } 335 } 398 336 399 //std::cout << "Collision cutoff " << 337 //std::cout << "Collision cutoff " << i << " " << j << " " << cutoff << std::endl; 400 if ( srt < cutoff ) continue; 338 if ( srt < cutoff ) continue; 401 339 402 G4ThreeVector dr = ri - rj; 340 G4ThreeVector dr = ri - rj; 403 G4double rsq = dr*dr; 341 G4double rsq = dr*dr; 404 342 405 G4double pij = p4i*p4j; 343 G4double pij = p4i*p4j; 406 G4double pidr = p4i.vect()*dr; 344 G4double pidr = p4i.vect()*dr; 407 G4double pjdr = p4j.vect()*dr; 345 G4double pjdr = p4j.vect()*dr; 408 346 409 G4double aij = 1.0 - ( rmi*rmj /pij ) 347 G4double aij = 1.0 - ( rmi*rmj /pij ) * ( rmi*rmj /pij ); 410 G4double bij = pidr / rmi - pjdr*rmi/ 348 G4double bij = pidr / rmi - pjdr*rmi/pij; 411 G4double cij = rsq + ( pidr / rmi ) * 349 G4double cij = rsq + ( pidr / rmi ) * ( pidr / rmi ); 412 G4double brel = std::sqrt ( std::abs 350 G4double brel = std::sqrt ( std::abs ( cij - bij*bij/aij ) ); 413 351 414 if ( brel > fbcmax ) continue; << 352 if ( brel > bcmax ) continue; 415 //std::cout << "collisions3 " << std: 353 //std::cout << "collisions3 " << std::endl; 416 354 417 G4double bji = -pjdr/rmj + pidr * rmj 355 G4double bji = -pjdr/rmj + pidr * rmj /pij; 418 356 419 G4double ti = ( pidr/rmi - bij / aij 357 G4double ti = ( pidr/rmi - bij / aij ) * p4i.e() / rmi; 420 G4double tj = (-pjdr/rmj - bji / aij 358 G4double tj = (-pjdr/rmj - bji / aij ) * p4j.e() / rmj; 421 359 422 360 423 /* 361 /* 424 G4cout << "collisions4 p4i " << p4i << 362 std::cout << "collisions4 p4i " << p4i << std::endl; 425 G4cout << "collisions4 ri " << ri << << 363 std::cout << "collisions4 ri " << ri << std::endl; 426 G4cout << "collisions4 p4j " << p4j << 364 std::cout << "collisions4 p4j " << p4j << std::endl; 427 G4cout << "collisions4 rj " << rj << << 365 std::cout << "collisions4 rj " << rj << std::endl; 428 G4cout << "collisions4 dr " << dr << << 366 std::cout << "collisions4 dr " << dr << std::endl; 429 G4cout << "collisions4 pij " << pij << 367 std::cout << "collisions4 pij " << pij << std::endl; 430 G4cout << "collisions4 aij " << aij << 368 std::cout << "collisions4 aij " << aij << std::endl; 431 G4cout << "collisions4 bij bji " << << 369 std::cout << "collisions4 bij bji " << bij << " " << bji << std::endl; 432 G4cout << "collisions4 pidr pjdr " < << 370 std::cout << "collisions4 pidr pjdr " << pidr << " " << pjdr << std::endl; 433 G4cout << "collisions4 p4i.e() p4j.e << 371 std::cout << "collisions4 p4i.e() p4j.e() " << p4i.e() << " " << p4j.e() << std::endl; 434 G4cout << "collisions4 rmi rmj " << << 372 std::cout << "collisions4 rmi rmj " << rmi << " " << rmj << std::endl; 435 G4cout << "collisions4 " << ti << " " << 373 std::cout << "collisions4 " << ti << " " << tj << std::endl; 436 */ 374 */ 437 if ( std::abs ( ti + tj ) > deltaT ) 375 if ( std::abs ( ti + tj ) > deltaT ) continue; 438 //std::cout << "collisions4 " << std: 376 //std::cout << "collisions4 " << std::endl; 439 377 440 G4ThreeVector beta = ( p4i + p4j ).bo 378 G4ThreeVector beta = ( p4i + p4j ).boostVector(); 441 379 442 G4LorentzVector p = p4i; 380 G4LorentzVector p = p4i; 443 G4LorentzVector p4icm = p.boost( p.fi 381 G4LorentzVector p4icm = p.boost( p.findBoostToCM ( p4j ) ); 444 G4ThreeVector pcm = p4icm.vect(); 382 G4ThreeVector pcm = p4icm.vect(); 445 383 446 G4double prcm = pcm.mag(); 384 G4double prcm = pcm.mag(); 447 385 448 if ( prcm <= 0.00001 ) continue; 386 if ( prcm <= 0.00001 ) continue; 449 //std::cout << "collisions5 " << std: 387 //std::cout << "collisions5 " << std::endl; 450 388 451 G4bool energetically_forbidden = !( C 389 G4bool energetically_forbidden = !( CalFinalStateOfTheBinaryCollision ( i , j ) ); // Use Geant4 Collision Library 452 //G4bool energetically_forbidden = !( 390 //G4bool energetically_forbidden = !( CalFinalStateOfTheBinaryCollisionJQMD ( sig , cutoff , pcm , prcm , srt, beta , gamma , i , j ) ); // JQMD Elastic 453 391 454 /* 392 /* 455 G4bool pauli_blocked = false; 393 G4bool pauli_blocked = false; 456 if ( energetically_forbidden == false 394 if ( energetically_forbidden == false ) // result true 457 { 395 { 458 if ( theMeanField->IsPauliBlocked 396 if ( theMeanField->IsPauliBlocked ( i ) == true || theMeanField->IsPauliBlocked ( j ) == true ) 459 { 397 { 460 pauli_blocked = true; 398 pauli_blocked = true; 461 //std::cout << "G4QMDRESULT Col 399 //std::cout << "G4QMDRESULT Collsion Pauli Blocked " << std::endl; 462 } 400 } 463 } 401 } 464 else 402 else 465 { 403 { 466 if ( theMeanField->IsPauliBlocked 404 if ( theMeanField->IsPauliBlocked ( i ) == true || theMeanField->IsPauliBlocked ( j ) == true ) 467 pauli_blocked = false; 405 pauli_blocked = false; 468 //std::cout << "G4QMDRESULT Collsi 406 //std::cout << "G4QMDRESULT Collsion Blocked " << std::endl; 469 } 407 } 470 */ 408 */ 471 409 472 /* 410 /* 473 G4cout << "G4QMDRESULT Collsion in << 411 std::cout << "G4QMDRESULT Collsion initial p4 i and j " 474 << p4i << " " << p4j 412 << p4i << " " << p4j 475 << G4endl; << 413 << std::endl; 476 */ 414 */ 477 // 081118 415 // 081118 478 //if ( energetically_forbidden == tru 416 //if ( energetically_forbidden == true || pauli_blocked == true ) 479 if ( energetically_forbidden == true 417 if ( energetically_forbidden == true ) 480 { 418 { 481 419 482 //G4cout << " energetically_forbid 420 //G4cout << " energetically_forbidden " << G4endl; 483 // Collsion not allowed then re enter 421 // Collsion not allowed then re enter orginal participants 484 // Now only momentum, becasuse we onl 422 // Now only momentum, becasuse we only consider elastic scattering of nucleons 485 423 486 theSystem->GetParticipant( i )->Se 424 theSystem->GetParticipant( i )->SetMomentum( p4i.vect() ); 487 theSystem->GetParticipant( i )->Se 425 theSystem->GetParticipant( i )->SetDefinition( pdi ); 488 theSystem->GetParticipant( i )->Se 426 theSystem->GetParticipant( i )->SetPosition( ri ); 489 427 490 theSystem->GetParticipant( j )->Se 428 theSystem->GetParticipant( j )->SetMomentum( p4j.vect() ); 491 theSystem->GetParticipant( j )->Se 429 theSystem->GetParticipant( j )->SetDefinition( pdj ); 492 theSystem->GetParticipant( j )->Se 430 theSystem->GetParticipant( j )->SetPosition( rj ); 493 431 494 theMeanField->Cal2BodyQuantities( 432 theMeanField->Cal2BodyQuantities( i ); 495 theMeanField->Cal2BodyQuantities( 433 theMeanField->Cal2BodyQuantities( j ); 496 434 497 } 435 } 498 else 436 else 499 { 437 { 500 438 501 439 502 G4bool absorption = false; 440 G4bool absorption = false; 503 if ( n == theSystem->GetTotalNumber 441 if ( n == theSystem->GetTotalNumberOfParticipant()+1 ) absorption = true; 504 if ( absorption ) 442 if ( absorption ) 505 { 443 { 506 //G4cout << "Absorption happend 444 //G4cout << "Absorption happend " << G4endl; 507 i = i-1; 445 i = i-1; 508 n = n-1; 446 n = n-1; 509 } 447 } 510 448 511 // Collsion allowed (really happened) 449 // Collsion allowed (really happened) 512 450 513 // Unset Projectile/Target flag 451 // Unset Projectile/Target flag 514 theSystem->GetParticipant( i )->Un 452 theSystem->GetParticipant( i )->UnsetInitialMark(); 515 if ( !absorption ) theSystem->GetP 453 if ( !absorption ) theSystem->GetParticipant( j )->UnsetInitialMark(); 516 454 517 theSystem->GetParticipant( i )->Se 455 theSystem->GetParticipant( i )->SetHitMark(); 518 if ( !absorption ) theSystem->GetP 456 if ( !absorption ) theSystem->GetParticipant( j )->SetHitMark(); 519 457 520 theSystem->IncrementCollisionCount 458 theSystem->IncrementCollisionCounter(); 521 459 522 /* 460 /* 523 G4cout << "G4QMDRESULT Collsion Re << 461 std::cout << "G4QMDRESULT Collsion Really Happened between " 524 << i << " and " << j 462 << i << " and " << j 525 << G4endl; << 463 << std::endl; 526 G4cout << "G4QMDRESULT Collsion in << 464 std::cout << "G4QMDRESULT Collsion initial p4 i and j " 527 << p4i << " " << p4j 465 << p4i << " " << p4j 528 << G4endl; << 466 << std::endl; 529 G4cout << "G4QMDRESULT Collsion af << 467 std::cout << "G4QMDRESULT Collsion after p4 i and j " 530 << theSystem->GetPartici 468 << theSystem->GetParticipant( i )->Get4Momentum() 531 << " " 469 << " " 532 << theSystem->GetPartici 470 << theSystem->GetParticipant( j )->Get4Momentum() 533 << G4endl; << 471 << std::endl; 534 G4cout << "G4QMDRESULT Collsion Di << 472 std::cout << "G4QMDRESULT Collsion Diff " 535 << p4i + p4j - theSystem 473 << p4i + p4j - theSystem->GetParticipant( i )->Get4Momentum() - theSystem->GetParticipant( j )->Get4Momentum() 536 << G4endl; << 474 << std::endl; 537 G4cout << "G4QMDRESULT Collsion in << 475 std::cout << "G4QMDRESULT Collsion initial r i and j " 538 << ri << " " << rj 476 << ri << " " << rj 539 << G4endl; << 477 << std::endl; 540 G4cout << "G4QMDRESULT Collsion af << 478 std::cout << "G4QMDRESULT Collsion after r i and j " 541 << theSystem->GetPartici 479 << theSystem->GetParticipant( i )->GetPosition() 542 << " " 480 << " " 543 << theSystem->GetPartici 481 << theSystem->GetParticipant( j )->GetPosition() 544 << G4endl; << 482 << std::endl; 545 */ 483 */ 546 484 547 485 548 } 486 } 549 487 550 } 488 } 551 489 552 } 490 } 553 491 554 492 555 } 493 } 556 494 557 495 558 496 559 G4bool G4QMDCollision::CalFinalStateOfTheBinar 497 G4bool G4QMDCollision::CalFinalStateOfTheBinaryCollision( G4int i , G4int j ) 560 { 498 { 561 499 562 //081103 500 //081103 563 //G4cout << "CalFinalStateOfTheBinaryCollis 501 //G4cout << "CalFinalStateOfTheBinaryCollision " << i << " " << j << " " << theSystem->GetTotalNumberOfParticipant() << G4endl; 564 502 565 G4bool result = false; 503 G4bool result = false; 566 G4bool energyOK = false; 504 G4bool energyOK = false; 567 G4bool pauliOK = false; 505 G4bool pauliOK = false; 568 G4bool abs = false; 506 G4bool abs = false; 569 G4QMDParticipant* absorbed = NULL; 507 G4QMDParticipant* absorbed = NULL; 570 508 571 G4LorentzVector p4i = theSystem->GetPartici 509 G4LorentzVector p4i = theSystem->GetParticipant( i )->Get4Momentum(); 572 G4LorentzVector p4j = theSystem->GetPartici 510 G4LorentzVector p4j = theSystem->GetParticipant( j )->Get4Momentum(); 573 511 574 //071031 512 //071031 575 513 576 G4double epot = theMeanField->GetTotalPoten 514 G4double epot = theMeanField->GetTotalPotential(); 577 515 578 G4double eini = epot + p4i.e() + p4j.e(); 516 G4double eini = epot + p4i.e() + p4j.e(); 579 517 580 //071031 518 //071031 581 // will use KineticTrack 519 // will use KineticTrack 582 const G4ParticleDefinition* pdi0 =theSystem << 520 G4ParticleDefinition* pdi0 =theSystem->GetParticipant( i )->GetDefinition(); 583 const G4ParticleDefinition* pdj0 =theSystem << 521 G4ParticleDefinition* pdj0 =theSystem->GetParticipant( j )->GetDefinition(); 584 G4LorentzVector p4i0 = p4i*GeV; 522 G4LorentzVector p4i0 = p4i*GeV; 585 G4LorentzVector p4j0 = p4j*GeV; 523 G4LorentzVector p4j0 = p4j*GeV; 586 G4ThreeVector ri0 = ( theSystem->GetPartici 524 G4ThreeVector ri0 = ( theSystem->GetParticipant( i )->GetPosition() )*fermi; 587 G4ThreeVector rj0 = ( theSystem->GetPartici 525 G4ThreeVector rj0 = ( theSystem->GetParticipant( j )->GetPosition() )*fermi; 588 526 589 for ( G4int iitry = 0 ; iitry < 4 ; iitry++ 527 for ( G4int iitry = 0 ; iitry < 4 ; iitry++ ) 590 { 528 { 591 529 592 abs = false; 530 abs = false; 593 531 594 G4KineticTrack kt1( pdi0 , 0.0 , ri0 , p 532 G4KineticTrack kt1( pdi0 , 0.0 , ri0 , p4i0 ); 595 G4KineticTrack kt2( pdj0 , 0.0 , rj0 , p 533 G4KineticTrack kt2( pdj0 , 0.0 , rj0 , p4j0 ); 596 534 597 G4LorentzVector p4ix_new; 535 G4LorentzVector p4ix_new; 598 G4LorentzVector p4jx_new; 536 G4LorentzVector p4jx_new; 599 G4KineticTrackVector* secs = NULL; 537 G4KineticTrackVector* secs = NULL; 600 secs = theScatterer->Scatter( kt1 , kt2 538 secs = theScatterer->Scatter( kt1 , kt2 ); 601 539 602 //std::cout << "G4QMDSCATTERER BEFORE " 540 //std::cout << "G4QMDSCATTERER BEFORE " << kt1.GetDefinition()->GetParticleName() << " " << kt1.Get4Momentum()/GeV << " " << kt1.GetPosition()/fermi << std::endl; 603 //std::cout << "G4QMDSCATTERER BEFORE " 541 //std::cout << "G4QMDSCATTERER BEFORE " << kt2.GetDefinition()->GetParticleName() << " " << kt2.Get4Momentum()/GeV << " " << kt2.GetPosition()/fermi << std::endl; 604 //std::cout << "THESCATTERER " << theSca 542 //std::cout << "THESCATTERER " << theScatterer->GetCrossSection ( kt1 , kt2 )/millibarn << " " << elastic << " " << sig << std::endl; 605 543 606 544 607 if ( secs ) 545 if ( secs ) 608 { 546 { 609 G4int iti = 0; 547 G4int iti = 0; 610 if ( secs->size() == 2 ) 548 if ( secs->size() == 2 ) 611 { 549 { 612 for ( G4KineticTrackVector::iterat 550 for ( G4KineticTrackVector::iterator it 613 = secs->begin() ; it != secs-> 551 = secs->begin() ; it != secs->end() ; it++ ) 614 { 552 { 615 if ( iti == 0 ) 553 if ( iti == 0 ) 616 { 554 { 617 theSystem->GetParticipant( i 555 theSystem->GetParticipant( i )->SetDefinition( (*it)->GetDefinition() ); 618 p4ix_new = (*it)->Get4Moment 556 p4ix_new = (*it)->Get4Momentum()/GeV; 619 //std::cout << "THESCATTERER 557 //std::cout << "THESCATTERER " << (*it)->GetDefinition()->GetParticleName() << std::endl; 620 theSystem->GetParticipant( i 558 theSystem->GetParticipant( i )->SetMomentum( p4ix_new.v() ); 621 } 559 } 622 if ( iti == 1 ) 560 if ( iti == 1 ) 623 { 561 { 624 theSystem->GetParticipant( j 562 theSystem->GetParticipant( j )->SetDefinition( (*it)->GetDefinition() ); 625 p4jx_new = (*it)->Get4Moment 563 p4jx_new = (*it)->Get4Momentum()/GeV; 626 //std::cout << "THESCATTERER 564 //std::cout << "THESCATTERER " << p4jx_new.e()-p4jx_new.m() << std::endl; 627 theSystem->GetParticipant( j 565 theSystem->GetParticipant( j )->SetMomentum( p4jx_new.v() ); 628 } 566 } 629 //std::cout << "G4QMDSCATTERER 567 //std::cout << "G4QMDSCATTERER AFTER " << (*it)->GetDefinition()->GetParticleName() << " " << (*it)->Get4Momentum()/GeV << std::endl; 630 iti++; 568 iti++; 631 } 569 } 632 } 570 } 633 else if ( secs->size() == 1 ) 571 else if ( secs->size() == 1 ) 634 { 572 { 635 //081118 573 //081118 636 abs = true; 574 abs = true; 637 //G4cout << "G4QMDCollision pion a 575 //G4cout << "G4QMDCollision pion absrorption " << secs->front()->GetDefinition()->GetParticleName() << G4endl; 638 //secs->front()->Decay(); 576 //secs->front()->Decay(); 639 theSystem->GetParticipant( i )->Se 577 theSystem->GetParticipant( i )->SetDefinition( secs->front()->GetDefinition() ); 640 p4ix_new = secs->front()->Get4Mome 578 p4ix_new = secs->front()->Get4Momentum()/GeV; 641 theSystem->GetParticipant( i )->Se 579 theSystem->GetParticipant( i )->SetMomentum( p4ix_new.v() ); 642 580 643 } 581 } 644 582 645 //081118 583 //081118 646 if ( secs->size() > 2 ) 584 if ( secs->size() > 2 ) 647 { 585 { 648 586 649 G4cout << "G4QMDCollision secs siz 587 G4cout << "G4QMDCollision secs size > 2; " << secs->size() << G4endl; 650 588 651 for ( G4KineticTrackVector::iterat 589 for ( G4KineticTrackVector::iterator it 652 = secs->begin() ; it != secs-> 590 = secs->begin() ; it != secs->end() ; it++ ) 653 { 591 { 654 G4cout << "G4QMDSCATTERER AFTER 592 G4cout << "G4QMDSCATTERER AFTER " << (*it)->GetDefinition()->GetParticleName() << " " << (*it)->Get4Momentum()/GeV << G4endl; 655 } 593 } 656 594 657 } 595 } 658 596 659 // deleteing KineticTrack 597 // deleteing KineticTrack 660 for ( G4KineticTrackVector::iterator 598 for ( G4KineticTrackVector::iterator it 661 = secs->begin() ; it != secs->e 599 = secs->begin() ; it != secs->end() ; it++ ) 662 { 600 { 663 delete *it; 601 delete *it; 664 } 602 } 665 603 666 delete secs; 604 delete secs; 667 } 605 } 668 //071031 606 //071031 669 607 670 if ( !abs ) 608 if ( !abs ) 671 { 609 { 672 theMeanField->Cal2BodyQuantities( i ) 610 theMeanField->Cal2BodyQuantities( i ); 673 theMeanField->Cal2BodyQuantities( j ) 611 theMeanField->Cal2BodyQuantities( j ); 674 } 612 } 675 else 613 else 676 { 614 { 677 absorbed = theSystem->EraseParticipan 615 absorbed = theSystem->EraseParticipant( j ); 678 theMeanField->Update(); 616 theMeanField->Update(); 679 } 617 } 680 618 681 epot = theMeanField->GetTotalPotential() 619 epot = theMeanField->GetTotalPotential(); 682 620 683 G4double efin = epot + p4ix_new.e() + p4 621 G4double efin = epot + p4ix_new.e() + p4jx_new.e(); 684 622 685 //std::cout << "Collision NEW epot " << << 623 //std::cout << "Collision NEW epot " << i << " " << j << " " << epot << " " << std::abs ( eini - efin ) - epse << std::endl; 686 624 687 /* 625 /* 688 G4cout << "Collision efin " << i << " " << 626 std::cout << "Collision efin " << i << " " << j << " " << efin << std::endl; 689 G4cout << "Collision " << i << " " << j << 627 std::cout << "Collision " << i << " " << j << " " << std::abs ( eini - efin ) << " " << epse << std::endl; 690 G4cout << "Collision " << std::abs ( ein << 628 std::cout << "Collision " << std::abs ( eini - efin ) << " " << epse << std::endl; 691 */ 629 */ 692 630 693 //071031 631 //071031 694 if ( std::abs ( eini - efin ) < fepse ) << 632 if ( std::abs ( eini - efin ) < epse ) 695 { 633 { 696 // Collison OK 634 // Collison OK 697 //std::cout << "collisions6" << std:: 635 //std::cout << "collisions6" << std::endl; 698 //std::cout << "collisions before " < 636 //std::cout << "collisions before " << p4i << " " << p4j << std::endl; 699 //std::cout << "collisions after " << 637 //std::cout << "collisions after " << theSystem->GetParticipant( i )->Get4Momentum() << " " << theSystem->GetParticipant( j )->Get4Momentum() << std::endl; 700 //std::cout << "collisions dif " << ( 638 //std::cout << "collisions dif " << ( p4i + p4j ) - ( theSystem->GetParticipant( i )->Get4Momentum() + theSystem->GetParticipant( j )->Get4Momentum() ) << std::endl; 701 //std::cout << "collisions before " < 639 //std::cout << "collisions before " << ri0/fermi << " " << rj0/fermi << std::endl; 702 //std::cout << "collisions after " << 640 //std::cout << "collisions after " << theSystem->GetParticipant( i )->GetPosition() << " " << theSystem->GetParticipant( j )->GetPosition() << std::endl; 703 energyOK = true; 641 energyOK = true; 704 break; 642 break; 705 } 643 } 706 else 644 else 707 { 645 { 708 //G4cout << "Energy Not OK " << G4end 646 //G4cout << "Energy Not OK " << G4endl; 709 if ( abs ) 647 if ( abs ) 710 { 648 { 711 //G4cout << "TKDB reinsert j " << 649 //G4cout << "TKDB reinsert j " << G4endl; 712 theSystem->InsertParticipant( abso 650 theSystem->InsertParticipant( absorbed , j ); 713 theMeanField->Update(); 651 theMeanField->Update(); 714 } 652 } 715 // do not need reinsert in no absropt 653 // do not need reinsert in no absroption case 716 } 654 } 717 //071031 655 //071031 718 } 656 } 719 657 720 // Energetically forbidden collision 658 // Energetically forbidden collision 721 659 722 if ( energyOK ) 660 if ( energyOK ) 723 { 661 { 724 // Pauli Check 662 // Pauli Check 725 //G4cout << "Pauli Checking " << theSyst 663 //G4cout << "Pauli Checking " << theSystem->GetTotalNumberOfParticipant() << G4endl; 726 if ( !abs ) 664 if ( !abs ) 727 { 665 { 728 if ( !( theMeanField->IsPauliBlocked 666 if ( !( theMeanField->IsPauliBlocked ( i ) == true || theMeanField->IsPauliBlocked ( j ) == true ) ) 729 { 667 { 730 //G4cout << "Binary Collision Happ 668 //G4cout << "Binary Collision Happen " << theSystem->GetTotalNumberOfParticipant() << G4endl; 731 pauliOK = true; 669 pauliOK = true; 732 } 670 } 733 } 671 } 734 else 672 else 735 { 673 { 736 //if ( theMeanField->IsPauliBlocked ( 674 //if ( theMeanField->IsPauliBlocked ( i ) == false ) 737 //090126 i 675 //090126 i-1 cause jth is erased 738 if ( theMeanField->IsPauliBlocked ( i 676 if ( theMeanField->IsPauliBlocked ( i-1 ) == false ) 739 { 677 { 740 //G4cout << "Absorption Happen " < 678 //G4cout << "Absorption Happen " << theSystem->GetTotalNumberOfParticipant() << G4endl; 741 delete absorbed; 679 delete absorbed; 742 pauliOK = true; 680 pauliOK = true; 743 } 681 } 744 } 682 } 745 683 746 684 747 if ( pauliOK ) 685 if ( pauliOK ) 748 { 686 { 749 result = true; 687 result = true; 750 } 688 } 751 else 689 else 752 { 690 { 753 //G4cout << "Pauli Blocked" << G4endl 691 //G4cout << "Pauli Blocked" << G4endl; 754 if ( abs ) 692 if ( abs ) 755 { 693 { 756 //G4cout << "TKDB reinsert j pauli 694 //G4cout << "TKDB reinsert j pauli block" << G4endl; 757 theSystem->InsertParticipant( abso 695 theSystem->InsertParticipant( absorbed , j ); 758 theMeanField->Update(); 696 theMeanField->Update(); 759 } 697 } 760 } 698 } 761 } 699 } 762 700 763 return result; 701 return result; 764 702 765 } 703 } 766 704 767 705 768 706 769 G4bool G4QMDCollision::CalFinalStateOfTheBinar 707 G4bool G4QMDCollision::CalFinalStateOfTheBinaryCollisionJQMD( G4double sig , G4double cutoff , G4ThreeVector pcm , G4double prcm , G4double srt , G4ThreeVector beta , G4double gamma , G4int i , G4int j ) 770 { 708 { 771 709 772 //G4cout << "CalFinalStateOfTheBinaryCollis 710 //G4cout << "CalFinalStateOfTheBinaryCollisionJQMD" << G4endl; 773 711 774 G4bool result = true; 712 G4bool result = true; 775 713 776 G4LorentzVector p4i = theSystem->GetPartic 714 G4LorentzVector p4i = theSystem->GetParticipant( i )->Get4Momentum(); 777 G4double rmi = theSystem->GetParticipant( 715 G4double rmi = theSystem->GetParticipant( i )->GetMass(); 778 G4int zi = theSystem->GetParticipant( i )- 716 G4int zi = theSystem->GetParticipant( i )->GetChargeInUnitOfEplus(); 779 717 780 G4LorentzVector p4j = theSystem->GetPartic 718 G4LorentzVector p4j = theSystem->GetParticipant( j )->Get4Momentum(); 781 G4double rmj = theSystem->GetParticipant( 719 G4double rmj = theSystem->GetParticipant( j )->GetMass(); 782 G4int zj = theSystem->GetParticipant( j )- 720 G4int zj = theSystem->GetParticipant( j )->GetChargeInUnitOfEplus(); 783 721 784 G4double pr = prcm; 722 G4double pr = prcm; 785 723 786 G4double c2 = pcm.z()/pr; 724 G4double c2 = pcm.z()/pr; 787 725 788 G4double csrt = srt - cutoff; 726 G4double csrt = srt - cutoff; 789 727 790 //G4double pri = prcm; 728 //G4double pri = prcm; 791 //G4double prf = sqrt ( 0.25 * srt*srt -rm2 729 //G4double prf = sqrt ( 0.25 * srt*srt -rm2 ); 792 730 793 G4double asrt = srt - rmi - rmj; 731 G4double asrt = srt - rmi - rmj; 794 G4double pra = prcm; 732 G4double pra = prcm; 795 733 796 734 797 735 798 G4double elastic = 0.0; 736 G4double elastic = 0.0; 799 737 800 if ( zi == zj ) 738 if ( zi == zj ) 801 { 739 { 802 if ( csrt < 0.4286 ) 740 if ( csrt < 0.4286 ) 803 { 741 { 804 elastic = 35.0 / ( 1. + csrt * 100.0 742 elastic = 35.0 / ( 1. + csrt * 100.0 ) + 20.0; 805 } 743 } 806 else 744 else 807 { 745 { 808 elastic = ( - std::atan( ( csrt - 0.4 746 elastic = ( - std::atan( ( csrt - 0.4286 ) * 1.5 - 0.8 ) 809 * 2. / pi + 1.0 ) * 9.65 + 747 * 2. / pi + 1.0 ) * 9.65 + 7.0; 810 } 748 } 811 } 749 } 812 else 750 else 813 { 751 { 814 if ( csrt < 0.4286 ) 752 if ( csrt < 0.4286 ) 815 { 753 { 816 elastic = 28.0 / ( 1. + csrt * 100.0 754 elastic = 28.0 / ( 1. + csrt * 100.0 ) + 27.0; 817 } 755 } 818 else 756 else 819 { 757 { 820 elastic = ( - std::atan( ( csrt - 0.4 758 elastic = ( - std::atan( ( csrt - 0.4286 ) * 1.5 - 0.8 ) 821 * 2. / pi + 1.0 ) * 12.34 + 759 * 2. / pi + 1.0 ) * 12.34 + 10.0; 822 } 760 } 823 } 761 } 824 762 825 // std::cout << "Collision csrt " << i << " 763 // std::cout << "Collision csrt " << i << " " << j << " " << csrt << std::endl; 826 // std::cout << "Collision elstic " << i << 764 // std::cout << "Collision elstic " << i << " " << j << " " << elastic << std::endl; 827 765 828 766 829 // std::cout << "Collision sig " << i << " " 767 // std::cout << "Collision sig " << i << " " << j << " " << sig << std::endl; 830 if ( G4UniformRand() > elastic / sig ) 768 if ( G4UniformRand() > elastic / sig ) 831 { 769 { 832 //std::cout << "Inelastic " << std::endl 770 //std::cout << "Inelastic " << std::endl; 833 //std::cout << "elastic/sig " << elastic 771 //std::cout << "elastic/sig " << elastic/sig << std::endl; 834 return result; 772 return result; 835 } 773 } 836 else 774 else 837 { 775 { 838 //std::cout << "Elastic " << std::endl; 776 //std::cout << "Elastic " << std::endl; 839 } 777 } 840 // std::cout << "Collision ELSTIC " << i << 778 // std::cout << "Collision ELSTIC " << i << " " << j << std::endl; 841 779 842 780 843 G4double as = G4Pow::GetInstance()->powN ( << 781 G4double as = std::pow ( 3.65 * asrt , 6 ); 844 G4double a = 6.0 * as / (1.0 + as); 782 G4double a = 6.0 * as / (1.0 + as); 845 G4double ta = -2.0 * pra*pra; 783 G4double ta = -2.0 * pra*pra; 846 G4double x = G4UniformRand(); 784 G4double x = G4UniformRand(); 847 G4double t1 = G4Log( (1-x) * G4Exp(2.*a*ta) << 785 G4double t1 = std::log( (1-x) * std::exp(2.*a*ta) + x ) / a; 848 G4double c1 = 1.0 - t1/ta; 786 G4double c1 = 1.0 - t1/ta; 849 787 850 if( std::abs(c1) > 1.0 ) c1 = 2.0 * x - 1.0 788 if( std::abs(c1) > 1.0 ) c1 = 2.0 * x - 1.0; 851 789 852 /* 790 /* 853 G4cout << "Collision as " << i << " " << j << 791 std::cout << "Collision as " << i << " " << j << " " << as << std::endl; 854 G4cout << "Collision a " << i << " " << j < << 792 std::cout << "Collision a " << i << " " << j << " " << a << std::endl; 855 G4cout << "Collision ta " << i << " " << j << 793 std::cout << "Collision ta " << i << " " << j << " " << ta << std::endl; 856 G4cout << "Collision x " << i << " " << j < << 794 std::cout << "Collision x " << i << " " << j << " " << x << std::endl; 857 G4cout << "Collision t1 " << i << " " << j << 795 std::cout << "Collision t1 " << i << " " << j << " " << t1 << std::endl; 858 G4cout << "Collision c1 " << i << " " << j << 796 std::cout << "Collision c1 " << i << " " << j << " " << c1 << std::endl; 859 */ 797 */ 860 t1 = 2.0*pi*G4UniformRand(); 798 t1 = 2.0*pi*G4UniformRand(); 861 // std::cout << "Collision t1 " << i << " " 799 // std::cout << "Collision t1 " << i << " " << j << " " << t1 << std::endl; 862 G4double t2 = 0.0; 800 G4double t2 = 0.0; 863 if ( pcm.x() == 0.0 && pcm.y() == 0 ) 801 if ( pcm.x() == 0.0 && pcm.y() == 0 ) 864 { 802 { 865 t2 = 0.0; 803 t2 = 0.0; 866 } 804 } 867 else 805 else 868 { 806 { 869 t2 = std::atan2( pcm.y() , pcm.x() ); 807 t2 = std::atan2( pcm.y() , pcm.x() ); 870 } 808 } 871 // std::cout << "Collision t2 " << i << " 809 // std::cout << "Collision t2 " << i << " " << j << " " << t2 << std::endl; 872 810 873 G4double s1 = std::sqrt ( 1.0 - c1*c1 ); 811 G4double s1 = std::sqrt ( 1.0 - c1*c1 ); 874 G4double s2 = std::sqrt ( 1.0 - c2*c2 ); 812 G4double s2 = std::sqrt ( 1.0 - c2*c2 ); 875 813 876 G4double ct1 = std::cos(t1); 814 G4double ct1 = std::cos(t1); 877 G4double st1 = std::sin(t1); 815 G4double st1 = std::sin(t1); 878 816 879 G4double ct2 = std::cos(t2); 817 G4double ct2 = std::cos(t2); 880 G4double st2 = std::sin(t2); 818 G4double st2 = std::sin(t2); 881 819 882 G4double ss = c2*s1*ct1 + s2*c1; 820 G4double ss = c2*s1*ct1 + s2*c1; 883 821 884 pcm.setX( pr * ( ss*ct2 - s1*st1*st2) ); 822 pcm.setX( pr * ( ss*ct2 - s1*st1*st2) ); 885 pcm.setY( pr * ( ss*st2 + s1*st1*ct2) ); 823 pcm.setY( pr * ( ss*st2 + s1*st1*ct2) ); 886 pcm.setZ( pr * ( c1*c2 - s1*s2*ct1) ); 824 pcm.setZ( pr * ( c1*c2 - s1*s2*ct1) ); 887 825 888 // std::cout << "Collision pcm " << i << " " < 826 // std::cout << "Collision pcm " << i << " " << j << " " << pcm << std::endl; 889 827 890 G4double epot = theMeanField->GetTotalPoten 828 G4double epot = theMeanField->GetTotalPotential(); 891 829 892 G4double eini = epot + p4i.e() + p4j.e(); 830 G4double eini = epot + p4i.e() + p4j.e(); 893 G4double etwo = p4i.e() + p4j.e(); 831 G4double etwo = p4i.e() + p4j.e(); 894 832 895 /* 833 /* 896 G4cout << "Collision epot " << i << " " << << 834 std::cout << "Collision epot " << i << " " << j << " " << epot << std::endl; 897 G4cout << "Collision eini " << i << " " << << 835 std::cout << "Collision eini " << i << " " << j << " " << eini << std::endl; 898 G4cout << "Collision etwo " << i << " " << << 836 std::cout << "Collision etwo " << i << " " << j << " " << etwo << std::endl; 899 */ 837 */ 900 838 901 839 902 for ( G4int itry = 0 ; itry < 4 ; itry++ ) 840 for ( G4int itry = 0 ; itry < 4 ; itry++ ) 903 { 841 { 904 842 905 G4double eicm = std::sqrt ( rmi*rmi + pc 843 G4double eicm = std::sqrt ( rmi*rmi + pcm*pcm ); 906 G4double pibeta = pcm*beta; 844 G4double pibeta = pcm*beta; 907 845 908 G4double trans = gamma * ( gamma * pibet 846 G4double trans = gamma * ( gamma * pibeta / ( gamma + 1 ) + eicm ); 909 847 910 G4ThreeVector pi_new = beta*trans + pcm; 848 G4ThreeVector pi_new = beta*trans + pcm; 911 849 912 G4double ejcm = std::sqrt ( rmj*rmj + pc 850 G4double ejcm = std::sqrt ( rmj*rmj + pcm*pcm ); 913 trans = gamma * ( gamma * pibeta / ( gam 851 trans = gamma * ( gamma * pibeta / ( gamma + 1 ) + ejcm ); 914 852 915 G4ThreeVector pj_new = beta*trans - pcm; 853 G4ThreeVector pj_new = beta*trans - pcm; 916 854 917 // 855 // 918 // Delete old 856 // Delete old 919 // Add new Particitipants 857 // Add new Particitipants 920 // 858 // 921 // Now only change momentum ( Beacuse we only 859 // Now only change momentum ( Beacuse we only have elastic sctter of nucleon 922 // In future Definition also will be change 860 // In future Definition also will be change 923 // 861 // 924 862 925 theSystem->GetParticipant( i )->SetMomen 863 theSystem->GetParticipant( i )->SetMomentum( pi_new ); 926 theSystem->GetParticipant( j )->SetMomen 864 theSystem->GetParticipant( j )->SetMomentum( pj_new ); 927 865 928 G4double pi_new_e = (theSystem->GetParti 866 G4double pi_new_e = (theSystem->GetParticipant( i )->Get4Momentum()).e(); 929 G4double pj_new_e = (theSystem->GetParti 867 G4double pj_new_e = (theSystem->GetParticipant( j )->Get4Momentum()).e(); 930 868 931 theMeanField->Cal2BodyQuantities( i ); 869 theMeanField->Cal2BodyQuantities( i ); 932 theMeanField->Cal2BodyQuantities( j ); 870 theMeanField->Cal2BodyQuantities( j ); 933 871 934 epot = theMeanField->GetTotalPotential() 872 epot = theMeanField->GetTotalPotential(); 935 873 936 G4double efin = epot + pi_new_e + pj_new 874 G4double efin = epot + pi_new_e + pj_new_e ; 937 875 938 //std::cout << "Collision NEW epot " << << 876 //std::cout << "Collision NEW epot " << i << " " << j << " " << epot << " " << std::abs ( eini - efin ) - epse << std::endl; 939 /* 877 /* 940 G4cout << "Collision efin " << i << " " << 878 std::cout << "Collision efin " << i << " " << j << " " << efin << std::endl; 941 G4cout << "Collision " << i << " " << j << 879 std::cout << "Collision " << i << " " << j << " " << std::abs ( eini - efin ) << " " << epse << std::endl; 942 G4cout << "Collision " << std::abs ( ein << 880 std::cout << "Collision " << std::abs ( eini - efin ) << " " << epse << std::endl; 943 */ 881 */ 944 882 945 //071031 883 //071031 946 if ( std::abs ( eini - efin ) < fepse ) << 884 if ( std::abs ( eini - efin ) < epse ) 947 { 885 { 948 // Collison OK 886 // Collison OK 949 //std::cout << "collisions6" << std:: 887 //std::cout << "collisions6" << std::endl; 950 //std::cout << "collisions before " < 888 //std::cout << "collisions before " << p4i << " " << p4j << std::endl; 951 //std::cout << "collisions after " << 889 //std::cout << "collisions after " << theSystem->GetParticipant( i )->Get4Momentum() << " " << theSystem->GetParticipant( j )->Get4Momentum() << std::endl; 952 //std::cout << "collisions dif " << ( 890 //std::cout << "collisions dif " << ( p4i + p4j ) - ( theSystem->GetParticipant( i )->Get4Momentum() + theSystem->GetParticipant( j )->Get4Momentum() ) << std::endl; 953 //std::cout << "collisions before " < 891 //std::cout << "collisions before " << rix/fermi << " " << rjx/fermi << std::endl; 954 //std::cout << "collisions after " << 892 //std::cout << "collisions after " << theSystem->GetParticipant( i )->GetPosition() << " " << theSystem->GetParticipant( j )->GetPosition() << std::endl; 955 } 893 } 956 //071031 894 //071031 957 895 958 if ( std::abs ( eini - efin ) < fepse << 896 if ( std::abs ( eini - efin ) < epse ) return result; // Collison OK 959 897 960 G4double cona = ( eini - efin + etwo 898 G4double cona = ( eini - efin + etwo ) / gamma; 961 G4double fac2 = 1.0 / ( 4.0 * cona*co 899 G4double fac2 = 1.0 / ( 4.0 * cona*cona * pr*pr ) * 962 ( ( cona*cona - ( rmi*r 900 ( ( cona*cona - ( rmi*rmi + rmj*rmj ) )*( cona*cona - ( rmi*rmi + rmj*rmj ) ) 963 - 4.0 * rmi*rmi * rmj*r 901 - 4.0 * rmi*rmi * rmj*rmj ); 964 902 965 if ( fac2 > 0 ) 903 if ( fac2 > 0 ) 966 { 904 { 967 G4double fact = std::sqrt ( fac2 ) 905 G4double fact = std::sqrt ( fac2 ); 968 pcm = fact*pcm; 906 pcm = fact*pcm; 969 } 907 } 970 908 971 909 972 } 910 } 973 911 974 // Energetically forbidden collision 912 // Energetically forbidden collision 975 result = false; 913 result = false; 976 914 977 return result; 915 return result; 978 916 979 } 917 } 980 918