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