ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4UrQMD1_3Model.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4UrQMD1_3Model.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * *
21 // * Parts of this code which have been developed by Abdel-Waged *
22 // * et al under contract (31-465) to the King Abdul-Aziz City for *
23 // * Science and Technology (KACST), the National Centre of *
24 // * Mathematics and Physics (NCMP), Saudi Arabia. *
25 // * *
26 // * By using, copying, modifying or distributing the software (or *
27 // * any work based on the software) you agree to acknowledge its *
28 // * use in resulting scientific publications, and indicate your *
29 // * acceptance of all terms of the Geant4 Software license. *
30 // ********************************************************************
31 //
34 //
35 //
37 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 //
39 // MODULE: G4UrQMD1_3Model.hh
40 //
41 // Version: 0.B
42 // Date: 25/01/12
43 // Authors: Kh. Abdel-Waged and Nuha Felemban
44 // Revised by: V.V. Uzhinskii
45 // SPONSERED BY
46 // Customer: KAUST/NCMP
47 // Contract: 31-465
48 //
49 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 //
51 #ifdef G4_USE_URQMD
52 
53 #include "G4UrQMD1_3Model.hh"
54 #include "G4UrQMD1_3Interface.hh"
55 //-------------------------------
56 #include "globals.hh"
57 #include "G4DynamicParticle.hh"
58 #include "G4IonTable.hh"
59 #include "G4CollisionOutput.hh"
60 #include "G4V3DNucleus.hh"
61 #include "G4Track.hh"
62 #include "G4Nucleus.hh"
63 #include "G4LorentzRotation.hh"
64 
65 #include "G4ParticleDefinition.hh"
66 #include "G4ParticleTable.hh"
67 #include "G4PhysicalConstants.hh"
68 #include "G4SystemOfUnits.hh"
69 
70 //AND->
71 #include "G4Version.hh"
72 //AND<-
73 //----------------new_anti
74 #include "G4AntiHe3.hh"
75 #include "G4AntiDeuteron.hh"
76 #include "G4AntiTriton.hh"
77 #include "G4AntiAlpha.hh"
78 //---------------------------
79 #include <fstream>
80 #include <string>
81 
83 
84 //
86  :G4VIntraNuclearTransportModel(nam), verbose(0)
87 {
88 
89 
90  if (verbose > 3) {
91  G4cout << " >>> G4UrQMD1_3Model default constructor" << G4endl;
92  }
93 
94 
95 
96 //
97 // Set the minimum and maximum range for the UrQMD model
98 
99 // SetMinEnergy(100.0*MeV);
100 // SetMaxEnergy(200.0*GeV);
101 
102 //
103 
104 //
105  WelcomeMessage();
106 //
107  CurrentEvent=0;
108 //
109 
110 InitialiseDataTables();
111 
112 
113 //
114 }
116 //
117 // Destructor
118 //
121 
123  G4V3DNucleus* ) {
124  return 0;
125 }
126 
128 //
129 // ApplyYourself
130 //
131 // Member function to process an event, and get information about the products.
132 
133 
135  const G4HadProjectile &theTrack, G4Nucleus &theTarget)
136 {
137 //anti_new
138 // ------------------define anti_light_nucleus
139 const G4ParticleDefinition* anti_deu =
141 
142 const G4ParticleDefinition* anti_he3=
144 
145 const G4ParticleDefinition* anti_tri=
147 
148 const G4ParticleDefinition* anti_alp=
150 //---------------------------------------------------
151 //
152 // The secondaries will be returned in G4HadFinalState &theResult -
153 // initialise this. The original track will always be discontinued and
154 // secondaries followed.
155 //
156  theResult.Clear();
158 
159  G4DynamicParticle* cascadeParticle=0;
160 //
161 //
162 // Get relevant information about the projectile and target (A, Z, energy/nuc,
163 // momentum, etc).
164 //
165 
166 
167  const G4ParticleDefinition *definitionP = theTrack.GetDefinition();
168  const G4double AP = definitionP->GetBaryonNumber();
169  const G4double ZP = definitionP->GetPDGCharge();
170  G4double AT = theTarget.GetN();
171  G4double ZT = theTarget.GetZ();
172 // -----------------------------------------------
173  G4int id=definitionP->GetPDGEncoding(); //get particle encoding
174 // ------------------------------------------------
175  G4int AP1 = G4lrint(AP);
176  G4int ZP1 = G4lrint(ZP);
177  G4int AT1 = G4lrint(AT);
178  G4int ZT1 = G4lrint(ZT);
179 // G4cout<<"------ap1--=="<<AP1<<"---zp1---=="<<ZP1<<"---id-=="<<id<< G4endl;
180 //
181 // ****************************************************************************
182 // The following is the parameters necessary to initiate Uinit() and UrQMD()
183 // ----------------------------------------------------------------------------
185  urqmdparams_.u_spproj=1; // projectile is a special particle
186 
187 //new_anti
188 
189  if (AP1>1 ||definitionP==anti_deu ||definitionP==anti_he3
190  ||definitionP==anti_tri ||definitionP==anti_alp)
191  {
192 
193  urqmdparams_.u_ap=AP1;
194  urqmdparams_.u_zp=ZP1;
195 
197  } else if (id==2212) {
198  urqmdparams_.u_ap=1;
199  urqmdparams_.u_zp=1;
200 
201 
202  } else if(id==-2212){
203  urqmdparams_.u_ap=-1;
204  urqmdparams_.u_zp=-1;
205  } else if(id==2112){
206  urqmdparams_.u_ap=1;
207  urqmdparams_.u_zp=-1;
208 
209  } else if(id==-2112){
210  urqmdparams_.u_ap=-1;
211  urqmdparams_.u_zp=1;
212 
213  } else if(id==211) {
214  urqmdparams_.u_ap=101;
215  urqmdparams_.u_zp=2;
216  } else if(id==-211) {
217  urqmdparams_.u_ap=101;
218  urqmdparams_.u_zp=-2;
219  } else if(id==321) {
220  urqmdparams_.u_ap=106;
221  urqmdparams_.u_zp=1;
222  } else if(id==-321) {
223  urqmdparams_.u_ap=-106;
224  urqmdparams_.u_zp=-1;
225  } else if(id==130 || id==310) { // ! K0
226  urqmdparams_.u_ap=106;
227  urqmdparams_.u_zp=-1;
228  } else if(id==-130 || id==-310){ // ! K0bar
229  urqmdparams_.u_ap=-106;
230  urqmdparams_.u_zp=1;
231  } else {
232 
233  G4cout << " Sorry, No definition for particle for UrQMD::"
234  <<id<< "found" << G4endl;
235 
236  //AND->
237 #if G4VERSION_NUMBER>=950
238  //New signature (9.5) for G4Exception
239  //Using G4HadronicException
240  throw G4HadronicException(__FILE__,__LINE__,
241  "Sorry, no definition for particle for UrQMD");
242 #else
243  G4Exception(" ");
244 #endif
245  //AND<-
246  } //end if id
247 //-------------------------------------------------------
248 
249  urqmdparams_.u_at=AT1; // Target identified
250  urqmdparams_.u_zt=ZT1;
251 //----------------------------------------------------
252 // identify Energy
253 //
254  G4ThreeVector Pbefore = theTrack.Get4Momentum().vect();
255  G4double T = theTrack.GetKineticEnergy();
256  G4double E = theTrack.GetTotalEnergy();
257  G4double TotalEbefore = E*AP1 +
258  theTarget.AtomicMass(AT1, ZT1) + theTarget.GetEnergyDeposit();
259 // -----------------------------------------------------------------
260 
261  if (AP1>1) {
262  urqmdparams_.u_elab=T/(AP1*GeV); // Units are GeV/nuc for UrQMD
263 
264  E = E/AP1; // Units are GeV/nuc
265 
266  } else {
267 
268  urqmdparams_.u_elab=T/GeV; //units are GeV
269 
270  TotalEbefore = E +
271  theTarget.AtomicMass(AT1, ZT1) + theTarget.GetEnergyDeposit();
272  }
273 
274 
275 //------------------------------------------------------------
276 // identify impact parameter
277  urqmdparams_.u_imp=-(1.1 * std::pow(G4double(AT1),(1./3.)));
278  //units are in fm for UrQMD;
279 //------------------------------------------------------------
281 
282 if (CurrentEvent==0)
283 {
284 G4cout << "\n creation of table, wait-------"<<G4endl;
285 
286 G4cout << "\n"<<G4endl;
287 
288 G4int io=0;
289 
290 uinit_ (&io);
291 
292 
293 G4cout << "\n end to create table "<<G4endl;
294 
295 CurrentEvent=1;
296 }
298 
299 //#ifdef debug_G4UrQMD1_3Model
300 
301 G4cout <<"UrQMDModel running-------------" <<G4endl;
302 
303 urqmd_ ();
304 
305 //#endif
306 
307 //G4cout <<"Number of produced particles: " <<sys_.npart<<G4endl;
308 
309 G4int n = sys_.npart; //no of produced particles
310 if (n<2)
311 {
312 G4cout <<"===============Warning================"<<G4endl;
313 G4cout <<"======================================"<<G4endl;
314 
315 G4cout <<"Number of produced particles is very low: " <<sys_.npart<<G4endl;
316 G4cout <<"============================================"<<G4endl;
317 
318 //AND->
319 #if G4VERSION_NUMBER>=950
320 //New signature (9.5) for G4Exception
321 //Using G4HadronicException instead of base class
322 throw G4HadronicException(__FILE__,__LINE__,
323  "Number of produced particle is very low");
324 #else
325 G4Exception(" "); //stop
326 #endif
327 //AND<-
328 } else {
329  for (G4int i=0; i<n; i++)
330  {
331 
332 
333 G4int pid=pdgid_ (&isys_.ityp[i], &isys_.iso3[i]);
334 
335 // Particle is a final state secondary and not a nucleus.
336 // Determine what this secondary particle is, and if valid, load dynamic
337 // parameters.
338 //
339 
340 
343 
344  if (pd)
345  {
346  G4double px = (coor_.px[i]+ffermi_.ffermpx[i])* GeV;
347  //units are in MeV/c for G4
348  G4double py = (coor_.py[i]+ffermi_.ffermpy[i])* GeV;
349  G4double pz = (coor_.pz[i]+ffermi_.ffermpz[i])* GeV;
350 
351  G4double et = (coor_.p0[i]) *GeV;
352 
353 
354 // ------------------------------Use only "Lorentz vector"----------
355 
356  G4LorentzVector lorenzvec = G4LorentzVector(px,py,pz,et);
357 
358  cascadeParticle = new G4DynamicParticle(pd, lorenzvec); //
359 
360  theResult.AddSecondary(cascadeParticle);
361 
362 //======================================================================
363 
364 
365 
366  } //if
367 } //for
368 
369 } //if warning
370 
371 //=======================================================================
372 if (verbose >= 3) {
373 
374 //
375  G4double TotalEafter = 0.0;
376  G4ThreeVector TotalPafter;
377  G4double charge = 0.0;
378  G4int baryon = 0;
379  G4int nSecondaries = theResult.GetNumberOfSecondaries();
380 
381  for (G4int j=0; j<nSecondaries; j++) {
382  TotalEafter += theResult.GetSecondary(j)->
383  GetParticle()->GetTotalEnergy();
384 
385  TotalPafter += theResult.GetSecondary(j)->
386  GetParticle()->GetMomentum();
387 
389  GetParticle()->GetDefinition();
390 
391  charge += pd->GetPDGCharge();
392  baryon += pd->GetBaryonNumber();
393 
394  } //for secondaries
395 
396  G4cout <<"----------------------------------------"
397  <<"----------------------------------------"
398  <<G4endl;
399  G4cout <<"Total energy before collision = " <<TotalEbefore
400  <<" MeV" <<G4endl;
401  G4cout <<"Total energy after collision = " <<TotalEafter //MeV
402  <<" MeV" <<G4endl;
403 
404  G4cout <<"----------------------------------------"<<G4endl;
405 
406  G4cout <<"Total momentum before collision = " <<Pbefore //MeV
407  <<" MeV/c" <<G4endl;
408  G4cout <<"Total momentum after collision = " <<TotalPafter //MeV
409  <<" MeV/c" <<G4endl;
410  G4cout <<"----------------------------------------"<<G4endl;
411 
412  if (verbose >= 4) {
413  G4cout <<"Total charge before collision = " <<(ZP+ZT)*eplus
414  <<G4endl;
415  G4cout <<"Total charge after collision = " <<charge
416  <<G4endl;
417 
418  G4cout <<"----------------------------------------"<<G4endl;
419 
420  G4cout <<"Total baryon number before collision = "<<AP+AT
421  <<G4endl;
422  G4cout <<"Total baryon number after collision = "<<baryon
423  <<G4endl;
424  G4cout <<"----------------------------------------"<<G4endl;
425 
426  } //if verbose4
427 
428  G4cout <<"----------------------------------------"
429  <<"----------------------------------------"
430  <<G4endl;
431 
432  } //if verbose3
433 
434 
435 return &theResult;
436 } //G4hadfinal
437 
438 
439 //---------------------------------------------------------------------
440 
441 //---------------------------------------------------------------------
442 //
443 // WelcomeMessage
444 //
446 {
447  G4cout <<G4endl;
448  G4cout <<" *****************************************************************"
449  <<G4endl;
450  G4cout <<" Interface to G4UrQMD_1.3 activated"
451  <<G4endl;
452  G4cout <<" Version number : 00.00.0B File date : 25/01/12" <<G4endl;
453  G4cout <<" (Interface written by Kh. Abdel-Waged et al. for the KACST/NCMP)"
454  <<G4endl;
455  G4cout <<G4endl;
456  G4cout <<" *****************************************************************"
457  <<G4endl;
458  G4cout << G4endl;
459 
460  return;
461 }
462 
464 {
465 //
466 //
467 // The next line is to make sure the block data statements are
468 // executed.
469 //
470 
472 
473 
476 //G4int ranseed=-time_ ();
477 // Fixed seed ///////////////////////////
478 
479 G4int ranseed=1097569630;
480 
481 G4cout <<"\n seed: "<<ranseed<<G4endl;
482 
483 sseed_ (&ranseed);
484 
485 loginit_();
486 
487 }
488 
489 #endif //G4_USE_URQMD