]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/PHOTOS/phocha.F
Changes for #89887: Detector status ULong_t in AliESDEvent (Jacek)
[u/mrichter/AliRoot.git] / TEvtGen / PHOTOS / phocha.F
1       FUNCTION PHOCHA(IDHEP)
2 C.----------------------------------------------------------------------
3 C.
4 C.    PHOTOS:   PHOton radiation in decays CHArge determination
5 C.
6 C.    Purpose:  Calculate the charge  of particle  with code IDHEP.  The
7 C.              code  of the  particle  is  defined by the Particle Data
8 C.              Group in Phys. Lett. B204 (1988) 1.
9 C.
10 C.    Input Parameter:   IDHEP
11 C.
12 C.    Output Parameter:  Funtion value = charge  of  particle  with code
13 C.                       IDHEP
14 C.
15 C.    Author(s):  E. Barberio and B. van Eijk     Created at:  29/11/89
16 C.                                                Last update: 02/01/90
17 C.
18 C.----------------------------------------------------------------------
19       IMPLICIT NONE
20       REAL*8 PHOCHA
21       INTEGER IDHEP,IDABS,Q1,Q2,Q3
22 C--
23 C--   Array 'CHARGE' contains the charge  of the first 101 particles ac-
24 C--   cording  to  the PDG particle code... (0 is added for convenience)
25       REAL*8 CHARGE(0:100)
26       DATA CHARGE/ 0.D0,
27      &-0.3333333333D0,  0.6666666667D0, -0.3333333333D0, 0.6666666667D0,
28      &-0.3333333333D0,  0.6666666667D0, -0.3333333333D0, 0.6666666667D0,
29      & 2*0.D0, -1.D0, 0.D0, -1.D0, 0.D0, -1.D0, 0.D0, -1.D0, 6*0.D0, 
30      & 1.D0, 12*0.D0, 1.D0, 63*0.D0/
31       IDABS=ABS(IDHEP)
32       IF (IDABS.LE.100) THEN
33 C--
34 C--   Charge of quark, lepton, boson etc....
35         PHOCHA = CHARGE(IDABS)
36       ELSE
37 C--
38 C--   Check on particle build out of quarks, unpack its code...
39         Q3=MOD(IDABS/1000,10)
40         Q2=MOD(IDABS/100,10)
41         Q1=MOD(IDABS/10,10)
42         IF (Q3.EQ.0) THEN
43 C--
44 C--   ...meson...
45           IF(MOD(Q2,2).EQ.0) THEN
46             PHOCHA=CHARGE(Q2)-CHARGE(Q1)
47           ELSE
48             PHOCHA=CHARGE(Q1)-CHARGE(Q2)
49           ENDIF
50         ELSE
51 C--
52 C--   ...diquarks or baryon.
53           PHOCHA=CHARGE(Q1)+CHARGE(Q2)+CHARGE(Q3)
54         ENDIF
55       ENDIF
56 C--
57 C--   Find the sign of the charge...
58       IF (IDHEP.LT.0.D0) PHOCHA=-PHOCHA
59       IF (PHOCHA**2.lt.1d-6) PHOCHA=0.D0
60       RETURN
61       END