1 |
formato |
1.1 |
* |
2 |
|
|
* $Id: gprnhran.F,v 1.5 2009-06-12 18:39:58 pam-rm2 Exp $ |
3 |
|
|
* |
4 |
|
|
* $Log: gprnhran.F,v $ |
5 |
|
|
* Revision 1.5 2009-06-12 18:39:58 pam-rm2 |
6 |
|
|
* - Introduced user-defined names of output files and random seeds number. |
7 |
|
|
* Users can do it use options of PamVMCApplication constructor: |
8 |
|
|
* PamVMCApplication(const char* name, const char *title, const char* |
9 |
|
|
* filename="pamtest", Int_t seed=0). |
10 |
|
|
* The Random object that I use is TRandom3 object which has astronomical |
11 |
|
|
* large period (in case of default initialization 0). All random generators |
12 |
|
|
* in the code use this object by calling of gRandom singleton which keeps |
13 |
|
|
* it. |
14 |
|
|
* |
15 |
|
|
* - Corrected TOF digitization routine. No problems with TDC hits due to |
16 |
|
|
* hadronic interactions anymore. |
17 |
|
|
* |
18 |
|
|
* - Some small changes was done to compile code under Root 5.23. + |
19 |
|
|
* geant4_vmc v. 2.6 without any warnings |
20 |
|
|
* |
21 |
|
|
* - Some classes of PamG4RunConfiguartion was changed for geant4_vmc v. |
22 |
|
|
* 2.6.Some obsolete classes was deleted as soon as developers implemented |
23 |
|
|
* regions. |
24 |
|
|
* |
25 |
|
|
* - Navigation was changed from "geomRootToGeant4" to "geomRoot", because on |
26 |
|
|
* VMC web page written that as soon as Geant4 has no option ONLY/MANY |
27 |
|
|
* translation of overlapped geometry to Geant4 through VGM could be wrong. |
28 |
|
|
* I'd like to stay with Root navigation: |
29 |
|
|
* http://root.cern.ch/root/vmc/Geant4VMC.html. This should be default |
30 |
|
|
* option. |
31 |
|
|
* |
32 |
|
|
* - New Tracker digitization routine written by Sergio was implemented |
33 |
|
|
* |
34 |
|
|
* - PamVMC again became compatible with geant4_vmc v.2.5 and ROOT 5.20. |
35 |
|
|
* The problem was that ROOT developers introduced in TVirtualMC class a new |
36 |
|
|
* method SetMagField and new base class:TVirtualMagField from which |
37 |
|
|
* user-defined classes shoukd be derived |
38 |
|
|
* |
39 |
|
|
* Revision 1.1 2009-02-19 17:46:26 nikolas |
40 |
|
|
* Cleaning up before releasing |
41 |
|
|
* |
42 |
|
|
* Revision 3.1 2005/12/06 01:06:42 cafagna |
43 |
|
|
* Adding new magnetic field routines |
44 |
|
|
* |
45 |
|
|
* Revision 1.2 1996/04/10 16:31:41 mclareni |
46 |
|
|
* NAME given dimension 2 |
47 |
|
|
* |
48 |
|
|
* Revision 1.1 1996/04/09 13:34:34 mclareni |
49 |
|
|
* Add new routine rnhran.F (V149), also to Imakefile |
50 |
|
|
* |
51 |
|
|
* 27/05/2005 Sergio Bottai |
52 |
|
|
* MODIFIED IN ORDER TO USE GEANT RANDOM NUMBERS |
53 |
|
|
* |
54 |
|
|
* |
55 |
|
|
SUBROUTINE GPRNHRAN(Y,N,XLO,XWID,XRAN) |
56 |
|
|
CHARACTER*8 NAME(2) |
57 |
|
|
|
58 |
|
|
DIMENSION Y(*) |
59 |
|
|
|
60 |
|
|
DATA IERR /0/ |
61 |
|
|
DATA NAME /'GPRNHRAN','GPRNHPRE'/ |
62 |
|
|
|
63 |
|
|
NTRY=1 |
64 |
|
|
IF(Y(N) .EQ. 1) GOTO 4 |
65 |
|
|
WRITE(6,101) NAME(1),Y(N) |
66 |
|
|
GOTO 5 |
67 |
|
|
|
68 |
|
|
ENTRY GPRNHPRE(Y,N) |
69 |
|
|
NTRY=2 |
70 |
|
|
|
71 |
|
|
5 YTOT=0 |
72 |
|
|
DO 1 I = 1,N |
73 |
|
|
IF(Y(I) .LT. 0) GOTO 9 |
74 |
|
|
YTOT=YTOT+Y(I) |
75 |
|
|
1 Y(I)=YTOT |
76 |
|
|
IF(YTOT .LE. 0) GOTO 9 |
77 |
|
|
YINV=1/YTOT |
78 |
|
|
DO 2 I = 1,N |
79 |
|
|
2 Y(I)=Y(I)*YINV |
80 |
|
|
Y(N)=1 |
81 |
|
|
IF(NTRY .EQ. 2) RETURN |
82 |
|
|
|
83 |
|
|
c 4 CALL RANLUX(YR,1) |
84 |
|
|
4 CALL GRNDMC(YR,1) |
85 |
|
|
c PRINT*,'GPRNHRAN.F calls RNDM' |
86 |
|
|
|
87 |
|
|
L=LOCATR(Y,N,YR) |
88 |
|
|
IF(L .LT. 0) THEN |
89 |
|
|
L=-L |
90 |
|
|
XRAN=XLO+XWID*(L+((YR-Y(L))/(Y(L+1)-Y(L)))) |
91 |
|
|
ELSEIF(L .EQ. 0) THEN |
92 |
|
|
XRAN=XLO+XWID*(YR/Y(1)) |
93 |
|
|
ELSE |
94 |
|
|
XRAN=XLO+L*XWID |
95 |
|
|
ENDIF |
96 |
|
|
RETURN |
97 |
|
|
|
98 |
|
|
9 IERR=IERR+1 |
99 |
|
|
IF(IERR .LT. 6) WRITE(6,102) NAME(NTRY) |
100 |
|
|
WRITE(6,'(1X,10F13.7)') (Y(K),K=1,N) |
101 |
|
|
XRAN=0 |
102 |
|
|
RETURN |
103 |
|
|
101 FORMAT(/7X,'+++++ CERN V149 ',A6,' : Y(N) = ',E15.6,' .NE. 1; ', |
104 |
|
|
1 'Y(I) NOT IN CUMULATIVE FORM.'/) |
105 |
|
|
102 FORMAT(/7X,'+++++ CERN V149 ',A6,' : NOT ALL VALUES Y(I) > 0'/) |
106 |
|
|
END |
107 |
|
|
|