forked from alisw/POWHEG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpwhg_bookhist.f
1424 lines (1369 loc) · 47.3 KB
/
pwhg_bookhist.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
C**********************************************************************
C Modified by S.Alioli and E.Re, 27-11-2007: now is y2k compliant!
C Modified by P. Nason, 28-6-91
C SIMPLE HISTOGRAMMING PACKAGE -- SIMPLIFIED VERSION OF HBOOK
C BY Michelangelo Mangano NOVEMBER 1988
C LAST REVISED NOVEMBER 9, 1988
C LAST REVISED JUNE 12, 1989 (ADD SCATTER PLOTS)
C LAST REVISED oct 1990 (Add multi-plots on one page, routines MULTITOP,
C PWHGTFILL,...)
C**********************************************************************
C
C Fills up to nmh histograms with up to nxm bins.
C Gives a data file (to be specified in the calling program by assigning
C a file name to unit 98) and a topdrawer file (to be specified in the
C calling program by assigning a file name to unit 99).
C
C INITIALIZATION:
C Call once INIHIST; this just resets a few counters and logicals
C Call PWHGBOOK(N,'TITLE',DEL,XMIN,XMAX) for each histogram to be booked.
C N (an integer) is the label of the histogram;
C 'TITLE' is the name of the histogram (no more then 100 characters);
C DEL (real*4) is the bin size;
C XMIN (real*4) is the lower limit of the first bin;
C XMAX (real*4)is the upper limit of the last bin
C Example:
C call pwhgbook(2,'pt distribution',1.,10,70)
C This call initializes histogram number 2, called 'pt distribution';
C The bin size will be 1. (possibly GeV, if that's what you want), the
C first bin being 10<x<11. and the last one being 69.<x<70
C
C FILLING:
C When it's time, call PWHGFILL(N,X,Y); this will add Y (real*4) to the bin
C in which X (real*4) happens to be, within histogram N.
C
C PLAYING AROUND:
C At the end of the day you may want to sum, divide, cancel, etc.etc.
C various histograms (bin by bin). Then you call PWHGOPERA(I,'O',J,K,X,Y).
C The 1-character string O can take the following values:
C + : sums X*(hist I) with Y*(hist J) and puts the result in hist K;
C - : subtracts X*(hist I) with Y*(hist J) and puts the result in hist K;
C * : multiplies X*(hist I) with Y*(hist J) and puts the result in hist K;
C / : divides X*(hist I) with Y*(hist J) and puts the result in hist K;
C F : multiplies hist I by the factor X, and puts the result in hist K;
C R : takes the square root of hist I, and puts the result in hist K;if
C the value at a given bin is less than or equal to 0, puts 0 in K
C S : takes the square of hist I, and puts the result in hist K;
C L : takes the log_10 of hist I, and puts the result in hist K; if the
C value at a given bin is less than or equal to 0, puts 0 in K
C M : statistical analysis; if I contains the weights (let's say WGT),
C J contains variable times weight (F*WGT) and K contains the
C variable squared times the weight (F**2*WGT), then, after using 'M',
C J will contain the average value of the variable <F> and K will
C contain the sigma of the average: sigma=sqrt(<F**2>-<F>**2).
C If WGT=1. for all the entries, then it is enough to put I=J, and
C it is not necessary to book a hist with the weights.
C V : estimates errors for vegas evaluation of differential distributions.
C Fill I with the values of
C the functions do integrate times the Vegas weight (fun*wgt); fill
C J with fun**2*wgt; then K will contain an estimate of the error
C of the integration. Putting X=1/(#of iterations) performs the
C avegare over the iterations, and gives the right normalization to
C the differential distribution, I, and to the errors, K. J stays the same.
C
C FINAL ACCOUNTING:
C Now we can finalize our histograms; PWHGFINAL(N) will calculate the integral
C of the histogram N, the mean value of the X variable and its RMS.
C If we now want to renormalize the hist's, we can call PWHGNORM(N,X), which
C will normalize the integral to X -- CAUTION: do not call PWHGNORM before
C PWHGFINAL, it will blow up.
C
C OUTPUT:
C To get a .dat file containing the values of the histograms, together with
C some information (like integral, mean values, etc.etc.) call PWHGPRINT(N),
C for each hist N that you want in the .dat file. Before the call to PWHGPRINT
C you want to open unit 98 and give it a name:
C OPEN(UNIT=98,NAME='NAME.DAT',STATUS='NEW')
C If you want a topdrawer file with a plot of the hist values, call
C PWHGTOP(N,M,'X','Y','SCALE'). The points of the plot will be taken from histogram
C N, the error bars from histogram M. 'SCALE', character*(*), determines
C the scale for y, logarithmic or linear (SCALE=LOG,LIN).
C If you do not want error bars, keep
C a histogram of zeros, or just call a hist that had not been booked.
C X will appear as a 'bottom title', and Y will appear as a 'left title'.
C The top title is by default the name of the histogram itself.
C A little box below the plot will contain some information on the plot
C itself. Before calling PWHGTOP,
C OPEN(UNIT=99,NAME='NAME.TOP',STATUS='NEW')
C--------------------------------------------------------------------------
C
C COMMON/HISTO/ Histogram N
C
C BOOK(N), Three-letter character-string: 'NO' if histogram was not
C Booked, 'YES' otherwise
C TITLE(N), Title of the histogram
C
C HMIN(N), Min value of x range
C HMAX(N), Max value of x range
C HDEL(N), Bin width
C NBIN(N), Total number of bins
C USCORE(N), Total integral of underscores with x < HMIN(N)
C OSCORE(N), Total integral of onderscores with x > HMAX(N)
C IUSCORE(N), Number of entries with x < HMIN(N)
C IOSCORE(N), Number of entries with x > HMAX(N)
C IENT(N), Total number of entries within x range HMIN(N)<x<HMAX(N)
C HINT(N), Integral of the histogram within HMIN(N)<x<HMAX(N)
C HAVG(N), Average value of x, weighted over the x range of the histo
C HSIG(N), Quadratic dispersion of x around the average
C HIST(N,L), Value of bin L-th
C XHIS(N,L), Central x value of bin L-th
C IHIS(N,L), Number of entries within bin L-th
C NHIST Total number of booked histograms
C
SUBROUTINE pwhgINIHIST
implicit none
include 'pwhg_book.h'
integer i
DO 1, I=1,NMB
1 BOOK(I)=' NO'
DO 2 I=1,10
2 BOOK2(I)=' NO'
call pwhgresetmultitop
END
subroutine pwhggettitle(N,TIT)
implicit none
character *(*) TIT
integer n
include 'pwhg_book.h'
TIT=TITLE(N)
end
SUBROUTINE PWHGBOOK(N,TIT,DEL,XMIN,XMAX)
implicit none
include 'pwhg_book.h'
integer n,i
real * 8 del,xmin,xmax,onep
CHARACTER*(*) TIT
DATA ONEP/1.00001d0/
IF(N.GT.NMB) THEN
CALL PWHGWARN('PWHGBOOK')
WRITE(*,*) 'PWHGBOOK: no more then ',NMB,' histograms'
STOP
ENDIF
NHIST = MAX(N,NHIST)
IF(BOOK(N).NE.' NO') THEN
CALL PWHGWARN('PWHGBOOK')
WRITE(*,*) 'Histogram',N,TITLE(N),' already in use. '
WRITE(*,*) 'superseded by ',TIT
ENDIF
BOOK(N) = 'YES'
TITLE(N) = ' '//TIT
1 HDEL(N) = DEL
NBIN(N) = INT(ONEP*(XMAX-XMIN)/DEL)
IF(NBIN(N).GT.nxm) THEN
WRITE(*,*) 'TOO MANY BINS (',NBIN(N),') REQUIRED IN HIST ',N
WRITE(*,*) 'RE-ENTER BIN SIZE DELTA (OLD BIN = ',DEL,' ):'
READ(*,*) DEL
GO TO 1
ENDIF
HMIN(N) = XMIN
HMAX(N) = NBIN(N)*DEL+XMIN
IF(ABS(HMAX(N)-XMAX)/(XMAX-XMIN).GT.0.1E-5) THEN
CALL PWHGWARN('PWHGBOOK')
WRITE(*,*)
#'Histogram ', TIT, ' Change of upper limit:',xmax,'-->',HMAX(N)
ENDIF
IENT(N) = 0
IUSCORE(N) = 0
IOSCORE(N) = 0
USCORE(N) = 0
OSCORE(N) = 0
HAVG(N) = 0
HINT(N) = 0
HSIG(N) = 0
DO I=1,NBIN(N)
XHIS(N,I)=HMIN(N)+HDEL(N)*(FLOAT(I)-0.5D0)
IHIS(N,I)=0
HIST(N,I)=0
ENDDO
END
SUBROUTINE PWHGFILL(N,X,Y)
implicit none
include 'pwhg_book.h'
real * 8 x,y,xi
integer n,i
C
XI=((X-HMIN(N))/HDEL(N))
I=INT(XI)+1
C
IF(X.LT.HMIN(N)) I=0
IF(X.GT.HMAX(N)) I=NBIN(N)+1
C
IF(I.LT.1) THEN
USCORE(N) = USCORE(N) + Y
IUSCORE(N) = IUSCORE(N) + 1
ELSEIF(I.GT.NBIN(N)) THEN
OSCORE(N) = OSCORE(N) + Y
IOSCORE(N) = IOSCORE(N) + 1
ELSE
IENT(N)=IENT(N)+1
IHIS(N,I)=IHIS(N,I)+1
HIST(N,I)=HIST(N,I)+Y
ENDIF
END
SUBROUTINE PWHGINTEG(NIN,NOUT,IDIR,IPOW)
C If IPOW=1 performs the integral of the distribution contained in histogram
C NIN up to the value specified by the abscissa (if IDIR=1) or from this
C value on (if IDIR=-1). The resulting integral distribution is put into
C NOUT, which is automatically booked if NOUT.ne.NIN . Choosing IPOW=2
C the routine will return the square root of the integral of the squares,
C as is required, for example, for the propagation of the mean quadratic error
C of a given distribution. Overscores and underscores are included.
implicit none
integer nin,nout,idir,ipow,m,i,l
real * 8 pwhgsumpow
include 'pwhg_book.h'
CHARACTER*14 C
DIMENSION C(2)
DATA C/' INTEG BELOW X',' INTEG ABOVE X'/
M = NBIN(NIN)
I = (IDIR + 3)/2
IF(NOUT.NE.NIN) THEN
CALL PWHGBOOK(NOUT,TITLE(NIN)//C(I),
& HDEL(NIN),HMIN(NIN),HMAX(NIN))
ENDIF
IF(IDIR.EQ.1) THEN
HIST(NOUT,1) = PWHGSUMPOW(HIST(NIN,1),USCORE(NIN),IPOW)
IHIS(NOUT,1) = IHIS(NIN,1) + IUSCORE(NIN)
XHIS(NOUT,1) = XHIS(NIN,1) + HDEL(NIN)/2
DO L=2,M
HIST(NOUT,L) = PWHGSUMPOW(HIST(NIN,L),HIST(NOUT,L-1),IPOW)
IHIS(NOUT,L) = IHIS(NIN,L) + IHIS(NOUT,L-1)
XHIS(NOUT,L) = XHIS(NIN,L) + HDEL(NIN)/2
ENDDO
OSCORE(NOUT) = PWHGSUMPOW(OSCORE(NIN),HIST(NIN,M),IPOW)
IOSCORE(NOUT) = IOSCORE(NIN) + IHIS(NIN,M)
ELSEIF(IDIR.EQ.-1) THEN
HIST(NOUT,M) = PWHGSUMPOW(HIST(NIN,M),OSCORE(NIN),IPOW)
IHIS(NOUT,M) = IHIS(NIN,M) + IOSCORE(NIN)
XHIS(NOUT,M) = XHIS(NIN,M) - HDEL(NIN)/2
DO L=M-1,1,-1
HIST(NOUT,L) = PWHGSUMPOW(HIST(NIN,L),HIST(NOUT,L+1),IPOW)
IHIS(NOUT,L) = IHIS(NIN,L) + IHIS(NOUT,L+1)
XHIS(NOUT,L) = XHIS(NIN,L) - HDEL(NIN)/2
ENDDO
USCORE(NOUT) = PWHGSUMPOW(USCORE(NIN),HIST(NIN,1),IPOW)
IUSCORE(NOUT) = IUSCORE(NIN)+IHIS(NIN,1)
ELSE
CALL PWHGWARN('PWHGINTEG')
WRITE(*,*) 'Wrong idir in pwhginteg: OPERATION NOT PERFORMED'
STOP
ENDIF
END
FUNCTION PWHGSUMPOW(X,Y,IPOW)
implicit none
real * 8 x,y,pwhgsumpow
integer ipow
IF(IPOW.EQ.1) THEN
PWHGSUMPOW = X + Y
ELSEIF(IPOW.EQ.2) THEN
PWHGSUMPOW = SQRT(X**2+Y**2)
ELSEIF(IPOW.EQ.0) THEN
CALL PWHGWARN('PWHGSUMPOW')
WRITE(*,*)'Error: IPOW=0 not allowed in PWHGSUMPOW'
STOP
ELSE
PWHGSUMPOW = (X**IPOW+Y**IPOW)**(1./IPOW)
ENDIF
END
SUBROUTINE PWHGOPERA(I,OPER,J,K,X,Y)
implicit none
include 'pwhg_book.h'
integer i,j,k,l
real * 8 x,y,xxx,xsum,xsumsq,xsqavg,xnorm,xavg
character * 1 oper
IF(NBIN(I).NE.NBIN(J).AND.(OPER.EQ.'+'.OR.OPER.EQ.'-'.OR.OPER.EQ.
& '*'.OR.OPER.EQ.'/'.OR.OPER.EQ.'M'.OR.OPER.EQ.'A')) THEN
CALL PWHGWARN('PWHGOPERA')
WRITE(20,*) I,J
20 FORMAT(' ****** INCOMPATIBLE OPERATION HIST ',I2,' &',I2,
& '*******'/)
STOP
ENDIF
IF(OPER.EQ.'E') THEN
c If I contains the accumulated weights, J the accumulated squares of the
c weights and IHIS(J,1) the number of accumulated entries, 'E' will add
c the average value of I to K and will put in J the quadratic dispersion.
IF(IHIS(J,1).NE.0) THEN
XXX = 1./IHIS(J,1)
ELSE
XXX = 0
ENDIF
DO L=1,NBIN(I)
XSUM = HIST(I,L)
XSUMSQ = HIST(J,L)
HIST(K,L)=HIST(K,L) + XXX*XSUM
IHIS(K,L)=IHIS(K,L) + IHIS(I,L)
HIST(J,L)=XXX*SQRT(ABS(XSUMSQ-XSUM**2*XXX))
ENDDO
IENT(K)=IENT(K)+IENT(I)
XSUM = USCORE(I)
XSUMSQ = USCORE(J)
USCORE(K) = USCORE(K)+XXX*XSUM
IUSCORE(K) = IUSCORE(K)+IUSCORE(I)
USCORE(J) = XXX*SQRT(ABS(XSUMSQ-XSUM**2*XXX))
XSUM = OSCORE(I)
XSUMSQ = OSCORE(J)
OSCORE(K) = OSCORE(K)+XXX*XSUM
IOSCORE(K) = IOSCORE(K)+IOSCORE(I)
OSCORE(J) = XXX*SQRT(ABS(XSUMSQ-XSUM**2*XXX))
ELSEIF(OPER.EQ.'Q') THEN
DO L=1,NBIN(I)
HIST(K,L) = SQRT(HIST(J,L)**2+HIST(I,L)**2)
ENDDO
USCORE(K) = SQRT(USCORE(J)**2+USCORE(I)**2)
OSCORE(K) = SQRT(OSCORE(J)**2+OSCORE(I)**2)
ELSEIF(OPER.EQ.'A') THEN
DO L=1,NBIN(I)
HIST(J,L) = HIST(J,L) + HIST(I,L)
IHIS(J,L) = IHIS(J,L) + IHIS(I,L)
HIST(K,L) = HIST(K,L) + HIST(I,L)**2
IHIS(K,L) = IHIS(K,L) + 1
IENT(K) = IENT(K)+1
HIST(I,L) = 0
IHIS(I,L) = 0
ENDDO
IENT(J) = IENT(J)+IENT(I)
IUSCORE(J) = IUSCORE(J) + IUSCORE(I)
USCORE(J) = USCORE(J) + USCORE(I)
IOSCORE(J) = IOSCORE(J) + IOSCORE(I)
OSCORE(J) = OSCORE(J) + OSCORE(I)
IUSCORE(K) = IUSCORE(K) + 1
USCORE(K) = USCORE(K) + USCORE(I)**2
IOSCORE(K) = IOSCORE(K) + 1
OSCORE(K) = OSCORE(K) + OSCORE(I)**2
IENT(I) = 0
IUSCORE(I) = 0
IOSCORE(I) = 0
USCORE(I) = 0
OSCORE(I) = 0
ELSE
DO L=1,NBIN(I)
IF(OPER.EQ.'+') THEN
HIST(K,L)=X*HIST(I,L) + Y*HIST(J,L)
ELSEIF(OPER.EQ.'-') THEN
HIST(K,L)=X*HIST(I,L) - Y*HIST(J,L)
ELSEIF(OPER.EQ.'*') THEN
HIST(K,L)=X*HIST(I,L) * Y*HIST(J,L)
ELSEIF(OPER.EQ.'/') THEN
IF(Y.EQ.0..OR.HIST(J,L).EQ.0.) THEN
HIST(K,L)=0.
ELSE
HIST(K,L)=X*HIST(I,L) / (Y*HIST(J,L))
ENDIF
ELSEIF(OPER.EQ.'F') THEN
HIST(K,L)=X*HIST(I,L)
ELSEIF(OPER.EQ.'R') THEN
IF(HIST(I,L).GT.0.) THEN
HIST(K,L)=X*SQRT(HIST(I,L))
ELSE
HIST(K,L)=0.
ENDIF
ELSEIF(OPER.EQ.'S') THEN
HIST(K,L)=X*HIST(I,L)**2
ELSEIF(OPER.EQ.'L') THEN
IF(HIST(I,L).EQ.0..OR.J.EQ.0.) THEN
HIST(K,L)=0.
ELSE
HIST(K,L)=X*LOG10(Y*HIST(I,L))
ENDIF
ELSEIF(OPER.EQ.'M') THEN
IF(I.NE.J) XNORM=HIST(I,L)
IF(I.EQ.J) XNORM=FLOAT(IHIS(J,L))
IF(XNORM.NE.0.) THEN
XAVG=HIST(J,L)/XNORM
HIST(K,L)=
& SQRT(ABS(-XAVG**2+HIST(K,L)/XNORM)/FLOAT(IHIS(I,L)))
HIST(J,L)=XAVG
ELSE
HIST(K,L)=0.
HIST(J,L)=0.
ENDIF
ELSEIF(OPER.EQ.'V') THEN
XAVG=HIST(I,L)*X
XSQAVG=HIST(J,L)*X
XNORM=FLOAT(IHIS(I,L))*X
IF(XNORM.NE.0.) THEN
HIST(K,L)=SQRT(ABS(XSQAVG-XAVG**2)/XNORM)
HIST(I,L)=XAVG
ELSE
HIST(K,L)=0.
ENDIF
ELSE
CALL PWHGWARN('PWHGOPERA')
WRITE(*,*) OPER
5 FORMAT(' ****** OPERATION ="',A1,'" UNKNOWN ********'/)
STOP
ENDIF
ENDDO
IF(OPER.EQ.'+') THEN
USCORE(K)=X*USCORE(I) + Y*USCORE(J)
OSCORE(K)=X*OSCORE(I) + Y*OSCORE(J)
ELSEIF(OPER.EQ.'-') THEN
USCORE(K)=X*USCORE(I) - Y*USCORE(J)
OSCORE(K)=X*OSCORE(I) - Y*OSCORE(J)
ELSEIF(OPER.EQ.'*') THEN
USCORE(K)=X*USCORE(I) * Y*USCORE(J)
OSCORE(K)=X*OSCORE(I) * Y*OSCORE(J)
ELSEIF(OPER.EQ.'/') THEN
IF(Y.EQ.0..OR.USCORE(J).EQ.0.) THEN
USCORE(K)=0.
ELSE
USCORE(K)=X*USCORE(I) / (Y*USCORE(J))
ENDIF
IF(Y.EQ.0..OR.OSCORE(J).EQ.0.) THEN
OSCORE(K)=0.
ELSE
OSCORE(K)=X*OSCORE(I) / (Y*OSCORE(J))
ENDIF
ELSEIF(OPER.EQ.'F') THEN
USCORE(K)=X*USCORE(I)
OSCORE(K)=X*OSCORE(I)
ELSEIF(OPER.EQ.'R') THEN
IF(USCORE(I).GT.0.) THEN
USCORE(K)=X*SQRT(USCORE(I))
ELSE
USCORE(K)=0.
ENDIF
IF(OSCORE(I).GT.0.) THEN
OSCORE(K)=X*SQRT(OSCORE(I))
ELSE
OSCORE(K)=0.
ENDIF
ELSEIF(OPER.EQ.'S') THEN
USCORE(K)=X*USCORE(I)**2
OSCORE(K)=X*OSCORE(I)**2
ELSEIF(OPER.EQ.'L') THEN
IF(USCORE(I).EQ.0..OR.J.EQ.0.) THEN
USCORE(K)=0.
ELSE
USCORE(K)=X*LOG10(Y*USCORE(I))
ENDIF
IF(OSCORE(I).EQ.0..OR.J.EQ.0.) THEN
OSCORE(K)=0.
ELSE
OSCORE(K)=X*LOG10(Y*OSCORE(I))
ENDIF
ENDIF
ENDIF
RETURN
END
SUBROUTINE PWHGZERO(N)
implicit none
include 'pwhg_book.h'
integer i,n
BOOK(N)='RES'
IENT(N)=0
IUSCORE(N)=0
IOSCORE(N)=0
HAVG(N)=0.
HINT(N)=0.
DO 1 I=1,NBIN(N)
1 HIST(N,I)=0
END
SUBROUTINE PWHGRESET(N)
implicit none
integer n
include 'pwhg_book.h'
BOOK(N)='RES'
END
SUBROUTINE PWHGPUTTAG(J,NAME)
implicit none
include 'pwhg_book.h'
integer j
c Per marcare un istogramma
CHARACTER * (*) NAME, TAG
BOOK(J) = NAME
RETURN
ENTRY pwhgGETTAG(J,TAG)
TAG = BOOK(J)
END
SUBROUTINE PWHGFINAL(N)
implicit none
integer n
real * 8 avg,xin,sig,x
integer j,if
include 'pwhg_book.h'
AVG=0
XIN=0
SIG=0
IF=0
DO J=1,NBIN(N)
X=HIST(N,J)
AVG=AVG+X*XHIS(N,J)
XIN=XIN+X
IF(X.NE.0) IF=1
ENDDO
IF(XIN.EQ.0) GO TO 10
AVG = AVG/XIN
DO J=1,NBIN(N)
SIG=HIST(N,J)*(XHIS(N,J)-AVG)**2+SIG
ENDDO
SIG=SQRT(ABS(SIG/XIN))
10 CONTINUE
HINT(N) = XIN
HAVG(N) = AVG
HSIG(N) = SIG
IF(IF.EQ.0) BOOK(N)='RES'
END
SUBROUTINE PWHGNORM(N,X)
implicit none
integer n,i
real * 8 x,y
include 'pwhg_book.h'
IF(BOOK(N).NE.'YES')RETURN
IF(HINT(N).EQ.0.) THEN
CALL PWHGWARN('PWHGNORM')
WRITE(*,*)' INTEGRAL HIST ',N,' IS ZERO: CANNOT RENORMALIZE'
RETURN
ELSE
Y=X/HINT(N)
ENDIF
DO 1, I=1,NBIN(N)
1 HIST(N,I)=HIST(N,I)*Y
HINT(N)=X
OSCORE(N)=OSCORE(N)*Y
USCORE(N)=USCORE(N)*Y
END
SUBROUTINE PWHGPRINT(N)
implicit none
include 'pwhg_book.h'
integer ini,imon,iday,iyear,n,j,itime(3)
save imon,iday,iyear,ctime,ini
character * 8 ctime
DATA INI/0/
data ctime/' '/
IF(INI.EQ.0) THEN
c CALL IDATE(IMON,IDAY,IYEAR) ! not y2k compliant
CALL IDATE(ITIME)
imon=itime(2)
iday=itime(1)
iyear=itime(3)
c CALL TIME(CTIME)
INI=1
ENDIF
IF(BOOK(N).NE.'YES') RETURN
WRITE(98,7) N,IDAY,IMON,IYEAR,CTIME(1:3)
WRITE(98,*) TITLE(N)
DO 1 J=1,NBIN(N)
IF(HIST(N,J).EQ.0.) GO TO 1
WRITE(98,'(3X,F10.4,2X,E15.4)')
& XHIS(N,J),HIST(N,J)
1 CONTINUE
WRITE(98,15) HAVG(N),HSIG(N),HINT(N)
WRITE(98,20) IENT(N),IUSCORE(N),IOSCORE(N)
7 FORMAT(4X,'HIST = ',I3,' ',I2,'/',I2,'/',I4,1X,A5/)
10 FORMAT(4X,2E10.3)
15 FORMAT(/' AVG =',E10.3,4X,' RMS =',E10.3,' INTEGRAL =',E10.3,/)
20 FORMAT(' ENTRIES=',I5,4X,'UNDERSCORE=',I5,4x,'OVERSCORE=',I5,//)
END
SUBROUTINE PWHGTOP(N,M,BTIT,LTIT,SCALE)
implicit none
include 'pwhg_book.h'
integer imon,iday,iyear,ini,n,m,j,itime(3)
CHARACTER CTIME*8
CHARACTER*(*) LTIT,BTIT,SCALE
save imon,iday,iyear,ctime,ini
DATA INI/0/
data ctime/' '/
IF(INI.EQ.0) THEN
c CALL IDATE(IMON,IDAY,IYEAR) ! not y2k compliant
CALL IDATE(ITIME)
imon=itime(2)
iday=itime(1)
iyear=itime(3)
c CALL TIME(CTIME)
INI=1
ENDIF
IF(BOOK(N).NE.'YES') RETURN
WRITE(99,100) TITLE(N),BTIT,LTIT,SCALE,HMIN(N),HMAX(N)
100 FORMAT( /1x,
&' SET WINDOW Y 2.5 TO 9.'/,1X,
&' SET WINDOW X 2.5 TO 10.'/,1X,
&'(SET FONT SIMPLEX '/1X,
&' SET SYMBOL 5O SIZE 1.8'/,1X,
&' TITLE TOP ','"',A,'"',/1X,
&' TITLE BOTTOM ','"',A,'"',/1X,
&' TITLE LEFT ','"',A,'"',/1X,
&' SET SCALE Y ',A,/1X,
&' (SET TICKS TOP OFF) '/1x,
&' SET LIMITS X ',F10.5,' ',F10.5,/1X,
&' SET ORDER X Y DY ')
DO 1 J=1,NBIN(N)
IF(HIST(N,J).EQ.0.) GO TO 1
WRITE(99,'(3X,F10.4,2(2X,E15.4))')
& XHIS(N,J),HIST(N,J),HIST(M,J)
1 CONTINUE
WRITE(99,200)
200 FORMAT(' HIST')
WRITE(99,300) HINT(N),HAVG(N),HSIG(N),IENT(N),IUSCORE(N)
& ,IOSCORE(N),USCORE(N),OSCORE(N),IDAY,IMON,IYEAR,CTIME(1:3)
300 FORMAT( /1x,
&' BOX 6.25 0.9 SIZE 7.5 1.2'/,1X,
&' SET WINDOW Y 0. TO 2.'/,1X,
&' SET TITLE SIZE -1.5'/1X,
&'(SET FONT SIMPLEX '/1X,
&' TITLE 2.8 1.2 "INT =',1PE10.3,' AVG =',1PE10.3,
& ' RMS =',1PE10.3,'"',/1X,
&' TITLE 2.8 0.9 "Entries =',I8,2x,'Undersc =',I6,2X
& ,'Oversc =',I6,'"',/1X,
&' TITLE 2.8 0.6 "Ufloat=',1PE10.3,' Ofloat=',
& 1PE10.3,'"',/1X,
&' TITLE 7.5 0.6 "',I2,'/',I2,'/',I4,2X,A5,'"',/1X,
&' SET TITLE SIZE -2')
WRITE(99,400)
400 FORMAT(' NEW PLOT')
END
SUBROUTINE PWHGMNRTOP(N,M,BTIT,LTIT,SCALE)
implicit none
include 'pwhg_book.h'
integer imon,iday,iyear,ini,n,m,j,itime(3)
CHARACTER CTIME*8
CHARACTER*(*) LTIT,BTIT,SCALE
save imon,iday,iyear,ctime,ini
DATA INI/0/
data ctime/' '/
IF(INI.EQ.0) THEN
c CALL IDATE(IMON,IDAY,IYEAR)
CALL IDATE(ITIME)
imon=itime(2)
iday=itime(1)
iyear=itime(3)
c CALL TIME(CTIME)
INI=1
ENDIF
CALL PWHGFINAL(N)
WRITE(99,100) TITLE(N)(1:20),BTIT,LTIT,SCALE,HMIN(N),HMAX(N)
100 FORMAT( /1x,
&' SET WINDOW Y 2.5 TO 7.'/,1X,
&' SET WINDOW X 2.5 TO 10.'/,1X,
&'(SET FONT DUPLEX '/1X,
&' SET SYMBOL 5O SIZE 1.8'/,1X,
&' TITLE TOP ','"',A,'"',/1X,
&' TITLE BOTTOM ','"',A,'"',/1X,
&' TITLE LEFT ','"',A,'"',/1X,
&' SET SCALE Y ',A,/1X,
&' (SET TICKS TOP OFF) '/1x,
&' SET LIMITS X ',F10.5,' ',F10.5,/1X,
&' SET ORDER X Y DY ')
DO 1 J=1,NBIN(N)
WRITE(99,'(3X,F10.4,2(2X,E10.3))')
& XHIS(N,J),HIST(N,J),HIST(M,J)
1 CONTINUE
WRITE(99,200)
200 FORMAT(' PLOT')
WRITE(99,300) HINT(N),HAVG(N),HSIG(N),IENT(N),IUSCORE(N)
& ,IOSCORE(N),USCORE(N),OSCORE(N),IDAY,IMON,IYEAR,CTIME(1:3)
300 FORMAT( /1x,
&' BOX 6.25 0.9 SIZE 7.5 1.2'/,1X,
&' SET WINDOW Y 0. TO 2.'/,1X,
&' SET TITLE SIZE -1.5'/1X,
&'(SET FONT SIMPLEX '/1X,
&' TITLE 2.8 1.2 "INT =',1PE10.3,' AVG =',1PE10.3,
& ' RMS =',1PE10.3,'"',/1X,
&' TITLE 2.8 0.9 "Entries =',I9,2x,'Usc =',I8,2X
& ,'Osc =',I8,'"',/1X,
&' TITLE 2.8 0.6 "Ufloat=',1PE10.3,' Ofloat=',
& 1PE10.3,'"',/1X,
&' TITLE 7.5 0.6 "',I2,'/',I2,'/',I4,2X,A5,'"',/1X,
&' SET TITLE SIZE -2')
WRITE(99,400)
400 FORMAT(' NEW PLOT')
END
SUBROUTINE PWHGBOOK2(N,TIT,DELX,XMIN,XMAX,DELY,YMIN,YMAX)
implicit real * 8 (a-h,o-z)
include 'pwhg_book.h'
CHARACTER*(*) TIT
NHIST2=MAX(N,NHIST2)
TITLE2(N)=' '//TIT
BOOK2(N)='YES'
C-- setup x-boundaries
HDEL2(1,N)=DELX
HMIN2(1,N)=XMIN
HMAX2(1,N)=XMAX
NBIN2(1,N)=INT((XMAX-XMIN)/DELX)
C-- setup y-boundaries
HDEL2(2,N)=DELY
HMIN2(2,N)=YMIN
HMAX2(2,N)=YMAX
NBIN2(2,N)=INT((YMAX-YMIN)/DELY)
IENT2(N)=0
IOSCORE2(N)=0
HAVG2(1,N)=0.
HAVG2(2,N)=0.
HINT2(N)=0.
DO 1 I=1,NBIN2(1,N)
XHIS2(N,I)=HMIN2(1,N)+HDEL2(1,N)*(FLOAT(I)-0.5D0)
1 CONTINUE
DO 2 I=1,NBIN2(2,N)
YHIS2(N,I)=HMIN2(2,N)+HDEL2(2,N)*(FLOAT(I)-0.5D0)
2 CONTINUE
DO 3 I=1,NBIN2(1,N)
DO 3 J=1,NBIN2(2,N)
HIST2(N,I,J)=0.
3 CONTINUE
END
SUBROUTINE PWHGFILL2(N,X,Y,WGT)
implicit real * 8 (a-h,o-z)
include 'pwhg_book.h'
C-- find x-coordinate
XI=((X-HMIN2(1,N))/HDEL2(1,N))+1.
IF(XI.GT.100.OR.XI.LT.0.) THEN
IOSCORE2(N)=IOSCORE2(N)+1
RETURN
ENDIF
I=INT(XI)
C-- find y-coordinate
YI=((Y-HMIN2(2,N))/HDEL2(2,N))+1.
IF(YI.GT.100.OR.YI.LT.0.) THEN
IOSCORE2(N)=IOSCORE2(N)+1
RETURN
ENDIF
J=INT(YI)
IF(I.GT.0.AND.I.LE.NBIN2(1,N).AND.J.GT.0.AND.J.LE.NBIN2(2,N))
* THEN
IENT2(N)=IENT2(N)+1
IHIS2(N,I,J)=IHIS2(N,I,J)+1
HIST2(N,I,J)=HIST2(N,I,J)+WGT
ELSE
IOSCORE2(N)=IOSCORE2(N)+1
ENDIF
END
SUBROUTINE PWHGOPERA2(I,OPER,J,K,X,Y)
implicit real * 8 (a-h,o-z)
include 'pwhg_book.h'
CHARACTER OPER*1
IF(NBIN2(1,I).NE.NBIN2(1,J).OR.NBIN2(2,I).NE.NBIN2(2,J).
&AND.(OPER.EQ.'+'.OR.OPER.EQ.'-'.OR.OPER.EQ.
&'*'.OR.OPER.EQ.'/'.OR.OPER.EQ.'M')) GO TO 10
DO L1=1,NBIN2(1,I)
DO L2=1,NBIN2(2,I)
IF(OPER.EQ.'+') THEN
HIST2(K,L1,L2)=X*HIST2(I,L1,L2) + Y*HIST2(J,L1,L2)
ELSEIF(OPER.EQ.'-') THEN
HIST2(K,L1,L2)=X*HIST2(I,L1,L2) - Y*HIST2(J,L1,L2)
ELSEIF(OPER.EQ.'*') THEN
HIST2(K,L1,L2)=X*HIST2(I,L1,L2) * Y*HIST2(J,L1,L2)
ELSEIF(OPER.EQ.'/') THEN
IF(Y.EQ.0..OR.HIST2(J,L1,L2).EQ.0.) THEN
HIST2(K,L1,L2)=0.
ELSE
HIST2(K,L1,L2)=X*HIST2(I,L1,L2) / (Y*HIST2(J,L1,L2))
ENDIF
ELSEIF(OPER.EQ.'F') THEN
HIST2(K,L1,L2)=X*HIST2(I,L1,L2)
ELSEIF(OPER.EQ.'R') THEN
IF(HIST2(I,L1,L2).GT.0.) THEN
HIST2(K,L1,L2)=X*SQRT(HIST2(I,L1,L2))
ELSE
HIST2(K,L1,L2)=0.
ENDIF
ELSEIF(OPER.EQ.'S') THEN
HIST2(K,L1,L2)=X*HIST2(I,L1,L2)**2
ELSEIF(OPER.EQ.'L') THEN
IF(HIST2(I,L1,L2).EQ.0..OR.J.EQ.0.) THEN
HIST2(K,L1,L2)=0.
ELSE
HIST2(K,L1,L2)=X*LOG10(Y*HIST2(I,L1,L2))
ENDIF
ELSE
WRITE(98,5) OPER
5 FORMAT(' ****** OPERATION ="',A1,'" UNKNOWN ********'/)
RETURN
ENDIF
END DO
ENDDO
RETURN
10 WRITE(98,20) I,J
20 FORMAT(' ****** INCOMPATIBLE OPERATION HIST2 ',I2,' &',I2,
& '*******'/)
END
SUBROUTINE PWHGFINAL2(N)
implicit real * 8 (a-h,o-z)
include 'pwhg_book.h'
IF(BOOK2(N).NE.'YES') RETURN
XIN=0.
C-- projection on the x-axis
DO 2 I=1,NBIN2(1,N)
DO 1 J=1,NBIN2(2,N)
1 XPROJ(N,I)=XPROJ(N,I)+HIST2(N,I,J)
2 XIN=XIN+XPROJ(N,I)
IF(XIN.EQ.0.) GO TO 10
C-- projection on the y-axis
DO 3 J=1,NBIN2(2,N)
DO 3 I=1,NBIN2(1,N)
3 YPROJ(N,J)=YPROJ(N,J)+HIST2(N,I,J)
HINT2(N)=XIN
RETURN
10 BOOK2(N)=' NO'
END
SUBROUTINE PWHGPROHIS(N,M,IAX)
C-- projects the scatter plot N onto the IAX axis (x,y->IAX=1,2) and
C put the contents in histogram M, after automatically booking it.
implicit real * 8 (a-h,o-z)
include 'pwhg_book.h'
BOOK(M)='YES'
NBIN(M)=NBIN2(IAX,N)
HDEL(M)=HDEL2(IAX,N)
HMIN(M)=HMIN2(IAX,N)
HMAX(M)=HMAX2(IAX,N)
NHIST=MAX(NHIST,M)
TITLE(M)=TITLE2(N)//'(PROJ)'
DO I=1,NBIN(M)
IF(IAX.EQ.1) THEN
HIST(M,I)=XPROJ(N,I)
XHIS(M,I)=XHIS2(N,I)
ELSEIF(IAX.EQ.2) THEN
HIST(M,I)=YPROJ(N,I)
XHIS(M,I)=YHIS2(N,I)
ENDIF
ENDDO
END
SUBROUTINE PWHGNORM2(N,X)
implicit real * 8 (a-h,o-z)
include 'pwhg_book.h'
IF(BOOK2(N).NE.'YES')RETURN
DO 1, I=1,NBIN2(1,N)
DO 1, J=1,NBIN2(2,N)
1 HIST2(N,I,J)=HIST2(N,I,J)/HINT2(N)*X
HINT2(N)=X
END
SUBROUTINE PWHGPRINT2(N)
implicit real * 8 (a-h,o-z)
include 'pwhg_book.h'
integer imon,iday,iyear,ini,itime(3)
CHARACTER CTIME*8
save imon,iday,iyear,ctime,ini
DATA INI/0/
data ctime/' '/
IF(INI.EQ.0) THEN
c CALL IDATE(IMON,IDAY,IYEAR)
CALL IDATE(ITIME)
imon=itime(2)
iday=itime(1)
iyear=itime(3)
c CALL TIME(CTIME)
INI=1
ENDIF
IF(BOOK2(N).NE.'YES') RETURN
WRITE(98,7) N,IDAY,IMON,IYEAR,CTIME(1:3)
WRITE(98,*) TITLE2(N)
WRITE(98,10) ((XHIS2(N,I),YHIS2(N,J),HIST2(N,I,J),J=1,NBIN2(2,N))
* ,I=1,NBIN2(1,N))
WRITE(98,20) IENT2(N),HINT2(N),IOSCORE2(N)
7 FORMAT(4X,'HIST = ',I3,' ',I2,'/',I2,'/',I4,1X,A5/)
10 FORMAT(4X,3E10.3)
20 FORMAT(' ENTRIES=',I5,4X,' INTEGRAL =',E10.3,4x,
* 'OVERSCORE=',I5,//)
END
c$$$ SUBROUTINE PWHGTOP2(N,BTIT,LTIT,PLOPT)
c$$$ implicit real * 8 (a-h,o-z)
c$$$ include 'pwhg_book.h'
c$$$ CHARACTER CTIME*8
c$$$ integer imon,iday,iyear,ini,iseed,itime(3)
c$$$ CHARACTER*(*) LTIT,BTIT,PLOPT
c$$$ save imon,iday,iyear,ctime,ini,iseed
c$$$ real * 8 random
c$$$ DATA INI/0/
c$$$ IF(INI.EQ.0) THEN
c$$$ ISEED=1
c$$$c CALL IDATE(IMON,IDAY,IYEAR)
c$$$ CALL IDATE(ITIME)
c$$$ imon=itime(2)
c$$$ iday=itime(1)
c$$$ iyear=itime(3)
c$$$c CALL TIME(CTIME)
c$$$ INI=1
c$$$ ENDIF
c$$$ IF(BOOK2(N).NE.'YES') RETURN
c$$$ WRITE(99,100) TITLE2(N),BTIT,LTIT,HMIN2(1,N),HMAX2(1,N),
c$$$ * HMIN2(2,N),HMAX2(2,N)
c$$$ 100 FORMAT( /1x,
c$$$ &' SET WINDOW Y 2.5 TO 9.'/,1X,
c$$$ &' SET WINDOW X 2.5 TO 10.'/,1X,
c$$$ &'(SET FONT SIMPLEX '/1X,
c$$$ &' TITLE TOP ','"',A,'"',/1X,
c$$$ &' TITLE BOTTOM ','"',A,'"',/1X,
c$$$ &' TITLE LEFT ','"',A,'"',/1X,
c$$$ &' (SET TICKS TOP OFF) '/1x,
c$$$ &' SET LIMITS X ',F10.5,' ',F10.5,/1X,
c$$$ &' SET LIMITS Y ',F10.5,' ',F10.5,/1X,
c$$$ &' SET ORDER X Y ')
c$$$
c$$$C-- squares with area proportional to the bin weight
c$$$ IF(PLOPT.EQ.'BOX') THEN
c$$$ DO 1, I=1,NBIN2(1,N)
c$$$ DO 1, J=1,NBIN2(2,N)
c$$$ SCMAX=MAX(SCMAX,HIST2(N,I,J))
c$$$ 1 CONTINUE
c$$$ SCMAX=0.8*SCMAX
c$$$ DO 2, I=1,NBIN2(1,N)
c$$$ DO 2, J=1,NBIN2(2,N)
c$$$ IF(HIST2(N,I,J).EQ.0.) GO TO 2
c$$$ WRITE(99,200) XHIS2(N,I),YHIS2(N,J),HIST2(N,I,J)/SCMAX*0.3
c$$$ 2 CONTINUE
c$$$ 200 FORMAT(2X,'BOX',F14.8,2X,F14.8,3X,'DATA SIZE',F14.8)
c$$$ WRITE(99,300)
c$$$ 300 FORMAT(' PLOT')
c$$$ WRITE(99,400) HINT2(N),IENT2(N)
c$$$ & ,IOSCORE2(N),IDAY,IMON,IYEAR,CTIME(1:5)
c$$$ 400 FORMAT( /1x,
c$$$ &' BOX 6.25 1.0 SIZE 7.5 1.'/,1X,
c$$$ &' SET WINDOW Y 0. TO 2.'/,1X,
c$$$ &' SET TITLE SIZE -1.5'/1X,
c$$$ &'(SET FONT SIMPLEX '/1X,
c$$$ &' TITLE 2.8 1.2 "INT =',1PE10.3,' Entries =',I8,2x
c$$$ & ,'Oversc =',I6,'"',/1X,
c$$$ &' TITLE 2.8 0.8 "',I2,'/',I2,'/',I4,2X,A5,'"'/1X,
c$$$ &' SET TITLE SIZE -2')
c$$$ WRITE(99,500)
c$$$ 500 FORMAT(' NEW PLOT')
c$$$
c$$$C-- dots - as many as the value of HINT2(n), distributed according to wgt
c$$$ ELSEIF(PLOPT.EQ.'DOT') THEN
c$$$ WRITE(99,*) ' SET INTENSITY 3'
c$$$ DO 3, I=1,NBIN2(1,N)
c$$$ DO 3, J=1,NBIN2(2,N)
c$$$ IF(HIST2(N,I,J).EQ.0.) GO TO 3
c$$$ NDOTS=INT(HIST2(N,I,J))
c$$$ RN=RANdom()
c$$$ REST=HIST2(N,I,J)-FLOAT(NDOTS)
c$$$ IF(RN.LT.REST) NDOTS=NDOTS+1
c$$$ DO ND=1,NDOTS
c$$$ X=XHIS2(N,I)+(2.*RANdom()-1.)*HDEL2(1,N)
c$$$ Y=YHIS2(N,J)+(2.*RANdom()-1.)*HDEL2(2,N)
c$$$ WRITE(99,*) X,Y
c$$$ ENDDO
c$$$ NTOT=NTOT+NDOTS
c$$$ 3 CONTINUE
c$$$ WRITE(99,*) ' SET INTENSITY 1'
c$$$ WRITE(99,300)
c$$$ WRITE(99,600) HINT2(N),IENT2(N),NTOT
c$$$ & ,IDAY,IMON,IYEAR,CTIME(1:5)
c$$$ 600 FORMAT( /1x,
c$$$ &' BOX 6.25 1.0 SIZE 7.5 1.'/,1X,
c$$$ &' SET WINDOW Y 0. TO 2.'/,1X,
c$$$ &' SET TITLE SIZE -1.5'/1X,
c$$$ &'(SET FONT SIMPLEX '/1X,
c$$$ &' TITLE 2.8 1.2 "INT =',1PE10.3,' Entries =',I8,2x
c$$$ & ,'Points =',I6,'"',/1X,
c$$$ &' TITLE 2.8 0.8 "',I2,'/',I2,'/',I4,2X,A5,'"'/1X,
c$$$ &' SET TITLE SIZE -2')
c$$$ WRITE(99,500)
c$$$
c$$$ ENDIF
c$$$ END
SUBROUTINE PWHGMULTITOP(NH,NE,N,M,BTIT,LTIT,SCA,INI)
implicit none
include 'pwhg_book.h'
CHARACTER CTIME*8,SCALE*3
CHARACTER*(*) LTIT,BTIT,SCA
CHARACTER*7 PLOT(4)
REAL * 8 LAB0,LABS,WIDTH,HEIGHT,XCORN,YCORN,XPFRAC,YPFRAC,
#TIT0,TIC0,tits,tics,xtit0,xd,sred,yd,ytit0,xl,yl
#,xu,yu,fmn,fmx,xmx,x,fmin,fmax,fexp,xtit,ytit
integer imon,iday,iyear,ini,iframe,nh,ne,n,m,ifrmax,nold,mold
#,i,j,ns,ip,ibin,itime(3)
save imon,iday,iyear,ctime
c,ini