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