This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / ghits / gcderr.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:21:08  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.20  by  S.Giani
11 *-- Author :
12       SUBROUTINE GCDERR (ICD,ERP,ERS)
13 C.
14 C.    ******************************************************************
15 C.    *                                                                *
16 C.    *       ROUTINE TO CALCULATE THE ERROR ON THE CURRENT DIVISION   *
17 C.    *       INFORMATION AS OBTAINED BY "GCDRIF"                      *
18 C.    *                                                                *
19 C.    *       INPUT:  ICD = DIGITIZED CURRENT DIVISION INFORMATION     *
20 C.    *                     ( 0 ... 1000 )                             *
21 C.    *               ERP = VARIANCE OF GAUSSIAN DISTRIBUTED PEDESTAL  *
22 C.    *                     ERRORS ON THE MEASURED PULSE HEIGHTS       *
23 C.    *                     RELATIVE TO THE SUM OF THE PULSE HEIGHTS   *
24 C.    *               ERS = VARIANCE OF GAUSSIAN DISTRIBUTED SLOPE     *
25 C.    *                     ERRORS ON THE MEASURED PULSE HEIGHTS       *
26 C.    *                     RELATIVE TO EACH PULSE HEIGHT              *
27 C.    *       OUTPUT: ICD = VALUE UPDATED ACCORDING TO RANDOM ERRORS   *
28 C.    *                                                                *
29 C.    *    ==>Called by : <USER>, GUDIGI                               *
30 C.    *       Author    D.Mitaroff  *********                          *
31 C.    *                                                                *
32 C.    ******************************************************************
33 C.
34       COMMON  /GCYDR/ ZL
35       DIMENSION RNDM(4)
36 C
37       Z = ICD
38 C
39 C---- CALCULATE PEDESTAL ERRORS FOR VARIANCE BEING 1.
40       CALL GRNDM(RNDM,4)
41 *          call rannor(eps1,eps2)
42       RY=RNDM(1)
43       RZ=RNDM(2)
44       RX=6.283185*RZ
45       A1=SQRT(-2.*LOG(RY))
46       EPS1=A1*SIN(RX)
47       EPS2=A1*COS(RX)
48       DZP = - EPS1 * Z + EPS2 * (ZL - Z)
49 C
50 C---- CALCULATE SLOPE ERRORS FOR VARIANCE BEING 1.
51 *          call rannor(eps1,eps2)
52       RY=RNDM(3)
53       RZ=RNDM(4)
54       RX=6.283185*RZ
55       A1=SQRT(-2.*LOG(RY))
56       EPS1=A1*SIN(RX)
57       EPS2=A1*COS(RX)
58       DZS = (EPS2 - EPS1) * Z * (ZL - Z) / ZL
59 C
60 C---- CALCULATE NEW VALUE OF ICD FOR VARIANCES ERP, ERS.
61       Z = Z + ERP * DZP + ERS * DZS
62       IF (Z .LT. 0.)   Z = 0.
63       IF (Z .GT. ZL)   Z = ZL
64 C
65       ICD = Z
66 C
67       END