]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVGEN/AliGenGSIlib.cxx
AliRICHDetectV1 added.
[u/mrichter/AliRoot.git] / EVGEN / AliGenGSIlib.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15   
16 /*
17 $Log$
18 Revision 1.5.10.1  2002/06/10 14:57:41  hristov
19 Merged with v3-08-02
20
21 Revision 1.6  2002/04/16 15:53:19  morsch
22 Coding rule violations corrected.
23
24 Revision 1.5  2001/05/15 15:43:23  morsch
25 Update of library for low mass resonances (Yiota Foka)
26
27 Revision 1.4  2001/03/09 13:01:41  morsch
28 - enum constants for paramterisation type (particle family) moved to AliGen*lib.h
29 - use AliGenGSIlib::kUpsilon, AliGenPHOSlib::kEtaPrime to access the constants
30
31 Revision 1.3  2000/12/21 16:24:06  morsch
32 Coding convention clean-up
33
34 Revision 1.2  2000/11/30 07:12:50  alibrary
35 Introducing new Rndm and QA classes
36
37 Revision 1.1  2000/06/15 08:48:43  morsch
38 AliGenGSIlib with parametersations for GSI physics simulation added (YF, MI)
39
40 Revision 1.7  2000/05/02 08:12:13  morsch
41 Coding rule violations corrected.
42
43 Revision 1.6  1999/09/29 09:24:14  fca
44 Introduction of the Copyright and cvs Log
45
46 */
47
48 /////////////////////////////////////////////////////////////////////////////
49 //                                                                         //
50 // Implementation of AliGenlib to collect parametrisations used for        //
51 // GSI simulations.                                                        //
52 // It is an extension of AliMUONLib providing in addition the option       //
53 // for different parametrisations of pt, y and ip for every particle type  //
54 //                                                                         //
55 // Responsible: Andres.Sandoval@cern.ch                                    //
56 //                                                                         //
57 /////////////////////////////////////////////////////////////////////////////
58
59 #include "TMath.h"
60 #include "TRandom.h"
61 #include "TString.h"
62 #include "AliGenGSIlib.h"
63
64
65 ClassImp(AliGenGSIlib)
66
67 //==========================================================================
68 //
69 //              Definition of Particle Distributions
70 //                    
71 //==========================================================================
72 //
73 //                         Upsilon 
74 //
75 //--------------------------------------------------------------------------
76 //
77 //                  upsilon particle composition
78 //
79 //--------------------------------------------------------------------------
80 Int_t AliGenGSIlib::IpUpsilon(TRandom *)
81 {
82 // Return upsilon pdg code
83
84   return 553;     
85
86 }
87 Double_t AliGenGSIlib::PtUpsilonFlat( Double_t *px, Double_t *dummy )
88 {
89 //--------------------------------------------------------------------------
90 //
91 //                   upsilon pt-distribution FLAT
92 //
93 //____________________________________________________________--------------
94     
95   const Double_t kptmin = 0.0;
96   const Double_t kptmax  = 15.0;
97   Double_t x=*px;
98   Double_t weight = 0.;
99
100   if (kptmin < x < kptmax) weight = 1.;
101
102   return weight;
103    
104 }
105 Double_t AliGenGSIlib::YUpsilonFlat(Double_t *py, Double_t *dummy)
106 {
107 //--------------------------------------------------------------------------
108 //
109 //                    upsilon y-distribution FLAT
110 //
111 //--------------------------------------------------------------------------
112
113   const Double_t ky0 = 1.5;
114   const Double_t kb=1.;
115   Double_t yu;
116   Double_t y=TMath::Abs(*py);
117
118   if (y < ky0)
119     yu=kb;
120   else
121     yu = 0.;
122
123   return yu;
124
125 }
126 Double_t AliGenGSIlib::PtUpsilonRitman( Double_t *px, Double_t *dummy )
127 {
128 //--------------------------------------------------------------------------
129 //
130 //                 upsilon pt-distribution RITMAN
131 //
132 //--------------------------------------------------------------------------
133
134   const Double_t kpt0 = 4.7;
135   const Double_t kxn  = 3.5;
136   Double_t x=*px;
137
138   Double_t pass1 = 1.+((x*x)/(kpt0*kpt0));
139
140   return x/TMath::Power(pass1,kxn);
141    
142 }
143 Double_t AliGenGSIlib::YUpsilonRitman(Double_t *py, Double_t *dummy)
144 {
145 //--------------------------------------------------------------------------
146 //
147 //                  upsilon y-distribution RITMAN
148 //
149 //--------------------------------------------------------------------------
150
151   const Double_t ky0 = 3.;
152   const Double_t kb=1.;
153   Double_t yu;
154   Double_t y=TMath::Abs(*py);
155
156   if (y < ky0)
157     yu=kb;
158   else
159     yu=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
160
161   return yu;
162    
163 }
164 Double_t AliGenGSIlib::PtUpsilonKarel( Double_t *px, Double_t *dummy )
165 {
166 //--------------------------------------------------------------------------
167 //
168 //                 upsilon pt-distribution kAREL
169 //
170 //--------------------------------------------------------------------------
171 // to implement
172
173   return 0.1;   
174
175 }
176 Double_t AliGenGSIlib::YUpsilonKarel(Double_t *py, Double_t *dummy)
177 {
178 //--------------------------------------------------------------------------
179 //
180 //                  upsilon y-distribution KAREL
181 //
182 //--------------------------------------------------------------------------
183   
184   //to implement
185
186   return 0.2;  
187
188 }
189 Double_t AliGenGSIlib::PtUpsilonMUON( Double_t *px, Double_t *dummy )
190 {
191 //--------------------------------------------------------------------------
192 //
193 //                 upsilon pt-distribution MUONlib
194 //
195 //--------------------------------------------------------------------------
196
197   const Double_t kpt0 = 5.3;
198   const Double_t kxn  = 2.5;
199   Double_t x=*px;
200
201   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
202
203   return x/TMath::Power(pass1,kxn);
204
205 }
206 Double_t AliGenGSIlib::YUpsilonMUON(Double_t *py, Double_t *dummy)
207 {
208 //--------------------------------------------------------------------------
209 //
210 //                   upsilon y-distribution MUONlib
211 //
212 //--------------------------------------------------------------------------
213
214   const Double_t ky0 = 3.;
215   const Double_t kb=1.;
216   Double_t yu;
217   Double_t y=TMath::Abs(*py);
218
219   if (y < ky0)
220     yu=kb;
221   else
222     yu=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
223
224   return yu;
225
226 }
227 //--------------------------------------------------------------------------
228 //
229 //                             J/Psi
230 //
231 Int_t AliGenGSIlib::IpJpsi(TRandom *)
232 {
233 //--------------------------------------------------------------------------
234 //
235 //                    J/Psi particle composition
236 //
237 //--------------------------------------------------------------------------
238
239   return 443;     
240
241 }
242 Double_t AliGenGSIlib::PtJpsiFlat( Double_t *px, Double_t *dummy )
243 {
244 //--------------------------------------------------------------------------
245 //
246 //                   J/Psi pt-distribution FLAT
247 //
248 //--------------------------------------------------------------------------
249
250   const Double_t kptmin = 0.0;
251   const Double_t kptmax  = 15.0;
252   Double_t x=*px;
253   Double_t weight = 0.;
254
255   if (kptmin < x < kptmax) weight = 1.;
256
257   return weight;
258    
259 }
260 Double_t AliGenGSIlib::YJpsiFlat(Double_t *py, Double_t *dummy)
261 {
262 //--------------------------------------------------------------------------
263 //
264 //                    J/Psi y-distribution FLAT
265 //
266 //--------------------------------------------------------------------------
267
268   const Double_t ky0 = 1.5;
269   const Double_t kb=1.;
270   Double_t yu;
271   Double_t y=TMath::Abs(*py);
272
273   if (y < ky0)
274     yu=kb;
275   else
276     yu = 0.;
277
278   return yu;
279
280 }
281 Double_t AliGenGSIlib::PtJpsiMUON( Double_t *px, Double_t *dummy )
282 {
283 //--------------------------------------------------------------------------
284 //
285 //                   J/Psi pt-distribution MUONlib
286 //
287 //--------------------------------------------------------------------------
288
289   const Double_t kpt0 = 4.;
290   const Double_t kxn  = 3.6;
291   Double_t x=*px;
292
293   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
294   return x/TMath::Power(pass1,kxn);
295    
296 }
297 Double_t AliGenGSIlib::PtJpsiRitman( Double_t *px, Double_t *dummy )
298 {
299 //--------------------------------------------------------------------------
300 //
301 //                   J/Psi pt-distribution Ritman
302 //
303 //--------------------------------------------------------------------------
304
305   const Double_t kpt0 = 2.3;
306   const Double_t kxn  = 3.5;
307   Double_t x=*px;
308
309   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
310
311   return x/TMath::Power(pass1,kxn);
312    
313 }
314 Double_t AliGenGSIlib::YJpsiMUON(Double_t *py, Double_t *dummy)
315 {
316 //--------------------------------------------------------------------------
317 //
318 //                    J/Psi y-distribution MUONlib
319 //
320 //--------------------------------------------------------------------------
321
322   const Double_t ky0 = 4.;
323   const Double_t kb=1.;
324   Double_t yj;
325   Double_t y=TMath::Abs(*py);
326
327   if (y < ky0)
328     yj=kb;
329   else
330     yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
331   return yj;
332
333 }
334 //--------------------------------------------------------------------------
335 //
336 //                  J/Psi pt-distribution by Sergei
337 //
338 //--------------------------------------------------------------------------
339 //Double_t AliGenGSIlib::PtJpsi( Double_t *px, Double_t *dummy )
340 //{
341
342 //  return x = gRandom->Rndm()*10.;
343
344 //}
345 //--------------------------------------------------------------------------
346 //
347 //                  J/Psi y-distribution by Sergei
348 //
349 //--------------------------------------------------------------------------
350 /*Double_t AliGenGSIlib::YJpsi(Double_t *py, Double_t *dummy)
351 {
352
353   const Double_t ky0 = 4.;
354   const Double_t kb=1.;
355   Double_t yj;
356   Double_t y=TMath::Abs(*py);
357   //
358   if (y < ky0)
359     yj=kb;
360   else
361     yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
362   return yj;
363
364 }
365 */
366 //--------------------------------------------------------------------------
367 //
368 //                        Charm
369 //
370 //--------------------------------------------------------------------------
371 Int_t AliGenGSIlib::IpCharm(TRandom *ran)
372 {
373 //
374 //                    charm particle composition
375 //
376 //--------------------------------------------------------------------------
377   
378     Float_t random;
379     Int_t ip;
380     // 411,421,431,4122
381     random = ran->Rndm();
382     if (random < 0.5) {
383         ip=411;
384     } else if (random < 0.75) {
385         ip=421;
386     } else if (random < 0.90) {
387         ip=431;
388     } else {
389         ip=4122;
390     }
391     if (ran->Rndm() < 0.5) {ip=-ip;}
392     
393     return ip;
394
395 }
396 Double_t AliGenGSIlib::PtCharmFlat( Double_t *px, Double_t *dummy)
397 {
398 //--------------------------------------------------------------------------
399 //
400 //                    charm pt-distribution, FLAT
401 //
402 //--------------------------------------------------------------------------
403
404   Double_t x=*px;
405
406   if (x>10.)  x = 0.;
407   else x=1.;
408   return x ;
409
410 }
411 Double_t AliGenGSIlib::PtCharmGSI( Double_t *px, Double_t *dummy)
412 {
413 //--------------------------------------------------------------------------
414 //
415 //                    charm pt-distribution, from Dariuzs Miskowiec
416 //
417 //--------------------------------------------------------------------------
418
419   //Taken from PYTHIA with MRS D-' (3031 from PDFLIB), K=3.0
420   const Double_t kp1 = 1.3;
421   const Double_t kp2  = 0.39;
422   const Double_t kp3  = 0.018;
423   const Double_t kp4  = 0.91;
424   Double_t x=*px;
425
426   Double_t pass1 =TMath::Exp(-x/kp2)  ;
427   Double_t pass2 =TMath::Exp(-x/kp4)  ;
428   return TMath::Power(x,kp1) * (pass1 + kp3 * pass2);
429
430 }
431 Double_t AliGenGSIlib::PtCharmMUON( Double_t *px, Double_t *dummy)
432 {
433 //--------------------------------------------------------------------------
434 //
435 //                    charm pt-distribution, from MUONlib
436 //
437 //--------------------------------------------------------------------------
438
439   const Double_t kpt0 = 4.08;
440   const Double_t kxn  = 9.40;
441   Double_t x=*px;
442
443   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
444
445   return x/TMath::Power(pass1,kxn);
446
447 }
448 Double_t AliGenGSIlib::YCharm( Double_t *px, Double_t *dummy)
449 {
450 //--------------------------------------------------------------------------
451 //
452 //                    charm y-distribution
453 //
454 //--------------------------------------------------------------------------
455
456     Double_t *dum=0;
457
458     return YJpsiMUON(px,dum);
459
460 }
461 //--------------------------------------------------------------------------
462 //
463 //                        Beauty
464 //
465 //--------------------------------------------------------------------------
466 Int_t AliGenGSIlib::IpBeauty(TRandom *ran)
467 {  
468 //
469 //                    beauty particle composition
470 //
471 //--------------------------------------------------------------------------
472
473     Float_t random;
474     Int_t ip;
475     random = ran->Rndm();
476     if (random < 0.5) {
477         ip=511;
478     } else if (random < 0.75) {
479         ip=521;
480     } else if (random < 0.90) {
481         ip=531;
482     } else {
483         ip=5122;
484     }
485     if (ran->Rndm() < 0.5) {ip=-ip;}
486     
487     return ip;
488 }
489 Double_t AliGenGSIlib::PtBeautyFlat( Double_t *px, Double_t *dummy)
490 {
491 //--------------------------------------------------------------------------
492 //
493 //                    beauty pt-distribution, FLAT
494 //
495 //--------------------------------------------------------------------------
496
497   Double_t x=*px;
498
499   if (x>10.) x=0.;
500   else x = 1.;
501   return x ;
502
503 }
504 Double_t AliGenGSIlib::PtBeautyGSI( Double_t *px, Double_t *dummy)
505 {
506 //--------------------------------------------------------------------------
507 //
508 //
509 //                    beauty pt-distribution, from D. Miskowiec
510 //
511 //--------------------------------------------------------------------------
512
513   //Taken from PYTHIA with MRS D-' (3031 from PDFLIB), K=3.0
514   const Double_t kp1 = 1.3;
515   const Double_t kp2  = 1.78;
516   const Double_t kp3  = 0.0096;
517   const Double_t kp4  = 4.16;
518   Double_t x=*px;
519
520   Double_t pass1 =TMath::Exp(-x/kp2)  ;
521   Double_t pass2 =TMath::Exp(-x/kp4)  ;
522
523   return TMath::Power(x,kp1) * (pass1 + kp3 * pass2);
524
525 }
526 Double_t AliGenGSIlib::PtBeautyMUON( Double_t *px, Double_t *dummy)
527 {
528 //--------------------------------------------------------------------------
529 //
530 //                    beauty pt-distribution, from MUONlib
531 //
532 //--------------------------------------------------------------------------
533
534   const Double_t kpt0 = 4.;
535   const Double_t kxn  = 3.6;
536   Double_t x=*px;
537
538   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
539
540   return x/TMath::Power(pass1,kxn);
541
542 }
543 Double_t AliGenGSIlib::YBeauty( Double_t *px, Double_t *dummy)
544 {
545 //--------------------------------------------------------------------------
546 //
547 //                    beauty y-distribution
548 //
549 //--------------------------------------------------------------------------
550
551     Double_t *dum=0;
552
553     return YJpsiMUON(px,dum);
554
555 }
556 //--------------------------------------------------------------------------
557 //
558 //                          Eta
559 //
560 //--------------------------------------------------------------------------
561 Int_t AliGenGSIlib::IpEta(TRandom *)
562 {
563 //
564 //                 eta particle composition 
565 //
566 //--------------------------------------------------------------------------
567
568   return 221;     
569
570 }
571 Double_t AliGenGSIlib::PtEtaPHOS( Double_t *px, Double_t *dummy )
572 {
573 //--------------------------------------------------------------------------
574 //
575 //                  eta pt-distribution
576 //
577 //____________________________________________________________--------------
578
579   return PtScal(*px,3);  //  3==> Eta in the PtScal function
580    
581 }
582 Double_t AliGenGSIlib::YEtaPHOS(Double_t *py, Double_t *dummy)
583 {
584 //--------------------------------------------------------------------------
585 //
586 //                   eta y-distribution 
587 //
588 //--------------------------------------------------------------------------
589
590   const Double_t ka    = 1000.;
591   const Double_t kdy   = 4.;
592
593   Double_t y=TMath::Abs(*py);
594
595   Double_t ex = y*y/(2*kdy*kdy);
596
597   return ka*TMath::Exp(-ex);
598
599 }
600 //--------------------------------------------------------------------------
601 //
602 //                       Etaprime
603 //
604 //--------------------------------------------------------------------------
605 Int_t AliGenGSIlib::IpEtaprime(TRandom *)
606 {
607 //
608 //                 etaprime particle composition 
609 //
610 //--------------------------------------------------------------------------
611
612   return 331;     
613
614 }
615 Double_t AliGenGSIlib::PtEtaprimePHOS( Double_t *px, Double_t *dummy )
616 {
617 //--------------------------------------------------------------------------
618 //
619 //                 etaprime pt-distribution
620 //
621 //____________________________________________________________--------------
622
623   return PtScal(*px,5);  //  5==> Etaprime in the PtScal function
624    
625 }
626 Double_t AliGenGSIlib::YEtaprimePHOS(Double_t *py, Double_t *dummy)
627 {
628 //--------------------------------------------------------------------------
629 //
630 //                  etaprime y-distribution 
631 //
632 //--------------------------------------------------------------------------
633
634   const Double_t ka    = 1000.;
635   const Double_t kdy   = 4.;
636
637   Double_t y=TMath::Abs(*py);
638
639   Double_t ex = y*y/(2*kdy*kdy);
640
641   return ka*TMath::Exp(-ex);
642
643 }
644 //--------------------------------------------------------------------------
645 //
646 //                       omega 
647 //
648 //--------------------------------------------------------------------------
649 Int_t AliGenGSIlib::IpOmega(TRandom *)
650 {
651 //
652 //                 omega particle composition 
653 //
654 //--------------------------------------------------------------------------
655
656   return 223;     
657
658 }
659 Double_t AliGenGSIlib::PtOmega( Double_t *px, Double_t *dummy )
660 {
661 //--------------------------------------------------------------------------
662 //
663 //                  omega pt-distribution
664 //
665 //____________________________________________________________--------------
666
667   return PtScal(*px,4);  //  4==> Omega in the PtScal function
668    
669 }
670 Double_t AliGenGSIlib::YOmega(Double_t *py, Double_t *dummy)
671 {
672 //--------------------------------------------------------------------------
673 //
674 //                   omega y-distribution 
675 //
676 //--------------------------------------------------------------------------
677
678   const Double_t ka    = 1000.;
679   const Double_t kdy   = 4.;
680
681
682   Double_t y=TMath::Abs(*py);
683
684   Double_t ex = y*y/(2*kdy*kdy);
685
686   return ka*TMath::Exp(-ex);
687
688 }
689 //--------------------------------------------------------------------------
690 //
691 //                       Rho 
692 //
693 //--------------------------------------------------------------------------
694
695 Int_t AliGenGSIlib::IpRho(TRandom *)
696 {
697 //
698 //                 rho particle composition 
699 //
700 //--------------------------------------------------------------------------
701
702   return 113;     
703
704 }
705 Double_t AliGenGSIlib::PtRho( Double_t *px, Double_t *dummy )
706 {
707 //--------------------------------------------------------------------------
708 //
709 //                  rho pt-distribution
710 //
711 //____________________________________________________________--------------
712
713   return PtScal(*px,11);  //  11==> Rho in the PtScal function
714    
715 }
716 Double_t AliGenGSIlib::YRho(Double_t *py, Double_t *dummy)
717 {
718 //--------------------------------------------------------------------------
719 //
720 //                   rho y-distribution 
721 //
722 //--------------------------------------------------------------------------
723
724   const Double_t ka    = 1000.;
725   const Double_t kdy   = 4.;
726
727
728   Double_t y=TMath::Abs(*py);
729
730   Double_t ex = y*y/(2*kdy*kdy);
731
732   return ka*TMath::Exp(-ex);
733
734 }
735 //--------------------------------------------------------------------------
736 //
737 //                              Pion
738 //
739 //--------------------------------------------------------------------------
740 Int_t AliGenGSIlib::IpPionPHOS(TRandom *ran)
741 {
742 //
743 //                 particle composition  pi+, pi0, pi-
744 //
745 //--------------------------------------------------------------------------
746
747     Float_t random = ran->Rndm();
748
749     if ( (3.*random)  < 1. ) 
750     {
751           return 211 ;
752     } 
753     else
754     {  
755       if ( (3.*random) >= 2.)
756       {
757          return -211 ;
758       }
759       else 
760       {
761         return 111  ;
762       }
763     }
764 }
765 Double_t AliGenGSIlib::PtPion( Double_t *px, Double_t *dummy )
766 {
767 //--------------------------------------------------------------------------
768 //
769 //                  pion pt-distribution
770 //
771 //       Pion transverse momentum distribtuion as in AliGenMUONlib class, 
772 //       version 3.01 of aliroot:
773 //       PT-PARAMETERIZATION CDF, PRL 61(88) 1819
774 //       POWER LAW FOR PT > 500 MEV
775 //       MT SCALING BELOW (T=160 MEV)
776 //
777 //____________________________________________________________--------------
778
779   const Double_t kp0 = 1.3;
780   const Double_t kxn = 8.28;
781   const Double_t kxlim=0.5;
782   const Double_t kt=0.160;
783   const Double_t kxmpi=0.139;
784   const Double_t kb=1.;
785   Double_t y, y1, kxmpi2, ynorm, a;
786   Double_t x=*px;
787
788   y1=TMath::Power(kp0/(kp0+kxlim),kxn);
789   kxmpi2=kxmpi*kxmpi;
790   ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+kxmpi2)/kt));
791   a=ynorm/y1;
792   if (x > kxlim)
793     y=a*TMath::Power(kp0/(kp0+x),kxn);
794   else
795     y=kb*TMath::Exp(-sqrt(x*x+kxmpi2)/kt);
796   return y*x;
797    
798 }
799 Double_t AliGenGSIlib::YPion(Double_t *py, Double_t *dummy)
800 {
801 //--------------------------------------------------------------------------
802 //
803 //                    pion y-distribution 
804 //
805 //--------------------------------------------------------------------------
806
807   const Double_t ka    = 7000.;   
808   const Double_t kdy   = 4.;
809
810   Double_t y=TMath::Abs(*py);
811
812   Double_t ex = y*y/(2*kdy*kdy);
813
814   return ka*TMath::Exp(-ex);
815
816 }
817 Int_t AliGenGSIlib::IpKaonPHOS(TRandom *ran)
818 {
819 //--------------------------------------------------------------------------
820 //
821 //
822 //                        Kaon
823 //--------------------------------------------------------------------------
824 //
825 //                kaon particle composition K+, K-, Ko_short, Ko_long
826 //
827 //--------------------------------------------------------------------------
828
829     Float_t random = ran->Rndm();
830     Float_t random2 = ran->Rndm();
831     if (random2 < 0.5) 
832     {
833       if (random < 0.5) {       
834         return  321;   //   K+
835       } else {
836         return -321;   // K-
837       }
838     }
839     else
840     {  
841       if (random < 0.5) {       
842         return  130;   // K^0 short
843       } else {  
844         return  310;   // K^0 long
845       }
846     }
847 }
848 Double_t AliGenGSIlib::PtKaonPHOS( Double_t *px, Double_t *dummy )
849 {
850 //--------------------------------------------------------------------------
851 //
852 //                   kaon pt-distribution
853 //
854 //____________________________________________________________--------------
855
856   return PtScal(*px,2);  //  2==> Kaon in the PtScal function
857    
858 }
859 Double_t AliGenGSIlib::YKaonPHOS(Double_t *py, Double_t *dummy)
860 {
861 //--------------------------------------------------------------------------
862 //
863 //                    kaon y-distribution 
864 //
865 //--------------------------------------------------------------------------
866
867   const Double_t ka    = 1000.;
868   const Double_t kdy   = 4.;
869
870   Double_t y=TMath::Abs(*py);
871
872   Double_t ex = y*y/(2*kdy*kdy);
873
874   return ka*TMath::Exp(-ex);
875
876 }
877 //--------------------------------------------------------------------------
878 //
879 //                        Phi  
880 //
881 Int_t AliGenGSIlib::IpPhi(TRandom *)
882 {
883 //--------------------------------------------------------------------------
884 //
885 //                 particle composition 
886 //
887 //--------------------------------------------------------------------------
888
889   return 333;     
890
891 }
892 Double_t AliGenGSIlib::PtPhiPHOS( Double_t *px, Double_t *dummy )
893 {
894 //--------------------------------------------------------------------------
895 //
896 //                   phi pt-distribution
897 //
898 //____________________________________________________________--------------
899
900   return PtScal(*px,6);  //  6==> Phi in the PtScal function
901    
902 }
903 Double_t AliGenGSIlib::YPhiPHOS(Double_t *py, Double_t *dummy)
904 {
905 //--------------------------------------------------------------------------
906 //
907 //                    phi y-distribution 
908 //
909 //--------------------------------------------------------------------------
910
911   const Double_t ka    = 1000.;
912   const Double_t kdy   = 4.;
913
914
915   Double_t y=TMath::Abs(*py);
916  
917   Double_t ex = y*y/(2*kdy*kdy);
918
919   return ka*TMath::Exp(-ex);
920
921 }
922 Int_t AliGenGSIlib::IpBaryons(TRandom *ran)
923 {
924 //--------------------------------------------------------------------------
925 //
926 //                          Baryons
927 //
928 //--------------------------------------------------------------------------
929 //
930 //                 baryons particle composition p, pbar, n, nbar
931 //
932 //--------------------------------------------------------------------------
933
934     Float_t random = ran->Rndm();
935     Float_t random2 = ran->Rndm();
936     if (random2 < 0.5) 
937     {
938       if (random < 0.5) {       
939         return  2212;   //   p
940       } else {
941         return -2212;   // pbar
942       }
943     }
944     else
945     {  
946       if (random < 0.5) {       
947         return  2112;   // n
948       } else {  
949         return -2112;   // n bar
950       }
951     }
952 }
953 Double_t AliGenGSIlib::PtBaryons( Double_t *px, Double_t *dummy )
954 {
955 //--------------------------------------------------------------------------
956 //
957 //                  baryons pt-distribution
958 //
959 //____________________________________________________________--------------
960
961   return PtScal(*px,7);  //  7==> Baryon in the PtScal function
962    
963 }
964 Double_t AliGenGSIlib::YBaryons(Double_t *py, Double_t *dummy)
965 {
966 //--------------------------------------------------------------------------
967 //
968 //                   baryons y-distribution 
969 //
970 //--------------------------------------------------------------------------
971
972   const Double_t ka    = 1000.;
973   const Double_t kdy   = 4.;
974
975   Double_t y=TMath::Abs(*py);
976
977   Double_t ex = y*y/(2*kdy*kdy);
978
979   return ka*TMath::Exp(-ex);
980
981 }
982 //============================================================= 
983 //
984 //                    Mt-scaling as in AliGenPHOSlib  
985 //
986 //============================================================= 
987 //
988  Double_t AliGenGSIlib::PtScal(Double_t pt, Int_t np)
989 {
990 // Function for the calculation of the Pt distribution for a 
991 // given particle np, from the pion Pt distribution using the 
992 // mt scaling. 
993
994 // It was taken from AliGenPHOSlib aliroot version 3.04, which 
995 // is an update of the one in AliGenMUONlib aliroot version 3.01
996 // with an extension for Baryons but supressing Rhos
997 // np = 1=>Pions 2=>Kaons 3=>Etas 4=>Omegas 5=>ETA' 6=>PHI
998 //      7=>BARYONS-BARYONBARS
999
1000 // The present adds the Rhos
1001
1002 // MASS   1=>PI, 2=>K, 3=>ETA, 4=>OMEGA, 5=>ETA', 6=>PHI 
1003 //        7=>BARYON-BARYONBAR, 11==>RHO
1004
1005   const Double_t khm[11] = {0.1396, 0.494,  0.547,    0.782,   0.957,   1.02, 
1006                                          0.938, 0. , 0., 0., 0.769};
1007
1008   //     VALUE MESON/PI AT 5 GEV
1009
1010   const Double_t kfmax[11]={1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.};
1011
1012   np--;
1013   Double_t f5=TMath::Power(((sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
1014   Double_t kfmax2=f5/kfmax[np];
1015   // PIONS
1016   Double_t ptpion=100.*PtPion(&pt, (Double_t*) 0);
1017   Double_t fmtscal=TMath::Power(((sqrt(pt*pt+0.018215)+2.)/
1018                                  (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/ kfmax2;
1019   return fmtscal*ptpion;
1020 }
1021
1022 //==========================================================================
1023 //
1024 //                     Set Getters 
1025 //    
1026 //==========================================================================
1027
1028 typedef Double_t (*GenFunc) (Double_t*,  Double_t*);
1029
1030 typedef Int_t (*GenFuncIp) (TRandom *);
1031
1032 GenFunc AliGenGSIlib::GetPt(Int_t param, const char * tname) const
1033 {
1034 // Return pointer to pT parameterisation
1035    GenFunc func=0;
1036    TString sname(tname);
1037
1038    switch (param) 
1039     {
1040     case kUpsilon:
1041       if (sname=="FLAT"){
1042         func= PtUpsilonFlat;
1043         break;
1044       }
1045       if (sname=="MUON"){
1046         func= PtUpsilonMUON;
1047         break;
1048       }
1049       if (sname=="RITMAN"){
1050         func=PtUpsilonRitman;
1051         break;
1052       }
1053       if (sname=="KAREL"){
1054         func=PtUpsilonKarel;
1055         break;
1056       }
1057       break;
1058        func=0;
1059         printf("<AliGenGSIlib::GetPt> unknown parametrisation\n");
1060
1061     case kJPsi:
1062       if (sname=="FLAT"){
1063         func= PtJpsiFlat;
1064         break;
1065       }
1066       if (sname=="MUON"){
1067         func= PtJpsiMUON;
1068         break;
1069       }
1070       //      if (sname=="SERGEI"){
1071       //        func= PtJpsi;
1072       //        break;
1073       //     }
1074       break;
1075         func=0;
1076         printf("<AliGenGSIlib::GetPt> unknown parametrisation\n");
1077
1078     case kCharm: 
1079       if (sname=="FLAT"){
1080         func= PtCharmFlat;
1081         break;
1082       }
1083
1084       if (sname=="MUON"){
1085         func= PtCharmMUON;
1086         break;
1087       }
1088
1089       if (sname=="GSI"){
1090         func= PtCharmGSI;
1091         break;
1092       }
1093       break;
1094        func=0;
1095         printf("<AliGenGSIlib::GetPt> unknown parametrisation\n");
1096
1097     case kBeauty: 
1098       if (sname=="FLAT"){
1099         func= PtBeautyFlat;
1100         break;
1101       }
1102       if (sname=="MUON"){
1103         func= PtBeautyMUON;
1104         break;
1105       }
1106       if (sname=="GSI"){
1107         func= PtBeautyGSI;
1108         break;
1109       }
1110       break;
1111        func=0;
1112         printf("<AliGenGSIlib::GetPt> unknown parametrisation\n");
1113
1114
1115     case kEta:
1116          func=PtEtaPHOS;
1117          break;
1118
1119     case kEtaprime:
1120          func=PtEtaprimePHOS;
1121          break;
1122
1123     case kOmega:
1124          func=PtOmega;
1125          break;
1126
1127     case kRho:
1128          func=PtRho;
1129          break;
1130
1131     case kKaon:
1132          func=PtKaonPHOS;
1133          break;
1134
1135     case kPion:
1136          func=PtPion;
1137          break;
1138
1139     case kPhi:
1140          func=PtPhiPHOS;
1141          break;
1142
1143          //    case kLambda:
1144          //         func=PtLambda;
1145          //         break;
1146
1147     case kBaryons:
1148          func=PtBaryons;
1149          break;
1150
1151     default:
1152         func=0;
1153         printf("<AliGenGSIlib::GetPt> unknown parametrisation\n");
1154     }
1155     return func;
1156 }
1157
1158 GenFunc AliGenGSIlib::GetY(Int_t param, const char * tname) const
1159 {
1160 // Return pointer to y- parameterisation
1161    GenFunc func=0;
1162    TString sname(tname);
1163
1164    switch (param) 
1165     {
1166     case kUpsilon:
1167       if (sname=="FLAT"){
1168         func= YUpsilonFlat;
1169         break;
1170       }
1171       if (sname=="MUON"){
1172         func= YUpsilonMUON;
1173         break;
1174       }
1175       if (sname=="RITMAN"){
1176         func=YUpsilonRitman;
1177         break;
1178       }
1179       if (sname=="KAREL"){
1180         func=YUpsilonKarel;
1181         break;
1182       }
1183       func=0;
1184       printf("<AliGenGSIlib::GetY> unknown parametrisation\n");
1185       break;
1186
1187     case kJPsi:
1188       if (sname=="FLAT"){
1189         func= YJpsiFlat;
1190         break;
1191       }
1192       if (sname=="MUON"){
1193         func= YJpsiMUON;
1194         break;
1195       }
1196       //      if (sname=="SERGEI"){
1197       //        func= YJpsi;
1198       //        break;
1199       //      }
1200    
1201       func=0;
1202       printf("<AliGenGSIlib::GetY> unknown parametrisation\n");
1203       break;
1204      
1205     case kCharm: 
1206         func= YCharm;
1207         break;
1208
1209     case kBeauty: 
1210         func= YBeauty;
1211         break;
1212
1213     case kEta:
1214          func=YEtaPHOS;
1215          break;
1216
1217     case kEtaprime:
1218          func=YEtaprimePHOS;
1219          break;
1220
1221     case kOmega:
1222          func=YOmega;
1223          break;
1224
1225     case kRho:
1226          func=YRho;
1227          break;
1228
1229     case kKaon:
1230          func=YKaonPHOS;
1231          break;
1232
1233     case kPion:
1234          func=YPion;
1235          break;
1236
1237     case kPhi:
1238          func=YPhiPHOS;
1239          break;
1240
1241          //    case kLambda:
1242          //         func=YLambda;
1243          //         break;
1244
1245     case kBaryons:
1246          func=YBaryons;
1247          break;
1248
1249     default:
1250         func=0;
1251         printf("<AliGenGSIlib::GetY> unknown parametrisation\n");
1252     }
1253     return func;
1254 }
1255
1256 GenFuncIp AliGenGSIlib::GetIp(Int_t param, const char * tname) const
1257 {
1258 // Return pointer to particle type parameterisation
1259    GenFuncIp func=0;
1260    TString sname(tname);
1261
1262    switch (param) 
1263     {
1264     case kUpsilon:
1265         func= IpUpsilon;
1266         break;
1267
1268     case kJPsi:
1269         func= IpJpsi;
1270         break;
1271
1272     case kCharm: 
1273         func= IpCharm;
1274         break;
1275
1276     case kBeauty: 
1277         func= IpBeauty;
1278         break;
1279
1280     case kEta:
1281          func=IpEta;
1282          break;
1283
1284     case kEtaprime:
1285          func=IpEtaprime;
1286          break;
1287
1288     case kOmega:
1289          func=IpOmega;
1290          break;
1291
1292     case kRho:
1293          func=IpRho;
1294          break;
1295
1296     case kKaon:
1297          func=IpKaonPHOS;
1298          break;
1299
1300     case kPion:
1301          func=IpPionPHOS;
1302          break;
1303
1304     case kPhi:
1305          func=IpPhi;
1306          break;
1307
1308          //    case kLambda:
1309          //         func=IpLambda;
1310          //         break;
1311
1312     case kBaryons:
1313          func=IpBaryons;
1314          break;
1315
1316     default:
1317         func=0;
1318         printf("<AliGenGSIlib::GetIp> unknown parametrisation\n");
1319     }
1320     return func;
1321 }
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333