Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/hadronic/models/qmd/src/G4LightIonQMDCollision.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/models/qmd/src/G4LightIonQMDCollision.cc (Version 11.3.0) and /processes/hadronic/models/qmd/src/G4LightIonQMDCollision.cc (Version 10.3)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 // 080602 Fix memory leaks by T. Koi              
 27 // 081120 Add deltaT in signature of CalKinema    
 28 //        Add several required updating of Mea    
 29 //        Modified handling of absorption case    
 30 // 090126 Fix in absorption case by T. Koi        
 31 // 090331 Fix for gamma participant by T. Koi     
 32 //                                                
 33 // 230308 Tentative modified in a short-lived     
 34 // 230308 Energy difference evaluated by "GetT    
 35 //                                                
 36 #include "G4LightIonQMDCollision.hh"              
 37 #include "G4Scatterer.hh"                         
 38 #include "G4Pow.hh"                               
 39 #include "G4Exp.hh"                               
 40 #include "G4Log.hh"                               
 41 #include "G4PhysicalConstants.hh"                 
 42 #include "G4SystemOfUnits.hh"                     
 43 #include "Randomize.hh"                           
 44                                                   
 45 G4LightIonQMDCollision::G4LightIonQMDCollision    
 46 : fdeltar ( 4.0 )                                 
 47 , fbcmax0 ( 1.323142 ) // NN maximum impact pa    
 48 , fbcmax1 ( 2.523 )    // others maximum impac    
 49 // , sig0 ( 55 )   // NN cross section            
 50 //110617 fix for gcc 4.6 compilation warnings     
 51 //, sig1 ( 200 )  // others cross section         
 52 , fepse ( 0.0001 )                                
 53 {                                                 
 54    //These two pointers will be set through Se    
 55    theSystem=NULL;                                
 56    theMeanField=NULL;                             
 57    theScatterer = new G4Scatterer();              
 58 }                                                 
 59                                                   
 60 /*                                                
 61 G4LightIonQMDCollision::G4LightIonQMDCollision    
 62 : fdeltar ( obj.fdeltar )                         
 63 , fbcmax0 ( obj.fbcmax0 ) // NN maximum impact    
 64 , fbcmax1 ( obj.fbcmax1 )    // others maximum    
 65 , fepse ( obj.fepse )                             
 66 {                                                 
 67                                                   
 68    if ( obj.theSystem != NULL ) {                 
 69       theSystem = new G4QMDSystem;                
 70       *theSystem = *obj.theSystem;                
 71    } else {                                       
 72       theSystem = NULL;                           
 73    }                                              
 74    if ( obj.theMeanField != NULL ) {              
 75       theMeanField = new G4LightIonQMDMeanFiel    
 76       *theMeanField = *obj.theMeanField;          
 77    } else {                                       
 78       theMeanField = NULL;                        
 79    }                                              
 80    theScatterer = new G4Scatterer();              
 81    *theScatterer = *obj.theScatterer;             
 82 }                                                 
 83                                                   
 84 G4LightIonQMDCollision & G4LightIonQMDCollisio    
 85 {                                                 
 86    fdeltar = obj.fdeltar;                         
 87    fbcmax0 = obj.fbcmax1;                         
 88    fepse = obj.fepse;                             
 89                                                   
 90    if ( obj.theSystem != NULL ) {                 
 91       delete theSystem;                           
 92       theSystem = new G4QMDSystem;                
 93       *theSystem = *obj.theSystem;                
 94    } else {                                       
 95       theSystem = NULL;                           
 96    }                                              
 97    if ( obj.theMeanField != NULL ) {              
 98       delete theMeanField;                        
 99       theMeanField = new G4LightIonQMDMeanFiel    
100       *theMeanField = *obj.theMeanField;          
101    } else {                                       
102       theMeanField = NULL;                        
103    }                                              
104    delete theScatterer;                           
105    theScatterer = new G4Scatterer();              
106    *theScatterer = *obj.theScatterer;             
107                                                   
108    return *this;                                  
109 }                                                 
110 */                                                
111                                                   
112                                                   
113 G4LightIonQMDCollision::~G4LightIonQMDCollisio    
114 {                                                 
115    //if ( theSystem != NULL ) delete theSystem    
116    //if ( theMeanField != NULL ) delete theMea    
117    delete theScatterer;                           
118 }                                                 
119                                                   
120                                                   
121 void G4LightIonQMDCollision::CalKinematicsOfBi    
122 {                                                 
123    G4double deltaT = dt;                          
124                                                   
125    G4int n = theSystem->GetTotalNumberOfPartic    
126 //081118                                          
127    //G4int nb = 0;                                
128    for ( G4int i = 0 ; i < n ; i++ )              
129    {                                              
130       theSystem->GetParticipant( i )->UnsetHit    
131       theSystem->GetParticipant( i )->UnsetHit    
132       //nb += theSystem->GetParticipant( i )->    
133    }                                              
134    //G4cout << "nb = " << nb << " n = " << n <    
135                                                   
136                                                   
137 //071101                                          
138    for ( G4int i = 0 ; i < n ; i++ )              
139    {                                              
140                                                   
141       //std::cout << i << " " << theSystem->Ge    
142                                                   
143       if ( theSystem->GetParticipant( i )->Get    
144       {                                           
145                                                   
146          G4bool decayed = false;                  
147                                                   
148          const G4ParticleDefinition* pd0 = the    
149          G4ThreeVector p0 = theSystem->GetPart    
150          G4ThreeVector r0 = theSystem->GetPart    
151                                                   
152          G4LorentzVector p40 = theSystem->GetP    
153                                                   
154           G4double eini = theMeanField->GetTot    
155                                                   
156          G4int n0 = theSystem->GetTotalNumberO    
157          G4int i0 = 0;                            
158                                                   
159          G4bool isThisEnergyOK = false;           
160                                                   
161          G4int maximumNumberOfTrial=4;            
162          for ( G4int ii = 0 ; ii < maximumNumb    
163          {                                        
164                                                   
165             //G4LorentzVector p4 = theSystem->    
166             G4LorentzVector p400 = p40;           
167                                                   
168             p400 *= GeV;                          
169             //G4KineticTrack kt( theSystem->Ge    
170             G4KineticTrack kt( pd0 , 0.0 , r0*    
171             //std::cout << "G4KineticTrack " <    
172             G4KineticTrackVector* secs = NULL;    
173             secs = kt.Decay();                    
174             G4int id = 0;                         
175             //G4double et = 0;                    
176             if ( secs )                           
177             {                                     
178                for ( G4KineticTrackVector::ite    
179                      = secs->begin() ; it != s    
180                {                                  
181 /*                                                
182                   G4cout << "G4KineticTrack"      
183                   << " " << (*it)->GetDefiniti    
184                   << " " << (*it)->Get4Momentu    
185                   << " " << (*it)->GetPosition    
186                   << G4endl;                      
187 */                                                
188                    if ( id == 0 )                 
189                    {                              
190                       theSystem->GetParticipan    
191                       theSystem->GetParticipan    
192                       theSystem->GetParticipan    
193                       //theMeanField->Cal2Body    
194                       //et += (*it)->Get4Momen    
195                    }                              
196                    if ( id > 0 )                  
197                    {                              
198                       // Append end;              
199                       theSystem->SetParticipan    
200                       //et += (*it)->Get4Momen    
201                       if ( id > 1 )               
202                       {                           
203                          //081118                 
204                          //G4cout << "G4LightI    
205                       }                           
206                    }                              
207                    id++; // number of daughter    
208                                                   
209                    delete *it;                    
210                }                                  
211                                                   
212                theMeanField->Update();            
213                i0 = id-1; // 0 enter to i         
214                                                   
215                delete secs;                       
216             }                                     
217                                                   
218 //          EnergyCheck                           
219                                                   
220              G4double efin = theMeanField->Get    
221             //std::cout <<  std::abs ( eini -     
222 //            std::cout <<  std::abs ( eini -     
223 //                                           *    
224             if ( std::abs ( eini - efin ) < fe    
225             {                                     
226                // Energy OK                       
227                isThisEnergyOK = true;             
228                break;                             
229             }                                     
230             else                                  
231             {                                     
232                                                   
233                theSystem->GetParticipant( i )-    
234                theSystem->GetParticipant( i )-    
235                theSystem->GetParticipant( i )-    
236                                                   
237                //for ( G4int i0i = 0 ; i0i < i    
238                //160210 deletion must be done     
239                for ( G4int i0i = id-2 ; 0 <= i    
240                   //081118                        
241                   //std::cout << "Decay Energi    
242                   theSystem->DeleteParticipant    
243                }                                  
244                //081103                           
245                theMeanField->Update();            
246             }                                     
247                                                   
248          }                                        
249                                                   
250                                                   
251 //       Pauli Check                              
252          if ( isThisEnergyOK == true )            
253          {                                        
254             if ( theMeanField->IsPauliBlocked     
255             {                                     
256                                                   
257                G4bool allOK = true;               
258                for ( G4int i0i = 0 ; i0i < i0     
259                {                                  
260                   if ( theMeanField->IsPauliBl    
261                   {                               
262                      allOK = false;               
263                      break;                       
264                   }                               
265                }                                  
266                                                   
267                if ( allOK )                       
268                {                                  
269                   decayed = true; //Decay Succ    
270                }                                  
271             }                                     
272                                                   
273          }                                        
274 //                                                
275                                                   
276          if ( decayed )                           
277          {                                        
278             //081119                              
279             //G4cout << "Decay Suceeded! " <<     
280             theSystem->GetParticipant( i )->Se    
281             for ( G4int i0i = 0 ; i0i < i0 ; i    
282             {                                     
283                 theSystem->GetParticipant( i0i    
284             }                                     
285                                                   
286          }                                        
287          else                                     
288          {                                        
289                                                   
290 //          Decay Blocked and re-enter orginal    
291                                                   
292             if ( isThisEnergyOK == true )  //     
293             {                                     
294                                                   
295                theSystem->GetParticipant( i )-    
296                theSystem->GetParticipant( i )-    
297                theSystem->GetParticipant( i )-    
298                                                   
299                for ( G4int i0i = 0 ; i0i < i0     
300                {                                  
301                   //081118                        
302                   //std::cout << "Decay Blocke    
303                   //160210 adding commnet: del    
304                   theSystem->DeleteParticipant    
305                }                                  
306                //081103                           
307                theMeanField->Update();            
308             }                                     
309                                                   
310          }                                        
311                                                   
312       }  //shortlive                              
313    }  // go next participant                      
314 //071101                                          
315                                                   
316                                                   
317    n = theSystem->GetTotalNumberOfParticipant(    
318                                                   
319 //081118                                          
320    //for ( G4int i = 1 ; i < n ; i++ )            
321    for ( G4int i = 1 ; i < theSystem->GetTotal    
322    {                                              
323                                                   
324       //std::cout << "Collision i " << i << st    
325       if ( theSystem->GetParticipant( i )->IsT    
326                                                   
327                                                   
328       G4ThreeVector ri =  theSystem->GetPartic    
329       G4LorentzVector p4i =  theSystem->GetPar    
330       G4double rmi =  theSystem->GetParticipan    
331       const G4ParticleDefinition* pdi =  theSy    
332 //090331 gamma                                    
333       if ( pdi->GetPDGMass() == 0.0 ) continue    
334                                                   
335       //std::cout << " p4i00 " << p4i << std::    
336       for ( G4int j = 0 ; j < i ; j++ )           
337       {                                           
338                                                   
339                                                   
340 /*                                                
341          G4cout << "Collision " << i << " " <<    
342          G4cout << "Collision " << j << " " <<    
343          G4cout << "Collision " << i << " " <<    
344          G4cout << "Collision " << j << " " <<    
345 */                                                
346                                                   
347          // Only 1 Collision allowed for each     
348          //081119                                 
349          if ( theSystem->GetParticipant( i )->    
350          if ( theSystem->GetParticipant( j )->    
351                                                   
352          //std::cout << "Collision " << i << "    
353                                                   
354          // Do not allow collision between nuc    
355          if ( theSystem->GetParticipant( i )->    
356          {                                        
357             if ( theSystem->GetParticipant( j     
358          }                                        
359          else if ( theSystem->GetParticipant(     
360          {                                        
361             if ( theSystem->GetParticipant( j     
362          }                                        
363                                                   
364                                                   
365          G4ThreeVector rj =  theSystem->GetPar    
366          G4LorentzVector p4j =  theSystem->Get    
367          G4double rmj =  theSystem->GetPartici    
368          const G4ParticleDefinition* pdj =  th    
369 //090331 gamma                                    
370          if ( pdj->GetPDGMass() == 0.0 ) conti    
371                                                   
372          G4double rr2 = theMeanField->GetRR2(     
373                                                   
374 //       Here we assume elab (beam momentum le    
375          if ( rr2 > fdeltar*fdeltar ) continue    
376                                                   
377          //G4double s = (p4i+p4j)*(p4i+p4j);      
378          //G4double srt = std::sqrt ( s );        
379                                                   
380          G4double srt = std::sqrt( (p4i+p4j)*(    
381                                                   
382          G4double cutoff = 0.0;                   
383          G4double fbcmax = 0.0;                   
384          //110617 fix for gcc 4.6 compilation     
385          //G4double sig = 0.0;                    
386                                                   
387          if ( rmi < 0.94 && rmj < 0.94 )          
388          {                                        
389 //          nucleon or pion case                  
390             cutoff = rmi + rmj + 0.02;            
391             fbcmax = fbcmax0;                     
392             //110617 fix for gcc 4.6 compilati    
393             //sig = sig0;                         
394          }                                        
395          else                                     
396          {                                        
397             cutoff = rmi + rmj;                   
398             fbcmax = fbcmax1;                     
399             //110617 fix for gcc compilation w    
400             //sig = sig1;                         
401          }                                        
402                                                   
403          //std::cout << "Collision cutoff " <<    
404          if ( srt < cutoff ) continue;            
405                                                   
406          G4ThreeVector dr = ri - rj;              
407          G4double rsq = dr*dr;                    
408                                                   
409          G4double pij = p4i*p4j;                  
410          G4double pidr = p4i.vect()*dr;           
411          G4double pjdr = p4j.vect()*dr;           
412                                                   
413          G4double aij = 1.0 - ( rmi*rmj /pij )    
414          G4double bij = pidr / rmi - pjdr*rmi/    
415          G4double cij = rsq + ( pidr / rmi ) *    
416          G4double brel = std::sqrt ( std::abs     
417                                                   
418          if ( brel > fbcmax ) continue;           
419          //std::cout << "collisions3 " << std:    
420                                                   
421          G4double bji = -pjdr/rmj + pidr * rmj    
422                                                   
423          G4double ti = ( pidr/rmi - bij / aij     
424          G4double tj = (-pjdr/rmj - bji / aij     
425                                                   
426                                                   
427 /*                                                
428          G4cout << "collisions4  p4i " << p4i     
429          G4cout << "collisions4  ri " << ri <<    
430          G4cout << "collisions4  p4j " << p4j     
431          G4cout << "collisions4  rj " << rj <<    
432          G4cout << "collisions4  dr " << dr <<    
433          G4cout << "collisions4  pij " << pij     
434          G4cout << "collisions4  aij " << aij     
435          G4cout << "collisions4  bij bji " <<     
436          G4cout << "collisions4  pidr pjdr " <    
437          G4cout << "collisions4  p4i.e() p4j.e    
438          G4cout << "collisions4  rmi rmj " <<     
439          G4cout << "collisions4 " << ti << " "    
440 */                                                
441          if ( std::abs ( ti + tj ) > deltaT )     
442          //std::cout << "collisions4 " << std:    
443                                                   
444          G4ThreeVector beta = ( p4i + p4j ).bo    
445                                                   
446          G4LorentzVector p = p4i;                 
447          G4LorentzVector p4icm = p.boost( p.fi    
448          G4ThreeVector pcm = p4icm.vect();        
449                                                   
450          G4double prcm = pcm.mag();               
451                                                   
452          if ( prcm <= 0.00001 ) continue;         
453          //std::cout << "collisions5 " << std:    
454                                                   
455          G4bool energetically_forbidden = !( C    
456          //G4bool energetically_forbidden = !(    
457                                                   
458 /*                                                
459          G4bool pauli_blocked = false;            
460          if ( energetically_forbidden == false    
461          {                                        
462             if ( theMeanField->IsPauliBlocked     
463             {                                     
464                pauli_blocked = true;              
465                //std::cout << "G4QMDRESULT Col    
466             }                                     
467          }                                        
468          else                                     
469          {                                        
470             if ( theMeanField->IsPauliBlocked     
471                pauli_blocked = false;             
472             //std::cout << "G4QMDRESULT Collsi    
473          }                                        
474 */                                                
475                                                   
476 /*                                                
477             G4cout << "G4QMDRESULT Collsion in    
478                       << p4i << " " << p4j        
479                       << G4endl;                  
480 */                                                
481 //       081118                                   
482          //if ( energetically_forbidden == tru    
483          if ( energetically_forbidden == true     
484          {                                        
485                                                   
486             //G4cout << " energetically_forbid    
487 //          Collsion not allowed then re enter    
488 //          Now only momentum, becasuse we onl    
489                                                   
490             theSystem->GetParticipant( i )->Se    
491             theSystem->GetParticipant( i )->Se    
492             theSystem->GetParticipant( i )->Se    
493                                                   
494             theSystem->GetParticipant( j )->Se    
495             theSystem->GetParticipant( j )->Se    
496             theSystem->GetParticipant( j )->Se    
497                                                   
498             theMeanField->Cal2BodyQuantities(     
499             theMeanField->Cal2BodyQuantities(     
500                                                   
501          }                                        
502          else                                     
503          {                                        
504                                                   
505                                                   
506            G4bool absorption = false;             
507            if ( n == theSystem->GetTotalNumber    
508            if ( absorption )                      
509            {                                      
510               //G4cout << "Absorption happend     
511               i = i-1;                            
512               n = n-1;                            
513            }                                      
514                                                   
515 //          Collsion allowed (really happened)    
516                                                   
517             // Unset Projectile/Target flag       
518             theSystem->GetParticipant( i )->Un    
519             if ( !absorption ) theSystem->GetP    
520                                                   
521             theSystem->GetParticipant( i )->Se    
522             if ( !absorption ) theSystem->GetP    
523                                                   
524             theSystem->IncrementCollisionCount    
525                                                   
526 /*                                                
527             G4cout << "G4QMDRESULT Collsion Re    
528                       << i << " and " << j        
529                       << G4endl;                  
530             G4cout << "G4QMDRESULT Collsion in    
531                       << p4i << " " << p4j        
532                       << G4endl;                  
533             G4cout << "G4QMDRESULT Collsion af    
534                       << theSystem->GetPartici    
535                       << " "                      
536                       << theSystem->GetPartici    
537                       << G4endl;                  
538             G4cout << "G4QMDRESULT Collsion Di    
539                       << p4i + p4j - theSystem    
540                       << G4endl;                  
541             G4cout << "G4QMDRESULT Collsion in    
542                       << ri << " " << rj          
543                       << G4endl;                  
544             G4cout << "G4QMDRESULT Collsion af    
545                       << theSystem->GetPartici    
546                       << " "                      
547                       << theSystem->GetPartici    
548                       << G4endl;                  
549 */                                                
550                                                   
551                                                   
552          }                                        
553                                                   
554       }                                           
555                                                   
556    }                                              
557                                                   
558                                                   
559 }                                                 
560                                                   
561                                                   
562                                                   
563 G4bool G4LightIonQMDCollision::CalFinalStateOf    
564 {                                                 
565                                                   
566 //081103                                          
567    //G4cout << "CalFinalStateOfTheBinaryCollis    
568                                                   
569     G4int k = theSystem->GetTotalNumberOfParti    
570                                                   
571    G4bool result = false;                         
572    G4bool energyOK = false;                       
573    G4bool pauliOK = false;                        
574    G4bool abs = false;                            
575     G4bool pion_prod = false; // added by Y-H.    
576     //G4bool pion_abs = false; // added by Y-H    
577    G4QMDParticipant* absorbed = NULL;             
578                                                   
579    G4LorentzVector p4i = theSystem->GetPartici    
580    G4LorentzVector p4j = theSystem->GetPartici    
581                                                   
582 //071031                                          
583                                                   
584    //G4double epot = theMeanField->GetTotalPot    
585    //G4double eini = epot + p4i.e() + p4j.e();    
586     G4double eini = theMeanField->GetTotalEner    
587                                                   
588 //071031                                          
589    // will use KineticTrack                       
590    const G4ParticleDefinition* pdi0 =theSystem    
591    const G4ParticleDefinition* pdj0 =theSystem    
592    G4LorentzVector p4i0 = p4i*GeV;                
593    G4LorentzVector p4j0 = p4j*GeV;                
594    G4ThreeVector ri0 = ( theSystem->GetPartici    
595    G4ThreeVector rj0 = ( theSystem->GetPartici    
596                                                   
597    for ( G4int iitry = 0 ; iitry < 4 ; iitry++    
598    {                                              
599                                                   
600       abs = false;                                
601                                                   
602       G4KineticTrack kt1( pdi0 , 0.0 , ri0 , p    
603       G4KineticTrack kt2( pdj0 , 0.0 , rj0 , p    
604                                                   
605       G4LorentzVector p4ix_new;                   
606       G4LorentzVector p4jx_new;                   
607       G4LorentzVector p4kx_new(G4ThreeVector(0    
608       G4KineticTrackVector* secs = NULL;          
609       secs = theScatterer->Scatter( kt1 , kt2     
610                                                   
611       //std::cout << "G4QMDSCATTERER BEFORE "     
612       //std::cout << "G4QMDSCATTERER BEFORE "     
613       //std::cout << "THESCATTERER " << theSca    
614                                                   
615                                                   
616       if ( secs )                                 
617       {                                           
618          G4int iti = 0;                           
619          if (  secs->size() == 2 )                
620          {                                        
621             for ( G4KineticTrackVector::iterat    
622                 = secs->begin() ; it != secs->    
623             {                                     
624                if ( iti == 0 )                    
625                {                                  
626                   theSystem->GetParticipant( i    
627                   p4ix_new = (*it)->Get4Moment    
628                   //std::cout << "THESCATTERER    
629                   theSystem->GetParticipant( i    
630                }                                  
631                if ( iti == 1 )                    
632                {                                  
633                   //theSystem->GetParticipant(    
634                   //p4jx_new = (*it)->Get4Mome    
635                   //std::cout << "THESCATTERER    
636                   //theSystem->GetParticipant(    
637                                                   
638                    // added by Y-H. S and A.H.    
639                    if((*it)->GetDefinition()->    
640                    {                              
641                        G4KineticTrackVector *     
642                                                   
643                        G4int ita = 0;             
644                        for(G4KineticTrackVecto    
645                        {                          
646                            //G4cout << "decay     
647                                                   
648                            if(ita == 0)           
649                            {                      
650                                theSystem->SetP    
651                                //G4cout << "de    
652                                //theMeanField-    
653                                //G4cout << "de    
654                                theSystem->GetP    
655                                //theMeanField-    
656                                //G4cout << "de    
657                                p4kx_new = (*jt    
658                                theSystem->GetP    
659                                //theSystem->Sh    
660                                                   
661                            }                      
662                            else if(ita == 1)      
663                            {                      
664                                theSystem->GetP    
665                                p4jx_new = (*jt    
666                                theSystem->GetP    
667                                pion_prod = tru    
668                                //theMeanField-    
669                                //G4cout << "de    
670                                //theSystem->Sh    
671                                //exit(0);         
672                            }                      
673                            else                   
674                            {                      
675                                std::cout << "*    
676                            }                      
677                            ita ++;                
678                                                   
679                        }                          
680                        delete dec;                
681                                                   
682                        //std::cout << "THESCAT    
683                        //std::cout << "THESCAT    
684                        //std::cout << "THESCAT    
685                        //std::cout << "THESCAT    
686                        //std::cout << "THESCAT    
687                    }                              
688                    else                           
689                    {                              
690                        theSystem->GetParticipa    
691                        p4jx_new = (*it)->Get4M    
692                        //std::cout << "THESCAT    
693                        theSystem->GetParticipa    
694                    }                              
695                                                   
696                }                                  
697                //std::cout << "G4QMDSCATTERER     
698                iti++;                             
699             }                                     
700          }                                        
701          else if ( secs->size() == 1 )            
702          {                                        
703 //081118                                          
704              abs = true;                          
705              //G4cout << "G4LightIonQMDCollisi    
706                                                   
707               // added by Y-H. S and A.H.         
708               if(secs->front()->GetDefinition(    
709               {                                   
710                   G4KineticTrackVector * dec =    
711                   G4int ita = 0;                  
712                   for(G4KineticTrackVector::it    
713                   {                               
714                       //G4cout << "decay "<<(*    
715                       if(ita == 0)                
716                       {                           
717                           theSystem->GetPartic    
718                           p4ix_new = (*jter)->    
719                           theSystem->GetPartic    
720                       }                           
721                       else if(ita == 1)           
722                       {                           
723                           theSystem->GetPartic    
724                           p4jx_new = (*jter)->    
725                           theSystem->GetPartic    
726                           abs = false;            
727                           //pion_abs = true;      
728                       }                           
729                       else                        
730                       {                           
731                           std::cout << "******    
732                       }                           
733                       ita ++;                     
734                   }                               
735                   delete dec;                     
736               }                                   
737               else                                
738               {                                   
739                   theSystem->GetParticipant( i    
740                   p4ix_new = secs->front()->Ge    
741                   theSystem->GetParticipant( i    
742               }                                   
743               // added by Y-H. S and A.H. -- e    
744                                                   
745              //secs->front()->Decay();            
746               /*                                  
747              theSystem->GetParticipant( i )->S    
748              p4ix_new = secs->front()->Get4Mom    
749              theSystem->GetParticipant( i )->S    
750               */                                  
751               //std::cout << "THESCATTERER " <    
752               //std::cout << "THESCATTERER " <    
753               //exit(0);                          
754          }                                        
755                                                   
756 //081118                                          
757          if ( secs->size() > 2 )                  
758          {                                        
759                                                   
760             G4cout << "G4LightIonQMDCollision     
761                                                   
762             for ( G4KineticTrackVector::iterat    
763                 = secs->begin() ; it != secs->    
764             {                                     
765                G4cout << "G4QMDSCATTERER AFTER    
766             }                                     
767                                                   
768          }                                        
769                                                   
770          // deleteing KineticTrack                
771          for ( G4KineticTrackVector::iterator     
772                = secs->begin() ; it != secs->e    
773          {                                        
774             delete *it;                           
775          }                                        
776                                                   
777          delete secs;                             
778       }                                           
779 //071031                                          
780                                                   
781       if ( !abs )                                 
782       {                                           
783          //theMeanField->Cal2BodyQuantities( i    
784          //theMeanField->Cal2BodyQuantities( j    
785           theMeanField->Update();                 
786                                                   
787       }                                           
788       else                                        
789       {                                           
790          absorbed = theSystem->EraseParticipan    
791          theMeanField->Update();                  
792       }                                           
793                                                   
794       //epot = theMeanField->GetTotalPotential    
795       //G4double efin = epot + p4ix_new.e() +     
796        G4double efin = theMeanField->GetTotalE    
797       //std::cout << "Collision NEW epot " <<     
798                                                   
799 /*                                                
800       G4cout << "Collision efin " << i << " "     
801       G4cout << "Collision " << i << " " << j     
802       G4cout << "Collision " << std::abs ( ein    
803 */                                                
804                                                   
805 //071031                                          
806        //G4double fepse_change = fepse; // Add    
807        //if(pion_prod || pion_abs) fepse_chang    
808                                                   
809       if ( std::abs ( eini - efin ) < fepse )     
810       {                                           
811          // Collison OK                           
812          //std::cout << "collisions6" << std::    
813          //std::cout << "collisions before " <    
814          //std::cout << "collisions after " <<    
815          //std::cout << "collisions dif " << (    
816          //std::cout << "collisions before " <    
817          //std::cout << "collisions after " <<    
818                                                   
819          energyOK = true;                         
820          break;                                   
821       }                                           
822       else                                        
823       {                                           
824           //if(pion_prod || pion_abs) G4cout <    
825            //G4cout << "EnergyNotOK " << std::    
826            //if(iitry == 3) G4cout << "Energy     
827            /*                                     
828            if(std::abs ( eini - efin )*1000 >     
829            {                                      
830              //G4cout << "EnergyNotOK " << std    
831                G4cout << p4ix_new + p4jx_new <    
832                G4cout << p4ix_new.m() << " " <    
833             G4cout << "G4QMDRESULT Collsion Re    
834             << i << " and " << j                  
835             << G4endl;                            
836             G4cout << "G4QMDRESULT Collsion in    
837             << p4i << " " << p4j                  
838             << G4endl;                            
839             G4cout << "G4QMDRESULT Collsion af    
840             << theSystem->GetParticipant( i )-    
841             << " "                                
842             << theSystem->GetParticipant( j )-    
843             << G4endl;                            
844             G4cout << "G4QMDRESULT Collsion Di    
845             << p4i + p4j - theSystem->GetParti    
846             << G4endl;                            
847                G4cout << "G4QMDRESULT Particle    
848                << theSystem->GetParticipant( i    
849                << G4endl;                         
850             //G4cout << "G4QMDRESULT Collsion     
851             //<< ri << " " << rj                  
852             //<< G4endl;                          
853             //G4cout << "G4QMDRESULT Collsion     
854             //<< theSystem->GetParticipant( i     
855             //<< " "                              
856             //<< theSystem->GetParticipant( j     
857             //<< G4endl;                          
858            }                                      
859            */                                     
860                                                   
861          if ( abs )                               
862          {                                        
863             //G4cout << "TKDB reinsert j " <<     
864             theSystem->InsertParticipant( abso    
865             theMeanField->Update();               
866          }                                        
867          else if ( pion_prod ) // added by Y-H    
868           {                                       
869               //G4cout << "TKDB reinsert j " <    
870               theSystem->EraseParticipant( k )    
871               theMeanField->Update();             
872               theSystem->GetParticipant( i )->    
873               theSystem->GetParticipant( i )->    
874               theSystem->GetParticipant( j )->    
875               theSystem->GetParticipant( j )->    
876               theMeanField->Update();             
877               pion_prod = false;                  
878           }                                       
879          else                                     
880          {                                        
881              theSystem->GetParticipant( i )->S    
882              theSystem->GetParticipant( i )->S    
883                                                   
884              theSystem->GetParticipant( j )->S    
885              theSystem->GetParticipant( j )->S    
886              theMeanField->Update();              
887          }  // added by Y-H. S and A.H. -- end    
888          // do not need reinsert in no absropt    
889       }                                           
890 //071031                                          
891    }                                              
892                                                   
893 // Energetically forbidden collision              
894                                                   
895    if ( energyOK )                                
896    {                                              
897       // Pauli Check                              
898       //G4cout << "Pauli Checking " << theSyst    
899       if ( !abs )                                 
900       {                                           
901          if ( !( theMeanField->IsPauliBlocked     
902          {                                        
903             //G4cout << "Binary Collision Happ    
904             pauliOK = true;                       
905          }                                        
906       }                                           
907       else                                        
908       {                                           
909          //if ( theMeanField->IsPauliBlocked (    
910          //090126                            i    
911          if ( theMeanField->IsPauliBlocked ( i    
912          {                                        
913             //G4cout << "Absorption Happen " <    
914             delete absorbed;                      
915             pauliOK = true;                       
916          }                                        
917       }                                           
918                                                   
919                                                   
920       if ( pauliOK )                              
921       {                                           
922          result = true;                           
923       }                                           
924       else                                        
925       {                                           
926          //G4cout << "Pauli Blocked" << G4endl    
927          if ( abs )                               
928          {                                        
929             //G4cout << "TKDB reinsert j pauli    
930             theSystem->InsertParticipant( abso    
931             theMeanField->Update();               
932          }                                        
933          else if ( pion_prod ) // added by Y-H    
934          {                                        
935              //G4cout << "TKDB reinsert j " <<    
936              theSystem->EraseParticipant( k );    
937              theMeanField->Update();              
938              theSystem->GetParticipant( i )->S    
939              theSystem->GetParticipant( i )->S    
940              theSystem->GetParticipant( j )->S    
941              theSystem->GetParticipant( j )->S    
942              theMeanField->Update();              
943              pion_prod = false;                   
944          }                                        
945          else                                     
946          {                                        
947              theSystem->GetParticipant( i )->S    
948              theSystem->GetParticipant( i )->S    
949                                                   
950              theSystem->GetParticipant( j )->S    
951              theSystem->GetParticipant( j )->S    
952              theMeanField->Update();              
953          }  // added by Y-H. S and A.H. -- end    
954       }                                           
955    }                                              
956                                                   
957    return result;                                 
958                                                   
959 }                                                 
960                                                   
961                                                   
962                                                   
963 G4bool G4LightIonQMDCollision::CalFinalStateOf    
964 {                                                 
965                                                   
966    //G4cout << "CalFinalStateOfTheBinaryCollis    
967                                                   
968    G4bool result = true;                          
969                                                   
970    G4LorentzVector p4i =  theSystem->GetPartic    
971    G4double rmi =  theSystem->GetParticipant(     
972    G4int zi =  theSystem->GetParticipant( i )-    
973                                                   
974    G4LorentzVector p4j =  theSystem->GetPartic    
975    G4double rmj =  theSystem->GetParticipant(     
976    G4int zj =  theSystem->GetParticipant( j )-    
977                                                   
978    G4double pr = prcm;                            
979                                                   
980    G4double c2  = pcm.z()/pr;                     
981                                                   
982    G4double csrt = srt - cutoff;                  
983                                                   
984    //G4double pri = prcm;                         
985    //G4double prf = sqrt ( 0.25 * srt*srt -rm2    
986                                                   
987    G4double asrt = srt - rmi - rmj;               
988    G4double pra = prcm;                           
989                                                   
990                                                   
991                                                   
992    G4double elastic = 0.0;                        
993                                                   
994    if ( zi == zj )                                
995    {                                              
996       if ( csrt < 0.4286 )                        
997       {                                           
998          elastic = 35.0 / ( 1. + csrt * 100.0     
999       }                                           
1000       else                                       
1001       {                                          
1002          elastic = ( - std::atan( ( csrt - 0.    
1003                  *   2. / pi + 1.0 ) * 9.65 +    
1004       }                                          
1005    }                                             
1006    else                                          
1007    {                                             
1008       if ( csrt < 0.4286 )                       
1009       {                                          
1010          elastic = 28.0 / ( 1. + csrt * 100.0    
1011       }                                          
1012       else                                       
1013       {                                          
1014          elastic = ( - std::atan( ( csrt - 0.    
1015                  *   2. / pi + 1.0 ) * 12.34     
1016       }                                          
1017    }                                             
1018                                                  
1019 //   std::cout << "Collision csrt " << i << "    
1020 //   std::cout << "Collision elstic " << i <<    
1021                                                  
1022                                                  
1023 //   std::cout << "Collision sig " << i << "     
1024    if ( G4UniformRand() > elastic / sig )        
1025    {                                             
1026       //std::cout << "Inelastic " << std::end    
1027       //std::cout << "elastic/sig " << elasti    
1028       return result;                             
1029    }                                             
1030    else                                          
1031    {                                             
1032       //std::cout << "Elastic " << std::endl;    
1033    }                                             
1034 //   std::cout << "Collision ELSTIC " << i <<    
1035                                                  
1036                                                  
1037    G4double as = G4Pow::GetInstance()->powN (    
1038    G4double a = 6.0 * as / (1.0 + as);           
1039    G4double ta = -2.0 * pra*pra;                 
1040    G4double x = G4UniformRand();                 
1041    G4double t1 = G4Log( (1-x) * G4Exp(2.*a*ta    
1042    G4double c1 = 1.0 - t1/ta;                    
1043                                                  
1044    if( std::abs(c1) > 1.0 ) c1 = 2.0 * x - 1.    
1045                                                  
1046 /*                                               
1047    G4cout << "Collision as " << i << " " << j    
1048    G4cout << "Collision a " << i << " " << j     
1049    G4cout << "Collision ta " << i << " " << j    
1050    G4cout << "Collision x " << i << " " << j     
1051    G4cout << "Collision t1 " << i << " " << j    
1052    G4cout << "Collision c1 " << i << " " << j    
1053 */                                               
1054    t1 = 2.0*pi*G4UniformRand();                  
1055 //   std::cout << "Collision t1 " << i << " "    
1056    G4double t2 = 0.0;                            
1057    if ( pcm.x() == 0.0 && pcm.y() == 0 )         
1058    {                                             
1059       t2 = 0.0;                                  
1060    }                                             
1061    else                                          
1062    {                                             
1063       t2 = std::atan2( pcm.y() , pcm.x() );      
1064    }                                             
1065 //      std::cout << "Collision t2 " << i <<     
1066                                                  
1067    G4double s1 = std::sqrt ( 1.0 - c1*c1 );      
1068    G4double s2 = std::sqrt ( 1.0 - c2*c2 );      
1069                                                  
1070    G4double ct1 = std::cos(t1);                  
1071    G4double st1 = std::sin(t1);                  
1072                                                  
1073    G4double ct2 = std::cos(t2);                  
1074    G4double st2 = std::sin(t2);                  
1075                                                  
1076    G4double ss = c2*s1*ct1 + s2*c1;              
1077                                                  
1078    pcm.setX( pr * ( ss*ct2 - s1*st1*st2) );      
1079    pcm.setY( pr * ( ss*st2 + s1*st1*ct2) );      
1080    pcm.setZ( pr * ( c1*c2 - s1*s2*ct1) );        
1081                                                  
1082 // std::cout << "Collision pcm " << i << " "     
1083                                                  
1084    G4double epot = theMeanField->GetTotalPote    
1085                                                  
1086    G4double eini = epot + p4i.e() + p4j.e();     
1087    G4double etwo = p4i.e() + p4j.e();            
1088                                                  
1089 /*                                               
1090    G4cout << "Collision epot " << i << " " <<    
1091    G4cout << "Collision eini " << i << " " <<    
1092    G4cout << "Collision etwo " << i << " " <<    
1093 */                                               
1094                                                  
1095                                                  
1096    for ( G4int itry = 0 ; itry < 4 ; itry++ )    
1097    {                                             
1098                                                  
1099       G4double eicm = std::sqrt ( rmi*rmi + p    
1100       G4double pibeta = pcm*beta;                
1101                                                  
1102       G4double trans = gamma * ( gamma * pibe    
1103                                                  
1104       G4ThreeVector pi_new = beta*trans + pcm    
1105                                                  
1106       G4double ejcm = std::sqrt ( rmj*rmj + p    
1107       trans = gamma * ( gamma * pibeta / ( ga    
1108                                                  
1109       G4ThreeVector pj_new = beta*trans - pcm    
1110                                                  
1111 //                                               
1112 // Delete old                                    
1113 // Add new Particitipants                        
1114 //                                               
1115 // Now only change momentum ( Beacuse we only    
1116 // In future Definition also will be change      
1117 //                                               
1118                                                  
1119       theSystem->GetParticipant( i )->SetMome    
1120       theSystem->GetParticipant( j )->SetMome    
1121                                                  
1122       //G4double pi_new_e = (theSystem->GetPa    
1123       //G4double pj_new_e = (theSystem->GetPa    
1124                                                  
1125       theMeanField->Cal2BodyQuantities( i );     
1126       theMeanField->Cal2BodyQuantities( j );     
1127                                                  
1128       //epot = theMeanField->GetTotalPotentia    
1129       //G4double efin = epot + pi_new_e + pj_    
1130        G4double efin = theMeanField->GetTotal    
1131       //std::cout << "Collision NEW epot " <<    
1132 /*                                               
1133       G4cout << "Collision efin " << i << " "    
1134       G4cout << "Collision " << i << " " << j    
1135       G4cout << "Collision " << std::abs ( ei    
1136 */                                               
1137                                                  
1138 //071031                                         
1139       if ( std::abs ( eini - efin ) < fepse )    
1140       {                                          
1141    // Collison OK                                
1142          //std::cout << "collisions6" << std:    
1143          //std::cout << "collisions before "     
1144          //std::cout << "collisions after " <    
1145          //std::cout << "collisions dif " <<     
1146          //std::cout << "collisions before "     
1147          //std::cout << "collisions after " <    
1148       }                                          
1149 //071031                                         
1150                                                  
1151          if ( std::abs ( eini - efin ) < feps    
1152                                                  
1153          G4double cona = ( eini - efin + etwo    
1154          G4double fac2 = 1.0 / ( 4.0 * cona*c    
1155                        ( ( cona*cona - ( rmi*    
1156                        - 4.0 * rmi*rmi * rmj*    
1157                                                  
1158          if ( fac2 > 0 )                         
1159          {                                       
1160             G4double fact = std::sqrt ( fac2     
1161             pcm = fact*pcm;                      
1162          }                                       
1163                                                  
1164                                                  
1165    }                                             
1166                                                  
1167 // Energetically forbidden collision             
1168    result = false;                               
1169                                                  
1170    return result;                                
1171                                                  
1172 }                                                
1173