from Ruediger
[u/mrichter/AliRoot.git] / THijing / THijing.cxx
CommitLineData
3010c308 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
7dffa423 18////////////////////////////////////////////////////////////////////////////////
19// //
20// THijing //
21// //
22// THijing is an interface class to F77 version of Hijing 1.36 //
23// event generator, written by X.N. Wang and M. Gyulassy. //
24// For details see http://nta2.lbl.gov/~xnwang //
25// //
26// ************************************************** //
27// * | _______ / ------/ * //
28// * ----- ------ |_____| /_/ / * //
29// * || / |_____| / / * //
30// * /| /_/ /_______ /_ / _ * //
31// * / | / / / / / | ------- * //
32// * | / / / / | / | * //
33// * | / / / / _| / ------- * //
34// * * //
35// ************************************************** //
36// HIJING //
37// Heavy Ion Jet INteraction Generator //
38// by //
39// X. N. Wang and M. Gyulassy //
40// Lawrence Berkeley Laboratory //
41//****************************************************************************//
42
c627bfa0 43
3010c308 44#include <TClonesArray.h>
45#include <TObjArray.h>
46#include <TParticle.h>
47#include <TROOT.h>
48
7dffa423 49#include "Hcommon.h"
3010c308 50#include "THijing.h"
7dffa423 51
52#ifndef WIN32
53# define hijset hijset_
54# define hijing hijing_
ce5a1dbd 55# define profile profile_
10074e0d 56# define rluget_hijing rluget_hijing_
57# define rluset_hijing rluset_hijing_
0f07b55b 58# define lulist_hijing lulist_hijing_
7dffa423 59# define type_of_call
60#else
61# define hijset HIJSET
62# define hijing HIJING
ce5a1dbd 63# define profile PROFILE
6b759e67 64# define rluget_hijing RLUGET_HIJING
65# define rluset_hijing RLUSET_HIJING
0f07b55b 66# define lulist_hijing LULIST_HIJING
7dffa423 67# define type_of_call _stdcall
68#endif
69
70#ifndef WIN32
7dffa423 71extern "C" void type_of_call hijset(Float_t & , const char *,
72 const char *, const char *,
73 Int_t & , Int_t &, Int_t &,
74 Int_t &, const int,
75 const int, const int);
ce5a1dbd 76extern "C" float type_of_call profile(Float_t &);
ce5a1dbd 77extern "C" void type_of_call hijing(const char *, Float_t &,
7dffa423 78 Float_t &, const int);
6b759e67 79extern "C" void type_of_call rluget_hijing(Int_t & lfn, Int_t & move);
80
81extern "C" void type_of_call rluset_hijing(Int_t & lfn, Int_t & move);
0f07b55b 82extern "C" void type_of_call lulist_hijing(Int_t &);
6b759e67 83
7dffa423 84#else
7dffa423 85#endif
86
ce5a1dbd 87
88
7dffa423 89ClassImp(THijing)
90
9d89c88d 91
92THijing::THijing():
93 TGenerator("Hijing","Hijing"),
94 fEfrm(5500.),
95 fFrame("CMS"),
96 fProj("A"),
97 fTarg("A"),
98 fIap(208),
99 fIzp(82),
100 fIat(208),
101 fIzt(82),
102 fBmin(0.),
103 fBmax(5.)
7dffa423 104{
c627bfa0 105// Default constructor
7dffa423 106}
107
108//______________________________________________________________________________
109THijing::THijing(Float_t efrm, const char *frame="CMS",
9d89c88d 110 const char *proj="A", const char *targ="A",
111 Int_t iap=207, Int_t izp=82, Int_t iat=207, Int_t izt=82,
112 Float_t bmin=0, Float_t bmax=20):
113 TGenerator("Hijing","Hijing"),
114 fEfrm(efrm),
115 fFrame(frame),
116 fProj(proj),
117 fTarg(targ),
118 fIap(iap),
119 fIzp(izp),
120 fIat(iat),
121 fIzt(izt),
122 fBmin(bmin),
123 fBmax(bmax)
7dffa423 124{
c627bfa0 125// THijing constructor:
126// Note that there may be only one functional THijing object
7dffa423 127// at a time, so it's not use to create more than one instance of it.
7dffa423 128}
129
130//______________________________________________________________________________
131THijing::~THijing()
132{
c627bfa0 133// Destructor
7dffa423 134}
135
7dffa423 136
dd63ae11 137TObjArray* THijing::ImportParticles(Option_t *option)
138{
139//
140// Default primary creation method. It reads the /HEPEVT/ common block which
141// has been filled by the GenerateEvent method. If the event generator does
142// not use the HEPEVT common block, This routine has to be overloaded by
143// the subclasses.
144// The function loops on the generated particles and store them in
145// the TClonesArray pointed by the argument particles.
146// The default action is to store only the stable particles (ISTHEP = 1)
147// This can be demanded explicitly by setting the option = "Final"
148// If the option = "All", all the particles are stored.
149//
150 fParticles->Clear();
151 Int_t numpart = HIMAIN1.natt;
152 printf("\n THijing: HIJING stack contains %d particles.", numpart);
153 printf("\n THijing: Total energy: %f ", HIMAIN1.eatt);
154 printf("\n THijing: Number of hard scatterings: %d ", HIMAIN1.jatt);
155 Int_t nump = 0;
156 if (!strcmp(option,"") || !strcmp(option,"Final")) {
157 for (Int_t i = 0; i < numpart; i++) {
158
159 if (HIMAIN2.katt[3][i] == 1) {
160//
161// Use the common block values for the TParticle constructor
162//
163 nump++;
164 TParticle* p = new TParticle(
ebae626c 165 HIMAIN2.katt[0][i], HIMAIN2.katt[3][i] ,
dd63ae11 166 -1, -1, -1, -1,
167 HIMAIN2.patt[0][i], HIMAIN2.patt[1][i], HIMAIN2.patt[2][i], HIMAIN2.patt[3][i] ,
168 HIMAIN2.vatt[0][i], HIMAIN2.vatt[1][i], HIMAIN2.vatt[2][i], HIMAIN2.vatt[3][i]
169 );
ebae626c 170 p->SetUniqueID(HIMAIN2.katt[1][i]);
dd63ae11 171 fParticles->Add(p);
172 }
173 }
174 }
175 else if (!strcmp(option,"All")) {
176 nump = numpart;
177 for (Int_t i = 0; i < numpart; i++) {
178
179 Int_t iParent = HIMAIN2.katt[2][i]-1;
180
181 if (iParent >= 0) {
182 TParticle *mother = (TParticle*) (fParticles->UncheckedAt(iParent));
183 mother->SetLastDaughter(i);
184 if (mother->GetFirstDaughter()==-1)
185 mother->SetFirstDaughter(i);
186 }
187
188 TParticle* p = new TParticle(
ebae626c 189 HIMAIN2.katt[0][i], HIMAIN2.katt[3][i], iParent,
dd63ae11 190 -1, -1, -1,
191 HIMAIN2.patt[0][i], HIMAIN2.patt[1][i], HIMAIN2.patt[2][i], HIMAIN2.patt[3][i] ,
192 HIMAIN2.vatt[0][i], HIMAIN2.vatt[1][i], HIMAIN2.vatt[2][i], HIMAIN2.vatt[3][i]
193 );
ebae626c 194 p->SetUniqueID(HIMAIN2.katt[1][i]);
dd63ae11 195 fParticles->Add(p);
196 }
197 }
198 return fParticles;
199}
7dffa423 200
7dffa423 201Int_t THijing::ImportParticles(TClonesArray *particles, Option_t *option)
202{
203//
204// Default primary creation method. It reads the /HEPEVT/ common block which
205// has been filled by the GenerateEvent method. If the event generator does
206// not use the HEPEVT common block, This routine has to be overloaded by
207// the subclasses.
208// The function loops on the generated particles and store them in
209// the TClonesArray pointed by the argument particles.
210// The default action is to store only the stable particles (ISTHEP = 1)
211// This can be demanded explicitly by setting the option = "Final"
212// If the option = "All", all the particles are stored.
213//
214 if (particles == 0) return 0;
c627bfa0 215 TClonesArray &particlesR = *particles;
216 particlesR.Clear();
7dffa423 217 Int_t numpart = HIMAIN1.natt;
835a6822 218 printf("\n THijing: HIJING stack contains %d particles.", numpart);
219 printf("\n THijing: Total energy: %f ", HIMAIN1.eatt);
220 printf("\n THijing: Number of hard scatterings: %d ", HIMAIN1.jatt);
92903f9d 221 Int_t nump = 0;
7dffa423 222 if (!strcmp(option,"") || !strcmp(option,"Final")) {
41bb41a6 223 for (Int_t i = 0; i < numpart; i++) {
ce5a1dbd 224
225 if (HIMAIN2.katt[3][i] == 1) {
7dffa423 226//
227// Use the common block values for the TParticle constructor
228//
92903f9d 229 nump++;
c627bfa0 230 new(particlesR[i]) TParticle(
ce5a1dbd 231 HIMAIN2.katt[0][i] ,
ebae626c 232 HIMAIN2.katt[3][i] ,
92903f9d 233 -1 ,
ce5a1dbd 234 -1,
235 -1,
236 -1,
237
238 HIMAIN2.patt[0][i] ,
239 HIMAIN2.patt[1][i] ,
240 HIMAIN2.patt[2][i] ,
241 HIMAIN2.patt[3][i] ,
af615bc3 242
243 HIMAIN2.vatt[0][i] ,
244 HIMAIN2.vatt[1][i] ,
245 HIMAIN2.vatt[2][i] ,
246 HIMAIN2.vatt[3][i]
247 );
ebae626c 248 particlesR[i]->SetUniqueID(HIMAIN2.katt[1][i]);
ce5a1dbd 249 }
250 }
7dffa423 251 }
252 else if (!strcmp(option,"All")) {
c627bfa0 253 nump = numpart;
41bb41a6 254 for (Int_t i = 0; i < numpart; i++) {
ce5a1dbd 255
256 Int_t iParent = HIMAIN2.katt[2][i]-1;
257
258 if (iParent >= 0) {
c627bfa0 259 TParticle *mother = (TParticle*) (particlesR.UncheckedAt(iParent));
ce5a1dbd 260 mother->SetLastDaughter(i);
261 if (mother->GetFirstDaughter()==-1)
262 mother->SetFirstDaughter(i);
263 }
264
c627bfa0 265 new(particlesR[i]) TParticle(
ce5a1dbd 266 HIMAIN2.katt[0][i] ,
ebae626c 267 HIMAIN2.katt[3][i] ,
ce5a1dbd 268 iParent,
269 -1,
270 -1,
271 -1,
272
273 HIMAIN2.patt[0][i] ,
274 HIMAIN2.patt[1][i] ,
275 HIMAIN2.patt[2][i] ,
276 HIMAIN2.patt[3][i] ,
277
af615bc3 278 HIMAIN2.vatt[0][i] ,
279 HIMAIN2.vatt[1][i] ,
280 HIMAIN2.vatt[2][i] ,
281 HIMAIN2.vatt[3][i]
282 );
ebae626c 283 particlesR[i]->SetUniqueID(HIMAIN2.katt[1][i]);
ce5a1dbd 284 }
7dffa423 285 }
92903f9d 286 return nump;
7dffa423 287}
288
289//______________________________________________________________________________
290void THijing::SetEFRM(Float_t efrm)
291{
c627bfa0 292// Set the centre of mass (CMS) or lab-energy (LAB)
7dffa423 293 fEfrm=efrm;
294}
295//______________________________________________________________________________
296void THijing::SetFRAME(const char* frame)
297{
c627bfa0 298// Set the frame type ("CMS" or "LAB")
7dffa423 299 fFrame=frame;
300}
301//______________________________________________________________________________
302void THijing::SetPROJ(const char* proj)
303{
c627bfa0 304// Set the projectile type
7dffa423 305 fProj=proj;
306}
307//______________________________________________________________________________
308void THijing::SetTARG(const char* targ)
309{
c627bfa0 310// Set the target type
7dffa423 311 fTarg=targ;
312}
313//______________________________________________________________________________
314void THijing::SetIAP(Int_t iap)
315{
c627bfa0 316// Set the projectile atomic number
7dffa423 317 fIap=iap;
318}
319//______________________________________________________________________________
320void THijing::SetIZP(Int_t izp)
321{
c627bfa0 322// Set the projectile charge number
7dffa423 323 fIzp=izp;
324}
325//______________________________________________________________________________
326void THijing::SetIAT(Int_t iat)
327{
c627bfa0 328// Set the target atomic number
7dffa423 329 fIat=iat;
330}
331//______________________________________________________________________________
332void THijing::SetIZT(Int_t izt)
333{
c627bfa0 334// Set the target charge number
7dffa423 335 fIzt=izt;
336}
337//______________________________________________________________________________
338void THijing::SetBMIN(Float_t bmin)
339{
c627bfa0 340// Set the minimum impact parameter
7dffa423 341 fBmin=bmin;
342}
343//______________________________________________________________________________
344void THijing::SetBMAX(Float_t bmax)
345{
c627bfa0 346// Set the maximum impact parameter
7dffa423 347 fBmax=bmax;
348}
349//______________________________________________________________________________
350Float_t THijing::GetEFRM() const
351{
c627bfa0 352// Get the centre of mass (CMS) or lab-energy (LAB)
7dffa423 353 return fEfrm;
354}
355//______________________________________________________________________________
356const char* THijing::GetFRAME() const
357{
c627bfa0 358// Get the frame type ("CMS" or "LAB")
7dffa423 359 return fFrame.Data();
360}
361//______________________________________________________________________________
362const char* THijing::GetPROJ() const
363{
c627bfa0 364// Get the projectile type
7dffa423 365 return fProj;
366}
367//______________________________________________________________________________
368const char* THijing::GetTARG() const
369{
c627bfa0 370// Set the target type
7dffa423 371 return fTarg;
372}
373//______________________________________________________________________________
374Int_t THijing::GetIAP() const
375{
c627bfa0 376// Get the projectile atomic number
7dffa423 377 return fIap;
378}
379//______________________________________________________________________________
380Int_t THijing::GetIZP() const
381{
c627bfa0 382// Get the projectile charge number
7dffa423 383 return fIzp;
384}
385//______________________________________________________________________________
386Int_t THijing::GetIAT() const
387{
c627bfa0 388// Get the target atomic number
7dffa423 389 return fIat;
390}
391//______________________________________________________________________________
392Int_t THijing::GetIZT() const
393{
c627bfa0 394// Get the target charge number
7dffa423 395 return fIzt;
396}
397//______________________________________________________________________________
398Float_t THijing::GetBMIN() const
399{
c627bfa0 400// Get the minimum impact parameter
7dffa423 401 return fBmin;
402}
403//______________________________________________________________________________
404Float_t THijing::GetBMAX() const
405{
c627bfa0 406// Get the maximum impact parameter
7dffa423 407 return fBmax;
408}
409
410//====================== access to common HIPARNT ===============================
411
412//______________________________________________________________________________
413void THijing::SetHIPR1(Int_t key,Float_t value)
414{
c627bfa0 415// Set the values of array HIPR1 in common HIPARNT
7dffa423 416 if ( key<1 || key>100 ) {
417 printf ("ERROR in THijing:SetHIPR1(key,value): \n ");
418 printf (" key=%i is out of range [1..100]!\n",key);
419 return;
420 }
421
422 HIPARNT.hipr1[key-1]=value;
423
424}
425
426//______________________________________________________________________________
427Float_t THijing::GetHIPR1(Int_t key) const
428{
c627bfa0 429// Get the values of array HIPR1 in common HIPARNT
7dffa423 430 if ( key<1 || key>100 ) {
431 printf ("ERROR in THijing:GetHIPR1(key): \n ");
432 printf (" key=%i is out of range [1..100]!\n",key);
433 return 0;
434 }
435
436 return HIPARNT.hipr1[key-1];
437
438}
439
440//______________________________________________________________________________
441void THijing::SetIHPR2(Int_t key,Int_t value)
442{
c627bfa0 443// Set the values of array HIPR2 in common HIPARNT
7dffa423 444 if ( key<1 || key>50 ) {
445 printf ("ERROR in THijing:SetIHPR2(key,value): \n ");
446 printf (" key=%i is out of range [1..50]!\n",key);
447 return;
448 }
449
450 HIPARNT.ihpr2[key-1]=value;
451
452}
453
454//______________________________________________________________________________
455Int_t THijing::GetIHPR2(Int_t key) const
456{
c627bfa0 457// Get the values of array HIPR2 in common HIPARNT
7dffa423 458 if ( key<1 || key>50 ) {
459 printf ("ERROR in THijing:GetIHPR2(key): \n ");
460 printf (" key=%i is out of range [1..50]!\n",key);
461 return 0;
462 }
463
464 return HIPARNT.ihpr2[key-1];
465
466}
467
468
469//______________________________________________________________________________
470Float_t THijing::GetHINT1(Int_t key) const
471{
c627bfa0 472// Get the values of array HINT1 in common HIPARNT
7dffa423 473 if ( key<1 || key>100 ) {
474 printf ("ERROR in THijing:GetHINT1(key): \n ");
475 printf (" key=%i is out of range [1..100]!\n",key);
476 return 0;
477 }
478
479 return HIPARNT.hint1[key-1];
480
481}
482
483
484//______________________________________________________________________________
485Int_t THijing::GetIHNT2(Int_t key) const
486{
c627bfa0 487// Get the values of array HINT2 in common HIPARNT
7dffa423 488 if ( key<1 || key>50 ) {
489 printf ("ERROR in THijing:GetIHNT2(key): \n ");
490 printf (" key=%i is out of range [1..50]!\n",key);
491 return 0;
492 }
493
494 return HIPARNT.ihnt2[key-1];
495
496}
497
498
499//====================== access to common HIMAIN1 ===============================
500
501//______________________________________________________________________________
502Int_t THijing::GetNATT() const
503{
c627bfa0 504// Get the number of particles produces
7dffa423 505 return HIMAIN1.natt;
506
507}
508
369eeebb 509Int_t THijing::GetNPART() const
510{
511// Get true number of participants
512 return HIMAIN1.npart;
513
514}
515
7dffa423 516//______________________________________________________________________________
517Float_t THijing::GetEATT() const
518{
c627bfa0 519// Get total energy of particles
7dffa423 520
521 return HIMAIN1.eatt;
522
523}
524
525//______________________________________________________________________________
526Int_t THijing::GetJATT() const
527{
c627bfa0 528// Get number of hard scatterings
7dffa423 529
530 return HIMAIN1.jatt;
531
532}
533
534//______________________________________________________________________________
535Int_t THijing::GetNT() const
536{
c627bfa0 537// Get number of target participants
7dffa423 538
539 return HIMAIN1.nt;
540
541}
542
543//______________________________________________________________________________
544Int_t THijing::GetNP() const
545{
c627bfa0 546// Get number of projectile participants
7dffa423 547 return HIMAIN1.np;
548
549}
550
551
552//______________________________________________________________________________
553Int_t THijing::GetN0() const
554{
c627bfa0 555// Get number of N-N collisions
7dffa423 556 return HIMAIN1.n0;
557
558}
559//______________________________________________________________________________
560Int_t THijing::GetN01() const
561{
c627bfa0 562// Get number of N-wounded collisions
7dffa423 563
564 return HIMAIN1.n01;
565
566}
567
568//______________________________________________________________________________
569Int_t THijing::GetN10() const
570{
c627bfa0 571// Get number of wounded-N collisions
7dffa423 572
573 return HIMAIN1.n10;
574
575}
576
577//______________________________________________________________________________
578Int_t THijing::GetN11() const
579{
c627bfa0 580// Get number of wounded-wounded collisions
7dffa423 581
582 return HIMAIN1.n11;
583
584}
585
586//______________________________________________________________________________
587Float_t THijing::GetBB() const
588{
c627bfa0 589// Get impact parameter
7dffa423 590
591 return HIMAIN1.bb;
592
593}
594
595//====================== access to common HIMAIN2 ===============================
596
597//______________________________________________________________________________
598Int_t THijing::GetKATT(Int_t key1, Int_t key2) const
599{
c627bfa0 600// Get values of array KATT in common HIMAIN2
835a6822 601 if ( key1<1 || key1>200000 ) {
7dffa423 602 printf("ERROR in THijing::GetKATT(key1,key2):\n");
835a6822 603 printf(" key1=%i is out of range [1..200000]\n",key1);
7dffa423 604 return 0;
605 }
606
607 if ( key2<1 || key2>4 ) {
608 printf("ERROR in THijing::GetKATT(key1,key2):\n");
609 printf(" key2=%i is out of range [1..4]\n",key2);
610 return 0;
611 }
612
613 return HIMAIN2.katt[key2-1][key1-1];
614}
615
616//______________________________________________________________________________
617Float_t THijing::GetPATT(Int_t key1, Int_t key2) const
618{
c627bfa0 619// Get values of array PATT in common HIMAIN2
af615bc3 620 if ( key1<1 || key1>200000 ) {
7dffa423 621 printf("ERROR in THijing::GetPATT(key1,key2):\n");
622 printf(" key1=%i is out of range [1..130000]\n",key1);
623 return 0;
624 }
625
626 if ( key2<1 || key2>4 ) {
627 printf("ERROR in THijing::GetPATT(key1,key2):\n");
628 printf(" key2=%i is out of range [1..4]\n",key2);
629 return 0;
630 }
631
632 return HIMAIN2.patt[key2-1][key1-1];
633}
634
af615bc3 635Float_t THijing::GetVATT(Int_t key1, Int_t key2) const
636{
c627bfa0 637// Get values of array VATT in common HIMAIN2
af615bc3 638 if ( key1<1 || key1>200000 ) {
639 printf("ERROR in THijing::GetVATT(key1,key2):\n");
640 printf(" key1=%i is out of range [1..130000]\n",key1);
641 return 0;
642 }
643
644 if ( key2<1 || key2>4 ) {
645 printf("ERROR in THijing::GetVATT(key1,key2):\n");
646 printf(" key2=%i is out of range [1..4]\n",key2);
647 return 0;
648 }
649
650 return HIMAIN2.vatt[key2-1][key1-1];
651}
652
7dffa423 653//====================== access to common HIJJET1 ===============================
654
655//______________________________________________________________________________
656Int_t THijing::GetNPJ(Int_t key) const
657{
c627bfa0 658// Get values of array NPJ of common HIJJET1
7dffa423 659 if ( key<1 || key>300 ) {
660 printf("ERROR in THijing::GetNPJ(key):\n");
661 printf(" key=%i is out of range [1..300]\n",key);
662 return 0;
663 }
664 return HIJJET1.npj[key-1];
665}
666
667//______________________________________________________________________________
668Int_t THijing::GetKFPJ(Int_t key1, Int_t key2) const
669{
c627bfa0 670// Get values of array KFPJ in common HIJJET1
7dffa423 671 if ( key1<1 || key1>300 ) {
672 printf("ERROR in THijing::GetKFPJ(key1):\n");
673 printf(" key1=%i is out of range [1..300]\n",key1);
674 return 0;
675 }
676 if ( key2<1 || key2>500 ) {
677 printf("ERROR in THijing::GetKFPJ(key1,key2):\n");
678 printf(" key2=%i is out of range [1..500]\n",key2);
679 return 0;
680 }
681
682 return HIJJET1.kfpj[key2-1][key1-1];
683}
684
685//______________________________________________________________________________
686Float_t THijing::GetPJPX(Int_t key1, Int_t key2) const
687{
c627bfa0 688// Get values of array PJPX in common HIJJET1
7dffa423 689 if ( key1<1 || key1>300 ) {
690 printf("ERROR in THijing::GetPJPX(key1):\n");
691 printf(" key1=%i is out of range [1..300]\n",key1);
692 return 0;
693 }
694 if ( key2<1 || key2>500 ) {
695 printf("ERROR in THijing::GetPJPX(key1,key2):\n");
696 printf(" key2=%i is out of range [1..500]\n",key2);
697 return 0;
698 }
699
700 return HIJJET1.pjpx[key2-1][key1-1];
701}
702
703//______________________________________________________________________________
704Float_t THijing::GetPJPY(Int_t key1, Int_t key2) const
705{
c627bfa0 706// Get values of array PJPY in common HIJJET1
7dffa423 707 if ( key1<1 || key1>300 ) {
708 printf("ERROR in THijing::GetPJPY(key1):\n");
709 printf(" key1=%i is out of range [1..300]\n",key1);
710 return 0;
711 }
712 if ( key2<1 || key2>500 ) {
713 printf("ERROR in THijing::GetPJPY(key1,key2):\n");
714 printf(" key2=%i is out of range [1..500]\n",key2);
715 return 0;
716 }
717
718 return HIJJET1.pjpy[key2-1][key1-1];
719}
720
721//______________________________________________________________________________
722Float_t THijing::GetPJPZ(Int_t key1, Int_t key2) const
723{
c627bfa0 724// Get values of array PJPZ in common HIJJET1
7dffa423 725 if ( key1<1 || key1>300 ) {
726 printf("ERROR in THijing::GetPJPZ(key1):\n");
727 printf(" key1=%i is out of range [1..300]\n",key1);
728 return 0;
729 }
730 if ( key2<1 || key2>500 ) {
731 printf("ERROR in THijing::GetPJPZ(key1,key2):\n");
732 printf(" key2=%i is out of range [1..500]\n",key2);
733 return 0;
734 }
735
736 return HIJJET1.pjpz[key2-1][key1-1];
737}
738
739//______________________________________________________________________________
740Float_t THijing::GetPJPE(Int_t key1, Int_t key2) const
741{
c627bfa0 742// Get values of array PJPE in common HIJJET1
7dffa423 743 if ( key1<1 || key1>300 ) {
744 printf("ERROR in THijing::GetPJPE(key1):\n");
745 printf(" key1=%i is out of range [1..300]\n",key1);
746 return 0;
747 }
748 if ( key2<1 || key2>500 ) {
749 printf("ERROR in THijing::GetPJPE(key1,key2):\n");
750 printf(" key2=%i is out of range [1..500]\n",key2);
751 return 0;
752 }
753
754 return HIJJET1.pjpe[key2-1][key1-1];
755}
756
757//______________________________________________________________________________
758Float_t THijing::GetPJPM(Int_t key1, Int_t key2) const
759{
c627bfa0 760// Get values of array PJPM in common HIJJET1
7dffa423 761 if ( key1<1 || key1>300 ) {
762 printf("ERROR in THijing::GetPJPM(key1):\n");
763 printf(" key1=%i is out of range [1..300]\n",key1);
764 return 0;
765 }
766 if ( key2<1 || key2>500 ) {
767 printf("ERROR in THijing::GetPJPM(key1,key2):\n");
768 printf(" key2=%i is out of range [1..500]\n",key2);
769 return 0;
770 }
771
772 return HIJJET1.pjpm[key2-1][key1-1];
773}
774
775//______________________________________________________________________________
776Int_t THijing::GetNTJ(Int_t key) const
777{
c627bfa0 778// Get values of array NTJ in common HIJJET1
7dffa423 779 if ( key<1 || key>300 ) {
780 printf("ERROR in THijing::GetNTJ(key):\n");
781 printf(" key=%i is out of range [1..300]\n",key);
782 return 0;
783 }
784 return HIJJET1.ntj[key-1];
785}
786
787//______________________________________________________________________________
788Int_t THijing::GetKFTJ(Int_t key1, Int_t key2) const
789{
c627bfa0 790// Get values of array KFTJ in common HIJJET1
7dffa423 791 if ( key1<1 || key1>300 ) {
792 printf("ERROR in THijing::GetKFTJ(key1):\n");
793 printf(" key1=%i is out of range [1..300]\n",key1);
794 return 0;
795 }
796 if ( key2<1 || key2>500 ) {
797 printf("ERROR in THijing::GetKFTJ(key1,key2):\n");
798 printf(" key2=%i is out of range [1..500]\n",key2);
799 return 0;
800 }
801
802 return HIJJET1.kftj[key2-1][key1-1];
803}
804
805//______________________________________________________________________________
806Float_t THijing::GetPJTX(Int_t key1, Int_t key2) const
807{
c627bfa0 808// Get values of array PJTX in common HIJJET1
7dffa423 809 if ( key1<1 || key1>300 ) {
810 printf("ERROR in THijing::GetPJTX(key1):\n");
811 printf(" key1=%i is out of range [1..300]\n",key1);
812 return 0;
813 }
814 if ( key2<1 || key2>500 ) {
815 printf("ERROR in THijing::GetPJTX(key1,key2):\n");
816 printf(" key2=%i is out of range [1..500]\n",key2);
817 return 0;
818 }
819
820 return HIJJET1.pjtx[key2-1][key1-1];
821}
822
823//______________________________________________________________________________
824Float_t THijing::GetPJTY(Int_t key1, Int_t key2) const
825{
c627bfa0 826// Get values of array PJTY in common HIJJET1
7dffa423 827 if ( key1<1 || key1>300 ) {
828 printf("ERROR in THijing::GetPJTY(key1):\n");
829 printf(" key1=%i is out of range [1..300]\n",key1);
830 return 0;
831 }
832 if ( key2<1 || key2>500 ) {
833 printf("ERROR in THijing::GetPJTY(key1,key2):\n");
834 printf(" key2=%i is out of range [1..500]\n",key2);
835 return 0;
836 }
837
838 return HIJJET1.pjty[key2-1][key1-1];
839}
840
841//______________________________________________________________________________
842Float_t THijing::GetPJTZ(Int_t key1, Int_t key2) const
843{
c627bfa0 844// Get values of array PJTZ in common HIJJET1
7dffa423 845 if ( key1<1 || key1>300 ) {
846 printf("ERROR in THijing::GetPJTZ(key1):\n");
847 printf(" key1=%i is out of range [1..300]\n",key1);
848 return 0;
849 }
850 if ( key2<1 || key2>500 ) {
851 printf("ERROR in THijing::GetPJTZ(key1,key2):\n");
852 printf(" key2=%i is out of range [1..500]\n",key2);
853 return 0;
854 }
855
856 return HIJJET1.pjtz[key2-1][key1-1];
857}
858
859//______________________________________________________________________________
860Float_t THijing::GetPJTE(Int_t key1, Int_t key2) const
861{
c627bfa0 862// Get values of array PJTE in common HIJJET1
7dffa423 863 if ( key1<1 || key1>300 ) {
864 printf("ERROR in THijing::GetPJTE(key1):\n");
865 printf(" key1=%i is out of range [1..300]\n",key1);
866 return 0;
867 }
868 if ( key2<1 || key2>500 ) {
869 printf("ERROR in THijing::GetPJTE(key1,key2):\n");
870 printf(" key2=%i is out of range [1..500]\n",key2);
871 return 0;
872 }
873
874 return HIJJET1.pjte[key2-1][key1-1];
875}
876
877//______________________________________________________________________________
878Float_t THijing::GetPJTM(Int_t key1, Int_t key2) const
879{
c627bfa0 880// Get values of array PJTM in common HIJJET1
7dffa423 881 if ( key1<1 || key1>300 ) {
882 printf("ERROR in THijing::GetPJTM(key1):\n");
883 printf(" key1=%i is out of range [1..300]\n",key1);
884 return 0;
885 }
886 if ( key2<1 || key2>500 ) {
887 printf("ERROR in THijing::GetPJTM(key1,key2):\n");
888 printf(" key2=%i is out of range [1..500]\n",key2);
889 return 0;
890 }
891
892 return HIJJET1.pjtm[key2-1][key1-1];
893}
894
895//====================== access to common HIJJET1 ===============================
896
897//______________________________________________________________________________
898Int_t THijing::GetNSG() const
899{
c627bfa0 900// Get value of NSG in common HIJJET2
7dffa423 901 return HIJJET2.nsg;
902}
903
904//______________________________________________________________________________
905Int_t THijing::GetNJSG(Int_t key) const
906{
c627bfa0 907// Get values of array NJSG in common HIJJET2
7dffa423 908 if ( key<1 || key>900 ) {
909 printf ("ERROR in THijing:GetNJSG(key): \n ");
910 printf (" key=%i is out of range [1..900]!\n",key);
911 return 0;
912 }
913
914 return HIJJET2.njsg[key-1];
915
916}
917
918//______________________________________________________________________________
919Int_t THijing::GetIASG(Int_t key1, Int_t key2) const
920{
c627bfa0 921// Get values of IASG in common HIJJET2
7dffa423 922 if ( key1<1 || key1>900 ) {
923 printf("ERROR in THijing::GetIASG(key1):\n");
924 printf(" key1=%i is out of range [1..900]\n",key1);
925 return 0;
926 }
927 if ( key2<1 || key2>3 ) {
928 printf("ERROR in THijing::GetIASG(key1,key2):\n");
929 printf(" key2=%i is out of range [1..3]\n",key2);
930 return 0;
931 }
932
933 return HIJJET2.iasg[key2-1][key1-1];
934}
935
936//______________________________________________________________________________
937Int_t THijing::GetK1SG(Int_t key1, Int_t key2) const
938{
c627bfa0 939// Get values of K1SG in common HIJJET2
7dffa423 940 if ( key1<1 || key1>900 ) {
941 printf("ERROR in THijing::GetK1SG(key1):\n");
942 printf(" key1=%i is out of range [1..900]\n",key1);
943 return 0;
944 }
945 if ( key2<1 || key2>100 ) {
946 printf("ERROR in THijing::GetK1SG(key1,key2):\n");
947 printf(" key2=%i is out of range [1..100]\n",key2);
948 return 0;
949 }
950
951 return HIJJET2.k1sg[key2-1][key1-1];
952}
953
954//______________________________________________________________________________
955Int_t THijing::GetK2SG(Int_t key1, Int_t key2) const
956{
c627bfa0 957// Get values of K2SG in common HIJJET2
7dffa423 958 if ( key1<1 || key1>900 ) {
959 printf("ERROR in THijing::GetK2SG(key1):\n");
960 printf(" key1=%i is out of range [1..900]\n",key1);
961 return 0;
962 }
963 if ( key2<1 || key2>100 ) {
964 printf("ERROR in THijing::GetK2SG(key1,key2):\n");
965 printf(" key2=%i is out of range [1..100]\n",key2);
966 return 0;
967 }
968
969 return HIJJET2.k2sg[key2-1][key1-1];
970}
971
972//______________________________________________________________________________
973Float_t THijing::GetPXSG(Int_t key1, Int_t key2) const
974{
c627bfa0 975// Get values of PXSG in common HIJJET2
7dffa423 976 if ( key1<1 || key1>900 ) {
977 printf("ERROR in THijing::GetPXSG(key1):\n");
978 printf(" key1=%i is out of range [1..900]\n",key1);
979 return 0;
980 }
981 if ( key2<1 || key2>100 ) {
982 printf("ERROR in THijing::GetPXSG(key1,key2):\n");
983 printf(" key2=%i is out of range [1..100]\n",key2);
984 return 0;
985 }
986
987 return HIJJET2.pxsg[key2-1][key1-1];
988}
989
990//______________________________________________________________________________
991Float_t THijing::GetPYSG(Int_t key1, Int_t key2) const
992{
c627bfa0 993// Get values of PYSG in common HIJJET2
7dffa423 994 if ( key1<1 || key1>900 ) {
995 printf("ERROR in THijing::GetPYSG(key1):\n");
996 printf(" key1=%i is out of range [1..900]\n",key1);
997 return 0;
998 }
999 if ( key2<1 || key2>100 ) {
1000 printf("ERROR in THijing::GetPYSG(key1,key2):\n");
1001 printf(" key2=%i is out of range [1..100]\n",key2);
1002 return 0;
1003 }
1004
1005 return HIJJET2.pysg[key2-1][key1-1];
1006}
1007
1008//______________________________________________________________________________
1009Float_t THijing::GetPZSG(Int_t key1, Int_t key2) const
1010{
c627bfa0 1011// Get values of PZSG in common HIJJET2
7dffa423 1012 if ( key1<1 || key1>900 ) {
1013 printf("ERROR in THijing::GetPZSG(key1):\n");
1014 printf(" key1=%i is out of range [1..900]\n",key1);
1015 return 0;
1016 }
1017 if ( key2<1 || key2>100 ) {
1018 printf("ERROR in THijing::GetPZSG(key1,key2):\n");
1019 printf(" key2=%i is out of range [1..100]\n",key2);
1020 return 0;
1021 }
1022
1023 return HIJJET2.pzsg[key2-1][key1-1];
1024}
1025
1026//______________________________________________________________________________
1027Float_t THijing::GetPESG(Int_t key1, Int_t key2) const
1028{
c627bfa0 1029// Get values of PESG in common HIJJET2
7dffa423 1030 if ( key1<1 || key1>900 ) {
1031 printf("ERROR in THijing::GetPESG(key1):\n");
1032 printf(" key1=%i is out of range [1..900]\n",key1);
1033 return 0;
1034 }
1035 if ( key2<1 || key2>100 ) {
1036 printf("ERROR in THijing::GetPESG(key1,key2):\n");
1037 printf(" key2=%i is out of range [1..100]\n",key2);
1038 return 0;
1039 }
1040
1041 return HIJJET2.pesg[key2-1][key1-1];
1042}
1043
1044//______________________________________________________________________________
1045Float_t THijing::GetPMSG(Int_t key1, Int_t key2) const
1046{
c627bfa0 1047// Get values of PMSG in common HIJJET2
7dffa423 1048 if ( key1<1 || key1>900 ) {
1049 printf("ERROR in THijing::GetPMSG(key1):\n");
1050 printf(" key1=%i is out of range [1..900]\n",key1);
1051 return 0;
1052 }
1053 if ( key2<1 || key2>100 ) {
1054 printf("ERROR in THijing::GetPMSG(key1,key2):\n");
1055 printf(" key2=%i is out of range [1..100]\n",key2);
1056 return 0;
1057 }
1058
1059 return HIJJET2.pmsg[key2-1][key1-1];
1060}
1061
1062//====================== access to common HISTRNG ===============================
1063
1064//______________________________________________________________________________
1065Int_t THijing::GetNFP(Int_t key1, Int_t key2) const
1066{
c627bfa0 1067// Get values of array NFP in common HISTRNG
7dffa423 1068 if ( key1<1 || key1>300 ) {
1069 printf("ERROR in THijing::GetNFP(key1):\n");
1070 printf(" key1=%i is out of range [1..300]\n",key1);
1071 return 0;
1072 }
1073 if ( key2<1 || key2>15 ) {
1074 printf("ERROR in THijing::GetNFP(key1,key2):\n");
1075 printf(" key2=%i is out of range [1..15]\n",key2);
1076 return 0;
1077 }
1078
1079 return HISTRNG.nfp[key2-1][key1-1];
1080}
1081
1082//______________________________________________________________________________
1083Float_t THijing::GetPP(Int_t key1, Int_t key2) const
1084{
c627bfa0 1085// Get values of array PP in common HISTRNG
7dffa423 1086 if ( key1<1 || key1>300 ) {
1087 printf("ERROR in THijing::GetPP(key1):\n");
1088 printf(" key1=%i is out of range [1..300]\n",key1);
1089 return 0;
1090 }
1091 if ( key2<1 || key2>15 ) {
1092 printf("ERROR in THijing::GetPP(key1,key2):\n");
1093 printf(" key2=%i is out of range [1..15]\n",key2);
1094 return 0;
1095 }
1096
1097 return HISTRNG.pp[key2-1][key1-1];
1098}
1099
1100//______________________________________________________________________________
1101Int_t THijing::GetNFT(Int_t key1, Int_t key2) const
1102{
c627bfa0 1103// Get values of array NFT in common HISTRNG
7dffa423 1104 if ( key1<1 || key1>300 ) {
1105 printf("ERROR in THijing::GetNFT(key1):\n");
1106 printf(" key1=%i is out of range [1..300]\n",key1);
1107 return 0;
1108 }
1109 if ( key2<1 || key2>15 ) {
1110 printf("ERROR in THijing::GetNFT(key1,key2):\n");
1111 printf(" key2=%i is out of range [1..15]\n",key2);
1112 return 0;
1113 }
1114
1115 return HISTRNG.nft[key2-1][key1-1];
1116}
1117
1118//______________________________________________________________________________
1119Float_t THijing::GetPT(Int_t key1, Int_t key2) const
1120{
c627bfa0 1121// Get values of array PT in common HISTRNG
7dffa423 1122 if ( key1<1 || key1>300 ) {
1123 printf("ERROR in THijing::GetPT(key1):\n");
1124 printf(" key1=%i is out of range [1..300]\n",key1);
1125 return 0;
1126 }
1127 if ( key2<1 || key2>15 ) {
1128 printf("ERROR in THijing::GetPT(key1,key2):\n");
1129 printf(" key2=%i is out of range [1..15]\n",key2);
1130 return 0;
1131 }
1132
1133 return HISTRNG.pt[key2-1][key1-1];
1134}
1135
c9080d26 1136void THijing::SetPARJ(Int_t key, Float_t parm)
1137{
c627bfa0 1138// Set values of array PARJ in common HISTRNG
c9080d26 1139 if ( key < 1 || key > 200) {
1140 printf("ERROR in THijing::SetPARJ(key,parm):\n");
1141 printf(" key=%i is out of range [1..200]\n",key);
8f64c44f 1142 } else {
1143 LUDAT1_HIJING.parj[key-1] = parm;
c9080d26 1144 }
c9080d26 1145}
1146
1147
1148void THijing::SetMSTJ(Int_t key, Int_t parm)
1149{
c627bfa0 1150// Set values of array MSTJ in common HISTRNG
c9080d26 1151 if ( key < 1 || key > 200) {
1152 printf("ERROR in THijing::SetMSTJ(key,parm):\n");
1153 printf(" key=%i is out of range [1..200]\n",key);
8f64c44f 1154 } else {
1155 LUDAT1_HIJING.mstj[key-1] = parm;
c9080d26 1156 }
c9080d26 1157}
7dffa423 1158
0f07b55b 1159void THijing::SetMDCY(Int_t key1, Int_t key2, Int_t parm)
1160{
1161 // Set value of array MDCY
1162 if ( key1 < 1 || key1 > 500) {
1163 printf("ERROR in THijing::SetMDCY(key1, key2, parm):\n");
e9b09fa2 1164 printf(" key1=%i is out of range [1..500]\n", key1);
0f07b55b 1165 } else if ( key2 < 1 || key2 > 3) {
1166 printf("ERROR in THijing::SetMDCY(key1, key2, parm):\n");
e9b09fa2 1167 printf(" key2=%i is out of range [1..3]\n", key2);
0f07b55b 1168 } else {
1169 LUDAT3_HIJING.mdcy[key2-1][key1-1] = parm;
1170 }
1171
1172}
1173
e9b09fa2 1174void THijing::SetMDME(Int_t key1, Int_t key2, Int_t parm)
1175{
1176 // Set value of array MDME
1177 if ( key1 < 1 || key1 > 2000) {
1178 printf("ERROR in THijing::SetMDME(key1, key2, parm):\n");
1179 printf(" key1=%i is out of range [1..2000]\n", key1);
cba9ef30 1180 } else if ( key2 < 1 || key2 > 2) {
e9b09fa2 1181 printf("ERROR in THijing::SetMDME(key1, key2, parm):\n");
1182 printf(" key2=%i is out of range [1..3]\n", key2);
1183 } else {
1184 LUDAT3_HIJING.mdme[key2-1][key1-1] = parm;
1185 }
1186
1187}
1188
0f07b55b 1189Int_t THijing::GetMDCY(Int_t key1, Int_t key2)
1190{
1191 // Get value of array MDCY
e9b09fa2 1192
0f07b55b 1193 if ( key1 < 1 || key1 > 500) {
1194 printf("ERROR in THijing::GetMDCY(key1, key2, parm):\n");
1195 printf(" key1=%i is out of range [1..200]\n", key1);
1196 return -1;
1197 } else if ( key2 < 1 || key2 > 3) {
1198 printf("ERROR in THijing::GetMDCY(key1, key2, parm):\n");
1199 printf(" key2=%i is out of range [1..200]\n", key2);
1200 return -1;
1201 } else {
1202 return (LUDAT3_HIJING.mdcy[key2-1][key1-1]);
1203 }
7dffa423 1204
e9b09fa2 1205
0f07b55b 1206}
7dffa423 1207//====================== access to Hijing subroutines =========================
1208
1209
1210//______________________________________________________________________________
1211void THijing::Initialize()
1212{
1213//////////////////////////////////////////////////////////////////////////////////
1214// Calls Hijset with the either default parameters or the ones set by the user //
1215// via SetEFRM, SetFRAME, SetPROJ, SetTARG, SetIAP, SetIZP, SetIAT, SetIZT //
1216//////////////////////////////////////////////////////////////////////////////////
1217
ce5a1dbd 1218 if ( (!strcmp(fFrame.Data(), "CMS " )) &&
1219 (!strcmp(fFrame.Data(), "LAB " ))){
7dffa423 1220 printf("WARNING! In THijing:Initialize():\n");
1221 printf(" specified frame=%s is neither CMS or LAB\n",fFrame.Data());
1222 printf(" resetting to default \"CMS\" .");
1223 fFrame="CMS";
1224 }
1225
ce5a1dbd 1226 if ( (!strcmp(fProj.Data(), "A " )) &&
1227 (!strcmp(fProj.Data(), "P " )) &&
1228 (!strcmp(fProj.Data(), "PBAR " ))){
7dffa423 1229 printf("WARNING! In THijing:Initialize():\n");
1230 printf(" specified projectile=%s is neither A, P or PBAR\n",fProj.Data());
1231 printf(" resetting to default \"A\" .");
1232 fProj="A";
1233 }
1234
ce5a1dbd 1235 if ( (!strcmp(fTarg.Data(), "A " )) &&
1236 (!strcmp(fTarg.Data(), "P " )) &&
1237 (!strcmp(fTarg.Data(), "PBAR " ))){
7dffa423 1238 printf("WARNING! In THijing:Initialize():\n");
1239 printf(" specified target=%s is neither A, P or PBAR\n",fTarg.Data());
1240 printf(" resetting to default \"A\" .");
1241 fTarg="A";
1242 }
1243
ce5a1dbd 1244 printf(" %s-%s at %f GeV \n",fProj.Data(),fTarg.Data(),fEfrm);
7dffa423 1245
1246 Hijset(fEfrm,fFrame.Data(),fProj.Data(),fTarg.Data(),fIap,fIzp,fIat,fIzt);
1247
1248 printf(" %s-%s at %f GeV \n",fProj.Data(),fTarg.Data(),fEfrm);
1249}
1250
1251
1252//______________________________________________________________________________
1253void THijing::GenerateEvent()
1254{
1255// Generates one event;
1256
1257 Hijing(fFrame.Data(),fBmin,fBmax);
1258
1259}
1260//______________________________________________________________________________
1261void THijing::Hijset(float efrm, const char *frame, const char *proj,
1262 const char *targ, int iap, int izp, int iat, int izt)
1263{
1264// Call HIJING routine HIJSET passing the parameters in a way accepted by
1265// Fortran routines
1266
1267 int s1 = strlen(frame);
1268 int s2 = strlen(proj);
1269 int s3 = strlen(targ);
1270 printf("s1 = %d s2 = %d s3 = %d\n",s1,s2,s3);
1271#ifndef WIN32
1272 hijset(efrm, frame, proj, targ, iap, izp, iat, izt, s1, s2, s3);
1273#else
1274 hijset(efrm, frame, s1, proj, s2, targ, s3, iap, izp, iat, izt);
1275#endif
1276}
1277//______________________________________________________________________________
1278void THijing::Hijing(const char *frame, float bmin, float bmax)
1279{
1280// Call HIJING routine HIJSET passing the parameters in a way accepted by
1281// Fortran routines
1282
1283 int s1 = strlen(frame);
1284
1285#ifndef WIN32
1286 hijing(frame, bmin, bmax, s1);
1287#else
1288 hijing(frame, s1, bmin, bmax);
1289#endif
1290}
ce5a1dbd 1291
1292
1293Float_t THijing::Profile(float b)
1294{
1295// Call HIJING routine PROFILE
1296 return profile(b);
1297}
1298
1299
6b759e67 1300void THijing::Rluget(Int_t lfn, Int_t move)
1301{
1302// write seed to file
1303 rluget_hijing(lfn, move);
1304}
1305
1306
1307void THijing::Rluset(Int_t lfn, Int_t move)
1308{
1309// read seed from file
1310 rluset_hijing(lfn, move);
1311}
ce5a1dbd 1312
0f07b55b 1313void THijing::Pylist(Int_t flag)
1314{
1315// call lulist
1316 lulist_hijing(flag);
1317}