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