File indexing completed on 2026-09-17 08:31:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 #include "G4HIJING_Model.hh"
0041 #ifdef G4_USE_HIJING
0042 # include "G4HIJING_Interface.hh"
0043
0044 # include "G4CollisionOutput.hh"
0045 # include "G4DynamicParticle.hh"
0046 # include "G4IonTable.hh"
0047 # include "G4LorentzRotation.hh"
0048 # include "G4Nucleus.hh"
0049 # include "G4ParticleDefinition.hh"
0050 # include "G4ParticleTable.hh"
0051 # include "G4Track.hh"
0052 # include "G4V3DNucleus.hh"
0053 # include "globals.hh"
0054
0055
0056 # include "G4Version.hh"
0057
0058
0059 # include "G4AntiAlpha.hh"
0060 # include "G4AntiDeuteron.hh"
0061 # include "G4AntiHe3.hh"
0062 # include "G4AntiTriton.hh"
0063
0064 # include "HistoManager.hh" //newkhaled
0065
0066 # include "G4SystemOfUnits.hh"
0067
0068 # include <fstream>
0069 # include <string>
0070
0071
0072
0073
0074 G4HIJING_Model::G4HIJING_Model(const G4String& nam) : G4VIntraNuclearTransportModel(nam), verbose(0)
0075 {
0076 if (verbose > 3) {
0077 G4cout << " >>> G4HIJING_Model default constructor" << G4endl;
0078 }
0079
0080 # ifdef G4ANALYSIS_USE
0081 fHistoManager = HistoManager::GetPointer();
0082 # endif
0083
0084
0085
0086
0087 SetMinEnergy(4.0 * GeV);
0088
0089
0090
0091
0092
0093 WelcomeMessage();
0094
0095 CurrentEvent = 0;
0096
0097
0098
0099 InitialiseDataTables();
0100
0101
0102 }
0103
0104
0105
0106
0107
0108 G4HIJING_Model::~G4HIJING_Model() {}
0109
0110
0111 G4ReactionProductVector* G4HIJING_Model::Propagate(G4KineticTrackVector*, G4V3DNucleus*)
0112 {
0113 return 0;
0114 }
0115
0116
0117
0118
0119
0120
0121
0122
0123 G4HadFinalState* G4HIJING_Model::ApplyYourself(const G4HadProjectile& theTrack,
0124 G4Nucleus& theTarget)
0125 {
0126 G4cout << "HERE I AM" << G4endl;
0127
0128
0129 const G4ParticleDefinition* anti_deu = G4AntiDeuteron::AntiDeuteron();
0130
0131 const G4ParticleDefinition* anti_he3 = G4AntiHe3::AntiHe3();
0132
0133 const G4ParticleDefinition* anti_tri = G4AntiTriton::AntiTriton();
0134
0135 const G4ParticleDefinition* anti_alp = G4AntiAlpha::AntiAlpha();
0136
0137
0138
0139
0140
0141
0142
0143 theResult.Clear();
0144 theResult.SetStatusChange(stopAndKill);
0145
0146 G4DynamicParticle* cascadeParticle = 0;
0147
0148
0149
0150
0151
0152
0153 const G4ParticleDefinition* definitionP = theTrack.GetDefinition();
0154 const G4double AP = definitionP->GetBaryonNumber();
0155 const G4double ZP = definitionP->GetPDGCharge();
0156 G4int AT = theTarget.GetN_asInt();
0157 G4int ZT = theTarget.GetZ_asInt();
0158
0159 G4int id = definitionP->GetPDGEncoding();
0160
0161
0162
0163 G4int AP1 = G4lrint(AP);
0164 G4int ZP1 = G4lrint(ZP);
0165 G4int AT1 = AT;
0166 G4int ZT1 = ZT;
0167
0168
0169
0170
0171
0172
0173
0174
0175 hiparnt_.ihnt2[1] = ZP1;
0176 hiparnt_.ihnt2[2] = AT1;
0177 hiparnt_.ihnt2[3] = ZT1;
0178 hiparnt_.ihnt2[5] = 0;
0179
0180 if (AP1 > 1 || definitionP == anti_deu || definitionP == anti_he3 || definitionP == anti_tri
0181 || definitionP == anti_alp)
0182
0183 {
0184 hiparnt_.ihnt2[0] = AP1;
0185 hiparnt_.ihnt2[4] = 0;
0186 }
0187 else if (id == 2212) {
0188
0189 hiparnt_.ihnt2[0] = 1;
0190 hiparnt_.ihnt2[4] = 2212;
0191 }
0192 else if (id == -2212) {
0193
0194 hiparnt_.ihnt2[0] = 1;
0195 hiparnt_.ihnt2[4] = -2212;
0196 }
0197 else if (id == 2112) {
0198
0199 hiparnt_.ihnt2[0] = 1;
0200 hiparnt_.ihnt2[4] = 2112;
0201 }
0202 else if (id == -2112) {
0203
0204 hiparnt_.ihnt2[0] = 1;
0205 hiparnt_.ihnt2[4] = -2112;
0206 }
0207 else if (id == 211) {
0208 hiparnt_.ihnt2[0] = 1;
0209 hiparnt_.ihnt2[4] = 211;
0210 }
0211 else if (id == -211) {
0212
0213 hiparnt_.ihnt2[0] = 1;
0214 hiparnt_.ihnt2[4] = -211;
0215 }
0216 else if (id == 321) {
0217
0218 hiparnt_.ihnt2[0] = 1;
0219 hiparnt_.ihnt2[4] = 321;
0220 }
0221 else if (id == -321) {
0222
0223 hiparnt_.ihnt2[0] = 1;
0224 hiparnt_.ihnt2[4] = -321;
0225 }
0226 else {
0227 G4cout << " Sorry, No definition for PROJECTLE for HIJING::" << id << "found" << G4endl;
0228
0229
0230 # if G4VERSION_NUMBER >= 950
0231
0232
0233 throw G4HadronicException(__FILE__, __LINE__, "Sorry, no definition for PROJECTILE for HIJING");
0234 # else
0235 G4Exception(" ");
0236 # endif
0237
0238 }
0239
0240
0241
0242
0243 G4int id_n = 2112;
0244 G4int id_p = 2212;
0245
0246 hiparnt_.hint1[7] = std::max(ulmass_(&id_n), ulmass_(&id_p));
0247
0248 hiparnt_.hint1[8] = hiparnt_.hint1[7];
0249
0250 if (hiparnt_.ihnt2[4] != 0) hiparnt_.hint1[7] = ulmass_(&hiparnt_.ihnt2[4]);
0251
0252
0253
0254
0255
0256
0257 G4double m = hiparnt_.hint1[7];
0258
0259 G4ThreeVector P3 = theTrack.Get4Momentum().vect() / GeV;
0260
0261
0262 G4double Pbeam = P3.z();
0263
0264
0265 G4double Ebeam = Eplab(m, Pbeam);
0266
0267
0268
0269
0270
0271
0272
0273
0274 G4LorentzVector lab = G4LorentzVector(0.0, 0.0, -1.0 * Pbeam, Ebeam + m);
0275
0276 G4double TotalPbefore = -1.0 * lab.z();
0277
0278
0279 G4double TotalEbefore = lab.e();
0280
0281
0282
0283
0284
0285
0286 G4LorentzVector cms = G4LorentzVector(0.0, 0.0, 0.0, lab.mag());
0287
0288
0289
0290 G4LorentzVector Psum = (lab + cms);
0291 G4double beta_rel = Psum.beta();
0292
0293
0294
0295
0296 Psum.boost(0.0, 0.0, -1.0 * beta_rel);
0297
0298
0299 G4double betann = Psum.beta();
0300
0301
0302
0303
0304
0305 G4double Ecms = lab.mag();
0306 efrm = Ecms;
0307
0308
0309
0310 if (CurrentEvent == 0) {
0311 G4cout << "\n initialise HIJING, wait-------" << G4endl;
0312
0313 G4cout << "\n" << G4endl;
0314
0315
0316
0317 hijset_(&efrm);
0318
0319 G4cout << "\n end initialize " << G4endl;
0320
0321 CurrentEvent = 1;
0322 }
0323
0324
0325
0326 bmin = 0.0;
0327
0328
0329 bmax = hiparnt_.hipr1[33] + hiparnt_.hipr1[34];
0330
0331
0332
0333 do {
0334 G4cout << "HIJING_Model running-------------" << G4endl;
0335
0336 hijing_(&bmin, &bmax);
0337
0338 Nproduce = himain1_.natt;
0339
0340 if (Nproduce < 2) {
0341 G4cout << "===============Warning=====================================" << G4endl;
0342 G4cout << "-----------------------------------------------------------" << G4endl;
0343 G4cout << "Number of produced particles is very low: " << himain1_.natt << G4endl;
0344 G4cout << "------------------------------------------------------------" << G4endl;
0345 G4cout << "============================================================" << G4endl;
0346 }
0347 } while (Nproduce < 2);
0348
0349
0350 G4double BB = hiparnt_.hint1[18];
0351
0352
0353 for (G4int i = 0; i < Nproduce; i++) {
0354 G4int pid = himain2_.katt[0][i];
0355
0356
0357
0358
0359
0360
0361
0362 G4ParticleDefinition* pd = G4ParticleTable::GetParticleTable()->FindParticle(pid);
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372 if (pd) {
0373
0374
0375 G4double px = himain2_.patt[0][i] * GeV;
0376 G4double py = himain2_.patt[1][i] * GeV;
0377 G4double pz = himain2_.patt[2][i] * GeV;
0378 G4double et = himain2_.patt[3][i] * GeV;
0379
0380
0381 G4LorentzVector lorenzCM = G4LorentzVector(px, py, pz, et);
0382
0383 lorenzCM.boost(0.0, 0.0, -1.0 * betann);
0384 G4LorentzVector lorenzLab =
0385 G4LorentzVector(lorenzCM.px(), lorenzCM.py(), -1.0 * lorenzCM.pz(), lorenzCM.e());
0386
0387 cascadeParticle = new G4DynamicParticle(pd, lorenzLab);
0388
0389 theResult.AddSecondary(cascadeParticle);
0390
0391 }
0392
0393 }
0394
0395 # ifdef G4ANALYSIS_USE
0396 fHistoManager->StoreSecondaries(BB, theResult);
0397 # endif
0398
0399
0400
0401
0402
0403 if (verbose >= 3) {
0404
0405 G4double TotalEafter = 0.0;
0406 G4ThreeVector TotalPafter;
0407 G4double charge = 0.0;
0408 G4int baryon = 0;
0409 G4int nSecondaries = theResult.GetNumberOfSecondaries();
0410
0411 for (G4int j = 0; j < nSecondaries; j++) {
0412 TotalEafter += theResult.GetSecondary(j)->GetParticle()->GetTotalEnergy() / GeV;
0413
0414 TotalPafter += theResult.GetSecondary(j)->GetParticle()->GetMomentum() / GeV;
0415
0416 G4ParticleDefinition* pd = theResult.GetSecondary(j)->GetParticle()->GetDefinition();
0417
0418 charge += pd->GetPDGCharge();
0419 baryon += pd->GetBaryonNumber();
0420
0421 }
0422
0423 G4cout << "----------------------------------------"
0424 << "----------------------------------------" << G4endl;
0425 G4cout << "Total energy before collision = " << TotalEbefore
0426 << " GeV" << G4endl;
0427 G4cout << "Total energy after collision = "
0428 << TotalEafter / nSecondaries
0429
0430 << " GeV" << G4endl;
0431
0432 G4cout << "----------------------------------------" << G4endl;
0433
0434 G4cout << "Total momentum before collision = "
0435 << TotalPbefore
0436
0437 << " GeV/c" << G4endl;
0438 G4cout << "Total momentum after collision = "
0439 << TotalPafter.z() / nSecondaries
0440
0441 << " GeV/c" << G4endl;
0442 G4cout << "----------------------------------------" << G4endl;
0443
0444 if (verbose >= 4) {
0445 G4cout << "Total charge before collision = " << (ZP + ZT)
0446 << G4endl;
0447 G4cout << "Total charge after collision = " << charge << G4endl;
0448
0449 G4cout << "----------------------------------------" << G4endl;
0450
0451 G4cout << "Total baryon number before collision = " << AP + AT << G4endl;
0452 G4cout << "Total baryon number after collision = " << baryon << G4endl;
0453 G4cout << "----------------------------------------" << G4endl;
0454
0455 }
0456
0457 G4cout << "----------------------------------------"
0458 << "----------------------------------------" << G4endl;
0459
0460 }
0461
0462 return &theResult;
0463 }
0464
0465
0466
0467
0468
0469
0470
0471
0472 void G4HIJING_Model::WelcomeMessage() const
0473 {
0474 G4cout << G4endl;
0475 G4cout << " *****************************************************************" << G4endl;
0476 G4cout << " Interface to G4HIJING_Model activated" << G4endl;
0477 G4cout << " Version number : 01.00.0B File date : 10/09/2013" << G4endl;
0478 G4cout << " Interface written by Khaled Abdel-Waged " << G4endl;
0479 G4cout << " Umm Al-Qura University " << G4endl;
0480 G4cout << " SAUDI ARABIA " << G4endl;
0481 G4cout << G4endl;
0482 G4cout << " *****************************************************************" << G4endl;
0483 G4cout << G4endl;
0484 return;
0485 }
0486
0487
0488 void G4HIJING_Model::InitialiseDataTables()
0489 {
0490
0491
0492
0493
0494
0495
0496 g4hijingblockdata_();
0497 }
0498
0499 G4double G4HIJING_Model::Eplab(G4double m, G4double P)
0500 {
0501 G4double Eb = std::sqrt(P * P + m * m);
0502 return Eb;
0503 }
0504 #endif