Rluget and Rluset calling FORTRAN functions rluget_hijing and rluset_hijing 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
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_
6b759e67 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;
245 if (!strcmp(option,"") || !strcmp(option,"Final")) {
ce5a1dbd 246 for (Int_t i = 0; i<=numpart; i++) {
247
248 if (HIMAIN2.katt[3][i] == 1) {
7dffa423 249//
250// Use the common block values for the TParticle constructor
251//
ce5a1dbd 252 new(Particles[i]) TParticle(
253 HIMAIN2.katt[0][i] ,
254 HIMAIN2.katt[1][i] ,
255 HIMAIN2.katt[2][i] ,
256 -1,
257 -1,
258 -1,
259
260 HIMAIN2.patt[0][i] ,
261 HIMAIN2.patt[1][i] ,
262 HIMAIN2.patt[2][i] ,
263 HIMAIN2.patt[3][i] ,
264
265 0,
266 0,
267 0,
268 0);
269 }
270 }
7dffa423 271 }
272 else if (!strcmp(option,"All")) {
ce5a1dbd 273 for (Int_t i = 0; i<=numpart; i++) {
274
275 Int_t iParent = HIMAIN2.katt[2][i]-1;
276
277 if (iParent >= 0) {
278 TParticle *mother = (TParticle*) (Particles.UncheckedAt(iParent));
279 mother->SetLastDaughter(i);
280 if (mother->GetFirstDaughter()==-1)
281 mother->SetFirstDaughter(i);
282 }
283
7dffa423 284 new(Particles[i]) TParticle(
ce5a1dbd 285 HIMAIN2.katt[0][i] ,
286 HIMAIN2.katt[3][i] ,
287 iParent,
288 -1,
289 -1,
290 -1,
291
292 HIMAIN2.patt[0][i] ,
293 HIMAIN2.patt[1][i] ,
294 HIMAIN2.patt[2][i] ,
295 HIMAIN2.patt[3][i] ,
296
297 0,
298 0,
299 0,
300 0);
301 }
7dffa423 302 }
303 return numpart;
304}
305
306//______________________________________________________________________________
307void THijing::SetEFRM(Float_t efrm)
308{
309 fEfrm=efrm;
310}
311//______________________________________________________________________________
312void THijing::SetFRAME(const char* frame)
313{
314 fFrame=frame;
315}
316//______________________________________________________________________________
317void THijing::SetPROJ(const char* proj)
318{
319 fProj=proj;
320}
321//______________________________________________________________________________
322void THijing::SetTARG(const char* targ)
323{
324 fTarg=targ;
325}
326//______________________________________________________________________________
327void THijing::SetIAP(Int_t iap)
328{
329 fIap=iap;
330}
331//______________________________________________________________________________
332void THijing::SetIZP(Int_t izp)
333{
334 fIzp=izp;
335}
336//______________________________________________________________________________
337void THijing::SetIAT(Int_t iat)
338{
339 fIat=iat;
340}
341//______________________________________________________________________________
342void THijing::SetIZT(Int_t izt)
343{
344 fIzt=izt;
345}
346//______________________________________________________________________________
347void THijing::SetBMIN(Float_t bmin)
348{
349 fBmin=bmin;
350}
351//______________________________________________________________________________
352void THijing::SetBMAX(Float_t bmax)
353{
354 fBmax=bmax;
355}
356//______________________________________________________________________________
357Float_t THijing::GetEFRM() const
358{
359 return fEfrm;
360}
361//______________________________________________________________________________
362const char* THijing::GetFRAME() const
363{
364 return fFrame.Data();
365}
366//______________________________________________________________________________
367const char* THijing::GetPROJ() const
368{
369 return fProj;
370}
371//______________________________________________________________________________
372const char* THijing::GetTARG() const
373{
374 return fTarg;
375}
376//______________________________________________________________________________
377Int_t THijing::GetIAP() const
378{
379 return fIap;
380}
381//______________________________________________________________________________
382Int_t THijing::GetIZP() const
383{
384 return fIzp;
385}
386//______________________________________________________________________________
387Int_t THijing::GetIAT() const
388{
389 return fIat;
390}
391//______________________________________________________________________________
392Int_t THijing::GetIZT() const
393{
394 return fIzt;
395}
396//______________________________________________________________________________
397Float_t THijing::GetBMIN() const
398{
399 return fBmin;
400}
401//______________________________________________________________________________
402Float_t THijing::GetBMAX() const
403{
404 return fBmax;
405}
406
407//====================== access to common HIPARNT ===============================
408
409//______________________________________________________________________________
410void THijing::SetHIPR1(Int_t key,Float_t value)
411{
412 if ( key<1 || key>100 ) {
413 printf ("ERROR in THijing:SetHIPR1(key,value): \n ");
414 printf (" key=%i is out of range [1..100]!\n",key);
415 return;
416 }
417
418 HIPARNT.hipr1[key-1]=value;
419
420}
421
422//______________________________________________________________________________
423Float_t THijing::GetHIPR1(Int_t key) const
424{
425 if ( key<1 || key>100 ) {
426 printf ("ERROR in THijing:GetHIPR1(key): \n ");
427 printf (" key=%i is out of range [1..100]!\n",key);
428 return 0;
429 }
430
431 return HIPARNT.hipr1[key-1];
432
433}
434
435//______________________________________________________________________________
436void THijing::SetIHPR2(Int_t key,Int_t value)
437{
438 if ( key<1 || key>50 ) {
439 printf ("ERROR in THijing:SetIHPR2(key,value): \n ");
440 printf (" key=%i is out of range [1..50]!\n",key);
441 return;
442 }
443
444 HIPARNT.ihpr2[key-1]=value;
445
446}
447
448//______________________________________________________________________________
449Int_t THijing::GetIHPR2(Int_t key) const
450{
451 if ( key<1 || key>50 ) {
452 printf ("ERROR in THijing:GetIHPR2(key): \n ");
453 printf (" key=%i is out of range [1..50]!\n",key);
454 return 0;
455 }
456
457 return HIPARNT.ihpr2[key-1];
458
459}
460
461
462//______________________________________________________________________________
463Float_t THijing::GetHINT1(Int_t key) const
464{
465 if ( key<1 || key>100 ) {
466 printf ("ERROR in THijing:GetHINT1(key): \n ");
467 printf (" key=%i is out of range [1..100]!\n",key);
468 return 0;
469 }
470
471 return HIPARNT.hint1[key-1];
472
473}
474
475
476//______________________________________________________________________________
477Int_t THijing::GetIHNT2(Int_t key) const
478{
479 if ( key<1 || key>50 ) {
480 printf ("ERROR in THijing:GetIHNT2(key): \n ");
481 printf (" key=%i is out of range [1..50]!\n",key);
482 return 0;
483 }
484
485 return HIPARNT.ihnt2[key-1];
486
487}
488
489
490//====================== access to common HIMAIN1 ===============================
491
492//______________________________________________________________________________
493Int_t THijing::GetNATT() const
494{
495
496 return HIMAIN1.natt;
497
498}
499
500//______________________________________________________________________________
501Float_t THijing::GetEATT() const
502{
503
504 return HIMAIN1.eatt;
505
506}
507
508//______________________________________________________________________________
509Int_t THijing::GetJATT() const
510{
511
512 return HIMAIN1.jatt;
513
514}
515
516//______________________________________________________________________________
517Int_t THijing::GetNT() const
518{
519
520 return HIMAIN1.nt;
521
522}
523
524//______________________________________________________________________________
525Int_t THijing::GetNP() const
526{
527
528 return HIMAIN1.np;
529
530}
531
532
533//______________________________________________________________________________
534Int_t THijing::GetN0() const
535{
536
537 return HIMAIN1.n0;
538
539}
540//______________________________________________________________________________
541Int_t THijing::GetN01() const
542{
543
544 return HIMAIN1.n01;
545
546}
547
548//______________________________________________________________________________
549Int_t THijing::GetN10() const
550{
551
552 return HIMAIN1.n10;
553
554}
555
556//______________________________________________________________________________
557Int_t THijing::GetN11() const
558{
559
560 return HIMAIN1.n11;
561
562}
563
564//______________________________________________________________________________
565Float_t THijing::GetBB() const
566{
567
568 return HIMAIN1.bb;
569
570}
571
572//====================== access to common HIMAIN2 ===============================
573
574//______________________________________________________________________________
575Int_t THijing::GetKATT(Int_t key1, Int_t key2) const
576{
577 if ( key1<1 || key1>130000 ) {
578 printf("ERROR in THijing::GetKATT(key1,key2):\n");
579 printf(" key1=%i is out of range [1..130000]\n",key1);
580 return 0;
581 }
582
583 if ( key2<1 || key2>4 ) {
584 printf("ERROR in THijing::GetKATT(key1,key2):\n");
585 printf(" key2=%i is out of range [1..4]\n",key2);
586 return 0;
587 }
588
589 return HIMAIN2.katt[key2-1][key1-1];
590}
591
592//______________________________________________________________________________
593Float_t THijing::GetPATT(Int_t key1, Int_t key2) const
594{
595 if ( key1<1 || key1>130000 ) {
596 printf("ERROR in THijing::GetPATT(key1,key2):\n");
597 printf(" key1=%i is out of range [1..130000]\n",key1);
598 return 0;
599 }
600
601 if ( key2<1 || key2>4 ) {
602 printf("ERROR in THijing::GetPATT(key1,key2):\n");
603 printf(" key2=%i is out of range [1..4]\n",key2);
604 return 0;
605 }
606
607 return HIMAIN2.patt[key2-1][key1-1];
608}
609
610//====================== access to common HIJJET1 ===============================
611
612//______________________________________________________________________________
613Int_t THijing::GetNPJ(Int_t key) const
614{
615 if ( key<1 || key>300 ) {
616 printf("ERROR in THijing::GetNPJ(key):\n");
617 printf(" key=%i is out of range [1..300]\n",key);
618 return 0;
619 }
620 return HIJJET1.npj[key-1];
621}
622
623//______________________________________________________________________________
624Int_t THijing::GetKFPJ(Int_t key1, Int_t key2) const
625{
626 if ( key1<1 || key1>300 ) {
627 printf("ERROR in THijing::GetKFPJ(key1):\n");
628 printf(" key1=%i is out of range [1..300]\n",key1);
629 return 0;
630 }
631 if ( key2<1 || key2>500 ) {
632 printf("ERROR in THijing::GetKFPJ(key1,key2):\n");
633 printf(" key2=%i is out of range [1..500]\n",key2);
634 return 0;
635 }
636
637 return HIJJET1.kfpj[key2-1][key1-1];
638}
639
640//______________________________________________________________________________
641Float_t THijing::GetPJPX(Int_t key1, Int_t key2) const
642{
643 if ( key1<1 || key1>300 ) {
644 printf("ERROR in THijing::GetPJPX(key1):\n");
645 printf(" key1=%i is out of range [1..300]\n",key1);
646 return 0;
647 }
648 if ( key2<1 || key2>500 ) {
649 printf("ERROR in THijing::GetPJPX(key1,key2):\n");
650 printf(" key2=%i is out of range [1..500]\n",key2);
651 return 0;
652 }
653
654 return HIJJET1.pjpx[key2-1][key1-1];
655}
656
657//______________________________________________________________________________
658Float_t THijing::GetPJPY(Int_t key1, Int_t key2) const
659{
660 if ( key1<1 || key1>300 ) {
661 printf("ERROR in THijing::GetPJPY(key1):\n");
662 printf(" key1=%i is out of range [1..300]\n",key1);
663 return 0;
664 }
665 if ( key2<1 || key2>500 ) {
666 printf("ERROR in THijing::GetPJPY(key1,key2):\n");
667 printf(" key2=%i is out of range [1..500]\n",key2);
668 return 0;
669 }
670
671 return HIJJET1.pjpy[key2-1][key1-1];
672}
673
674//______________________________________________________________________________
675Float_t THijing::GetPJPZ(Int_t key1, Int_t key2) const
676{
677 if ( key1<1 || key1>300 ) {
678 printf("ERROR in THijing::GetPJPZ(key1):\n");
679 printf(" key1=%i is out of range [1..300]\n",key1);
680 return 0;
681 }
682 if ( key2<1 || key2>500 ) {
683 printf("ERROR in THijing::GetPJPZ(key1,key2):\n");
684 printf(" key2=%i is out of range [1..500]\n",key2);
685 return 0;
686 }
687
688 return HIJJET1.pjpz[key2-1][key1-1];
689}
690
691//______________________________________________________________________________
692Float_t THijing::GetPJPE(Int_t key1, Int_t key2) const
693{
694 if ( key1<1 || key1>300 ) {
695 printf("ERROR in THijing::GetPJPE(key1):\n");
696 printf(" key1=%i is out of range [1..300]\n",key1);
697 return 0;
698 }
699 if ( key2<1 || key2>500 ) {
700 printf("ERROR in THijing::GetPJPE(key1,key2):\n");
701 printf(" key2=%i is out of range [1..500]\n",key2);
702 return 0;
703 }
704
705 return HIJJET1.pjpe[key2-1][key1-1];
706}
707
708//______________________________________________________________________________
709Float_t THijing::GetPJPM(Int_t key1, Int_t key2) const
710{
711 if ( key1<1 || key1>300 ) {
712 printf("ERROR in THijing::GetPJPM(key1):\n");
713 printf(" key1=%i is out of range [1..300]\n",key1);
714 return 0;
715 }
716 if ( key2<1 || key2>500 ) {
717 printf("ERROR in THijing::GetPJPM(key1,key2):\n");
718 printf(" key2=%i is out of range [1..500]\n",key2);
719 return 0;
720 }
721
722 return HIJJET1.pjpm[key2-1][key1-1];
723}
724
725//______________________________________________________________________________
726Int_t THijing::GetNTJ(Int_t key) const
727{
728 if ( key<1 || key>300 ) {
729 printf("ERROR in THijing::GetNTJ(key):\n");
730 printf(" key=%i is out of range [1..300]\n",key);
731 return 0;
732 }
733 return HIJJET1.ntj[key-1];
734}
735
736//______________________________________________________________________________
737Int_t THijing::GetKFTJ(Int_t key1, Int_t key2) const
738{
739 if ( key1<1 || key1>300 ) {
740 printf("ERROR in THijing::GetKFTJ(key1):\n");
741 printf(" key1=%i is out of range [1..300]\n",key1);
742 return 0;
743 }
744 if ( key2<1 || key2>500 ) {
745 printf("ERROR in THijing::GetKFTJ(key1,key2):\n");
746 printf(" key2=%i is out of range [1..500]\n",key2);
747 return 0;
748 }
749
750 return HIJJET1.kftj[key2-1][key1-1];
751}
752
753//______________________________________________________________________________
754Float_t THijing::GetPJTX(Int_t key1, Int_t key2) const
755{
756 if ( key1<1 || key1>300 ) {
757 printf("ERROR in THijing::GetPJTX(key1):\n");
758 printf(" key1=%i is out of range [1..300]\n",key1);
759 return 0;
760 }
761 if ( key2<1 || key2>500 ) {
762 printf("ERROR in THijing::GetPJTX(key1,key2):\n");
763 printf(" key2=%i is out of range [1..500]\n",key2);
764 return 0;
765 }
766
767 return HIJJET1.pjtx[key2-1][key1-1];
768}
769
770//______________________________________________________________________________
771Float_t THijing::GetPJTY(Int_t key1, Int_t key2) const
772{
773 if ( key1<1 || key1>300 ) {
774 printf("ERROR in THijing::GetPJTY(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::GetPJTY(key1,key2):\n");
780 printf(" key2=%i is out of range [1..500]\n",key2);
781 return 0;
782 }
783
784 return HIJJET1.pjty[key2-1][key1-1];
785}
786
787//______________________________________________________________________________
788Float_t THijing::GetPJTZ(Int_t key1, Int_t key2) const
789{
790 if ( key1<1 || key1>300 ) {
791 printf("ERROR in THijing::GetPJTZ(key1):\n");
792 printf(" key1=%i is out of range [1..300]\n",key1);
793 return 0;
794 }
795 if ( key2<1 || key2>500 ) {
796 printf("ERROR in THijing::GetPJTZ(key1,key2):\n");
797 printf(" key2=%i is out of range [1..500]\n",key2);
798 return 0;
799 }
800
801 return HIJJET1.pjtz[key2-1][key1-1];
802}
803
804//______________________________________________________________________________
805Float_t THijing::GetPJTE(Int_t key1, Int_t key2) const
806{
807 if ( key1<1 || key1>300 ) {
808 printf("ERROR in THijing::GetPJTE(key1):\n");
809 printf(" key1=%i is out of range [1..300]\n",key1);
810 return 0;
811 }
812 if ( key2<1 || key2>500 ) {
813 printf("ERROR in THijing::GetPJTE(key1,key2):\n");
814 printf(" key2=%i is out of range [1..500]\n",key2);
815 return 0;
816 }
817
818 return HIJJET1.pjte[key2-1][key1-1];
819}
820
821//______________________________________________________________________________
822Float_t THijing::GetPJTM(Int_t key1, Int_t key2) const
823{
824 if ( key1<1 || key1>300 ) {
825 printf("ERROR in THijing::GetPJTM(key1):\n");
826 printf(" key1=%i is out of range [1..300]\n",key1);
827 return 0;
828 }
829 if ( key2<1 || key2>500 ) {
830 printf("ERROR in THijing::GetPJTM(key1,key2):\n");
831 printf(" key2=%i is out of range [1..500]\n",key2);
832 return 0;
833 }
834
835 return HIJJET1.pjtm[key2-1][key1-1];
836}
837
838//====================== access to common HIJJET1 ===============================
839
840//______________________________________________________________________________
841Int_t THijing::GetNSG() const
842{
843 return HIJJET2.nsg;
844}
845
846//______________________________________________________________________________
847Int_t THijing::GetNJSG(Int_t key) const
848{
849 if ( key<1 || key>900 ) {
850 printf ("ERROR in THijing:GetNJSG(key): \n ");
851 printf (" key=%i is out of range [1..900]!\n",key);
852 return 0;
853 }
854
855 return HIJJET2.njsg[key-1];
856
857}
858
859//______________________________________________________________________________
860Int_t THijing::GetIASG(Int_t key1, Int_t key2) const
861{
862 if ( key1<1 || key1>900 ) {
863 printf("ERROR in THijing::GetIASG(key1):\n");
864 printf(" key1=%i is out of range [1..900]\n",key1);
865 return 0;
866 }
867 if ( key2<1 || key2>3 ) {
868 printf("ERROR in THijing::GetIASG(key1,key2):\n");
869 printf(" key2=%i is out of range [1..3]\n",key2);
870 return 0;
871 }
872
873 return HIJJET2.iasg[key2-1][key1-1];
874}
875
876//______________________________________________________________________________
877Int_t THijing::GetK1SG(Int_t key1, Int_t key2) const
878{
879 if ( key1<1 || key1>900 ) {
880 printf("ERROR in THijing::GetK1SG(key1):\n");
881 printf(" key1=%i is out of range [1..900]\n",key1);
882 return 0;
883 }
884 if ( key2<1 || key2>100 ) {
885 printf("ERROR in THijing::GetK1SG(key1,key2):\n");
886 printf(" key2=%i is out of range [1..100]\n",key2);
887 return 0;
888 }
889
890 return HIJJET2.k1sg[key2-1][key1-1];
891}
892
893//______________________________________________________________________________
894Int_t THijing::GetK2SG(Int_t key1, Int_t key2) const
895{
896 if ( key1<1 || key1>900 ) {
897 printf("ERROR in THijing::GetK2SG(key1):\n");
898 printf(" key1=%i is out of range [1..900]\n",key1);
899 return 0;
900 }
901 if ( key2<1 || key2>100 ) {
902 printf("ERROR in THijing::GetK2SG(key1,key2):\n");
903 printf(" key2=%i is out of range [1..100]\n",key2);
904 return 0;
905 }
906
907 return HIJJET2.k2sg[key2-1][key1-1];
908}
909
910//______________________________________________________________________________
911Float_t THijing::GetPXSG(Int_t key1, Int_t key2) const
912{
913 if ( key1<1 || key1>900 ) {
914 printf("ERROR in THijing::GetPXSG(key1):\n");
915 printf(" key1=%i is out of range [1..900]\n",key1);
916 return 0;
917 }
918 if ( key2<1 || key2>100 ) {
919 printf("ERROR in THijing::GetPXSG(key1,key2):\n");
920 printf(" key2=%i is out of range [1..100]\n",key2);
921 return 0;
922 }
923
924 return HIJJET2.pxsg[key2-1][key1-1];
925}
926
927//______________________________________________________________________________
928Float_t THijing::GetPYSG(Int_t key1, Int_t key2) const
929{
930 if ( key1<1 || key1>900 ) {
931 printf("ERROR in THijing::GetPYSG(key1):\n");
932 printf(" key1=%i is out of range [1..900]\n",key1);
933 return 0;
934 }
935 if ( key2<1 || key2>100 ) {
936 printf("ERROR in THijing::GetPYSG(key1,key2):\n");
937 printf(" key2=%i is out of range [1..100]\n",key2);
938 return 0;
939 }
940
941 return HIJJET2.pysg[key2-1][key1-1];
942}
943
944//______________________________________________________________________________
945Float_t THijing::GetPZSG(Int_t key1, Int_t key2) const
946{
947 if ( key1<1 || key1>900 ) {
948 printf("ERROR in THijing::GetPZSG(key1):\n");
949 printf(" key1=%i is out of range [1..900]\n",key1);
950 return 0;
951 }
952 if ( key2<1 || key2>100 ) {
953 printf("ERROR in THijing::GetPZSG(key1,key2):\n");
954 printf(" key2=%i is out of range [1..100]\n",key2);
955 return 0;
956 }
957
958 return HIJJET2.pzsg[key2-1][key1-1];
959}
960
961//______________________________________________________________________________
962Float_t THijing::GetPESG(Int_t key1, Int_t key2) const
963{
964 if ( key1<1 || key1>900 ) {
965 printf("ERROR in THijing::GetPESG(key1):\n");
966 printf(" key1=%i is out of range [1..900]\n",key1);
967 return 0;
968 }
969 if ( key2<1 || key2>100 ) {
970 printf("ERROR in THijing::GetPESG(key1,key2):\n");
971 printf(" key2=%i is out of range [1..100]\n",key2);
972 return 0;
973 }
974
975 return HIJJET2.pesg[key2-1][key1-1];
976}
977
978//______________________________________________________________________________
979Float_t THijing::GetPMSG(Int_t key1, Int_t key2) const
980{
981 if ( key1<1 || key1>900 ) {
982 printf("ERROR in THijing::GetPMSG(key1):\n");
983 printf(" key1=%i is out of range [1..900]\n",key1);
984 return 0;
985 }
986 if ( key2<1 || key2>100 ) {
987 printf("ERROR in THijing::GetPMSG(key1,key2):\n");
988 printf(" key2=%i is out of range [1..100]\n",key2);
989 return 0;
990 }
991
992 return HIJJET2.pmsg[key2-1][key1-1];
993}
994
995//====================== access to common HISTRNG ===============================
996
997//______________________________________________________________________________
998Int_t THijing::GetNFP(Int_t key1, Int_t key2) const
999{
1000 if ( key1<1 || key1>300 ) {
1001 printf("ERROR in THijing::GetNFP(key1):\n");
1002 printf(" key1=%i is out of range [1..300]\n",key1);
1003 return 0;
1004 }
1005 if ( key2<1 || key2>15 ) {
1006 printf("ERROR in THijing::GetNFP(key1,key2):\n");
1007 printf(" key2=%i is out of range [1..15]\n",key2);
1008 return 0;
1009 }
1010
1011 return HISTRNG.nfp[key2-1][key1-1];
1012}
1013
1014//______________________________________________________________________________
1015Float_t THijing::GetPP(Int_t key1, Int_t key2) const
1016{
1017 if ( key1<1 || key1>300 ) {
1018 printf("ERROR in THijing::GetPP(key1):\n");
1019 printf(" key1=%i is out of range [1..300]\n",key1);
1020 return 0;
1021 }
1022 if ( key2<1 || key2>15 ) {
1023 printf("ERROR in THijing::GetPP(key1,key2):\n");
1024 printf(" key2=%i is out of range [1..15]\n",key2);
1025 return 0;
1026 }
1027
1028 return HISTRNG.pp[key2-1][key1-1];
1029}
1030
1031//______________________________________________________________________________
1032Int_t THijing::GetNFT(Int_t key1, Int_t key2) const
1033{
1034 if ( key1<1 || key1>300 ) {
1035 printf("ERROR in THijing::GetNFT(key1):\n");
1036 printf(" key1=%i is out of range [1..300]\n",key1);
1037 return 0;
1038 }
1039 if ( key2<1 || key2>15 ) {
1040 printf("ERROR in THijing::GetNFT(key1,key2):\n");
1041 printf(" key2=%i is out of range [1..15]\n",key2);
1042 return 0;
1043 }
1044
1045 return HISTRNG.nft[key2-1][key1-1];
1046}
1047
1048//______________________________________________________________________________
1049Float_t THijing::GetPT(Int_t key1, Int_t key2) const
1050{
1051 if ( key1<1 || key1>300 ) {
1052 printf("ERROR in THijing::GetPT(key1):\n");
1053 printf(" key1=%i is out of range [1..300]\n",key1);
1054 return 0;
1055 }
1056 if ( key2<1 || key2>15 ) {
1057 printf("ERROR in THijing::GetPT(key1,key2):\n");
1058 printf(" key2=%i is out of range [1..15]\n",key2);
1059 return 0;
1060 }
1061
1062 return HISTRNG.pt[key2-1][key1-1];
1063}
1064
1065
1066
1067//====================== access to Hijing subroutines =========================
1068
1069
1070//______________________________________________________________________________
1071void THijing::Initialize()
1072{
1073//////////////////////////////////////////////////////////////////////////////////
1074// Calls Hijset with the either default parameters or the ones set by the user //
1075// via SetEFRM, SetFRAME, SetPROJ, SetTARG, SetIAP, SetIZP, SetIAT, SetIZT //
1076//////////////////////////////////////////////////////////////////////////////////
1077
ce5a1dbd 1078 if ( (!strcmp(fFrame.Data(), "CMS " )) &&
1079 (!strcmp(fFrame.Data(), "LAB " ))){
7dffa423 1080 printf("WARNING! In THijing:Initialize():\n");
1081 printf(" specified frame=%s is neither CMS or LAB\n",fFrame.Data());
1082 printf(" resetting to default \"CMS\" .");
1083 fFrame="CMS";
1084 }
1085
ce5a1dbd 1086 if ( (!strcmp(fProj.Data(), "A " )) &&
1087 (!strcmp(fProj.Data(), "P " )) &&
1088 (!strcmp(fProj.Data(), "PBAR " ))){
7dffa423 1089 printf("WARNING! In THijing:Initialize():\n");
1090 printf(" specified projectile=%s is neither A, P or PBAR\n",fProj.Data());
1091 printf(" resetting to default \"A\" .");
1092 fProj="A";
1093 }
1094
ce5a1dbd 1095 if ( (!strcmp(fTarg.Data(), "A " )) &&
1096 (!strcmp(fTarg.Data(), "P " )) &&
1097 (!strcmp(fTarg.Data(), "PBAR " ))){
7dffa423 1098 printf("WARNING! In THijing:Initialize():\n");
1099 printf(" specified target=%s is neither A, P or PBAR\n",fTarg.Data());
1100 printf(" resetting to default \"A\" .");
1101 fTarg="A";
1102 }
1103
ce5a1dbd 1104 printf(" %s-%s at %f GeV \n",fProj.Data(),fTarg.Data(),fEfrm);
7dffa423 1105
1106 Hijset(fEfrm,fFrame.Data(),fProj.Data(),fTarg.Data(),fIap,fIzp,fIat,fIzt);
1107
1108 printf(" %s-%s at %f GeV \n",fProj.Data(),fTarg.Data(),fEfrm);
1109}
1110
1111
1112//______________________________________________________________________________
1113void THijing::GenerateEvent()
1114{
1115// Generates one event;
1116
1117 Hijing(fFrame.Data(),fBmin,fBmax);
1118
1119}
1120//______________________________________________________________________________
1121void THijing::Hijset(float efrm, const char *frame, const char *proj,
1122 const char *targ, int iap, int izp, int iat, int izt)
1123{
1124// Call HIJING routine HIJSET passing the parameters in a way accepted by
1125// Fortran routines
1126
1127 int s1 = strlen(frame);
1128 int s2 = strlen(proj);
1129 int s3 = strlen(targ);
1130 printf("s1 = %d s2 = %d s3 = %d\n",s1,s2,s3);
1131#ifndef WIN32
1132 hijset(efrm, frame, proj, targ, iap, izp, iat, izt, s1, s2, s3);
1133#else
1134 hijset(efrm, frame, s1, proj, s2, targ, s3, iap, izp, iat, izt);
1135#endif
1136}
1137//______________________________________________________________________________
1138void THijing::Hijing(const char *frame, float bmin, float bmax)
1139{
1140// Call HIJING routine HIJSET passing the parameters in a way accepted by
1141// Fortran routines
1142
1143 int s1 = strlen(frame);
1144
1145#ifndef WIN32
1146 hijing(frame, bmin, bmax, s1);
1147#else
1148 hijing(frame, s1, bmin, bmax);
1149#endif
1150}
ce5a1dbd 1151
1152
1153Float_t THijing::Profile(float b)
1154{
1155// Call HIJING routine PROFILE
1156 return profile(b);
1157}
1158
1159
6b759e67 1160void THijing::Rluget(Int_t lfn, Int_t move)
1161{
1162// write seed to file
1163 rluget_hijing(lfn, move);
1164}
1165
1166
1167void THijing::Rluset(Int_t lfn, Int_t move)
1168{
1169// read seed from file
1170 rluset_hijing(lfn, move);
1171}
ce5a1dbd 1172