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