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